This module provides functions for managing location resources in the Humaans API.
Summary
Functions
Creates a new location.
Deletes a specific location by ID.
Lists all locations.
Retrieves a specific location by ID.
Updates a specific location by ID.
Types
Functions
@spec create(client :: map(), params :: map() | keyword()) :: {:ok, Humaans.Resources.Location.t()} | {:error, Humaans.Error.t()}
Creates a new location.
Parameters
client- Client created withHumaans.new/1params- Map of attributes for the new location
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{name: "London HQ"}
{:ok, location} = Humaans.Locations.create(client, params)
@spec delete(client :: map(), id :: String.t()) :: {:ok, %{id: String.t(), deleted: boolean()}} | {:error, Humaans.Error.t()}
Deletes a specific location by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the location to delete
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, %{id: "location_id", deleted: true}} = Humaans.Locations.delete(client, "location_id")
@spec list(client :: map(), params :: map() | keyword() | [{String.t(), term()}]) :: {:ok, [Humaans.Resources.Location.t()]} | {:error, Humaans.Error.t()}
Lists all locations.
Returns a list of locations 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, locations} = Humaans.Locations.list(client)
{:ok, locations} = Humaans.Locations.list(client, %{})
@spec retrieve(client :: map(), id :: String.t()) :: {:ok, Humaans.Resources.Location.t()} | {:error, Humaans.Error.t()}
Retrieves a specific location by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the location to retrieve
Examples
client = Humaans.new(access_token: "your_access_token")
{:ok, location} = Humaans.Locations.retrieve(client, "location_id")
@spec update(client :: map(), id :: String.t(), params :: map() | keyword()) :: {:ok, Humaans.Resources.Location.t()} | {:error, Humaans.Error.t()}
Updates a specific location by ID.
Parameters
client- Client created withHumaans.new/1id- String ID of the location to updateparams- Map of attributes to update
Examples
client = Humaans.new(access_token: "your_access_token")
params = %{name: "London Office"}
{:ok, location} = Humaans.Locations.update(client, "location_id", params)