Interface UserApi

  • All Known Implementing Classes:
    MattermostClient

    public interface UserApi
    User API.
    Author:
    Takayuki Maruyama
    • Method Detail

      • createUser

        ApiResponse<User> createUser​(User user)
        creates a user in the system based on the provided user object.
      • getUser

        default ApiResponse<User> getUser​(String userId)
        returns a user based on the provided user id string.
      • getUserByUsername

        default ApiResponse<User> getUserByUsername​(String username)
        returns a user based pn the provided user name string.
      • getUserByUsername

        ApiResponse<User> getUserByUsername​(String username,
                                            String etag)
        returns a user based pn the provided user name string.
      • getUserByEmail

        default ApiResponse<User> getUserByEmail​(String email)
        returns a user based on the provided user email string.
      • getUserByEmail

        ApiResponse<User> getUserByEmail​(String email,
                                         String etag)
        returns a user based on the provided user email string.
      • getProfileImage

        default ApiResponse<byte[]> getProfileImage​(String userId)
        gets user's profile image. Must be logged in or be a system administrator.
      • getProfileImage

        ApiResponse<byte[]> getProfileImage​(String userId,
                                            String etag)
        gets user's profile image. Must be logged in or be a system administrator.
      • getUsers

        default ApiResponse<UserList> getUsers()
        returns a page of users on the system. Page counting starts at 0.
      • getUsers

        default ApiResponse<UserList> getUsers​(Pager pager)
        returns a page of users on the system. Page counting starts at 0.
      • getUsersInTeam

        default ApiResponse<UserList> getUsersInTeam​(String teamId)
        returns a page of users on a team. Page counting starts at 0.
      • getUsersInTeam

        default ApiResponse<UserList> getUsersInTeam​(String teamId,
                                                     Pager pager)
        returns a page of users on a team. Page counting starts at 0.
      • getUsersNotInTeam

        default ApiResponse<UserList> getUsersNotInTeam​(String teamId)
        returns a page of users who are not in a team. Page counting starts at 0.
      • getUsersNotInTeam

        default ApiResponse<UserList> getUsersNotInTeam​(String teamId,
                                                        Pager pager)
        returns a page of users who are not in a team. Page counting starts at 0.
      • getUsersNotInTeam

        ApiResponse<UserList> getUsersNotInTeam​(String teamId,
                                                Pager pager,
                                                String etag)
        returns a page of users who are not in a team. Page counting starts at 0.
      • getUsersInChannel

        default ApiResponse<UserList> getUsersInChannel​(String channelId)
        returns a page of users on a team. Page counting starts at 0.
      • getUsersInChannel

        default ApiResponse<UserList> getUsersInChannel​(String channelId,
                                                        Pager pager)
        returns a page of users on a team. Page counting starts at 0.
      • getUsersInChannel

        default ApiResponse<UserList> getUsersInChannel​(String channelId,
                                                        Pager pager,
                                                        String etag)
        returns a page of users on a team. Page counting starts at 0.
      • getUsersNotInChannel

        default ApiResponse<UserList> getUsersNotInChannel​(String teamId,
                                                           String channelId)
        returns a page of users on a team. Page counting starts at 0.
      • getUsersNotInChannel

        default ApiResponse<UserList> getUsersNotInChannel​(String teamId,
                                                           String channelId,
                                                           Pager pager)
        returns a page of users on a team. Page counting starts at 0.
      • getUsersWithoutTeam

        default ApiResponse<UserList> getUsersWithoutTeam()
        returns a page of users on the system that aren't on any teams. Page counting starts at 0.
      • getUsersWithoutTeam

        default ApiResponse<UserList> getUsersWithoutTeam​(Pager pager)
        returns a page of users on the system that aren't on any teams. Page counting starts at 0.
      • getUsersWithoutTeam

        ApiResponse<UserList> getUsersWithoutTeam​(Pager pager,
                                                  String etag)
        returns a page of users on the system that aren't on any teams. Page counting starts at 0.
      • getUsersByIds

        ApiResponse<UserList> getUsersByIds​(String... userIds)
        returns a list of users based on the provided user ids.
      • getUsersByUsernames

        ApiResponse<UserList> getUsersByUsernames​(String... usernames)
        returns a list of users based on the provided usernames.
      • updateUser

        ApiResponse<User> updateUser​(User user)
        updates a user in the system based on the provided user object.
      • patchUser

        ApiResponse<User> patchUser​(String userId,
                                    UserPatch patch)
        partially updates a user in the system. Any missing fields are not updated.
      • updateUserMfa

        ApiResponse<Boolean> updateUserMfa​(String userId,
                                           String code,
                                           boolean activate)
        activates multi-factor authentication for a user if activate is true and a valid code is provided. If activate is false, then code is not required and multi-factor authentication is disabled for the user.
      • checkUserMfa

        @Deprecated
        boolean checkUserMfa​(String loginId)
        Deprecated.
        Legacy MFA is no longer supported by Mattermost Server 6.x or later.
        checks whether a user has MFA active on their account or not based on the provided login id.
      • generateMfaSecret

        ApiResponse<MfaSecret> generateMfaSecret​(String userId)
        will generate a new MFA secret for a user and return it as a string and as a base64 encoded image QR code.
      • updateUserPassword

        ApiResponse<Boolean> updateUserPassword​(String userId,
                                                String currentPassword,
                                                String newPassword)
        updates a user's password. Must be logged in as the user or be a system administrator.
      • updateUserRoles

        default ApiResponse<Boolean> updateUserRoles​(String userId,
                                                     Collection<Role> roles)
        updates a user's roles in the system. A user can have "system_user" and "system_admin" roles.
      • updateUserRoles

        ApiResponse<Boolean> updateUserRoles​(String userId,
                                             Role... roles)
        updates a user's roles in the system. A user can have "system_user" and "system_admin" roles.
      • updateUserActive

        ApiResponse<Boolean> updateUserActive​(String userId,
                                              boolean active)
        updates status of a user whether active or not.
      • deleteUser

        ApiResponse<Boolean> deleteUser​(String userId)
        deactivates a user in the system based on the provided user id string.
      • sendPasswordResetEmail

        ApiResponse<Boolean> sendPasswordResetEmail​(String email)
        will send a link for password resetting to a user with the provided email.
      • getSessions

        default ApiResponse<SessionList> getSessions​(String userId)
        returns a list of sessions based on the provided user id string.
      • revokeSession

        default ApiResponse<Boolean> revokeSession​(Session session)
        revokes a user session based on the provided user id and session id strings.
      • revokeSession

        ApiResponse<Boolean> revokeSession​(String userId,
                                           String sessionId)
        revokes a user session based on the provided user id and session id strings.
      • attachDeviceId

        ApiResponse<Boolean> attachDeviceId​(String deviceId)
        attaches a mobile device ID to the current session.
      • getTeamUnreadForUser

        default ApiResponse<TeamUnreadList> getTeamUnreadForUser​(String userId)
        will return a list with TeamUnread objects that contain the amount of unread messages and mentions the current user has for the teams it belongs to. An optional team ID can be set to exclude that team from the results. Must be authenticated.
      • getTeamUnreadForUser

        ApiResponse<TeamUnreadList> getTeamUnreadForUser​(String userId,
                                                         String teamIdToExclude)
        will return a list with TeamUnread objects that contain the amount of unread messages and mentions the current user has for the teams it belongs to. An optional team ID can be set to exclude that team from the results. Must be authenticated.
      • getUserAudits

        default ApiResponse<Audits> getUserAudits​(String userId)
        returns a list of audit based on the provided user id string.
      • getUserAudits

        default ApiResponse<Audits> getUserAudits​(String userId,
                                                  Pager pager)
        returns a list of audit based on the provided user id string.
      • verifyUserEmail

        ApiResponse<Boolean> verifyUserEmail​(String token)
        will verify a user's email using the supplied token.
      • sendVerificationEmail

        ApiResponse<Boolean> sendVerificationEmail​(String email)
        will send an email to the user with the provided email addresses, if that user exists. The email will contain a link that can be used to verify the user's email address.