Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Export ArchiveFormat #1534

Merged
merged 2 commits into from
May 28, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions github/repos_contents.go
Original file line number Diff line number Diff line change
Expand Up @@ -228,23 +228,23 @@ func (s *RepositoriesService) DeleteFile(ctx context.Context, owner, repo, path
return deleteResponse, resp, nil
}

// archiveFormat is used to define the archive type when calling GetArchiveLink.
type archiveFormat string
// ArchiveFormat is used to define the archive type when calling GetArchiveLink.
type ArchiveFormat string

const (
// Tarball specifies an archive in gzipped tar format.
Tarball archiveFormat = "tarball"
Tarball ArchiveFormat = "tarball"

// Zipball specifies an archive in zip format.
Zipball archiveFormat = "zipball"
Zipball ArchiveFormat = "zipball"
)

// GetArchiveLink returns an URL to download a tarball or zipball archive for a
// repository. The archiveFormat can be specified by either the github.Tarball
// or github.Zipball constant.
//
// GitHub API docs: https://developer.github.com/v3/repos/contents/#get-archive-link
func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat archiveFormat, opts *RepositoryContentGetOptions, followRedirects bool) (*url.URL, *Response, error) {
func (s *RepositoriesService) GetArchiveLink(ctx context.Context, owner, repo string, archiveformat ArchiveFormat, opts *RepositoryContentGetOptions, followRedirects bool) (*url.URL, *Response, error) {
u := fmt.Sprintf("repos/%s/%s/%s", owner, repo, archiveformat)
if opts != nil && opts.Ref != "" {
u += fmt.Sprintf("/%s", opts.Ref)
Expand Down