Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewClient ¶
func NewClient(ctx context.Context, stp api.StringTokenProvider, oaccf ...ClientCreationFunc) (api.HTTPClient, error)
NewClient conveniently creates an oAuth2 client out of the provided factory function referred by oaccf [OAuth2ClientCreationFunc] and by using a string token provided via stp [StringTokenProvider]
If the provided context is empty, the context will be initialised with context.Background
If stp is not provided, the routine defaults to trying to retrieve tokens from default environment variables determined by [WellKnownGithubTokenVarNames]
Also if oaccf is not provided, the default oAuth2 client creation mechanism is triggered via [NewOAuthClientDefault]
func NewClientDefault ¶
func NewClientDefault(ctx context.Context, ts goauth2.TokenSource) (api.HTTPClient, error)
NewClientDefault creates a default oAuth2 client
func NewStaticTokenSource ¶
func NewStaticTokenSource(token string) goauth2.TokenSource
NewStaticTokenSource conveniently creates a goauth2.StaticTokenSource based on the provided token, which must be non-empty
Types ¶
type ClientCreationFunc ¶
type ClientCreationFunc func(ctx context.Context, ts goauth2.TokenSource) (api.HTTPClient, error)
ClientCreationFunc defines the structure of a function, which is capable for creating an oauth2 client