Skip to content

Releases: rekurt/ymsdk

v0.2.0

Choose a tag to compare

@github-actions github-actions released this 02 Sep 12:52
507511a

Installation

go get github.com/rekurt/ymsdk@v0.2.0

Changes

Added

  • Complete API coverage: all 28 documented Bot API endpoints. New in this
    release — messages/pin, unpin, sendReaction, getReactions,
    sendSticker, sendSystemMessage, sendTyping, shareFile, shareImage,
    shareGallery, chats/get, chats/getChat, chats/getMembers, self/get
  • Message editing via EditText and SendMessageOptions.MessageID, plus the
    previously missing reply_quote, forwards and action_buttons parameters
  • ym.Target with ChatTarget, LoginTarget and UserIDTarget, covering the
    user_id recipient form the SDK could not express
  • Automatic payload_id idempotency keys, so a retried send cannot deliver the
    same message twice; opt out with Config.DisableAutoPayloadID
  • updates.Run, which backs off and retries failed polls instead of ending the
    loop, with per-error policies and optional panic recovery
  • updates.NewWebhookHandler: acknowledges within the API's 1s budget,
    processes on a worker pool, and drops the repeats that at-least-once delivery
    guarantees
  • Types the update schema needs: Reaction, ReactionEvent, ReactionsPage,
    ChatMembersUpdate, ChatInfo, ChatMetaData, ChatMember, Forward,
    ActionButtons, BotSettings
  • Text formatting helpers — EscapeMarkdown, Bold, Italic, Strikethrough,
    Underline, Code, CodeBlock, Link
  • Local validation of the documented API limits, reported as *ym.LimitError
  • Retry back-off jitter, a User-Agent identifying the SDK, and
    ym.SleepContext
  • Endpoint path constants in client/ym/endpoints.go
  • LLM skill for using the SDK: skills/ymsdk/, plus AGENTS.md, GEMINI.md,
    Cursor, Copilot and Windsurf adapters
  • messages.SendFileRequest.MimeType — overrides the Content-Type of the
    uploaded document part, replacing files.SendFileOptions.MimeType
  • Full documented parameter coverage for sendText, sendFile, sendImage and
    sendGallery: message_id (edit), reply_message_id, reply_quote,
    forwards, disable_notification, important and action_buttons. Every
    send method now accepts the same shared set instead of a per-method subset.
  • ym.Forward, ym.ActionButtons, ym.ActionButton, ym.ActionButtonIcon and
    the ym.Icon* / ym.ActionButtonIconType constants
  • Send methods now surface the parts of the response they used to drop:
    sendFile returns file_id in Message.Document, sendImage returns
    file_id plus dimensions in Message.Image, and sendGallery returns the
    per-image results in Message.Gallery
  • Client-side enforcement of documented constraints, so an invalid combination
    fails before a request is spent: reply_quote requires reply_message_id,
    forwards cannot be combined with reply_message_id, at most 6 action
    buttons, at most 100 suggest buttons, gallery text at most 6000 characters
  • ym.SuggestButtons now emits the button array in the shape its layout
    requires: a flat array for layout: "false" and a nested one for
    layout: "true". Rows carry no meaning in the flat layout, so they are
    concatenated in order rather than dropped. UnmarshalJSON accepts both
    shapes, so a value survives a round trip through its own output.
  • ym.SuggestLayoutFlat and ym.SuggestLayoutRows constants — the Bot API
    spells the layout as the strings "false" and "true", not as booleans

Removed

  • BREAKING: client/ym/files package and the YMClient.Files field. The
    service parsed a {"ok":true,"message":{...}} response that the Bot API never
    sends — sendFile answers with flat {"ok":true,"message_id":N,"file_id":"..."}
    so files.SendToChat and files.SendToLogin could never succeed against the
    live API. Its tests passed only against a fabricated response shape. The
    package also carried an undocumented caption field that the server silently
    discarded; removing the package supersedes the deprecation from a8c89f8. Use
    messages.SendFile, which now also carries the MimeType override the files
    service provided.

Fixed

  • CI and release builds now use Go 1.25.14 instead of 1.25.3, bringing in the
    latest standard-library security fixes. govulncheck is now blocking in both
    pipelines, so a vulnerable build cannot be published behind a green check.
  • CI and release workflows now use current GitHub Actions releases backed by
    the supported Node.js runtime.
  • Dead fallback lookup in getRequestID. http.Header.Get canonicalises its
    argument, so "X-Request-Id" and "X-Request-ID" address the same entry and
    the second lookup could never find what the first one missed. Collapsed to one
    lookup; behaviour is unchanged. Also clears the canonicalheader lint finding.
  • Retries could duplicate messages. The API documents payload_id as an
    idempotency key; the client never sent one, so a sendText retried after a
    timeout or a 500 delivered the message twice
  • A single incoming image broke the bot. Update.Images was declared as a
    flat []Image while the API sends Image[][] — one list of size variants per
    image. Decoding failed, and since one decode error rejects the whole response,
    every update in that batch was lost; PollLoop then stopped the bot
  • Incoming files were silently dropped. The API field is file; the SDK
    read document, so Update.Document was always nil
  • A single API error killed the bot. PollLoop returned on the first error
    of any kind
  • Cancellation was ignored during back-off. time.Sleep kept a shutting-down
    bot blocked for the full delay, up to MaxBackoff
  • The webhook example could not have worked. It required a header the API
    never sends, decoded a single update where the API sends a batch, and replied
    inline well past the 1s budget
  • Header injection through filenames. sanitizeFilename left CR and LF
    intact, so a filename could inject MIME headers into a multipart part
  • GetFile could return a drained, closed body that read as an empty file
  • A refused webhook delivery was acknowledged and lost. The update was
    recorded in the dedup window before the enqueue succeeded, so the redelivery
    the 503 asked for was skipped as a duplicate and answered 200. Refused
    updates are now rolled back out of the window
  • Shutdown could panic a serving goroutine with send on closed channel
    when it raced an in-flight delivery; new deliveries are now refused before
    the queue is closed
  • GetChat accepted a payload with no id. The absent- and null-payload
    guards did not reach inside the object, so {"data":{}} unmarshalled cleanly
    into a chat with no identity and a nil error
  • SendTyping sent unsupported display values. The check compared against
    the empty string although its own error already said only default and
    text are valid
  • Validation sentinels were scattered across service packages. Sixteen
    public Err… values sat beside the services that returned them, so matching
    one with errors.Is meant importing messages, chats and ym separately.
    They are all in ymerrors now — done before the release, since a published
    sentinel cannot move without breaking imports or keeping an alias forever. A
    source-level test now fails if a sentinel is declared anywhere else
  • A dropped connection lost the delivery. A body that could not be read
    answered 400, which the API treats as final, so an interrupted or truncated
    delivery was never redelivered. It is 503 now; 400 is reserved for a body
    that arrived whole and still would not parse
  • SendTyping sent unsupported indicator types. The type discriminator
    was passed through unchecked, so ym.TypingType("bogus") reached the API as
    the discriminator. Reported by review one field over from the display fix
  • GetMembers sent unsupported role filters. role documents exactly
    three values, and an unrecognised one travelled to the API in the query
    string. Found by auditing every string enum that reaches a request
  • GetUserLink returned links that go nowhere. id, chat_link and
    call_link are all documented as required, but a response omitting them
    produced empty strings and a nil error. Found while auditing the other
    single-object decoders rather than in review
  • A large delivery was truncated and then permanently dropped. The body was
    read through a LimitReader capped at 8 MiB, which truncates silently; the
    remainder failed to parse and answered 400, which the API treats as final. The
    documented maxima reach past that cap — 1000 updates of 6000 characters is
    11 MiB in Cyrillic — so ordinary Russian-language traffic could be lost. The
    cap is now 32 MiB, configurable through MaxBodyBytes, and an oversized body
    answers 503 so the API sends it again
  • A dedup window narrower than a delivery could let updates run twice.
    Admitting a batch evicted ids from that same batch; if it then hit a full
    queue and answered 503, the API redelivered all of it and the evicted prefix
    was processed again. A positive window is now raised to hold a full delivery
  • SendTyping sent processing content with an empty display. The zero value
    of ProcessingContent leaves the discriminator blank, which is the shape a
    caller writes by accident most easily, and the API cannot act on it
  • self/get returned a bot with no identity. A response missing the
    required id produced a zero-valued BotSelf and a nil error. That decoder
    escaped the earlier sweep because it uses a named type rather than an inline
    struct
  • Run ignored Retry-After when retrying a throttled poll. Because the
    client makes a single attempt by default, the 429 surfaced to the loop, which
    then slept its own back-off — one second where the server had asked for sixty,
    prolonging the throttling. The server's instruction now wins, subject to the
    clien...
Read more

v0.1.1

Choose a tag to compare

@rekurt rekurt released this 08 Apr 08:30
e2844ce

Installation

go get github.com/rekurt/ymsdk@v0.1.1

Changes

  • Merge pull request #9 from rekurt/claude/stupefied-mendel
  • docs: add ready-to-use promotional materials
  • docs: add example tests, Codecov, and CHANGELOG
  • Merge pull request #8 from rekurt/claude/stupefied-mendel
  • docs: improve repository SEO and discoverability

What's Changed

  • docs: improve repository SEO and discoverability by @rekurt in #8
  • docs: add example tests, Codecov integration, and CHANGELOG by @rekurt in #9

Full Changelog: v0.1.0...v0.1.1

v0.1.0

Choose a tag to compare

@rekurt rekurt released this 08 Apr 00:22
2f51cd7

Installation

go get github.com/rekurt/ymsdk@v0.1.0

Changes

  • Merge pull request #7 from rekurt/claude/project-analysis-improvements-Or2B9
  • Add coverage.out to .gitignore
  • Improve error handling, add interactive button types, consolidate retry logic, and fix thread safety
  • Merge pull request #6 from rekurt/fix/examples
  • docs: update documentation and enrich examples with graceful shutdown and richer SDK usage
  • Merge branch 'master' into feat/fix-webhook-example-unauthenticated-updates
  • Add CLAUDE and middleware docs
  • Merge pull request #3 from rekurt/feat/fix-nil-dereference-in-tomessage
  • Harden webhook example request validation
  • Fix Update.ToMessage nil dereference on missing fields
  • Merge pull request #2 from rekurt/feat/improve
  • remove CONTRIBUTING.md and references
  • deduplicate retry logic, add comprehensive tests, improve examples
  • Merge pull request #1 from rekurt/claude/improve-library-docs-Y0X5r
  • make govulncheck informational (continue-on-error)
  • fix all lint issues and set up professional CI/CD
  • improve documentation, code quality, and release infrastructure
  • add structured logging, debugging utilities, HTTP logging wrapper, and message parsing updates

What's Changed

  • Add comprehensive documentation and development guidelines by @rekurt in #1
  • deduplicate retry logic, add comprehensive tests, improve examples by @rekurt in #2
  • Guard Update.ToMessage against nil Chat/From to prevent panic by @rekurt in #3
  • docs: update documentation and enrich examples with graceful shutdown and richer SDK usage by @rekurt in #6
  • Harden webhook example request validation by @rekurt in #4
  • Fix/linters by @rekurt in #5
  • Claude/project analysis improvements or2 b9 by @rekurt in #7

New Contributors

  • @rekurt made their first contribution in #1

Full Changelog: v0.0.2...v0.1.0

v0.0.2

v0.0.2 Pre-release
Pre-release

Choose a tag to compare

@rekurt rekurt released this 08 Dec 13:10

Full Changelog: v0.0.1...v0.0.2

Initial release of sdk

Pre-release

Choose a tag to compare

@rekurt rekurt released this 08 Dec 12:59
v0.0.1

downgrade Go version to 1.24 in go.mod