Current section

Files

Jump to
campaign_flow lib campaign_flow client assets.ex
Raw

lib/campaign_flow/client/assets.ex

defmodule CampaignFlow.Client.Assets do
@moduledoc """
Asset resource operations for the Campaign Flow API.
Assets represent files that have been uploaded to the system.
"""
alias CampaignFlow.Client
alias CampaignFlow.Client.Request
@doc """
Uploads an asset and optionally attaches it to an entity.
## Examples
{:ok, asset} = CampaignFlow.Client.Assets.create(client, %{
file: file_data,
entity_type: "campaign",
entity_id: 123
})
"""
@spec create(Client.t(), map()) :: Client.Request.response()
def create(client, params) do
Request.post(client, "/assets", json: params)
end
@doc """
Retrieves a previously uploaded asset.
## Examples
{:ok, asset} = CampaignFlow.Client.Assets.get(client, 123, "abc123hash")
"""
@spec get(Client.t(), integer(), String.t()) :: Client.Request.response()
def get(client, id, hash) do
Request.get(client, "/assets/#{id}/#{hash}")
end
end