Humaans.WorkingPatterns (Humaans v0.6.0)

Copy Markdown View Source

This module provides functions for managing working pattern resources in the Humaans API.

Summary

Functions

Creates a new working_pattern.

Deletes a specific working_pattern by ID.

Lists all working_patterns.

Retrieves a specific working_pattern by ID.

Updates a specific working_pattern 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.WorkingPattern{
       company_id: term(),
       created_at: term(),
       id: term(),
       name: term(),
       updated_at: term()
     }
   ]}
  | {:error, Humaans.Error.t()}

response()

@type response() ::
  {:ok,
   %Humaans.Resources.WorkingPattern{
     company_id: term(),
     created_at: term(),
     id: term(),
     name: term(),
     updated_at: term()
   }}
  | {:error, Humaans.Error.t()}

Functions

create(client, params)

@spec create(client :: map(), params :: map() | keyword()) ::
  {:ok, Humaans.Resources.WorkingPattern.t()} | {:error, Humaans.Error.t()}

Creates a new working_pattern.

Parameters

  • client - Client created with Humaans.new/1
  • params - Map of attributes for the new working_pattern

Examples

client = Humaans.new(access_token: "your_access_token")
params = %{name: "Mon-Fri 9-5"}
{:ok, working_pattern} = Humaans.WorkingPatterns.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 working_pattern by ID.

Parameters

  • client - Client created with Humaans.new/1
  • id - String ID of the working_pattern to delete

Examples

client = Humaans.new(access_token: "your_access_token")
{:ok, %{id: "working_pattern_id", deleted: true}} = Humaans.WorkingPatterns.delete(client, "working_pattern_id")

list(client, params \\ %{})

@spec list(client :: map(), params :: map() | keyword() | [{String.t(), term()}]) ::
  {:ok, [Humaans.Resources.WorkingPattern.t()]} | {:error, Humaans.Error.t()}

Lists all working_patterns.

Returns a list of working_patterns 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, working_patterns} = Humaans.WorkingPatterns.list(client)
{:ok, working_patterns} = Humaans.WorkingPatterns.list(client, %{})

retrieve(client, id)

@spec retrieve(client :: map(), id :: String.t()) ::
  {:ok, Humaans.Resources.WorkingPattern.t()} | {:error, Humaans.Error.t()}

Retrieves a specific working_pattern by ID.

Parameters

  • client - Client created with Humaans.new/1
  • id - String ID of the working_pattern to retrieve

Examples

client = Humaans.new(access_token: "your_access_token")
{:ok, working_pattern} = Humaans.WorkingPatterns.retrieve(client, "working_pattern_id")

update(client, id, params)

@spec update(client :: map(), id :: String.t(), params :: map() | keyword()) ::
  {:ok, Humaans.Resources.WorkingPattern.t()} | {:error, Humaans.Error.t()}

Updates a specific working_pattern by ID.

Parameters

  • client - Client created with Humaans.new/1
  • id - String ID of the working_pattern to update
  • params - Map of attributes to update

Examples

client = Humaans.new(access_token: "your_access_token")
params = %{name: "Mon-Thu 9-5"}
{:ok, working_pattern} = Humaans.WorkingPatterns.update(client, "working_pattern_id", params)