// Code generated by @openmeter/typespec-go. DO NOT EDIT. package openmeter import ( "net/http" "runtime/debug" ) // Version is the SDK version reported in the default User-Agent. When the SDK // is consumed as a module dependency it is resolved from the consumer's build // info (the module version selected by their go.mod), so tagged releases need // no stamping commit. Builds where that is unavailable — the module itself, // replace directives, vendored trees without version data — fall back to the // sdk-version emitter option ("0.0.0-dev"). var Version = resolveVersion() func resolveVersion() string { if info, ok := debug.ReadBuildInfo(); ok { for _, dep := range info.Deps { if dep.Path != "github.com/openmeterio/openmeter/api/v3/client" || dep.Replace != nil { continue } if dep.Version != "" && dep.Version != "(devel)" { return dep.Version } } } return "0.0.0-dev" } var defaultUserAgent = "openmeter-go-sdk/" + Version // Option configures a Client during New. type Option func(*Client) // WithToken sets the bearer token sent in the Authorization header of every // request. The header is applied during request construction, so it is honored // regardless of any client injected via WithHTTPClient. func WithToken(token string) Option { return func(c *Client) { c.token = token } } // WithHTTPClient replaces the default *http.Client. The provided client owns all // transport behavior: retries, timeouts, proxies, TLS, and tracing. Pass nil to // keep the default. func WithHTTPClient(hc *http.Client) Option { return func(c *Client) { if hc != nil { c.httpClient = hc } } } // WithUserAgent overrides the User-Agent header sent with each request. func WithUserAgent(ua string) Option { return func(c *Client) { if ua != "" { c.userAgent = ua } } }