# `ExWapp.Contact`
[🔗](https://github.com/elchemista/ex_wapp/blob/v0.1.5/lib/ex_wapp/contact.ex#L2)

Contact struct and local CRUD operations.

Contact data is populated from:
- App state sync patches (field "contact" in critical_unblock_low)
- Incoming message notify attribute (push name)
- History sync data

# `t`

```elixir
@type t() :: %ExWapp.Contact{
  first_name: String.t() | nil,
  full_name: String.t() | nil,
  jid: String.t(),
  lid: String.t() | nil,
  phone_number: String.t() | nil,
  push_name: String.t() | nil,
  username: String.t() | nil
}
```

# `delete`

```elixir
@spec delete(struct(), String.t()) :: :ok
```

Delete a contact by JID.

# `get`

```elixir
@spec get(struct(), String.t()) :: t() | nil
```

Get a contact by JID.

# `list`

```elixir
@spec list(struct()) :: [t()]
```

List all contacts from the store.

# `merge_from_sync`

```elixir
@spec merge_from_sync(struct(), String.t(), map()) :: :ok
```

Merge contact data from an app state sync ContactAction.

# `put`

```elixir
@spec put(struct(), String.t(), t()) :: :ok
```

Put (create or update) a contact.

# `update_push_name`

```elixir
@spec update_push_name(struct(), String.t(), String.t()) :: :ok
```

Update push name for a contact (from incoming message notify attr).

# `vcard`

```elixir
@spec vcard(String.t(), String.t()) :: String.t()
```

Builds a WhatsApp-compatible vCard 3.0 payload for `send_contact/5`.

The `waid` parameter is normalized to digits while the displayed telephone
number keeps its leading `+` when one was supplied.

---

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