ExWapp.Domains.Contacts.Repository (ExWapp v0.1.2)

Copy Markdown View Source

Persists normalized contacts in an ExWapp.Store.

Every lookup and write canonicalizes the JID and removes legacy aliases, so consumers see one contact record regardless of the identifier form received from the wire.

Summary

Functions

Deletes a contact and every legacy alias for the same JID.

Fetches a contact by JID, including records stored under legacy aliases.

Lists all normalized contacts currently stored.

Merges contact fields decoded from app-state synchronization.

Stores a contact under its canonical JID and removes duplicate aliases.

Updates the push name associated with a contact.

Functions

delete(store, jid)

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

Deletes a contact and every legacy alias for the same JID.

get(store, jid)

@spec get(
  struct(),
  String.t()
) :: ExWapp.Contact.t() | nil

Fetches a contact by JID, including records stored under legacy aliases.

list(store)

@spec list(struct()) :: [ExWapp.Contact.t()]

Lists all normalized contacts currently stored.

merge_from_sync(store, jid, contact_action)

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

Merges contact fields decoded from app-state synchronization.

put(store, jid, contact)

@spec put(struct(), String.t(), ExWapp.Contact.t()) :: :ok

Stores a contact under its canonical JID and removes duplicate aliases.

update_push_name(store, jid, name)

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

Updates the push name associated with a contact.