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
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=
"type": "string",
"x-go-name": "UserName"
},
+ "visibility": {
+ "$ref": "#/definitions/VisibleType"
+ },
"website": {
"type": "string",
"x-go-name": "Website"
"type": "string",
"x-go-name": "UserName"
},
+ "visibility": {
+ "$ref": "#/definitions/VisibleType"
+ },
"website": {
"type": "string",
"x-go-name": "Website"
},
"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",
"AccessToken": {
"description": "AccessToken represents an API access token.",
"headers": {
- "hashed_token": {
- "type": "string"
- },
"id": {
"type": "integer",
"format": "int64"
"name": {
"type": "string"
},
- "token": {
+ "sha1": {
"type": "string"
},
"token_last_eight": {
// 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
// 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
--- /dev/null
+// 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
+}
// 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)
}
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"`
}
-# 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