Zum Hauptinhalt springen

Interface: ProductsUpdateConsumer

Implement this interface for APIs that can receive product updates.

Methods

updateProducts

updateProducts(request): Promise<{ attributeValues?: Record<string, unknown> = ZAttributeValues; availability?: { amount?: number; stockId?: string; stockName?: string; attributeValues?: Record<string, unknown>; }[] ; description?: string ; details?: Record<string, string> ; grossPrice?: { value?: number; divisor?: number; currencyCode?: string; } ; gtin?: string ; id?: string ; images?: { url?: string; isDefault?: boolean; attributeValues?: Record<string, unknown>; }[] ; manufacturer?: string ; name?: string ; netPrice?: { value?: number; divisor?: number; currencyCode?: string; } ; sku?: string ; taxRate?: number ; variationParentId?: string ; weightInGrams?: number }[]>

Updates a set of products.

Parameters

NameTypeDescription
requestObjectThe request that contain details for patching products
request.fields?[{ field?: string; operation?: PatchOperation.Remove; } | { field?: string ; operation?: Append ; value?: unknown } | { field?: string ; operation?: Set ; value?: unknown }, ...(({ field?: string; operation?: PatchOperation.Remove; }) | Object | Object)[]]-
request.filters?[{ field?: string ; operation?: FilterOperation ; value?: unknown }, ...Object[]]-

Returns

Promise<{ attributeValues?: Record<string, unknown> = ZAttributeValues; availability?: { amount?: number; stockId?: string; stockName?: string; attributeValues?: Record<string, unknown>; }[] ; description?: string ; details?: Record<string, string> ; grossPrice?: { value?: number; divisor?: number; currencyCode?: string; } ; gtin?: string ; id?: string ; images?: { url?: string; isDefault?: boolean; attributeValues?: Record<string, unknown>; }[] ; manufacturer?: string ; name?: string ; netPrice?: { value?: number; divisor?: number; currencyCode?: string; } ; sku?: string ; taxRate?: number ; variationParentId?: string ; weightInGrams?: number }[]>

The list of patched products

Remarks

The request contain filters. All products that match against all filters are updated.

Example

Request:

{
filters: [
{field: 'manufacturer', operation: FilterOperation.Equal, value: 'My manufacturer'}
{field: 'taxRate', operation: FilterOperation.NotEqual, value: 19}
],
fields: [
{field: 'manufacturer', operation: PatchOperation.Remove}
]
}

Defined in

src/contracts/patch-products/handler/products-update-consumer.ts:33