{"id":30237986,"url":"https://github.com/stainless-api/bug-squash-go","last_synced_at":"2025-08-15T02:59:07.599Z","repository":{"id":213143662,"uuid":"732855045","full_name":"stainless-api/bug-squash-go","owner":"stainless-api","description":"An interview question sshh","archived":false,"fork":false,"pushed_at":"2025-05-27T20:49:43.000Z","size":14951,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-08-10T00:36:55.358Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/stainless-api.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}},"created_at":"2023-12-18T02:26:05.000Z","updated_at":"2025-08-02T07:33:16.000Z","dependencies_parsed_at":"2024-12-20T18:23:39.217Z","dependency_job_id":null,"html_url":"https://github.com/stainless-api/bug-squash-go","commit_stats":null,"previous_names":["stainless-sdks/bug-squash-increase-go","stainless-api/bug-squash-go"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/stainless-api/bug-squash-go","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stainless-api%2Fbug-squash-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stainless-api%2Fbug-squash-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stainless-api%2Fbug-squash-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stainless-api%2Fbug-squash-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/stainless-api","download_url":"https://codeload.github.com/stainless-api/bug-squash-go/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/stainless-api%2Fbug-squash-go/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":270515666,"owners_count":24598440,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-08-15T02:00:12.559Z","response_time":110,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":[],"created_at":"2025-08-15T02:59:04.799Z","updated_at":"2025-08-15T02:59:07.586Z","avatar_url":"https://github.com/stainless-api.png","language":"Go","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Acme Go API Library\n\n\u003ca href=\"https://pkg.go.dev/github.com/acme/acme-go\"\u003e\u003cimg src=\"https://pkg.go.dev/badge/github.com/acme/acme-go.svg\" alt=\"Go Reference\"\u003e\u003c/a\u003e\n\nThe Acme Go library provides convenient access to [the Acme REST\nAPI](https://acme.com/documentation) from applications written in Go.\n\n## Installation\n\n\u003c!-- x-release-please-start-version --\u003e\n\n```go\nimport (\n\t\"github.com/acme/acme-go\" // imported as acme\n)\n```\n\n\u003c!-- x-release-please-end --\u003e\n\nOr to pin the version:\n\n\u003c!-- x-release-please-start-version --\u003e\n\n```sh\ngo get -u 'github.com/acme/acme-go@v0.8.0'\n```\n\n\u003c!-- x-release-please-end --\u003e\n\n## Requirements\n\nThis library requires Go 1.18+.\n\n## Usage\n\nThe full API of this library can be found in [api.md](https://www.github.com/acme/acme-go/blob/main/api.md).\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"github.com/acme/acme-go\"\n\t\"github.com/acme/acme-go/option\"\n)\n\nfunc main() {\n\tclient := acme.NewClient(\n\t\toption.WithAPIKey(\"My API Key\"), // defaults to os.LookupEnv(\"ACME_API_KEY\")\n\t\toption.WithEnvironmentSandbox(), // defaults to option.WithEnvironmentProduction()\n\t)\n\taccount, err := client.Accounts.New(context.TODO(), acme.AccountNewParams{\n\t\tName: acme.F(\"My First Acme Account\"),\n\t})\n\tif err != nil {\n\t\tpanic(err.Error())\n\t}\n\tfmt.Printf(\"%+v\\n\", account.ID)\n}\n\n```\n\n### Request Fields\n\nAll request parameters are wrapped in a generic `Field` type,\nwhich we use to distinguish zero values from null or omitted fields.\n\nThis prevents accidentally sending a zero value if you forget a required parameter,\nand enables explicitly sending `null`, `false`, `''`, or `0` on optional parameters.\nAny field not specified is not sent.\n\nTo construct fields with values, use the helpers `String()`, `Int()`, `Float()`, or most commonly, the generic `F[T]()`.\nTo send a null, use `Null[T]()`, and to send a nonconforming value, use `Raw[T](any)`. For example:\n\n```go\nparams := FooParams{\n\tName: acme.F(\"hello\"),\n\n\t// Explicitly send `\"description\": null`\n\tDescription: acme.Null[string](),\n\n\tPoint: acme.F(acme.Point{\n\t\tX: acme.Int(0),\n\t\tY: acme.Int(1),\n\n\t\t// In cases where the API specifies a given type,\n\t\t// but you want to send something else, use `Raw`:\n\t\tZ: acme.Raw[int64](0.01), // sends a float\n\t}),\n}\n```\n\n### Response Objects\n\nAll fields in response structs are value types (not pointers or wrappers).\n\nIf a given field is `null`, not present, or invalid, the corresponding field\nwill simply be its zero value.\n\nAll response structs also include a special `JSON` field, containing more detailed\ninformation about each property, which you can use like so:\n\n```go\nif res.Name == \"\" {\n\t// true if `\"name\"` is either not present or explicitly null\n\tres.JSON.Name.IsNull()\n\n\t// true if the `\"name\"` key was not present in the repsonse JSON at all\n\tres.JSON.Name.IsMissing()\n\n\t// When the API returns data that cannot be coerced to the expected type:\n\tif res.JSON.Name.IsInvalid() {\n\t\traw := res.JSON.Name.Raw()\n\n\t\tlegacyName := struct{\n\t\t\tFirst string `json:\"first\"`\n\t\t\tLast  string `json:\"last\"`\n\t\t}{}\n\t\tjson.Unmarshal([]byte(raw), \u0026legacyName)\n\t\tname = legacyName.First + \" \" + legacyName.Last\n\t}\n}\n```\n\nThese `.JSON` structs also include an `Extras` map containing\nany properties in the json response that were not specified\nin the struct. This can be useful for API features not yet\npresent in the SDK.\n\n```go\nbody := res.JSON.ExtraFields[\"my_unexpected_field\"].Raw()\n```\n\n### RequestOptions\n\nThis library uses the functional options pattern. Functions defined in the\n`option` package return a `RequestOption`, which is a closure that mutates a\n`RequestConfig`. These options can be supplied to the client or at individual\nrequests. For example:\n\n```go\nclient := acme.NewClient(\n\t// Adds a header to every request made by the client\n\toption.WithHeader(\"X-Some-Header\", \"custom_header_info\"),\n)\n\nclient.Accounts.New(context.TODO(), ...,\n\t// Override the header\n\toption.WithHeader(\"X-Some-Header\", \"some_other_custom_header_info\"),\n\t// Add an undocumented field to the request body, using sjson syntax\n\toption.WithJSONSet(\"some.json.path\", map[string]string{\"my\": \"object\"}),\n)\n```\n\nThe full list of request options is [here](https://pkg.go.dev/github.com/acme/acme-go/option).\n\n### Pagination\n\nThis library provides some conveniences for working with paginated list endpoints.\n\nYou can use `.ListAutoPaging()` methods to iterate through items across all pages:\n\n```go\niter := client.Accounts.ListAutoPaging(context.TODO(), acme.AccountListParams{})\n// Automatically fetches more pages as needed.\nfor iter.Next() {\n\taccount := iter.Current()\n\tfmt.Printf(\"%+v\\n\", account)\n}\nif err := iter.Err(); err != nil {\n\tpanic(err.Error())\n}\n```\n\nOr you can use simple `.List()` methods to fetch a single page and receive a standard response object\nwith additional helper methods like `.GetNextPage()`, e.g.:\n\n```go\npage, err := client.Accounts.List(context.TODO(), acme.AccountListParams{})\nfor page != nil {\n\tfor _, account := range page.Data {\n\t\tfmt.Printf(\"%+v\\n\", account)\n\t}\n\tpage, err = page.GetNextPage()\n}\nif err != nil {\n\tpanic(err.Error())\n}\n```\n\n### Errors\n\nWhen the API returns a non-success status code, we return an error with type\n`*acme.Error`. This contains the `StatusCode`, `*http.Request`, and\n`*http.Response` values of the request, as well as the JSON of the error body\n(much like other response objects in the SDK).\n\nTo handle errors, we recommend that you use the `errors.As` pattern:\n\n```go\n_, err := client.Accounts.New(context.TODO(), acme.AccountNewParams{\n\tName: acme.F(\"New Account!\"),\n})\nif err != nil {\n\tvar apierr *acme.Error\n\tif errors.As(err, \u0026apierr) {\n\t\tprintln(string(apierr.DumpRequest(true)))  // Prints the serialized HTTP request\n\t\tprintln(string(apierr.DumpResponse(true))) // Prints the serialized HTTP response\n\t\tprintln(apierr.Type)                       // missing_param\n\t\tprintln(apierr.Title)                      // Missing param \"name\"\n\t\tprintln(apierr.Detail)                     // Looks like \"naem\" may have been a typo?\n\t\tprintln(apierr.Status)                     // 400\n\t}\n\tpanic(err.Error()) // GET \"/accounts\": 400 Bad Request { ... }\n}\n```\n\nWhen other errors occur, they are returned unwrapped; for example,\nif HTTP transport fails, you might receive `*url.Error` wrapping `*net.OpError`.\n\n### Timeouts\n\nRequests do not time out by default; use context to configure a timeout for a request lifecycle.\n\nNote that if a request is [retried](#retries), the context timeout does not start over.\nTo set a per-retry timeout, use `option.WithRequestTimeout()`.\n\n```go\n// This sets the timeout for the request, including all the retries.\nctx, cancel := context.WithTimeout(context.Background(), 5*time.Minute)\ndefer cancel()\nclient.Accounts.List(\n\tctx,\n\tacme.AccountListParams{\n\t\tStatus: acme.F(acme.AccountListParamsStatusOpen),\n\t},\n\t// This sets the per-retry timeout\n\toption.WithRequestTimeout(20*time.Second),\n)\n```\n\n## Retries\n\nCertain errors will be automatically retried 2 times by default, with a short exponential backoff.\nWe retry by default all connection errors, 408 Request Timeout, 409 Conflict, 429 Rate Limit,\nand \u003e=500 Internal errors.\n\nYou can use the `WithMaxRetries` option to configure or disable this:\n\n```go\n// Configure the default for all requests:\nclient := acme.NewClient(\n\toption.WithMaxRetries(0), // default is 2\n)\n\n// Override per-request:\nclient.Accounts.New(\n\tcontext.TODO(),\n\tacme.AccountNewParams{\n\t\tName: acme.F(\"Jack\"),\n\t},\n\toption.WithMaxRetries(5),\n)\n```\n\n### Middleware\n\nWe provide `option.WithMiddleware` which applies the given\nmiddleware to requests.\n\n```go\nfunc Logger(req *http.Request, next option.MiddlewareNext) (res *http.Response, err error) {\n\t// Before the request\n\tstart := time.Now()\n\tLogReq(req)\n\n\t// Forward the request to the next handler\n\tres, err = next(req)\n\n\t// Handle stuff after the request\n\tend := time.Now()\n\tLogRes(res, err, start - end)\n\n    return res, err\n}\n\nclient := acme.NewClient(\n\toption.WithMiddleware(Logger),\n)\n```\n\nWhen multiple middlewares are provided as variadic arguments, the middlewares\nare applied left to right. If `option.WithMiddleware` is given\nmultiple times, for example first in the client then the method, the\nmiddleware in the client will run first and the middleware given in the method\nwill run next.\n\nYou may also replace the default `http.Client` with\n`option.WithHTTPClient(client)`. Only one http client is\naccepted (this overwrites any previous client) and receives requests after any\nmiddleware has been applied.\n\n## Semantic Versioning\n\nThis package generally follows [SemVer](https://semver.org/spec/v2.0.0.html) conventions, though certain backwards-incompatible changes may be released as minor versions:\n\n1. Changes to library internals which are technically public but not intended or documented for external use. _(Please open a GitHub issue to let us know if you are relying on such internals)_.\n2. Changes that we do not expect to impact the vast majority of users in practice.\n\nWe take backwards-compatibility seriously and work hard to ensure you can rely on a smooth upgrade experience.\n\nWe are keen for your feedback; please open an [issue](https://www.github.com/acme/acme-go/issues) with questions, bugs, or suggestions.\n\n## Development\n\nThe project should build with:\n\n```sh\nmake\n```\n\nThen run tests with:\n\n```sh\nmake test\n```\n\nNote that this will fire up two mock servers, running in parallel.\n\nThe Prism server simulates basic inputs and outputs for the API:\n\n```sh\nnpm install -g @stoplight/prism-cli\nprism mock openapi.json\n```\n\nThe integration server simulates more complex behaviour that we want to test\nend-to-end and that isn't handled by the auto-generated Prism server:\n\n```sh\ngo run scripts/integration_server.go\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstainless-api%2Fbug-squash-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fstainless-api%2Fbug-squash-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fstainless-api%2Fbug-squash-go/lists"}