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