pkg

package
v0.0.18 Latest Latest
Warning

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

Go to latest
Published: Jun 28, 2024 License: MIT Imports: 8 Imported by: 1

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client struct {
	*github.ApiClient
}

Client wraps github.ApiClient so that we may provide neater constructors and ease of use

func NewApiClient

func NewApiClient(optionFuncs ...ClientOptionFunc) (*Client, error)

NewApiClient is a convenience constructor to create a new instance of a Client (wrapper of *github.ApiClient) with the provided option functions. By default, it includes a rate limiting middleware.

type ClientOptionFunc

type ClientOptionFunc func(*ClientOptions)

ClientOptionFunc provides a functional pattern for client configuration

func WithAPIVersion

func WithAPIVersion(version string) ClientOptionFunc

WithAPIVersion configures the client with the given API version.

func WithBaseUrl

func WithBaseUrl(baseURL string) ClientOptionFunc

WithBaseUrl configures the client with the given base URL.

func WithGitHubAppAuthentication added in v0.0.15

func WithGitHubAppAuthentication(pemFilePath string, clientID string, installationID int64) ClientOptionFunc

WithGitHubAppAuthentication configures the client with the given GitHub App auth.

func WithGitHubAppAuthenticationUsingAppID added in v0.0.15

func WithGitHubAppAuthenticationUsingAppID(pemFilePath string, appID int64, installationID int64) ClientOptionFunc

WithGitHubAppAuthenticationUsingAppID configures the client with the given GitHub App auth. Deprecated: Use WithGitHubAppAuthentication instead, which takes in a clientID string instead of an appID integer.

func WithRequestTimeout

func WithRequestTimeout(timeout time.Duration) ClientOptionFunc

WithRequestTimeout configures the client with the given request timeout.

func WithTokenAuthentication added in v0.0.15

func WithTokenAuthentication(token string) ClientOptionFunc

WithTokenAuthentication configures the client with the given Personal Authorization Token.

func WithUserAgent

func WithUserAgent(userAgent string) ClientOptionFunc

WithUserAgent configures the client with the given user agent string.

type ClientOptions

type ClientOptions struct {
	UserAgent      string
	APIVersion     string
	RequestTimeout time.Duration
	Middleware     []kiotaHttp.Middleware
	BaseURL        string

	// Token should be left blank if GitHub App auth or an unauthenticated client is desired.
	Token string

	// GitHubAppPemFilePath should be left blank if token auth or an unauthenticated client is desired.
	GitHubAppPemFilePath string
	// GitHubAppID should be left blank if token auth or an unauthenticated client is desired.
	// Deprecated: Use GitHubAppClientID instead.
	GitHubAppID int64
	// GitHubAppClientID should be left blank if token auth or an unauthenticated client is desired.
	GitHubAppClientID string
	// GitHubAppInstallationID should be left blank if token auth or an unauthenticated client is desired.
	GitHubAppInstallationID int64
}

ClientOptions contains every setting we could possibly want to set for the token provider, the netHttpClient, the middleware, and the adapter. If we can possibly override it, it should be in this struct. In the constructor, when helper functions apply options, they'll be applied to this struct. Then later in the constructor when that chain of objects is put together, all configuration will be drawn from this (hydrated) struct.

func GetDefaultClientOptions

func GetDefaultClientOptions() *ClientOptions

GetDefaultClientOptions returns a new instance of ClientOptions with default values. This is used in the NewApiClient constructor before applying user-defined custom options.

Directories

Path Synopsis
app
zen

Jump to

Keyboard shortcuts

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