githubapps

package
v1.1.2-0...-4fe2cf0 Latest Latest
Warning

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

Go to latest
Published: Jan 18, 2025 License: MIT Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrShowHelp = errors.New("receive show help args")
)

Functions

This section is empty.

Types

type Auther

type Auther interface {
	FetchToken(context.Context) (string, error)
}

Auther provides API Token with authentication on GitHub Apps.

func NewAutherFromFile

func NewAutherFromFile(privateKey string, appID int64, options ...AutherOption) (Auther, error)

NewAutherFromFile is constructor with filename that private key for Auther.

type AutherOption

type AutherOption func(*auther) error

AutherOption is set parameter. This is like a Functional Option Pattern.

func WithBaseURL

func WithBaseURL(base string) AutherOption

WithBaseURL provides change api endpoint. For GitHub Enterprise

func WithInstallationID

func WithInstallationID(id int64) AutherOption

WithInstallationID is option parameter with installation ID for Auther.

func WithLogin

func WithLogin(ctx context.Context, login string) AutherOption

WithLogin is optional parameter for Auther. This provides to search a installation ID from login name.

func WithStore

func WithStore(store Store) AutherOption

WithStore provides injection token store to Auther.

type Runner

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

Runner provides retrieving token

func ParseArgs

func ParseArgs() (*Runner, error)

ParseArgs is retrieve github apps credentials with command line options.

func (*Runner) Args

func (r *Runner) Args() []string

Args returns command options not contains parsed.

func (*Runner) Hostname

func (r *Runner) Hostname() string

Hostname returns hostname from arguments

func (*Runner) Run

func (r *Runner) Run(ctx context.Context) (string, error)

Run returns credentials

type Store

type Store interface {
	Save(token string, expire time.Time) error
	Token() string
	Expired() bool
}

Store is store for token and expires.

func NewFileStore

func NewFileStore(path string) (Store, error)

NewFileStore returns Store from path of credential file

Jump to

Keyboard shortcuts

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