Documentation
¶
Index ¶
- Variables
- func GitHubAPIDomain(domain string) string
- func NewClient(httpClient *http.Client, domain string) (*github.Client, error)
- func NewGraphQLClient(httpClient *http.Client, domain string) (*api.GraphQLClient, error)
- func NewHTTPClientForDomain(ctx context.Context, domain string) (*http.Client, error)
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 NewClient ¶
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 ¶
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.