Parcourir la source

vendor: update github.com/gogs/go-gogs-client

Unknwon il y a 6 ans
Parent
commit
e755aafe29

+ 2 - 2
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, "/"),

+ 9 - 0
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 {

+ 18 - 0
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
+}

+ 1 - 1
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
 }
 

+ 8 - 0
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)
+}

+ 1 - 1
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
 }
 

+ 6 - 0
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",