diff options
author | Unknwon <u@gogs.io> | 2018-12-02 12:55:16 -0500 |
---|---|---|
committer | Unknwon <u@gogs.io> | 2018-12-02 12:55:16 -0500 |
commit | e755aafe29354f1ec46b0418b0fb6b92ca6aeabb (patch) | |
tree | 1097fee0471b6d1bdf8f39fc628b7b656b7a35ef | |
parent | e1b3a250085195122c3b41b998504692f47fcb63 (diff) |
vendor: update github.com/gogs/go-gogs-client
-rw-r--r-- | vendor/github.com/gogs/go-gogs-client/gogs.go | 4 | ||||
-rw-r--r-- | vendor/github.com/gogs/go-gogs-client/org.go | 9 | ||||
-rw-r--r-- | vendor/github.com/gogs/go-gogs-client/repo.go | 18 | ||||
-rw-r--r-- | vendor/github.com/gogs/go-gogs-client/repo_collaborator.go | 2 | ||||
-rw-r--r-- | vendor/github.com/gogs/go-gogs-client/repo_file.go | 8 | ||||
-rw-r--r-- | vendor/github.com/gogs/go-gogs-client/user_follow.go | 2 | ||||
-rw-r--r-- | 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 1c81d16f..582900f8 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 08d00882..10d22b50 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 48ded475..ddcea998 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 c382bc77..6030850e 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 c50708b4..d766fb6d 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 36cc65d4..5ba20cc0 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 44de4d8c..702df522 100644 --- a/vendor/vendor.json +++ b/vendor/vendor.json @@ -219,6 +219,12 @@ "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", "revision": "a47340a8e42c4ceb44c00c2a05199e24b24fcaef", |