@teez-sdk/teez-b2c-api 1.0.0 → 1.0.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +0 -2
- package/dist/index.cjs +180 -38
- package/dist/index.cjs.map +1 -1
- package/dist/index.d.cts +142 -0
- package/dist/index.d.mts +142 -0
- package/dist/index.mjs +180 -38
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/dist/index.mjs
CHANGED
|
@@ -46,14 +46,22 @@ const BannersApiListResponseSchema = z.array(BannersApiBannerItemSchema);
|
|
|
46
46
|
* API for retrieving promotional and informational banners.
|
|
47
47
|
*/
|
|
48
48
|
var BannersApi = class {
|
|
49
|
+
/**
|
|
50
|
+
* Initializes a new instance of the BannersApi.
|
|
51
|
+
*
|
|
52
|
+
* @param http HTTP client instance.
|
|
53
|
+
*/
|
|
49
54
|
constructor(http) {
|
|
50
55
|
this.http = http;
|
|
51
56
|
}
|
|
52
57
|
/**
|
|
53
58
|
* Retrieves a list of active banners.
|
|
59
|
+
*
|
|
60
|
+
* @example
|
|
61
|
+
* const banners = await client.banners.list();
|
|
54
62
|
*/
|
|
55
|
-
|
|
56
|
-
return
|
|
63
|
+
list(params = {}) {
|
|
64
|
+
return this.http.get({
|
|
57
65
|
path: "/api/v3/banners",
|
|
58
66
|
params,
|
|
59
67
|
schema: BannersApiListResponseSchema
|
|
@@ -115,14 +123,22 @@ const CategoriesApiGetParentsResponseSchema = z.array(CategoriesApiGetParentsRes
|
|
|
115
123
|
* API for retrieving product category information.
|
|
116
124
|
*/
|
|
117
125
|
var CategoriesApi = class {
|
|
126
|
+
/**
|
|
127
|
+
* Initializes a new instance of the CategoriesApi.
|
|
128
|
+
*
|
|
129
|
+
* @param http HTTP client instance.
|
|
130
|
+
*/
|
|
118
131
|
constructor(http) {
|
|
119
132
|
this.http = http;
|
|
120
133
|
}
|
|
121
134
|
/**
|
|
122
135
|
* Retrieves a list of all categories.
|
|
136
|
+
*
|
|
137
|
+
* @example
|
|
138
|
+
* const categories = await client.categories.list();
|
|
123
139
|
*/
|
|
124
|
-
|
|
125
|
-
return
|
|
140
|
+
list(params = {}) {
|
|
141
|
+
return this.http.get({
|
|
126
142
|
path: "/categories",
|
|
127
143
|
params,
|
|
128
144
|
schema: CategoriesApiListResponseSchema
|
|
@@ -130,9 +146,14 @@ var CategoriesApi = class {
|
|
|
130
146
|
}
|
|
131
147
|
/**
|
|
132
148
|
* Retrieves detailed information about a specific category by its ID.
|
|
149
|
+
*
|
|
150
|
+
* @example
|
|
151
|
+
* const category = await client.categories.get({
|
|
152
|
+
* categoryId: 1234
|
|
153
|
+
* });
|
|
133
154
|
*/
|
|
134
|
-
|
|
135
|
-
return
|
|
155
|
+
get(params) {
|
|
156
|
+
return this.http.get({
|
|
136
157
|
path: `/categories/${params.categoryId}`,
|
|
137
158
|
params,
|
|
138
159
|
schema: CategoriesApiGetResponseSchema
|
|
@@ -140,9 +161,14 @@ var CategoriesApi = class {
|
|
|
140
161
|
}
|
|
141
162
|
/**
|
|
142
163
|
* Retrieves parent categories for specific category IDs.
|
|
164
|
+
*
|
|
165
|
+
* @example
|
|
166
|
+
* const parents = await client.categories.getParents({
|
|
167
|
+
* categoryId: [123, 456]
|
|
168
|
+
* });
|
|
143
169
|
*/
|
|
144
|
-
|
|
145
|
-
return
|
|
170
|
+
getParents(params) {
|
|
171
|
+
return this.http.get({
|
|
146
172
|
path: "/api/v1/categories/parents",
|
|
147
173
|
params,
|
|
148
174
|
schema: CategoriesApiGetParentsResponseSchema
|
|
@@ -285,14 +311,25 @@ const CollectionsApiGetResponseSchema = z.object({
|
|
|
285
311
|
* API for retrieving curated collections of products.
|
|
286
312
|
*/
|
|
287
313
|
var CollectionsApi = class {
|
|
314
|
+
/**
|
|
315
|
+
* Initializes a new instance of the CollectionsApi.
|
|
316
|
+
*
|
|
317
|
+
* @param http HTTP client instance.
|
|
318
|
+
*/
|
|
288
319
|
constructor(http) {
|
|
289
320
|
this.http = http;
|
|
290
321
|
}
|
|
291
322
|
/**
|
|
292
323
|
* Retrieves a list of SKUs belonging to a specific collection with pagination and sorting.
|
|
324
|
+
*
|
|
325
|
+
* @example
|
|
326
|
+
* const skus = await client.collections.getSkus({
|
|
327
|
+
* collectionId: 123,
|
|
328
|
+
* pageSize: 10
|
|
329
|
+
* });
|
|
293
330
|
*/
|
|
294
|
-
|
|
295
|
-
return
|
|
331
|
+
getSkus(params) {
|
|
332
|
+
return this.http.get({
|
|
296
333
|
path: "/api/v2/collections/skus",
|
|
297
334
|
params,
|
|
298
335
|
schema: CollectionsApiGetSkusResponseSchema
|
|
@@ -300,9 +337,12 @@ var CollectionsApi = class {
|
|
|
300
337
|
}
|
|
301
338
|
/**
|
|
302
339
|
* Retrieves a list of all collections.
|
|
340
|
+
*
|
|
341
|
+
* @example
|
|
342
|
+
* const collections = await client.collections.list();
|
|
303
343
|
*/
|
|
304
|
-
|
|
305
|
-
return
|
|
344
|
+
list(params = {}) {
|
|
345
|
+
return this.http.get({
|
|
306
346
|
path: "/collections",
|
|
307
347
|
params,
|
|
308
348
|
schema: CollectionsApiListResponseSchema
|
|
@@ -310,9 +350,14 @@ var CollectionsApi = class {
|
|
|
310
350
|
}
|
|
311
351
|
/**
|
|
312
352
|
* Retrieves detailed information about a specific collection by its ID.
|
|
353
|
+
*
|
|
354
|
+
* @example
|
|
355
|
+
* const collection = await client.collections.get({
|
|
356
|
+
* collectionId: 123
|
|
357
|
+
* });
|
|
313
358
|
*/
|
|
314
|
-
|
|
315
|
-
return
|
|
359
|
+
get(params) {
|
|
360
|
+
return this.http.get({
|
|
316
361
|
path: `/collections/${params.collectionId}`,
|
|
317
362
|
params,
|
|
318
363
|
schema: CollectionsApiGetResponseSchema
|
|
@@ -340,14 +385,22 @@ const FeatureFlagsApiListResponseSchema = z.array(FeatureFlagsApiItemSchema);
|
|
|
340
385
|
* API for retrieving feature flags configuration.
|
|
341
386
|
*/
|
|
342
387
|
var FeatureFlagsApi = class {
|
|
388
|
+
/**
|
|
389
|
+
* Initializes a new instance of the FeatureFlagsApi.
|
|
390
|
+
*
|
|
391
|
+
* @param http HTTP client instance.
|
|
392
|
+
*/
|
|
343
393
|
constructor(http) {
|
|
344
394
|
this.http = http;
|
|
345
395
|
}
|
|
346
396
|
/**
|
|
347
397
|
* Retrieves all active feature flags.
|
|
398
|
+
*
|
|
399
|
+
* @example
|
|
400
|
+
* const flags = await client.featureFlags.list();
|
|
348
401
|
*/
|
|
349
|
-
|
|
350
|
-
return
|
|
402
|
+
list(params = {}) {
|
|
403
|
+
return this.http.get({
|
|
351
404
|
path: "/api/v1/feature-flags",
|
|
352
405
|
params,
|
|
353
406
|
schema: FeatureFlagsApiListResponseSchema
|
|
@@ -463,14 +516,22 @@ const ProductsApiListResponseSchema = z.object({
|
|
|
463
516
|
* API for retrieving product listings, details, and reviews.
|
|
464
517
|
*/
|
|
465
518
|
var ProductsApi = class {
|
|
519
|
+
/**
|
|
520
|
+
* Initializes a new instance of the ProductsApi.
|
|
521
|
+
*
|
|
522
|
+
* @param http HTTP client instance.
|
|
523
|
+
*/
|
|
466
524
|
constructor(http) {
|
|
467
525
|
this.http = http;
|
|
468
526
|
}
|
|
469
527
|
/**
|
|
470
528
|
* Retrieves available sorting options for product lists.
|
|
529
|
+
*
|
|
530
|
+
* @example
|
|
531
|
+
* const sortOptions = await client.products.getSortOptions();
|
|
471
532
|
*/
|
|
472
|
-
|
|
473
|
-
return
|
|
533
|
+
getSortOptions(params = {}) {
|
|
534
|
+
return this.http.get({
|
|
474
535
|
path: "/api/product/sort-options",
|
|
475
536
|
params,
|
|
476
537
|
schema: ProductsApiGetSortOptionsResponseSchema
|
|
@@ -478,9 +539,15 @@ var ProductsApi = class {
|
|
|
478
539
|
}
|
|
479
540
|
/**
|
|
480
541
|
* Retrieves a list of products with optional filtering and pagination.
|
|
542
|
+
*
|
|
543
|
+
* @example
|
|
544
|
+
* const products = await client.products.list({
|
|
545
|
+
* pageSize: 20,
|
|
546
|
+
* pageNumber: 1
|
|
547
|
+
* });
|
|
481
548
|
*/
|
|
482
|
-
|
|
483
|
-
return
|
|
549
|
+
list(params = {}) {
|
|
550
|
+
return this.http.get({
|
|
484
551
|
path: "/api/v2/product",
|
|
485
552
|
params,
|
|
486
553
|
schema: ProductsApiListResponseSchema
|
|
@@ -488,9 +555,14 @@ var ProductsApi = class {
|
|
|
488
555
|
}
|
|
489
556
|
/**
|
|
490
557
|
* Retrieves reviews for a specific product.
|
|
558
|
+
*
|
|
559
|
+
* @example
|
|
560
|
+
* const reviews = await client.products.getReviews({
|
|
561
|
+
* productId: 12345
|
|
562
|
+
* });
|
|
491
563
|
*/
|
|
492
|
-
|
|
493
|
-
return
|
|
564
|
+
getReviews(params) {
|
|
565
|
+
return this.http.get({
|
|
494
566
|
path: `/api/v1/product/${params.productId}/review`,
|
|
495
567
|
params,
|
|
496
568
|
schema: ProductsApiGetReviewsResponseSchema
|
|
@@ -522,14 +594,22 @@ const PromoApiListResponseSchema = z.array(PromoApiItemSchema);
|
|
|
522
594
|
* API for retrieving active promotions.
|
|
523
595
|
*/
|
|
524
596
|
var PromoApi = class {
|
|
597
|
+
/**
|
|
598
|
+
* Initializes a new instance of the PromoApi.
|
|
599
|
+
*
|
|
600
|
+
* @param http HTTP client instance.
|
|
601
|
+
*/
|
|
525
602
|
constructor(http) {
|
|
526
603
|
this.http = http;
|
|
527
604
|
}
|
|
528
605
|
/**
|
|
529
606
|
* Retrieves a list of all active promotions.
|
|
607
|
+
*
|
|
608
|
+
* @example
|
|
609
|
+
* const promos = await client.promo.list();
|
|
530
610
|
*/
|
|
531
|
-
|
|
532
|
-
return
|
|
611
|
+
list(params = {}) {
|
|
612
|
+
return this.http.get({
|
|
533
613
|
path: "/api/promo",
|
|
534
614
|
params,
|
|
535
615
|
schema: PromoApiListResponseSchema
|
|
@@ -646,14 +726,24 @@ const ShopsApiGetProductsResponseSchema = z.object({
|
|
|
646
726
|
* API for interacting with shop-related endpoints.
|
|
647
727
|
*/
|
|
648
728
|
var ShopsApi = class {
|
|
729
|
+
/**
|
|
730
|
+
* Initializes a new instance of the ShopsApi.
|
|
731
|
+
*
|
|
732
|
+
* @param http HTTP client instance.
|
|
733
|
+
*/
|
|
649
734
|
constructor(http) {
|
|
650
735
|
this.http = http;
|
|
651
736
|
}
|
|
652
737
|
/**
|
|
653
738
|
* Retrieves details of a specific shop.
|
|
739
|
+
*
|
|
740
|
+
* @example
|
|
741
|
+
* const shop = await client.shops.get({
|
|
742
|
+
* shopId: 123
|
|
743
|
+
* });
|
|
654
744
|
*/
|
|
655
|
-
|
|
656
|
-
return
|
|
745
|
+
get(params) {
|
|
746
|
+
return this.http.get({
|
|
657
747
|
path: `/api/v1/shops/${params.shopId}`,
|
|
658
748
|
params,
|
|
659
749
|
schema: ShopsApiGetResponseSchema
|
|
@@ -661,9 +751,12 @@ var ShopsApi = class {
|
|
|
661
751
|
}
|
|
662
752
|
/**
|
|
663
753
|
* Retrieves monobrand shop details.
|
|
754
|
+
*
|
|
755
|
+
* @example
|
|
756
|
+
* const monobrand = await client.shops.getMonobrand();
|
|
664
757
|
*/
|
|
665
|
-
|
|
666
|
-
return
|
|
758
|
+
getMonobrand(params = {}) {
|
|
759
|
+
return this.http.get({
|
|
667
760
|
path: "/api/v1/shops/monobrand",
|
|
668
761
|
params,
|
|
669
762
|
schema: ShopsApiGetMonobrandResponseSchema
|
|
@@ -671,9 +764,15 @@ var ShopsApi = class {
|
|
|
671
764
|
}
|
|
672
765
|
/**
|
|
673
766
|
* Retrieves products for a specific shop.
|
|
767
|
+
*
|
|
768
|
+
* @example
|
|
769
|
+
* const shopProducts = await client.shops.getProducts({
|
|
770
|
+
* shopId: 123,
|
|
771
|
+
* pageSize: 10
|
|
772
|
+
* });
|
|
674
773
|
*/
|
|
675
|
-
|
|
676
|
-
return
|
|
774
|
+
getProducts(params) {
|
|
775
|
+
return this.http.get({
|
|
677
776
|
path: `/api/v2/shops/${params.shopId}/products`,
|
|
678
777
|
params,
|
|
679
778
|
schema: ShopsApiGetProductsResponseSchema
|
|
@@ -856,14 +955,24 @@ const SkuApiGetReviewAvailableResponseSchema = z.object({
|
|
|
856
955
|
* API for interacting with SKU-related endpoints.
|
|
857
956
|
*/
|
|
858
957
|
var SkuApi = class {
|
|
958
|
+
/**
|
|
959
|
+
* Initializes a new instance of the SkuApi.
|
|
960
|
+
*
|
|
961
|
+
* @param http HTTP client instance.
|
|
962
|
+
*/
|
|
859
963
|
constructor(http) {
|
|
860
964
|
this.http = http;
|
|
861
965
|
}
|
|
862
966
|
/**
|
|
863
967
|
* Retrieves details of a specific SKU.
|
|
968
|
+
*
|
|
969
|
+
* @example
|
|
970
|
+
* const sku = await client.sku.get({
|
|
971
|
+
* skuId: 123
|
|
972
|
+
* });
|
|
864
973
|
*/
|
|
865
|
-
|
|
866
|
-
return
|
|
974
|
+
get(params) {
|
|
975
|
+
return this.http.get({
|
|
867
976
|
path: `/api/v2/sku/${params.skuId}`,
|
|
868
977
|
params,
|
|
869
978
|
schema: SkuApiGetResponseSchema
|
|
@@ -871,9 +980,14 @@ var SkuApi = class {
|
|
|
871
980
|
}
|
|
872
981
|
/**
|
|
873
982
|
* Retrieves similar SKUs.
|
|
983
|
+
*
|
|
984
|
+
* @example
|
|
985
|
+
* const similar = await client.sku.getSimilar({
|
|
986
|
+
* skuId: 123
|
|
987
|
+
* });
|
|
874
988
|
*/
|
|
875
|
-
|
|
876
|
-
return
|
|
989
|
+
getSimilar(params) {
|
|
990
|
+
return this.http.get({
|
|
877
991
|
path: "/api/v2/sku/similar-skus",
|
|
878
992
|
params,
|
|
879
993
|
schema: SkuApiGetSimilarResponseSchema
|
|
@@ -881,9 +995,14 @@ var SkuApi = class {
|
|
|
881
995
|
}
|
|
882
996
|
/**
|
|
883
997
|
* Retrieves collections associated with a SKU.
|
|
998
|
+
*
|
|
999
|
+
* @example
|
|
1000
|
+
* const collections = await client.sku.getCollections({
|
|
1001
|
+
* skuId: 123
|
|
1002
|
+
* });
|
|
884
1003
|
*/
|
|
885
|
-
|
|
886
|
-
return
|
|
1004
|
+
getCollections(params) {
|
|
1005
|
+
return this.http.get({
|
|
887
1006
|
path: `/sku/${params.skuId}/collections`,
|
|
888
1007
|
params,
|
|
889
1008
|
schema: SkuApiGetCollectionsResponseSchema
|
|
@@ -891,9 +1010,14 @@ var SkuApi = class {
|
|
|
891
1010
|
}
|
|
892
1011
|
/**
|
|
893
1012
|
* Checks if a review is available for a SKU.
|
|
1013
|
+
*
|
|
1014
|
+
* @example
|
|
1015
|
+
* const isAvailable = await client.sku.getReviewAvailable({
|
|
1016
|
+
* skuId: 123
|
|
1017
|
+
* });
|
|
894
1018
|
*/
|
|
895
|
-
|
|
896
|
-
return
|
|
1019
|
+
getReviewAvailable(params) {
|
|
1020
|
+
return this.http.get({
|
|
897
1021
|
path: `/sku/${params.skuId}/review-available`,
|
|
898
1022
|
params,
|
|
899
1023
|
schema: SkuApiGetReviewAvailableResponseSchema
|
|
@@ -1149,6 +1273,11 @@ var HttpClient = class {
|
|
|
1149
1273
|
* Request timeout in milliseconds.
|
|
1150
1274
|
*/
|
|
1151
1275
|
timeout;
|
|
1276
|
+
/**
|
|
1277
|
+
* Initializes a new instance of the HttpClient.
|
|
1278
|
+
*
|
|
1279
|
+
* @param config Resolved client configuration.
|
|
1280
|
+
*/
|
|
1152
1281
|
constructor(config) {
|
|
1153
1282
|
this.baseUrl = config.baseUrl;
|
|
1154
1283
|
this.headers = buildHeaders(config);
|
|
@@ -1156,6 +1285,8 @@ var HttpClient = class {
|
|
|
1156
1285
|
}
|
|
1157
1286
|
/**
|
|
1158
1287
|
* Performs a low-level HTTP request.
|
|
1288
|
+
*
|
|
1289
|
+
* @param options Request options.
|
|
1159
1290
|
*/
|
|
1160
1291
|
async request(options) {
|
|
1161
1292
|
const { url, headers, ...fetchOptions } = options;
|
|
@@ -1220,6 +1351,12 @@ var HttpClient = class {
|
|
|
1220
1351
|
//#region src/client.ts
|
|
1221
1352
|
/**
|
|
1222
1353
|
* Main client for interacting with the Teez B2C API.
|
|
1354
|
+
*
|
|
1355
|
+
* @example
|
|
1356
|
+
* const client = new TeezClient({
|
|
1357
|
+
* language: "ru",
|
|
1358
|
+
* timeout: 10000
|
|
1359
|
+
* });
|
|
1223
1360
|
*/
|
|
1224
1361
|
var TeezClient = class {
|
|
1225
1362
|
/**
|
|
@@ -1262,6 +1399,11 @@ var TeezClient = class {
|
|
|
1262
1399
|
* API for retrieving SKU details.
|
|
1263
1400
|
*/
|
|
1264
1401
|
sku;
|
|
1402
|
+
/**
|
|
1403
|
+
* Initializes a new instance of the TeezClient.
|
|
1404
|
+
*
|
|
1405
|
+
* @param config Optional client configuration.
|
|
1406
|
+
*/
|
|
1265
1407
|
constructor(config) {
|
|
1266
1408
|
this.config = resolveConfig(config);
|
|
1267
1409
|
this.http = new HttpClient(this.config);
|