update sdk to latest (#6903)
This commit is contained in:
parent
d64a646c0a
commit
1dc401635b
2
go.mod
2
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
|
||||
|
|
2
go.sum
2
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=
|
||||
|
|
|
@ -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": {
|
||||
|
|
|
@ -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
|
||||
|
|
|
@ -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
|
||||
}
|
|
@ -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)
|
||||
}
|
||||
|
|
|
@ -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"`
|
||||
}
|
||||
|
||||
|
|
|
@ -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
|
||||
|
|
Loading…
Reference in New Issue