public class UserApi extends AbstractApi
Constants.ActionType, Constants.ApplicationScope, Constants.ArchiveFormat, Constants.AutoDevopsDeployStrategy, Constants.BuildGitStrategy, Constants.CommitBuildState, Constants.ContributorOrderBy, Constants.DefaultBranchProtectionLevel, Constants.DeploymentOrderBy, Constants.DeploymentStatus, Constants.DeployTokenScope, Constants.Encoding, Constants.EpicOrderBy, Constants.EventScope, Constants.GroupOrderBy, Constants.GroupSearchScope, Constants.ImpersonationState, Constants.IssueOrderBy, Constants.IssueScope, Constants.IssueState, Constants.JobScope, Constants.LineType, Constants.MergeRequestOrderBy, Constants.MergeRequestScope, Constants.MergeRequestSearchIn, Constants.MergeRequestState, Constants.MilestoneState, Constants.PackageOrderBy, Constants.PackageStatus, Constants.PipelineOrderBy, Constants.PipelineScope, Constants.ProjectAccessTokenScope, Constants.ProjectCreationLevel, Constants.ProjectOrderBy, Constants.ProjectSearchScope, Constants.SearchScope, Constants.SortOrder, Constants.SquashOption, Constants.StateEvent, Constants.SubgroupCreationLevel, Constants.TagOrderBy, Constants.TargetType, Constants.TodoAction, Constants.TodoState, Constants.TodoType, Constants.TokenType
gitLabApi
NEXT_PAGE_HEADER, PAGE_HEADER, PAGE_PARAM, PER_PAGE, PER_PAGE_PARAM, PREV_PAGE_HEADER, TOTAL_HEADER, TOTAL_PAGES_HEADER
Modifier and Type | Method and Description |
---|---|
Email |
addEmail(java.lang.Object userIdOrUsername,
java.lang.String email,
java.lang.Boolean skipConfirmation)
Add an email to the user's emails.
|
Email |
addEmail(java.lang.String email)
Add an email to the current user's emails.
|
GpgKey |
addGpgKey(java.lang.Long userId,
java.lang.String key)
Add a GPG key for a specific user
|
GpgKey |
addGpgKey(java.lang.String key)
Add a GPG key for the current user
|
SshKey |
addSshKey(java.lang.Long userId,
java.lang.String title,
java.lang.String key)
Create new key owned by specified user.
|
SshKey |
addSshKey(java.lang.String title,
java.lang.String key)
Creates a new key owned by the currently authenticated user.
|
void |
approveUser(java.lang.Long userId)
Approves the specified user.
|
void |
blockUser(java.lang.Long userId)
Blocks the specified user.
|
CustomAttribute |
changeCustomAttribute(java.lang.Object userIdOrUsername,
CustomAttribute customAttribute)
Change custom attribute for the given user
|
CustomAttribute |
changeCustomAttribute(java.lang.Object userIdOrUsername,
java.lang.String key,
java.lang.String value)
Changes custom attribute for the given user
|
CustomAttribute |
createCustomAttribute(java.lang.Object userIdOrUsername,
CustomAttribute customAttribute)
Creates custom attribute for the given user
|
CustomAttribute |
createCustomAttribute(java.lang.Object userIdOrUsername,
java.lang.String key,
java.lang.String value)
Creates custom attribute for the given user
|
ImpersonationToken |
createImpersonationToken(java.lang.Object userIdOrUsername,
java.lang.String name,
java.util.Date expiresAt,
ImpersonationToken.Scope[] scopes)
Create an impersonation token.
|
ImpersonationToken |
createPersonalAccessToken(java.lang.Object userIdOrUsername,
java.lang.String name,
java.util.Date expiresAt,
ImpersonationToken.Scope[] scopes)
Create a personal access token.
|
User |
createUser(User user,
java.lang.CharSequence password,
boolean resetPassword)
Creates a new user.
|
User |
createUser(User user,
java.lang.CharSequence password,
java.lang.Integer projectsLimit)
Deprecated.
Will be removed in version 6.0, replaced by
createUser(User, CharSequence, boolean) |
void |
deleteCustomAttribute(java.lang.Object userIdOrUsername,
CustomAttribute customAttribute)
Delete a custom attribute for the given user
|
void |
deleteCustomAttribute(java.lang.Object userIdOrUsername,
java.lang.String key)
Delete a custom attribute for the given user
|
void |
deleteEmail(java.lang.Long emailId)
Deletes an email belonging to the current user.
|
void |
deleteEmail(java.lang.Object userIdOrUsername,
java.lang.Long emailId)
Deletes a user's email
|
void |
deleteGpgKey(java.lang.Long keyId)
Remove a specific GPG key for the current user
|
void |
deleteGpgKey(java.lang.Long userId,
java.lang.Long keyId)
Remove a specific GPG key for a specific user
|
void |
deleteSshKey(java.lang.Long keyId)
Deletes key owned by currently authenticated user.
|
void |
deleteSshKey(java.lang.Object userIdOrUsername,
java.lang.Long keyId)
Deletes key owned by a specified user.
|
void |
deleteUser(java.lang.Object userIdOrUsername)
Deletes a user.
|
void |
deleteUser(java.lang.Object userIdOrUsername,
java.lang.Boolean hardDelete)
Deletes a user.
|
void |
disableCustomAttributes()
Disables custom attributes to be returned when fetching User instances.
|
void |
enableCustomAttributes()
Enables custom attributes to be returned when fetching User instances.
|
java.util.List<User> |
findUsers(java.lang.String emailOrUsername)
Search users by Email or username
|
Pager<User> |
findUsers(java.lang.String emailOrUsername,
int itemsPerPage)
Search users by Email or username and return a Pager
|
java.util.List<User> |
findUsers(java.lang.String emailOrUsername,
int page,
int perPage)
Search users by Email or username in the specified page range.
|
java.util.stream.Stream<User> |
findUsersStream(java.lang.String emailOrUsername)
Search users by Email or username.
|
java.util.List<User> |
getActiveUsers()
Get a list of active users
|
Pager<User> |
getActiveUsers(int itemsPerPage)
Get a Pager of active users.
|
java.util.List<User> |
getActiveUsers(int page,
int perPage)
Get a list of active users using the specified page and per page settings.
|
java.util.stream.Stream<User> |
getActiveUsersStream()
Get a Stream of active users
|
java.util.List<User> |
getBlockedUsers()
Get a list of blocked users.
|
Pager<User> |
getBlockedUsers(int itemsPerPage)
Get a Pager of blocked users.
|
java.util.List<User> |
getblockedUsers(int page,
int perPage)
Get a list of blocked users using the specified page and per page settings.
|
java.util.stream.Stream<User> |
getBlockedUsersStream()
Get a Stream of blocked users.
|
User |
getCurrentUser()
Get currently authenticated user.
|
Email |
getEmail(java.lang.Long emailId)
Get a single Email instance specified by he email ID
|
java.util.List<Email> |
getEmails()
Get a list of emails for the current user.
|
java.util.List<Email> |
getEmails(java.lang.Object userIdOrUsername)
Get a list of a specified user’s emails.
|
ImpersonationToken |
getImpersonationToken(java.lang.Object userIdOrUsername,
java.lang.Long tokenId)
Get an impersonation token of a user.
|
java.util.List<ImpersonationToken> |
getImpersonationTokens(java.lang.Object userIdOrUsername)
Get a list of a specified user's impersonation tokens.
|
java.util.List<ImpersonationToken> |
getImpersonationTokens(java.lang.Object userIdOrUsername,
Constants.ImpersonationState state)
Get a list of a specified user's impersonation tokens.
|
java.util.List<Membership> |
getMemberships(java.lang.Long userId)
Lists all projects and groups a user is a member of.
|
Pager<Membership> |
getMemberships(java.lang.Long userId,
int itemsPerPage)
Returns a Pager that lists all projects and groups a user is a member of.
|
java.util.Optional<ImpersonationToken> |
getOptionalImpersonationToken(java.lang.Object userIdOrUsername,
java.lang.Long tokenId)
Get an impersonation token of a user as an Optional instance.
|
java.util.Optional<SshKey> |
getOptionalSshKey(java.lang.Long keyId)
Get a single SSH Key as an Optional instance.
|
java.util.Optional<User> |
getOptionalUser(java.lang.Long userId)
Get a single user as an Optional instance.
|
java.util.Optional<User> |
getOptionalUser(java.lang.String username)
Lookup a user by username and return an Optional instance.
|
java.util.Optional<User> |
getOptionalUserByEmail(java.lang.String email)
Lookup a user by email address and returns an Optional with the User instance as the value.
|
java.util.Optional<User> |
getOptionalUserByExternalUid(java.lang.String provider,
java.lang.String externalUid)
Lookup a user by external UID and return an Optional instance.
|
SshKey |
getSshKey(java.lang.Long keyId)
Get a single SSH Key.
|
java.util.List<SshKey> |
getSshKeys()
Get a list of currently authenticated user's SSH keys.
|
java.util.List<SshKey> |
getSshKeys(java.lang.Long userId)
Get a list of a specified user's SSH keys.
|
User |
getUser(java.lang.Long userId)
Get a single user.
|
User |
getUser(java.lang.String username)
Lookup a user by username.
|
User |
getUserByEmail(java.lang.String email)
Lookup a user by email address.
|
User |
getUserByExternalUid(java.lang.String provider,
java.lang.String externalUid)
Lookup a user by external UID.
|
java.util.List<User> |
getUsers()
Get a list of users.
|
Pager<User> |
getUsers(int itemsPerPage)
Get a Pager of users.
|
java.util.List<User> |
getUsers(int page,
int perPage)
Get a list of users using the specified page and per page settings.
|
java.util.stream.Stream<User> |
getUsersStream()
Get a Stream of users.
|
java.util.List<GpgKey> |
listGpgKeys()
Get all GPG keys for the current user.
|
java.util.List<GpgKey> |
listGpgKeys(java.lang.Long userId)
Get all GPG keys for a given user.
|
User |
modifyUser(User user,
java.lang.CharSequence password,
java.lang.Integer projectsLimit)
Deprecated.
Will be removed in version 6.0, replaced by
updateUser(User, CharSequence) |
void |
rejectUser(java.lang.Long userId)
Rejects specified user that is pending approval.
|
void |
revokeImpersonationToken(java.lang.Object userIdOrUsername,
java.lang.Long tokenId)
Revokes an impersonation token.
|
User |
setUserAvatar(java.lang.Object userIdOrUsername,
java.io.File avatarFile)
Uploads and sets the user's avatar for the specified user.
|
void |
unblockUser(java.lang.Long userId)
Unblocks the specified user.
|
User |
updateUser(User user,
java.lang.CharSequence password)
Modifies an existing user.
|
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getLabelIdOrName, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, patch, patch, post, post, post, post, post, put, put, put, putUpload, putUpload, putWithFormData, upload, upload, upload, upload, urlEncode, validate
public UserApi(GitLabApi gitLabApi)
public void enableCustomAttributes()
public void disableCustomAttributes()
public java.util.List<User> getUsers() throws GitLabApiException
Get a list of users.
WARNING: Do not use this method to fetch users from https://gitlab.com, gitlab.com has many 1,000,000's of users and it will a long time to fetch all of them. Instead usegetUsers(int itemsPerPage)
which will return a Pager of Group instances.
GitLab Endpoint: GET /users
GitLabApiException
- if any exception occurspublic java.util.List<User> getUsers(int page, int perPage) throws GitLabApiException
GitLab Endpoint: GET /users
page
- the page to getperPage
- the number of users per pageGitLabApiException
- if any exception occurspublic Pager<User> getUsers(int itemsPerPage) throws GitLabApiException
GitLab Endpoint: GET /users
itemsPerPage
- the number of User instances that will be fetched per pageGitLabApiException
- if any exception occurspublic java.util.stream.Stream<User> getUsersStream() throws GitLabApiException
GitLab Endpoint: GET /users
GitLabApiException
- if any exception occurspublic java.util.List<User> getActiveUsers() throws GitLabApiException
GitLab Endpoint: GET /users?active=true
GitLabApiException
- if any exception occurspublic java.util.List<User> getActiveUsers(int page, int perPage) throws GitLabApiException
GitLab Endpoint: GET /users?active=true
page
- the page to getperPage
- the number of users per pageGitLabApiException
- if any exception occurspublic Pager<User> getActiveUsers(int itemsPerPage) throws GitLabApiException
GitLab Endpoint: GET /users?active=true
itemsPerPage
- the number of active User instances that will be fetched per pageGitLabApiException
- if any exception occurspublic java.util.stream.Stream<User> getActiveUsersStream() throws GitLabApiException
GitLab Endpoint: GET /users?active=true
GitLabApiException
- if any exception occurspublic void approveUser(java.lang.Long userId) throws GitLabApiException
GitLab Endpoint: POST /users/:id/approve
userId
- the ID of the user to approveGitLabApiException
- if any exception occurspublic void rejectUser(java.lang.Long userId) throws GitLabApiException
GitLab Endpoint: POST /users/:id/reject
userId
- the ID of the user to rejectGitLabApiException
- if any exception occurspublic void blockUser(java.lang.Long userId) throws GitLabApiException
GitLab Endpoint: POST /users/:id/block
userId
- the ID of the user to blockGitLabApiException
- if any exception occurspublic void unblockUser(java.lang.Long userId) throws GitLabApiException
GitLab Endpoint: POST /users/:id/unblock
userId
- the ID of the user to unblockGitLabApiException
- if any exception occurspublic java.util.List<User> getBlockedUsers() throws GitLabApiException
GitLab Endpoint: GET /users?blocked=true
GitLabApiException
- if any exception occurspublic java.util.List<User> getblockedUsers(int page, int perPage) throws GitLabApiException
GitLab Endpoint: GET /users?blocked=true
page
- the page to getperPage
- the number of users per pageGitLabApiException
- if any exception occurspublic Pager<User> getBlockedUsers(int itemsPerPage) throws GitLabApiException
GitLab Endpoint: GET /users?blocked=true
itemsPerPage
- the number of blocked User instances that will be fetched per pageGitLabApiException
- if any exception occurspublic java.util.stream.Stream<User> getBlockedUsersStream() throws GitLabApiException
GitLab Endpoint: GET /users?blocked=true
GitLabApiException
- if any exception occurspublic User getUser(java.lang.Long userId) throws GitLabApiException
GitLab Endpoint: GET /users/:id
userId
- the ID of the user to getGitLabApiException
- if any exception occurspublic java.util.Optional<User> getOptionalUser(java.lang.Long userId)
GitLab Endpoint: GET /users/:id
userId
- the ID of the user to getpublic User getUser(java.lang.String username) throws GitLabApiException
NOTE: This is for admin users only.
GitLab Endpoint: GET /users?username=:username
username
- the username of the user to getGitLabApiException
- if any exception occurspublic java.util.Optional<User> getOptionalUser(java.lang.String username)
NOTE: This is for admin users only.
GitLab Endpoint: GET /users?username=:username
username
- the username of the user to getpublic User getUserByEmail(java.lang.String email) throws GitLabApiException
GitLab Endpoint: GET /users?search=:email_or_username
email
- the email of the user to getGitLabApiException
- if any exception occursjava.lang.IllegalArgumentException
- if email is not validpublic java.util.Optional<User> getOptionalUserByEmail(java.lang.String email)
GitLab Endpoint: GET /users?search=:email_or_username
email
- the email of the user to getpublic User getUserByExternalUid(java.lang.String provider, java.lang.String externalUid) throws GitLabApiException
NOTE: This is for admin users only.
GitLab Endpoint: GET /users?extern_uid=:externalUid&provider=:provider
provider
- the provider of the external uidexternalUid
- the external UID of the userGitLabApiException
- if any exception occurspublic java.util.Optional<User> getOptionalUserByExternalUid(java.lang.String provider, java.lang.String externalUid)
NOTE: This is for admin users only.
GitLab Endpoint: GET /users?extern_uid=:externUid&provider=:provider
provider
- the provider of the external uidexternalUid
- the external UID of the userpublic java.util.List<User> findUsers(java.lang.String emailOrUsername) throws GitLabApiException
GitLab Endpoint: GET /users?search=:email_or_username
emailOrUsername
- the email or username to search forGitLabApiException
- if any exception occurspublic java.util.List<User> findUsers(java.lang.String emailOrUsername, int page, int perPage) throws GitLabApiException
GitLab Endpoint: GET /users?search=:email_or_username
emailOrUsername
- the email or username to search forpage
- the page to getperPage
- the number of users per pageGitLabApiException
- if any exception occurspublic Pager<User> findUsers(java.lang.String emailOrUsername, int itemsPerPage) throws GitLabApiException
GitLab Endpoint: GET /users?search=:email_or_username
emailOrUsername
- the email or username to search foritemsPerPage
- the number of Project instances that will be fetched per pageGitLabApiException
- if any exception occurspublic java.util.stream.Stream<User> findUsersStream(java.lang.String emailOrUsername) throws GitLabApiException
GitLab Endpoint: GET /users?search=:email_or_username
emailOrUsername
- the email or username to search forGitLabApiException
- if any exception occurs@Deprecated public User createUser(User user, java.lang.CharSequence password, java.lang.Integer projectsLimit) throws GitLabApiException
createUser(User, CharSequence, boolean)
Creates a new user. Note only administrators can create new users. Either password or reset_password should be specified (reset_password takes priority).
If both the User object's projectsLimit and the parameter projectsLimit is specified the parameter will take precedence.
GitLab Endpoint: POST /users
The following properties of the provided User instance can be set during creation:
email (required) - Email
username (required) - Username
name (required) - Name
skype (optional) - Skype ID
linkedin (optional) - LinkedIn
twitter (optional) - Twitter account
websiteUrl (optional) - Website URL
organization (optional) - Organization name
projectsLimit (optional) - Number of projects user can create
externUid (optional) - External UID
provider (optional) - External provider name
bio (optional) - User's biography
location (optional) - User's location
admin (optional) - User is admin - true or false (default)
canCreateGroup (optional) - User can create groups - true or false
skipConfirmation (optional) - Skip confirmation - true or false (default)
external (optional) - Flags the user as external - true or false(default)
sharedRunnersMinutesLimit (optional) - Pipeline minutes quota for this user
user
- the User instance with the user info to createpassword
- the password for the new userprojectsLimit
- the maximum number of projectGitLabApiException
- if any exception occurspublic User createUser(User user, java.lang.CharSequence password, boolean resetPassword) throws GitLabApiException
Creates a new user. Note only administrators can create new users. Either password or resetPassword should be specified (resetPassword takes priority).
GitLab Endpoint: POST /users
The following properties of the provided User instance can be set during creation:
email (required) - Email
username (required) - Username
name (required) - Name
skype (optional) - Skype ID
linkedin (optional) - LinkedIn
twitter (optional) - Twitter account
websiteUrl (optional) - Website URL
organization (optional) - Organization name
projectsLimit (optional) - Number of projects user can create
externUid (optional) - External UID
provider (optional) - External provider name
bio (optional) - User's biography
location (optional) - User's location
admin (optional) - User is admin - true or false (default)
canCreateGroup (optional) - User can create groups - true or false
skipConfirmation (optional) - Skip confirmation - true or false (default)
external (optional) - Flags the user as external - true or false(default)
sharedRunnersMinutesLimit (optional) - Pipeline minutes quota for this user
user
- the User instance with the user info to createpassword
- the password for the new userresetPassword
- whether to send a password reset linkGitLabApiException
- if any exception occurspublic User updateUser(User user, java.lang.CharSequence password) throws GitLabApiException
Modifies an existing user. Only administrators can change attributes of a user.
GitLab Endpoint: PUT /users
The following properties of the provided User instance can be set during update:
email (required) - Email
username (required) - Username
name (required) - Name
skype (optional) - Skype ID
linkedin (optional) - LinkedIn
twitter (optional) - Twitter account
websiteUrl (optional) - Website URL
organization (optional) - Organization name
projectsLimit (optional) - Number of projects user can create
externUid (optional) - External UID
provider (optional) - External provider name
bio (optional) - User's biography
location (optional) - User's location
admin (optional) - User is admin - true or false (default)
canCreateGroup (optional) - User can create groups - true or false
skipConfirmation (optional) - Skip confirmation - true or false (default)
external (optional) - Flags the user as external - true or false(default)
sharedRunnersMinutesLimit (optional) - Pipeline minutes quota for this user
user
- the User instance with the user info to modifypassword
- the new password for the userGitLabApiException
- if any exception occurs@Deprecated public User modifyUser(User user, java.lang.CharSequence password, java.lang.Integer projectsLimit) throws GitLabApiException
updateUser(User, CharSequence)
GitLab Endpoint: PUT /users/:id
The following properties of the provided User instance can be set during update:
email (required) - Email
username (required) - Username
name (required) - Name
skype (optional) - Skype ID
linkedin (optional) - LinkedIn
twitter (optional) - Twitter account
websiteUrl (optional) - Website URL
organization (optional) - Organization name
projectsLimit (optional) - Number of projects user can create
externUid (optional) - External UID
provider (optional) - External provider name
bio (optional) - User's biography
location (optional) - User's location
admin (optional) - User is admin - true or false (default)
canCreateGroup (optional) - User can create groups - true or false
skipConfirmation (optional) - Skip confirmation - true or false (default)
external (optional) - Flags the user as external - true or false(default)
sharedRunnersMinutesLimit (optional) - Pipeline minutes quota for this user
user
- the User instance with the user info to modifypassword
- the new password for the userprojectsLimit
- the maximum number of projectGitLabApiException
- if any exception occurspublic void deleteUser(java.lang.Object userIdOrUsername) throws GitLabApiException
GitLab Endpoint: DELETE /users/:id
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instanceGitLabApiException
- if any exception occurspublic void deleteUser(java.lang.Object userIdOrUsername, java.lang.Boolean hardDelete) throws GitLabApiException
GitLab Endpoint: DELETE /users/:id
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancehardDelete
- If true, contributions that would usually be moved to the
ghost user will be deleted instead, as well as groups owned solely by this userGitLabApiException
- if any exception occurspublic User getCurrentUser() throws GitLabApiException
GitLab Endpoint: GET /user
GitLabApiException
- if any exception occurspublic java.util.List<SshKey> getSshKeys() throws GitLabApiException
GitLab Endpoint: GET /user/keys
GitLabApiException
- if any exception occurspublic java.util.List<SshKey> getSshKeys(java.lang.Long userId) throws GitLabApiException
GitLab Endpoint: GET /users/:id/keys
userId
- the user ID to get the SSH keys forGitLabApiException
- if any exception occurspublic SshKey getSshKey(java.lang.Long keyId) throws GitLabApiException
GitLab Endpoint: GET /user/keys/:key_id
keyId
- the ID of the SSH key.GitLabApiException
- if any exception occurspublic java.util.Optional<SshKey> getOptionalSshKey(java.lang.Long keyId)
GitLab Endpoint: GET /user/keys/:key_id
keyId
- the ID of the SSH keypublic SshKey addSshKey(java.lang.String title, java.lang.String key) throws GitLabApiException
GitLab Endpoint: POST /user/keys
title
- the new SSH Key's titlekey
- the new SSH keyGitLabApiException
- if any exception occurspublic SshKey addSshKey(java.lang.Long userId, java.lang.String title, java.lang.String key) throws GitLabApiException
GitLab Endpoint: POST /users/:id/keys
userId
- the ID of the user to add the SSH key fortitle
- the new SSH Key's titlekey
- the new SSH keyGitLabApiException
- if any exception occurspublic void deleteSshKey(java.lang.Long keyId) throws GitLabApiException
GitLab Endpoint: DELETE /user/keys/:key_id
keyId
- the key ID to deleteGitLabApiException
- if any exception occurspublic void deleteSshKey(java.lang.Object userIdOrUsername, java.lang.Long keyId) throws GitLabApiException
GitLab Endpoint: DELETE /users/:id/keys/:key_id
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancekeyId
- the key ID to deleteGitLabApiException
- if any exception occurspublic java.util.List<ImpersonationToken> getImpersonationTokens(java.lang.Object userIdOrUsername) throws GitLabApiException
GitLab Endpoint: GET /users/:id/impersonation_tokens
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instanceGitLabApiException
- if any exception occurspublic java.util.List<ImpersonationToken> getImpersonationTokens(java.lang.Object userIdOrUsername, Constants.ImpersonationState state) throws GitLabApiException
GitLab Endpoint: GET /users/:id/impersonation_tokens
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancestate
- the state of impersonation tokens to list (ALL, ACTIVE, INACTIVE)GitLabApiException
- if any exception occurspublic ImpersonationToken getImpersonationToken(java.lang.Object userIdOrUsername, java.lang.Long tokenId) throws GitLabApiException
GitLab Endpoint: GET /users/:user_id/impersonation_tokens/:impersonation_token_id
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancetokenId
- the impersonation token ID to getGitLabApiException
- if any exception occurspublic java.util.Optional<ImpersonationToken> getOptionalImpersonationToken(java.lang.Object userIdOrUsername, java.lang.Long tokenId)
GitLab Endpoint: GET /users/:user_id/impersonation_tokens/:impersonation_token_id
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancetokenId
- the impersonation token ID to getpublic ImpersonationToken createImpersonationToken(java.lang.Object userIdOrUsername, java.lang.String name, java.util.Date expiresAt, ImpersonationToken.Scope[] scopes) throws GitLabApiException
GitLab Endpoint: POST /users/:user_id/impersonation_tokens
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancename
- the name of the impersonation token, requiredexpiresAt
- the expiration date of the impersonation token, optionalscopes
- an array of scopes of the impersonation tokenGitLabApiException
- if any exception occurspublic void revokeImpersonationToken(java.lang.Object userIdOrUsername, java.lang.Long tokenId) throws GitLabApiException
GitLab Endpoint: DELETE /users/:user_id/impersonation_tokens/:impersonation_token_id
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancetokenId
- the impersonation token ID to revokeGitLabApiException
- if any exception occurspublic ImpersonationToken createPersonalAccessToken(java.lang.Object userIdOrUsername, java.lang.String name, java.util.Date expiresAt, ImpersonationToken.Scope[] scopes) throws GitLabApiException
GitLab Endpoint: POST /users/:user_id/personal_access_tokens
userIdOrUsername
- the user in the form of an Integer(ID), String(username), or User instancename
- the name of the personal access token, requiredexpiresAt
- the expiration date of the personal access token, optionalscopes
- an array of scopes of the personal access tokenGitLabApiException
- if any exception occurspublic CustomAttribute createCustomAttribute(java.lang.Object userIdOrUsername, CustomAttribute customAttribute) throws GitLabApiException
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancecustomAttribute
- the custom attribute to setGitLabApiException
- on failure while setting customAttributespublic CustomAttribute createCustomAttribute(java.lang.Object userIdOrUsername, java.lang.String key, java.lang.String value) throws GitLabApiException
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancekey
- for the customAttributevalue
- or the customAttributeGitLabApiException
- on failure while setting customAttributespublic CustomAttribute changeCustomAttribute(java.lang.Object userIdOrUsername, CustomAttribute customAttribute) throws GitLabApiException
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancecustomAttribute
- the custome attribute to changeGitLabApiException
- on failure while changing customAttributespublic CustomAttribute changeCustomAttribute(java.lang.Object userIdOrUsername, java.lang.String key, java.lang.String value) throws GitLabApiException
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancekey
- for the customAttributevalue
- for the customAttributeGitLabApiException
- on failure while changing customAttributespublic void deleteCustomAttribute(java.lang.Object userIdOrUsername, CustomAttribute customAttribute) throws GitLabApiException
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancecustomAttribute
- to removeGitLabApiException
- on failure while deleting customAttributespublic void deleteCustomAttribute(java.lang.Object userIdOrUsername, java.lang.String key) throws GitLabApiException
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instancekey
- of the customAttribute to removeGitLabApiException
- on failure while deleting customAttributespublic User setUserAvatar(java.lang.Object userIdOrUsername, java.io.File avatarFile) throws GitLabApiException
PUT /users/:id
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instanceavatarFile
- the File instance of the avatar file to uploadGitLabApiException
- if any exception occurspublic java.util.List<Email> getEmails() throws GitLabApiException
GitLab Endpoint: GET /users/emails
GitLabApiException
- if any exception occurspublic java.util.List<Email> getEmails(java.lang.Object userIdOrUsername) throws GitLabApiException
GitLab Endpoint: GET /user/:id/emails
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instanceGitLabApiException
- if any exception occurspublic Email addEmail(java.lang.String email) throws GitLabApiException
GitLab Endpoint: POST /user/:id/emails
email
- the email address to addGitLabApiException
- if any exception occurspublic Email getEmail(java.lang.Long emailId) throws GitLabApiException
GitLab Endpoint: GET /user/emails/:emailId
emailId
- the email ID to getGitLabApiException
- if any exception occurspublic Email addEmail(java.lang.Object userIdOrUsername, java.lang.String email, java.lang.Boolean skipConfirmation) throws GitLabApiException
GitLab Endpoint: POST /user/:id/emails
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instanceemail
- the email address to addskipConfirmation
- skip confirmation and assume e-mail is verified - true or false (default)GitLabApiException
- if any exception occurspublic void deleteEmail(java.lang.Long emailId) throws GitLabApiException
GitLab Endpoint: DELETE /user/emails/:emailId
emailId
- the email ID to deleteGitLabApiException
- if any exception occurspublic void deleteEmail(java.lang.Object userIdOrUsername, java.lang.Long emailId) throws GitLabApiException
GitLab Endpoint: DELETE /user/:id/emails/:emailId
userIdOrUsername
- the user in the form of an Long(ID), String(username), or User instanceemailId
- the email ID to deleteGitLabApiException
- if any exception occurspublic java.util.List<GpgKey> listGpgKeys() throws GitLabApiException
GitLab Endpoint: GET /user/gpg_keys
GitLabApiException
- if any exception occurspublic GpgKey addGpgKey(java.lang.String key) throws GitLabApiException
GitLab Endpoint: POST /user/gpg_keys
key
- the ASCII-armored exported public GPG key to addGitLabApiException
- if any exception occurspublic void deleteGpgKey(java.lang.Long keyId) throws GitLabApiException
GitLab Endpoint: DELETE /user/gpg_keys/:keyId
keyId
- the key ID in the form if an Long(ID)GitLabApiException
- if any exception occurspublic java.util.List<GpgKey> listGpgKeys(java.lang.Long userId) throws GitLabApiException
GitLab Endpoint: GET /users/:id/gpg_keys
userId
- the user in the form of an Long(ID)GitLabApiException
- if any exception occurspublic GpgKey addGpgKey(java.lang.Long userId, java.lang.String key) throws GitLabApiException
GitLab Endpoint: POST /users/:id/gpg_keys
userId
- the user in the form of an Long(ID)key
- the ASCII-armored exported public GPG key to addGitLabApiException
- if any exception occurspublic void deleteGpgKey(java.lang.Long userId, java.lang.Long keyId) throws GitLabApiException
GitLab Endpoint: DELETE /users/:id/gpg_keys/:keyId
userId
- the user in the form of an Long(ID)keyId
- the key ID in the form if an Long(ID)GitLabApiException
- if any exception occurspublic java.util.List<Membership> getMemberships(java.lang.Long userId) throws GitLabApiException
GitLab Endpoint: GET /users/:id/memberships
userId
- the ID of the user to get the memberships forGitLabApiException
- if any exception occurspublic Pager<Membership> getMemberships(java.lang.Long userId, int itemsPerPage) throws GitLabApiException
GitLab Endpoint: GET /users/:id/memberships
userId
- the ID of the user to get the memberships foritemsPerPage
- the number of Membership instances that will be fetched per pageGitLabApiException
- if any exception occurs