Humaans.CompensationTypes (Humaans v0.5.1)

Copy Markdown View Source

This module provides functions for managing compensation type resources in the Humaans API. Compensation types are used to define different categories of compensation such as salary, bonus, commission, etc.

Summary

Functions

Creates a new compensation_type.

Deletes a specific compensation_type by ID.

Lists all compensation_types.

Retrieves a specific compensation_type by ID.

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

response()

@type response() ::
  {:ok,
   %Humaans.Resources.CompensationType{
     base_type: term(),
     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.CompensationType.t()} | {:error, Humaans.Error.t()}

Creates a new compensation_type.

Parameters

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

Examples

client = Humaans.new(access_token: "your_access_token")
params = %{name: "Annual Bonus", baseType: "variable"}
{:ok, compensation_type} = Humaans.CompensationTypes.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 compensation_type by ID.

Parameters

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

Examples

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

list(client, params \\ %{})

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

Lists all compensation_types.

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

retrieve(client, id)

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

Retrieves a specific compensation_type by ID.

Parameters

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

Examples

client = Humaans.new(access_token: "your_access_token")
{:ok, compensation_type} = Humaans.CompensationTypes.retrieve(client, "compensation_type_id")

update(client, id, params)

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

Updates a specific compensation_type by ID.

Parameters

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

Examples

client = Humaans.new(access_token: "your_access_token")
params = %{name: "Performance Bonus"}
{:ok, compensation_type} = Humaans.CompensationTypes.update(client, "compensation_type_id", params)