summaryrefslogtreecommitdiffstats
path: root/vendor
diff options
context:
space:
mode:
authortechknowlogick <techknowlogick@users.noreply.github.com>2018-07-06 21:54:30 -0400
committerGitHub <noreply@github.com>2018-07-06 21:54:30 -0400
commitab55ca7ebd7d30dad894c35e6facd0b1822fb899 (patch)
tree979f05088d7d0362cb7c95f097ff3931b3dc2e91 /vendor
parent1675fc4301d4bff339a0831348fca76a9e394999 (diff)
downloadgitea-ab55ca7ebd7d30dad894c35e6facd0b1822fb899.tar.gz
gitea-ab55ca7ebd7d30dad894c35e6facd0b1822fb899.zip
Add ability to delete a token (#4235)
Fix #4234
Diffstat (limited to 'vendor')
-rw-r--r--vendor/code.gitea.io/sdk/gitea/user_app.go7
1 files changed, 7 insertions, 0 deletions
diff --git a/vendor/code.gitea.io/sdk/gitea/user_app.go b/vendor/code.gitea.io/sdk/gitea/user_app.go
index 08e98513ee..d3bfce971b 100644
--- a/vendor/code.gitea.io/sdk/gitea/user_app.go
+++ b/vendor/code.gitea.io/sdk/gitea/user_app.go
@@ -20,6 +20,7 @@ func BasicAuthEncode(user, pass string) string {
// AccessToken represents a API access token.
// swagger:response AccessToken
type AccessToken struct {
+ ID int64 `json:"id"`
Name string `json:"name"`
Sha1 string `json:"sha1"`
}
@@ -54,3 +55,9 @@ func (c *Client) CreateAccessToken(user, pass string, opt CreateAccessTokenOptio
"Authorization": []string{"Basic " + BasicAuthEncode(user, pass)}},
bytes.NewReader(body), t)
}
+
+// DeleteAccessToken delete token with key id
+func (c *Client) DeleteAccessToken(user string, keyID int64) error {
+ _, err := c.getResponse("DELETE", fmt.Sprintf("/user/%s/tokens/%d", user, keyID), nil, nil)
+ return err
+}