gh

package
v1.5.23 Latest Latest
Warning

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

Go to latest
Published: Jun 13, 2023 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// WellKnownTokenVarNames lists known env var names for Github related tokens
	WellKnownTokenVarNames = []string{"GITHUB_TOKEN", "GH_TOKEN", "NPM_TOKEN"}
)

Functions

func NewClient

func NewClient(authenticated *http.Client, gccf ...ClientCreationFunc) (*github.Client, error)

NewClient conveniently creates a client connection to the Github API based on an already authenticated http client connection

If the authenticated client is not provided, a new client will be created by calling [NewOAuthClient] trying to find tokens in [WellKnownGithubTokenVarNames]

Providing a parameter for gccf would allow creating the github client with a customized function

func NewClientDefault

func NewClientDefault(authenticated *http.Client) (*github.Client, error)

NewClientDefault provides a client connection to the Github API based on an already authenticated http client connection

Types

type ClientCreationFunc

type ClientCreationFunc func(*http.Client) (*github.Client, error)

ClientCreationFunc defines the structure of a function, which is capable for creating an oauth2 client

Jump to

Keyboard shortcuts

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