Iris.Rigging.GeneralUnit (iris v0.1.0)

This module represents a GeneralUnit in Cordage.

Attributes:

  • id
  • name
  • code
  • description
  • level
  • parent_id
  • organization_id
  • responsible_id

Link to this section Summary

Functions

Validates if a list of General Units from Rigging exist. Expects the token of the user making the request, along with the ID's of the general units they are validating.

Validates if a list of General Units from Rigging exist. Expects the token of the user making the request, along with the ID's of the general units they are validating.

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

Gets a General Unit 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)

@spec all!(user_token :: String.t(), ids :: [String.t()]) :: [
  %Iris.Rigging.GeneralUnit{
    code: term(),
    description: term(),
    id: term(),
    level: term(),
    name: term(),
    organization_id: term(),
    responsible_id: term(),
    type_of_access: term()
  }
]

Validates if a list of General Units from Rigging exist. Expects the token of the user making the request, along with the ID's of the general units they are validating.

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

iex> GeneralUnit.all!("my valid token", ["my id"])
iex> [%Iris.Rigging.GeneralUnit{}]

iex> GeneralUnit.all!("my valid token", "[not_existing_id]")
iex> ** Iris.Error.NotFoundError

iex> GeneralUnit.all!("my invalid token", ["my id"])
iex> ** Iris.Error.UnauthorizedError
Link to this function

all(user_token, ids)

@spec all(user_token :: String.t(), ids :: [String.t()]) ::
  [
    %Iris.Rigging.GeneralUnit{
      code: term(),
      description: term(),
      id: term(),
      level: term(),
      name: term(),
      organization_id: term(),
      responsible_id: term(),
      type_of_access: term()
    }
  ]
  | []

Validates if a list of General Units from Rigging exist. Expects the token of the user making the request, along with the ID's of the general units they are validating.

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

Examples

iex> GeneralUnit.all("my valid token", ["my id"])
iex> [%Iris.Rigging.GeneralUnit{}]

iex> GeneralUnit.all("my valid token", "[not_existing_id]")
iex> :not_found
Link to this function

get!(user_token, id)

@spec get!(user_token :: String.t(), id :: String.t()) :: %Iris.Rigging.GeneralUnit{
  code: term(),
  description: term(),
  id: term(),
  level: term(),
  name: term(),
  organization_id: term(),
  responsible_id: term(),
  type_of_access: term()
}

Gets a General Unit 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

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

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

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

get(user_token, id)

@spec get(user_token :: String.t(), id :: String.t()) ::
  {:ok,
   %Iris.Rigging.GeneralUnit{
     code: term(),
     description: term(),
     id: term(),
     level: term(),
     name: term(),
     organization_id: term(),
     responsible_id: term(),
     type_of_access: term()
   }}
  | {:error, %Iris.Error.NotFoundError{__exception__: term(), message: term()}}
  | {:error,
     %Iris.Error.UnauthorizedError{__exception__: term(), message: term()}}

Gets a General Unit 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.

Examples

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

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

iex> GeneralUnit.get("my invalid token", "my id")
iex> {:error, %Iris.Error.UnauthorizedError}