import type { Contact, ContactDeleteResult, CreateContactInput, ListContactsQuery, Paginated, UpdateContactInput } from '../../types'; import type { HttpClient } from '../../http'; /** * Contacts: the people an account talks to, and the resource everything else in * the audience module hangs off. * * Scoping: contacts belong to an account, and a request carries two identities * -- the caller and the account they act for. Reads match either; writes land * on the caller's own. */ export declare class Contacts { private readonly http; constructor(http: HttpClient); /** * `GET /v1/audience/contacts` -- offset paginated. * * `search` matches the first and last name plus the name and identifier of * every channel identity. `segment` replays a saved filter; `filter` carries * ad-hoc conditions, serialised to JSON on the query string by the SDK. * Sending both narrows the segment rather than replacing it, and `tag`, * `agent` and `status` narrow whatever those produce. * * Defaults to `status: 'live'`, so the trash needs an explicit * `status: 'trashed'`. * * Scope: `contacts:read`. */ list(query?: Partial): Promise>; /** * `GET /v1/audience/contacts/:id` -- one contact with its tags resolved. * 404 `not_found` if no contact with that id belongs to the caller. * * Scope: `contacts:read`. */ get(id: string): Promise; /** * `POST /v1/audience/contacts` -- 201 with the created contact. * * Every field is optional: an empty body creates a blank contact. Such a * contact has no channel identity, which means nothing can message it and an * inbound message will not be matched to it -- so pass `whatsapp` unless the * contact is genuinely a placeholder. * * `whatsapp` takes a number in any shape and is stored as digits only, which * is the form an inbound message carries. It creates the contact's WhatsApp * identity and is reflected back under `profile.whatsapp` on the response. * Other channels' identities are still written by the conversation that starts * on them. * * 409 `conflict` if the account already holds that WhatsApp number, on another * contact or on this one -- a number identifies one contact per account, so * nothing is created and the existing contact is left alone. 422 if the value * contains no digits at all. * * Scope: `contacts:write`. */ create(input?: CreateContactInput): Promise; /** * `PATCH /v1/audience/contacts/:id` -- a partial update; anything left out is * untouched. `tags` and `custom_field_hash` replace their stored value rather * than merging into it. * * `whatsapp` is not accepted: a channel identity lives in its own collection, * and changing one is a different write from patching the contact. It is * create-only for now. * * Scope: `contacts:write`. */ update(id: string, input: UpdateContactInput): Promise; /** * `DELETE /v1/audience/contacts/:id` -- two-stage, and 200 rather than 204 * both times: the body is what says which stage ran. * * The first call moves the contact to the trash (`status: 'trashed'`); a * second call on an already-trashed contact destroys it along with its notes * and channel identities (`status: 'deleted'`). * * Scope: `contacts:write`. */ delete(id: string): Promise; /** * Walks every page of `list`, yielding one contact at a time. Takes the same * query as `list`; `page` is managed here and is ignored if passed. * * ```ts * for await (const contact of crm.contacts.iterate({ tag: tagId })) { * console.log(contact.id); * } * ``` */ iterate(query?: Partial): AsyncGenerator; }