]> source.dussan.org Git - gitea.git/commitdiff
Update vendor of code.gitea.io/sdk/gitea 970/head
authorAndrey Nering <andrey.nering@gmail.com>
Wed, 22 Feb 2017 23:53:33 +0000 (20:53 -0300)
committerAndrey Nering <andrey.nering@gmail.com>
Sat, 25 Feb 2017 13:04:22 +0000 (10:04 -0300)
vendor/code.gitea.io/sdk/gitea/hook.go
vendor/code.gitea.io/sdk/gitea/issue.go
vendor/code.gitea.io/sdk/gitea/pull.go
vendor/code.gitea.io/sdk/gitea/release.go [new file with mode: 0644]
vendor/code.gitea.io/sdk/gitea/releases.go [deleted file]
vendor/code.gitea.io/sdk/gitea/repo.go
vendor/code.gitea.io/sdk/gitea/user_gpgkey.go [new file with mode: 0644]
vendor/vendor.json

index 4e04275f863285414a667e86cc701cad8593b079..c2f88f4a31f458b557689f8fdfbf0e40c639f44d 100644 (file)
@@ -1,4 +1,5 @@
 // Copyright 2014 The Gogs Authors. All rights reserved.
+// Copyright 2017 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.
 
@@ -147,6 +148,7 @@ type PayloadCommit struct {
 var (
        _ Payloader = &CreatePayload{}
        _ Payloader = &PushPayload{}
+       _ Payloader = &IssuePayload{}
        _ Payloader = &PullRequestPayload{}
 )
 
@@ -277,8 +279,33 @@ const (
        HookIssueLabelCleared HookIssueAction = "label_cleared"
        // HookIssueSynchronized synchronized
        HookIssueSynchronized HookIssueAction = "synchronized"
+       // HookIssueMilestoned is an issue action for when a milestone is set on an issue.
+       HookIssueMilestoned HookIssueAction = "milestoned"
+       // HookIssueDemilestoned is an issue action for when a milestone is cleared on an issue.
+       HookIssueDemilestoned HookIssueAction = "demilestoned"
 )
 
+// IssuePayload represents the payload information that is sent along with an issue event.
+type IssuePayload struct {
+       Secret     string          `json:"secret"`
+       Action     HookIssueAction `json:"action"`
+       Index      int64           `json:"number"`
+       Changes    *ChangesPayload `json:"changes,omitempty"`
+       Issue      *Issue          `json:"issue"`
+       Repository *Repository     `json:"repository"`
+       Sender     *User           `json:"sender"`
+}
+
+// SetSecret modifies the secret of the IssuePayload.
+func (p *IssuePayload) SetSecret(secret string) {
+       p.Secret = secret
+}
+
+// JSONPayload encodes the IssuePayload to JSON, with an indentation of two spaces.
+func (p *IssuePayload) JSONPayload() ([]byte, error) {
+       return json.MarshalIndent(p, "", "  ")
+}
+
 // ChangesFromPayload FIXME
 type ChangesFromPayload struct {
        From string `json:"from"`
@@ -308,7 +335,7 @@ type PullRequestPayload struct {
        Sender      *User           `json:"sender"`
 }
 
-// SetSecret FIXME
+// SetSecret modifies the secret of the PullRequestPayload.
 func (p *PullRequestPayload) SetSecret(secret string) {
        p.Secret = secret
 }
index adb283abc25095b4f5036f7a18d7945474069157..729e54fe8b27b4e637d2ab2f0cd0391eea73fe62 100644 (file)
@@ -30,6 +30,7 @@ type PullRequestMeta struct {
 // Issue an issue to a repository
 type Issue struct {
        ID        int64      `json:"id"`
+       URL       string     `json:"url"`
        Index     int64      `json:"number"`
        Poster    *User      `json:"user"`
        Title     string     `json:"title"`
index f55ecc042edf2f291be750cca2e5db9bd96409ac..fcccf07e2b9c9004144c1400f396a3353abadbd7 100644 (file)
@@ -14,6 +14,7 @@ import (
 // PullRequest represents a pull request API object.
 type PullRequest struct {
        ID        int64      `json:"id"`
+       URL       string     `json:"url"`
        Index     int64      `json:"number"`
        Poster    *User      `json:"user"`
        Title     string     `json:"title"`
diff --git a/vendor/code.gitea.io/sdk/gitea/release.go b/vendor/code.gitea.io/sdk/gitea/release.go
new file mode 100644 (file)
index 0000000..de5ccba
--- /dev/null
@@ -0,0 +1,101 @@
+// Copyright 2016 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
+
+import (
+       "bytes"
+       "encoding/json"
+       "fmt"
+       "time"
+)
+
+// Release represents a repository release
+type Release struct {
+       ID           int64     `json:"id"`
+       TagName      string    `json:"name"`
+       Target       string    `json:"target_commitish"`
+       Title        string    `json:"name"`
+       Note         string    `json:"body"`
+       URL          string    `json:"url"`
+       TarURL       string    `json:"tarball_url"`
+       ZipURL       string    `json:"zipball_url"`
+       IsDraft      bool      `json:"draft"`
+       IsPrerelease bool      `json:"prerelease"`
+       CreatedAt    time.Time `json:"created_at"`
+       PublishedAt  time.Time `json:"published_at"`
+       Publisher    *User     `json:"author"`
+}
+
+// ListReleases list releases of a repository
+func (c *Client) ListReleases(user, repo string) ([]*Release, error) {
+       releases := make([]*Release, 0, 10)
+       err := c.getParsedResponse("GET",
+               fmt.Sprintf("/repos/%s/%s/releases", user, repo),
+               nil, nil, &releases)
+       return releases, err
+}
+
+// GetRelease get a release of a repository
+func (c *Client) GetRelease(user, repo string, id int64) (*Release, error) {
+       r := new(Release)
+       err := c.getParsedResponse("GET",
+               fmt.Sprintf("/repos/%s/%s/releases/%d", user, repo, id),
+               nil, nil, &r)
+       return r, err
+}
+
+// CreateReleaseOption options when creating a release
+type CreateReleaseOption struct {
+       TagName      string `json:"tag_name" binding:"Required"`
+       Target       string `json:"target_commitish"`
+       Title        string `json:"name"`
+       Note         string `json:"body"`
+       IsDraft      bool   `json:"draft"`
+       IsPrerelease bool   `json:"prerelease"`
+}
+
+// CreateRelease create a release
+func (c *Client) CreateRelease(user, repo string, form CreateReleaseOption) (*Release, error) {
+       body, err := json.Marshal(form)
+       if err != nil {
+               return nil, err
+       }
+       r := new(Release)
+       err = c.getParsedResponse("POST",
+               fmt.Sprintf("/repos/%s/%s/releases", user, repo),
+               jsonHeader, bytes.NewReader(body), r)
+       return r, err
+}
+
+// EditReleaseOption options when editing a release
+type EditReleaseOption struct {
+       TagName      string `json:"tag_name"`
+       Target       string `json:"target_commitish"`
+       Title        string `json:"name"`
+       Note         string `json:"body"`
+       IsDraft      *bool  `json:"draft"`
+       IsPrerelease *bool  `json:"prerelease"`
+}
+
+// EditRelease edit a release
+func (c *Client) EditRelease(user, repo string, id int64, form EditReleaseOption) (*Release, error) {
+       body, err := json.Marshal(form)
+       if err != nil {
+               return nil, err
+       }
+       r := new(Release)
+       err = c.getParsedResponse("PATCH",
+               fmt.Sprintf("/repos/%s/%s/releases/%d", user, repo, id),
+               jsonHeader, bytes.NewReader(body), r)
+       return r, err
+}
+
+// DeleteRelease delete a release from a repository
+func (c *Client) DeleteRelease(user, repo string, id int64) error {
+       _, err := c.getResponse("DELETE",
+               fmt.Sprintf("/repos/%s/%s/releases/%d", user, repo, id),
+               nil, nil)
+       return err
+}
diff --git a/vendor/code.gitea.io/sdk/gitea/releases.go b/vendor/code.gitea.io/sdk/gitea/releases.go
deleted file mode 100644 (file)
index de5ccba..0000000
+++ /dev/null
@@ -1,101 +0,0 @@
-// Copyright 2016 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
-
-import (
-       "bytes"
-       "encoding/json"
-       "fmt"
-       "time"
-)
-
-// Release represents a repository release
-type Release struct {
-       ID           int64     `json:"id"`
-       TagName      string    `json:"name"`
-       Target       string    `json:"target_commitish"`
-       Title        string    `json:"name"`
-       Note         string    `json:"body"`
-       URL          string    `json:"url"`
-       TarURL       string    `json:"tarball_url"`
-       ZipURL       string    `json:"zipball_url"`
-       IsDraft      bool      `json:"draft"`
-       IsPrerelease bool      `json:"prerelease"`
-       CreatedAt    time.Time `json:"created_at"`
-       PublishedAt  time.Time `json:"published_at"`
-       Publisher    *User     `json:"author"`
-}
-
-// ListReleases list releases of a repository
-func (c *Client) ListReleases(user, repo string) ([]*Release, error) {
-       releases := make([]*Release, 0, 10)
-       err := c.getParsedResponse("GET",
-               fmt.Sprintf("/repos/%s/%s/releases", user, repo),
-               nil, nil, &releases)
-       return releases, err
-}
-
-// GetRelease get a release of a repository
-func (c *Client) GetRelease(user, repo string, id int64) (*Release, error) {
-       r := new(Release)
-       err := c.getParsedResponse("GET",
-               fmt.Sprintf("/repos/%s/%s/releases/%d", user, repo, id),
-               nil, nil, &r)
-       return r, err
-}
-
-// CreateReleaseOption options when creating a release
-type CreateReleaseOption struct {
-       TagName      string `json:"tag_name" binding:"Required"`
-       Target       string `json:"target_commitish"`
-       Title        string `json:"name"`
-       Note         string `json:"body"`
-       IsDraft      bool   `json:"draft"`
-       IsPrerelease bool   `json:"prerelease"`
-}
-
-// CreateRelease create a release
-func (c *Client) CreateRelease(user, repo string, form CreateReleaseOption) (*Release, error) {
-       body, err := json.Marshal(form)
-       if err != nil {
-               return nil, err
-       }
-       r := new(Release)
-       err = c.getParsedResponse("POST",
-               fmt.Sprintf("/repos/%s/%s/releases", user, repo),
-               jsonHeader, bytes.NewReader(body), r)
-       return r, err
-}
-
-// EditReleaseOption options when editing a release
-type EditReleaseOption struct {
-       TagName      string `json:"tag_name"`
-       Target       string `json:"target_commitish"`
-       Title        string `json:"name"`
-       Note         string `json:"body"`
-       IsDraft      *bool  `json:"draft"`
-       IsPrerelease *bool  `json:"prerelease"`
-}
-
-// EditRelease edit a release
-func (c *Client) EditRelease(user, repo string, id int64, form EditReleaseOption) (*Release, error) {
-       body, err := json.Marshal(form)
-       if err != nil {
-               return nil, err
-       }
-       r := new(Release)
-       err = c.getParsedResponse("PATCH",
-               fmt.Sprintf("/repos/%s/%s/releases/%d", user, repo, id),
-               jsonHeader, bytes.NewReader(body), r)
-       return r, err
-}
-
-// DeleteRelease delete a release from a repository
-func (c *Client) DeleteRelease(user, repo string, id int64) error {
-       _, err := c.getResponse("DELETE",
-               fmt.Sprintf("/repos/%s/%s/releases/%d", user, repo, id),
-               nil, nil)
-       return err
-}
index 75d6395cb7880577de9519c20ef8992fe37417e2..9399ca2ee31210fbed41be0db78c9a62d9f0ebd3 100644 (file)
@@ -27,6 +27,7 @@ type Repository struct {
        Description   string      `json:"description"`
        Private       bool        `json:"private"`
        Fork          bool        `json:"fork"`
+       Mirror        bool        `json:"mirror"`
        HTMLURL       string      `json:"html_url"`
        SSHURL        string      `json:"ssh_url"`
        CloneURL      string      `json:"clone_url"`
diff --git a/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go b/vendor/code.gitea.io/sdk/gitea/user_gpgkey.go
new file mode 100644 (file)
index 0000000..911e63f
--- /dev/null
@@ -0,0 +1,67 @@
+// Copyright 2017 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
+
+import (
+       "bytes"
+       "encoding/json"
+       "fmt"
+       "time"
+)
+
+// GPGKey a user GPG key to sign commit and tag in repository
+type GPGKey struct {
+       ID                int64          `json:"id"`
+       PrimaryKeyID      string         `json:"primary_key_id"`
+       KeyID             string         `json:"key_id"`
+       PublicKey         string         `json:"public_key"`
+       Emails            []*GPGKeyEmail `json:"emails"`
+       SubsKey           []*GPGKey      `json:"subkeys"`
+       CanSign           bool           `json:"can_sign"`
+       CanEncryptComms   bool           `json:"can_encrypt_comms"`
+       CanEncryptStorage bool           `json:"can_encrypt_storage"`
+       CanCertify        bool           `json:"can_certify"`
+       Created           time.Time      `json:"created_at,omitempty"`
+       Expires           time.Time      `json:"expires_at,omitempty"`
+}
+
+// GPGKeyEmail a email attache to a GPGKey
+type GPGKeyEmail struct {
+       Email    string `json:"email"`
+       Verified bool   `json:"verified"`
+}
+
+// CreateGPGKeyOption options create user GPG key
+type CreateGPGKeyOption struct {
+       ArmoredKey string `json:"armored_public_key" binding:"Required"`
+}
+
+// ListMyGPGKeys list all the GPG keys of current user
+func (c *Client) ListMyGPGKeys() ([]*GPGKey, error) {
+       keys := make([]*GPGKey, 0, 10)
+       return keys, c.getParsedResponse("GET", "/user/gpg_keys", nil, nil, &keys)
+}
+
+// GetGPGKey get current user's GPG key by key id
+func (c *Client) GetGPGKey(keyID int64) (*GPGKey, error) {
+       key := new(GPGKey)
+       return key, c.getParsedResponse("GET", fmt.Sprintf("/user/gpg_keys/%d", keyID), nil, nil, &key)
+}
+
+// CreateGPGKey create GPG key with options
+func (c *Client) CreateGPGKey(opt CreateGPGKeyOption) (*GPGKey, error) {
+       body, err := json.Marshal(&opt)
+       if err != nil {
+               return nil, err
+       }
+       key := new(GPGKey)
+       return key, c.getParsedResponse("POST", "/user/gpg_keys", jsonHeader, bytes.NewReader(body), key)
+}
+
+// DeleteGPGKey delete GPG key with key id
+func (c *Client) DeleteGPGKey(keyID int64) error {
+       _, err := c.getResponse("DELETE", fmt.Sprintf("/user/gpg_keys/%d", keyID), nil, nil)
+       return err
+}
index 3a4ebc57809d8360ba31f1509b784b45b17c911d..afe768a0be66fe2c87efe2d3032407c432bfe8cc 100644 (file)
@@ -9,10 +9,10 @@
                        "revisionTime": "2017-02-22T02:52:05Z"
                },
                {
-                       "checksumSHA1": "BKj0haFTDebzdC2nACpoGzp3s8A=",
+                       "checksumSHA1": "K0VWBaa3ZUE598zVFGavdLB7vW4=",
                        "path": "code.gitea.io/sdk/gitea",
-                       "revision": "2064cc397bc48b0a46f8324a97421a824b11882e",
-                       "revisionTime": "2016-12-31T14:43:27Z"
+                       "revision": "06902fe19508c7ede2be38b71287c665efa1f10d",
+                       "revisionTime": "2017-02-19T11:17:32Z"
                },
                {
                        "checksumSHA1": "IyfS7Rbl6OgR83QR7TOfKdDCq+M=",