Documentation
¶
Overview ¶
Package ymsdk is a lightweight Go SDK for the Yandex Messenger Bot API.
The SDK provides type-safe models, automatic retry with exponential back-off, rate-limit handling, and service-oriented architecture covering all core API methods: messages, chats, polls, updates, users, files, and bot self-management.
Quick start — use the convenience aggregator:
import "github.com/rekurt/ymsdk/client"
cs := client.New(ym.Config{Token: os.Getenv("YM_TOKEN")})
msg, _ := cs.Messages.SendToChat(ctx, "chat-id", "hello", nil)
poll, _ := cs.Polls.Create(ctx, &polls.CreatePollRequest{...})
link, _ := cs.Users.GetUserLink(ctx, "john.doe")
Or construct individual services from a core client:
cl := ym.NewClient(ym.Config{Token: "..."})
msgSvc := messages.NewService(cl)
pollSvc := polls.NewService(cl)
For debug logging, wrap the HTTP transport:
debugLogger := middleware.NewDebugLogger(logger, middleware.LogLevelDebug) loggedHTTP := middleware.NewHTTPLogger(httpClient, debugLogger) ymClient := ym.NewClientWithHTTP(cfg, loggedHTTP) cs := client.Wrap(ymClient)
See sub-packages for detailed documentation:
- github.com/rekurt/ymsdk/client — YMClient aggregator
- github.com/rekurt/ymsdk/client/ym — core Client and shared types
- github.com/rekurt/ymsdk/client/ym/ymerrors — error types and configuration
- github.com/rekurt/ymsdk/middleware — zap-based logging and HTTP inspection
Directories
¶
| Path | Synopsis |
|---|---|
|
Package client provides the YMClient aggregator — a single entry point to all Yandex Messenger Bot API services.
|
Package client provides the YMClient aggregator — a single entry point to all Yandex Messenger Bot API services. |
|
ym
Package ym provides the core Yandex Messenger Bot API client and shared types.
|
Package ym provides the core Yandex Messenger Bot API client and shared types. |
|
ym/chats
Package chats provides operations for creating and managing chats and channels in Yandex Messenger.
|
Package chats provides operations for creating and managing chats and channels in Yandex Messenger. |
|
ym/files
Package files provides operations for uploading files to Yandex Messenger chats.
|
Package files provides operations for uploading files to Yandex Messenger chats. |
|
ym/messages
Package messages provides operations for sending, deleting, and managing messages in Yandex Messenger chats.
|
Package messages provides operations for sending, deleting, and managing messages in Yandex Messenger chats. |
|
ym/polls
Package polls provides operations for creating and managing polls in Yandex Messenger chats.
|
Package polls provides operations for creating and managing polls in Yandex Messenger chats. |
|
ym/self
Package self provides operations for managing the bot's own settings in Yandex Messenger, such as configuring webhook URLs.
|
Package self provides operations for managing the bot's own settings in Yandex Messenger, such as configuring webhook URLs. |
|
ym/updates
Package updates provides mechanisms for receiving real-time updates from the Yandex Messenger Bot API.
|
Package updates provides mechanisms for receiving real-time updates from the Yandex Messenger Bot API. |
|
ym/users
Package users provides operations for retrieving user information from Yandex Messenger.
|
Package users provides operations for retrieving user information from Yandex Messenger. |
|
ym/ymerrors
Package ymerrors defines error types and sentinel errors for the Yandex Messenger Bot API SDK.
|
Package ymerrors defines error types and sentinel errors for the Yandex Messenger Bot API SDK. |
|
examples
|
|
|
basic_send
command
|
|
|
debug_logger
command
|
|
|
integration
command
|
|
|
poll_bot
command
|
|
|
poller
command
|
|
|
webhook
command
|
|
|
internal
|
|
|
Package middleware provides structured logging and HTTP debugging utilities for the Yandex Messenger Bot API SDK.
|
Package middleware provides structured logging and HTTP debugging utilities for the Yandex Messenger Bot API SDK. |
Click to show internal directories.
Click to hide internal directories.