forked from forgejo/forgejo
Vendor Update (#14696)
* github.com/yuin/goldmark v1.3.1 -> v1.3.2 * github.com/xanzy/go-gitlab v0.42.0 -> v0.44.0 * github.com/prometheus/client_golang v1.8.0 -> v1.9.0 * github.com/minio/minio-go v7.0.7 -> v7.0.9 * github.com/lafriks/xormstore v1.3.2 -> v1.4.0 Co-authored-by: Lunny Xiao <xiaolunwen@gmail.com>
This commit is contained in:
parent
dc707aea09
commit
fe628d8406
137 changed files with 3348 additions and 1312 deletions
74
vendor/github.com/xanzy/go-gitlab/users.go
generated
vendored
74
vendor/github.com/xanzy/go-gitlab/users.go
generated
vendored
|
@ -1,5 +1,5 @@
|
|||
//
|
||||
// Copyright 2017, Sander van Harmelen
|
||||
// Copyright 2021, Sander van Harmelen
|
||||
//
|
||||
// Licensed under the Apache License, Version 2.0 (the "License");
|
||||
// you may not use this file except in compliance with the License.
|
||||
|
@ -19,6 +19,7 @@ package gitlab
|
|||
import (
|
||||
"errors"
|
||||
"fmt"
|
||||
"net/http"
|
||||
"time"
|
||||
)
|
||||
|
||||
|
@ -117,7 +118,10 @@ type ListUsersOptions struct {
|
|||
CreatedAfter *time.Time `url:"created_after,omitempty" json:"created_after,omitempty"`
|
||||
OrderBy *string `url:"order_by,omitempty" json:"order_by,omitempty"`
|
||||
Sort *string `url:"sort,omitempty" json:"sort,omitempty"`
|
||||
TwoFactor *string `url:"two_factor,omitempty" json:"two_factor,omitempty"`
|
||||
Admins *bool `url:"admins,omitempty" json:"admins,omitempty"`
|
||||
External *bool `url:"external,omitempty" json:"external,omitempty"`
|
||||
WithoutProjects *bool `url:"without_projects,omitempty" json:"without_projects,omitempty"`
|
||||
WithCustomAttributes *bool `url:"with_custom_attributes,omitempty" json:"with_custom_attributes,omitempty"`
|
||||
}
|
||||
|
||||
|
@ -125,7 +129,7 @@ type ListUsersOptions struct {
|
|||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-users
|
||||
func (s *UsersService) ListUsers(opt *ListUsersOptions, options ...RequestOptionFunc) ([]*User, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "users", opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, "users", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -145,7 +149,7 @@ func (s *UsersService) ListUsers(opt *ListUsersOptions, options ...RequestOption
|
|||
func (s *UsersService) GetUser(user int, options ...RequestOptionFunc) (*User, *Response, error) {
|
||||
u := fmt.Sprintf("users/%d", user)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -184,13 +188,14 @@ type CreateUserOptions struct {
|
|||
SkipConfirmation *bool `url:"skip_confirmation,omitempty" json:"skip_confirmation,omitempty"`
|
||||
External *bool `url:"external,omitempty" json:"external,omitempty"`
|
||||
PrivateProfile *bool `url:"private_profile,omitempty" json:"private_profile,omitempty"`
|
||||
Note *string `url:"note,omitempty" json:"note,omitempty"`
|
||||
}
|
||||
|
||||
// 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, options ...RequestOptionFunc) (*User, *Response, error) {
|
||||
req, err := s.client.NewRequest("POST", "users", opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodPost, "users", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -227,6 +232,7 @@ type ModifyUserOptions struct {
|
|||
SkipReconfirmation *bool `url:"skip_reconfirmation,omitempty" json:"skip_reconfirmation,omitempty"`
|
||||
External *bool `url:"external,omitempty" json:"external,omitempty"`
|
||||
PrivateProfile *bool `url:"private_profile,omitempty" json:"private_profile,omitempty"`
|
||||
Note *string `url:"note,omitempty" json:"note,omitempty"`
|
||||
}
|
||||
|
||||
// ModifyUser modifies an existing user. Only administrators can change attributes
|
||||
|
@ -236,7 +242,7 @@ type ModifyUserOptions struct {
|
|||
func (s *UsersService) ModifyUser(user int, opt *ModifyUserOptions, options ...RequestOptionFunc) (*User, *Response, error) {
|
||||
u := fmt.Sprintf("users/%d", user)
|
||||
|
||||
req, err := s.client.NewRequest("PUT", u, opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodPut, u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -260,7 +266,7 @@ func (s *UsersService) ModifyUser(user int, opt *ModifyUserOptions, options ...R
|
|||
func (s *UsersService) DeleteUser(user int, options ...RequestOptionFunc) (*Response, error) {
|
||||
u := fmt.Sprintf("users/%d", user)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -272,7 +278,7 @@ func (s *UsersService) DeleteUser(user int, options ...RequestOptionFunc) (*Resp
|
|||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#current-user
|
||||
func (s *UsersService) CurrentUser(options ...RequestOptionFunc) (*User, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "user", nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, "user", nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -300,7 +306,7 @@ type SSHKey struct {
|
|||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-ssh-keys
|
||||
func (s *UsersService) ListSSHKeys(options ...RequestOptionFunc) ([]*SSHKey, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "user/keys", nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, "user/keys", nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -328,7 +334,7 @@ type ListSSHKeysForUserOptions ListOptions
|
|||
func (s *UsersService) ListSSHKeysForUser(user int, opt *ListSSHKeysForUserOptions, options ...RequestOptionFunc) ([]*SSHKey, *Response, error) {
|
||||
u := fmt.Sprintf("users/%d/keys", user)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -348,7 +354,7 @@ func (s *UsersService) ListSSHKeysForUser(user int, opt *ListSSHKeysForUserOptio
|
|||
func (s *UsersService) GetSSHKey(key int, options ...RequestOptionFunc) (*SSHKey, *Response, error) {
|
||||
u := fmt.Sprintf("user/keys/%d", key)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -375,7 +381,7 @@ type AddSSHKeyOptions struct {
|
|||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-ssh-key
|
||||
func (s *UsersService) AddSSHKey(opt *AddSSHKeyOptions, options ...RequestOptionFunc) (*SSHKey, *Response, error) {
|
||||
req, err := s.client.NewRequest("POST", "user/keys", opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodPost, "user/keys", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -396,7 +402,7 @@ func (s *UsersService) AddSSHKey(opt *AddSSHKeyOptions, options ...RequestOption
|
|||
func (s *UsersService) AddSSHKeyForUser(user int, opt *AddSSHKeyOptions, options ...RequestOptionFunc) (*SSHKey, *Response, error) {
|
||||
u := fmt.Sprintf("users/%d/keys", user)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -419,7 +425,7 @@ func (s *UsersService) AddSSHKeyForUser(user int, opt *AddSSHKeyOptions, options
|
|||
func (s *UsersService) DeleteSSHKey(key int, options ...RequestOptionFunc) (*Response, error) {
|
||||
u := fmt.Sprintf("user/keys/%d", key)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -435,7 +441,7 @@ func (s *UsersService) DeleteSSHKey(key int, options ...RequestOptionFunc) (*Res
|
|||
func (s *UsersService) DeleteSSHKeyForUser(user, key int, options ...RequestOptionFunc) (*Response, error) {
|
||||
u := fmt.Sprintf("users/%d/keys/%d", user, key)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -449,7 +455,7 @@ func (s *UsersService) DeleteSSHKeyForUser(user, key int, options ...RequestOpti
|
|||
func (s *UsersService) BlockUser(user int, options ...RequestOptionFunc) error {
|
||||
u := fmt.Sprintf("users/%d/block", user)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -477,7 +483,7 @@ func (s *UsersService) BlockUser(user int, options ...RequestOptionFunc) error {
|
|||
func (s *UsersService) UnblockUser(user int, options ...RequestOptionFunc) error {
|
||||
u := fmt.Sprintf("users/%d/unblock", user)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -505,7 +511,7 @@ func (s *UsersService) UnblockUser(user int, options ...RequestOptionFunc) error
|
|||
func (s *UsersService) DeactivateUser(user int, options ...RequestOptionFunc) error {
|
||||
u := fmt.Sprintf("users/%d/deactivate", user)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -533,7 +539,7 @@ func (s *UsersService) DeactivateUser(user int, options ...RequestOptionFunc) er
|
|||
func (s *UsersService) ActivateUser(user int, options ...RequestOptionFunc) error {
|
||||
u := fmt.Sprintf("users/%d/activate", user)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodPost, u, nil, options)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
@ -567,7 +573,7 @@ type Email struct {
|
|||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#list-emails
|
||||
func (s *UsersService) ListEmails(options ...RequestOptionFunc) ([]*Email, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "user/emails", nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, "user/emails", nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -595,7 +601,7 @@ type ListEmailsForUserOptions ListOptions
|
|||
func (s *UsersService) ListEmailsForUser(user int, opt *ListEmailsForUserOptions, options ...RequestOptionFunc) ([]*Email, *Response, error) {
|
||||
u := fmt.Sprintf("users/%d/emails", user)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -615,7 +621,7 @@ func (s *UsersService) ListEmailsForUser(user int, opt *ListEmailsForUserOptions
|
|||
func (s *UsersService) GetEmail(email int, options ...RequestOptionFunc) (*Email, *Response, error) {
|
||||
u := fmt.Sprintf("user/emails/%d", email)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -640,7 +646,7 @@ type AddEmailOptions struct {
|
|||
//
|
||||
// GitLab API docs: https://docs.gitlab.com/ce/api/users.html#add-email
|
||||
func (s *UsersService) AddEmail(opt *AddEmailOptions, options ...RequestOptionFunc) (*Email, *Response, error) {
|
||||
req, err := s.client.NewRequest("POST", "user/emails", opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodPost, "user/emails", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -661,7 +667,7 @@ func (s *UsersService) AddEmail(opt *AddEmailOptions, options ...RequestOptionFu
|
|||
func (s *UsersService) AddEmailForUser(user int, opt *AddEmailOptions, options ...RequestOptionFunc) (*Email, *Response, error) {
|
||||
u := fmt.Sprintf("users/%d/emails", user)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -684,7 +690,7 @@ func (s *UsersService) AddEmailForUser(user int, opt *AddEmailOptions, options .
|
|||
func (s *UsersService) DeleteEmail(email int, options ...RequestOptionFunc) (*Response, error) {
|
||||
u := fmt.Sprintf("user/emails/%d", email)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -700,7 +706,7 @@ func (s *UsersService) DeleteEmail(email int, options ...RequestOptionFunc) (*Re
|
|||
func (s *UsersService) DeleteEmailForUser(user, email int, options ...RequestOptionFunc) (*Response, error) {
|
||||
u := fmt.Sprintf("users/%d/emails/%d", user, email)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -740,7 +746,7 @@ type GetAllImpersonationTokensOptions struct {
|
|||
func (s *UsersService) GetAllImpersonationTokens(user int, opt *GetAllImpersonationTokensOptions, options ...RequestOptionFunc) ([]*ImpersonationToken, *Response, error) {
|
||||
u := fmt.Sprintf("users/%d/impersonation_tokens", user)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -761,7 +767,7 @@ func (s *UsersService) GetAllImpersonationTokens(user int, opt *GetAllImpersonat
|
|||
func (s *UsersService) GetImpersonationToken(user, token int, options ...RequestOptionFunc) (*ImpersonationToken, *Response, error) {
|
||||
u := fmt.Sprintf("users/%d/impersonation_tokens/%d", user, token)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -793,7 +799,7 @@ type CreateImpersonationTokenOptions struct {
|
|||
func (s *UsersService) CreateImpersonationToken(user int, opt *CreateImpersonationTokenOptions, options ...RequestOptionFunc) (*ImpersonationToken, *Response, error) {
|
||||
u := fmt.Sprintf("users/%d/impersonation_tokens", user)
|
||||
|
||||
req, err := s.client.NewRequest("POST", u, opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodPost, u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -814,7 +820,7 @@ func (s *UsersService) CreateImpersonationToken(user int, opt *CreateImpersonati
|
|||
func (s *UsersService) RevokeImpersonationToken(user, token int, options ...RequestOptionFunc) (*Response, error) {
|
||||
u := fmt.Sprintf("users/%d/impersonation_tokens/%d", user, token)
|
||||
|
||||
req, err := s.client.NewRequest("DELETE", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodDelete, u, nil, options)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -845,7 +851,7 @@ type GetUserActivitiesOptions struct {
|
|||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/users.html#get-user-activities-admin-only
|
||||
func (s *UsersService) GetUserActivities(opt *GetUserActivitiesOptions, options ...RequestOptionFunc) ([]*UserActivity, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "user/activities", opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, "user/activities", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -874,7 +880,7 @@ type UserStatus struct {
|
|||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/users.html#user-status
|
||||
func (s *UsersService) CurrentUserStatus(options ...RequestOptionFunc) (*UserStatus, *Response, error) {
|
||||
req, err := s.client.NewRequest("GET", "user/status", nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, "user/status", nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -895,7 +901,7 @@ func (s *UsersService) CurrentUserStatus(options ...RequestOptionFunc) (*UserSta
|
|||
func (s *UsersService) GetUserStatus(user int, options ...RequestOptionFunc) (*UserStatus, *Response, error) {
|
||||
u := fmt.Sprintf("users/%d/status", user)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, nil, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, u, nil, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -923,7 +929,7 @@ type UserStatusOptions struct {
|
|||
// GitLab API docs:
|
||||
// https://docs.gitlab.com/ce/api/users.html#set-user-status
|
||||
func (s *UsersService) SetUserStatus(opt *UserStatusOptions, options ...RequestOptionFunc) (*UserStatus, *Response, error) {
|
||||
req, err := s.client.NewRequest("PUT", "user/status", opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodPut, "user/status", opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
@ -964,7 +970,7 @@ type GetUserMembershipOptions struct {
|
|||
func (s *UsersService) GetUserMemberships(user int, opt *GetUserMembershipOptions, options ...RequestOptionFunc) ([]*UserMembership, *Response, error) {
|
||||
u := fmt.Sprintf("users/%d/memberships", user)
|
||||
|
||||
req, err := s.client.NewRequest("GET", u, opt, options)
|
||||
req, err := s.client.NewRequest(http.MethodGet, u, opt, options)
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue