RepoLicense fetches an available repository license. It uses API v3 because licenses are not supported by GraphQL.
(httpClient *http.Client, hostname string, licenseName string)
| 1719 | // RepoLicense fetches an available repository license. |
| 1720 | // It uses API v3 because licenses are not supported by GraphQL. |
| 1721 | func 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. |