Current section
Files
Jump to
Current section
Files
lib/campaign_flow/client/agencies.ex
defmodule CampaignFlow.Client.Agencies do
@moduledoc """
Agency resource operations for the Campaign Flow API.
"""
alias CampaignFlow.Client
alias CampaignFlow.Client.Request
@doc """
Lists all agencies.
## Options
* `:page` - Page number for pagination
* `:per_page` - Number of items per page
## Examples
{:ok, agencies} = CampaignFlow.Client.Agencies.list(client)
{:ok, agencies} = CampaignFlow.Client.Agencies.list(client, page: 2)
"""
@spec list(Client.t(), keyword()) :: Client.Request.response()
def list(client, params \\ []) do
Request.get(client, "/agencies", params: params)
end
@doc """
Retrieves a specific agency by ID.
## Examples
{:ok, agency} = CampaignFlow.Client.Agencies.get(client, 123)
"""
@spec get(Client.t(), integer()) :: Client.Request.response()
def get(client, id) do
Request.get(client, "/agencies/#{id}")
end
@doc """
Registers a new agency.
## Examples
{:ok, agency} = CampaignFlow.Client.Agencies.create(client, %{
name: "ABC Real Estate",
abn: "12345678901"
})
"""
@spec create(Client.t(), map()) :: Client.Request.response()
def create(client, params) do
Request.post(client, "/agencies", json: params)
end
end