Package com.io7m.idstore.database.api

# Interface IdDatabaseUsersQueriesType

All Superinterfaces:
  `IdDatabaseQueriesType`

public non-sealed interface IdDatabaseUsersQueriesType extends IdDatabaseQueriesType
The database queries involving users.

- ## Field Summary

  ### Fields inherited from interface com.io7m.idstore.database.api.IdDatabaseQueriesType

  `EARLIEST`

- ## Method Summary

  Modifier and Type
  Method
  Description
  `void`
  `userBanCreate(IdBan ban)`
  Create a ban on the given user account.
  `void`
  `userBanDelete(IdBan ban)`
  Delete the given ban.
  `Optional<IdBan>`
  `userBanGet(UUID id)`
  Get the ban for the given user, if one exists.
  `default IdUser`
  `userCreate(IdName idName, IdRealName realName, IdEmail email, IdPassword password)`
  Create a user.
  `IdUser`
  `userCreate(UUID id, IdName idName, IdRealName realName, IdEmail email, OffsetDateTime created, IdPassword password)`
  Create a user.
  `void`
  `userDelete(UUID id)`
  Delete the given user.
  `void`
  `userEmailAdd(UUID id, IdEmail email)`
  Add an email address to the given user.
  `void`
  `userEmailRemove(UUID id, IdEmail email)`
  Remove an email address from the given user.
  `Optional<IdUser>`
  `userGet(UUID id)`
  `Optional<IdUser>`
  `userGetForEmail(IdEmail email)`
  `IdUser`
  `userGetForEmailRequire(IdEmail email)`
  `Optional<IdUser>`
  `userGetForName(IdName name)`
  `IdUser`
  `userGetForNameRequire(IdName name)`
  `IdUser`
  `userGetRequire(UUID id)`
  `void`
  `userLogin(UUID id, Map<String,String> metadata, int limitHistory)`
  Record the fact that the given user has logged in.
  `List<IdLogin>`
  `userLoginHistory(UUID id, int limit)`
  Obtain the login history of the given user.
  `void`
  `userPasswordResetCreate(IdUserPasswordReset reset)`
  Create a password reset request.
  `void`
  `userPasswordResetDelete(IdUserPasswordReset reset)`
  Delete a password reset request.
  `List<IdUserPasswordReset>`
  `userPasswordResetGet(UUID user)`
  List the password reset requests for the given user.
  `Optional<IdUserPasswordReset>`
  `userPasswordResetGetForToken(IdToken token)`
  List the password reset request for the given token.
  `IdDatabaseUserSearchType`
  `userSearch(IdUserSearchParameters parameters)`
  List users.
  `IdDatabaseUserSearchByEmailType`
  `userSearchByEmail(IdUserSearchByEmailParameters parameters)`
  List users.
  `void`
  `userUpdate(UUID id, Optional<IdName> withIdName, Optional<IdRealName> withRealName, Optional<IdPassword> withPassword)`
  Update the given user.
  `void`
  `userUpdateAsAdmin(UUID id, Optional<IdName> withIdName, Optional<IdRealName> withRealName, Optional<IdPassword> withPassword)`
  Update the given user as an admin.

- ## Method Details

  - ### userCreate

    @IdDatabaseRequiresUser default IdUser userCreate(IdName idName, IdRealName realName, IdEmail email, IdPassword password) throws IdDatabaseException
    Create a user.
    Parameters:
      `idName` - The ID name
      `realName` - The real name
      `email` - The user email
      `password` - The hashed password
    Returns:
      The created user
    Throws:
      `IdDatabaseException` - On errors

  - ### userCreate

    @IdDatabaseRequiresAdmin IdUser userCreate(UUID id, IdName idName, IdRealName realName, IdEmail email, OffsetDateTime created, IdPassword password) throws IdDatabaseException
    Create a user.
    Parameters:
      `id` - The user ID
      `idName` - The ID name
      `created` - The creation time
      `realName` - The real name
      `email` - The user email
      `password` - The hashed password
    Returns:
      The created user
    Throws:
      `IdDatabaseException` - On errors

  - ### userGet

    Optional<IdUser> userGet(UUID id) throws IdDatabaseException
    Parameters:
      `id` - The user ID
    Returns:
      A user with the given ID
    Throws:
      `IdDatabaseException` - On errors

  - ### userGetRequire

    IdUser userGetRequire(UUID id) throws IdDatabaseException
    Parameters:
      `id` - The user ID
    Returns:
      A user with the given ID
    Throws:
      `IdDatabaseException` - On errors

  - ### userGetForName

    Optional<IdUser> userGetForName(IdName name) throws IdDatabaseException
    Parameters:
      `name` - The ID name
    Returns:
      A user with the given name
    Throws:
      `IdDatabaseException` - On errors

  - ### userGetForNameRequire

    IdUser userGetForNameRequire(IdName name) throws IdDatabaseException
    Parameters:
      `name` - The ID name
    Returns:
      A user with the given name
    Throws:
      `IdDatabaseException` - On errors

  - ### userGetForEmail

    Optional<IdUser> userGetForEmail(IdEmail email) throws IdDatabaseException
    Parameters:
      `email` - The user email
    Returns:
      A user with the given email
    Throws:
      `IdDatabaseException` - On errors

  - ### userGetForEmailRequire

    IdUser userGetForEmailRequire(IdEmail email) throws IdDatabaseException
    Parameters:
      `email` - The user email
    Returns:
      A user with the given email
    Throws:
      `IdDatabaseException` - On errors

  - ### userLogin

    void userLogin(UUID id, Map<String,String> metadata, int limitHistory) throws IdDatabaseException
    Record the fact that the given user has logged in.
    Parameters:
      `id` - The user ID
      `metadata` - The optional metadata included with the request
      `limitHistory` - The limit on the number of login records that will be kept
    Throws:
      `IdDatabaseException` - On errors

  - ### userUpdate

    @IdDatabaseRequiresUser void userUpdate(UUID id, Optional<IdName> withIdName, Optional<IdRealName> withRealName, Optional<IdPassword> withPassword) throws IdDatabaseException
    Update the given user.
    Parameters:
      `id` - The user ID
      `withIdName` - The new ID name, if desired
      `withRealName` - The new real name, if desired
      `withPassword` - The new password, if desired
    Throws:
      `IdDatabaseException` - On errors

  - ### userUpdateAsAdmin

    @IdDatabaseRequiresAdmin void userUpdateAsAdmin(UUID id, Optional<IdName> withIdName, Optional<IdRealName> withRealName, Optional<IdPassword> withPassword) throws IdDatabaseException
    Update the given user as an admin.
    Parameters:
      `id` - The user ID
      `withIdName` - The new ID name, if desired
      `withRealName` - The new real name, if desired
      `withPassword` - The new password, if desired
    Throws:
      `IdDatabaseException` - On errors

  - ### userEmailAdd

    void userEmailAdd(UUID id, IdEmail email) throws IdDatabaseException
    Add an email address to the given user.
    Parameters:
      `id` - The user ID
      `email` - The new email
    Throws:
      `IdDatabaseException` - On errors

  - ### userEmailRemove

    void userEmailRemove(UUID id, IdEmail email) throws IdDatabaseException
    Remove an email address from the given user.
    Parameters:
      `id` - The user ID
      `email` - The email
    Throws:
      `IdDatabaseException` - On errors

  - ### userLoginHistory

    List<IdLogin> userLoginHistory(UUID id, int limit) throws IdDatabaseException
    Obtain the login history of the given user.
    Parameters:
      `id` - The user ID
      `limit` - The limit on the number of returned items
    Returns:
      The login history
    Throws:
      `IdDatabaseException` - On errors

  - ### userDelete

    @IdDatabaseRequiresAdmin void userDelete(UUID id) throws IdDatabaseException
    Delete the given user.
    Parameters:
      `id` - The user ID
    Throws:
      `IdDatabaseException` - On errors

  - ### userBanCreate

    @IdDatabaseRequiresAdmin void userBanCreate(IdBan ban) throws IdDatabaseException
    Create a ban on the given user account.
    Parameters:
      `ban` - The ban
    Throws:
      `IdDatabaseException` - On errors

  - ### userBanGet

    Optional<IdBan> userBanGet(UUID id) throws IdDatabaseException
    Get the ban for the given user, if one exists.
    Parameters:
      `id` - The user ID
    Returns:
      The ban, if any
    Throws:
      `IdDatabaseException` - On errors

  - ### userBanDelete

    @IdDatabaseRequiresAdmin void userBanDelete(IdBan ban) throws IdDatabaseException
    Delete the given ban.
    Parameters:
      `ban` - The ban
    Throws:
      `IdDatabaseException` - On errors

  - ### userPasswordResetCreate

    void userPasswordResetCreate(IdUserPasswordReset reset) throws IdDatabaseException
    Create a password reset request.
    Parameters:
      `reset` - The request
    Throws:
      `IdDatabaseException` - On errors

  - ### userPasswordResetGet

    List<IdUserPasswordReset> userPasswordResetGet(UUID user) throws IdDatabaseException
    List the password reset requests for the given user.
    Parameters:
      `user` - The user
    Returns:
      A list of requests, if any
    Throws:
      `IdDatabaseException` - On errors

  - ### userPasswordResetGetForToken

    Optional<IdUserPasswordReset> userPasswordResetGetForToken(IdToken token) throws IdDatabaseException
    List the password reset request for the given token.
    Parameters:
      `token` - The token
    Returns:
      A request, if any
    Throws:
      `IdDatabaseException` - On errors

  - ### userPasswordResetDelete

    void userPasswordResetDelete(IdUserPasswordReset reset) throws IdDatabaseException
    Delete a password reset request.
    Parameters:
      `reset` - The request
    Throws:
      `IdDatabaseException` - On errors

  - ### userSearch

    IdDatabaseUserSearchType userSearch(IdUserSearchParameters parameters) throws IdDatabaseException
    List users.
    Parameters:
      `parameters` - The search parameters
    Returns:
      The users
    Throws:
      `IdDatabaseException` - On errors

  - ### userSearchByEmail

    IdDatabaseUserSearchByEmailType userSearchByEmail(IdUserSearchByEmailParameters parameters) throws IdDatabaseException
    List users.
    Parameters:
      `parameters` - The search parameters
    Returns:
      The users
    Throws:
      `IdDatabaseException` - On errors