aboutsummaryrefslogtreecommitdiff
path: root/vendor/github.com/xanzy/go-gitlab/users.go
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/github.com/xanzy/go-gitlab/users.go')
-rw-r--r--vendor/github.com/xanzy/go-gitlab/users.go92
1 files changed, 44 insertions, 48 deletions
diff --git a/vendor/github.com/xanzy/go-gitlab/users.go b/vendor/github.com/xanzy/go-gitlab/users.go
index 13ae2ae..ba955a8 100644
--- a/vendor/github.com/xanzy/go-gitlab/users.go
+++ b/vendor/github.com/xanzy/go-gitlab/users.go
@@ -79,8 +79,8 @@ type ListUsersOptions struct {
// ListUsers gets a list of users.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-users
-func (s *UsersService) ListUsers(opt *ListUsersOptions) ([]*User, *Response, error) {
- req, err := s.client.NewRequest("GET", "users", opt)
+func (s *UsersService) ListUsers(opt *ListUsersOptions, options ...OptionFunc) ([]*User, *Response, error) {
+ req, err := s.client.NewRequest("GET", "users", opt, options)
if err != nil {
return nil, nil, err
}
@@ -97,10 +97,10 @@ func (s *UsersService) ListUsers(opt *ListUsersOptions) ([]*User, *Response, err
// GetUser gets a single user.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#single-user
-func (s *UsersService) GetUser(user int) (*User, *Response, error) {
+func (s *UsersService) GetUser(user int, options ...OptionFunc) (*User, *Response, error) {
u := fmt.Sprintf("users/%d", user)
- req, err := s.client.NewRequest("GET", u, nil)
+ req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -138,8 +138,8 @@ type CreateUserOptions struct {
// CreateUser creates a new user. Note only administrators can create new users.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-creation
-func (s *UsersService) CreateUser(opt *CreateUserOptions) (*User, *Response, error) {
- req, err := s.client.NewRequest("POST", "users", opt)
+func (s *UsersService) CreateUser(opt *CreateUserOptions, options ...OptionFunc) (*User, *Response, error) {
+ req, err := s.client.NewRequest("POST", "users", opt, options)
if err != nil {
return nil, nil, err
}
@@ -177,10 +177,10 @@ type ModifyUserOptions struct {
// of a user.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-modification
-func (s *UsersService) ModifyUser(user int, opt *ModifyUserOptions) (*User, *Response, error) {
+func (s *UsersService) ModifyUser(user int, opt *ModifyUserOptions, options ...OptionFunc) (*User, *Response, error) {
u := fmt.Sprintf("users/%d", user)
- req, err := s.client.NewRequest("PUT", u, opt)
+ req, err := s.client.NewRequest("PUT", u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -201,10 +201,10 @@ func (s *UsersService) ModifyUser(user int, opt *ModifyUserOptions) (*User, *Res
// latter not.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#user-deletion
-func (s *UsersService) DeleteUser(user int) (*Response, error) {
+func (s *UsersService) DeleteUser(user int, options ...OptionFunc) (*Response, error) {
u := fmt.Sprintf("users/%d", user)
- req, err := s.client.NewRequest("DELETE", u, nil)
+ req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
return nil, err
}
@@ -215,8 +215,8 @@ func (s *UsersService) DeleteUser(user int) (*Response, error) {
// CurrentUser gets currently authenticated user.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#current-user
-func (s *UsersService) CurrentUser() (*User, *Response, error) {
- req, err := s.client.NewRequest("GET", "user", nil)
+func (s *UsersService) CurrentUser(options ...OptionFunc) (*User, *Response, error) {
+ req, err := s.client.NewRequest("GET", "user", nil, options)
if err != nil {
return nil, nil, err
}
@@ -243,8 +243,8 @@ type SSHKey struct {
// ListSSHKeys gets a list of currently authenticated user's SSH keys.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-ssh-keys
-func (s *UsersService) ListSSHKeys() ([]*SSHKey, *Response, error) {
- req, err := s.client.NewRequest("GET", "user/keys", nil)
+func (s *UsersService) ListSSHKeys(options ...OptionFunc) ([]*SSHKey, *Response, error) {
+ req, err := s.client.NewRequest("GET", "user/keys", nil, options)
if err != nil {
return nil, nil, err
}
@@ -263,10 +263,10 @@ func (s *UsersService) ListSSHKeys() ([]*SSHKey, *Response, error) {
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/users.html#list-ssh-keys-for-user
-func (s *UsersService) ListSSHKeysForUser(user int) ([]*SSHKey, *Response, error) {
+func (s *UsersService) ListSSHKeysForUser(user int, options ...OptionFunc) ([]*SSHKey, *Response, error) {
u := fmt.Sprintf("users/%d/keys", user)
- req, err := s.client.NewRequest("GET", u, nil)
+ req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -283,10 +283,10 @@ func (s *UsersService) ListSSHKeysForUser(user int) ([]*SSHKey, *Response, error
// GetSSHKey gets a single key.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#single-ssh-key
-func (s *UsersService) GetSSHKey(kid int) (*SSHKey, *Response, error) {
+func (s *UsersService) GetSSHKey(kid int, options ...OptionFunc) (*SSHKey, *Response, error) {
u := fmt.Sprintf("user/keys/%d", kid)
- req, err := s.client.NewRequest("GET", u, nil)
+ req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -311,8 +311,8 @@ type AddSSHKeyOptions struct {
// AddSSHKey creates a new key owned by the currently authenticated user.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-ssh-key
-func (s *UsersService) AddSSHKey(opt *AddSSHKeyOptions) (*SSHKey, *Response, error) {
- req, err := s.client.NewRequest("POST", "user/keys", opt)
+func (s *UsersService) AddSSHKey(opt *AddSSHKeyOptions, options ...OptionFunc) (*SSHKey, *Response, error) {
+ req, err := s.client.NewRequest("POST", "user/keys", opt, options)
if err != nil {
return nil, nil, err
}
@@ -330,12 +330,10 @@ func (s *UsersService) AddSSHKey(opt *AddSSHKeyOptions) (*SSHKey, *Response, err
// admin.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-ssh-key-for-user
-func (s *UsersService) AddSSHKeyForUser(
- user int,
- opt *AddSSHKeyOptions) (*SSHKey, *Response, error) {
+func (s *UsersService) AddSSHKeyForUser(user int, opt *AddSSHKeyOptions, options ...OptionFunc) (*SSHKey, *Response, error) {
u := fmt.Sprintf("users/%d/keys", user)
- req, err := s.client.NewRequest("POST", u, opt)
+ req, err := s.client.NewRequest("POST", u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -355,10 +353,10 @@ func (s *UsersService) AddSSHKeyForUser(
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/users.html#delete-ssh-key-for-current-owner
-func (s *UsersService) DeleteSSHKey(kid int) (*Response, error) {
+func (s *UsersService) DeleteSSHKey(kid int, options ...OptionFunc) (*Response, error) {
u := fmt.Sprintf("user/keys/%d", kid)
- req, err := s.client.NewRequest("DELETE", u, nil)
+ req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
return nil, err
}
@@ -371,10 +369,10 @@ func (s *UsersService) DeleteSSHKey(kid int) (*Response, error) {
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/users.html#delete-ssh-key-for-given-user
-func (s *UsersService) DeleteSSHKeyForUser(user int, kid int) (*Response, error) {
+func (s *UsersService) DeleteSSHKeyForUser(user int, kid int, options ...OptionFunc) (*Response, error) {
u := fmt.Sprintf("users/%d/keys/%d", user, kid)
- req, err := s.client.NewRequest("DELETE", u, nil)
+ req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
return nil, err
}
@@ -385,10 +383,10 @@ func (s *UsersService) DeleteSSHKeyForUser(user int, kid int) (*Response, error)
// BlockUser blocks the specified user. Available only for admin.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#block-user
-func (s *UsersService) BlockUser(user int) error {
+func (s *UsersService) BlockUser(user int, options ...OptionFunc) error {
u := fmt.Sprintf("users/%d/block", user)
- req, err := s.client.NewRequest("PUT", u, nil)
+ req, err := s.client.NewRequest("PUT", u, nil, options)
if err != nil {
return err
}
@@ -413,10 +411,10 @@ func (s *UsersService) BlockUser(user int) error {
// UnblockUser unblocks the specified user. Available only for admin.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#unblock-user
-func (s *UsersService) UnblockUser(user int) error {
+func (s *UsersService) UnblockUser(user int, options ...OptionFunc) error {
u := fmt.Sprintf("users/%d/unblock", user)
- req, err := s.client.NewRequest("PUT", u, nil)
+ req, err := s.client.NewRequest("PUT", u, nil, options)
if err != nil {
return err
}
@@ -449,8 +447,8 @@ type Email struct {
// ListEmails gets a list of currently authenticated user's Emails.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-emails
-func (s *UsersService) ListEmails() ([]*Email, *Response, error) {
- req, err := s.client.NewRequest("GET", "user/emails", nil)
+func (s *UsersService) ListEmails(options ...OptionFunc) ([]*Email, *Response, error) {
+ req, err := s.client.NewRequest("GET", "user/emails", nil, options)
if err != nil {
return nil, nil, err
}
@@ -469,10 +467,10 @@ func (s *UsersService) ListEmails() ([]*Email, *Response, error) {
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/users.html#list-emails-for-user
-func (s *UsersService) ListEmailsForUser(uid int) ([]*Email, *Response, error) {
+func (s *UsersService) ListEmailsForUser(uid int, options ...OptionFunc) ([]*Email, *Response, error) {
u := fmt.Sprintf("users/%d/emails", uid)
- req, err := s.client.NewRequest("GET", u, nil)
+ req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -489,10 +487,10 @@ func (s *UsersService) ListEmailsForUser(uid int) ([]*Email, *Response, error) {
// GetEmail gets a single email.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#single-email
-func (s *UsersService) GetEmail(eid int) (*Email, *Response, error) {
+func (s *UsersService) GetEmail(eid int, options ...OptionFunc) (*Email, *Response, error) {
u := fmt.Sprintf("user/emails/%d", eid)
- req, err := s.client.NewRequest("GET", u, nil)
+ req, err := s.client.NewRequest("GET", u, nil, options)
if err != nil {
return nil, nil, err
}
@@ -516,8 +514,8 @@ type AddEmailOptions struct {
// AddEmail creates a new email owned by the currently authenticated user.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-email
-func (s *UsersService) AddEmail(opt *AddEmailOptions) (*Email, *Response, error) {
- req, err := s.client.NewRequest("POST", "user/emails", opt)
+func (s *UsersService) AddEmail(opt *AddEmailOptions, options ...OptionFunc) (*Email, *Response, error) {
+ req, err := s.client.NewRequest("POST", "user/emails", opt, options)
if err != nil {
return nil, nil, err
}
@@ -535,12 +533,10 @@ func (s *UsersService) AddEmail(opt *AddEmailOptions) (*Email, *Response, error)
// admin.
//
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-email-for-user
-func (s *UsersService) AddEmailForUser(
- uid int,
- opt *AddEmailOptions) (*Email, *Response, error) {
+func (s *UsersService) AddEmailForUser(uid int, opt *AddEmailOptions, options ...OptionFunc) (*Email, *Response, error) {
u := fmt.Sprintf("users/%d/emails", uid)
- req, err := s.client.NewRequest("POST", u, opt)
+ req, err := s.client.NewRequest("POST", u, opt, options)
if err != nil {
return nil, nil, err
}
@@ -560,10 +556,10 @@ func (s *UsersService) AddEmailForUser(
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/users.html#delete-email-for-current-owner
-func (s *UsersService) DeleteEmail(eid int) (*Response, error) {
+func (s *UsersService) DeleteEmail(eid int, options ...OptionFunc) (*Response, error) {
u := fmt.Sprintf("user/emails/%d", eid)
- req, err := s.client.NewRequest("DELETE", u, nil)
+ req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
return nil, err
}
@@ -576,10 +572,10 @@ func (s *UsersService) DeleteEmail(eid int) (*Response, error) {
//
// GitLab API docs:
// https://docs.gitlab.com/ce/api/users.html#delete-email-for-given-user
-func (s *UsersService) DeleteEmailForUser(uid int, eid int) (*Response, error) {
+func (s *UsersService) DeleteEmailForUser(uid int, eid int, options ...OptionFunc) (*Response, error) {
u := fmt.Sprintf("users/%d/emails/%d", uid, eid)
- req, err := s.client.NewRequest("DELETE", u, nil)
+ req, err := s.client.NewRequest("DELETE", u, nil, options)
if err != nil {
return nil, err
}