# entitycontact This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`. ## `entitycontact.create` *Source: `src/store/entitycontact/create.js`* Creates a new contact for an entity. **Parameters** | Name | Type | Description | | --- | --- | --- | | `googleAuthId` | `number` | The id of the Google auth user. | | `entityId` | `number` | The id of the entity. | | `input` | `object` | The contact input. | | `input.contactType` | `string` | The contact type (e.g. `'email'`). | | `input.contact` | `string` | The contact value. | | `[input.sort]` | `number` | Optional sort order. | **Returns** `Promise<{id: number, entityId: number, contactType: string, contact: string, sort: number}>` — The created contact. **Throws** `Error` — If the contact type or value is missing. **Example** ```js const contact = await store.entitycontact.create(42, 5, { contactType: 'email', contact: 'a@b.c' }); // => { id, entityId, contactType, contact, sort } ``` ## `entitycontact.delete` *Source: `src/store/entitycontact/delete.js`* Deletes a contact of an entity. **Parameters** | Name | Type | Description | | --- | --- | --- | | `googleAuthId` | `number` | The id of the Google auth user. | | `entityId` | `number` | The id of the entity. | | `id` | `number` | The id of the contact to delete. | **Returns** `Promise` **Throws** `Error` — If the contact is not found. **Example** ```js await store.entitycontact.delete(42, 5, 9); ``` ## `entitycontact.list` *Source: `src/store/entitycontact/list.js`* Lists the contacts of an entity. **Parameters** | Name | Type | Description | | --- | --- | --- | | `googleAuthId` | `number` | The id of the Google auth user. | | `entityId` | `number` | The id of the entity. | **Returns** `Promise>` — The contacts. **Example** ```js const contacts = await store.entitycontact.list(42, 5); // => [{ id, entityId, contactType, contact, sort }] ``` ## `entitycontact.update` *Source: `src/store/entitycontact/update.js`* Updates a contact of an entity. **Parameters** | Name | Type | Description | | --- | --- | --- | | `googleAuthId` | `number` | The id of the Google auth user. | | `entityId` | `number` | The id of the entity. | | `id` | `number` | The id of the contact to update. | | `patch` | `object` | The update patch (any subset of contact fields). | **Returns** `Promise<{id: number, entityId: number, contactType: string, contact: string, sort: number}>` — The updated contact. **Throws** `Error` — If the contact is not found. **Example** ```js const contact = await store.entitycontact.update(42, 5, 9, { contact: 'b@c.d' }); // => { id, entityId, contactType, contact, sort } ```