Documentation
¶
Index ¶
- Variables
- type APIError
- type APIKeyOption
- type BaseURLOption
- type BodyPropertiesOption
- type CorrelationIDOption
- type HTTPClient
- type HTTPClientOption
- type HTTPHeaderOption
- type IdempotencyKeyOption
- type IdempotentRequestOption
- type IdempotentRequestOptions
- type MaxAttemptsOption
- type Page
- type PageIterator
- type QueryParametersOption
- type RequestOption
- type RequestOptions
- type Response
Constants ¶
This section is empty.
Variables ¶
var ErrNoPages = errors.New("no pages remain")
ErrNoPages is a sentinel error used to signal that no pages remain.
This error should be used similar to io.EOF, such that it represents a non-actionable error.
Functions ¶
This section is empty.
Types ¶
type APIError ¶
type APIError struct {
StatusCode int `json:"-"`
Header http.Header `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 ¶
NewAPIError constructs a new API error.
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 CorrelationIDOption ¶
type CorrelationIDOption struct {
CorrelationID *string
}
CorrelationIDOption implements the RequestOption interface.
type HTTPClient ¶
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 ¶
HTTPHeaderOption implements the RequestOption interface.
type IdempotencyKeyOption ¶
type IdempotencyKeyOption struct {
IdempotencyKey *string
}
IdempotencyKeyOption implements the RequestOption interface.
type IdempotentRequestOption ¶
type IdempotentRequestOption interface {
// contains filtered or unexported methods
}
IdempotentRequestOption adapts the behavior of an individual request.
type IdempotentRequestOptions ¶
type IdempotentRequestOptions struct {
*RequestOptions
IdempotencyKey *string
}
IdempotentRequestOptions defines all of the possible idempotent 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 NewIdempotentRequestOptions ¶
func NewIdempotentRequestOptions(opts ...IdempotentRequestOption) *IdempotentRequestOptions
NewIdempotentRequestOptions returns a new *IdempotentRequestOptions value.
This function is primarily used by the generated code and is not meant to be used directly; use IdempotentRequestOption instead.
func (*IdempotentRequestOptions) ToHeader ¶
func (i *IdempotentRequestOptions) ToHeader() http.Header
ToHeader maps the configured request options into a http.Header used for the request.
type MaxAttemptsOption ¶
type MaxAttemptsOption struct {
MaxAttempts uint
}
MaxAttemptsOption implements the RequestOption interface.
type Page ¶
Page represents a single page of results.
func (*Page[T]) GetNextPage ¶
GetNextPage fetches the next page, if any. If no pages remain, the ErrNoPages error is returned.
func (*Page[T]) Iterator ¶
func (p *Page[T]) Iterator() *PageIterator[T]
Iterator returns an iterator that starts at the current page.
type PageIterator ¶
type PageIterator[T any] struct { // contains filtered or unexported fields }
PageIterator is an auto-iterator for paginated endpoints.
func (*PageIterator[T]) Current ¶
func (p *PageIterator[T]) Current() T
Current returns the current element.
func (*PageIterator[T]) Err ¶
func (p *PageIterator[T]) Err() error
Err returns a non-nil error if the iterator encountered an error.
type QueryParametersOption ¶
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
CorrelationID *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).