diff options
author | Niall Sheridan <nsheridan@gmail.com> | 2017-04-10 21:18:42 +0100 |
---|---|---|
committer | Niall Sheridan <nsheridan@gmail.com> | 2017-04-10 21:38:33 +0100 |
commit | 30802e07b2d84fbc213b490d3402707dffe60096 (patch) | |
tree | 934aecb8f3582325dfd1aa6652193adac87d00db /vendor/github.com/xanzy/go-gitlab/gitlab.go | |
parent | da7638dc112c4c106e8929601b642d2ca4596cba (diff) |
update dependencies
Diffstat (limited to 'vendor/github.com/xanzy/go-gitlab/gitlab.go')
-rw-r--r-- | vendor/github.com/xanzy/go-gitlab/gitlab.go | 33 |
1 files changed, 24 insertions, 9 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/gitlab.go b/vendor/github.com/xanzy/go-gitlab/gitlab.go index 35d65a4..c2da4c3 100644 --- a/vendor/github.com/xanzy/go-gitlab/gitlab.go +++ b/vendor/github.com/xanzy/go-gitlab/gitlab.go @@ -18,6 +18,7 @@ package gitlab import ( "bytes" + "context" "encoding/json" "fmt" "io" @@ -39,12 +40,14 @@ const ( // tokenType represents a token type within GitLab. // -// GitLab API docs: https://docs.gitlab.com/ce/api/ +// GitLab API docs: +// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/ type tokenType int // List of available token type // -// GitLab API docs: https://docs.gitlab.com/ce/api/ +// GitLab API docs: +// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/ const ( privateToken tokenType = iota oAuthToken @@ -52,12 +55,14 @@ const ( // AccessLevelValue represents a permission level within GitLab. // -// GitLab API docs: https://docs.gitlab.com/ce/permissions/permissions.html +// GitLab API docs: +// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/permissions/permissions.md type AccessLevelValue int // List of available access levels // -// GitLab API docs: https://docs.gitlab.com/ce/permissions/permissions.html +// GitLab API docs: +// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/permissions/permissions.md const ( GuestPermissions AccessLevelValue = 10 ReporterPermissions AccessLevelValue = 20 @@ -128,12 +133,14 @@ var notificationLevelTypes = map[string]NotificationLevelValue{ // VisibilityLevelValue represents a visibility level within GitLab. // -// GitLab API docs: https://docs.gitlab.com/ce/api/ +// GitLab API docs: +// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/ type VisibilityLevelValue int // List of available visibility levels // -// GitLab API docs: https://docs.gitlab.com/ce/api/ +// GitLab API docs: +// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/ const ( PrivateVisibility VisibilityLevelValue = 0 InternalVisibility VisibilityLevelValue = 10 @@ -448,7 +455,7 @@ func parseID(id interface{}) (string, error) { // An ErrorResponse reports one or more errors caused by an API request. // // GitLab API docs: -// https://docs.gitlab.com/ce/api/README.html#data-validation-and-error-reporting +// https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/README.md#data-validation-and-error-reporting type ErrorResponse struct { Response *http.Response Message string @@ -517,7 +524,7 @@ func parseError(raw interface{}) string { errs = append(errs, fmt.Sprintf("{%s: %s}", k, parseError(v))) } sort.Strings(errs) - return fmt.Sprintf("%s", strings.Join(errs, ", ")) + return strings.Join(errs, ", ") default: return fmt.Sprintf("failed to parse unexpected error type: %T", raw) @@ -527,7 +534,7 @@ func parseError(raw interface{}) string { // OptionFunc can be passed to all API requests to make the API call as if you were // another user, provided your private token is from an administrator account. // -// GitLab docs: https://docs.gitlab.com/ce/api/README.html#sudo +// GitLab docs: https://gitlab.com/gitlab-org/gitlab-ce/blob/8-16-stable/doc/api/README.md#sudo type OptionFunc func(*http.Request) error // WithSudo takes either a username or user ID and sets the SUDO request header @@ -546,6 +553,14 @@ func WithSudo(uid interface{}) OptionFunc { } } +// WithContext runs the request with the provided context +func WithContext(ctx context.Context) OptionFunc { + return func(req *http.Request) error { + *req = *req.WithContext(ctx) + return nil + } +} + // Bool is a helper routine that allocates a new bool value // to store v and returns a pointer to it. func Bool(v bool) *bool { |