AppwriteElixir.Services.Users (appwrite_elixir v0.1.3)

The Users service allows you to manage your project users. Use this service to search, block, and view your users' info, current sessions, and latest activity logs. You can also use the Users service to edit your users' preferences and personal info.

Link to this section Summary

Types

event: Event name.

sum: total number of sessions sessions: list of sessions

$id: Session ID.

$id: User ID.

Functions

Create a new user.

Delete a user by its unique ID.

Delete a user sessions by its unique ID.

Delete all user's sessions by using the user's unique ID.

Get a list of all the project's users. You can use the query params to filter your results.

Get a user by its unique ID.

Get a user activity logs list by its unique ID.

Get the user preferences by its unique ID.

Get the user sessions list by its unique ID.

Update the user email verification status by its unique ID.

Update the user name by its unique ID.

Update the user password by its unique ID.

Update the user preferences by its unique ID. You can pass only the specific settings you wish to update.

Update the user status by its unique ID.

Link to this section Types

Specs

log() :: %{
  event: String.t(),
  ip: String.t(),
  time: integer(),
  osCode: String.t(),
  osName: String.t(),
  osVersion: String.t(),
  clientType: String.t(),
  clientCode: String.t(),
  clientName: String.t(),
  clientVersion: String.t(),
  clientEngine: String.t(),
  clientEngineVersion: String.t(),
  deviceName: String.t(),
  deviceBrand: String.t(),
  deviceModel: String.t(),
  countryCode: String.t(),
  countryName: String.t(),
  current: boolean()
}

event: Event name.

ip: IP session in use when the session was created.

time: Log creation time in Unix timestamp.

osCode: Operating system code name. View list of available options.

osName: Operating system name.

osVersion: Operating system version.

clientType: Client type.

clientCode: Client code name.

clientName: Client name.

clientVersion: Client version.

clientEngine: Client engine name.

clientEngineVersion: Client engine name.

deviceName: Device name.

deviceBrand: Device brand name.

deviceModel: Device model name.

countryCode: Country two-character ISO 3166-1 alpha code.

countryName: Country name.

Link to this type

session_list_object()

Specs

session_list_object() :: %{sum: integer(), sessions: List[session_object()]}

sum: total number of sessions sessions: list of sessions

Link to this type

session_object()

Specs

session_object() :: %{
  id: String.t(),
  userId: String.t(),
  expire: integer(),
  provider: String.t(),
  providerUid: String.t(),
  providerToken: String.t(),
  ip: String.t(),
  osCode: String.t(),
  osName: String.t(),
  osVersion: String.t(),
  clientType: String.t(),
  clientCode: String.t(),
  clientName: String.t(),
  clientVersion: String.t(),
  clientEngine: String.t(),
  clientEngineVersion: String.t(),
  deviceName: String.t(),
  deviceBrand: String.t(),
  deviceModel: String.t(),
  countryCode: String.t(),
  countryName: String.t(),
  current: boolean()
}

$id: Session ID.

userId: User ID.

expire: Session expiration date in Unix timestamp.

provider: Session Provider.

providerUid: Session Provider User ID.

providerToken: Session Provider Token.

ip: IP session in use when the session was created.

osCode: Operating system code name. View list of available options.

osName: Operating system name.

osVersion: Operating system version.

clientType: Client type.

clientCode: Client code name.

clientName: Client name.

clientVersion: Client version.

clientEngine: Client engine name.

clientEngineVersion: Client engine name.

deviceName: Device name.

deviceBrand: Device brand name.

deviceModel: Device model name.

countryCode: Country two-character ISO 3166-1 alpha code.

countryName: Country name.

Link to this type

user_object()

Specs

user_object() :: %{
  id: String.t(),
  name: String.t(),
  registration: integer(),
  status: integer(),
  passwordUpdate: integer(),
  email: String.t(),
  emailVerification: boolean(),
  prefs: %{}
}

$id: User ID.

name: User name.

registration: User registration date in Unix timestamp.

status: User status. 0 for Unactivated, 1 for active and 2 is blocked.

passwordUpdate: Unix timestamp of the most recent password update

email: User email address.

emailVerification: Email verification status.

prefs: User preferences as a key-value object

Link to this section Functions

Link to this function

create_user(input)

Specs

create_user(CeateUserInputs.t()) :: user_object() | {:error, term()}

Create a new user.

Link to this function

delete_user(user_id)

Specs

delete_user([{:id, String.t()}]) :: nil | :error

Delete a user by its unique ID.

Link to this function

delete_user_session(input)

Specs

delete_user_session(AppwriteElixir.Services.Users.DeleteUserSessionInputs.t()) ::
  nil | {:error, term()}

Delete a user sessions by its unique ID.

Link to this function

delete_user_sessions(user_id)

Specs

delete_user_sessions([{:id, String.t()}]) :: nil | {:error, term()}

Delete all user's sessions by using the user's unique ID.

Link to this function

get_all_users()

Specs

get_all_users() :: List[user_object()] | {:error, term()}

Get a list of all the project's users. You can use the query params to filter your results.

Link to this function

get_one_user(user_id)

Specs

get_one_user([{:id, String.t()}]) :: user_object() | {:error, term()}

Get a user by its unique ID.

Link to this function

get_user_logs(user_id)

Specs

get_user_logs([{:id, String.t()}]) :: List[log()] | {:error, term()}

Get a user activity logs list by its unique ID.

Link to this function

get_user_prefs(user_id)

Specs

get_user_prefs([{:id, String.t()}]) :: %{} | {:error, term()}

Get the user preferences by its unique ID.

Link to this function

get_user_sessions(user_id)

Specs

get_user_sessions([{:id, String.t()}]) ::
  session_list_object() | {:error, term()}

Get the user sessions list by its unique ID.

Link to this function

update_user_email(input)

Specs

Link to this function

update_user_email_verification(input)

Specs

update_user_email_verification(
  AppwriteElixir.Services.Users.UpdateEmailVerificationInputs.t()
) :: user_object() | {:error, term()}

Update the user email verification status by its unique ID.

Link to this function

update_user_name(input)

Specs

Update the user name by its unique ID.

Link to this function

update_user_password(input)

Specs

Update the user password by its unique ID.

Link to this function

update_user_prefs(input)

Specs

Update the user preferences by its unique ID. You can pass only the specific settings you wish to update.

Link to this function

update_user_status(input)

Specs

update_user_status(AppwriteElixir.Services.Users.UpdateUserStatusInputs) ::
  user_object() | {:error, term()}

Update the user status by its unique ID.