Skip to content
This repository was archived by the owner on Jul 24, 2024. It is now read-only.

Commit 6449f79

Browse files
feat: catalog product children (#726)
1 parent 4b001fd commit 6449f79

File tree

4 files changed

+53
-0
lines changed

4 files changed

+53
-0
lines changed

src/endpoints/catalog.js

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -267,6 +267,30 @@ class Products extends ShopperCatalogProductsQuery {
267267
additionalHeaders
268268
)
269269
}
270+
271+
GetProductChildren({
272+
productId,
273+
token = null,
274+
additionalHeaders = null
275+
}) {
276+
const { limit, offset, filter, includes } = this
277+
278+
return this.request.send(
279+
buildURL(`catalog/${this.endpoint}/${productId}/relationships/children`, {
280+
limit,
281+
offset,
282+
filter,
283+
includes
284+
}),
285+
'GET',
286+
undefined,
287+
token,
288+
undefined,
289+
false,
290+
undefined,
291+
additionalHeaders
292+
)
293+
}
270294
}
271295

272296
class ShopperCatalogEndpoint extends ShopperCatalogQuery {

src/endpoints/catalogs.js

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,22 @@ class Products extends CRUDExtend {
147147
token
148148
)
149149
}
150+
151+
GetCatalogProductChildren({
152+
catalogId,
153+
releaseId,
154+
productId,
155+
token = null
156+
}) {
157+
return this.request.send(
158+
`catalogs/${catalogId}/releases/${releaseId}/${
159+
this.endpoint
160+
}/${productId}/relationships/children`,
161+
'GET',
162+
undefined,
163+
token
164+
)
165+
}
150166
}
151167

152168
class Releases extends CRUDExtend {

src/types/catalog.d.ts

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,12 @@ export interface ShopperCatalogProductsEndpoint
124124
token?: string
125125
additionalHeaders?: ShopperCatalogAdditionalHeaders
126126
}): Promise<ShopperCatalogResourcePage<ProductResponse>>
127+
128+
GetProductChildren(options: {
129+
productId: string
130+
token?: string
131+
additionalHeaders?: ShopperCatalogAdditionalHeaders
132+
}): Promise<ShopperCatalogResourcePage<ProductResponse>>
127133
}
128134

129135
export interface NodesShopperCatalogEndpoint

src/types/catalogs-products.d.ts

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -157,4 +157,11 @@ export interface CatalogsProductsEndpoint {
157157
releaseId: string
158158
token?: string
159159
}): Promise<ResourcePage<PcmProduct>>
160+
161+
GetCatalogProductChildren(options: {
162+
catalogId: string
163+
releaseId: string
164+
productId: string
165+
token?: string
166+
}): Promise<ResourcePage<PcmProduct>>
160167
}

0 commit comments

Comments
 (0)