Class UserApi
- java.lang.Object
-
- org.gitlab4j.api.AbstractApi
-
- org.gitlab4j.api.UserApi
-
- All Implemented Interfaces:
org.gitlab4j.models.Constants
public class UserApi extends AbstractApi
This class provides an entry point to all the GitLab API users calls.- See Also:
- Users API at GitLab
-
-
Nested Class Summary
-
Nested classes/interfaces inherited from interface org.gitlab4j.models.Constants
org.gitlab4j.models.Constants.ActionType, org.gitlab4j.models.Constants.ApplicationScope, org.gitlab4j.models.Constants.ArchiveFormat, org.gitlab4j.models.Constants.AutoCancelPendingPipelines, org.gitlab4j.models.Constants.AutoDevopsDeployStrategy, org.gitlab4j.models.Constants.BuildGitStrategy, org.gitlab4j.models.Constants.CommitBuildState, org.gitlab4j.models.Constants.ContributorOrderBy, org.gitlab4j.models.Constants.DefaultBranchProtectionLevel, org.gitlab4j.models.Constants.DeploymentOrderBy, org.gitlab4j.models.Constants.DeploymentStatus, org.gitlab4j.models.Constants.DeployTokenScope, org.gitlab4j.models.Constants.Encoding, org.gitlab4j.models.Constants.EpicOrderBy, org.gitlab4j.models.Constants.EventScope, org.gitlab4j.models.Constants.GroupOrderBy, org.gitlab4j.models.Constants.GroupSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.ImpersonationState, org.gitlab4j.models.Constants.IssueOrderBy, org.gitlab4j.models.Constants.IssueScope, org.gitlab4j.models.Constants.IssueState, org.gitlab4j.models.Constants.JobScope, org.gitlab4j.models.Constants.LineType, org.gitlab4j.models.Constants.MergeRequestOrderBy, org.gitlab4j.models.Constants.MergeRequestScope, org.gitlab4j.models.Constants.MergeRequestSearchIn, org.gitlab4j.models.Constants.MergeRequestState, org.gitlab4j.models.Constants.MilestoneState, org.gitlab4j.models.Constants.PackageOrderBy, org.gitlab4j.models.Constants.PackageStatus, org.gitlab4j.models.Constants.PipelineOrderBy, org.gitlab4j.models.Constants.PipelineScope, org.gitlab4j.models.Constants.PipelineSource, org.gitlab4j.models.Constants.ProjectAccessTokenScope, org.gitlab4j.models.Constants.ProjectCreationLevel, org.gitlab4j.models.Constants.ProjectFeatureVisibilityAccessLevel, org.gitlab4j.models.Constants.ProjectOrderBy, org.gitlab4j.models.Constants.ProjectSearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SearchScope<T extends java.lang.Object>, org.gitlab4j.models.Constants.SortOrder, org.gitlab4j.models.Constants.SquashOption, org.gitlab4j.models.Constants.StateEvent, org.gitlab4j.models.Constants.SubgroupCreationLevel, org.gitlab4j.models.Constants.TagOrderBy, org.gitlab4j.models.Constants.TargetType, org.gitlab4j.models.Constants.TodoAction, org.gitlab4j.models.Constants.TodoState, org.gitlab4j.models.Constants.TodoType, org.gitlab4j.models.Constants.TokenType
-
-
Field Summary
-
Fields inherited from class org.gitlab4j.api.AbstractApi
gitLabApi
-
-
Method Summary
All Methods Instance Methods Concrete Methods Deprecated Methods Modifier and Type Method Description voidactivateUser(java.lang.Long userId)Activates the given user (admin only)org.gitlab4j.api.models.EmailaddEmail(java.lang.Object userIdOrUsername, java.lang.String email, java.lang.Boolean skipConfirmation)Add an email to the user's emails.org.gitlab4j.api.models.EmailaddEmail(java.lang.String email)Add an email to the current user's emails.org.gitlab4j.api.models.GpgKeyaddGpgKey(java.lang.Long userId, java.lang.String key)Add a GPG key for a specific userorg.gitlab4j.api.models.GpgKeyaddGpgKey(java.lang.String key)Add a GPG key for the current userorg.gitlab4j.api.models.SshKeyaddSshKey(java.lang.Long userId, java.lang.String title, java.lang.String key)Deprecated.useaddSshKey(Long, String, String, Date)insteadorg.gitlab4j.api.models.SshKeyaddSshKey(java.lang.Long userId, java.lang.String title, java.lang.String key, java.util.Date expiresAt)Create new key owned by specified user.org.gitlab4j.api.models.SshKeyaddSshKey(java.lang.String title, java.lang.String key)Deprecated.useaddSshKey(String, String, Date)insteadorg.gitlab4j.api.models.SshKeyaddSshKey(java.lang.String title, java.lang.String key, java.util.Date expiresAt)Creates a new key owned by the currently authenticated user.voidapproveUser(java.lang.Long userId)Approves the specified user.voidblockUser(java.lang.Long userId)Blocks the specified user.org.gitlab4j.api.models.CustomAttributechangeCustomAttribute(java.lang.Object userIdOrUsername, java.lang.String key, java.lang.String value)Changes custom attribute for the given userorg.gitlab4j.api.models.CustomAttributechangeCustomAttribute(java.lang.Object userIdOrUsername, org.gitlab4j.api.models.CustomAttribute customAttribute)Change custom attribute for the given userorg.gitlab4j.api.models.CustomAttributecreateCustomAttribute(java.lang.Object userIdOrUsername, java.lang.String key, java.lang.String value)Creates custom attribute for the given userorg.gitlab4j.api.models.CustomAttributecreateCustomAttribute(java.lang.Object userIdOrUsername, org.gitlab4j.api.models.CustomAttribute customAttribute)Creates custom attribute for the given userorg.gitlab4j.api.models.ImpersonationTokencreateImpersonationToken(java.lang.Object userIdOrUsername, java.lang.String name, java.util.Date expiresAt, org.gitlab4j.api.models.ImpersonationToken.Scope[] scopes)Create an impersonation token.org.gitlab4j.api.models.ImpersonationTokencreatePersonalAccessToken(java.lang.Object userIdOrUsername, java.lang.String name, java.lang.String description, java.util.Date expiresAt, org.gitlab4j.api.models.ImpersonationToken.Scope[] scopes)Create a personal access token.org.gitlab4j.api.models.ImpersonationTokencreatePersonalAccessToken(java.lang.Object userIdOrUsername, java.lang.String name, java.util.Date expiresAt, org.gitlab4j.api.models.ImpersonationToken.Scope[] scopes)Deprecated.org.gitlab4j.api.models.ImpersonationTokencreatePersonalAccessToken(java.lang.String name, java.lang.String description, java.util.Date expiresAt, org.gitlab4j.api.models.ImpersonationToken.Scope[] scopes)Create a personal access token for your account.org.gitlab4j.api.models.CreateRunnerResponsecreateRunner(org.gitlab4j.api.models.CreateRunnerParams params)Create a runner linked to the current user.org.gitlab4j.api.models.UsercreateUser(org.gitlab4j.api.models.User user, java.lang.CharSequence password, java.lang.Boolean resetPassword)Creates a new user.org.gitlab4j.api.models.UsercreateUser(org.gitlab4j.api.models.User user, java.lang.CharSequence password, java.lang.Integer projectsLimit)Deprecated.Will be removed in version 6.0, replaced bycreateUser(User, CharSequence, Boolean)voiddeactivateUser(java.lang.Long userId)Deactivates the given user (admin only)voiddeleteCustomAttribute(java.lang.Object userIdOrUsername, java.lang.String key)Delete a custom attribute for the given uservoiddeleteCustomAttribute(java.lang.Object userIdOrUsername, org.gitlab4j.api.models.CustomAttribute customAttribute)Delete a custom attribute for the given uservoiddeleteEmail(java.lang.Long emailId)Deletes an email belonging to the current user.voiddeleteEmail(java.lang.Object userIdOrUsername, java.lang.Long emailId)Deletes a user's emailvoiddeleteGpgKey(java.lang.Long keyId)Remove a specific GPG key for the current uservoiddeleteGpgKey(java.lang.Long userId, java.lang.Long keyId)Remove a specific GPG key for a specific uservoiddeleteSshKey(java.lang.Long keyId)Deletes key owned by currently authenticated user.voiddeleteSshKey(java.lang.Object userIdOrUsername, java.lang.Long keyId)Deletes key owned by a specified user.voiddeleteUser(java.lang.Object userIdOrUsername)Deletes a user.voiddeleteUser(java.lang.Object userIdOrUsername, java.lang.Boolean hardDelete)Deletes a user.voiddisableCustomAttributes()Disables custom attributes to be returned when fetching User instances.voidenableCustomAttributes()Enables custom attributes to be returned when fetching User instances.booleanexists(java.lang.String username)Check if the given user exists.java.util.List<org.gitlab4j.api.models.User>findUsers(java.lang.String emailOrUsername)Search users by Email or usernamePager<org.gitlab4j.api.models.User>findUsers(java.lang.String emailOrUsername, int itemsPerPage)Search users by Email or username and return a Pagerjava.util.List<org.gitlab4j.api.models.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<org.gitlab4j.api.models.User>findUsersStream(java.lang.String emailOrUsername)Search users by Email or username.java.util.List<org.gitlab4j.api.models.User>getActiveUsers()Get a list of active usersPager<org.gitlab4j.api.models.User>getActiveUsers(int itemsPerPage)Get a Pager of active users.java.util.List<org.gitlab4j.api.models.User>getActiveUsers(int page, int perPage)Get a list of active users using the specified page and per page settings.java.util.stream.Stream<org.gitlab4j.api.models.User>getActiveUsersStream()Get a Stream of active usersorg.gitlab4j.api.models.AssociationsgetAssociationsCount(java.lang.Long userId)Get a count of a user’s projects, groups, issues, and merge requestsjava.util.List<org.gitlab4j.api.models.User>getblockedUsers(int page, int perPage)Get a list of blocked users using the specified page and per page settings.java.util.List<org.gitlab4j.api.models.User>getBlockedUsers()Get a list of blocked users.Pager<org.gitlab4j.api.models.User>getBlockedUsers(int itemsPerPage)Get a Pager of blocked users.java.util.stream.Stream<org.gitlab4j.api.models.User>getBlockedUsersStream()Get a Stream of blocked users.org.gitlab4j.api.models.UsergetCurrentUser()Get currently authenticated user.org.gitlab4j.api.models.EmailgetEmail(java.lang.Long emailId)Get a single Email instance specified by he email IDjava.util.List<org.gitlab4j.api.models.Email>getEmails()Get a list of emails for the current user.java.util.List<org.gitlab4j.api.models.Email>getEmails(java.lang.Object userIdOrUsername)Get a list of a specified user’s emails.org.gitlab4j.api.models.ImpersonationTokengetImpersonationToken(java.lang.Object userIdOrUsername, java.lang.Long tokenId)Get an impersonation token of a user.java.util.List<org.gitlab4j.api.models.ImpersonationToken>getImpersonationTokens(java.lang.Object userIdOrUsername)Get a list of a specified user's impersonation tokens.java.util.List<org.gitlab4j.api.models.ImpersonationToken>getImpersonationTokens(java.lang.Object userIdOrUsername, org.gitlab4j.models.Constants.ImpersonationState state)Get a list of a specified user's impersonation tokens.java.util.List<org.gitlab4j.api.models.Membership>getMemberships(java.lang.Long userId)Lists all projects and groups a user is a member of.Pager<org.gitlab4j.api.models.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<org.gitlab4j.api.models.ImpersonationToken>getOptionalImpersonationToken(java.lang.Object userIdOrUsername, java.lang.Long tokenId)Get an impersonation token of a user as an Optional instance.java.util.Optional<org.gitlab4j.api.models.SshKey>getOptionalSshKey(java.lang.Long keyId)Get a single SSH Key as an Optional instance.java.util.Optional<org.gitlab4j.api.models.User>getOptionalUser(java.lang.Long userId)Get a single user as an Optional instance.java.util.Optional<org.gitlab4j.api.models.User>getOptionalUser(java.lang.String username)Lookup a user by username and return an Optional instance.java.util.Optional<org.gitlab4j.api.models.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<org.gitlab4j.api.models.User>getOptionalUserByExternalUid(java.lang.String provider, java.lang.String externalUid)Lookup a user by external UID and return an Optional instance.org.gitlab4j.api.models.SshKeygetSshKey(java.lang.Long keyId)Get a single SSH Key.java.util.List<org.gitlab4j.api.models.SshKey>getSshKeys()Get a list of currently authenticated user's SSH keys.java.util.List<org.gitlab4j.api.models.SshKey>getSshKeys(java.lang.Long userId)Get a list of a specified user's SSH keys.org.gitlab4j.api.models.UsergetUser(java.lang.Long userId)Get a single user.org.gitlab4j.api.models.UsergetUser(java.lang.String username)Lookup a user by username.org.gitlab4j.api.models.UsergetUserByEmail(java.lang.String email)Lookup a user by email address.org.gitlab4j.api.models.UsergetUserByExternalUid(java.lang.String provider, java.lang.String externalUid)Lookup a user by external UID.java.util.List<org.gitlab4j.api.models.User>getUsers()Get a list of users.Pager<org.gitlab4j.api.models.User>getUsers(int itemsPerPage)Get a Pager of users.java.util.List<org.gitlab4j.api.models.User>getUsers(int page, int perPage)Get a list of users using the specified page and per page settings.java.util.stream.Stream<org.gitlab4j.api.models.User>getUsersStream()Get a Stream of users.java.util.List<org.gitlab4j.api.models.GpgKey>listGpgKeys()Get all GPG keys for the current user.java.util.List<org.gitlab4j.api.models.GpgKey>listGpgKeys(java.lang.Long userId)Get all GPG keys for a given user.org.gitlab4j.api.models.UsermodifyUser(org.gitlab4j.api.models.User user, java.lang.CharSequence password, java.lang.Integer projectsLimit)Deprecated.Will be removed in version 6.0, replaced byupdateUser(User, CharSequence)voidrejectUser(java.lang.Long userId)Rejects specified user that is pending approval.voidrevokeImpersonationToken(java.lang.Object userIdOrUsername, java.lang.Long tokenId)Revokes an impersonation token.voidrevokePersonalAccessToken(java.lang.Long tokenId)Revokes a personal access token.org.gitlab4j.api.models.UsersetUserAvatar(java.lang.Object userIdOrUsername, java.io.File avatarFile)Uploads and sets the user's avatar for the specified user.voidunblockUser(java.lang.Long userId)Unblocks the specified user.org.gitlab4j.api.models.UserupdateUser(org.gitlab4j.api.models.User user, java.lang.CharSequence password)Modifies an existing user.-
Methods inherited from class org.gitlab4j.api.AbstractApi
addFormParam, addFormParam, delete, delete, get, get, getApiClient, getApiVersion, getDefaultPerPage, getDefaultPerPageParam, getDefaultPerPageParam, getGroupIdOrPath, getLabelIdOrName, getNamespaceIdOrPath, getPageQueryParams, getPageQueryParams, getPerPageQueryParam, getProjectIdOrPath, getUserIdOrUsername, getWithAccepts, handle, head, isApiVersion, patch, patch, post, post, post, post, post, put, put, put, putUpload, putUpload, putWithFormData, putWithFormData, upload, upload, upload, upload, urlEncode, validate
-
-
-
-
Constructor Detail
-
UserApi
public UserApi(GitLabApi gitLabApi)
-
-
Method Detail
-
enableCustomAttributes
public void enableCustomAttributes()
Enables custom attributes to be returned when fetching User instances.
-
disableCustomAttributes
public void disableCustomAttributes()
Disables custom attributes to be returned when fetching User instances.
-
getUsers
public java.util.List<org.gitlab4j.api.models.User> getUsers() throws GitLabApiExceptionGet 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- Returns:
- a list of Users
- Throws:
GitLabApiException- if any exception occurs
-
getUsers
public java.util.List<org.gitlab4j.api.models.User> getUsers(int page, int perPage) throws GitLabApiExceptionGet a list of users using the specified page and per page settings.GitLab Endpoint: GET /users- Parameters:
page- the page to getperPage- the number of users per page- Returns:
- the list of Users in the specified range
- Throws:
GitLabApiException- if any exception occurs
-
getUsers
public Pager<org.gitlab4j.api.models.User> getUsers(int itemsPerPage) throws GitLabApiException
Get a Pager of users.GitLab Endpoint: GET /users- Parameters:
itemsPerPage- the number of User instances that will be fetched per page- Returns:
- a Pager of User
- Throws:
GitLabApiException- if any exception occurs
-
getUsersStream
public java.util.stream.Stream<org.gitlab4j.api.models.User> getUsersStream() throws GitLabApiExceptionGet a Stream of users.GitLab Endpoint: GET /users- Returns:
- a Stream of Users.
- Throws:
GitLabApiException- if any exception occurs
-
getActiveUsers
public java.util.List<org.gitlab4j.api.models.User> getActiveUsers() throws GitLabApiExceptionGet a list of active usersGitLab Endpoint: GET /users?active=true- Returns:
- a list of active Users
- Throws:
GitLabApiException- if any exception occurs
-
getActiveUsers
public java.util.List<org.gitlab4j.api.models.User> getActiveUsers(int page, int perPage) throws GitLabApiExceptionGet a list of active users using the specified page and per page settings.GitLab Endpoint: GET /users?active=true- Parameters:
page- the page to getperPage- the number of users per page- Returns:
- the list of active Users in the specified range
- Throws:
GitLabApiException- if any exception occurs
-
getActiveUsers
public Pager<org.gitlab4j.api.models.User> getActiveUsers(int itemsPerPage) throws GitLabApiException
Get a Pager of active users.GitLab Endpoint: GET /users?active=true- Parameters:
itemsPerPage- the number of active User instances that will be fetched per page- Returns:
- a Pager of active User
- Throws:
GitLabApiException- if any exception occurs
-
getActiveUsersStream
public java.util.stream.Stream<org.gitlab4j.api.models.User> getActiveUsersStream() throws GitLabApiExceptionGet a Stream of active usersGitLab Endpoint: GET /users?active=true- Returns:
- a Stream of active Users
- Throws:
GitLabApiException- if any exception occurs
-
approveUser
public void approveUser(java.lang.Long userId) throws GitLabApiExceptionApproves the specified user. Available only for admin.GitLab Endpoint: POST /users/:id/approve- Parameters:
userId- the ID of the user to approve- Throws:
GitLabApiException- if any exception occurs
-
rejectUser
public void rejectUser(java.lang.Long userId) throws GitLabApiExceptionRejects specified user that is pending approval. Available only for administrators.GitLab Endpoint: POST /users/:id/reject- Parameters:
userId- the ID of the user to reject- Throws:
GitLabApiException- if any exception occurs
-
blockUser
public void blockUser(java.lang.Long userId) throws GitLabApiExceptionBlocks the specified user. Available only for admin.GitLab Endpoint: POST /users/:id/block- Parameters:
userId- the ID of the user to block- Throws:
GitLabApiException- if any exception occurs
-
unblockUser
public void unblockUser(java.lang.Long userId) throws GitLabApiExceptionUnblocks the specified user. Available only for admin.GitLab Endpoint: POST /users/:id/unblock- Parameters:
userId- the ID of the user to unblock- Throws:
GitLabApiException- if any exception occurs
-
getBlockedUsers
public java.util.List<org.gitlab4j.api.models.User> getBlockedUsers() throws GitLabApiExceptionGet a list of blocked users.GitLab Endpoint: GET /users?blocked=true- Returns:
- a list of blocked Users
- Throws:
GitLabApiException- if any exception occurs
-
getblockedUsers
public java.util.List<org.gitlab4j.api.models.User> getblockedUsers(int page, int perPage) throws GitLabApiExceptionGet a list of blocked users using the specified page and per page settings.GitLab Endpoint: GET /users?blocked=true- Parameters:
page- the page to getperPage- the number of users per page- Returns:
- the list of blocked Users in the specified range
- Throws:
GitLabApiException- if any exception occurs
-
getBlockedUsers
public Pager<org.gitlab4j.api.models.User> getBlockedUsers(int itemsPerPage) throws GitLabApiException
Get a Pager of blocked users.GitLab Endpoint: GET /users?blocked=true- Parameters:
itemsPerPage- the number of blocked User instances that will be fetched per page- Returns:
- a Pager of blocked User
- Throws:
GitLabApiException- if any exception occurs
-
getBlockedUsersStream
public java.util.stream.Stream<org.gitlab4j.api.models.User> getBlockedUsersStream() throws GitLabApiExceptionGet a Stream of blocked users.GitLab Endpoint: GET /users?blocked=true- Returns:
- a Stream of blocked Users
- Throws:
GitLabApiException- if any exception occurs
-
getUser
public org.gitlab4j.api.models.User getUser(java.lang.Long userId) throws GitLabApiExceptionGet a single user.GitLab Endpoint: GET /users/:id- Parameters:
userId- the ID of the user to get- Returns:
- the User instance for the specified user ID
- Throws:
GitLabApiException- if any exception occurs
-
getOptionalUser
public java.util.Optional<org.gitlab4j.api.models.User> getOptionalUser(java.lang.Long userId)
Get a single user as an Optional instance.GitLab Endpoint: GET /users/:id- Parameters:
userId- the ID of the user to get- Returns:
- the User for the specified user ID as an Optional instance
-
getUser
public org.gitlab4j.api.models.User getUser(java.lang.String username) throws GitLabApiExceptionLookup a user by username. Returns null if not found.NOTE: This is for admin users only.
GitLab Endpoint: GET /users?username=:username- Parameters:
username- the username of the user to get- Returns:
- the User instance for the specified username, or null if not found
- Throws:
GitLabApiException- if any exception occurs
-
getOptionalUser
public java.util.Optional<org.gitlab4j.api.models.User> getOptionalUser(java.lang.String username)
Lookup a user by username and return an Optional instance.NOTE: This is for admin users only.
GitLab Endpoint: GET /users?username=:username- Parameters:
username- the username of the user to get- Returns:
- the User for the specified username as an Optional instance
-
getUserByEmail
public org.gitlab4j.api.models.User getUserByEmail(java.lang.String email) throws GitLabApiExceptionLookup a user by email address. Returns null if not found.GitLab Endpoint: GET /users?search=:email_or_username- Parameters:
email- the email of the user to get- Returns:
- the User instance for the specified email, or null if not found
- Throws:
GitLabApiException- if any exception occursjava.lang.IllegalArgumentException- if email is not valid
-
getOptionalUserByEmail
public java.util.Optional<org.gitlab4j.api.models.User> getOptionalUserByEmail(java.lang.String email)
Lookup a user by email address and returns an Optional with the User instance as the value.GitLab Endpoint: GET /users?search=:email_or_username- Parameters:
email- the email of the user to get- Returns:
- the User for the specified email as an Optional instance
-
getUserByExternalUid
public org.gitlab4j.api.models.User getUserByExternalUid(java.lang.String provider, java.lang.String externalUid) throws GitLabApiExceptionLookup a user by external UID. Returns null if not found.NOTE: This is for admin users only.
GitLab Endpoint: GET /users?extern_uid=:externalUid&provider=:provider- Parameters:
provider- the provider of the external uidexternalUid- the external UID of the user- Returns:
- the User instance for the specified external UID, or null if not found
- Throws:
GitLabApiException- if any exception occurs
-
getOptionalUserByExternalUid
public java.util.Optional<org.gitlab4j.api.models.User> getOptionalUserByExternalUid(java.lang.String provider, java.lang.String externalUid)Lookup a user by external UID and return an Optional instance.NOTE: This is for admin users only.
GitLab Endpoint: GET /users?extern_uid=:externUid&provider=:provider- Parameters:
provider- the provider of the external uidexternalUid- the external UID of the user- Returns:
- the User for the specified external UID as an Optional instance
-
findUsers
public java.util.List<org.gitlab4j.api.models.User> findUsers(java.lang.String emailOrUsername) throws GitLabApiExceptionSearch users by Email or usernameGitLab Endpoint: GET /users?search=:email_or_username- Parameters:
emailOrUsername- the email or username to search for- Returns:
- the User List with the email or username like emailOrUsername
- Throws:
GitLabApiException- if any exception occurs
-
findUsers
public java.util.List<org.gitlab4j.api.models.User> findUsers(java.lang.String emailOrUsername, int page, int perPage) throws GitLabApiExceptionSearch users by Email or username in the specified page range.GitLab Endpoint: GET /users?search=:email_or_username- Parameters:
emailOrUsername- the email or username to search forpage- the page to getperPage- the number of users per page- Returns:
- the User List with the email or username like emailOrUsername in the specified page range
- Throws:
GitLabApiException- if any exception occurs
-
findUsers
public Pager<org.gitlab4j.api.models.User> findUsers(java.lang.String emailOrUsername, int itemsPerPage) throws GitLabApiException
Search users by Email or username and return a PagerGitLab Endpoint: GET /users?search=:email_or_username- Parameters:
emailOrUsername- the email or username to search foritemsPerPage- the number of Project instances that will be fetched per page- Returns:
- the User Pager with the email or username like emailOrUsername
- Throws:
GitLabApiException- if any exception occurs
-
findUsersStream
public java.util.stream.Stream<org.gitlab4j.api.models.User> findUsersStream(java.lang.String emailOrUsername) throws GitLabApiExceptionSearch users by Email or username.GitLab Endpoint: GET /users?search=:email_or_username- Parameters:
emailOrUsername- the email or username to search for- Returns:
- a Stream of User instances with the email or username like emailOrUsername
- Throws:
GitLabApiException- if any exception occurs
-
createUser
@Deprecated public org.gitlab4j.api.models.User createUser(org.gitlab4j.api.models.User user, java.lang.CharSequence password, java.lang.Integer projectsLimit) throws GitLabApiExceptionDeprecated.Will be removed in version 6.0, replaced bycreateUser(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 /usersThe 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- Parameters:
user- the User instance with the user info to createpassword- the password for the new userprojectsLimit- the maximum number of project- Returns:
- created User instance
- Throws:
GitLabApiException- if any exception occurs
-
createUser
public org.gitlab4j.api.models.User createUser(org.gitlab4j.api.models.User user, java.lang.CharSequence password, java.lang.Boolean resetPassword) throws GitLabApiExceptionCreates a new user. Note only administrators can create new users. Either password or resetPassword should be specified (resetPassword takes priority).
GitLab Endpoint: POST /usersThe 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- Parameters:
user- the User instance with the user info to createpassword- the password for the new userresetPassword- whether to send a password reset link- Returns:
- created User instance
- Throws:
GitLabApiException- if any exception occurs
-
updateUser
public org.gitlab4j.api.models.User updateUser(org.gitlab4j.api.models.User user, java.lang.CharSequence password) throws GitLabApiExceptionModifies an existing user. Only administrators can change attributes of a user.
GitLab Endpoint: PUT /usersThe 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- Parameters:
user- the User instance with the user info to modifypassword- the new password for the user- Returns:
- the modified User instance
- Throws:
GitLabApiException- if any exception occurs
-
modifyUser
@Deprecated public org.gitlab4j.api.models.User modifyUser(org.gitlab4j.api.models.User user, java.lang.CharSequence password, java.lang.Integer projectsLimit) throws GitLabApiExceptionDeprecated.Will be removed in version 6.0, replaced byupdateUser(User, CharSequence)Modifies an existing user. Only administrators can change attributes of a user.GitLab Endpoint: PUT /users/:idThe 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- Parameters:
user- the User instance with the user info to modifypassword- the new password for the userprojectsLimit- the maximum number of project- Returns:
- the modified User instance
- Throws:
GitLabApiException- if any exception occurs
-
deleteUser
public void deleteUser(java.lang.Object userIdOrUsername) throws GitLabApiExceptionDeletes a user. Available only for administrators.GitLab Endpoint: DELETE /users/:id- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instance- Throws:
GitLabApiException- if any exception occurs
-
deleteUser
public void deleteUser(java.lang.Object userIdOrUsername, java.lang.Boolean hardDelete) throws GitLabApiExceptionDeletes a user. Available only for administrators.GitLab Endpoint: DELETE /users/:id- Parameters:
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 user- Throws:
GitLabApiException- if any exception occurs
-
getCurrentUser
public org.gitlab4j.api.models.User getCurrentUser() throws GitLabApiExceptionGet currently authenticated user.GitLab Endpoint: GET /user- Returns:
- the User instance for the currently authenticated user
- Throws:
GitLabApiException- if any exception occurs
-
getSshKeys
public java.util.List<org.gitlab4j.api.models.SshKey> getSshKeys() throws GitLabApiExceptionGet a list of currently authenticated user's SSH keys.GitLab Endpoint: GET /user/keys- Returns:
- a list of currently authenticated user's SSH keys
- Throws:
GitLabApiException- if any exception occurs
-
getSshKeys
public java.util.List<org.gitlab4j.api.models.SshKey> getSshKeys(java.lang.Long userId) throws GitLabApiExceptionGet a list of a specified user's SSH keys. Available only for admin users.GitLab Endpoint: GET /users/:id/keys- Parameters:
userId- the user ID to get the SSH keys for- Returns:
- a list of a specified user's SSH keys
- Throws:
GitLabApiException- if any exception occurs
-
getSshKey
public org.gitlab4j.api.models.SshKey getSshKey(java.lang.Long keyId) throws GitLabApiExceptionGet a single SSH Key.GitLab Endpoint: GET /user/keys/:key_id- Parameters:
keyId- the ID of the SSH key.- Returns:
- an SshKey instance holding the info on the SSH key specified by keyId
- Throws:
GitLabApiException- if any exception occurs
-
getOptionalSshKey
public java.util.Optional<org.gitlab4j.api.models.SshKey> getOptionalSshKey(java.lang.Long keyId)
Get a single SSH Key as an Optional instance.GitLab Endpoint: GET /user/keys/:key_id- Parameters:
keyId- the ID of the SSH key- Returns:
- an SshKey as an Optional instance holding the info on the SSH key specified by keyId
-
addSshKey
@Deprecated public org.gitlab4j.api.models.SshKey addSshKey(java.lang.String title, java.lang.String key) throws GitLabApiExceptionDeprecated.useaddSshKey(String, String, Date)insteadCreates a new key owned by the currently authenticated user.GitLab Endpoint: POST /user/keys- Parameters:
title- the new SSH Key's titlekey- the new SSH key- Returns:
- an SshKey instance with info on the added SSH key
- Throws:
GitLabApiException- if any exception occurs
-
addSshKey
public org.gitlab4j.api.models.SshKey addSshKey(java.lang.String title, java.lang.String key, java.util.Date expiresAt) throws GitLabApiExceptionCreates a new key owned by the currently authenticated user.GitLab Endpoint: POST /user/keys- Parameters:
title- the new SSH Key's titlekey- the new SSH keyexpiresAt- the expiration date of the ssh key, optional- Returns:
- an SshKey instance with info on the added SSH key
- Throws:
GitLabApiException- if any exception occurs
-
addSshKey
@Deprecated public org.gitlab4j.api.models.SshKey addSshKey(java.lang.Long userId, java.lang.String title, java.lang.String key) throws GitLabApiExceptionDeprecated.useaddSshKey(Long, String, String, Date)insteadCreate new key owned by specified user. Available only for admin users.GitLab Endpoint: POST /users/:id/keys- Parameters:
userId- the ID of the user to add the SSH key fortitle- the new SSH Key's titlekey- the new SSH key- Returns:
- an SshKey instance with info on the added SSH key
- Throws:
GitLabApiException- if any exception occurs
-
addSshKey
public org.gitlab4j.api.models.SshKey addSshKey(java.lang.Long userId, java.lang.String title, java.lang.String key, java.util.Date expiresAt) throws GitLabApiExceptionCreate new key owned by specified user. Available only for admin users.GitLab Endpoint: POST /users/:id/keys- Parameters:
userId- the ID of the user to add the SSH key fortitle- the new SSH Key's titlekey- the new SSH keyexpiresAt- the expiration date of the ssh key, optional- Returns:
- an SshKey instance with info on the added SSH key
- Throws:
GitLabApiException- if any exception occurs
-
deleteSshKey
public void deleteSshKey(java.lang.Long keyId) throws GitLabApiExceptionDeletes key owned by currently authenticated user. This is an idempotent function and calling it on a key that is already deleted or not available results in success.GitLab Endpoint: DELETE /user/keys/:key_id- Parameters:
keyId- the key ID to delete- Throws:
GitLabApiException- if any exception occurs
-
deleteSshKey
public void deleteSshKey(java.lang.Object userIdOrUsername, java.lang.Long keyId) throws GitLabApiExceptionDeletes key owned by a specified user. Available only for admin users.GitLab Endpoint: DELETE /users/:id/keys/:key_id- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instancekeyId- the key ID to delete- Throws:
GitLabApiException- if any exception occurs
-
getImpersonationTokens
public java.util.List<org.gitlab4j.api.models.ImpersonationToken> getImpersonationTokens(java.lang.Object userIdOrUsername) throws GitLabApiExceptionGet a list of a specified user's impersonation tokens. Available only for admin users.GitLab Endpoint: GET /users/:id/impersonation_tokens- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instance- Returns:
- a list of a specified user's impersonation tokens
- Throws:
GitLabApiException- if any exception occurs
-
getImpersonationTokens
public java.util.List<org.gitlab4j.api.models.ImpersonationToken> getImpersonationTokens(java.lang.Object userIdOrUsername, org.gitlab4j.models.Constants.ImpersonationState state) throws GitLabApiExceptionGet a list of a specified user's impersonation tokens. Available only for admin users.GitLab Endpoint: GET /users/:id/impersonation_tokens- Parameters:
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)- Returns:
- a list of a specified user's impersonation tokens
- Throws:
GitLabApiException- if any exception occurs
-
getImpersonationToken
public org.gitlab4j.api.models.ImpersonationToken getImpersonationToken(java.lang.Object userIdOrUsername, java.lang.Long tokenId) throws GitLabApiExceptionGet an impersonation token of a user. Available only for admin users.GitLab Endpoint: GET /users/:user_id/impersonation_tokens/:impersonation_token_id- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instancetokenId- the impersonation token ID to get- Returns:
- the specified impersonation token
- Throws:
GitLabApiException- if any exception occurs
-
getOptionalImpersonationToken
public java.util.Optional<org.gitlab4j.api.models.ImpersonationToken> getOptionalImpersonationToken(java.lang.Object userIdOrUsername, java.lang.Long tokenId)Get an impersonation token of a user as an Optional instance. Available only for admin users.GitLab Endpoint: GET /users/:user_id/impersonation_tokens/:impersonation_token_id- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instancetokenId- the impersonation token ID to get- Returns:
- the specified impersonation token as an Optional instance
-
createImpersonationToken
public org.gitlab4j.api.models.ImpersonationToken createImpersonationToken(java.lang.Object userIdOrUsername, java.lang.String name, java.util.Date expiresAt, org.gitlab4j.api.models.ImpersonationToken.Scope[] scopes) throws GitLabApiExceptionCreate an impersonation token. Available only for admin users.GitLab Endpoint: POST /users/:user_id/impersonation_tokens- Parameters:
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 token- Returns:
- the created ImpersonationToken instance
- Throws:
GitLabApiException- if any exception occurs
-
revokeImpersonationToken
public void revokeImpersonationToken(java.lang.Object userIdOrUsername, java.lang.Long tokenId) throws GitLabApiExceptionRevokes an impersonation token. Available only for admin users.GitLab Endpoint: DELETE /users/:user_id/impersonation_tokens/:impersonation_token_id- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instancetokenId- the impersonation token ID to revoke- Throws:
GitLabApiException- if any exception occurs
-
createPersonalAccessToken
@Deprecated public org.gitlab4j.api.models.ImpersonationToken createPersonalAccessToken(java.lang.Object userIdOrUsername, java.lang.String name, java.util.Date expiresAt, org.gitlab4j.api.models.ImpersonationToken.Scope[] scopes) throws GitLabApiExceptionDeprecated.Create a personal access token. Available only for admin users.GitLab Endpoint: POST /users/:user_id/personal_access_tokens- Parameters:
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 token- Returns:
- the created PersonalAccessToken instance
- Throws:
GitLabApiException- if any exception occurs
-
createPersonalAccessToken
public org.gitlab4j.api.models.ImpersonationToken createPersonalAccessToken(java.lang.Object userIdOrUsername, java.lang.String name, java.lang.String description, java.util.Date expiresAt, org.gitlab4j.api.models.ImpersonationToken.Scope[] scopes) throws GitLabApiExceptionCreate a personal access token. Available only for admin users.GitLab Endpoint: POST /users/:user_id/personal_access_tokens- Parameters:
userIdOrUsername- the user in the form of an Integer(ID), String(username), or User instancename- the name of the personal access token, requireddescription- description of personal access token, optionalexpiresAt- the expiration date of the personal access token, optionalscopes- an array of scopes of the personal access token- Returns:
- the created PersonalAccessToken instance
- Throws:
GitLabApiException- if any exception occurs
-
createPersonalAccessToken
public org.gitlab4j.api.models.ImpersonationToken createPersonalAccessToken(java.lang.String name, java.lang.String description, java.util.Date expiresAt, org.gitlab4j.api.models.ImpersonationToken.Scope[] scopes) throws GitLabApiExceptionCreate a personal access token for your account.GitLab Endpoint: POST /user/personal_access_tokens- Parameters:
name- the name of the personal access token, requireddescription- description of personal access token, optionalexpiresAt- the expiration date of the personal access token, optionalscopes- an array of scopes of the personal access token. Only accepts k8s_proxy.- Returns:
- the created PersonalAccessToken instance
- Throws:
GitLabApiException- if any exception occurs
-
revokePersonalAccessToken
public void revokePersonalAccessToken(java.lang.Long tokenId) throws GitLabApiExceptionRevokes a personal access token. Available only for admin users.GitLab Endpoint: DELETE /personal_access_tokens/:token_id- Parameters:
tokenId- the personal access token ID to revoke- Throws:
GitLabApiException- if any exception occurs
-
createCustomAttribute
public org.gitlab4j.api.models.CustomAttribute createCustomAttribute(java.lang.Object userIdOrUsername, org.gitlab4j.api.models.CustomAttribute customAttribute) throws GitLabApiExceptionCreates custom attribute for the given user- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instancecustomAttribute- the custom attribute to set- Returns:
- the created CustomAttribute
- Throws:
GitLabApiException- on failure while setting customAttributes
-
createCustomAttribute
public org.gitlab4j.api.models.CustomAttribute createCustomAttribute(java.lang.Object userIdOrUsername, java.lang.String key, java.lang.String value) throws GitLabApiExceptionCreates custom attribute for the given user- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instancekey- for the customAttributevalue- or the customAttribute- Returns:
- the created CustomAttribute
- Throws:
GitLabApiException- on failure while setting customAttributes
-
changeCustomAttribute
public org.gitlab4j.api.models.CustomAttribute changeCustomAttribute(java.lang.Object userIdOrUsername, org.gitlab4j.api.models.CustomAttribute customAttribute) throws GitLabApiExceptionChange custom attribute for the given user- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instancecustomAttribute- the custome attribute to change- Returns:
- the changed CustomAttribute
- Throws:
GitLabApiException- on failure while changing customAttributes
-
changeCustomAttribute
public org.gitlab4j.api.models.CustomAttribute changeCustomAttribute(java.lang.Object userIdOrUsername, java.lang.String key, java.lang.String value) throws GitLabApiExceptionChanges custom attribute for the given user- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instancekey- for the customAttributevalue- for the customAttribute- Returns:
- changedCustomAttribute
- Throws:
GitLabApiException- on failure while changing customAttributes
-
deleteCustomAttribute
public void deleteCustomAttribute(java.lang.Object userIdOrUsername, org.gitlab4j.api.models.CustomAttribute customAttribute) throws GitLabApiExceptionDelete a custom attribute for the given user- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instancecustomAttribute- to remove- Throws:
GitLabApiException- on failure while deleting customAttributes
-
deleteCustomAttribute
public void deleteCustomAttribute(java.lang.Object userIdOrUsername, java.lang.String key) throws GitLabApiExceptionDelete a custom attribute for the given user- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instancekey- of the customAttribute to remove- Throws:
GitLabApiException- on failure while deleting customAttributes
-
setUserAvatar
public org.gitlab4j.api.models.User setUserAvatar(java.lang.Object userIdOrUsername, java.io.File avatarFile) throws GitLabApiExceptionUploads and sets the user's avatar for the specified user.PUT /users/:id- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instanceavatarFile- the File instance of the avatar file to upload- Returns:
- the updated User instance
- Throws:
GitLabApiException- if any exception occurs
-
getEmails
public java.util.List<org.gitlab4j.api.models.Email> getEmails() throws GitLabApiExceptionGet a list of emails for the current user.GitLab Endpoint: GET /users/emails- Returns:
- a List of Email instances for the current user
- Throws:
GitLabApiException- if any exception occurs
-
getEmails
public java.util.List<org.gitlab4j.api.models.Email> getEmails(java.lang.Object userIdOrUsername) throws GitLabApiExceptionGet a list of a specified user’s emails. Available only for admin users.GitLab Endpoint: GET /user/:id/emails- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instance- Returns:
- a List of Email instances for the specified user
- Throws:
GitLabApiException- if any exception occurs
-
addEmail
public org.gitlab4j.api.models.Email addEmail(java.lang.String email) throws GitLabApiExceptionAdd an email to the current user's emails.GitLab Endpoint: POST /user/:id/emails- Parameters:
email- the email address to add- Returns:
- the Email instance for the added email
- Throws:
GitLabApiException- if any exception occurs
-
getEmail
public org.gitlab4j.api.models.Email getEmail(java.lang.Long emailId) throws GitLabApiExceptionGet a single Email instance specified by he email IDGitLab Endpoint: GET /user/emails/:emailId- Parameters:
emailId- the email ID to get- Returns:
- the Email instance for the provided email ID
- Throws:
GitLabApiException- if any exception occurs
-
addEmail
public org.gitlab4j.api.models.Email addEmail(java.lang.Object userIdOrUsername, java.lang.String email, java.lang.Boolean skipConfirmation) throws GitLabApiExceptionAdd an email to the user's emails.GitLab Endpoint: POST /user/:id/emails- Parameters:
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)- Returns:
- the Email instance for the added email
- Throws:
GitLabApiException- if any exception occurs
-
deleteEmail
public void deleteEmail(java.lang.Long emailId) throws GitLabApiExceptionDeletes an email belonging to the current user.GitLab Endpoint: DELETE /user/emails/:emailId- Parameters:
emailId- the email ID to delete- Throws:
GitLabApiException- if any exception occurs
-
deleteEmail
public void deleteEmail(java.lang.Object userIdOrUsername, java.lang.Long emailId) throws GitLabApiExceptionDeletes a user's emailGitLab Endpoint: DELETE /user/:id/emails/:emailId- Parameters:
userIdOrUsername- the user in the form of an Long(ID), String(username), or User instanceemailId- the email ID to delete- Throws:
GitLabApiException- if any exception occurs
-
listGpgKeys
public java.util.List<org.gitlab4j.api.models.GpgKey> listGpgKeys() throws GitLabApiExceptionGet all GPG keys for the current user.GitLab Endpoint: GET /user/gpg_keys- Throws:
GitLabApiException- if any exception occurs
-
addGpgKey
public org.gitlab4j.api.models.GpgKey addGpgKey(java.lang.String key) throws GitLabApiExceptionAdd a GPG key for the current userGitLab Endpoint: POST /user/gpg_keys- Parameters:
key- the ASCII-armored exported public GPG key to add- Throws:
GitLabApiException- if any exception occurs
-
deleteGpgKey
public void deleteGpgKey(java.lang.Long keyId) throws GitLabApiExceptionRemove a specific GPG key for the current userGitLab Endpoint: DELETE /user/gpg_keys/:keyId- Parameters:
keyId- the key ID in the form if an Long(ID)- Throws:
GitLabApiException- if any exception occurs
-
listGpgKeys
public java.util.List<org.gitlab4j.api.models.GpgKey> listGpgKeys(java.lang.Long userId) throws GitLabApiExceptionGet all GPG keys for a given user.GitLab Endpoint: GET /users/:id/gpg_keys- Parameters:
userId- the user in the form of an Long(ID)- Throws:
GitLabApiException- if any exception occurs
-
addGpgKey
public org.gitlab4j.api.models.GpgKey addGpgKey(java.lang.Long userId, java.lang.String key) throws GitLabApiExceptionAdd a GPG key for a specific userGitLab Endpoint: POST /users/:id/gpg_keys- Parameters:
userId- the user in the form of an Long(ID)key- the ASCII-armored exported public GPG key to add- Throws:
GitLabApiException- if any exception occurs
-
deleteGpgKey
public void deleteGpgKey(java.lang.Long userId, java.lang.Long keyId) throws GitLabApiExceptionRemove a specific GPG key for a specific userGitLab Endpoint: DELETE /users/:id/gpg_keys/:keyId- Parameters:
userId- the user in the form of an Long(ID)keyId- the key ID in the form if an Long(ID)- Throws:
GitLabApiException- if any exception occurs
-
getMemberships
public java.util.List<org.gitlab4j.api.models.Membership> getMemberships(java.lang.Long userId) throws GitLabApiExceptionLists all projects and groups a user is a member of. (admin only)GitLab Endpoint: GET /users/:id/memberships- Parameters:
userId- the ID of the user to get the memberships for- Returns:
- the list of memberships of the given user
- Throws:
GitLabApiException- if any exception occurs- Since:
- GitLab 12.8
-
getMemberships
public Pager<org.gitlab4j.api.models.Membership> getMemberships(java.lang.Long userId, int itemsPerPage) throws GitLabApiException
Returns a Pager that lists all projects and groups a user is a member of. (admin only) This allows lazy-fetching of huge numbers of memberships.GitLab Endpoint: GET /users/:id/memberships- Parameters:
userId- the ID of the user to get the memberships foritemsPerPage- the number of Membership instances that will be fetched per page- Returns:
- a Pager of user's memberships
- Throws:
GitLabApiException- if any exception occurs- Since:
- GitLab 12.8
-
getAssociationsCount
public org.gitlab4j.api.models.Associations getAssociationsCount(java.lang.Long userId) throws GitLabApiExceptionGet a count of a user’s projects, groups, issues, and merge requestsGitLab Endpoint: GET /user/:id/associations_count- Parameters:
userId- the ID of the user to get the associations for- Returns:
- the count of each type of association
- Throws:
GitLabApiException- if any exception occurs
-
activateUser
public void activateUser(java.lang.Long userId) throws GitLabApiExceptionActivates the given user (admin only)GitLab Endpoint: POST /users/:id/activate- Parameters:
userId- the ID of the user to activate- Throws:
GitLabApiException- if any exception occurs.- Since:
- GitLab 12.4
-
deactivateUser
public void deactivateUser(java.lang.Long userId) throws GitLabApiExceptionDeactivates the given user (admin only)GitLab Endpoint: POST /users/:id/deactivate- Parameters:
userId- the ID of the user to deactivate- Throws:
GitLabApiException- if any exception occurs.- Since:
- GitLab 12.4
-
exists
public boolean exists(java.lang.String username) throws GitLabApiExceptionCheck if the given user exists.GitLab Endpoint: POST /users/:username/exists- Parameters:
username- the name of the user to check- Throws:
GitLabApiException- if any exception occurs.
-
createRunner
public org.gitlab4j.api.models.CreateRunnerResponse createRunner(org.gitlab4j.api.models.CreateRunnerParams params) throws GitLabApiExceptionCreate a runner linked to the current user.GitLab Endpoint: POST /user/runners- Parameters:
params- a CreateRunnerParams instance holding the parameters for the runner creation- Returns:
- creation response, be sure to copy or save the token in the response, the value cannot be retrieved again.
- Throws:
GitLabApiException
-
-