Skip to content

Commit

Permalink
Export ArchiveFormat (#1534)
Browse files Browse the repository at this point in the history
Fixes: #1533.
  • Loading branch information
gmlewis committed May 28, 2020
1 parent 8d28b93 commit ec3758e
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions github/repos_contents.go
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

0 comments on commit ec3758e

Please sign in to comment.