]> source.dussan.org Git - gitea.git/commitdiff
update sdk to latest (#6903)
authortechknowlogick <hello@techknowlogick.com>
Fri, 10 May 2019 20:49:29 +0000 (16:49 -0400)
committerGitHub <noreply@github.com>
Fri, 10 May 2019 20:49:29 +0000 (16:49 -0400)
go.mod
go.sum
templates/swagger/v1_json.tmpl
vendor/code.gitea.io/sdk/gitea/org.go
vendor/code.gitea.io/sdk/gitea/org_type.go [new file with mode: 0644]
vendor/code.gitea.io/sdk/gitea/repo_commit.go
vendor/code.gitea.io/sdk/gitea/user_app.go
vendor/modules.txt

diff --git a/go.mod b/go.mod
index f7e7a683ac1f0d6a5cf79b30668de1318cdfac35..2657a279948fe1784945403267617294b4a840d9 100644 (file)
--- 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 ca64a7a5e7680f689177bb55bb83fd982cce3258..ad9a0a9be4d7f7fc916d396fe03df9bf338852c4 100644 (file)
--- 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=
index bc095f723741501f97cf28a1954d0b363640c397..198c18919e51329ab6d2f8bd60847588a82b7a1e 100644 (file)
           "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": {
index 19238d1028453aba19c88047424f5519ddefe41d..0897da3ef6b58731ea5d7c81b7651254ec989a51 100644 (file)
@@ -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 (file)
index 0000000..778ec3b
--- /dev/null
@@ -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
+}
index 74c52c06fb0bc87d35dcabba907f7dcdfda6901d..1df66428aa433cc69822ce185216bc6e204cfd54 100644 (file)
@@ -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)
 }
index 023837f83bfe25df5db9a68abaf67db0e8ddd987..c5367be5cd34d7adcac01e41a3d1058589e9da21 100644 (file)
@@ -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"`
 }
 
index 370cfece985ca10982c8d7a3edd2999102e387f3..715f20a130fae6648cb933a150eca9de110d192d 100644 (file)
@@ -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