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