Documentation
¶
Index ¶
- type Client
- func (c *Client) Authenticate(ctx context.Context) (accessToken string, refreshToken string, err error)
- func (c *Client) Fetch(ctx context.Context, accessToken string, ftVersion, settingsVersion int64) (*pb_toggles.FetchResponse, error)
- func (c *Client) Listen(ctx context.Context, accessToken string, ftVersion, settingsVersion int64) (<-chan *pb_toggles.ListenPayload, error)
- func (c *Client) Refresh(ctx context.Context, token string) (accesToken string, refreshToken string, err error)
- func (c *Client) RefreshAndAuth(ctx context.Context, token string) (accessToken string, refreshToken string, err error)
- type Options
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 (*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) 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 WithDialOptions ¶
func WithDialOptions(options ...grpc.DialOption) Options