1
0
mirror of https://github.com/drone/drone-cli.git synced 2024-11-23 01:11:57 +01:00

Updated vendor with latest master drone-go

This commit is contained in:
Raffaele Di Fazio 2018-11-19 18:13:03 +01:00
parent 534651760a
commit ec38999c64
No known key found for this signature in database
GPG Key ID: 58D6875FAB8FF740
3 changed files with 18 additions and 6 deletions

4
Gopkg.lock generated

@ -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"

@ -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
}

@ -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)