# Unicom360 v0.1.0 - API Reference

## Modules

- Client
  - [Unicom360](Unicom360.md): The official Elixir client for the [Unicom360](https://unicom360.com) API: SMS, email and
WhatsApp over one JSON API.
  - [Unicom360.Client](Unicom360.Client.md): A configured, immutable Unicom360 client.
  - [Unicom360.Codes](Unicom360.Codes.md): The normalised error codes, and the function that derives them from the gateway's messages.
  - [Unicom360.Error](Unicom360.Error.md): The one error type of the SDK.

- Operations
  - [Unicom360.Balance](Unicom360.Balance.md): Account balances (`POST /api/v1/json/balance` and `/balance/all`), and the struct
`get/2` returns (canonical name `Balance`).
  - [Unicom360.Email](Unicom360.Email.md): Send email (`POST /api/v1/json/bulk/email`).
  - [Unicom360.SMS](Unicom360.SMS.md): Send SMS (`POST /api/v1/json/bulk/sms`).
  - [Unicom360.WhatsApp](Unicom360.WhatsApp.md): WhatsApp Business messaging: approved templates, session messages inside the 24-hour customer
service window, message status and the template list.

- WhatsApp builders
  - [Unicom360.WhatsApp.ListRow](Unicom360.WhatsApp.ListRow.md): A row of an interactive list message (`Unicom360.WhatsApp.Session.list/5`). The builder also
takes maps.

  - [Unicom360.WhatsApp.ListSection](Unicom360.WhatsApp.ListSection.md): A section of an interactive list message (`Unicom360.WhatsApp.Session.list/5`): rows of
`Unicom360.WhatsApp.ListRow`, with an optional title. The builder also takes maps.

  - [Unicom360.WhatsApp.ReplyButton](Unicom360.WhatsApp.ReplyButton.md): A reply button of an interactive buttons message (`Unicom360.WhatsApp.Session.buttons/4`).
The builder also takes `{id, title}` tuples and maps.

  - [Unicom360.WhatsApp.Session](Unicom360.WhatsApp.Session.md): Builders for WhatsApp session messages, sent with `Unicom360.WhatsApp.send_session/3` inside
the 24-hour customer service window.
  - [Unicom360.WhatsApp.SessionMessage](Unicom360.WhatsApp.SessionMessage.md): A WhatsApp session message, built with `Unicom360.WhatsApp.Session` and sent with
`Unicom360.WhatsApp.send_session/3`.
  - [Unicom360.WhatsApp.TemplateBody](Unicom360.WhatsApp.TemplateBody.md): A template recipient's body parameters: positional or named.
  - [Unicom360.WhatsApp.TemplateButton](Unicom360.WhatsApp.TemplateButton.md): A template recipient's button parameter.
  - [Unicom360.WhatsApp.TemplateHeader](Unicom360.WhatsApp.TemplateHeader.md): A template recipient's header parameter.
  - [Unicom360.WhatsApp.TemplateRecipient](Unicom360.WhatsApp.TemplateRecipient.md): One recipient of a template send.

- Results
  - [Unicom360.Balances](Unicom360.Balances.md): The result of `Unicom360.Balance.all/2` (canonical name `Balances`).
  - [Unicom360.Email.Result](Unicom360.Email.Result.md): One recipient of an email send (canonical name `EmailResult`).
  - [Unicom360.Email.SendResult](Unicom360.Email.SendResult.md): The result of `Unicom360.Email.send/3` (canonical name `EmailSendResult`).
  - [Unicom360.Health](Unicom360.Health.md): The result of `Unicom360.health/2` (canonical name `Health`): `status` (`"ok"`), `timestamp`
(an ISO 8601 string, as received), `version`, `environment`, `raw` and `extra`.

  - [Unicom360.SMS.Result](Unicom360.SMS.Result.md): One recipient of an SMS send (canonical name `SmsResult`).
  - [Unicom360.SMS.SendResult](Unicom360.SMS.SendResult.md): The result of `Unicom360.SMS.send/3` (canonical name `SmsSendResult`).
  - [Unicom360.WhatsApp.MessageError](Unicom360.WhatsApp.MessageError.md): Why a WhatsApp message failed: Meta's error `code` (an integer, or `nil`) and its `message`.

  - [Unicom360.WhatsApp.MessageStatus](Unicom360.WhatsApp.MessageStatus.md): The status of one WhatsApp message (canonical name `MessageStatus`).
  - [Unicom360.WhatsApp.SessionSendResult](Unicom360.WhatsApp.SessionSendResult.md): The result of `Unicom360.WhatsApp.send_session/3` (canonical name `SessionSendResult`).
  - [Unicom360.WhatsApp.StatusResult](Unicom360.WhatsApp.StatusResult.md): The result of `Unicom360.WhatsApp.status/3` (canonical name `StatusResult`): `results`, one
`Unicom360.WhatsApp.MessageStatus` per distinct id asked for, plus `api_reference`, `message`,
`raw` and `extra`.

  - [Unicom360.WhatsApp.TemplateButtonInfo](Unicom360.WhatsApp.TemplateButtonInfo.md): A button of an approved template (`Unicom360.WhatsApp.TemplateInfo`): `index`, `type`
(`"url"`, `"quick_reply"`, `"otp"`, ...; open), and `text`, `url` and `otp_type` when the
type has them.

  - [Unicom360.WhatsApp.TemplateInfo](Unicom360.WhatsApp.TemplateInfo.md): An approved WhatsApp template, as `Unicom360.WhatsApp.templates/2` lists it.
  - [Unicom360.WhatsApp.TemplateInfo.Authentication](Unicom360.WhatsApp.TemplateInfo.Authentication.md): An authentication template's `otp_type` and `code_expiration_minutes`.
  - [Unicom360.WhatsApp.TemplateInfo.Body](Unicom360.WhatsApp.TemplateInfo.Body.md): A template's body: its `text` and the names of its `variables`.
  - [Unicom360.WhatsApp.TemplateInfo.Header](Unicom360.WhatsApp.TemplateInfo.Header.md): A template's header: its `type` and the names of its `variables`.
  - [Unicom360.WhatsApp.TemplateList](Unicom360.WhatsApp.TemplateList.md): The result of `Unicom360.WhatsApp.templates/2` (canonical name `TemplateList`): `templates`, a
list of `Unicom360.WhatsApp.TemplateInfo`, plus `api_reference`, `message`, `raw` and `extra`.

  - [Unicom360.WhatsApp.TemplateResult](Unicom360.WhatsApp.TemplateResult.md): One recipient of a template send (canonical name `TemplateResult`).
  - [Unicom360.WhatsApp.TemplateSendResult](Unicom360.WhatsApp.TemplateSendResult.md): The result of `Unicom360.WhatsApp.send_template/3` (canonical name `TemplateSendResult`).

- Webhooks
  - [Unicom360.Webhook](Unicom360.Webhook.md): Verify and parse Unicom360 webhooks, and parse the unsigned SMS and email delivery reports.
  - [Unicom360.Webhook.BodyReader](Unicom360.Webhook.BodyReader.md): A `Plug.Parsers` body reader that keeps the raw body in `conn.assigns.raw_body`.
  - [Unicom360.Webhook.EmailDeliveryReport](Unicom360.Webhook.EmailDeliveryReport.md): An email delivery report, from `Unicom360.Webhook.parse_email_callback/1`: `message_id` (a
string, though the wire sends a number), `status` (`"SENT"`, `"DELIVERED"`, `"FAILED"`; open),
`email_address`, `message`, `raw` and `extra`.
  - [Unicom360.Webhook.Handler](Unicom360.Webhook.Handler.md): The behaviour of the module `Unicom360.Webhook.Plug` calls with each verified event.
  - [Unicom360.Webhook.InboundMedia](Unicom360.Webhook.InboundMedia.md): The media of an inbound WhatsApp message: `id`, `mime_type` and `filename` (`nil` unless a
document), plus `raw` and `extra`. A caption arrives in the message's `text`, not here.

  - [Unicom360.Webhook.InboundMessage](Unicom360.Webhook.InboundMessage.md): The `data` of a `message.received` event.
  - [Unicom360.Webhook.MessageReceivedEvent](Unicom360.Webhook.MessageReceivedEvent.md): A verified `message.received` webhook delivery, from `Unicom360.Webhook.construct_event/4`.
  - [Unicom360.Webhook.MessageStatusData](Unicom360.Webhook.MessageStatusData.md): The `data` of a `message.status` event.
  - [Unicom360.Webhook.MessageStatusEvent](Unicom360.Webhook.MessageStatusEvent.md): A verified `message.status` webhook delivery, from `Unicom360.Webhook.construct_event/4`.
  - [Unicom360.Webhook.Plug](Unicom360.Webhook.Plug.md): A plug that receives Unicom360 webhooks: it verifies the signature, parses the event and
calls your handler.
  - [Unicom360.Webhook.SmsDeliveryReport](Unicom360.Webhook.SmsDeliveryReport.md): An SMS delivery report, from `Unicom360.Webhook.parse_sms_callback/1`: `message_id`, `status`
(`"SENT"`, `"DELIVERED"`, `"FAILED"`, `"UNKNOWN_ERROR"`; open), `mobile_number`, `raw` and
`extra`.
  - [Unicom360.Webhook.TestEvent](Unicom360.Webhook.TestEvent.md): A verified `webhook.test` webhook delivery, from `Unicom360.Webhook.construct_event/4`.
  - [Unicom360.Webhook.TestEventData](Unicom360.Webhook.TestEventData.md): The `data` of a `webhook.test` event: `message`, `raw` and `extra`.
  - [Unicom360.Webhook.UnknownEvent](Unicom360.Webhook.UnknownEvent.md): A verified webhook delivery of an event this version does not know. Never an error.

- Utilities
  - [Unicom360.GSM](Unicom360.GSM.md): Opt-in GSM-7 helpers: the gateway's own answers about an SMS text, before you send it.
  - [Unicom360.TransportError](Unicom360.TransportError.md): A transport failure that states the two facts the retry rules need.

