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

Function RepoLicenses

api/queries_repo.go:1705–1717  ·  view source on GitHub ↗

RepoLicenses fetches available repository licenses. It uses API v3 because licenses are not supported by GraphQL.

(httpClient *http.Client, hostname string)

Source from the content-addressed store, hash-verified

1703// RepoLicenses fetches available repository licenses.
1704// It uses API v3 because licenses are not supported by GraphQL.
1705func RepoLicenses(httpClient *http.Client, hostname string) ([]License, error) {
1706 var licenses []License
1707 client := NewClientFromHTTP(httpClient)
1708 path, err := safeurl.JoinPath("licenses")
1709 if err != nil {
1710 return nil, err
1711 }
1712 err = client.REST(hostname, "GET", path.String(), nil, &licenses)
1713 if err != nil {
1714 return nil, err
1715 }
1716 return licenses, nil
1717}
1718
1719// RepoLicense fetches an available repository license.
1720// It uses API v3 because licenses are not supported by GraphQL.

Callers 4

listRunFunction · 0.92
NewCmdCreateFunction · 0.92
interactiveLicenseFunction · 0.92

Calls 4

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

Tested by 1