Humaans.Compensations behaviour (Humaans v0.1.0)

View Source

Handles operations related to bank accounts.

Summary

Types

delete_response()

@type delete_response() :: {:ok, %{id: String.t(), deleted: bool()}} | {:error, any()}

list_response()

@type list_response() ::
  {:ok,
   [
     %Humaans.Resources.Compensation{
       amount: term(),
       compensation_type_id: term(),
       created_at: term(),
       currency: term(),
       effective_date: term(),
       end_date: term(),
       end_reason: term(),
       id: term(),
       note: term(),
       period: term(),
       person_id: term(),
       updated_at: term()
     }
   ]}
  | {:error, any()}

response()

@type response() ::
  {:ok,
   %Humaans.Resources.Compensation{
     amount: term(),
     compensation_type_id: term(),
     created_at: term(),
     currency: term(),
     effective_date: term(),
     end_date: term(),
     end_reason: term(),
     id: term(),
     note: term(),
     period: term(),
     person_id: term(),
     updated_at: term()
   }}
  | {:error, any()}

Callbacks

create(map)

@callback create(map()) :: {:ok, map()} | {:error, any()}

delete(t)

@callback delete(String.t()) :: {:ok, map()} | {:error, any()}

list(map)

@callback list(map()) :: {:ok, map()} | {:error, any()}

retrieve(t)

@callback retrieve(String.t()) :: {:ok, map()} | {:error, any()}

update(t, map)

@callback update(String.t(), map()) :: {:ok, map()} | {:error, any()}

Functions

create(params)

@spec create(params :: keyword()) :: response()

delete(id)

@spec delete(id :: String.t()) :: delete_response()

list(params \\ %{})

@spec list(params :: keyword()) :: list_response()

retrieve(id)

@spec retrieve(id :: String.t()) :: response()

update(id, params)

@spec update(id :: String.t(), params :: keyword()) :: response()