Iris.Rigging.User (iris v0.1.0)

This module represents a User in Cordage.

Attributes:

  • id
  • first_name
  • middle_name
  • last_name
  • email
  • timezone
  • auth0_id
  • type
  • status
  • language
  • organization_id
  • organizational_unit_id
  • job_title_id

Link to this section Summary

Functions

Gets a User from Rigging. Expects the token of the user making the request, along with the ID of the user they are looking for.

Gets a User from Rigging. Expects the token of the user making the request, along with the ID of the user they are looking for.

Link to this section Functions

Link to this function

all!(user_token, ids)

Link to this function

all(user_token, ids)

Link to this function

get!(user_token, id)

@spec get!(user_token :: String.t(), id :: String.t()) :: %Iris.Rigging.User{
  auth0_id: term(),
  email: term(),
  first_name: term(),
  id: term(),
  job_title_id: term(),
  language: term(),
  last_name: term(),
  middle_name: term(),
  organization_id: term(),
  organizational_unit_id: term(),
  status: term(),
  timezone: term(),
  type: term()
}

Gets a User from Rigging. Expects the token of the user making the request, along with the ID of the user they are looking for.

Token must not contain the "Bearer" prefix. Also, the authorization login will be enforce by Rigging.

Raises a Iris.Error.NotFoundError if no record is matched.

Raises a Iris.Error.UnauthorizedError if Rigging sends an "unauthorized" response.

examples

Examples

iex> User.get!("my valid token", "my id")
iex> %Iris.Rigging.User{}

iex> User.get!("my valid token", "invalid id")
** (Iris.Error.NotFoundError)

iex> User.get!("my invalid token", "my id")
** (Iris.Error.UnauthorizedError)
Link to this function

get(user_token, id)

@spec get(user_token :: String.t(), id :: String.t()) ::
  {:ok,
   %Iris.Rigging.User{
     auth0_id: term(),
     email: term(),
     first_name: term(),
     id: term(),
     job_title_id: term(),
     language: term(),
     last_name: term(),
     middle_name: term(),
     organization_id: term(),
     organizational_unit_id: term(),
     status: term(),
     timezone: term(),
     type: term()
   }}
  | {:error, %Iris.Error.NotFoundError{__exception__: term(), message: term()}}
  | {:error,
     %Iris.Error.UnauthorizedError{__exception__: term(), message: term()}}

Gets a User from Rigging. Expects the token of the user making the request, along with the ID of the user they are looking for.

Token must not contain the "Bearer" prefix. Also, the authorization logic will be enforce by Rigging.

examples

Examples

 iex> User.get("my valid token", "my id")
 iex> {:ok, %Iris.Rigging.User{}}

 iex> User.get("my valid token", "invalid id")
 iex> {:error, %Iris.Error.NotFoundError{}}