Releases: rekurt/ymsdk
Releases · rekurt/ymsdk
Release list
v0.2.0
Installation
go get github.com/rekurt/ymsdk@v0.2.0Changes
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
EditTextandSendMessageOptions.MessageID, plus the
previously missingreply_quote,forwardsandaction_buttonsparameters ym.TargetwithChatTarget,LoginTargetandUserIDTarget, covering the
user_idrecipient form the SDK could not express- Automatic
payload_ididempotency keys, so a retried send cannot deliver the
same message twice; opt out withConfig.DisableAutoPayloadID updates.Run, which backs off and retries failed polls instead of ending the
loop, with per-error policies and optional panic recoveryupdates.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-Agentidentifying the SDK, and
ym.SleepContext - Endpoint path constants in
client/ym/endpoints.go - LLM skill for using the SDK:
skills/ymsdk/, plusAGENTS.md,GEMINI.md,
Cursor, Copilot and Windsurf adapters messages.SendFileRequest.MimeType— overrides theContent-Typeof the
uploadeddocumentpart, replacingfiles.SendFileOptions.MimeType- Full documented parameter coverage for
sendText,sendFile,sendImageand
sendGallery:message_id(edit),reply_message_id,reply_quote,
forwards,disable_notification,importantandaction_buttons. Every
send method now accepts the same shared set instead of a per-method subset. ym.Forward,ym.ActionButtons,ym.ActionButton,ym.ActionButtonIconand
theym.Icon*/ym.ActionButtonIconTypeconstants- Send methods now surface the parts of the response they used to drop:
sendFilereturnsfile_idinMessage.Document,sendImagereturns
file_idplus dimensions inMessage.Image, andsendGalleryreturns the
per-image results inMessage.Gallery - Client-side enforcement of documented constraints, so an invalid combination
fails before a request is spent:reply_quoterequiresreply_message_id,
forwardscannot be combined withreply_message_id, at most 6 action
buttons, at most 100 suggest buttons, gallery text at most 6000 characters ym.SuggestButtonsnow emits the button array in the shape its layout
requires: a flat array forlayout: "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.UnmarshalJSONaccepts both
shapes, so a value survives a round trip through its own output.ym.SuggestLayoutFlatandym.SuggestLayoutRowsconstants — the Bot API
spells the layout as the strings"false"and"true", not as booleans
Removed
- BREAKING:
client/ym/filespackage and theYMClient.Filesfield. The
service parsed a{"ok":true,"message":{...}}response that the Bot API never
sends —sendFileanswers with flat{"ok":true,"message_id":N,"file_id":"..."}—
sofiles.SendToChatandfiles.SendToLogincould never succeed against the
live API. Its tests passed only against a fabricated response shape. The
package also carried an undocumentedcaptionfield that the server silently
discarded; removing the package supersedes the deprecation from a8c89f8. Use
messages.SendFile, which now also carries theMimeTypeoverride 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.govulncheckis 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.Getcanonicalises 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 thecanonicalheaderlint finding. - Retries could duplicate messages. The API documents
payload_idas an
idempotency key; the client never sent one, so asendTextretried after a
timeout or a 500 delivered the message twice - A single incoming image broke the bot.
Update.Imageswas declared as a
flat[]Imagewhile the API sendsImage[][]— 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;PollLoopthen stopped the bot - Incoming files were silently dropped. The API field is
file; the SDK
readdocument, soUpdate.Documentwas always nil - A single API error killed the bot.
PollLoopreturned on the first error
of any kind - Cancellation was ignored during back-off.
time.Sleepkept a shutting-down
bot blocked for the full delay, up toMaxBackoff - 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.
sanitizeFilenameleft CR and LF
intact, so a filename could inject MIME headers into a multipart part GetFilecould 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 Shutdowncould panic a serving goroutine withsend on closed channel
when it raced an in-flight delivery; new deliveries are now refused before
the queue is closedGetChataccepted 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 errorSendTypingsent unsupported display values. The check compared against
the empty string although its own error already said onlydefaultand
textare valid- Validation sentinels were scattered across service packages. Sixteen
publicErr…values sat beside the services that returned them, so matching
one witherrors.Ismeant importingmessages,chatsandymseparately.
They are all inymerrorsnow — 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 SendTypingsent unsupported indicator types. Thetypediscriminator
was passed through unchecked, soym.TypingType("bogus")reached the API as
the discriminator. Reported by review one field over from the display fixGetMemberssent unsupported role filters.roledocuments exactly
three values, and an unrecognised one travelled to the API in the query
string. Found by auditing every string enum that reaches a requestGetUserLinkreturned links that go nowhere.id,chat_linkand
call_linkare 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 throughMaxBodyBytes, 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 SendTypingsent processing content with an empty display. The zero value
ofProcessingContentleaves the discriminator blank, which is the shape a
caller writes by accident most easily, and the API cannot act on itself/getreturned a bot with no identity. A response missing the
requiredidproduced a zero-valuedBotSelfand a nil error. That decoder
escaped the earlier sweep because it uses a named type rather than an inline
structRunignoredRetry-Afterwhen 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...
v0.1.1
Installation
go get github.com/rekurt/ymsdk@v0.1.1Changes
- 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
Installation
go get github.com/rekurt/ymsdk@v0.1.0Changes
- 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
Full Changelog: v0.0.2...v0.1.0
v0.0.2
Full Changelog: v0.0.1...v0.0.2
Initial release of sdk
v0.0.1 downgrade Go version to 1.24 in go.mod