Skip to content

Commit 4fd6888

Browse files
author
George Botzakis
committed
feat: Added GetRelatedProducts endpoint method to ShopperCatalog.Products
1 parent 09ec27c commit 4fd6888

File tree

2 files changed

+32
-0
lines changed

2 files changed

+32
-0
lines changed

src/endpoints/catalog.js

+25
Original file line numberDiff line numberDiff line change
@@ -315,6 +315,31 @@ class Products extends ShopperCatalogProductsQuery {
315315
additionalHeaders
316316
)
317317
}
318+
319+
GetRelatedProducts({
320+
productId,
321+
customRelationshipSlug,
322+
token = null,
323+
additionalHeaders = null
324+
}) {
325+
const { limit, offset, filter, includes } = this
326+
327+
return this.request.send(
328+
buildURL(`catalog/${this.endpoint}/${productId}/relationships/${customRelationshipSlug}/products`, {
329+
limit,
330+
offset,
331+
filter,
332+
includes
333+
}),
334+
'GET',
335+
undefined,
336+
token,
337+
undefined,
338+
false,
339+
undefined,
340+
additionalHeaders
341+
)
342+
}
318343
}
319344

320345
class ShopperCatalogEndpoint extends ShopperCatalogQuery {

src/types/catalog.d.ts

+7
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,13 @@ export interface ShopperCatalogProductsEndpoint
167167
token?: string
168168
additionalHeaders?: ShopperCatalogAdditionalHeaders
169169
}): Promise<ShopperCatalogResourcePage<ProductResponse>>
170+
171+
GetRelatedProducts(options: {
172+
productId: string
173+
customRelationshipSlug: string
174+
token?: string
175+
additionalHeaders?: ShopperCatalogAdditionalHeaders
176+
}): Promise<ShopperCatalogResourcePage<ProductResponse>>
170177
}
171178

172179
export interface NodesShopperCatalogEndpoint

0 commit comments

Comments
 (0)