client

package
v2.1.0 Latest Latest
Warning

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

Go to latest
Published: Jan 10, 2023 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, options ...Options) (*Client, error)

func (*Client) Authenticate

func (c *Client) Authenticate(ctx context.Context) (accessToken string, refreshToken string, err error)

authenticate authenticates the client with the given apiKey and returns the accessToken, which is short lived and will be used for almost all API calls and refreshToken which is used for getting new access and refresh tokens.

func (*Client) Fetch

func (c *Client) Fetch(ctx context.Context, accessToken string, ftVersion, settingsVersion int64) (*pb_toggles.FetchResponse, error)

Fetch fetches new feature toggles since ftVersion and settingsVersion

func (*Client) Listen

func (c *Client) Listen(ctx context.Context, accessToken string, ftVersion, settingsVersion int64) (<-chan *pb_toggles.ListenPayload, error)

func (*Client) Refresh

func (c *Client) Refresh(ctx context.Context, token string) (accesToken string, refreshToken string, err error)

func (*Client) RefreshAndAuth

func (c *Client) RefreshAndAuth(ctx context.Context, token string) (accessToken string, refreshToken string, err error)

refreshAndAuth uses the given refresh token to get new access and refresh token pairs. Each refresh token can be used only once. This is because the server implements refresh token rotation to detect token reuse. See https://auth0.com/docs/secure/tokens/refresh-tokens/refresh-token-rotation#automatic-reuse-detection for more information. Upon failure, the client will need to re-authenticate with the server. The given apiKey will be used to re-authenticate. If that also fails, then an error is returned.

type Options

type Options func(o *clientOptions) error

func WithApiKey

func WithApiKey(key string) Options

func WithDialOptions

func WithDialOptions(options ...grpc.DialOption) Options

func WithDomain

func WithDomain(domain string) Options

For internal testing purposes mostly.

func WithLogLevel

func WithLogLevel(level logger.LogLevel) Options

Jump to

Keyboard shortcuts

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