$ show ktrysmt/go-bitbucket
This is a Go client library for the Bitbucket Cloud REST API v2.0. It provides typed wrappers for repositories, pull requests, issues, pipelines, commits, diffs, webhooks, downloads, deploy keys, SSH keys, workspaces, teams, users, branch restrictions, and deployment variables. The library exposes a Client constructed through various authentication methods (basic auth, app passwords, OAuth bearer tokens, client credentials, authorization code flows) and offers both high-level resource methods and raw paginated request execution. It is consumed as an embedded SDK by other Go programs, not a standalone service: there is no main package, CLI, or server entry point.
The LLM identified 3 files worth highlighting for reuse:
Central request execution layer that normalizes JSON, raw, multipart, and form-encoded HTTP requests, injects auth headers, handles custom CA bundles, and implements auto-pagination with depth/limit controls. The execute* method family is a reusable pattern for building robust REST API clients with consistent error handling and pagination behavior, though it is tightly coupled to the Client struct.
Provides reusable httptest-based helpers such as setupMockServer, respondJSON, and paginatedResponse. This pattern is directly applicable to testing any REST client library and demonstrates a clean approach to mocking paginated JSON APIs without external dependencies.
Defines a structured UnexpectedResponseStatusError that captures HTTP status and body details. It is a simple, isolated error type that can be extracted and reused in any HTTP client to provide actionable error diagnostics instead of generic failures.