From e755aafe29354f1ec46b0418b0fb6b92ca6aeabb Mon Sep 17 00:00:00 2001 From: Unknwon Date: Sun, 2 Dec 2018 12:55:16 -0500 Subject: [PATCH] vendor: update github.com/gogs/go-gogs-client --- vendor/github.com/gogs/go-gogs-client/gogs.go | 4 ++-- vendor/github.com/gogs/go-gogs-client/org.go | 9 +++++++++ vendor/github.com/gogs/go-gogs-client/repo.go | 18 ++++++++++++++++++ .../gogs/go-gogs-client/repo_collaborator.go | 2 +- .../gogs/go-gogs-client/repo_file.go | 8 ++++++++ .../gogs/go-gogs-client/user_follow.go | 2 +- vendor/vendor.json | 6 ++++++ 7 files changed, 45 insertions(+), 4 deletions(-) diff --git a/vendor/github.com/gogs/go-gogs-client/gogs.go b/vendor/github.com/gogs/go-gogs-client/gogs.go index 1c81d16f0..582900f85 100644 --- a/vendor/github.com/gogs/go-gogs-client/gogs.go +++ b/vendor/github.com/gogs/go-gogs-client/gogs.go @@ -14,7 +14,7 @@ import ( ) func Version() string { - return "0.12.12" + return "0.12.13" } // Client represents a Gogs API client. @@ -24,7 +24,7 @@ type Client struct { client *http.Client } -// NewClient initializes and returns a API client. +// NewClient initializes and returns an API client. func NewClient(url, token string) *Client { return &Client{ url: strings.TrimSuffix(url, "/"), diff --git a/vendor/github.com/gogs/go-gogs-client/org.go b/vendor/github.com/gogs/go-gogs-client/org.go index 08d008822..10d22b50c 100644 --- a/vendor/github.com/gogs/go-gogs-client/org.go +++ b/vendor/github.com/gogs/go-gogs-client/org.go @@ -50,6 +50,15 @@ type EditOrgOption struct { Location string `json:"location"` } +func (c *Client) CreateOrg(opt CreateOrgOption) (*Organization, error) { + body, err := json.Marshal(&opt) + if err != nil { + return nil, err + } + org := new(Organization) + return org, c.getParsedResponse("POST", "/user/orgs", jsonHeader, bytes.NewReader(body), org) +} + func (c *Client) EditOrg(orgname string, opt EditOrgOption) error { body, err := json.Marshal(&opt) if err != nil { diff --git a/vendor/github.com/gogs/go-gogs-client/repo.go b/vendor/github.com/gogs/go-gogs-client/repo.go index 48ded4758..ddcea9989 100644 --- a/vendor/github.com/gogs/go-gogs-client/repo.go +++ b/vendor/github.com/gogs/go-gogs-client/repo.go @@ -127,3 +127,21 @@ func (c *Client) MigrateRepo(opt MigrateRepoOption) (*Repository, error) { repo := new(Repository) return repo, c.getParsedResponse("POST", "/repos/migrate", jsonHeader, bytes.NewReader(body), repo) } + +type EditIssueTrackerOption struct { + EnableIssues *bool `json:"enable_issues"` + EnableExternalTracker *bool `json:"enable_external_tracker"` + ExternalTrackerURL *string `json:"external_tracker_url"` + TrackerURLFormat *string `json:"tracker_url_format"` + TrackerIssueStyle *string `json:"tracker_issue_style"` +} + +// EditIssueTracker updates issue tracker options of the repository. +func (c *Client) EditIssueTracker(owner, repo string, opt EditIssueTrackerOption) error { + body, err := json.Marshal(&opt) + if err != nil { + return err + } + _, err = c.getResponse("PATCH", fmt.Sprintf("/repos/%s/%s/issue-tracker", owner, repo), jsonHeader, bytes.NewReader(body)) + return err +} diff --git a/vendor/github.com/gogs/go-gogs-client/repo_collaborator.go b/vendor/github.com/gogs/go-gogs-client/repo_collaborator.go index c382bc771..6030850e6 100644 --- a/vendor/github.com/gogs/go-gogs-client/repo_collaborator.go +++ b/vendor/github.com/gogs/go-gogs-client/repo_collaborator.go @@ -29,7 +29,7 @@ func (c *Client) AddCollaborator(user, repo, collaborator string, opt AddCollabo if err != nil { return err } - _, err = c.getResponse("PUT", fmt.Sprintf("/repos/%s/%s/collaborators/%s", user, repo, collaborator), nil, bytes.NewReader(body)) + _, err = c.getResponse("PUT", fmt.Sprintf("/repos/%s/%s/collaborators/%s", user, repo, collaborator), jsonHeader, bytes.NewReader(body)) return err } diff --git a/vendor/github.com/gogs/go-gogs-client/repo_file.go b/vendor/github.com/gogs/go-gogs-client/repo_file.go index c50708b44..d766fb6d8 100644 --- a/vendor/github.com/gogs/go-gogs-client/repo_file.go +++ b/vendor/github.com/gogs/go-gogs-client/repo_file.go @@ -13,3 +13,11 @@ import ( func (c *Client) GetFile(user, repo, ref, tree string) ([]byte, error) { return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/raw/%s/%s", user, repo, ref, tree), nil, nil) } + +// GetArchive downloads the full contents of a repository. Ref can be a branch/tag/commit. +func (c *Client) GetArchive(user, repo, ref, format string) ([]byte, error) { + if format != ".zip" && format != ".tar.gz" { + return nil, fmt.Errorf("invalid format: %s (must be .zip or .tar.gz)", format) + } + return c.getResponse("GET", fmt.Sprintf("/repos/%s/%s/archive/%s%s", user, repo, ref, format), nil, nil) +} diff --git a/vendor/github.com/gogs/go-gogs-client/user_follow.go b/vendor/github.com/gogs/go-gogs-client/user_follow.go index 36cc65d45..5ba20cc08 100644 --- a/vendor/github.com/gogs/go-gogs-client/user_follow.go +++ b/vendor/github.com/gogs/go-gogs-client/user_follow.go @@ -37,7 +37,7 @@ func (c *Client) IsUserFollowing(user, target string) bool { } func (c *Client) Follow(target string) error { - _, err := c.getResponse("PUT", fmt.Sprintf("/user/following/%s", target), nil, nil) + _, err := c.getResponse("PUT", fmt.Sprintf("/user/following/%s", target), jsonHeader, nil) return err } diff --git a/vendor/vendor.json b/vendor/vendor.json index 44de4d8ca..702df522b 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -218,6 +218,12 @@ "revision": "dfc2c1e6d37744c84bf72e4649c87dec93eefffb", "revisionTime": "2018-10-23T10:58:32Z" }, + { + "checksumSHA1": "zQkw7E0MzSfPem4f9eCGhue21Nw=", + "path": "github.com/gogs/go-gogs-client", + "revision": "0c040274bc4e176c86a466e2ae327324fc143269", + "revisionTime": "2018-12-02T17:53:48Z" + }, { "checksumSHA1": "GaJLoEuMGnP5ofXvuweAI4wx06U=", "path": "github.com/golang/protobuf/proto",