This module provides functions for managing timesheet submission resources in the Humaans API. Timesheet submissions represent a collection of timesheet entries for a specific time period that has been submitted for review and approval.
Summary
Functions
Creates a new timesheet_submission.
Deletes a specific timesheet_submission by ID.
Lists all timesheet_submissions.
Retrieves a specific timesheet_submission by ID.
Updates a specific timesheet_submission by ID.
Types
@type delete_response() :: {:ok, %{id: String.t(), deleted: bool()}} | {:error, Humaans.Error.t()}
@type list_response() :: {:ok, [ %Humaans.Resources.TimesheetSubmission{ changes_requested: term(), created_at: term(), duration_as_days: term(), duration_as_time: term(), end_date: term(), id: term(), person_id: term(), reviewed_at: term(), reviewed_by: term(), start_date: term(), status: term(), submitted_at: term(), updated_at: term() } ]} | {:error, Humaans.Error.t()}
@type response() :: {:ok, %Humaans.Resources.TimesheetSubmission{ changes_requested: term(), created_at: term(), duration_as_days: term(), duration_as_time: term(), end_date: term(), id: term(), person_id: term(), reviewed_at: term(), reviewed_by: term(), start_date: term(), status: term(), submitted_at: term(), updated_at: term() }} | {:error, Humaans.Error.t()}
Functions
@spec create(client :: map(), params :: map() | keyword()) :: {:ok, Humaans.Resources.TimesheetSubmission.t()} | {:error, Humaans.Error.t()}
Creates a new timesheet_submission.
Parameters
client- Client created withHumaans.new/1params- Map of attributes for the new timesheet_submission
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{personId: "person_abc", startDate: "2024-06-01", endDate: "2024-06-30"}
{:ok, timesheet_submission} = Humaans.TimesheetSubmissions.create(client, params)
@spec delete(client :: map(), id :: String.t()) :: {:ok, %{id: String.t(), deleted: boolean()}} | {:error, Humaans.Error.t()}
Deletes a specific timesheet_submission by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the timesheet_submission to delete
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, %{id: "timesheet_submission_id", deleted: true}} = Humaans.TimesheetSubmissions.delete(client, "timesheet_submission_id")
@spec list(client :: map(), params :: map() | keyword()) :: {:ok, [Humaans.Resources.TimesheetSubmission.t()]} | {:error, Humaans.Error.t()}
Lists all timesheet_submissions.
Returns a list of timesheet_submissions matching the optional filter params.
Parameters
client- Client created withHumaans.new/1params- Optional map of filter parameters (default:%{})
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, timesheet_submissions} = Humaans.TimesheetSubmissions.list(client)
{:ok, timesheet_submissions} = Humaans.TimesheetSubmissions.list(client, %{})
@spec retrieve(client :: map(), id :: String.t()) :: {:ok, Humaans.Resources.TimesheetSubmission.t()} | {:error, Humaans.Error.t()}
Retrieves a specific timesheet_submission by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the timesheet_submission to retrieve
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, timesheet_submission} = Humaans.TimesheetSubmissions.retrieve(client, "timesheet_submission_id")
@spec update(client :: map(), id :: String.t(), params :: map() | keyword()) :: {:ok, Humaans.Resources.TimesheetSubmission.t()} | {:error, Humaans.Error.t()}
Updates a specific timesheet_submission by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the timesheet_submission to updateparams- Map of attributes to update
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, timesheet_submission} = Humaans.TimesheetSubmissions.update(client, "timesheet_submission_id", %{})