From 1dc401635b8acb20f4222216ad0828ef39617989 Mon Sep 17 00:00:00 2001 From: techknowlogick Date: Fri, 10 May 2019 16:49:29 -0400 Subject: [PATCH] update sdk to latest (#6903) --- go.mod | 2 +- go.sum | 2 + templates/swagger/v1_json.tmpl | 17 +++++-- vendor/code.gitea.io/sdk/gitea/org.go | 26 +++++----- vendor/code.gitea.io/sdk/gitea/org_type.go | 49 +++++++++++++++++++ vendor/code.gitea.io/sdk/gitea/repo_commit.go | 2 +- vendor/code.gitea.io/sdk/gitea/user_app.go | 3 +- vendor/modules.txt | 2 +- 8 files changed, 82 insertions(+), 21 deletions(-) create mode 100644 vendor/code.gitea.io/sdk/gitea/org_type.go diff --git a/go.mod b/go.mod index f7e7a683ac..2657a27994 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module code.gitea.io/gitea go 1.12 require ( - code.gitea.io/sdk v0.0.0-20190419065346-2858b80da5f7 + code.gitea.io/sdk v0.0.0-20190510041517-9251befd3702 github.com/BurntSushi/toml v0.3.1 // indirect github.com/PuerkitoBio/goquery v0.0.0-20170324135448-ed7d758e9a34 github.com/RoaringBitmap/roaring v0.4.7 // indirect diff --git a/go.sum b/go.sum index ca64a7a5e7..ad9a0a9be4 100644 --- a/go.sum +++ b/go.sum @@ -1,6 +1,8 @@ cloud.google.com/go v0.30.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw= code.gitea.io/sdk v0.0.0-20190419065346-2858b80da5f7 h1:YggbbCVgggcOjKYmcB2wVOsEtJHgHUNFFJZDB6QcYTg= code.gitea.io/sdk v0.0.0-20190419065346-2858b80da5f7/go.mod h1:5bZt0dRznpn2JysytQnV0yCru3FwDv9O5G91jo+lDAk= +code.gitea.io/sdk v0.0.0-20190510041517-9251befd3702 h1:MyOmF6QejeIZfsEQYoJVHOm1PGNyGZMAZmo6cO8Hq80= +code.gitea.io/sdk v0.0.0-20190510041517-9251befd3702/go.mod h1:5bZt0dRznpn2JysytQnV0yCru3FwDv9O5G91jo+lDAk= github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ= github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU= github.com/PuerkitoBio/goquery v0.0.0-20170324135448-ed7d758e9a34 h1:UsHpWO0Elp6NaWVARdZHjiYwkhrspHVEGsyIKPb9OI8= diff --git a/templates/swagger/v1_json.tmpl b/templates/swagger/v1_json.tmpl index bc095f7237..198c18919e 100644 --- a/templates/swagger/v1_json.tmpl +++ b/templates/swagger/v1_json.tmpl @@ -7126,6 +7126,9 @@ "type": "string", "x-go-name": "UserName" }, + "visibility": { + "$ref": "#/definitions/VisibleType" + }, "website": { "type": "string", "x-go-name": "Website" @@ -8595,6 +8598,9 @@ "type": "string", "x-go-name": "UserName" }, + "visibility": { + "$ref": "#/definitions/VisibleType" + }, "website": { "type": "string", "x-go-name": "Website" @@ -9447,6 +9453,12 @@ }, "x-go-package": "code.gitea.io/gitea/models" }, + "VisibleType": { + "description": "VisibleType defines the visibility (Organization only)", + "type": "integer", + "format": "int64", + "x-go-package": "code.gitea.io/gitea/vendor/code.gitea.io/sdk/gitea" + }, "WatchInfo": { "description": "WatchInfo represents an API watch status of one repository", "type": "object", @@ -9484,9 +9496,6 @@ "AccessToken": { "description": "AccessToken represents an API access token.", "headers": { - "hashed_token": { - "type": "string" - }, "id": { "type": "integer", "format": "int64" @@ -9494,7 +9503,7 @@ "name": { "type": "string" }, - "token": { + "sha1": { "type": "string" }, "token_last_eight": { diff --git a/vendor/code.gitea.io/sdk/gitea/org.go b/vendor/code.gitea.io/sdk/gitea/org.go index 19238d1028..0897da3ef6 100644 --- a/vendor/code.gitea.io/sdk/gitea/org.go +++ b/vendor/code.gitea.io/sdk/gitea/org.go @@ -12,13 +12,14 @@ import ( // Organization represents an organization type Organization struct { - ID int64 `json:"id"` - UserName string `json:"username"` - FullName string `json:"full_name"` - AvatarURL string `json:"avatar_url"` - Description string `json:"description"` - Website string `json:"website"` - Location string `json:"location"` + ID int64 `json:"id"` + UserName string `json:"username"` + FullName string `json:"full_name"` + AvatarURL string `json:"avatar_url"` + Description string `json:"description"` + Website string `json:"website"` + Location string `json:"location"` + Visibility VisibleType `json:"visibility"` } // ListMyOrgs list all of current user's organizations @@ -42,11 +43,12 @@ func (c *Client) GetOrg(orgname string) (*Organization, error) { // CreateOrgOption options for creating an organization type CreateOrgOption struct { // required: true - UserName string `json:"username" binding:"Required"` - FullName string `json:"full_name"` - Description string `json:"description"` - Website string `json:"website"` - Location string `json:"location"` + UserName string `json:"username" binding:"Required"` + FullName string `json:"full_name"` + Description string `json:"description"` + Website string `json:"website"` + Location string `json:"location"` + Visibility VisibleType `json:"visibility"` } // EditOrgOption options for editing an organization diff --git a/vendor/code.gitea.io/sdk/gitea/org_type.go b/vendor/code.gitea.io/sdk/gitea/org_type.go new file mode 100644 index 0000000000..778ec3b0a7 --- /dev/null +++ b/vendor/code.gitea.io/sdk/gitea/org_type.go @@ -0,0 +1,49 @@ +// 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. + +package gitea + +// VisibleType defines the visibility (Organization only) +type VisibleType int + +const ( + // VisibleTypePublic Visible for everyone + VisibleTypePublic VisibleType = iota + + // VisibleTypeLimited Visible for every connected user + VisibleTypeLimited + + // VisibleTypePrivate Visible only for organization's members + VisibleTypePrivate +) + +// VisibilityModes is a map of org Visibility types +var VisibilityModes = map[string]VisibleType{ + "public": VisibleTypePublic, + "limited": VisibleTypeLimited, + "private": VisibleTypePrivate, +} + +// IsPublic returns true if VisibleType is public +func (vt VisibleType) IsPublic() bool { + return vt == VisibleTypePublic +} + +// IsLimited returns true if VisibleType is limited +func (vt VisibleType) IsLimited() bool { + return vt == VisibleTypeLimited +} + +// IsPrivate returns true if VisibleType is private +func (vt VisibleType) IsPrivate() bool { + return vt == VisibleTypePrivate +} + +// ExtractKeysFromMapString provides a slice of keys from map +func ExtractKeysFromMapString(in map[string]VisibleType) (keys []string) { + for k := range in { + keys = append(keys, k) + } + return +} diff --git a/vendor/code.gitea.io/sdk/gitea/repo_commit.go b/vendor/code.gitea.io/sdk/gitea/repo_commit.go index 74c52c06fb..1df66428aa 100644 --- a/vendor/code.gitea.io/sdk/gitea/repo_commit.go +++ b/vendor/code.gitea.io/sdk/gitea/repo_commit.go @@ -50,5 +50,5 @@ type Commit struct { // GetSingleCommit returns a single commit func (c *Client) GetSingleCommit(user, repo, commitID string) (*Commit, error) { commit := new(Commit) - return commit, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/commits/%s", user, repo, commitID), nil, nil, &commit) + return commit, c.getParsedResponse("GET", fmt.Sprintf("/repos/%s/%s/git/commits/%s", user, repo, commitID), nil, nil, &commit) } diff --git a/vendor/code.gitea.io/sdk/gitea/user_app.go b/vendor/code.gitea.io/sdk/gitea/user_app.go index 023837f83b..c5367be5cd 100644 --- a/vendor/code.gitea.io/sdk/gitea/user_app.go +++ b/vendor/code.gitea.io/sdk/gitea/user_app.go @@ -23,8 +23,7 @@ func BasicAuthEncode(user, pass string) string { type AccessToken struct { ID int64 `json:"id"` Name string `json:"name"` - Token string `json:"token"` - HashedToken string `json:"hashed_token"` + Token string `json:"sha1"` TokenLastEight string `json:"token_last_eight"` } diff --git a/vendor/modules.txt b/vendor/modules.txt index 370cfece98..715f20a130 100644 --- a/vendor/modules.txt +++ b/vendor/modules.txt @@ -1,4 +1,4 @@ -# code.gitea.io/sdk v0.0.0-20190419065346-2858b80da5f7 +# code.gitea.io/sdk v0.0.0-20190510041517-9251befd3702 code.gitea.io/sdk/gitea # github.com/BurntSushi/toml v0.3.1 github.com/BurntSushi/toml