# supplier This document is auto-generated from the JSDoc comments in `src/store` by running `npm run api-doc`. ## `supplier.create` *Source: `src/store/supplier/create.js`* Creates a new supplier for the user's selected company, recording history. **Parameters** | Name | Type | Description | | --- | --- | --- | | `googleAuthId` | `number` | The id of the Google auth user. | | `input` | `object` | The supplier input. | | `input.name` | `string` | The supplier name. | **Returns** `Promise<{id: number, name: string, createdAt: string, updatedAt: string}>` — The created supplier. **Throws** `Error` — If the name is empty. **Example** ```js const supplier = await store.supplier.create(42, { name: 'Acme Supplies' }); // => { id, name, createdAt, updatedAt } ``` ## `supplier.delete` *Source: `src/store/supplier/delete.js`* Deletes a supplier by its id within the user's selected company. **Parameters** | Name | Type | Description | | --- | --- | --- | | `googleAuthId` | `number` | The id of the Google auth user. | | `id` | `number` | The id of the supplier to delete. | **Returns** `Promise` **Throws** `Error` — If the supplier is not found. **Example** ```js await store.supplier.delete(42, 5); ``` ## `supplier.list` *Source: `src/store/supplier/list.js`* Lists the suppliers of the user's selected company. **Parameters** | Name | Type | Description | | --- | --- | --- | | `googleAuthId` | `number` | The id of the Google auth user. | **Returns** `Promise>` — The suppliers. **Example** ```js const suppliers = await store.supplier.list(42); // => [{ id, name, createdAt, updatedAt }] ``` ## `supplier.update` *Source: `src/store/supplier/update.js`* Updates the name of a supplier, recording history. **Parameters** | Name | Type | Description | | --- | --- | --- | | `googleAuthId` | `number` | The id of the Google auth user. | | `id` | `number` | The id of the supplier to update. | | `input` | `object` | The update input. | | `input.name` | `string` | The new supplier name. | **Returns** `Promise<{id: number, name: string, createdAt: string, updatedAt: string}>` — The updated supplier. **Throws** `Error` — If the supplier is not found or the name is empty. **Example** ```js const supplier = await store.supplier.update(42, 5, { name: 'Acme GmbH' }); // => { id, name, createdAt, updatedAt } ```