Current section
Files
Jump to
Current section
Files
lib/loops_elixir/mailing_lists.ex
defmodule LoopsEx.MailingLists do
@moduledoc """
View mailing lists in your account.
"""
alias LoopsEx.Client
@typedoc "Response type returned by Loops API calls"
@type response :: LoopsEx.Client.response()
@doc """
Retrieve all mailing lists in your account.
## Returns
- `{:ok, [map()]}` where each map includes:
- `"id"` (string)
- `"name"` (string)
- `"description"` (string)
- `"isPublic"` (boolean)
- `{:error, {status_code, response_body}}` on failure.
## Example
iex> LoopsEx.MailingLists.list()
{:ok, [%{"id" => "list_123", "name" => "Main", "description" => "Desc", "isPublic" => true}]}
"""
@spec list() :: response()
def list do
Client.request_api(:get, "/lists")
|> Client.handle_response()
end
end