MCPcopy Create free account
hub / github.com/cli/cli / RepoLicense

Function RepoLicense

api/queries_repo.go:1714–1726  ·  view source on GitHub ↗

RepoLicense fetches an available repository license. It uses API v3 because licenses are not supported by GraphQL.

(httpClient *http.Client, hostname string, licenseName string)

Source from the content-addressed store, hash-verified

1712// RepoLicense fetches an available repository license.
1713// It uses API v3 because licenses are not supported by GraphQL.
1714func RepoLicense(httpClient *http.Client, hostname string, licenseName string) (*License, error) {
1715 var license License
1716 client := NewClientFromHTTP(httpClient)
1717 path, err := safeurl.JoinPath("licenses", licenseName)
1718 if err != nil {
1719 return nil, err
1720 }
1721 err = client.REST(hostname, "GET", path.String(), nil, &license)
1722 if err != nil {
1723 return nil, err
1724 }
1725 return &license, nil
1726}
1727
1728// RepoGitIgnoreTemplates fetches available repository gitignore templates.
1729// It uses API v3 here because gitignore template isn't supported by GraphQL.

Calls 4

JoinPathFunction · 0.92
NewClientFromHTTPFunction · 0.85
RESTMethod · 0.65
StringMethod · 0.65