Accessing raw response data (e.g. response headers)
You can access the raw HTTP response data by using theoption.WithResponseInto() request option. This is useful when
you need to examine response headers, status codes, or other details.
Making custom/undocumented requests
This library is typed for convenient access to the documented API. If you need to access undocumented endpoints, params, or response properties, the library can still be used.Undocumented endpoints
To make requests to undocumented endpoints, you can useclient.Get, client.Post, and other HTTP verbs.
RequestOptions on the client, such as retries, will be respected when making these requests.
Undocumented request params
To make requests using undocumented parameters, you may use either theoption.WithQuerySet()
or the option.WithJSONSet() methods.
Undocumented response properties
To access undocumented response properties, you may either access the raw JSON of the response as a string withresult.JSON.RawJSON(), or get the raw JSON of a particular field on the result with
result.JSON.Foo.Raw().
Any fields that are not present on the response struct will be saved and can be accessed by result.JSON.ExtraFields() which returns the extra fields as a map[string]Field.
Middleware
We provideoption.WithMiddleware which applies the given
middleware to requests.
option.WithMiddleware is given
multiple times, for example first in the client then the method, the
middleware in the client will run first and the middleware given in the method
will run next.
You may also replace the default http.Client with
option.WithHTTPClient(client). Only one http client is
accepted (this overwrites any previous client) and receives requests after any
middleware has been applied.
Requirements
This library requires Go 1.22+.Semantic versioning
This package generally follows SemVer conventions, though certain backwards-incompatible changes may be released as minor versions:- 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.)
- Changes that we do not expect to impact the vast majority of users in practice.