client

package
v5.24.0 Latest Latest
Warning

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

Go to latest
Published: Jan 11, 2022 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var UserAgent = fmt.Sprintf("Go-Auth0-SDK/%s", auth0.Version)

UserAgent is the default user agent string

Functions

func ClientCredentials

func ClientCredentials(ctx context.Context, uri, clientID, clientSecret string) oauth2.TokenSource

func DebugTransport

func DebugTransport(base http.RoundTripper, debug bool) http.RoundTripper

RateLimitTransport wraps base transport with the ability to log the contents of requests and responses.

func RateLimitTransport

func RateLimitTransport(base http.RoundTripper) http.RoundTripper

RateLimitTransport wraps base transport with rate limiting functionality.

When a 429 status code is returned by the remote server, the "X-RateLimit-Reset" header is used to determine how long the transport will wait until re-issuing the failed request.

func StaticToken

func StaticToken(token string) oauth2.TokenSource

func UserAgentTransport

func UserAgentTransport(base http.RoundTripper, userAgent string) http.RoundTripper

RateLimitTransport wraps base transport with a customized "User-Agent" header

func Wrap

func Wrap(base *http.Client, tokenSource oauth2.TokenSource, options ...Option) *http.Client

Wrap the base client with transports that enable OAuth2 authentication.

Types

type Option

type Option func(*http.Client)

Option is the type used to configure a client.

func WithDebug

func WithDebug(debug bool) Option

WithDebug configures the client to enable debug.

func WithRateLimit

func WithRateLimit() Option

WithRateLimit configures the client to enable rate limiting.

func WithUserAgent

func WithUserAgent(userAgent string) Option

WithUserAgent configures the client to overwrite the user agent header.

type RoundTripFunc

type RoundTripFunc func(*http.Request) (*http.Response, error)

RoundTripFunc is an adapter to allow the use of ordinary functions as HTTP round trips.

func (RoundTripFunc) RoundTrip

func (rf RoundTripFunc) RoundTrip(req *http.Request) (*http.Response, error)

RoundTrip executes a single HTTP transaction, returning a Response for the provided Request.

Jump to

Keyboard shortcuts

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