1
0
Fork 0
mirror of https://github.com/documize/community.git synced 2025-07-20 05:39:42 +02:00
Migrated from plain /vendor to go dep
This commit is contained in:
Harvey Kandola 2018-02-14 15:23:46 +00:00
parent 0262763c95
commit fd693f4ff4
957 changed files with 36866 additions and 177595 deletions

View file

@ -5,13 +5,16 @@
package github
import "fmt"
import (
"context"
"fmt"
)
// RepositoryListForksOptions specifies the optional parameters to the
// RepositoriesService.ListForks method.
type RepositoryListForksOptions struct {
// How to sort the forks list. Possible values are: newest, oldest,
// watchers. Default is "newest".
// How to sort the forks list. Possible values are: newest, oldest,
// watchers. Default is "newest".
Sort string `url:"sort,omitempty"`
ListOptions
@ -19,8 +22,8 @@ type RepositoryListForksOptions struct {
// ListForks lists the forks of the specified repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/forks/#list-forks
func (s *RepositoriesService) ListForks(owner, repo string, opt *RepositoryListForksOptions) ([]*Repository, *Response, error) {
// GitHub API docs: https://developer.github.com/v3/repos/forks/#list-forks
func (s *RepositoriesService) ListForks(ctx context.Context, owner, repo string, opt *RepositoryListForksOptions) ([]*Repository, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/forks", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@ -32,13 +35,16 @@ func (s *RepositoriesService) ListForks(owner, repo string, opt *RepositoryListF
return nil, nil, err
}
repos := new([]*Repository)
resp, err := s.client.Do(req, repos)
// TODO: remove custom Accept header when topics API fully launches.
req.Header.Set("Accept", mediaTypeTopicsPreview)
var repos []*Repository
resp, err := s.client.Do(ctx, req, &repos)
if err != nil {
return nil, resp, err
}
return *repos, resp, err
return repos, resp, nil
}
// RepositoryCreateForkOptions specifies the optional parameters to the
@ -50,8 +56,14 @@ type RepositoryCreateForkOptions struct {
// CreateFork creates a fork of the specified repository.
//
// GitHub API docs: http://developer.github.com/v3/repos/forks/#list-forks
func (s *RepositoriesService) CreateFork(owner, repo string, opt *RepositoryCreateForkOptions) (*Repository, *Response, error) {
// This method might return an *AcceptedError and a status code of
// 202. This is because this is the status that GitHub returns to signify that
// it is now computing creating the fork in a background task.
// A follow up request, after a delay of a second or so, should result
// in a successful request.
//
// GitHub API docs: https://developer.github.com/v3/repos/forks/#create-a-fork
func (s *RepositoriesService) CreateFork(ctx context.Context, owner, repo string, opt *RepositoryCreateForkOptions) (*Repository, *Response, error) {
u := fmt.Sprintf("repos/%v/%v/forks", owner, repo)
u, err := addOptions(u, opt)
if err != nil {
@ -64,10 +76,10 @@ func (s *RepositoriesService) CreateFork(owner, repo string, opt *RepositoryCrea
}
fork := new(Repository)
resp, err := s.client.Do(req, fork)
resp, err := s.client.Do(ctx, req, fork)
if err != nil {
return nil, resp, err
}
return fork, resp, err
return fork, resp, nil
}