RepoLicenses fetches available repository licenses. It uses API v3 because licenses are not supported by GraphQL.
(httpClient *http.Client, hostname string)
| 1703 | // RepoLicenses fetches available repository licenses. |
| 1704 | // It uses API v3 because licenses are not supported by GraphQL. |
| 1705 | func 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. |