Zum Hauptinhalt springen

Interface: ProductRequester

Implement this interface for implementing an api which requests products.

See

AppFeature

Methods

processProductsRequest

processProductsRequest(request): Promise<{ attributeValues?: Record<string, unknown> = ZAttributeValues; filters?: { value?: unknown; field?: string; operation?: FilterOperation; }[] ; pageSize?: number ; pageToken?: string }>

Handle the incoming request and transform it to a QueryProductsRequest.

Parameters

NameType
requestObject
request.body?string
request.headers?Record<string, string>
request.method?string
request.url?string

Returns

Promise<{ attributeValues?: Record<string, unknown> = ZAttributeValues; filters?: { value?: unknown; field?: string; operation?: FilterOperation; }[] ; pageSize?: number ; pageToken?: string }>

Defined in

src/contracts/pull-products/handler/product-requester.ts:16


provideProducts

provideProducts(result): Promise<{ body?: string ; headers?: Record<string, string> ; statusCode?: number }>

Transform the result to the expected response.

Parameters

NameType
resultObject
result.data?{ 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 }[]
result.nextPageToken?string
result.pageSize?number
result.pageToken?string

Returns

Promise<{ body?: string ; headers?: Record<string, string> ; statusCode?: number }>

Defined in

src/contracts/pull-products/handler/product-requester.ts:21