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

Function RepoLicense

api/queries_repo.go:1721–1733  ·  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

1719// RepoLicense fetches an available repository license.
1720// It uses API v3 because licenses are not supported by GraphQL.
1721func RepoLicense(httpClient *http.Client, hostname string, licenseName string) (*License, error) {
1722 var license License
1723 client := NewClientFromHTTP(httpClient)
1724 path, err := safeurl.JoinPath("licenses", licenseName)
1725 if err != nil {
1726 return nil, err
1727 }
1728 err = client.REST(hostname, "GET", path.String(), nil, &license)
1729 if err != nil {
1730 return nil, err
1731 }
1732 return &license, nil
1733}
1734
1735// RepoGitIgnoreTemplates fetches available repository gitignore templates.
1736// 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