{"id":47733112,"url":"https://github.com/maxigo-bot/maxigo-client","last_synced_at":"2026-04-02T22:00:33.072Z","repository":{"id":338491372,"uuid":"1157727437","full_name":"maxigo-bot/maxigo-client","owner":"maxigo-bot","description":"Idiomatic Go HTTP client for Max Bot API — zero dependencies, context support, structured errors","archived":false,"fork":false,"pushed_at":"2026-04-01T19:27:09.000Z","size":143,"stargazers_count":52,"open_issues_count":0,"forks_count":3,"subscribers_count":1,"default_branch":"main","last_synced_at":"2026-04-02T07:20:34.414Z","etag":null,"topics":["api-client","bot","bot-api","bot-framework","chatbot","go","golang","http-client","long-polling","max","max-api","max-bot","max-bot-api","max-messenger","maxigo","messenger","rest-api","sdk","webhook","zero-dependencies"],"latest_commit_sha":null,"homepage":"https://pkg.go.dev/github.com/maxigo-bot/maxigo-client","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/maxigo-bot.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null}},"created_at":"2026-02-14T07:40:06.000Z","updated_at":"2026-04-01T19:27:04.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/maxigo-bot/maxigo-client","commit_stats":null,"previous_names":["maxigo-bot/maxigo-client"],"tags_count":7,"template":false,"template_full_name":null,"purl":"pkg:github/maxigo-bot/maxigo-client","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxigo-bot%2Fmaxigo-client","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxigo-bot%2Fmaxigo-client/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxigo-bot%2Fmaxigo-client/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxigo-bot%2Fmaxigo-client/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/maxigo-bot","download_url":"https://codeload.github.com/maxigo-bot/maxigo-client/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/maxigo-bot%2Fmaxigo-client/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":31317830,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-02T21:35:00.834Z","status":"ssl_error","status_checked_at":"2026-04-02T21:34:59.806Z","response_time":89,"last_error":"SSL_connect returned=1 errno=0 peeraddr=140.82.121.6:443 state=error: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api-client","bot","bot-api","bot-framework","chatbot","go","golang","http-client","long-polling","max","max-api","max-bot","max-bot-api","max-messenger","maxigo","messenger","rest-api","sdk","webhook","zero-dependencies"],"created_at":"2026-04-02T22:00:22.776Z","updated_at":"2026-04-02T22:00:33.056Z","avatar_url":"https://github.com/maxigo-bot.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# maxigo-client\n\n[![Go Reference](https://pkg.go.dev/badge/github.com/maxigo-bot/maxigo-client.svg)](https://pkg.go.dev/github.com/maxigo-bot/maxigo-client)\n[![Go Report Card](https://goreportcard.com/badge/github.com/maxigo-bot/maxigo-client)](https://goreportcard.com/report/github.com/maxigo-bot/maxigo-client)\n[![CI](https://github.com/maxigo-bot/maxigo-client/actions/workflows/ci.yml/badge.svg)](https://github.com/maxigo-bot/maxigo-client/actions/workflows/ci.yml)\n[![codecov](https://codecov.io/gh/maxigo-bot/maxigo-client/branch/main/graph/badge.svg)](https://codecov.io/gh/maxigo-bot/maxigo-client)\n[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)\n[![Go Version](https://img.shields.io/github/go-mod/go-version/maxigo-bot/maxigo-client)](https://github.com/maxigo-bot/maxigo-client)\n\nIdiomatic Go HTTP client for [Max Bot API](https://dev.max.ru) (OpenAPI schema v0.0.10). Zero external dependencies.\n\n## Why This Project?\n\n  The official [`max-bot-api-client-go`](https://github.com/max-messenger/max-bot-api-client-go) has systemic issues that make it unsuitable for production use:\n\n  | Category                                          | Issues                                                   | Severity                                    |\n  |---------------------------------------------------|----------------------------------------------------------|---------------------------------------------|\n  | Errors swallowed via `log.Println` / `slog.Error` | 30+ places                                               | Critical — library must not write to stdout |\n  | Untestable without real API                       | No `WithBaseURL`, uploads use `http.DefaultClient`       | Critical — impossible to unit test          |\n  | Unnecessary dependencies                          | zerolog, yaml, env — 6 transitive deps                   | Critical — for an HTTP client               |\n  | Broken API methods                                | `GetChatID()` returns 0 for callbacks                    | Critical — callbacks unusable               |\n  | Wrong types                                       | `time.Duration` for Unix timestamps, `int64→int` casts   | Critical — data corruption on 32-bit        |\n  | No `context.Context` in uploads                   | `http.Get()` without timeout or cancellation             | Critical — can hang forever                 |\n  | Non-idiomatic API                                 | Builder pattern, `SCREAMING_CASE`, no functional options | Major                                       |\n  | `schemes.Error` always non-nil                    | `Check()` returns error even on success                  | Critical — always errors                    |\n\n  **maxigo-client** fixes all of these.\n\n## Documentation\n\n- **[English Guide](docs/guide.md)** — full API reference with examples\n- **[Документация на русском](docs/guide-ru.md)** — полное описание API с примерами\n  Requires Go 1.25+.\n\n## Installation\n\n```bash\ngo get github.com/maxigo-bot/maxigo-client\n```\n\n\n## Quick Start\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"log\"\n\n\tmaxigo \"github.com/maxigo-bot/maxigo-client\"\n)\n\nfunc main() {\n\tclient, err := maxigo.New(\"YOUR_BOT_TOKEN\")\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\n\tbot, err := client.GetBot(context.Background())\n\tif err != nil {\n\t\tlog.Fatal(err)\n\t}\n\tfmt.Printf(\"Bot: %s (ID: %d)\\n\", bot.FirstName, bot.UserID)\n}\n```\n\n\n## Features\n\n- Zero external dependencies — only stdlib\n- All methods take `context.Context`\n- Structured error handling with `errors.As`\n- Full Max Bot API coverage: messages, chats, uploads, webhooks, long polling\n- Type-safe constructors for all button types and attachments\n- `Optional[T]` generics for three-state fields (unset / zero / value)\n- Opt-in automatic retry for rate limits and attachment processing (`WithRetry`)\n- Testable without real API via `WithBaseURL`\n\n## Type-Safe Constructors\n\nNo need to remember string constants — use constructors for buttons and attachments:\n\n**Buttons:**\n\n```go\nmaxigo.NewCallbackButton(\"Click\", \"payload\")                        // callback\nmaxigo.NewCallbackButtonWithIntent(\"Yes\", \"yes\", maxigo.IntentPositive) // callback with intent\nmaxigo.NewLinkButton(\"Open\", \"https://example.com\")                 // link\nmaxigo.NewRequestContactButton(\"Share contact\")                     // request contact\nmaxigo.NewRequestGeoLocationButton(\"Send location\", true)           // request geo (quick=true)\nmaxigo.NewChatButton(\"Create chat\", \"Title\")                        // create chat\nmaxigo.NewMessageButton(\"Send\")                                     // message from user\nmaxigo.NewOpenAppButton(\"Open WebApp\", \"bot_username\")               // open mini-app\n```\n\n**Attachments:**\n\n```go\nmaxigo.NewInlineKeyboardAttachment(buttons) // inline keyboard\nmaxigo.NewPhotoAttachment(payload)          // image\nmaxigo.NewVideoAttachment(payload)          // video\nmaxigo.NewAudioAttachment(payload)          // audio\nmaxigo.NewFileAttachment(payload)           // file\nmaxigo.NewStickerAttachment(payload)        // sticker\nmaxigo.NewContactAttachment(payload)        // contact card\nmaxigo.NewShareAttachment(payload)          // share link\nmaxigo.NewLocationAttachment(lat, lng)      // location\n```\n\n**Example — inline keyboard with contact and geo buttons:**\n\n```go\nmsg, err := client.SendMessage(ctx, chatID, \u0026maxigo.NewMessageBody{\n    Text: maxigo.Some(\"Choose an option:\"),\n    Attachments: []maxigo.AttachmentRequest{\n        maxigo.NewInlineKeyboardAttachment([][]maxigo.Button{\n            {\n                maxigo.NewRequestContactButton(\"Share contact\"),\n                maxigo.NewRequestGeoLocationButton(\"Send location\", false),\n            },\n            {\n                maxigo.NewCallbackButtonWithIntent(\"Cancel\", \"cancel\", maxigo.IntentNegative),\n            },\n        }),\n    },\n})\n```\n\n## API Overview\n\n```go\n// Bot\nclient.GetBot(ctx)\nclient.EditBot(ctx, patch)\n\n// Messages\nclient.SendMessage(ctx, chatID, body)\nclient.SendMessageToUser(ctx, userID, body)\nclient.SendMessageToPhones(ctx, phoneNumbers, body)\nclient.EditMessage(ctx, messageID, body)\nclient.DeleteMessage(ctx, messageID)\nclient.AnswerCallback(ctx, callbackID, answer)\n\n// Chats\nclient.GetChat(ctx, chatID)\nclient.GetChats(ctx, opts)\nclient.EditChat(ctx, chatID, patch)\nclient.GetMembers(ctx, chatID, opts)\nclient.SendAction(ctx, chatID, action)\n\n// Phone numbers\nclient.CheckPhoneNumbers(ctx, phoneNumbers)\n\n// Uploads\nclient.UploadPhoto(ctx, filename, reader)\nclient.UploadMedia(ctx, uploadType, filename, reader)\n\n// Webhooks\nclient.Subscribe(ctx, url, types, secret)\nclient.Unsubscribe(ctx, url)\n\n// Long Polling\nclient.GetUpdates(ctx, opts)\n```\n\n## Error Handling\n\n```go\nvar e *maxigo.Error\nif errors.As(err, \u0026e) {\n    fmt.Printf(\"[%s] %s %d: %s\\n\", e.Op, e.Kind, e.StatusCode, e.Message)\n}\n```\n\nError kinds: `ErrAPI`, `ErrNetwork`, `ErrTimeout`, `ErrDecode`. See [guide](docs/guide.md#error-handling) for details.\n\n## Ecosystem\n\n| Package | Description |\n|---------|-------------|\n| [maxigo-client](https://github.com/maxigo-bot/maxigo-client) | Idiomatic Go HTTP client for Max Bot API (zero external deps) |\n| [maxigo-bot](https://github.com/maxigo-bot/maxigo-bot) | Bot framework with router, middleware, and context |\n\n## License\n\nMIT\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxigo-bot%2Fmaxigo-client","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fmaxigo-bot%2Fmaxigo-client","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fmaxigo-bot%2Fmaxigo-client/lists"}