aponoapi

package
v1.0.3 Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrProfileNotExists  = errors.New("profile not exists")
	ErrNoProfiles        = errors.New("no profiles configured, run `apono login` to create a profile")
	ErrorNoActiveProfile = errors.New("no active profile configured, run `apono login` to create a profile")
)
View Source
var (
	ErrClientNotConfigured = errors.New("client is not set in context")
	ErrIllegalContextValue = errors.New("illegal value is set in context")
)

Functions

func CreateClientContext added in v1.0.0

func CreateClientContext(ctx context.Context, client *AponoClient) context.Context

func NewRefreshableTokenSource

func NewRefreshableTokenSource(
	ctx context.Context,
	cfg oauth2.Config,
	token *oauth2.Token,
	f TokenUpdateFunc,
) oauth2.TokenSource

Types

type AponoClient

type AponoClient struct {
	*apono.APIClient
	ClientAPI *clientapi.APIClient
	Session   *Session
}

func CreateClient

func CreateClient(ctx context.Context, profileName string) (*AponoClient, error)

func GetClient added in v0.1.2

func GetClient(ctx context.Context) (*AponoClient, error)

type Session

type Session struct {
	AccountID string
	UserID    string
}

type TokenUpdateFunc

type TokenUpdateFunc func(*oauth2.Token) error

TokenUpdateFunc is a function that accepts an oauth2 Token upon refresh, and returns an error if it should not be used.

Jump to

Keyboard shortcuts

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