Files
dashlibstorage/API.entityaddress.md

4.0 KiB

entityaddress

This document is auto-generated from the JSDoc comments in src/store by running npm run api-doc.

entityaddress.create

Source: src/store/entityaddress/create.js

Creates a new address 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 address input.
input.addressType string The address type (e.g. 'billing').
[input.firstName] string The first name.
[input.name] string The name.
[input.street] string The street.
[input.streetNumber] string The street number.
[input.zip] string The zip code.
[input.city] string The city.
[input.county] string The county.
[input.sort] number Optional sort order.

Returns

Promise<{id: number, entityId: number, firstName: string|null, name: string|null, street: string|null, streetNumber: string|null, zip: string|null, city: string|null, county: string|null, addressType: string, sort: number}> — The created address.

Throws

Error — If the address type is missing.

Example

const address = await store.entityaddress.create(42, 5, { addressType: 'billing', street: 'Main St', city: 'Berlin' });
// => { id, entityId, firstName, name, street, streetNumber, zip, city, county, addressType, sort }

entityaddress.delete

Source: src/store/entityaddress/delete.js

Deletes an address 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 address to delete.

Returns

Promise<void>

Throws

Error — If the address is not found.

Example

await store.entityaddress.delete(42, 5, 9);

entityaddress.list

Source: src/store/entityaddress/list.js

Lists the addresses 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<Array<{id: number, entityId: number, firstName: string|null, name: string|null, street: string|null, streetNumber: string|null, zip: string|null, city: string|null, county: string|null, addressType: string, sort: number}>> — The addresses.

Example

const addresses = await store.entityaddress.list(42, 5);
// => [{ id, entityId, firstName, name, street, streetNumber, zip, city, county, addressType, sort }]

entityaddress.update

Source: src/store/entityaddress/update.js

Updates an address 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 address to update.
patch object The update patch (any subset of address fields).
[patch.addressType] string The address type.
[patch.firstName] string The first name.
[patch.name] string The name.
[patch.street] string The street.
[patch.streetNumber] string The street number.
[patch.zip] string The zip code.
[patch.city] string The city.
[patch.county] string The county.
[patch.sort] number The sort order.

Returns

Promise<{id: number, entityId: number, firstName: string|null, name: string|null, street: string|null, streetNumber: string|null, zip: string|null, city: string|null, county: string|null, addressType: string, sort: number}> — The updated address.

Throws

Error — If the address is not found.

Example

const address = await store.entityaddress.update(42, 5, 9, { city: 'Hamburg' });
// => { id, entityId, firstName, name, street, streetNumber, zip, city, county, addressType, sort }