Iris.Rigging.OrganizationalUnit (iris v0.1.0)

This module represents a OrganizationalUnit 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 Organizational Units from Rigging exist. Expects the token of the user making the request, along with the ID's of the organizational units they are validating.

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

Gets a Organizational 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 Organizational 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.OrganizationalUnit{
    code: term(),
    description: term(),
    id: term(),
    level: term(),
    name: term(),
    organization_id: term(),
    parent_id: term(),
    responsible_id: term()
  }
]

Validates if a list of Organizational Units from Rigging exist. Expects the token of the user making the request, along with the ID's of the organizational 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> OrganizationalUnit.all!("my valid token", ["my id"])
iex> [%Iris.Rigging.OrganizationalUnit{}]

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

iex> OrganizationalUnit.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.OrganizationalUnit{
      code: term(),
      description: term(),
      id: term(),
      level: term(),
      name: term(),
      organization_id: term(),
      parent_id: term(),
      responsible_id: term()
    }
  ]
  | []

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

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

Examples

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

iex> OrganizationalUnit.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.OrganizationalUnit{
    code: term(),
    description: term(),
    id: term(),
    level: term(),
    name: term(),
    organization_id: term(),
    parent_id: term(),
    responsible_id: term()
  }

Gets a Organizational 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> OrganizationalUnit.get!("my valid token", "my id")
iex> %Iris.Rigging.OrganizationalUnit{}

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

iex> OrganizationalUnit.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.OrganizationalUnit{
     code: term(),
     description: term(),
     id: term(),
     level: term(),
     name: term(),
     organization_id: term(),
     parent_id: term(),
     responsible_id: term()
   }}
  | {:error, %Iris.Error.NotFoundError{__exception__: term(), message: term()}}
  | {:error,
     %Iris.Error.UnauthorizedError{__exception__: term(), message: term()}}

Gets a Organizational 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> OrganizationalUnit.get("my valid token", "my id")
iex> {:ok, %Iris.Rigging.OrganizationalUnit{}}

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

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