RepoGitIgnoreTemplate fetches an available repository gitignore template. It uses API v3 here because gitignore template isn't supported by GraphQL.
(httpClient *http.Client, hostname string, gitIgnoreTemplateName string)
| 1744 | // RepoGitIgnoreTemplate fetches an available repository gitignore template. |
| 1745 | // It uses API v3 here because gitignore template isn't supported by GraphQL. |
| 1746 | func RepoGitIgnoreTemplate(httpClient *http.Client, hostname string, gitIgnoreTemplateName string) (*GitIgnore, error) { |
| 1747 | var gitIgnoreTemplate GitIgnore |
| 1748 | client := NewClientFromHTTP(httpClient) |
| 1749 | path, err := safeurl.JoinPath("gitignore", "templates", gitIgnoreTemplateName) |
| 1750 | if err != nil { |
| 1751 | return nil, err |
| 1752 | } |
| 1753 | err = client.REST(hostname, "GET", path.String(), nil, &gitIgnoreTemplate) |
| 1754 | if err != nil { |
| 1755 | return nil, err |
| 1756 | } |
| 1757 | return &gitIgnoreTemplate, nil |
| 1758 | } |