Functions for interacting with endpoints related to the authenticated user.
Summary
Functions
Get all the authenticated user's addresses including emergency contacts.
Same as all_contact_addresses/1 but raises on error.
Get the authenticated user's colleagues.
Same as colleagues/1 but raises on error.
Complete a task.
Same as complete_task/2 but raises on error.
Get the authenticated user's address.
Same as contact_address/1 but raises on error.
Get the authenticated user's leave requests.
Same as leave/1 but raises on error.
Get a specific location.
Same as location/2 but raises on error.
Get locations where the authenticated user can work.
Same as locations/1 but raises on error.
Get information about the authenticated user.
Same as me/1 but raises on error.
Get the authenticated user's memos (newsfeed).
Same as memos/1 but raises on error.
Get the authenticated user's notifications.
Same as notifications/1 but raises on error.
Get the authenticated user's rosters.
Same as rosters/1 but raises on error.
Get setup information for the authenticated user.
Same as setup/1 but raises on error.
Get the authenticated user's tasks.
Same as tasks/1 but raises on error.
Get details for a specific timesheet.
Same as timesheet_detail/2 but raises on error.
Get the authenticated user's timesheets.
Same as timesheets/1 but raises on error.
Get the authenticated user's training.
Same as training/1 but raises on error.
Get the authenticated user's unavailability.
Same as unavailability/1 but raises on error.
Update the authenticated user's address.
Same as update_contact_address/2 but raises on error.
Functions
@spec all_contact_addresses(Deputy.t()) :: {:ok, [map()]} | {:error, Deputy.Error.t()}
Get all the authenticated user's addresses including emergency contacts.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.all_contact_addresses(client)
{:ok, [%{"Street1" => "123 Main St", "City" => "New York"}]}
Same as all_contact_addresses/1 but raises on error.
@spec colleagues(Deputy.t()) :: {:ok, [map()]} | {:error, Deputy.Error.t()}
Get the authenticated user's colleagues.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.colleagues(client)
{:ok, [%{"Id" => 2, "FirstName" => "Jane", "LastName" => "Smith"}]}
Same as colleagues/1 but raises on error.
@spec complete_task(Deputy.t(), integer()) :: {:ok, map()} | {:error, Deputy.Error.t()}
Complete a task.
Parameters
client: A Deputy client.id: The ID of the task to complete.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.complete_task(client, 1)
{:ok, %{"success" => true}}
Same as complete_task/2 but raises on error.
@spec contact_address(Deputy.t()) :: {:ok, map()} | {:error, Deputy.Error.t()}
Get the authenticated user's address.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.contact_address(client)
{:ok, %{"Street1" => "123 Main St", "City" => "New York"}}
Same as contact_address/1 but raises on error.
@spec leave(Deputy.t()) :: {:ok, [map()]} | {:error, Deputy.Error.t()}
Get the authenticated user's leave requests.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.leave(client)
{:ok, [%{"Id" => 1, "DateStart" => "2023-01-01", "DateEnd" => "2023-01-05"}]}
Same as leave/1 but raises on error.
@spec location(Deputy.t(), integer()) :: {:ok, map()} | {:error, Deputy.Error.t()}
Get a specific location.
Parameters
client: A Deputy client.id: The ID of the location.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.location(client, 1)
{:ok, %{"Id" => 1, "Name" => "Main Office"}}
Same as location/2 but raises on error.
@spec locations(Deputy.t()) :: {:ok, [map()]} | {:error, Deputy.Error.t()}
Get locations where the authenticated user can work.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.locations(client)
{:ok, [%{"Id" => 1, "Name" => "Main Office"}]}
Same as locations/1 but raises on error.
@spec me(Deputy.t()) :: {:ok, map()} | {:error, Deputy.Error.t()}
Get information about the authenticated user.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.me(client)
{:ok, %{"Id" => 1, "FirstName" => "John", "LastName" => "Doe"}}
Same as me/1 but raises on error.
@spec memos(Deputy.t()) :: {:ok, [map()]} | {:error, Deputy.Error.t()}
Get the authenticated user's memos (newsfeed).
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.memos(client)
{:ok, [%{"Id" => 1, "Content" => "Welcome to Deputy"}]}
Same as memos/1 but raises on error.
@spec notifications(Deputy.t()) :: {:ok, [map()]} | {:error, Deputy.Error.t()}
Get the authenticated user's notifications.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.notifications(client)
{:ok, [%{"Id" => 1, "Message" => "You have a new roster"}]}
Same as notifications/1 but raises on error.
@spec rosters(Deputy.t()) :: {:ok, [map()]} | {:error, Deputy.Error.t()}
Get the authenticated user's rosters.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.rosters(client)
{:ok, [%{"Id" => 1, "StartTime" => "2023-01-01T09:00:00"}]}
Same as rosters/1 but raises on error.
@spec setup(Deputy.t()) :: {:ok, map()} | {:error, Deputy.Error.t()}
Get setup information for the authenticated user.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.setup(client)
{:ok, %{"locations" => [%{"Id" => 1, "Name" => "Main Office"}]}}
Same as setup/1 but raises on error.
@spec tasks(Deputy.t()) :: {:ok, [map()]} | {:error, Deputy.Error.t()}
Get the authenticated user's tasks.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.tasks(client)
{:ok, [%{"Id" => 1, "TaskName" => "Complete training"}]}
Same as tasks/1 but raises on error.
@spec timesheet_detail(Deputy.t(), integer()) :: {:ok, map()} | {:error, Deputy.Error.t()}
Get details for a specific timesheet.
Parameters
client: A Deputy client.id: The ID of the timesheet.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.timesheet_detail(client, 1)
{:ok, %{"Id" => 1, "StartTime" => "2023-01-01T09:00:00"}}
Same as timesheet_detail/2 but raises on error.
@spec timesheets(Deputy.t()) :: {:ok, [map()]} | {:error, Deputy.Error.t()}
Get the authenticated user's timesheets.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.timesheets(client)
{:ok, [%{"Id" => 1, "StartTime" => "2023-01-01T09:00:00"}]}
Same as timesheets/1 but raises on error.
@spec training(Deputy.t()) :: {:ok, [map()]} | {:error, Deputy.Error.t()}
Get the authenticated user's training.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> Deputy.My.training(client)
{:ok, [%{"Id" => 1, "Name" => "Safety Training"}]}
Same as training/1 but raises on error.
@spec update_contact_address(Deputy.t(), map()) :: {:ok, map()} | {:error, Deputy.Error.t()}
Update the authenticated user's address.
Parameters
client: A Deputy client.attrs: A map containing the address details.
Address parameters
ContactName: Name for the contact.UnitNo: Unit number.Street1: Street address.City: City.State: State code.Postcode: Postal code.Country: Country ID.Notes: Optional notes.
Examples
iex> client = Deputy.new(base_url: "https://test.deputy.com", api_key: "test-key")
iex> attrs = %{
...> ContactName: "John Doe",
...> UnitNo: "2",
...> Street1: "123 Main St",
...> City: "New York",
...> State: "NY",
...> Postcode: "10001",
...> Country: 1
...> }
iex> Deputy.My.update_contact_address(client, attrs)
{:ok, %{"success" => true}}
Same as update_contact_address/2 but raises on error.