Humaans.TimesheetSubmissions (Humaans v0.5.1)

Copy Markdown View Source

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

delete_response()

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

list_response()

@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()}

response()

@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

create(client, params)

@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 with Humaans.new/1
  • params - 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)

delete(client, id)

@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 with Humaans.new/1
  • id - 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")

list(client, params \\ %{})

@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 with Humaans.new/1
  • params - 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, %{})

retrieve(client, id)

@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 with Humaans.new/1
  • id - 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")

update(client, id, params)

@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 with Humaans.new/1
  • id - String ID of the timesheet_submission to update
  • params - Map of attributes to update

Examples

client = Humaans.new(access_token: "your_access_token")
{:ok, timesheet_submission} = Humaans.TimesheetSubmissions.update(client, "timesheet_submission_id", %{})