UsersEndpointGroup

public class UsersEndpointGroup : EndpointGroup

This EndpointGroup communicates with Users API

  • Gets users

    Declaration

    Swift

    public func getUsers(perPage: Int = RxGitLabAPIClient.defaultPerPage, parameters: QueryParameters? = nil) -> Paginator<User>

    Parameters

    perPage

    number of users per page - default: 20

    parameters

    Query Parameters - See description Optinal Query Parameters:

    Return Value

    A Paginator of User

  • Get a single user.

    • Query Parameters:
      • Optional:
      • password: String - Password
      • reset_password: Bool - Send user password reset link - true or false(default)
      • skype: String - Skype ID
      • linkedin: String - LinkedIn
      • twitter: String - Twitter account
      • website_url: String - Website URL
      • organization: String - Organization name
      • projects_limit: Int - Number of projects user can create
      • extern_uid: Int - External UID
      • provider: String - External provider name
      • bio: String - User’s biography
      • location: String - User’s location
      • public_email: String - The public email of the user
      • admin: String - User is admin - true or false (default)
      • can_create_group: Bool - User can create groups - true or false
      • skip_confirmation: Bool - Skip confirmation - true or false (default)
      • external: Bool - Flags the user as external - true or false(default)
      • avatar: String - Image file for user’s avatar
      • private_profile: Bool - User’s profile is private - true or false

    Declaration

    Swift

    public func getUser(userID: Int, parameters: QueryParameters? = nil) -> Observable<User?>

    Parameters

    parameters

    Query Parameters - See description

    Return Value

    returns and observable of User?

  • User creation

    Creates a new user. Note only administrators can create new users. Either password or reset_password should be specified (reset_password takes priority). If reset_password is false, then password is required.

    Declaration

    Swift

    public func postUser(user: User) -> Observable<User>

    Parameters

    user

    The user to be created

    Return Value

    An observable of created User

  • Modifies an existing user. Only administrators can change attributes of a user.

    • Query Parameters:
      • email: String - Email
      • username: String - Username
      • name: String - Name
      • password: String - Password
      • skype: String - Skype ID
      • linkedin: String - LinkedIn
      • twitter: String - Twitter account
      • website_url: String - Website URL
      • organization: String - Organization name
      • projects_limit: String - Limit projects each user can create
      • extern_uid: Int - External UID
      • provider: String - External provider name
      • bio: String - User’s biography
      • location: String - User’s location
      • public_email: String - The public email of the user
      • admin: String - User is admin - true or false (default)
      • can_create_group: Bool - User can create groups - true or false
      • skip_reconfirmation: Bool - Skip reconfirmation - true or false (default)
      • external: Bool - Flags the user as external - true or false(default)
      • avatar: String - Image file for user’s avatar
      • private_profile: String - User’s profile is private - true or false

    Declaration

    Swift

    public func putUser(userID: Int, parameters: QueryParameters? = nil) -> Observable<User>

    Parameters

    parameters

    Query Parameters [String: Any]

    Return Value

    returns and observable of User?

  • Deletes a user. Available only for administrators. This returns a 204 No Content status code if the operation was successfully or 404 if the resource was not found.

    • Query Parameters:
      • email: String - Email
      • username: String - Username

    Declaration

    Swift

    public func deleteUser(userID: Int, parameters: QueryParameters? = nil) -> Observable<Bool>

    Parameters

    parameters

    Query Parameters [String: Any]

    Return Value

    An Observable of boolean whether the deletion was successful

  • Gets currently authenticated user.

    Declaration

    Swift

    public func getCurrentUser() -> Observable<User?>

    Return Value

    An Observable of a User

  • User status

    Get the status of the currently signed in user.

    Declaration

    Swift

    public func getStatus() -> Observable<UserStatus>

    Return Value

    An Observable of a UserStatus

  • Get the status of a user

    Declaration

    Swift

    public func getUsersStatus(userID: Int) -> Observable<UserStatus>

    Parameters

    userID

    The id of the user to get a status of

    Return Value

    An Observable of a UserStatus

  • Get the status of a user

    Declaration

    Swift

    public func getUsersStatus(username: String) -> Observable<UserStatus>

    Parameters

    username

    The username of the user to get a status of

    Return Value

    An Observable of a UserStatus

  • Set user status

    Set the status of the current user.

    Declaration

    Swift

    public func putStatus(status: UserStatus) -> Observable<UserStatus>

    Parameters

    status

    UserStatus

    Return Value

    An Observable of a UserStatus

  • List SSH keys

    Get a list of currently authenticated user’s SSH keys.

    Declaration

    Swift

    public func getSSHKeys() -> Observable<[UserKey]>

    Return Value

    An Observable of a list of UserKey

  • List SSH keys for user

    Get a list of a specified user’s SSH keys.

    Declaration

    Swift

    public func getUsersSSHKeys(userID: Int) -> Observable<[UserKey]>

    Parameters

    userID

    id of specified user

    Return Value

    An Observable of a list of UserKey

  • Single SSH key

    Get a single key.

    Declaration

    Swift

    public func getSSHKey(keyID: Int) -> Observable<UserKey>

    Parameters

    keyID

    The ID of an SSH key

    Return Value

    An Observable of a UserKey

  • Add SSH key

    Creates a new key owned by the currently authenticated user.

    Declaration

    Swift

    public func postSSHKey(key: UserKey) -> Observable<UserKey>

    Parameters

    key

    UserKey (title and key is required)

    Return Value

    An Observable of a UserKey

  • Add SSH key

    Creates a new key owned by the currently authenticated user.

    Declaration

    Swift

    public func postSSHKeyForUser(key: UserKey, userID: Int) -> Observable<UserKey>

    Parameters

    key

    UserKey (title and key is required)

    Return Value

    An Observable of a UserKey

  • Delete SSH key for current user

    Deletes key owned by currently authenticated user. This returns a 204 No Content status code if the operation was successfully or 404 if the resource was not found.

    Declaration

    Swift

    public func deleteSSHKey(keyID: Int) -> Observable<Bool>

    Parameters

    keyID

    SSH key ID

    Return Value

    An Observable of a Bool - true if the deletion was successful

  • Delete SSH key for given user

    Deletes key owned by a specified user. Available only for admin.

    Declaration

    Swift

    public func deleteUsersSSHKey(userID: Int, keyID: Int, parameters: QueryParameters? = nil) -> Observable<Bool>

    Parameters

    userID

    id of specified user

    keyID

    SSH key ID

    Return Value

    An Observable of a UserKey

  • List all GPG keys

    Get a list of currently authenticated user’s GPG keys.

    Declaration

    Swift

    public func getGPGKeys() -> Observable<[UserKey]>

    Return Value

    An Observable of a list of UserKey

  • Get a specific GPG key

    Get a specific GPG key of currently authenticated user.

    Declaration

    Swift

    public func getGPGKey(keyID: Int) -> Observable<UserKey>

    Parameters

    keyID

    The ID of the GPG key

    Return Value

    An Observable of a UserKey

  • Add a GPG key

    Creates a new GPG key owned by the currently authenticated user.

    Declaration

    Swift

    public func postGPGKey(key: UserKey) -> Observable<UserKey>

    Parameters

    key

    UserKey (key is required)

    Return Value

    An Observable of a UserKey

  • Delete a GPG key

    Delete a GPG key owned by currently authenticated user.

    Declaration

    Swift

    public func deleteGPGKey(keyID: Int) -> Observable<Bool>

    Parameters

    keyID

    The ID of the GPG key

    Return Value

    An Observable of a Bool - true if the deletion was successful

  • List all GPG keys for given user

    Get a list of a specified user’s GPG keys. Available only for admins.

    Declaration

    Swift

    public func getUsersGPGKeys(userID: Int) -> Observable<[UserKey]>

    Parameters

    userID

    The ID of the user

    Return Value

    An Observable of a UserKey

  • Get a specific GPG key for a given user

    Get a specific GPG key for a given user. Available only for admins.

    Declaration

    Swift

    public func getGPGKeyForUser(userID: Int, keyID: Int) -> Observable<UserKey>

    Parameters

    userID

    The ID of the user

    keyID

    The ID of the GPG key

    Return Value

    An Observable of a UserKey

  • Add a GPG key for a given user

    Create new GPG key owned by the specified user. Available only for admins.

    Declaration

    Swift

    public func postUserGPGKey(key: UserKey, userID: Int) -> Observable<UserKey>

    Parameters

    key

    UserKey (key is required)

    userID

    The ID of the user

    Return Value

    An Observable of a UserKey

  • Delete a GPG key for a given user

    Delete a GPG key owned by a specified user. Available only for admins.

    Declaration

    Swift

    public func deleteUsersGPGKey(userID: Int, keyID: Int) -> Observable<Bool>

    Parameters

    keyID

    The ID of the GPG key

    userID

    The ID of the user

    Return Value

    An Observable of a Bool - true if the deletion was successful

  • List emails

    Get a list of currently authenticated user’s emails.

    Declaration

    Swift

    public func getEmails() -> Observable<[Email]>

    Return Value

    An Observable of a list of Email

  • List emails for user

    Get a list of a specified user’s emails. Available only for admin

    Declaration

    Swift

    public func getUserEmails(userID: Int) -> Observable<[Email]>

    Return Value

    An Observable of a list of Email

  • Single email

    Get a single email.

    Declaration

    Swift

    public func getEmail(emailID: Int) -> Observable<Email>

    Return Value

    An Observable of a Email

  • Add email

    Creates a new email owned by the currently authenticated user.

    Declaration

    Swift

    public func postEmail(email: Email) -> Observable<Email>

    Return Value

    An Observable of a Email

  • Delete email for current user

    Deletes email owned by currently authenticated user.

    Declaration

    Swift

    public func deleteEmail(emailID: Int) -> Observable<Bool>

    Return Value

    An Observable of a Bool - true if the deletion was successful

  • Add email for user

    Create new email owned by specified user. Available only for admin

    Declaration

    Swift

    public func postUsersEmail(email: Email, userID: Int) -> Observable<Email>

    Parameters

    userID

    The ID of the user

    Return Value

    An Observable of a UserKey

  • Delete email for given user

    Deletes email owned by a specified user. Available only for admin.

    Declaration

    Swift

    public func deleteUsersEmail(userID: Int, emailID: Int) -> Observable<Bool>

    Parameters

    userID

    The ID of the user

    emailID

    The ID of the email

    Return Value

    An Observable of a Bool - true if the deletion was successful

  • Block user

    Blocks the specified user. Available only for admin.

    Declaration

    Swift

    public func blockUser(userID: Int) -> Observable<Bool>

    Parameters

    userID

    The ID of the user

    Return Value

    An Observable of a Bool - true if blocking was successful

  • Unblock user

    Unlocks the specified user. Available only for admin.

    Declaration

    Swift

    public func unBlockUser(userID: Int) -> Observable<Bool>

    Parameters

    userID

    The ID of the user

    Return Value

    An Observable of a Bool - true if unblocking was successful

  • Get all impersonation tokens of a user

    Requires admin permissions.

    It retrieves every impersonation token of the user. Use the pagination parameters page and per_page to restrict the list of impersonation tokens.

    Optinal Query Parameters:

    • state: String - filter tokens based on state (all, active, inactive)

    Declaration

    Swift

    public func getImpersonationTokens(userID: Int, parameters: QueryParameters?) -> Observable<[ImpersonationToken]>

    Parameters

    userID

    The ID of the user

    parameters

    Query Parameters - See description

    Return Value

    An Observable of a list of ImpersonationToken

  • Get an impersonation token of a user

    Requires admin permissions.

    It shows a user’s impersonation token.

    Declaration

    Swift

    public func getUsersImpersonationToken(userID: Int, tokenID: Int) -> Observable<[ImpersonationToken]>

    Parameters

    userID

    The ID of the user

    tokenID

    The ID of the impersonation token

    Return Value

    An Observable of a UserKey

  • Create an impersonation token

    Requires admin permissions.

    Token values are returned once. Make sure you save it - you won’t be able to access it again.

    It creates a new impersonation token. Note that only administrators can do this. You are only able to create impersonation tokens to impersonate the user and perform both API calls and Git reads and writes. The user will not see these tokens in their profile settings page.

    Declaration

    Swift

    public func postImpersonationToken(token: ImpersonationToken, userID: Int) -> Observable<ImpersonationToken>

    Parameters

    userID

    The ID of the user

    Return Value

    An Observable of a UserKey

  • Revoke an impersonation token

    Requires admin permissions.

    It revokes an impersonation token.

    Declaration

    Swift

    public func deleteImpersonationToken(userID: Int, tokenID: Int) -> Observable<Bool>

    Parameters

    userID

    The ID of the user

    tokenID

    The ID of the impersonation token

    Return Value

    An Observable of a Bool - true if the deletion was successful

  • Get user activities (admin only)

    Note: This API endpoint is only available on 8.15 (EE) and 9.1 (CE) and above.

    Get the last activity date for all users, sorted from oldest to newest.

    The activities that update the timestamp are:

    • Git HTTP/SSH activities (such as clone, push)
    • User logging in into GitLab

    By default, it shows the activity for all users in the last 6 months, but this can be amended by using the from parameter.

    Declaration

    Swift

    public func getUserActivities(from: Date? = nil) -> Observable<[Activity]>

    Parameters

    userID

    The ID of the user

    tokenID

    The ID of the impersonation token

    Return Value

    An Observable of a list of Activity