diff options
author | Segev Finer <segev208@gmail.com> | 2019-02-25 20:56:47 +0200 |
---|---|---|
committer | techknowlogick <matti@mdranta.net> | 2019-02-25 13:56:47 -0500 |
commit | 594f59169129889387d792f6aa571150d4118dc6 (patch) | |
tree | ef4ba7db59acf97a5a2fd0d243d13958e3282811 /vendor | |
parent | 795f6e04ad7e42d168b85d44ec17eab31d741808 (diff) | |
download | gitea-594f59169129889387d792f6aa571150d4118dc6.tar.gz gitea-594f59169129889387d792f6aa571150d4118dc6.zip |
Increase Username and Orgname MaxSize 35 -> 40 (#6178)
* Increase Username and Orgname MaxSize 35 -> 40
Signed-off-by: Segev Finer <segev@codeocean.com>
* Dep update code.gitea.io/sdk
Signed-off-by: Segev Finer <segev@codeocean.com>
* Run generate-swagger
Signed-off-by: Segev Finer <segev@codeocean.com>
Diffstat (limited to 'vendor')
-rw-r--r-- | vendor/code.gitea.io/sdk/gitea/admin_user.go | 9 | ||||
-rw-r--r-- | vendor/code.gitea.io/sdk/gitea/gitea.go | 9 | ||||
-rw-r--r-- | vendor/code.gitea.io/sdk/gitea/issue.go | 16 |
3 files changed, 31 insertions, 3 deletions
diff --git a/vendor/code.gitea.io/sdk/gitea/admin_user.go b/vendor/code.gitea.io/sdk/gitea/admin_user.go index 089ff29644..a87ae89d44 100644 --- a/vendor/code.gitea.io/sdk/gitea/admin_user.go +++ b/vendor/code.gitea.io/sdk/gitea/admin_user.go @@ -1,4 +1,5 @@ // Copyright 2015 The Gogs Authors. All rights reserved. +// Copyright 2019 The Gitea Authors. All rights reserved. // Use of this source code is governed by a MIT-style // license that can be found in the LICENSE file. @@ -15,14 +16,15 @@ type CreateUserOption struct { SourceID int64 `json:"source_id"` LoginName string `json:"login_name"` // required: true - Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(35)"` + Username string `json:"username" binding:"Required;AlphaDashDot;MaxSize(40)"` FullName string `json:"full_name" binding:"MaxSize(100)"` // required: true // swagger:strfmt email Email string `json:"email" binding:"Required;Email;MaxSize(254)"` // required: true - Password string `json:"password" binding:"Required;MaxSize(255)"` - SendNotify bool `json:"send_notify"` + Password string `json:"password" binding:"Required;MaxSize(255)"` + MustChangePassword bool `json:"must_change_password"` + SendNotify bool `json:"send_notify"` } // AdminCreateUser create a user @@ -44,6 +46,7 @@ type EditUserOption struct { // swagger:strfmt email Email string `json:"email" binding:"Required;Email;MaxSize(254)"` Password string `json:"password" binding:"MaxSize(255)"` + MustChangePassword bool `json:"must_change_password"` Website string `json:"website" binding:"MaxSize(50)"` Location string `json:"location" binding:"MaxSize(50)"` Active *bool `json:"active"` diff --git a/vendor/code.gitea.io/sdk/gitea/gitea.go b/vendor/code.gitea.io/sdk/gitea/gitea.go index a5509b2aba..d90a6ebc15 100644 --- a/vendor/code.gitea.io/sdk/gitea/gitea.go +++ b/vendor/code.gitea.io/sdk/gitea/gitea.go @@ -23,6 +23,7 @@ func Version() string { type Client struct { url string accessToken string + sudo string client *http.Client } @@ -40,12 +41,20 @@ func (c *Client) SetHTTPClient(client *http.Client) { c.client = client } +// SetSudo sets username to impersonate. +func (c *Client) SetSudo(sudo string) { + c.sudo = sudo +} + func (c *Client) doRequest(method, path string, header http.Header, body io.Reader) (*http.Response, error) { req, err := http.NewRequest(method, c.url+"/api/v1"+path, body) if err != nil { return nil, err } req.Header.Set("Authorization", "token "+c.accessToken) + if c.sudo != "" { + req.Header.Set("Sudo", c.sudo) + } for k, v := range header { req.Header[k] = v } diff --git a/vendor/code.gitea.io/sdk/gitea/issue.go b/vendor/code.gitea.io/sdk/gitea/issue.go index 8fc2b2bf7b..0a1defb6f3 100644 --- a/vendor/code.gitea.io/sdk/gitea/issue.go +++ b/vendor/code.gitea.io/sdk/gitea/issue.go @@ -139,6 +139,22 @@ func (c *Client) EditIssue(owner, repo string, index int64, opt EditIssueOption) jsonHeader, bytes.NewReader(body), issue) } +// StartIssueStopWatch starts a stopwatch for an existing issue for a given +// repository +func (c *Client) StartIssueStopWatch(owner, repo string, index int64) error { + _, err := c.getResponse("POST", fmt.Sprintf("/repos/%s/%s/issues/%d/stopwatch/start", owner, repo, index), + jsonHeader, nil) + return err +} + +// StopIssueStopWatch stops an existing stopwatch for an issue in a given +// repository +func (c *Client) StopIssueStopWatch(owner, repo string, index int64) error { + _, err := c.getResponse("POST", fmt.Sprintf("/repos/%s/%s/issues/%d/stopwatch/stop", owner, repo, index), + jsonHeader, nil) + return err +} + // EditDeadlineOption options for creating a deadline type EditDeadlineOption struct { // required:true |