From ec38999c64ac6749ee01430aa8bb62e2e98e4ae3 Mon Sep 17 00:00:00 2001 From: Raffaele Di Fazio Date: Mon, 19 Nov 2018 18:13:03 +0100 Subject: [PATCH] Updated vendor with latest master drone-go --- Gopkg.lock | 4 ++-- .../github.com/drone/drone-go/drone/client.go | 18 +++++++++++++++--- .../drone/drone-go/drone/interface.go | 2 +- 3 files changed, 18 insertions(+), 6 deletions(-) diff --git a/Gopkg.lock b/Gopkg.lock index 790076c..b20dd81 100644 --- a/Gopkg.lock +++ b/Gopkg.lock @@ -91,7 +91,7 @@ [[projects]] branch = "master" - digest = "1:54d4d615594a29c821ce7655b3aa9ebf0143b9449957392501a6dd24eb21b547" + digest = "1:b32dbc42ae85ab6d943faeb881afabcec3d20e651369120e2d5c09d2a51db82f" name = "github.com/drone/drone-go" packages = [ "drone", @@ -102,7 +102,7 @@ "plugin/secret", ] pruneopts = "UT" - revision = "2d78f279e8ef75a009a54d794928446c2656e077" + revision = "e79fb40acd816665a46d428ace911cc09bed0e68" [[projects]] branch = "master" diff --git a/vendor/github.com/drone/drone-go/drone/client.go b/vendor/github.com/drone/drone-go/drone/client.go index 0dfc8fe..e1f1490 100644 --- a/vendor/github.com/drone/drone-go/drone/client.go +++ b/vendor/github.com/drone/drone-go/drone/client.go @@ -34,7 +34,7 @@ const ( pathRepoMove = "%s/api/repos/%s/%s/move?to=%s" pathChown = "%s/api/repos/%s/%s/chown" pathRepair = "%s/api/repos/%s/%s/repair" - pathBuilds = "%s/api/repos/%s/%s/builds" + pathBuilds = "%s/api/repos/%s/%s/builds?%s" pathBuild = "%s/api/repos/%s/%s/builds/%v" pathApprove = "%s/api/repos/%s/%s/builds/%d/approve/%d" pathDecline = "%s/api/repos/%s/%s/builds/%d/decline/%d" @@ -67,6 +67,18 @@ type client struct { addr string } +type ListOptions struct { + Page int +} + +func encodeListOptions(opts ListOptions) string { + params := url.Values{} + if opts.Page != 0 { + params.Set("page", strconv.Itoa(opts.Page)) + } + return params.Encode() +} + // New returns a client at the specified url. func New(uri string) Client { return &client{http.DefaultClient, strings.TrimSuffix(uri, "/")} @@ -218,9 +230,9 @@ func (c *client) BuildLast(owner, name, branch string) (*Build, error) { // BuildList returns a list of recent builds for the // the specified repository. -func (c *client) BuildList(owner, name string) ([]*Build, error) { +func (c *client) BuildList(owner, name string, opts ListOptions) ([]*Build, error) { var out []*Build - uri := fmt.Sprintf(pathBuilds, c.addr, owner, name) + uri := fmt.Sprintf(pathBuilds, c.addr, owner, name, encodeListOptions(opts)) err := c.get(uri, &out) return out, err } diff --git a/vendor/github.com/drone/drone-go/drone/interface.go b/vendor/github.com/drone/drone-go/drone/interface.go index fc5bf07..1193dd5 100644 --- a/vendor/github.com/drone/drone-go/drone/interface.go +++ b/vendor/github.com/drone/drone-go/drone/interface.go @@ -84,7 +84,7 @@ type Client interface { // BuildList returns a list of recent builds for the // the specified repository. - BuildList(namespace, name string) ([]*Build, error) + BuildList(namespace, name string, opts ListOptions) ([]*Build, error) // BuildRestart re-starts a build. BuildRestart(namespace, name string, build int, params map[string]string) (*Build, error)