Help us shape the future of Go! Take the 2026 Go Developer Survey

core

package
v1.8.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 20, 2026 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type APIError

type APIError struct {
	StatusCode int `json:"-"`
	// contains filtered or unexported fields
}

APIError is a lightweight wrapper around the standard error interface that preserves the status code from the RPC, if any.

func NewAPIError

func NewAPIError(statusCode int, err error) *APIError

NewAPIError constructs a new API error.

func (*APIError) Error

func (a *APIError) Error() string

Error returns the API error's message.

func (*APIError) Unwrap

func (a *APIError) Unwrap() error

Unwrap returns the underlying error. This also makes the error compatible with errors.As and errors.Is.

type ApiKeyOption

type ApiKeyOption struct {
	ApiKey string
}

ApiKeyOption implements the RequestOption interface.

type BaseURLOption

type BaseURLOption struct {
	BaseURL string
}

BaseURLOption implements the RequestOption interface.

type BodyPropertiesOption

type BodyPropertiesOption struct {
	BodyProperties map[string]interface{}
}

BodyPropertiesOption implements the RequestOption interface.

type HTTPClient

type HTTPClient interface {
	Do(*http.Request) (*http.Response, error)
}

HTTPClient is an interface for a subset of the *http.Client.

type HTTPClientOption

type HTTPClientOption struct {
	HTTPClient HTTPClient
}

HTTPClientOption implements the RequestOption interface.

type HTTPHeaderOption

type HTTPHeaderOption struct {
	HTTPHeader http.Header
}

HTTPHeaderOption implements the RequestOption interface.

type MaxAttemptsOption

type MaxAttemptsOption struct {
	MaxAttempts uint
}

MaxAttemptsOption implements the RequestOption interface.

type Optional

type Optional[T any] struct {
	Value T
	Null  bool
}

Optional is a wrapper used to distinguish zero values from null or omitted fields.

To instantiate an Optional, use the `Optional()` and `Null()` helpers exported from the root package.

func (*Optional[T]) MarshalJSON

func (o *Optional[T]) MarshalJSON() ([]byte, error)

func (*Optional[T]) String

func (o *Optional[T]) String() string

func (*Optional[T]) UnmarshalJSON

func (o *Optional[T]) UnmarshalJSON(data []byte) error

type QueryParametersOption

type QueryParametersOption struct {
	QueryParameters url.Values
}

QueryParametersOption implements the RequestOption interface.

type RequestOption

type RequestOption interface {
	// contains filtered or unexported methods
}

RequestOption adapts the behavior of the client or an individual request.

type RequestOptions

type RequestOptions struct {
	BaseURL         string
	HTTPClient      HTTPClient
	HTTPHeader      http.Header
	BodyProperties  map[string]interface{}
	QueryParameters url.Values
	MaxAttempts     uint
	ApiKey          string
}

RequestOptions defines all of the possible request options.

This type is primarily used by the generated code and is not meant to be used directly; use the option package instead.

func NewRequestOptions

func NewRequestOptions(opts ...RequestOption) *RequestOptions

NewRequestOptions returns a new *RequestOptions value.

This function is primarily used by the generated code and is not meant to be used directly; use RequestOption instead.

func (*RequestOptions) ToHeader

func (r *RequestOptions) ToHeader() http.Header

ToHeader maps the configured request options into a http.Header used for the request(s).

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL