core

package
v2.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2025 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
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

func NewAPIError(statusCode int, header http.Header, 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 Auth0ClientEnvEntryOption

type Auth0ClientEnvEntryOption struct {
	Key   string
	Value string
}

Auth0ClientEnvEntryOption 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 ClientCredentialsAndAudienceOption

type ClientCredentialsAndAudienceOption struct {
	Ctx          *context.Context
	ClientID     string
	ClientSecret string
	Audience     string
	// contains filtered or unexported fields
}

type ClientCredentialsOption

type ClientCredentialsOption struct {
	Ctx          *context.Context
	ClientID     string
	ClientSecret string
	// contains filtered or unexported fields
}

type ClientCredentialsPrivateKeyJwtAndAudienceOption

type ClientCredentialsPrivateKeyJwtAndAudienceOption struct {
	Ctx        *context.Context
	ClientID   string
	PrivateKey string
	Algorithm  string
	Audience   string
	// contains filtered or unexported fields
}

type ClientCredentialsPrivateKeyJwtOption

type ClientCredentialsPrivateKeyJwtOption struct {
	Ctx        *context.Context
	ClientID   string
	PrivateKey string
	Algorithm  string
	// contains filtered or unexported fields
}

type CustomDomainHeaderOption

type CustomDomainHeaderOption struct {
	CustomDomainHeader string
}

CustomDomainHeaderOption implements the RequestOption interface.

type DebugOption

type DebugOption struct {
	Debug bool
}

DebugOption 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 InsecureOption

type InsecureOption struct{}

InsecureOption implements the RequestOption interface. This option is for testing purposes only and should not be used in production.

type MaxAttemptsOption

type MaxAttemptsOption struct {
	MaxAttempts uint
}

MaxAttemptsOption implements the RequestOption interface.

type NoAuth0ClientInfoOption

type NoAuth0ClientInfoOption struct{}

NoAuth0ClientInfoOption implements the RequestOption interface.

type Page

type Page[T any] struct {
	Results      []T
	NextPageFunc func(context.Context) (*Page[T], error)
}

Page represents a single page of results.

func (*Page[T]) GetNextPage

func (p *Page[T]) GetNextPage(ctx context.Context) (*Page[T], error)

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.

func (*PageIterator[T]) Next

func (p *PageIterator[T]) Next(ctx context.Context) bool

Next returns true if the given iterator has more results, fetching the next page as needed.

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

	Ctx         context.Context
	Token       string
	TokenSource oauth2.TokenSource
	Insecure    bool // For testing purposes only - allows HTTP instead of HTTPS

	// Auth0ClientEnv holds custom environment entries for the Auth0-Client header
	Auth0ClientEnv map[string]string

	// NoAuth0ClientInfo when true, prevents sending the "Auth0-Client" header
	NoAuth0ClientInfo bool

	// CustomDomainHeader is the custom domain to be sent in the "Auth0-Custom-Domain" header
	// for whitelisted API endpoints
	CustomDomainHeader 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).

type Response

type Response[T any] struct {
	StatusCode int
	Header     http.Header
	Body       T
}

Response is an HTTP response from an HTTP client.

type TokenOption

type TokenOption struct {
	Token string
}

TokenOption implements the RequestOption interface.

type UserAgentOption

type UserAgentOption struct {
	UserAgent string
}

UserAgentOption implements the RequestOption interface.

Jump to

Keyboard shortcuts

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