github

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Dec 12, 2024 License: Apache-2.0 Imports: 8 Imported by: 2

Documentation

Index

Constants

View Source
const (
	AppIDKey             = "githubAppID"
	AppInstallationIDKey = "githubAppInstallationID"
	AppPrivateKey        = "githubAppPrivateKey"
	AppBaseUrlKey        = "githubAppBaseURL"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type AppToken

type AppToken struct {
	Token     string    `json:"token"`
	ExpiresAt time.Time `json:"expires_at"`
}

AppToken contains a GitHub App installation token and its expiry.

type Client

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

Client is an authentication provider for GitHub Apps.

func New

func New(opts ...OptFunc) (*Client, error)

New returns a new authentication provider for GitHub Apps.

func (*Client) GetToken

func (p *Client) GetToken(ctx context.Context) (*AppToken, error)

GetToken returns the token that can be used to authenticate as a GitHub App installation. Ref: https://docs.github.com/en/apps/creating-github-apps/authenticating-with-a-github-app/authenticating-as-a-github-app-installation

type OptFunc

type OptFunc func(*Client)

OptFunc enables specifying options for the provider.

func WithAppBaseURL

func WithAppBaseURL(appBaseURL string) OptFunc

WithAppBaseURL configures the GitHub API endpoint to use to fetch GitHub App installation token.

func WithAppData

func WithAppData(appData map[string][]byte) OptFunc

WithAppData configures the client using data from a map

func WithAppID

func WithAppID(appID string) OptFunc

WithAppID configures the app ID of the GitHub App.

func WithInstllationID

func WithInstllationID(installationID string) OptFunc

WithInstallationID configures the installation ID of the GitHub App.

func WithPrivateKey

func WithPrivateKey(pk []byte) OptFunc

WithPrivateKey configures the private key of the GitHub App.

func WithProxyURL

func WithProxyURL(proxyURL *url.URL) OptFunc

WithProxyURL sets the proxy URL to use with the transport.

Jump to

Keyboard shortcuts

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