gh

package
v0.0.0-...-ddc1c62 Latest Latest
Warning

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

Go to latest
Published: Aug 4, 2025 License: MIT Imports: 12 Imported by: 0

Documentation

Index

Examples

Constants

This section is empty.

Variables

View Source
var DefaultCredentialGetter credentials.CredentialGetter = defaultCredentials()

DefaultCredentialGetter implements retrieving credentials from a netrc formatted file, with a location of ~/.netrc

View Source
var Logger = logrus.New()

Logger provides the default logger for the whole maiao project

Functions

func GitHubAPIDomain

func GitHubAPIDomain(domain string) string

func NewClient

func NewClient(httpClient *http.Client, domain string) (*github.Client, error)

NewClient instanciates a new github client depending on the domain name

When requesting a client for a different host than github.com, a client for github enterprise is considered

Credentials are even taken from GITHUB_TOKEN environment variable or from your ~/.netrc file

Example
httpClient, err := NewHTTPClientForDomain(context.Background(), "github.com")
if err != nil {
	Logger.Errorf("failed to create http client: %s", err.Error())
}
client, err := NewClient(httpClient, "github.com")
if err != nil {
	Logger.Errorf("failed to create github client: %s", err.Error())
}
repo, _, err := client.Repositories.Get(context.Background(), "adevinta", "maiao")
if err != nil {
	Logger.Errorf("failed to get github repository: %s", err.Error())
}
fmt.Println(repo.GetName())
Output:

maiao

func NewGraphQLClient

func NewGraphQLClient(httpClient *http.Client, domain string) (*api.GraphQLClient, error)

func NewHTTPClientForDomain

func NewHTTPClientForDomain(ctx context.Context, domain string) (*http.Client, error)

Types

This section is empty.

Jump to

Keyboard shortcuts

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