# `Unicom360.WhatsApp.TemplateSendResult`
[🔗](https://github.com/TechRode-Solution-Limited/unicom360-elixir/blob/v0.1.0/lib/unicom360/whatsapp/template_send_result.ex#L1)

The result of `Unicom360.WhatsApp.send_template/3` (canonical name `TemplateSendResult`).

  * `api_reference`, `message` - from the envelope.
  * `accepted_count`, `rejected_count` - how many recipients were queued and rejected (the
    API's `accepted` and `rejected`; `accepted/1` and `rejected/1` return the results).
  * `results` - one `Unicom360.WhatsApp.TemplateResult` per recipient.
  * `raw`, `extra` - the JSON object, and the members this version does not model.

A rejected recipient is not an error. When **every** recipient is rejected the send fails with
a `NoValidRecipientsError` (`%Unicom360.Error{code: "NO_VALID_RECIPIENTS"}`), whose `results`
say why.

# `t`

```elixir
@type t() :: %Unicom360.WhatsApp.TemplateSendResult{
  accepted_count: non_neg_integer() | nil,
  api_reference: String.t() | nil,
  extra: map(),
  message: String.t() | nil,
  raw: map(),
  rejected_count: non_neg_integer() | nil,
  results: [Unicom360.WhatsApp.TemplateResult.t()]
}
```

# `accepted`

```elixir
@spec accepted(t()) :: [Unicom360.WhatsApp.TemplateResult.t()]
```

The queued results (status exactly `"ACKNOWLEDGED"`), in response order.

# `by_number`

```elixir
@spec by_number(t(), String.t()) :: Unicom360.WhatsApp.TemplateResult.t() | nil
```

The first result whose `to` has the same digits as `number`, or `nil`.

# `rejected`

```elixir
@spec rejected(t()) :: [Unicom360.WhatsApp.TemplateResult.t()]
```

The rejected results (status exactly `"REJECTED"`), in response order.

---

*Consult [api-reference.md](api-reference.md) for complete listing*
