@gofynd/fdk-client-javascript 1.0.2 → 1.0.3
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/documentation/application/CART.md +5934 -4502
- package/documentation/application/CATALOG.md +6338 -7245
- package/documentation/application/COMMON.md +95 -222
- package/documentation/application/COMMUNICATION.md +106 -186
- package/documentation/application/CONFIGURATION.md +903 -1597
- package/documentation/application/CONTENT.md +557 -1279
- package/documentation/application/FILESTORAGE.md +84 -220
- package/documentation/application/LEAD.md +314 -660
- package/documentation/application/LOGISTIC.md +229 -305
- package/documentation/application/ORDER.md +642 -1137
- package/documentation/application/PAYMENT.md +2285 -3031
- package/documentation/application/POSCART.md +6079 -4642
- package/documentation/application/REWARDS.md +94 -248
- package/documentation/application/SHARE.md +152 -250
- package/documentation/application/THEME.md +952 -1235
- package/documentation/application/USER.md +1228 -1765
- package/documentation/platform/ANALYTICS.md +207 -349
- package/documentation/platform/AUDITTRAIL.md +121 -204
- package/documentation/platform/BILLING.md +865 -1376
- package/documentation/platform/CART.md +2814 -3662
- package/documentation/platform/CATALOG.md +14453 -17192
- package/documentation/platform/COMMON.md +95 -222
- package/documentation/platform/COMMUNICATION.md +1632 -2380
- package/documentation/platform/COMPANYPROFILE.md +572 -957
- package/documentation/platform/CONFIGURATION.md +3050 -4073
- package/documentation/platform/CONTENT.md +3438 -4172
- package/documentation/platform/DISCOUNT.md +140 -236
- package/documentation/platform/FILESTORAGE.md +187 -323
- package/documentation/platform/INVENTORY.md +268 -911
- package/documentation/platform/LEAD.md +2195 -2541
- package/documentation/platform/ORDER.md +3400 -5361
- package/documentation/platform/PARTNER.md +9 -36
- package/documentation/platform/PAYMENT.md +903 -1213
- package/documentation/platform/REWARDS.md +183 -347
- package/documentation/platform/SHARE.md +120 -213
- package/documentation/platform/THEME.md +12956 -13239
- package/documentation/platform/USER.md +975 -1120
- package/documentation/platform/WEBHOOK.md +78 -184
- package/documentation/public/CONFIGURATION.md +95 -222
- package/documentation/public/INVENTORY.md +100 -282
- package/documentation/public/WEBHOOK.md +27 -133
- package/package.json +1 -1
- package/sdk/application/Cart/CartApplicationClient.d.ts +243 -243
- package/sdk/application/Cart/CartApplicationClient.js +567 -567
- package/sdk/application/Cart/CartApplicationModel.d.ts +64 -63
- package/sdk/application/Cart/CartApplicationModel.js +489 -886
- package/sdk/application/Cart/CartApplicationValidator.d.ts +17 -17
- package/sdk/application/Cart/CartApplicationValidator.js +98 -98
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +358 -358
- package/sdk/application/Catalog/CatalogApplicationClient.js +1036 -1036
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +90 -90
- package/sdk/application/Catalog/CatalogApplicationModel.js +677 -1243
- package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +19 -19
- package/sdk/application/Catalog/CatalogApplicationValidator.js +110 -110
- package/sdk/application/Common/CommonApplicationClient.d.ts +13 -13
- package/sdk/application/Common/CommonApplicationClient.js +38 -38
- package/sdk/application/Common/CommonApplicationModel.d.ts +12 -12
- package/sdk/application/Common/CommonApplicationModel.js +83 -160
- package/sdk/application/Common/CommonApplicationValidator.d.ts +1 -1
- package/sdk/application/Common/CommonApplicationValidator.js +6 -6
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +11 -11
- package/sdk/application/Communication/CommunicationApplicationClient.js +26 -26
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +6 -6
- package/sdk/application/Communication/CommunicationApplicationModel.js +38 -83
- package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +1 -1
- package/sdk/application/Communication/CommunicationApplicationValidator.js +4 -4
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +116 -116
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +330 -330
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +85 -85
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +480 -851
- package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +8 -8
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +33 -33
- package/sdk/application/Content/ContentApplicationClient.d.ts +67 -67
- package/sdk/application/Content/ContentApplicationClient.js +191 -191
- package/sdk/application/Content/ContentApplicationModel.d.ts +76 -76
- package/sdk/application/Content/ContentApplicationModel.js +467 -884
- package/sdk/application/Content/ContentApplicationValidator.d.ts +5 -5
- package/sdk/application/Content/ContentApplicationValidator.js +24 -24
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +25 -25
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +59 -59
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +13 -13
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +86 -169
- package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +1 -1
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +7 -7
- package/sdk/application/Lead/LeadApplicationClient.d.ts +24 -24
- package/sdk/application/Lead/LeadApplicationClient.js +100 -100
- package/sdk/application/Lead/LeadApplicationModel.d.ts +35 -35
- package/sdk/application/Lead/LeadApplicationModel.js +267 -474
- package/sdk/application/Lead/LeadApplicationValidator.d.ts +2 -2
- package/sdk/application/Lead/LeadApplicationValidator.js +11 -11
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +30 -19
- package/sdk/application/Logistic/LogisticApplicationClient.js +110 -43
- package/sdk/application/Logistic/LogisticApplicationModel.d.ts +17 -14
- package/sdk/application/Logistic/LogisticApplicationModel.js +133 -201
- package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +3 -2
- package/sdk/application/Logistic/LogisticApplicationValidator.js +14 -8
- package/sdk/application/Order/OrderApplicationClient.d.ts +85 -85
- package/sdk/application/Order/OrderApplicationClient.js +232 -232
- package/sdk/application/Order/OrderApplicationModel.d.ts +50 -50
- package/sdk/application/Order/OrderApplicationModel.js +352 -656
- package/sdk/application/Order/OrderApplicationValidator.d.ts +7 -7
- package/sdk/application/Order/OrderApplicationValidator.js +28 -28
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +318 -318
- package/sdk/application/Payment/PaymentApplicationClient.js +739 -739
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +72 -72
- package/sdk/application/Payment/PaymentApplicationModel.js +570 -1038
- package/sdk/application/Payment/PaymentApplicationValidator.d.ts +28 -28
- package/sdk/application/Payment/PaymentApplicationValidator.js +107 -107
- package/sdk/application/PosCart/PosCartApplicationClient.d.ts +254 -254
- package/sdk/application/PosCart/PosCartApplicationClient.js +617 -617
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +64 -63
- package/sdk/application/PosCart/PosCartApplicationModel.js +475 -871
- package/sdk/application/PosCart/PosCartApplicationValidator.d.ts +18 -18
- package/sdk/application/PosCart/PosCartApplicationValidator.js +103 -103
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +27 -27
- package/sdk/application/Rewards/RewardsApplicationClient.js +112 -112
- package/sdk/application/Rewards/RewardsApplicationModel.d.ts +14 -14
- package/sdk/application/Rewards/RewardsApplicationModel.js +96 -191
- package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +3 -3
- package/sdk/application/Rewards/RewardsApplicationValidator.js +12 -12
- package/sdk/application/Share/ShareApplicationClient.d.ts +37 -37
- package/sdk/application/Share/ShareApplicationClient.js +84 -84
- package/sdk/application/Share/ShareApplicationModel.d.ts +8 -8
- package/sdk/application/Share/ShareApplicationModel.js +63 -123
- package/sdk/application/Share/ShareApplicationValidator.d.ts +4 -4
- package/sdk/application/Share/ShareApplicationValidator.js +12 -12
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -8
- package/sdk/application/Theme/ThemeApplicationClient.js +31 -31
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +34 -34
- package/sdk/application/Theme/ThemeApplicationModel.js +190 -336
- package/sdk/application/Theme/ThemeApplicationValidator.d.ts +1 -1
- package/sdk/application/Theme/ThemeApplicationValidator.js +4 -4
- package/sdk/application/User/UserApplicationClient.d.ts +280 -280
- package/sdk/application/User/UserApplicationClient.js +581 -581
- package/sdk/application/User/UserApplicationModel.d.ts +79 -72
- package/sdk/application/User/UserApplicationModel.js +440 -689
- package/sdk/application/User/UserApplicationValidator.d.ts +24 -24
- package/sdk/application/User/UserApplicationValidator.js +89 -89
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +51 -51
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +179 -179
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +6 -6
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +20 -20
- package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +11 -11
- package/sdk/platform/Analytics/AnalyticsPlatformModel.js +95 -178
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +10 -10
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +41 -41
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +10 -10
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +50 -89
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.d.ts +1 -1
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +6 -6
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +60 -60
- package/sdk/platform/Billing/BillingPlatformClient.js +181 -181
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +40 -40
- package/sdk/platform/Billing/BillingPlatformModel.js +342 -668
- package/sdk/platform/Billing/BillingPlatformValidator.d.ts +8 -8
- package/sdk/platform/Billing/BillingPlatformValidator.js +25 -25
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +168 -168
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +553 -553
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +11 -11
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +63 -63
- package/sdk/platform/Cart/CartPlatformModel.d.ts +84 -83
- package/sdk/platform/Cart/CartPlatformModel.js +671 -1205
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +632 -632
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1525 -1525
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +40 -40
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +174 -174
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +682 -682
- package/sdk/platform/Catalog/CatalogPlatformClient.js +1557 -1557
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +291 -291
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2127 -3904
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +66 -66
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +229 -229
- package/sdk/platform/Common/CommonPlatformClient.d.ts +12 -12
- package/sdk/platform/Common/CommonPlatformClient.js +41 -41
- package/sdk/platform/Common/CommonPlatformModel.d.ts +12 -12
- package/sdk/platform/Common/CommonPlatformModel.js +83 -160
- package/sdk/platform/Common/CommonPlatformValidator.d.ts +1 -1
- package/sdk/platform/Common/CommonPlatformValidator.js +6 -6
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +326 -326
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +943 -943
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +30 -30
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +87 -87
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +67 -67
- package/sdk/platform/Communication/CommunicationPlatformModel.js +522 -974
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +55 -55
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +212 -212
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +27 -27
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +279 -542
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +7 -7
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +24 -24
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +163 -153
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +615 -552
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +22 -21
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +69 -63
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +125 -125
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +342 -342
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +148 -146
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +854 -1508
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +9 -9
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +38 -38
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +534 -534
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1324 -1324
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +50 -50
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +156 -156
- package/sdk/platform/Content/ContentPlatformModel.d.ts +78 -78
- package/sdk/platform/Content/ContentPlatformModel.js +484 -907
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +65 -65
- package/sdk/platform/Discount/DiscountPlatformClient.js +216 -216
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +7 -7
- package/sdk/platform/Discount/DiscountPlatformModel.js +60 -121
- package/sdk/platform/Discount/DiscountPlatformValidator.d.ts +6 -6
- package/sdk/platform/Discount/DiscountPlatformValidator.js +29 -29
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +24 -24
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +58 -58
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +8 -8
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +52 -52
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +123 -123
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +13 -13
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +86 -169
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.d.ts +3 -3
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +11 -11
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +63 -63
- package/sdk/platform/Inventory/InventoryPlatformClient.js +228 -228
- package/sdk/platform/Inventory/InventoryPlatformModel.d.ts +30 -30
- package/sdk/platform/Inventory/InventoryPlatformModel.js +497 -964
- package/sdk/platform/Inventory/InventoryPlatformValidator.d.ts +7 -7
- package/sdk/platform/Inventory/InventoryPlatformValidator.js +28 -28
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +73 -73
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +200 -200
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +7 -7
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +28 -28
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +80 -80
- package/sdk/platform/Lead/LeadPlatformClient.js +212 -212
- package/sdk/platform/Lead/LeadPlatformModel.d.ts +35 -35
- package/sdk/platform/Lead/LeadPlatformModel.js +267 -474
- package/sdk/platform/Lead/LeadPlatformValidator.d.ts +6 -6
- package/sdk/platform/Lead/LeadPlatformValidator.js +24 -24
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +10 -10
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +65 -65
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +6 -6
- package/sdk/platform/Order/OrderPlatformClient.d.ts +357 -357
- package/sdk/platform/Order/OrderPlatformClient.js +1035 -1035
- package/sdk/platform/Order/OrderPlatformModel.d.ts +198 -196
- package/sdk/platform/Order/OrderPlatformModel.js +1574 -2861
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +32 -32
- package/sdk/platform/Order/OrderPlatformValidator.js +160 -160
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +10 -26
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +57 -57
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +167 -167
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +6 -6
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +23 -23
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +42 -42
- package/sdk/platform/Payment/PaymentPlatformClient.js +153 -153
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +27 -27
- package/sdk/platform/Payment/PaymentPlatformModel.js +222 -410
- package/sdk/platform/Payment/PaymentPlatformValidator.d.ts +4 -4
- package/sdk/platform/Payment/PaymentPlatformValidator.js +21 -21
- package/sdk/platform/PlatformApplicationClient.d.ts +1496 -10325
- package/sdk/platform/PlatformApplicationClient.js +1584 -13899
- package/sdk/platform/PlatformClient.d.ts +7965 -7885
- package/sdk/platform/PlatformClient.js +8672 -10105
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +83 -83
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +275 -275
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +8 -8
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +34 -34
- package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +15 -15
- package/sdk/platform/Rewards/RewardsPlatformModel.js +92 -194
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +10 -10
- package/sdk/platform/Share/SharePlatformApplicationClient.js +59 -59
- package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Share/SharePlatformApplicationValidator.js +6 -6
- package/sdk/platform/Share/SharePlatformModel.d.ts +8 -8
- package/sdk/platform/Share/SharePlatformModel.js +60 -118
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +132 -132
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +310 -310
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +15 -15
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +44 -44
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +34 -34
- package/sdk/platform/Theme/ThemePlatformModel.js +190 -336
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +136 -69
- package/sdk/platform/User/UserPlatformApplicationClient.js +505 -166
- package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +12 -7
- package/sdk/platform/User/UserPlatformApplicationValidator.js +61 -23
- package/sdk/platform/User/UserPlatformModel.d.ts +79 -72
- package/sdk/platform/User/UserPlatformModel.js +440 -689
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +31 -31
- package/sdk/platform/Webhook/WebhookPlatformClient.js +88 -88
- package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +7 -7
- package/sdk/platform/Webhook/WebhookPlatformModel.js +68 -136
- package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +3 -3
- package/sdk/platform/Webhook/WebhookPlatformValidator.js +14 -14
- package/sdk/public/Configuration/ConfigurationPublicClient.d.ts +13 -13
- package/sdk/public/Configuration/ConfigurationPublicClient.js +38 -38
- package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +12 -12
- package/sdk/public/Configuration/ConfigurationPublicModel.js +85 -162
- package/sdk/public/Configuration/ConfigurationPublicValidator.d.ts +1 -1
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +6 -6
- package/sdk/public/Inventory/InventoryPublicClient.d.ts +34 -34
- package/sdk/public/Inventory/InventoryPublicClient.js +113 -113
- package/sdk/public/Inventory/InventoryPublicModel.d.ts +10 -10
- package/sdk/public/Inventory/InventoryPublicModel.js +119 -245
- package/sdk/public/Inventory/InventoryPublicValidator.d.ts +3 -3
- package/sdk/public/Inventory/InventoryPublicValidator.js +15 -15
- package/sdk/public/Webhook/WebhookPublicModel.d.ts +7 -7
- package/sdk/public/Webhook/WebhookPublicModel.js +68 -136
- package/tests/application/catalog.spec.js +7 -0
|
@@ -10,56 +10,56 @@ class Catalog {
|
|
|
10
10
|
constructor(_conf) {
|
|
11
11
|
this._conf = _conf;
|
|
12
12
|
this._relativeUrls = {
|
|
13
|
-
|
|
14
|
-
"/service/application/catalog/v1.0/
|
|
15
|
-
getProductSizesBySlug:
|
|
16
|
-
"/service/application/catalog/v1.0/products/{slug}/sizes/",
|
|
17
|
-
getProductComparisonBySlugs:
|
|
18
|
-
"/service/application/catalog/v1.0/products/compare/",
|
|
19
|
-
getSimilarComparisonProductBySlug:
|
|
20
|
-
"/service/application/catalog/v1.0/products/{slug}/similar/compare/",
|
|
21
|
-
getComparedFrequentlyProductBySlug:
|
|
22
|
-
"/service/application/catalog/v1.0/products/{slug}/similar/compared-frequently/",
|
|
23
|
-
getProductVariantsBySlug:
|
|
24
|
-
"/service/application/catalog/v1.0/products/{slug}/variants/",
|
|
25
|
-
getProductStockByIds:
|
|
26
|
-
"/service/application/catalog/v1.0/products/stock-status/",
|
|
27
|
-
getProductStockForTimeByIds:
|
|
28
|
-
"/service/application/catalog/v1.0/products/stock-status/poll/",
|
|
29
|
-
getProducts: "/service/application/catalog/v1.0/products/",
|
|
30
|
-
getBrands: "/service/application/catalog/v1.0/brands/",
|
|
13
|
+
followById:
|
|
14
|
+
"/service/application/catalog/v1.0/follow/{collection_type}/{collection_id}/",
|
|
31
15
|
getBrandDetailBySlug: "/service/application/catalog/v1.0/brands/{slug}/",
|
|
16
|
+
getBrands: "/service/application/catalog/v1.0/brands/",
|
|
32
17
|
getCategories: "/service/application/catalog/v1.0/categories/",
|
|
33
18
|
getCategoryDetailBySlug:
|
|
34
19
|
"/service/application/catalog/v1.0/categories/{slug}/",
|
|
35
|
-
getHomeProducts: "/service/application/catalog/v1.0/home/listing/",
|
|
36
|
-
getDepartments: "/service/application/catalog/v1.0/departments/",
|
|
37
|
-
getSearchResults: "/service/application/catalog/v1.0/auto-complete/",
|
|
38
|
-
getCollections: "/service/application/catalog/v1.0/collections/",
|
|
39
|
-
getCollectionItemsBySlug:
|
|
40
|
-
"/service/application/catalog/v1.0/collections/{slug}/items/",
|
|
41
20
|
getCollectionDetailBySlug:
|
|
42
21
|
"/service/application/catalog/v1.0/collections/{slug}/",
|
|
22
|
+
getCollectionItemsBySlug:
|
|
23
|
+
"/service/application/catalog/v1.0/collections/{slug}/items/",
|
|
24
|
+
getCollections: "/service/application/catalog/v1.0/collections/",
|
|
25
|
+
getComparedFrequentlyProductBySlug:
|
|
26
|
+
"/service/application/catalog/v1.0/products/{slug}/similar/compared-frequently/",
|
|
27
|
+
getDepartments: "/service/application/catalog/v1.0/departments/",
|
|
28
|
+
getFollowIds: "/service/application/catalog/v1.0/follow/ids/",
|
|
43
29
|
getFollowedListing:
|
|
44
30
|
"/service/application/catalog/v1.0/follow/{collection_type}/",
|
|
45
|
-
followById:
|
|
46
|
-
"/service/application/catalog/v1.0/follow/{collection_type}/{collection_id}/",
|
|
47
|
-
unfollowById:
|
|
48
|
-
"/service/application/catalog/v1.0/follow/{collection_type}/{collection_id}/",
|
|
49
31
|
getFollowerCountById:
|
|
50
32
|
"/service/application/catalog/v1.0/follow/{collection_type}/{collection_id}/count/",
|
|
51
|
-
|
|
52
|
-
getStores: "/service/application/catalog/v1.0/locations/",
|
|
33
|
+
getHomeProducts: "/service/application/catalog/v1.0/home/listing/",
|
|
53
34
|
getInStockLocations:
|
|
54
35
|
"/service/application/catalog/v1.0/in-stock/locations/",
|
|
55
36
|
getLocationDetailsById:
|
|
56
37
|
"/service/application/catalog/v1.0/locations/{location_id}/",
|
|
57
38
|
getProductBundlesBySlug:
|
|
58
39
|
"/service/application/catalog/v1.0/product-grouping/",
|
|
40
|
+
getProductComparisonBySlugs:
|
|
41
|
+
"/service/application/catalog/v1.0/products/compare/",
|
|
42
|
+
getProductDetailBySlug:
|
|
43
|
+
"/service/application/catalog/v1.0/products/{slug}/",
|
|
59
44
|
getProductPriceBySlug:
|
|
60
45
|
"/service/application/catalog/v3.0/products/{slug}/sizes/{size}/price/",
|
|
61
46
|
getProductSellersBySlug:
|
|
62
47
|
"/service/application/catalog/v3.0/products/{slug}/sizes/{size}/sellers/",
|
|
48
|
+
getProductSizesBySlug:
|
|
49
|
+
"/service/application/catalog/v1.0/products/{slug}/sizes/",
|
|
50
|
+
getProductStockByIds:
|
|
51
|
+
"/service/application/catalog/v1.0/products/stock-status/",
|
|
52
|
+
getProductStockForTimeByIds:
|
|
53
|
+
"/service/application/catalog/v1.0/products/stock-status/poll/",
|
|
54
|
+
getProductVariantsBySlug:
|
|
55
|
+
"/service/application/catalog/v1.0/products/{slug}/variants/",
|
|
56
|
+
getProducts: "/service/application/catalog/v1.0/products/",
|
|
57
|
+
getSearchResults: "/service/application/catalog/v1.0/auto-complete/",
|
|
58
|
+
getSimilarComparisonProductBySlug:
|
|
59
|
+
"/service/application/catalog/v1.0/products/{slug}/similar/compare/",
|
|
60
|
+
getStores: "/service/application/catalog/v1.0/locations/",
|
|
61
|
+
unfollowById:
|
|
62
|
+
"/service/application/catalog/v1.0/follow/{collection_type}/{collection_id}/",
|
|
63
63
|
};
|
|
64
64
|
this._urls = Object.entries(this._relativeUrls).reduce(
|
|
65
65
|
(urls, [method, relativeUrl]) => {
|
|
@@ -79,16 +79,16 @@ class Catalog {
|
|
|
79
79
|
|
|
80
80
|
/**
|
|
81
81
|
* @param {Object} arg - Arg object.
|
|
82
|
-
* @param {string} arg.
|
|
83
|
-
*
|
|
84
|
-
*
|
|
85
|
-
* @returns {Promise<
|
|
86
|
-
* @summary:
|
|
87
|
-
* @description:
|
|
82
|
+
* @param {string} arg.collectionType - Type of collection followed, i.e.
|
|
83
|
+
* products, brands, or collections.
|
|
84
|
+
* @param {string} arg.collectionId - The ID of the collection type.
|
|
85
|
+
* @returns {Promise<FollowPostResponse>} - Success response
|
|
86
|
+
* @summary: Follow an entity (product/brand/collection)
|
|
87
|
+
* @description: Follow a particular entity such as product, brand, collection specified by its ID.
|
|
88
88
|
*/
|
|
89
|
-
async
|
|
90
|
-
const { error } = CatalogValidator.
|
|
91
|
-
{
|
|
89
|
+
async followById({ collectionType, collectionId } = {}) {
|
|
90
|
+
const { error } = CatalogValidator.followById().validate(
|
|
91
|
+
{ collectionType, collectionId },
|
|
92
92
|
{ abortEarly: false, allowUnknown: true }
|
|
93
93
|
);
|
|
94
94
|
if (error) {
|
|
@@ -96,16 +96,14 @@ class Catalog {
|
|
|
96
96
|
}
|
|
97
97
|
|
|
98
98
|
// Showing warrnings if extra unknown parameters are found
|
|
99
|
-
const {
|
|
100
|
-
|
|
101
|
-
} = CatalogValidator.getProductDetailBySlug().validate(
|
|
102
|
-
{ slug },
|
|
99
|
+
const { error: warrning } = CatalogValidator.followById().validate(
|
|
100
|
+
{ collectionType, collectionId },
|
|
103
101
|
{ abortEarly: false, allowUnknown: false }
|
|
104
102
|
);
|
|
105
103
|
if (warrning) {
|
|
106
104
|
Logger({
|
|
107
105
|
level: "WARN",
|
|
108
|
-
message: "Parameter Validation warrnings for
|
|
106
|
+
message: "Parameter Validation warrnings for followById",
|
|
109
107
|
});
|
|
110
108
|
Logger({ level: "WARN", message: warrning });
|
|
111
109
|
}
|
|
@@ -116,25 +114,27 @@ class Catalog {
|
|
|
116
114
|
|
|
117
115
|
const response = await APIClient.execute(
|
|
118
116
|
this._conf,
|
|
119
|
-
"
|
|
117
|
+
"post",
|
|
120
118
|
constructUrl({
|
|
121
|
-
url: this._urls["
|
|
122
|
-
params: {
|
|
119
|
+
url: this._urls["followById"],
|
|
120
|
+
params: { collectionType, collectionId },
|
|
123
121
|
}),
|
|
124
122
|
query_params,
|
|
125
123
|
undefined,
|
|
126
124
|
xHeaders
|
|
127
125
|
);
|
|
128
126
|
|
|
129
|
-
const {
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
127
|
+
const {
|
|
128
|
+
error: res_error,
|
|
129
|
+
} = CatalogModel.FollowPostResponse().validate(response, {
|
|
130
|
+
abortEarly: false,
|
|
131
|
+
allowUnknown: false,
|
|
132
|
+
});
|
|
133
133
|
|
|
134
134
|
if (res_error) {
|
|
135
135
|
Logger({
|
|
136
136
|
level: "WARN",
|
|
137
|
-
message: "Response Validation Warnnings for
|
|
137
|
+
message: "Response Validation Warnnings for followById",
|
|
138
138
|
});
|
|
139
139
|
Logger({ level: "WARN", message: res_error });
|
|
140
140
|
}
|
|
@@ -145,17 +145,15 @@ class Catalog {
|
|
|
145
145
|
/**
|
|
146
146
|
* @param {Object} arg - Arg object.
|
|
147
147
|
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
148
|
-
* identifier of a
|
|
149
|
-
* /service/application/catalog/v1.0/
|
|
150
|
-
* @
|
|
151
|
-
*
|
|
152
|
-
* @
|
|
153
|
-
* @summary: Get the sizes of a product
|
|
154
|
-
* @description: A product can have multiple sizes. Use this API to fetch all the available sizes of a product.
|
|
148
|
+
* identifier of a brand. You can get slug value from the endpoint
|
|
149
|
+
* /service/application/catalog/v1.0/brands/.
|
|
150
|
+
* @returns {Promise<BrandDetailResponse>} - Success response
|
|
151
|
+
* @summary: Get metadata of a brand
|
|
152
|
+
* @description: Fetch metadata of a brand such as name, information, logo, banner, etc.
|
|
155
153
|
*/
|
|
156
|
-
async
|
|
157
|
-
const { error } = CatalogValidator.
|
|
158
|
-
{ slug
|
|
154
|
+
async getBrandDetailBySlug({ slug } = {}) {
|
|
155
|
+
const { error } = CatalogValidator.getBrandDetailBySlug().validate(
|
|
156
|
+
{ slug },
|
|
159
157
|
{ abortEarly: false, allowUnknown: true }
|
|
160
158
|
);
|
|
161
159
|
if (error) {
|
|
@@ -165,20 +163,19 @@ class Catalog {
|
|
|
165
163
|
// Showing warrnings if extra unknown parameters are found
|
|
166
164
|
const {
|
|
167
165
|
error: warrning,
|
|
168
|
-
} = CatalogValidator.
|
|
169
|
-
{ slug
|
|
166
|
+
} = CatalogValidator.getBrandDetailBySlug().validate(
|
|
167
|
+
{ slug },
|
|
170
168
|
{ abortEarly: false, allowUnknown: false }
|
|
171
169
|
);
|
|
172
170
|
if (warrning) {
|
|
173
171
|
Logger({
|
|
174
172
|
level: "WARN",
|
|
175
|
-
message: "Parameter Validation warrnings for
|
|
173
|
+
message: "Parameter Validation warrnings for getBrandDetailBySlug",
|
|
176
174
|
});
|
|
177
175
|
Logger({ level: "WARN", message: warrning });
|
|
178
176
|
}
|
|
179
177
|
|
|
180
178
|
const query_params = {};
|
|
181
|
-
query_params["store_id"] = storeId;
|
|
182
179
|
|
|
183
180
|
const xHeaders = {};
|
|
184
181
|
|
|
@@ -186,7 +183,7 @@ class Catalog {
|
|
|
186
183
|
this._conf,
|
|
187
184
|
"get",
|
|
188
185
|
constructUrl({
|
|
189
|
-
url: this._urls["
|
|
186
|
+
url: this._urls["getBrandDetailBySlug"],
|
|
190
187
|
params: { slug },
|
|
191
188
|
}),
|
|
192
189
|
query_params,
|
|
@@ -194,15 +191,17 @@ class Catalog {
|
|
|
194
191
|
xHeaders
|
|
195
192
|
);
|
|
196
193
|
|
|
197
|
-
const {
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
194
|
+
const {
|
|
195
|
+
error: res_error,
|
|
196
|
+
} = CatalogModel.BrandDetailResponse().validate(response, {
|
|
197
|
+
abortEarly: false,
|
|
198
|
+
allowUnknown: false,
|
|
199
|
+
});
|
|
201
200
|
|
|
202
201
|
if (res_error) {
|
|
203
202
|
Logger({
|
|
204
203
|
level: "WARN",
|
|
205
|
-
message: "Response Validation Warnnings for
|
|
204
|
+
message: "Response Validation Warnnings for getBrandDetailBySlug",
|
|
206
205
|
});
|
|
207
206
|
Logger({ level: "WARN", message: res_error });
|
|
208
207
|
}
|
|
@@ -212,16 +211,20 @@ class Catalog {
|
|
|
212
211
|
|
|
213
212
|
/**
|
|
214
213
|
* @param {Object} arg - Arg object.
|
|
215
|
-
* @param {string
|
|
216
|
-
*
|
|
217
|
-
*
|
|
218
|
-
*
|
|
219
|
-
* @
|
|
220
|
-
*
|
|
214
|
+
* @param {string} [arg.department] - The name of the department. Use this
|
|
215
|
+
* parameter to filter products by a particular department. See the list
|
|
216
|
+
* of available departments below. Also, you can get available departments
|
|
217
|
+
* from the endpoint /service/application/catalog/v1.0/departments/
|
|
218
|
+
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
219
|
+
* given set of results.
|
|
220
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
221
|
+
* @returns {Promise<BrandListingResponse>} - Success response
|
|
222
|
+
* @summary: Get all the brands
|
|
223
|
+
* @description: A brand is the name under which a product is sold. Use this API to list all the brands. You can also filter the brands by department.
|
|
221
224
|
*/
|
|
222
|
-
async
|
|
223
|
-
const { error } = CatalogValidator.
|
|
224
|
-
{
|
|
225
|
+
async getBrands({ department, pageNo, pageSize } = {}) {
|
|
226
|
+
const { error } = CatalogValidator.getBrands().validate(
|
|
227
|
+
{ department, pageNo, pageSize },
|
|
225
228
|
{ abortEarly: false, allowUnknown: true }
|
|
226
229
|
);
|
|
227
230
|
if (error) {
|
|
@@ -229,23 +232,22 @@ class Catalog {
|
|
|
229
232
|
}
|
|
230
233
|
|
|
231
234
|
// Showing warrnings if extra unknown parameters are found
|
|
232
|
-
const {
|
|
233
|
-
|
|
234
|
-
} = CatalogValidator.getProductComparisonBySlugs().validate(
|
|
235
|
-
{ slug },
|
|
235
|
+
const { error: warrning } = CatalogValidator.getBrands().validate(
|
|
236
|
+
{ department, pageNo, pageSize },
|
|
236
237
|
{ abortEarly: false, allowUnknown: false }
|
|
237
238
|
);
|
|
238
239
|
if (warrning) {
|
|
239
240
|
Logger({
|
|
240
241
|
level: "WARN",
|
|
241
|
-
message:
|
|
242
|
-
"Parameter Validation warrnings for getProductComparisonBySlugs",
|
|
242
|
+
message: "Parameter Validation warrnings for getBrands",
|
|
243
243
|
});
|
|
244
244
|
Logger({ level: "WARN", message: warrning });
|
|
245
245
|
}
|
|
246
246
|
|
|
247
247
|
const query_params = {};
|
|
248
|
-
query_params["
|
|
248
|
+
query_params["department"] = department;
|
|
249
|
+
query_params["page_no"] = pageNo;
|
|
250
|
+
query_params["page_size"] = pageSize;
|
|
249
251
|
|
|
250
252
|
const xHeaders = {};
|
|
251
253
|
|
|
@@ -253,7 +255,7 @@ class Catalog {
|
|
|
253
255
|
this._conf,
|
|
254
256
|
"get",
|
|
255
257
|
constructUrl({
|
|
256
|
-
url: this._urls["
|
|
258
|
+
url: this._urls["getBrands"],
|
|
257
259
|
params: {},
|
|
258
260
|
}),
|
|
259
261
|
query_params,
|
|
@@ -263,7 +265,7 @@ class Catalog {
|
|
|
263
265
|
|
|
264
266
|
const {
|
|
265
267
|
error: res_error,
|
|
266
|
-
} = CatalogModel.
|
|
268
|
+
} = CatalogModel.BrandListingResponse().validate(response, {
|
|
267
269
|
abortEarly: false,
|
|
268
270
|
allowUnknown: false,
|
|
269
271
|
});
|
|
@@ -271,8 +273,7 @@ class Catalog {
|
|
|
271
273
|
if (res_error) {
|
|
272
274
|
Logger({
|
|
273
275
|
level: "WARN",
|
|
274
|
-
message:
|
|
275
|
-
"Response Validation Warnnings for getProductComparisonBySlugs",
|
|
276
|
+
message: "Response Validation Warnnings for getBrands",
|
|
276
277
|
});
|
|
277
278
|
Logger({ level: "WARN", message: res_error });
|
|
278
279
|
}
|
|
@@ -282,18 +283,48 @@ class Catalog {
|
|
|
282
283
|
|
|
283
284
|
/**
|
|
284
285
|
* @param {Object} arg - Arg object.
|
|
285
|
-
* @param {string} arg.
|
|
286
|
-
*
|
|
287
|
-
*
|
|
288
|
-
*
|
|
289
|
-
* @
|
|
290
|
-
* @
|
|
286
|
+
* @param {string} [arg.department] - The name of the department. Use this
|
|
287
|
+
* parameter to filter products by a particular department. See the list
|
|
288
|
+
* of available departments below. Also, you can get available departments
|
|
289
|
+
* from the endpoint /service/application/catalog/v1.0/departments/
|
|
290
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
291
|
+
* @summary: Get all the brands
|
|
292
|
+
* @description: A brand is the name under which a product is sold. Use this API to list all the brands. You can also filter the brands by department.
|
|
291
293
|
*/
|
|
292
|
-
|
|
293
|
-
const
|
|
294
|
-
|
|
295
|
-
|
|
296
|
-
|
|
294
|
+
getBrandsPaginator({ department, pageSize } = {}) {
|
|
295
|
+
const paginator = new Paginator();
|
|
296
|
+
const callback = async () => {
|
|
297
|
+
const pageId = paginator.nextId;
|
|
298
|
+
const pageNo = paginator.pageNo;
|
|
299
|
+
const pageType = "number";
|
|
300
|
+
const data = await this.getBrands({
|
|
301
|
+
department: department,
|
|
302
|
+
pageNo: pageNo,
|
|
303
|
+
pageSize: pageSize,
|
|
304
|
+
});
|
|
305
|
+
paginator.setPaginator({
|
|
306
|
+
hasNext: data.page.has_next ? true : false,
|
|
307
|
+
nextId: data.page.next_id,
|
|
308
|
+
});
|
|
309
|
+
return data;
|
|
310
|
+
};
|
|
311
|
+
paginator.setCallback(callback);
|
|
312
|
+
return paginator;
|
|
313
|
+
}
|
|
314
|
+
|
|
315
|
+
/**
|
|
316
|
+
* @param {Object} arg - Arg object.
|
|
317
|
+
* @param {string} [arg.department] - The name of the department. Use this
|
|
318
|
+
* parameter to filter products by a particular department. See the list
|
|
319
|
+
* of available departments below. Also, you can get available departments
|
|
320
|
+
* from the endpoint /service/application/catalog/v1.0/departments/
|
|
321
|
+
* @returns {Promise<CategoryListingResponse>} - Success response
|
|
322
|
+
* @summary: List all the categories
|
|
323
|
+
* @description: Use this API to list all the categories. You can also filter the categories by department.
|
|
324
|
+
*/
|
|
325
|
+
async getCategories({ department } = {}) {
|
|
326
|
+
const { error } = CatalogValidator.getCategories().validate(
|
|
327
|
+
{ department },
|
|
297
328
|
{ abortEarly: false, allowUnknown: true }
|
|
298
329
|
);
|
|
299
330
|
if (error) {
|
|
@@ -301,22 +332,20 @@ class Catalog {
|
|
|
301
332
|
}
|
|
302
333
|
|
|
303
334
|
// Showing warrnings if extra unknown parameters are found
|
|
304
|
-
const {
|
|
305
|
-
|
|
306
|
-
} = CatalogValidator.getSimilarComparisonProductBySlug().validate(
|
|
307
|
-
{ slug },
|
|
335
|
+
const { error: warrning } = CatalogValidator.getCategories().validate(
|
|
336
|
+
{ department },
|
|
308
337
|
{ abortEarly: false, allowUnknown: false }
|
|
309
338
|
);
|
|
310
339
|
if (warrning) {
|
|
311
340
|
Logger({
|
|
312
341
|
level: "WARN",
|
|
313
|
-
message:
|
|
314
|
-
"Parameter Validation warrnings for getSimilarComparisonProductBySlug",
|
|
342
|
+
message: "Parameter Validation warrnings for getCategories",
|
|
315
343
|
});
|
|
316
344
|
Logger({ level: "WARN", message: warrning });
|
|
317
345
|
}
|
|
318
346
|
|
|
319
347
|
const query_params = {};
|
|
348
|
+
query_params["department"] = department;
|
|
320
349
|
|
|
321
350
|
const xHeaders = {};
|
|
322
351
|
|
|
@@ -324,8 +353,8 @@ class Catalog {
|
|
|
324
353
|
this._conf,
|
|
325
354
|
"get",
|
|
326
355
|
constructUrl({
|
|
327
|
-
url: this._urls["
|
|
328
|
-
params: {
|
|
356
|
+
url: this._urls["getCategories"],
|
|
357
|
+
params: {},
|
|
329
358
|
}),
|
|
330
359
|
query_params,
|
|
331
360
|
undefined,
|
|
@@ -334,7 +363,7 @@ class Catalog {
|
|
|
334
363
|
|
|
335
364
|
const {
|
|
336
365
|
error: res_error,
|
|
337
|
-
} = CatalogModel.
|
|
366
|
+
} = CatalogModel.CategoryListingResponse().validate(response, {
|
|
338
367
|
abortEarly: false,
|
|
339
368
|
allowUnknown: false,
|
|
340
369
|
});
|
|
@@ -342,8 +371,7 @@ class Catalog {
|
|
|
342
371
|
if (res_error) {
|
|
343
372
|
Logger({
|
|
344
373
|
level: "WARN",
|
|
345
|
-
message:
|
|
346
|
-
"Response Validation Warnnings for getSimilarComparisonProductBySlug",
|
|
374
|
+
message: "Response Validation Warnnings for getCategories",
|
|
347
375
|
});
|
|
348
376
|
Logger({ level: "WARN", message: res_error });
|
|
349
377
|
}
|
|
@@ -354,16 +382,14 @@ class Catalog {
|
|
|
354
382
|
/**
|
|
355
383
|
* @param {Object} arg - Arg object.
|
|
356
384
|
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
357
|
-
* identifier of a
|
|
358
|
-
* /service/application/catalog/v1.0/
|
|
359
|
-
* @returns {Promise<
|
|
360
|
-
* @summary: Get
|
|
361
|
-
* @description:
|
|
385
|
+
* identifier of a brand. You can get slug value from the endpoint
|
|
386
|
+
* /service/application/catalog/v1.0/brands/.
|
|
387
|
+
* @returns {Promise<CategoryMetaResponse>} - Success response
|
|
388
|
+
* @summary: Get metadata of a category
|
|
389
|
+
* @description: Fetch metadata of a category such as name, information, logo, banner, etc.
|
|
362
390
|
*/
|
|
363
|
-
async
|
|
364
|
-
const {
|
|
365
|
-
error,
|
|
366
|
-
} = CatalogValidator.getComparedFrequentlyProductBySlug().validate(
|
|
391
|
+
async getCategoryDetailBySlug({ slug } = {}) {
|
|
392
|
+
const { error } = CatalogValidator.getCategoryDetailBySlug().validate(
|
|
367
393
|
{ slug },
|
|
368
394
|
{ abortEarly: false, allowUnknown: true }
|
|
369
395
|
);
|
|
@@ -374,15 +400,14 @@ class Catalog {
|
|
|
374
400
|
// Showing warrnings if extra unknown parameters are found
|
|
375
401
|
const {
|
|
376
402
|
error: warrning,
|
|
377
|
-
} = CatalogValidator.
|
|
403
|
+
} = CatalogValidator.getCategoryDetailBySlug().validate(
|
|
378
404
|
{ slug },
|
|
379
405
|
{ abortEarly: false, allowUnknown: false }
|
|
380
406
|
);
|
|
381
407
|
if (warrning) {
|
|
382
408
|
Logger({
|
|
383
409
|
level: "WARN",
|
|
384
|
-
message:
|
|
385
|
-
"Parameter Validation warrnings for getComparedFrequentlyProductBySlug",
|
|
410
|
+
message: "Parameter Validation warrnings for getCategoryDetailBySlug",
|
|
386
411
|
});
|
|
387
412
|
Logger({ level: "WARN", message: warrning });
|
|
388
413
|
}
|
|
@@ -395,7 +420,7 @@ class Catalog {
|
|
|
395
420
|
this._conf,
|
|
396
421
|
"get",
|
|
397
422
|
constructUrl({
|
|
398
|
-
url: this._urls["
|
|
423
|
+
url: this._urls["getCategoryDetailBySlug"],
|
|
399
424
|
params: { slug },
|
|
400
425
|
}),
|
|
401
426
|
query_params,
|
|
@@ -405,16 +430,15 @@ class Catalog {
|
|
|
405
430
|
|
|
406
431
|
const {
|
|
407
432
|
error: res_error,
|
|
408
|
-
} = CatalogModel.
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
);
|
|
433
|
+
} = CatalogModel.CategoryMetaResponse().validate(response, {
|
|
434
|
+
abortEarly: false,
|
|
435
|
+
allowUnknown: false,
|
|
436
|
+
});
|
|
412
437
|
|
|
413
438
|
if (res_error) {
|
|
414
439
|
Logger({
|
|
415
440
|
level: "WARN",
|
|
416
|
-
message:
|
|
417
|
-
"Response Validation Warnnings for getComparedFrequentlyProductBySlug",
|
|
441
|
+
message: "Response Validation Warnnings for getCategoryDetailBySlug",
|
|
418
442
|
});
|
|
419
443
|
Logger({ level: "WARN", message: res_error });
|
|
420
444
|
}
|
|
@@ -425,14 +449,14 @@ class Catalog {
|
|
|
425
449
|
/**
|
|
426
450
|
* @param {Object} arg - Arg object.
|
|
427
451
|
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
428
|
-
* identifier of a
|
|
429
|
-
* /service/application/catalog/v1.0/
|
|
430
|
-
* @returns {Promise<
|
|
431
|
-
* @summary: Get
|
|
432
|
-
* @description:
|
|
452
|
+
* identifier of a collection. You can get slug value from the endpoint
|
|
453
|
+
* /service/application/catalog/v1.0/collections/.
|
|
454
|
+
* @returns {Promise<CollectionDetailResponse>} - Success response
|
|
455
|
+
* @summary: Get a particular collection
|
|
456
|
+
* @description: Get the details of a collection by its `slug`.
|
|
433
457
|
*/
|
|
434
|
-
async
|
|
435
|
-
const { error } = CatalogValidator.
|
|
458
|
+
async getCollectionDetailBySlug({ slug } = {}) {
|
|
459
|
+
const { error } = CatalogValidator.getCollectionDetailBySlug().validate(
|
|
436
460
|
{ slug },
|
|
437
461
|
{ abortEarly: false, allowUnknown: true }
|
|
438
462
|
);
|
|
@@ -443,14 +467,14 @@ class Catalog {
|
|
|
443
467
|
// Showing warrnings if extra unknown parameters are found
|
|
444
468
|
const {
|
|
445
469
|
error: warrning,
|
|
446
|
-
} = CatalogValidator.
|
|
470
|
+
} = CatalogValidator.getCollectionDetailBySlug().validate(
|
|
447
471
|
{ slug },
|
|
448
472
|
{ abortEarly: false, allowUnknown: false }
|
|
449
473
|
);
|
|
450
474
|
if (warrning) {
|
|
451
475
|
Logger({
|
|
452
476
|
level: "WARN",
|
|
453
|
-
message: "Parameter Validation warrnings for
|
|
477
|
+
message: "Parameter Validation warrnings for getCollectionDetailBySlug",
|
|
454
478
|
});
|
|
455
479
|
Logger({ level: "WARN", message: warrning });
|
|
456
480
|
}
|
|
@@ -463,7 +487,7 @@ class Catalog {
|
|
|
463
487
|
this._conf,
|
|
464
488
|
"get",
|
|
465
489
|
constructUrl({
|
|
466
|
-
url: this._urls["
|
|
490
|
+
url: this._urls["getCollectionDetailBySlug"],
|
|
467
491
|
params: { slug },
|
|
468
492
|
}),
|
|
469
493
|
query_params,
|
|
@@ -473,7 +497,7 @@ class Catalog {
|
|
|
473
497
|
|
|
474
498
|
const {
|
|
475
499
|
error: res_error,
|
|
476
|
-
} = CatalogModel.
|
|
500
|
+
} = CatalogModel.CollectionDetailResponse().validate(response, {
|
|
477
501
|
abortEarly: false,
|
|
478
502
|
allowUnknown: false,
|
|
479
503
|
});
|
|
@@ -481,7 +505,7 @@ class Catalog {
|
|
|
481
505
|
if (res_error) {
|
|
482
506
|
Logger({
|
|
483
507
|
level: "WARN",
|
|
484
|
-
message: "Response Validation Warnnings for
|
|
508
|
+
message: "Response Validation Warnnings for getCollectionDetailBySlug",
|
|
485
509
|
});
|
|
486
510
|
Logger({ level: "WARN", message: res_error });
|
|
487
511
|
}
|
|
@@ -491,22 +515,34 @@ class Catalog {
|
|
|
491
515
|
|
|
492
516
|
/**
|
|
493
517
|
* @param {Object} arg - Arg object.
|
|
494
|
-
* @param {string}
|
|
495
|
-
*
|
|
496
|
-
*
|
|
497
|
-
* @param {string} [arg.
|
|
498
|
-
*
|
|
499
|
-
*
|
|
500
|
-
*
|
|
501
|
-
* @param {
|
|
502
|
-
*
|
|
503
|
-
* @
|
|
504
|
-
*
|
|
505
|
-
*
|
|
518
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
519
|
+
* identifier of a collection. You can get slug value from the endpoint
|
|
520
|
+
* /service/application/catalog/v1.0/collections/.
|
|
521
|
+
* @param {string} [arg.f] - The search filter parameters. Filter parameters
|
|
522
|
+
* will be passed in f parameter as shown in the example below. Double
|
|
523
|
+
* Pipe (||) denotes the OR condition, whereas Triple-colon (:::)
|
|
524
|
+
* indicates a new filter paramater applied as an AND condition.
|
|
525
|
+
* @param {boolean} [arg.filters] - This is a boolean value, True for
|
|
526
|
+
* fetching all filter parameters and False for disabling the filter parameters.
|
|
527
|
+
* @param {string} [arg.sortOn] - The order in which the list of products
|
|
528
|
+
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
529
|
+
* either ascending or descending order. See the supported values below.
|
|
530
|
+
* @param {string} [arg.pageId] - Page ID to retrieve next set of results.
|
|
531
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
532
|
+
* @returns {Promise<ProductListingResponse>} - Success response
|
|
533
|
+
* @summary: Get the items in a collection
|
|
534
|
+
* @description: Get items in a collection specified by its `slug`.
|
|
506
535
|
*/
|
|
507
|
-
async
|
|
508
|
-
|
|
509
|
-
|
|
536
|
+
async getCollectionItemsBySlug({
|
|
537
|
+
slug,
|
|
538
|
+
f,
|
|
539
|
+
filters,
|
|
540
|
+
sortOn,
|
|
541
|
+
pageId,
|
|
542
|
+
pageSize,
|
|
543
|
+
} = {}) {
|
|
544
|
+
const { error } = CatalogValidator.getCollectionItemsBySlug().validate(
|
|
545
|
+
{ slug, f, filters, sortOn, pageId, pageSize },
|
|
510
546
|
{ abortEarly: false, allowUnknown: true }
|
|
511
547
|
);
|
|
512
548
|
if (error) {
|
|
@@ -516,24 +552,24 @@ class Catalog {
|
|
|
516
552
|
// Showing warrnings if extra unknown parameters are found
|
|
517
553
|
const {
|
|
518
554
|
error: warrning,
|
|
519
|
-
} = CatalogValidator.
|
|
520
|
-
{
|
|
555
|
+
} = CatalogValidator.getCollectionItemsBySlug().validate(
|
|
556
|
+
{ slug, f, filters, sortOn, pageId, pageSize },
|
|
521
557
|
{ abortEarly: false, allowUnknown: false }
|
|
522
558
|
);
|
|
523
559
|
if (warrning) {
|
|
524
560
|
Logger({
|
|
525
561
|
level: "WARN",
|
|
526
|
-
message: "Parameter Validation warrnings for
|
|
562
|
+
message: "Parameter Validation warrnings for getCollectionItemsBySlug",
|
|
527
563
|
});
|
|
528
564
|
Logger({ level: "WARN", message: warrning });
|
|
529
565
|
}
|
|
530
566
|
|
|
531
567
|
const query_params = {};
|
|
532
|
-
query_params["
|
|
533
|
-
query_params["
|
|
534
|
-
query_params["
|
|
535
|
-
query_params["
|
|
536
|
-
query_params["
|
|
568
|
+
query_params["f"] = f;
|
|
569
|
+
query_params["filters"] = filters;
|
|
570
|
+
query_params["sort_on"] = sortOn;
|
|
571
|
+
query_params["page_id"] = pageId;
|
|
572
|
+
query_params["page_size"] = pageSize;
|
|
537
573
|
|
|
538
574
|
const xHeaders = {};
|
|
539
575
|
|
|
@@ -541,8 +577,8 @@ class Catalog {
|
|
|
541
577
|
this._conf,
|
|
542
578
|
"get",
|
|
543
579
|
constructUrl({
|
|
544
|
-
url: this._urls["
|
|
545
|
-
params: {},
|
|
580
|
+
url: this._urls["getCollectionItemsBySlug"],
|
|
581
|
+
params: { slug },
|
|
546
582
|
}),
|
|
547
583
|
query_params,
|
|
548
584
|
undefined,
|
|
@@ -551,7 +587,7 @@ class Catalog {
|
|
|
551
587
|
|
|
552
588
|
const {
|
|
553
589
|
error: res_error,
|
|
554
|
-
} = CatalogModel.
|
|
590
|
+
} = CatalogModel.ProductListingResponse().validate(response, {
|
|
555
591
|
abortEarly: false,
|
|
556
592
|
allowUnknown: false,
|
|
557
593
|
});
|
|
@@ -559,7 +595,7 @@ class Catalog {
|
|
|
559
595
|
if (res_error) {
|
|
560
596
|
Logger({
|
|
561
597
|
level: "WARN",
|
|
562
|
-
message: "Response Validation Warnnings for
|
|
598
|
+
message: "Response Validation Warnnings for getCollectionItemsBySlug",
|
|
563
599
|
});
|
|
564
600
|
Logger({ level: "WARN", message: res_error });
|
|
565
601
|
}
|
|
@@ -569,16 +605,65 @@ class Catalog {
|
|
|
569
605
|
|
|
570
606
|
/**
|
|
571
607
|
* @param {Object} arg - Arg object.
|
|
572
|
-
* @param {string} arg.
|
|
608
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
609
|
+
* identifier of a collection. You can get slug value from the endpoint
|
|
610
|
+
* /service/application/catalog/v1.0/collections/.
|
|
611
|
+
* @param {string} [arg.f] - The search filter parameters. Filter parameters
|
|
612
|
+
* will be passed in f parameter as shown in the example below. Double
|
|
613
|
+
* Pipe (||) denotes the OR condition, whereas Triple-colon (:::)
|
|
614
|
+
* indicates a new filter paramater applied as an AND condition.
|
|
615
|
+
* @param {boolean} [arg.filters] - This is a boolean value, True for
|
|
616
|
+
* fetching all filter parameters and False for disabling the filter parameters.
|
|
617
|
+
* @param {string} [arg.sortOn] - The order in which the list of products
|
|
618
|
+
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
619
|
+
* either ascending or descending order. See the supported values below.
|
|
573
620
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
574
|
-
* @
|
|
575
|
-
* @
|
|
576
|
-
* @summary: Get the stock of a product
|
|
577
|
-
* @description: Retrieve the available stock of the products. Use this API to get the stock status of products whose inventory is updated at the specified time
|
|
621
|
+
* @summary: Get the items in a collection
|
|
622
|
+
* @description: Get items in a collection specified by its `slug`.
|
|
578
623
|
*/
|
|
579
|
-
|
|
580
|
-
|
|
581
|
-
|
|
624
|
+
getCollectionItemsBySlugPaginator({
|
|
625
|
+
slug,
|
|
626
|
+
f,
|
|
627
|
+
filters,
|
|
628
|
+
sortOn,
|
|
629
|
+
pageSize,
|
|
630
|
+
} = {}) {
|
|
631
|
+
const paginator = new Paginator();
|
|
632
|
+
const callback = async () => {
|
|
633
|
+
const pageId = paginator.nextId;
|
|
634
|
+
const pageNo = paginator.pageNo;
|
|
635
|
+
const pageType = "cursor";
|
|
636
|
+
const data = await this.getCollectionItemsBySlug({
|
|
637
|
+
slug: slug,
|
|
638
|
+
f: f,
|
|
639
|
+
filters: filters,
|
|
640
|
+
sortOn: sortOn,
|
|
641
|
+
pageId: pageId,
|
|
642
|
+
pageSize: pageSize,
|
|
643
|
+
});
|
|
644
|
+
paginator.setPaginator({
|
|
645
|
+
hasNext: data.page.has_next ? true : false,
|
|
646
|
+
nextId: data.page.next_id,
|
|
647
|
+
});
|
|
648
|
+
return data;
|
|
649
|
+
};
|
|
650
|
+
paginator.setCallback(callback);
|
|
651
|
+
return paginator;
|
|
652
|
+
}
|
|
653
|
+
|
|
654
|
+
/**
|
|
655
|
+
* @param {Object} arg - Arg object.
|
|
656
|
+
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
657
|
+
* given set of results.
|
|
658
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
659
|
+
* @param {string[]} [arg.tag] - List of tags to filter collections
|
|
660
|
+
* @returns {Promise<GetCollectionListingResponse>} - Success response
|
|
661
|
+
* @summary: List all the collections
|
|
662
|
+
* @description: Collections are a great way to organize your products and can improve the ability for customers to find items quickly and efficiently.
|
|
663
|
+
*/
|
|
664
|
+
async getCollections({ pageNo, pageSize, tag } = {}) {
|
|
665
|
+
const { error } = CatalogValidator.getCollections().validate(
|
|
666
|
+
{ pageNo, pageSize, tag },
|
|
582
667
|
{ abortEarly: false, allowUnknown: true }
|
|
583
668
|
);
|
|
584
669
|
if (error) {
|
|
@@ -586,25 +671,22 @@ class Catalog {
|
|
|
586
671
|
}
|
|
587
672
|
|
|
588
673
|
// Showing warrnings if extra unknown parameters are found
|
|
589
|
-
const {
|
|
590
|
-
|
|
591
|
-
} = CatalogValidator.getProductStockForTimeByIds().validate(
|
|
592
|
-
{ timestamp, pageSize, pageId },
|
|
674
|
+
const { error: warrning } = CatalogValidator.getCollections().validate(
|
|
675
|
+
{ pageNo, pageSize, tag },
|
|
593
676
|
{ abortEarly: false, allowUnknown: false }
|
|
594
677
|
);
|
|
595
678
|
if (warrning) {
|
|
596
679
|
Logger({
|
|
597
680
|
level: "WARN",
|
|
598
|
-
message:
|
|
599
|
-
"Parameter Validation warrnings for getProductStockForTimeByIds",
|
|
681
|
+
message: "Parameter Validation warrnings for getCollections",
|
|
600
682
|
});
|
|
601
683
|
Logger({ level: "WARN", message: warrning });
|
|
602
684
|
}
|
|
603
685
|
|
|
604
686
|
const query_params = {};
|
|
605
|
-
query_params["
|
|
687
|
+
query_params["page_no"] = pageNo;
|
|
606
688
|
query_params["page_size"] = pageSize;
|
|
607
|
-
query_params["
|
|
689
|
+
query_params["tag"] = tag;
|
|
608
690
|
|
|
609
691
|
const xHeaders = {};
|
|
610
692
|
|
|
@@ -612,7 +694,7 @@ class Catalog {
|
|
|
612
694
|
this._conf,
|
|
613
695
|
"get",
|
|
614
696
|
constructUrl({
|
|
615
|
-
url: this._urls["
|
|
697
|
+
url: this._urls["getCollections"],
|
|
616
698
|
params: {},
|
|
617
699
|
}),
|
|
618
700
|
query_params,
|
|
@@ -622,7 +704,7 @@ class Catalog {
|
|
|
622
704
|
|
|
623
705
|
const {
|
|
624
706
|
error: res_error,
|
|
625
|
-
} = CatalogModel.
|
|
707
|
+
} = CatalogModel.GetCollectionListingResponse().validate(response, {
|
|
626
708
|
abortEarly: false,
|
|
627
709
|
allowUnknown: false,
|
|
628
710
|
});
|
|
@@ -630,8 +712,7 @@ class Catalog {
|
|
|
630
712
|
if (res_error) {
|
|
631
713
|
Logger({
|
|
632
714
|
level: "WARN",
|
|
633
|
-
message:
|
|
634
|
-
"Response Validation Warnnings for getProductStockForTimeByIds",
|
|
715
|
+
message: "Response Validation Warnnings for getCollections",
|
|
635
716
|
});
|
|
636
717
|
Logger({ level: "WARN", message: res_error });
|
|
637
718
|
}
|
|
@@ -641,21 +722,21 @@ class Catalog {
|
|
|
641
722
|
|
|
642
723
|
/**
|
|
643
724
|
* @param {Object} arg - Arg object.
|
|
644
|
-
* @param {string} arg.timestamp - Timestamp in UTC format (2020-07-23T10:27:50Z)
|
|
645
725
|
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
646
|
-
* @
|
|
647
|
-
* @
|
|
726
|
+
* @param {string[]} [arg.tag] - List of tags to filter collections
|
|
727
|
+
* @summary: List all the collections
|
|
728
|
+
* @description: Collections are a great way to organize your products and can improve the ability for customers to find items quickly and efficiently.
|
|
648
729
|
*/
|
|
649
|
-
|
|
730
|
+
getCollectionsPaginator({ pageSize, tag } = {}) {
|
|
650
731
|
const paginator = new Paginator();
|
|
651
732
|
const callback = async () => {
|
|
652
733
|
const pageId = paginator.nextId;
|
|
653
734
|
const pageNo = paginator.pageNo;
|
|
654
|
-
const pageType = "
|
|
655
|
-
const data = await this.
|
|
656
|
-
|
|
735
|
+
const pageType = "number";
|
|
736
|
+
const data = await this.getCollections({
|
|
737
|
+
pageNo: pageNo,
|
|
657
738
|
pageSize: pageSize,
|
|
658
|
-
|
|
739
|
+
tag: tag,
|
|
659
740
|
});
|
|
660
741
|
paginator.setPaginator({
|
|
661
742
|
hasNext: data.page.has_next ? true : false,
|
|
@@ -669,38 +750,18 @@ class Catalog {
|
|
|
669
750
|
|
|
670
751
|
/**
|
|
671
752
|
* @param {Object} arg - Arg object.
|
|
672
|
-
* @param {string}
|
|
673
|
-
*
|
|
674
|
-
*
|
|
675
|
-
*
|
|
676
|
-
*
|
|
677
|
-
*
|
|
678
|
-
* @param {boolean} [arg.filters] - This is a boolean value, True for
|
|
679
|
-
* fetching all filter parameters and False for disabling the filter parameters.
|
|
680
|
-
* @param {string} [arg.sortOn] - The order in which the list of products
|
|
681
|
-
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
682
|
-
* either ascending or descending order. See the supported values below.
|
|
683
|
-
* @param {string} [arg.pageId] - Page ID to retrieve next set of results.
|
|
684
|
-
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
685
|
-
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
686
|
-
* given set of results.
|
|
687
|
-
* @param {string} [arg.pageType] - Available pagination types are cursor or number.
|
|
688
|
-
* @returns {Promise<ProductListingResponse>} - Success response
|
|
689
|
-
* @summary: Get all the products
|
|
690
|
-
* @description: Use this API to list all the products. You may choose a sort order or make arbitrary search queries by entering the product name, brand, category or collection.
|
|
753
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
754
|
+
* identifier of a product. You can get slug value from the endpoint
|
|
755
|
+
* /service/application/catalog/v1.0/products/
|
|
756
|
+
* @returns {Promise<ProductFrequentlyComparedSimilarResponse>} - Success response
|
|
757
|
+
* @summary: Get comparison between frequently compared products with the given product
|
|
758
|
+
* @description: Use this API to compare a given product automatically with products that are frequently compared with it. Only one slug is needed.
|
|
691
759
|
*/
|
|
692
|
-
async
|
|
693
|
-
|
|
694
|
-
|
|
695
|
-
|
|
696
|
-
|
|
697
|
-
pageId,
|
|
698
|
-
pageSize,
|
|
699
|
-
pageNo,
|
|
700
|
-
pageType,
|
|
701
|
-
} = {}) {
|
|
702
|
-
const { error } = CatalogValidator.getProducts().validate(
|
|
703
|
-
{ q, f, filters, sortOn, pageId, pageSize, pageNo, pageType },
|
|
760
|
+
async getComparedFrequentlyProductBySlug({ slug } = {}) {
|
|
761
|
+
const {
|
|
762
|
+
error,
|
|
763
|
+
} = CatalogValidator.getComparedFrequentlyProductBySlug().validate(
|
|
764
|
+
{ slug },
|
|
704
765
|
{ abortEarly: false, allowUnknown: true }
|
|
705
766
|
);
|
|
706
767
|
if (error) {
|
|
@@ -708,27 +769,22 @@ class Catalog {
|
|
|
708
769
|
}
|
|
709
770
|
|
|
710
771
|
// Showing warrnings if extra unknown parameters are found
|
|
711
|
-
const {
|
|
712
|
-
|
|
772
|
+
const {
|
|
773
|
+
error: warrning,
|
|
774
|
+
} = CatalogValidator.getComparedFrequentlyProductBySlug().validate(
|
|
775
|
+
{ slug },
|
|
713
776
|
{ abortEarly: false, allowUnknown: false }
|
|
714
777
|
);
|
|
715
778
|
if (warrning) {
|
|
716
779
|
Logger({
|
|
717
780
|
level: "WARN",
|
|
718
|
-
message:
|
|
781
|
+
message:
|
|
782
|
+
"Parameter Validation warrnings for getComparedFrequentlyProductBySlug",
|
|
719
783
|
});
|
|
720
784
|
Logger({ level: "WARN", message: warrning });
|
|
721
785
|
}
|
|
722
786
|
|
|
723
787
|
const query_params = {};
|
|
724
|
-
query_params["q"] = q;
|
|
725
|
-
query_params["f"] = f;
|
|
726
|
-
query_params["filters"] = filters;
|
|
727
|
-
query_params["sort_on"] = sortOn;
|
|
728
|
-
query_params["page_id"] = pageId;
|
|
729
|
-
query_params["page_size"] = pageSize;
|
|
730
|
-
query_params["page_no"] = pageNo;
|
|
731
|
-
query_params["page_type"] = pageType;
|
|
732
788
|
|
|
733
789
|
const xHeaders = {};
|
|
734
790
|
|
|
@@ -736,8 +792,8 @@ class Catalog {
|
|
|
736
792
|
this._conf,
|
|
737
793
|
"get",
|
|
738
794
|
constructUrl({
|
|
739
|
-
url: this._urls["
|
|
740
|
-
params: {},
|
|
795
|
+
url: this._urls["getComparedFrequentlyProductBySlug"],
|
|
796
|
+
params: { slug },
|
|
741
797
|
}),
|
|
742
798
|
query_params,
|
|
743
799
|
undefined,
|
|
@@ -746,15 +802,16 @@ class Catalog {
|
|
|
746
802
|
|
|
747
803
|
const {
|
|
748
804
|
error: res_error,
|
|
749
|
-
} = CatalogModel.
|
|
750
|
-
|
|
751
|
-
allowUnknown: false
|
|
752
|
-
|
|
805
|
+
} = CatalogModel.ProductFrequentlyComparedSimilarResponse().validate(
|
|
806
|
+
response,
|
|
807
|
+
{ abortEarly: false, allowUnknown: false }
|
|
808
|
+
);
|
|
753
809
|
|
|
754
810
|
if (res_error) {
|
|
755
811
|
Logger({
|
|
756
812
|
level: "WARN",
|
|
757
|
-
message:
|
|
813
|
+
message:
|
|
814
|
+
"Response Validation Warnnings for getComparedFrequentlyProductBySlug",
|
|
758
815
|
});
|
|
759
816
|
Logger({ level: "WARN", message: res_error });
|
|
760
817
|
}
|
|
@@ -764,63 +821,13 @@ class Catalog {
|
|
|
764
821
|
|
|
765
822
|
/**
|
|
766
823
|
* @param {Object} arg - Arg object.
|
|
767
|
-
* @
|
|
768
|
-
*
|
|
769
|
-
* @
|
|
770
|
-
* will be passed in f parameter as shown in the example below. Double
|
|
771
|
-
* Pipe (||) denotes the OR condition, whereas Triple-colon (:::)
|
|
772
|
-
* indicates a new filter paramater applied as an AND condition.
|
|
773
|
-
* @param {boolean} [arg.filters] - This is a boolean value, True for
|
|
774
|
-
* fetching all filter parameters and False for disabling the filter parameters.
|
|
775
|
-
* @param {string} [arg.sortOn] - The order in which the list of products
|
|
776
|
-
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
777
|
-
* either ascending or descending order. See the supported values below.
|
|
778
|
-
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
779
|
-
* @summary: Get all the products
|
|
780
|
-
* @description: Use this API to list all the products. You may choose a sort order or make arbitrary search queries by entering the product name, brand, category or collection.
|
|
781
|
-
*/
|
|
782
|
-
getProductsPaginator({ q, f, filters, sortOn, pageSize } = {}) {
|
|
783
|
-
const paginator = new Paginator();
|
|
784
|
-
const callback = async () => {
|
|
785
|
-
const pageId = paginator.nextId;
|
|
786
|
-
const pageNo = paginator.pageNo;
|
|
787
|
-
const pageType = "cursor";
|
|
788
|
-
const data = await this.getProducts({
|
|
789
|
-
q: q,
|
|
790
|
-
f: f,
|
|
791
|
-
filters: filters,
|
|
792
|
-
sortOn: sortOn,
|
|
793
|
-
pageId: pageId,
|
|
794
|
-
pageSize: pageSize,
|
|
795
|
-
pageNo: pageNo,
|
|
796
|
-
pageType: pageType,
|
|
797
|
-
});
|
|
798
|
-
paginator.setPaginator({
|
|
799
|
-
hasNext: data.page.has_next ? true : false,
|
|
800
|
-
nextId: data.page.next_id,
|
|
801
|
-
});
|
|
802
|
-
return data;
|
|
803
|
-
};
|
|
804
|
-
paginator.setCallback(callback);
|
|
805
|
-
return paginator;
|
|
806
|
-
}
|
|
807
|
-
|
|
808
|
-
/**
|
|
809
|
-
* @param {Object} arg - Arg object.
|
|
810
|
-
* @param {string} [arg.department] - The name of the department. Use this
|
|
811
|
-
* parameter to filter products by a particular department. See the list
|
|
812
|
-
* of available departments below. Also, you can get available departments
|
|
813
|
-
* from the endpoint /service/application/catalog/v1.0/departments/
|
|
814
|
-
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
815
|
-
* given set of results.
|
|
816
|
-
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
817
|
-
* @returns {Promise<BrandListingResponse>} - Success response
|
|
818
|
-
* @summary: Get all the brands
|
|
819
|
-
* @description: A brand is the name under which a product is sold. Use this API to list all the brands. You can also filter the brands by department.
|
|
824
|
+
* @returns {Promise<DepartmentResponse>} - Success response
|
|
825
|
+
* @summary: List all the departments
|
|
826
|
+
* @description: Departments are a way to categorise similar products. A product can lie in multiple departments. For example, a skirt can below to the 'Women's Fashion' Department while a handbag can lie in 'Women's Accessories' Department. Use this API to list all the departments. If successful, returns the list of departments specified in `DepartmentResponse`
|
|
820
827
|
*/
|
|
821
|
-
async
|
|
822
|
-
const { error } = CatalogValidator.
|
|
823
|
-
{
|
|
828
|
+
async getDepartments({} = {}) {
|
|
829
|
+
const { error } = CatalogValidator.getDepartments().validate(
|
|
830
|
+
{},
|
|
824
831
|
{ abortEarly: false, allowUnknown: true }
|
|
825
832
|
);
|
|
826
833
|
if (error) {
|
|
@@ -828,22 +835,19 @@ class Catalog {
|
|
|
828
835
|
}
|
|
829
836
|
|
|
830
837
|
// Showing warrnings if extra unknown parameters are found
|
|
831
|
-
const { error: warrning } = CatalogValidator.
|
|
832
|
-
{
|
|
838
|
+
const { error: warrning } = CatalogValidator.getDepartments().validate(
|
|
839
|
+
{},
|
|
833
840
|
{ abortEarly: false, allowUnknown: false }
|
|
834
841
|
);
|
|
835
842
|
if (warrning) {
|
|
836
843
|
Logger({
|
|
837
844
|
level: "WARN",
|
|
838
|
-
message: "Parameter Validation warrnings for
|
|
845
|
+
message: "Parameter Validation warrnings for getDepartments",
|
|
839
846
|
});
|
|
840
847
|
Logger({ level: "WARN", message: warrning });
|
|
841
848
|
}
|
|
842
849
|
|
|
843
850
|
const query_params = {};
|
|
844
|
-
query_params["department"] = department;
|
|
845
|
-
query_params["page_no"] = pageNo;
|
|
846
|
-
query_params["page_size"] = pageSize;
|
|
847
851
|
|
|
848
852
|
const xHeaders = {};
|
|
849
853
|
|
|
@@ -851,7 +855,7 @@ class Catalog {
|
|
|
851
855
|
this._conf,
|
|
852
856
|
"get",
|
|
853
857
|
constructUrl({
|
|
854
|
-
url: this._urls["
|
|
858
|
+
url: this._urls["getDepartments"],
|
|
855
859
|
params: {},
|
|
856
860
|
}),
|
|
857
861
|
query_params,
|
|
@@ -861,7 +865,7 @@ class Catalog {
|
|
|
861
865
|
|
|
862
866
|
const {
|
|
863
867
|
error: res_error,
|
|
864
|
-
} = CatalogModel.
|
|
868
|
+
} = CatalogModel.DepartmentResponse().validate(response, {
|
|
865
869
|
abortEarly: false,
|
|
866
870
|
allowUnknown: false,
|
|
867
871
|
});
|
|
@@ -869,7 +873,7 @@ class Catalog {
|
|
|
869
873
|
if (res_error) {
|
|
870
874
|
Logger({
|
|
871
875
|
level: "WARN",
|
|
872
|
-
message: "Response Validation Warnnings for
|
|
876
|
+
message: "Response Validation Warnnings for getDepartments",
|
|
873
877
|
});
|
|
874
878
|
Logger({ level: "WARN", message: res_error });
|
|
875
879
|
}
|
|
@@ -879,47 +883,15 @@ class Catalog {
|
|
|
879
883
|
|
|
880
884
|
/**
|
|
881
885
|
* @param {Object} arg - Arg object.
|
|
882
|
-
* @param {string} [arg.
|
|
883
|
-
*
|
|
884
|
-
*
|
|
885
|
-
*
|
|
886
|
-
* @
|
|
887
|
-
* @summary: Get all the brands
|
|
888
|
-
* @description: A brand is the name under which a product is sold. Use this API to list all the brands. You can also filter the brands by department.
|
|
889
|
-
*/
|
|
890
|
-
getBrandsPaginator({ department, pageSize } = {}) {
|
|
891
|
-
const paginator = new Paginator();
|
|
892
|
-
const callback = async () => {
|
|
893
|
-
const pageId = paginator.nextId;
|
|
894
|
-
const pageNo = paginator.pageNo;
|
|
895
|
-
const pageType = "number";
|
|
896
|
-
const data = await this.getBrands({
|
|
897
|
-
department: department,
|
|
898
|
-
pageNo: pageNo,
|
|
899
|
-
pageSize: pageSize,
|
|
900
|
-
});
|
|
901
|
-
paginator.setPaginator({
|
|
902
|
-
hasNext: data.page.has_next ? true : false,
|
|
903
|
-
nextId: data.page.next_id,
|
|
904
|
-
});
|
|
905
|
-
return data;
|
|
906
|
-
};
|
|
907
|
-
paginator.setCallback(callback);
|
|
908
|
-
return paginator;
|
|
909
|
-
}
|
|
910
|
-
|
|
911
|
-
/**
|
|
912
|
-
* @param {Object} arg - Arg object.
|
|
913
|
-
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
914
|
-
* identifier of a brand. You can get slug value from the endpoint
|
|
915
|
-
* /service/application/catalog/v1.0/brands/.
|
|
916
|
-
* @returns {Promise<BrandDetailResponse>} - Success response
|
|
917
|
-
* @summary: Get metadata of a brand
|
|
918
|
-
* @description: Fetch metadata of a brand such as name, information, logo, banner, etc.
|
|
886
|
+
* @param {string} [arg.collectionType] - Type of collection, i.e. products,
|
|
887
|
+
* brands, collections.
|
|
888
|
+
* @returns {Promise<FollowIdsResponse>} - Success response
|
|
889
|
+
* @summary: Get the IDs of followed products, brands and collections.
|
|
890
|
+
* @description: You can get the IDs of all the followed Products, Brands and Collections. Pass collection_type as query parameter to fetch specific Ids
|
|
919
891
|
*/
|
|
920
|
-
async
|
|
921
|
-
const { error } = CatalogValidator.
|
|
922
|
-
{
|
|
892
|
+
async getFollowIds({ collectionType } = {}) {
|
|
893
|
+
const { error } = CatalogValidator.getFollowIds().validate(
|
|
894
|
+
{ collectionType },
|
|
923
895
|
{ abortEarly: false, allowUnknown: true }
|
|
924
896
|
);
|
|
925
897
|
if (error) {
|
|
@@ -927,21 +899,20 @@ class Catalog {
|
|
|
927
899
|
}
|
|
928
900
|
|
|
929
901
|
// Showing warrnings if extra unknown parameters are found
|
|
930
|
-
const {
|
|
931
|
-
|
|
932
|
-
} = CatalogValidator.getBrandDetailBySlug().validate(
|
|
933
|
-
{ slug },
|
|
902
|
+
const { error: warrning } = CatalogValidator.getFollowIds().validate(
|
|
903
|
+
{ collectionType },
|
|
934
904
|
{ abortEarly: false, allowUnknown: false }
|
|
935
905
|
);
|
|
936
906
|
if (warrning) {
|
|
937
907
|
Logger({
|
|
938
908
|
level: "WARN",
|
|
939
|
-
message: "Parameter Validation warrnings for
|
|
909
|
+
message: "Parameter Validation warrnings for getFollowIds",
|
|
940
910
|
});
|
|
941
911
|
Logger({ level: "WARN", message: warrning });
|
|
942
912
|
}
|
|
943
913
|
|
|
944
914
|
const query_params = {};
|
|
915
|
+
query_params["collection_type"] = collectionType;
|
|
945
916
|
|
|
946
917
|
const xHeaders = {};
|
|
947
918
|
|
|
@@ -949,8 +920,8 @@ class Catalog {
|
|
|
949
920
|
this._conf,
|
|
950
921
|
"get",
|
|
951
922
|
constructUrl({
|
|
952
|
-
url: this._urls["
|
|
953
|
-
params: {
|
|
923
|
+
url: this._urls["getFollowIds"],
|
|
924
|
+
params: {},
|
|
954
925
|
}),
|
|
955
926
|
query_params,
|
|
956
927
|
undefined,
|
|
@@ -959,7 +930,7 @@ class Catalog {
|
|
|
959
930
|
|
|
960
931
|
const {
|
|
961
932
|
error: res_error,
|
|
962
|
-
} = CatalogModel.
|
|
933
|
+
} = CatalogModel.FollowIdsResponse().validate(response, {
|
|
963
934
|
abortEarly: false,
|
|
964
935
|
allowUnknown: false,
|
|
965
936
|
});
|
|
@@ -967,7 +938,7 @@ class Catalog {
|
|
|
967
938
|
if (res_error) {
|
|
968
939
|
Logger({
|
|
969
940
|
level: "WARN",
|
|
970
|
-
message: "Response Validation Warnnings for
|
|
941
|
+
message: "Response Validation Warnnings for getFollowIds",
|
|
971
942
|
});
|
|
972
943
|
Logger({ level: "WARN", message: res_error });
|
|
973
944
|
}
|
|
@@ -977,17 +948,17 @@ class Catalog {
|
|
|
977
948
|
|
|
978
949
|
/**
|
|
979
950
|
* @param {Object} arg - Arg object.
|
|
980
|
-
* @param {string}
|
|
981
|
-
*
|
|
982
|
-
*
|
|
983
|
-
*
|
|
984
|
-
* @returns {Promise<
|
|
985
|
-
* @summary:
|
|
986
|
-
* @description:
|
|
951
|
+
* @param {string} arg.collectionType - Type of collection followed, i.e.
|
|
952
|
+
* products, brands, or collections.
|
|
953
|
+
* @param {string} [arg.pageId] - Page ID to retrieve next set of results.
|
|
954
|
+
* @param {number} [arg.pageSize] - Page ID to retrieve next set of results.
|
|
955
|
+
* @returns {Promise<GetFollowListingResponse>} - Success response
|
|
956
|
+
* @summary: Get a list of followed Products, Brands, Collections
|
|
957
|
+
* @description: Users can follow a product they like. This API retrieves the products the user have followed.
|
|
987
958
|
*/
|
|
988
|
-
async
|
|
989
|
-
const { error } = CatalogValidator.
|
|
990
|
-
{
|
|
959
|
+
async getFollowedListing({ collectionType, pageId, pageSize } = {}) {
|
|
960
|
+
const { error } = CatalogValidator.getFollowedListing().validate(
|
|
961
|
+
{ collectionType, pageId, pageSize },
|
|
991
962
|
{ abortEarly: false, allowUnknown: true }
|
|
992
963
|
);
|
|
993
964
|
if (error) {
|
|
@@ -995,20 +966,21 @@ class Catalog {
|
|
|
995
966
|
}
|
|
996
967
|
|
|
997
968
|
// Showing warrnings if extra unknown parameters are found
|
|
998
|
-
const { error: warrning } = CatalogValidator.
|
|
999
|
-
{
|
|
969
|
+
const { error: warrning } = CatalogValidator.getFollowedListing().validate(
|
|
970
|
+
{ collectionType, pageId, pageSize },
|
|
1000
971
|
{ abortEarly: false, allowUnknown: false }
|
|
1001
972
|
);
|
|
1002
973
|
if (warrning) {
|
|
1003
974
|
Logger({
|
|
1004
975
|
level: "WARN",
|
|
1005
|
-
message: "Parameter Validation warrnings for
|
|
976
|
+
message: "Parameter Validation warrnings for getFollowedListing",
|
|
1006
977
|
});
|
|
1007
978
|
Logger({ level: "WARN", message: warrning });
|
|
1008
979
|
}
|
|
1009
980
|
|
|
1010
981
|
const query_params = {};
|
|
1011
|
-
query_params["
|
|
982
|
+
query_params["page_id"] = pageId;
|
|
983
|
+
query_params["page_size"] = pageSize;
|
|
1012
984
|
|
|
1013
985
|
const xHeaders = {};
|
|
1014
986
|
|
|
@@ -1016,8 +988,8 @@ class Catalog {
|
|
|
1016
988
|
this._conf,
|
|
1017
989
|
"get",
|
|
1018
990
|
constructUrl({
|
|
1019
|
-
url: this._urls["
|
|
1020
|
-
params: {},
|
|
991
|
+
url: this._urls["getFollowedListing"],
|
|
992
|
+
params: { collectionType },
|
|
1021
993
|
}),
|
|
1022
994
|
query_params,
|
|
1023
995
|
undefined,
|
|
@@ -1026,7 +998,7 @@ class Catalog {
|
|
|
1026
998
|
|
|
1027
999
|
const {
|
|
1028
1000
|
error: res_error,
|
|
1029
|
-
} = CatalogModel.
|
|
1001
|
+
} = CatalogModel.GetFollowListingResponse().validate(response, {
|
|
1030
1002
|
abortEarly: false,
|
|
1031
1003
|
allowUnknown: false,
|
|
1032
1004
|
});
|
|
@@ -1034,7 +1006,7 @@ class Catalog {
|
|
|
1034
1006
|
if (res_error) {
|
|
1035
1007
|
Logger({
|
|
1036
1008
|
level: "WARN",
|
|
1037
|
-
message: "Response Validation Warnnings for
|
|
1009
|
+
message: "Response Validation Warnnings for getFollowedListing",
|
|
1038
1010
|
});
|
|
1039
1011
|
Logger({ level: "WARN", message: res_error });
|
|
1040
1012
|
}
|
|
@@ -1044,36 +1016,65 @@ class Catalog {
|
|
|
1044
1016
|
|
|
1045
1017
|
/**
|
|
1046
1018
|
* @param {Object} arg - Arg object.
|
|
1047
|
-
* @param {string} arg.
|
|
1048
|
-
*
|
|
1049
|
-
*
|
|
1050
|
-
* @
|
|
1051
|
-
* @
|
|
1052
|
-
* @description: Fetch metadata of a category such as name, information, logo, banner, etc.
|
|
1019
|
+
* @param {string} arg.collectionType - Type of collection followed, i.e.
|
|
1020
|
+
* products, brands, or collections.
|
|
1021
|
+
* @param {number} [arg.pageSize] - Page ID to retrieve next set of results.
|
|
1022
|
+
* @summary: Get a list of followed Products, Brands, Collections
|
|
1023
|
+
* @description: Users can follow a product they like. This API retrieves the products the user have followed.
|
|
1053
1024
|
*/
|
|
1054
|
-
|
|
1055
|
-
const
|
|
1056
|
-
|
|
1057
|
-
|
|
1058
|
-
|
|
1059
|
-
|
|
1060
|
-
|
|
1061
|
-
|
|
1062
|
-
|
|
1063
|
-
|
|
1064
|
-
|
|
1065
|
-
|
|
1066
|
-
|
|
1067
|
-
|
|
1068
|
-
|
|
1069
|
-
|
|
1070
|
-
|
|
1071
|
-
|
|
1072
|
-
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1025
|
+
getFollowedListingPaginator({ collectionType, pageSize } = {}) {
|
|
1026
|
+
const paginator = new Paginator();
|
|
1027
|
+
const callback = async () => {
|
|
1028
|
+
const pageId = paginator.nextId;
|
|
1029
|
+
const pageNo = paginator.pageNo;
|
|
1030
|
+
const pageType = "cursor";
|
|
1031
|
+
const data = await this.getFollowedListing({
|
|
1032
|
+
collectionType: collectionType,
|
|
1033
|
+
pageId: pageId,
|
|
1034
|
+
pageSize: pageSize,
|
|
1035
|
+
});
|
|
1036
|
+
paginator.setPaginator({
|
|
1037
|
+
hasNext: data.page.has_next ? true : false,
|
|
1038
|
+
nextId: data.page.next_id,
|
|
1039
|
+
});
|
|
1040
|
+
return data;
|
|
1041
|
+
};
|
|
1042
|
+
paginator.setCallback(callback);
|
|
1043
|
+
return paginator;
|
|
1044
|
+
}
|
|
1045
|
+
|
|
1046
|
+
/**
|
|
1047
|
+
* @param {Object} arg - Arg object.
|
|
1048
|
+
* @param {string} arg.collectionType - Type of collection, i.e. products,
|
|
1049
|
+
* brands, or collections.
|
|
1050
|
+
* @param {string} arg.collectionId - The ID of the collection type.
|
|
1051
|
+
* @returns {Promise<FollowerCountResponse>} - Success response
|
|
1052
|
+
* @summary: Get Follow Count
|
|
1053
|
+
* @description: Get the total count of followers for a given collection type and collection ID.
|
|
1054
|
+
*/
|
|
1055
|
+
async getFollowerCountById({ collectionType, collectionId } = {}) {
|
|
1056
|
+
const { error } = CatalogValidator.getFollowerCountById().validate(
|
|
1057
|
+
{ collectionType, collectionId },
|
|
1058
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1059
|
+
);
|
|
1060
|
+
if (error) {
|
|
1061
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1062
|
+
}
|
|
1063
|
+
|
|
1064
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1065
|
+
const {
|
|
1066
|
+
error: warrning,
|
|
1067
|
+
} = CatalogValidator.getFollowerCountById().validate(
|
|
1068
|
+
{ collectionType, collectionId },
|
|
1069
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1070
|
+
);
|
|
1071
|
+
if (warrning) {
|
|
1072
|
+
Logger({
|
|
1073
|
+
level: "WARN",
|
|
1074
|
+
message: "Parameter Validation warrnings for getFollowerCountById",
|
|
1075
|
+
});
|
|
1076
|
+
Logger({ level: "WARN", message: warrning });
|
|
1077
|
+
}
|
|
1077
1078
|
|
|
1078
1079
|
const query_params = {};
|
|
1079
1080
|
|
|
@@ -1083,8 +1084,8 @@ class Catalog {
|
|
|
1083
1084
|
this._conf,
|
|
1084
1085
|
"get",
|
|
1085
1086
|
constructUrl({
|
|
1086
|
-
url: this._urls["
|
|
1087
|
-
params: {
|
|
1087
|
+
url: this._urls["getFollowerCountById"],
|
|
1088
|
+
params: { collectionType, collectionId },
|
|
1088
1089
|
}),
|
|
1089
1090
|
query_params,
|
|
1090
1091
|
undefined,
|
|
@@ -1093,7 +1094,7 @@ class Catalog {
|
|
|
1093
1094
|
|
|
1094
1095
|
const {
|
|
1095
1096
|
error: res_error,
|
|
1096
|
-
} = CatalogModel.
|
|
1097
|
+
} = CatalogModel.FollowerCountResponse().validate(response, {
|
|
1097
1098
|
abortEarly: false,
|
|
1098
1099
|
allowUnknown: false,
|
|
1099
1100
|
});
|
|
@@ -1101,7 +1102,7 @@ class Catalog {
|
|
|
1101
1102
|
if (res_error) {
|
|
1102
1103
|
Logger({
|
|
1103
1104
|
level: "WARN",
|
|
1104
|
-
message: "Response Validation Warnnings for
|
|
1105
|
+
message: "Response Validation Warnnings for getFollowerCountById",
|
|
1105
1106
|
});
|
|
1106
1107
|
Logger({ level: "WARN", message: res_error });
|
|
1107
1108
|
}
|
|
@@ -1211,13 +1212,32 @@ class Catalog {
|
|
|
1211
1212
|
|
|
1212
1213
|
/**
|
|
1213
1214
|
* @param {Object} arg - Arg object.
|
|
1214
|
-
* @
|
|
1215
|
-
*
|
|
1216
|
-
* @
|
|
1215
|
+
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
1216
|
+
* given set of results.
|
|
1217
|
+
* @param {number} [arg.pageSize] - Number of items to retrieve in each page.
|
|
1218
|
+
* @param {string} [arg.q] - Search a store by its name or store_code.
|
|
1219
|
+
* @param {string} [arg.city] - Search stores by the city in which they are situated.
|
|
1220
|
+
* @param {number} [arg.range] - Use this to retrieve stores within a
|
|
1221
|
+
* particular range in meters, e.g. 10000, to indicate a 10km range
|
|
1222
|
+
* @param {number} [arg.latitude] - Latitude of the location from where one
|
|
1223
|
+
* wants to retreive the nearest stores, e.g. 72.8691788
|
|
1224
|
+
* @param {number} [arg.longitude] - Longitude of the location from where
|
|
1225
|
+
* one wants to retreive the nearest stores, e.g. 19.1174114
|
|
1226
|
+
* @returns {Promise<ApplicationStoreListing>} - Success response
|
|
1227
|
+
* @summary: Get store meta information.
|
|
1228
|
+
* @description: Use this API to get a list of stores in a specific application.
|
|
1217
1229
|
*/
|
|
1218
|
-
async
|
|
1219
|
-
|
|
1220
|
-
|
|
1230
|
+
async getInStockLocations({
|
|
1231
|
+
pageNo,
|
|
1232
|
+
pageSize,
|
|
1233
|
+
q,
|
|
1234
|
+
city,
|
|
1235
|
+
range,
|
|
1236
|
+
latitude,
|
|
1237
|
+
longitude,
|
|
1238
|
+
} = {}) {
|
|
1239
|
+
const { error } = CatalogValidator.getInStockLocations().validate(
|
|
1240
|
+
{ pageNo, pageSize, q, city, range, latitude, longitude },
|
|
1221
1241
|
{ abortEarly: false, allowUnknown: true }
|
|
1222
1242
|
);
|
|
1223
1243
|
if (error) {
|
|
@@ -1225,19 +1245,26 @@ class Catalog {
|
|
|
1225
1245
|
}
|
|
1226
1246
|
|
|
1227
1247
|
// Showing warrnings if extra unknown parameters are found
|
|
1228
|
-
const { error: warrning } = CatalogValidator.
|
|
1229
|
-
{},
|
|
1248
|
+
const { error: warrning } = CatalogValidator.getInStockLocations().validate(
|
|
1249
|
+
{ pageNo, pageSize, q, city, range, latitude, longitude },
|
|
1230
1250
|
{ abortEarly: false, allowUnknown: false }
|
|
1231
1251
|
);
|
|
1232
1252
|
if (warrning) {
|
|
1233
1253
|
Logger({
|
|
1234
1254
|
level: "WARN",
|
|
1235
|
-
message: "Parameter Validation warrnings for
|
|
1255
|
+
message: "Parameter Validation warrnings for getInStockLocations",
|
|
1236
1256
|
});
|
|
1237
1257
|
Logger({ level: "WARN", message: warrning });
|
|
1238
1258
|
}
|
|
1239
1259
|
|
|
1240
1260
|
const query_params = {};
|
|
1261
|
+
query_params["page_no"] = pageNo;
|
|
1262
|
+
query_params["page_size"] = pageSize;
|
|
1263
|
+
query_params["q"] = q;
|
|
1264
|
+
query_params["city"] = city;
|
|
1265
|
+
query_params["range"] = range;
|
|
1266
|
+
query_params["latitude"] = latitude;
|
|
1267
|
+
query_params["longitude"] = longitude;
|
|
1241
1268
|
|
|
1242
1269
|
const xHeaders = {};
|
|
1243
1270
|
|
|
@@ -1245,7 +1272,7 @@ class Catalog {
|
|
|
1245
1272
|
this._conf,
|
|
1246
1273
|
"get",
|
|
1247
1274
|
constructUrl({
|
|
1248
|
-
url: this._urls["
|
|
1275
|
+
url: this._urls["getInStockLocations"],
|
|
1249
1276
|
params: {},
|
|
1250
1277
|
}),
|
|
1251
1278
|
query_params,
|
|
@@ -1255,7 +1282,7 @@ class Catalog {
|
|
|
1255
1282
|
|
|
1256
1283
|
const {
|
|
1257
1284
|
error: res_error,
|
|
1258
|
-
} = CatalogModel.
|
|
1285
|
+
} = CatalogModel.ApplicationStoreListing().validate(response, {
|
|
1259
1286
|
abortEarly: false,
|
|
1260
1287
|
allowUnknown: false,
|
|
1261
1288
|
});
|
|
@@ -1263,7 +1290,7 @@ class Catalog {
|
|
|
1263
1290
|
if (res_error) {
|
|
1264
1291
|
Logger({
|
|
1265
1292
|
level: "WARN",
|
|
1266
|
-
message: "Response Validation Warnnings for
|
|
1293
|
+
message: "Response Validation Warnnings for getInStockLocations",
|
|
1267
1294
|
});
|
|
1268
1295
|
Logger({ level: "WARN", message: res_error });
|
|
1269
1296
|
}
|
|
@@ -1273,17 +1300,60 @@ class Catalog {
|
|
|
1273
1300
|
|
|
1274
1301
|
/**
|
|
1275
1302
|
* @param {Object} arg - Arg object.
|
|
1276
|
-
* @param {
|
|
1277
|
-
*
|
|
1278
|
-
*
|
|
1279
|
-
*
|
|
1280
|
-
*
|
|
1281
|
-
* @
|
|
1282
|
-
*
|
|
1303
|
+
* @param {number} [arg.pageSize] - Number of items to retrieve in each page.
|
|
1304
|
+
* @param {string} [arg.q] - Search a store by its name or store_code.
|
|
1305
|
+
* @param {string} [arg.city] - Search stores by the city in which they are situated.
|
|
1306
|
+
* @param {number} [arg.range] - Use this to retrieve stores within a
|
|
1307
|
+
* particular range in meters, e.g. 10000, to indicate a 10km range
|
|
1308
|
+
* @param {number} [arg.latitude] - Latitude of the location from where one
|
|
1309
|
+
* wants to retreive the nearest stores, e.g. 72.8691788
|
|
1310
|
+
* @param {number} [arg.longitude] - Longitude of the location from where
|
|
1311
|
+
* one wants to retreive the nearest stores, e.g. 19.1174114
|
|
1312
|
+
* @summary: Get store meta information.
|
|
1313
|
+
* @description: Use this API to get a list of stores in a specific application.
|
|
1283
1314
|
*/
|
|
1284
|
-
|
|
1285
|
-
|
|
1286
|
-
|
|
1315
|
+
getInStockLocationsPaginator({
|
|
1316
|
+
pageSize,
|
|
1317
|
+
q,
|
|
1318
|
+
city,
|
|
1319
|
+
range,
|
|
1320
|
+
latitude,
|
|
1321
|
+
longitude,
|
|
1322
|
+
} = {}) {
|
|
1323
|
+
const paginator = new Paginator();
|
|
1324
|
+
const callback = async () => {
|
|
1325
|
+
const pageId = paginator.nextId;
|
|
1326
|
+
const pageNo = paginator.pageNo;
|
|
1327
|
+
const pageType = "number";
|
|
1328
|
+
const data = await this.getInStockLocations({
|
|
1329
|
+
pageNo: pageNo,
|
|
1330
|
+
pageSize: pageSize,
|
|
1331
|
+
q: q,
|
|
1332
|
+
city: city,
|
|
1333
|
+
range: range,
|
|
1334
|
+
latitude: latitude,
|
|
1335
|
+
longitude: longitude,
|
|
1336
|
+
});
|
|
1337
|
+
paginator.setPaginator({
|
|
1338
|
+
hasNext: data.page.has_next ? true : false,
|
|
1339
|
+
nextId: data.page.next_id,
|
|
1340
|
+
});
|
|
1341
|
+
return data;
|
|
1342
|
+
};
|
|
1343
|
+
paginator.setCallback(callback);
|
|
1344
|
+
return paginator;
|
|
1345
|
+
}
|
|
1346
|
+
|
|
1347
|
+
/**
|
|
1348
|
+
* @param {Object} arg - Arg object.
|
|
1349
|
+
* @param {number} arg.locationId - Unique Location ID.
|
|
1350
|
+
* @returns {Promise<StoreDetails>} - Success response
|
|
1351
|
+
* @summary: Get store meta information.
|
|
1352
|
+
* @description: Use this API to get meta details for a store.
|
|
1353
|
+
*/
|
|
1354
|
+
async getLocationDetailsById({ locationId } = {}) {
|
|
1355
|
+
const { error } = CatalogValidator.getLocationDetailsById().validate(
|
|
1356
|
+
{ locationId },
|
|
1287
1357
|
{ abortEarly: false, allowUnknown: true }
|
|
1288
1358
|
);
|
|
1289
1359
|
if (error) {
|
|
@@ -1291,20 +1361,21 @@ class Catalog {
|
|
|
1291
1361
|
}
|
|
1292
1362
|
|
|
1293
1363
|
// Showing warrnings if extra unknown parameters are found
|
|
1294
|
-
const {
|
|
1295
|
-
|
|
1364
|
+
const {
|
|
1365
|
+
error: warrning,
|
|
1366
|
+
} = CatalogValidator.getLocationDetailsById().validate(
|
|
1367
|
+
{ locationId },
|
|
1296
1368
|
{ abortEarly: false, allowUnknown: false }
|
|
1297
1369
|
);
|
|
1298
1370
|
if (warrning) {
|
|
1299
1371
|
Logger({
|
|
1300
1372
|
level: "WARN",
|
|
1301
|
-
message: "Parameter Validation warrnings for
|
|
1373
|
+
message: "Parameter Validation warrnings for getLocationDetailsById",
|
|
1302
1374
|
});
|
|
1303
1375
|
Logger({ level: "WARN", message: warrning });
|
|
1304
1376
|
}
|
|
1305
1377
|
|
|
1306
1378
|
const query_params = {};
|
|
1307
|
-
query_params["q"] = q;
|
|
1308
1379
|
|
|
1309
1380
|
const xHeaders = {};
|
|
1310
1381
|
|
|
@@ -1312,25 +1383,23 @@ class Catalog {
|
|
|
1312
1383
|
this._conf,
|
|
1313
1384
|
"get",
|
|
1314
1385
|
constructUrl({
|
|
1315
|
-
url: this._urls["
|
|
1316
|
-
params: {},
|
|
1386
|
+
url: this._urls["getLocationDetailsById"],
|
|
1387
|
+
params: { locationId },
|
|
1317
1388
|
}),
|
|
1318
1389
|
query_params,
|
|
1319
1390
|
undefined,
|
|
1320
1391
|
xHeaders
|
|
1321
1392
|
);
|
|
1322
1393
|
|
|
1323
|
-
const {
|
|
1324
|
-
|
|
1325
|
-
|
|
1326
|
-
|
|
1327
|
-
allowUnknown: false,
|
|
1328
|
-
});
|
|
1394
|
+
const { error: res_error } = CatalogModel.StoreDetails().validate(
|
|
1395
|
+
response,
|
|
1396
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1397
|
+
);
|
|
1329
1398
|
|
|
1330
1399
|
if (res_error) {
|
|
1331
1400
|
Logger({
|
|
1332
1401
|
level: "WARN",
|
|
1333
|
-
message: "Response Validation Warnnings for
|
|
1402
|
+
message: "Response Validation Warnnings for getLocationDetailsById",
|
|
1334
1403
|
});
|
|
1335
1404
|
Logger({ level: "WARN", message: res_error });
|
|
1336
1405
|
}
|
|
@@ -1340,17 +1409,15 @@ class Catalog {
|
|
|
1340
1409
|
|
|
1341
1410
|
/**
|
|
1342
1411
|
* @param {Object} arg - Arg object.
|
|
1343
|
-
* @param {
|
|
1344
|
-
*
|
|
1345
|
-
* @
|
|
1346
|
-
* @
|
|
1347
|
-
* @
|
|
1348
|
-
* @summary: List all the collections
|
|
1349
|
-
* @description: Collections are a great way to organize your products and can improve the ability for customers to find items quickly and efficiently.
|
|
1412
|
+
* @param {string} [arg.slug] - Product slug for which bundles need to be fetched.
|
|
1413
|
+
* @param {string} [arg.id] - Product uid
|
|
1414
|
+
* @returns {Promise<ProductBundle>} - Success response
|
|
1415
|
+
* @summary: Get product bundles
|
|
1416
|
+
* @description: Use this API to retrieve products bundles to the one specified by its slug.
|
|
1350
1417
|
*/
|
|
1351
|
-
async
|
|
1352
|
-
const { error } = CatalogValidator.
|
|
1353
|
-
{
|
|
1418
|
+
async getProductBundlesBySlug({ slug, id } = {}) {
|
|
1419
|
+
const { error } = CatalogValidator.getProductBundlesBySlug().validate(
|
|
1420
|
+
{ slug, id },
|
|
1354
1421
|
{ abortEarly: false, allowUnknown: true }
|
|
1355
1422
|
);
|
|
1356
1423
|
if (error) {
|
|
@@ -1358,22 +1425,23 @@ class Catalog {
|
|
|
1358
1425
|
}
|
|
1359
1426
|
|
|
1360
1427
|
// Showing warrnings if extra unknown parameters are found
|
|
1361
|
-
const {
|
|
1362
|
-
|
|
1428
|
+
const {
|
|
1429
|
+
error: warrning,
|
|
1430
|
+
} = CatalogValidator.getProductBundlesBySlug().validate(
|
|
1431
|
+
{ slug, id },
|
|
1363
1432
|
{ abortEarly: false, allowUnknown: false }
|
|
1364
1433
|
);
|
|
1365
1434
|
if (warrning) {
|
|
1366
1435
|
Logger({
|
|
1367
1436
|
level: "WARN",
|
|
1368
|
-
message: "Parameter Validation warrnings for
|
|
1437
|
+
message: "Parameter Validation warrnings for getProductBundlesBySlug",
|
|
1369
1438
|
});
|
|
1370
1439
|
Logger({ level: "WARN", message: warrning });
|
|
1371
1440
|
}
|
|
1372
1441
|
|
|
1373
1442
|
const query_params = {};
|
|
1374
|
-
query_params["
|
|
1375
|
-
query_params["
|
|
1376
|
-
query_params["tag"] = tag;
|
|
1443
|
+
query_params["slug"] = slug;
|
|
1444
|
+
query_params["id"] = id;
|
|
1377
1445
|
|
|
1378
1446
|
const xHeaders = {};
|
|
1379
1447
|
|
|
@@ -1381,7 +1449,7 @@ class Catalog {
|
|
|
1381
1449
|
this._conf,
|
|
1382
1450
|
"get",
|
|
1383
1451
|
constructUrl({
|
|
1384
|
-
url: this._urls["
|
|
1452
|
+
url: this._urls["getProductBundlesBySlug"],
|
|
1385
1453
|
params: {},
|
|
1386
1454
|
}),
|
|
1387
1455
|
query_params,
|
|
@@ -1389,17 +1457,15 @@ class Catalog {
|
|
|
1389
1457
|
xHeaders
|
|
1390
1458
|
);
|
|
1391
1459
|
|
|
1392
|
-
const {
|
|
1393
|
-
|
|
1394
|
-
|
|
1395
|
-
|
|
1396
|
-
allowUnknown: false,
|
|
1397
|
-
});
|
|
1460
|
+
const { error: res_error } = CatalogModel.ProductBundle().validate(
|
|
1461
|
+
response,
|
|
1462
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1463
|
+
);
|
|
1398
1464
|
|
|
1399
1465
|
if (res_error) {
|
|
1400
1466
|
Logger({
|
|
1401
1467
|
level: "WARN",
|
|
1402
|
-
message: "Response Validation Warnnings for
|
|
1468
|
+
message: "Response Validation Warnnings for getProductBundlesBySlug",
|
|
1403
1469
|
});
|
|
1404
1470
|
Logger({ level: "WARN", message: res_error });
|
|
1405
1471
|
}
|
|
@@ -1409,62 +1475,16 @@ class Catalog {
|
|
|
1409
1475
|
|
|
1410
1476
|
/**
|
|
1411
1477
|
* @param {Object} arg - Arg object.
|
|
1412
|
-
* @param {
|
|
1413
|
-
*
|
|
1414
|
-
*
|
|
1415
|
-
* @
|
|
1478
|
+
* @param {string[]} arg.slug - A short, human-readable, URL-friendly
|
|
1479
|
+
* identifier of a product. You can get slug value from the endpoint
|
|
1480
|
+
* /service/application/catalog/v1.0/products/.
|
|
1481
|
+
* @returns {Promise<ProductsComparisonResponse>} - Success response
|
|
1482
|
+
* @summary: Compare products
|
|
1483
|
+
* @description: Use this API to compare the features of products belonging to the same category. Note that at least one slug is mandatory in the request query.
|
|
1416
1484
|
*/
|
|
1417
|
-
|
|
1418
|
-
const
|
|
1419
|
-
|
|
1420
|
-
const pageId = paginator.nextId;
|
|
1421
|
-
const pageNo = paginator.pageNo;
|
|
1422
|
-
const pageType = "number";
|
|
1423
|
-
const data = await this.getCollections({
|
|
1424
|
-
pageNo: pageNo,
|
|
1425
|
-
pageSize: pageSize,
|
|
1426
|
-
tag: tag,
|
|
1427
|
-
});
|
|
1428
|
-
paginator.setPaginator({
|
|
1429
|
-
hasNext: data.page.has_next ? true : false,
|
|
1430
|
-
nextId: data.page.next_id,
|
|
1431
|
-
});
|
|
1432
|
-
return data;
|
|
1433
|
-
};
|
|
1434
|
-
paginator.setCallback(callback);
|
|
1435
|
-
return paginator;
|
|
1436
|
-
}
|
|
1437
|
-
|
|
1438
|
-
/**
|
|
1439
|
-
* @param {Object} arg - Arg object.
|
|
1440
|
-
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
1441
|
-
* identifier of a collection. You can get slug value from the endpoint
|
|
1442
|
-
* /service/application/catalog/v1.0/collections/.
|
|
1443
|
-
* @param {string} [arg.f] - The search filter parameters. Filter parameters
|
|
1444
|
-
* will be passed in f parameter as shown in the example below. Double
|
|
1445
|
-
* Pipe (||) denotes the OR condition, whereas Triple-colon (:::)
|
|
1446
|
-
* indicates a new filter paramater applied as an AND condition.
|
|
1447
|
-
* @param {boolean} [arg.filters] - This is a boolean value, True for
|
|
1448
|
-
* fetching all filter parameters and False for disabling the filter parameters.
|
|
1449
|
-
* @param {string} [arg.sortOn] - The order in which the list of products
|
|
1450
|
-
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
1451
|
-
* either ascending or descending order. See the supported values below.
|
|
1452
|
-
* @param {string} [arg.pageId] - Page ID to retrieve next set of results.
|
|
1453
|
-
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
1454
|
-
* @returns {Promise<ProductListingResponse>} - Success response
|
|
1455
|
-
* @summary: Get the items in a collection
|
|
1456
|
-
* @description: Get items in a collection specified by its `slug`.
|
|
1457
|
-
*/
|
|
1458
|
-
async getCollectionItemsBySlug({
|
|
1459
|
-
slug,
|
|
1460
|
-
f,
|
|
1461
|
-
filters,
|
|
1462
|
-
sortOn,
|
|
1463
|
-
pageId,
|
|
1464
|
-
pageSize,
|
|
1465
|
-
} = {}) {
|
|
1466
|
-
const { error } = CatalogValidator.getCollectionItemsBySlug().validate(
|
|
1467
|
-
{ slug, f, filters, sortOn, pageId, pageSize },
|
|
1485
|
+
async getProductComparisonBySlugs({ slug } = {}) {
|
|
1486
|
+
const { error } = CatalogValidator.getProductComparisonBySlugs().validate(
|
|
1487
|
+
{ slug },
|
|
1468
1488
|
{ abortEarly: false, allowUnknown: true }
|
|
1469
1489
|
);
|
|
1470
1490
|
if (error) {
|
|
@@ -1474,24 +1494,21 @@ class Catalog {
|
|
|
1474
1494
|
// Showing warrnings if extra unknown parameters are found
|
|
1475
1495
|
const {
|
|
1476
1496
|
error: warrning,
|
|
1477
|
-
} = CatalogValidator.
|
|
1478
|
-
{ slug
|
|
1497
|
+
} = CatalogValidator.getProductComparisonBySlugs().validate(
|
|
1498
|
+
{ slug },
|
|
1479
1499
|
{ abortEarly: false, allowUnknown: false }
|
|
1480
1500
|
);
|
|
1481
1501
|
if (warrning) {
|
|
1482
1502
|
Logger({
|
|
1483
1503
|
level: "WARN",
|
|
1484
|
-
message:
|
|
1504
|
+
message:
|
|
1505
|
+
"Parameter Validation warrnings for getProductComparisonBySlugs",
|
|
1485
1506
|
});
|
|
1486
1507
|
Logger({ level: "WARN", message: warrning });
|
|
1487
1508
|
}
|
|
1488
1509
|
|
|
1489
1510
|
const query_params = {};
|
|
1490
|
-
query_params["
|
|
1491
|
-
query_params["filters"] = filters;
|
|
1492
|
-
query_params["sort_on"] = sortOn;
|
|
1493
|
-
query_params["page_id"] = pageId;
|
|
1494
|
-
query_params["page_size"] = pageSize;
|
|
1511
|
+
query_params["slug"] = slug;
|
|
1495
1512
|
|
|
1496
1513
|
const xHeaders = {};
|
|
1497
1514
|
|
|
@@ -1499,8 +1516,8 @@ class Catalog {
|
|
|
1499
1516
|
this._conf,
|
|
1500
1517
|
"get",
|
|
1501
1518
|
constructUrl({
|
|
1502
|
-
url: this._urls["
|
|
1503
|
-
params: {
|
|
1519
|
+
url: this._urls["getProductComparisonBySlugs"],
|
|
1520
|
+
params: {},
|
|
1504
1521
|
}),
|
|
1505
1522
|
query_params,
|
|
1506
1523
|
undefined,
|
|
@@ -1509,7 +1526,7 @@ class Catalog {
|
|
|
1509
1526
|
|
|
1510
1527
|
const {
|
|
1511
1528
|
error: res_error,
|
|
1512
|
-
} = CatalogModel.
|
|
1529
|
+
} = CatalogModel.ProductsComparisonResponse().validate(response, {
|
|
1513
1530
|
abortEarly: false,
|
|
1514
1531
|
allowUnknown: false,
|
|
1515
1532
|
});
|
|
@@ -1517,7 +1534,8 @@ class Catalog {
|
|
|
1517
1534
|
if (res_error) {
|
|
1518
1535
|
Logger({
|
|
1519
1536
|
level: "WARN",
|
|
1520
|
-
message:
|
|
1537
|
+
message:
|
|
1538
|
+
"Response Validation Warnnings for getProductComparisonBySlugs",
|
|
1521
1539
|
});
|
|
1522
1540
|
Logger({ level: "WARN", message: res_error });
|
|
1523
1541
|
}
|
|
@@ -1528,62 +1546,14 @@ class Catalog {
|
|
|
1528
1546
|
/**
|
|
1529
1547
|
* @param {Object} arg - Arg object.
|
|
1530
1548
|
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
1531
|
-
* identifier of a
|
|
1532
|
-
* /service/application/catalog/v1.0/
|
|
1533
|
-
* @
|
|
1534
|
-
*
|
|
1535
|
-
*
|
|
1536
|
-
* indicates a new filter paramater applied as an AND condition.
|
|
1537
|
-
* @param {boolean} [arg.filters] - This is a boolean value, True for
|
|
1538
|
-
* fetching all filter parameters and False for disabling the filter parameters.
|
|
1539
|
-
* @param {string} [arg.sortOn] - The order in which the list of products
|
|
1540
|
-
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
1541
|
-
* either ascending or descending order. See the supported values below.
|
|
1542
|
-
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
1543
|
-
* @summary: Get the items in a collection
|
|
1544
|
-
* @description: Get items in a collection specified by its `slug`.
|
|
1545
|
-
*/
|
|
1546
|
-
getCollectionItemsBySlugPaginator({
|
|
1547
|
-
slug,
|
|
1548
|
-
f,
|
|
1549
|
-
filters,
|
|
1550
|
-
sortOn,
|
|
1551
|
-
pageSize,
|
|
1552
|
-
} = {}) {
|
|
1553
|
-
const paginator = new Paginator();
|
|
1554
|
-
const callback = async () => {
|
|
1555
|
-
const pageId = paginator.nextId;
|
|
1556
|
-
const pageNo = paginator.pageNo;
|
|
1557
|
-
const pageType = "cursor";
|
|
1558
|
-
const data = await this.getCollectionItemsBySlug({
|
|
1559
|
-
slug: slug,
|
|
1560
|
-
f: f,
|
|
1561
|
-
filters: filters,
|
|
1562
|
-
sortOn: sortOn,
|
|
1563
|
-
pageId: pageId,
|
|
1564
|
-
pageSize: pageSize,
|
|
1565
|
-
});
|
|
1566
|
-
paginator.setPaginator({
|
|
1567
|
-
hasNext: data.page.has_next ? true : false,
|
|
1568
|
-
nextId: data.page.next_id,
|
|
1569
|
-
});
|
|
1570
|
-
return data;
|
|
1571
|
-
};
|
|
1572
|
-
paginator.setCallback(callback);
|
|
1573
|
-
return paginator;
|
|
1574
|
-
}
|
|
1575
|
-
|
|
1576
|
-
/**
|
|
1577
|
-
* @param {Object} arg - Arg object.
|
|
1578
|
-
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
1579
|
-
* identifier of a collection. You can get slug value from the endpoint
|
|
1580
|
-
* /service/application/catalog/v1.0/collections/.
|
|
1581
|
-
* @returns {Promise<CollectionDetailResponse>} - Success response
|
|
1582
|
-
* @summary: Get a particular collection
|
|
1583
|
-
* @description: Get the details of a collection by its `slug`.
|
|
1549
|
+
* identifier of a product. You can get slug value from the endpoint
|
|
1550
|
+
* /service/application/catalog/v1.0/products/
|
|
1551
|
+
* @returns {Promise<ProductDetail>} - Success response
|
|
1552
|
+
* @summary: Get a product
|
|
1553
|
+
* @description: Use this API to retrieve a product by its slug value.
|
|
1584
1554
|
*/
|
|
1585
|
-
async
|
|
1586
|
-
const { error } = CatalogValidator.
|
|
1555
|
+
async getProductDetailBySlug({ slug } = {}) {
|
|
1556
|
+
const { error } = CatalogValidator.getProductDetailBySlug().validate(
|
|
1587
1557
|
{ slug },
|
|
1588
1558
|
{ abortEarly: false, allowUnknown: true }
|
|
1589
1559
|
);
|
|
@@ -1594,14 +1564,14 @@ class Catalog {
|
|
|
1594
1564
|
// Showing warrnings if extra unknown parameters are found
|
|
1595
1565
|
const {
|
|
1596
1566
|
error: warrning,
|
|
1597
|
-
} = CatalogValidator.
|
|
1567
|
+
} = CatalogValidator.getProductDetailBySlug().validate(
|
|
1598
1568
|
{ slug },
|
|
1599
1569
|
{ abortEarly: false, allowUnknown: false }
|
|
1600
1570
|
);
|
|
1601
1571
|
if (warrning) {
|
|
1602
1572
|
Logger({
|
|
1603
1573
|
level: "WARN",
|
|
1604
|
-
message: "Parameter Validation warrnings for
|
|
1574
|
+
message: "Parameter Validation warrnings for getProductDetailBySlug",
|
|
1605
1575
|
});
|
|
1606
1576
|
Logger({ level: "WARN", message: warrning });
|
|
1607
1577
|
}
|
|
@@ -1614,7 +1584,7 @@ class Catalog {
|
|
|
1614
1584
|
this._conf,
|
|
1615
1585
|
"get",
|
|
1616
1586
|
constructUrl({
|
|
1617
|
-
url: this._urls["
|
|
1587
|
+
url: this._urls["getProductDetailBySlug"],
|
|
1618
1588
|
params: { slug },
|
|
1619
1589
|
}),
|
|
1620
1590
|
query_params,
|
|
@@ -1622,17 +1592,15 @@ class Catalog {
|
|
|
1622
1592
|
xHeaders
|
|
1623
1593
|
);
|
|
1624
1594
|
|
|
1625
|
-
const {
|
|
1626
|
-
|
|
1627
|
-
|
|
1628
|
-
|
|
1629
|
-
allowUnknown: false,
|
|
1630
|
-
});
|
|
1595
|
+
const { error: res_error } = CatalogModel.ProductDetail().validate(
|
|
1596
|
+
response,
|
|
1597
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1598
|
+
);
|
|
1631
1599
|
|
|
1632
1600
|
if (res_error) {
|
|
1633
1601
|
Logger({
|
|
1634
1602
|
level: "WARN",
|
|
1635
|
-
message: "Response Validation Warnnings for
|
|
1603
|
+
message: "Response Validation Warnnings for getProductDetailBySlug",
|
|
1636
1604
|
});
|
|
1637
1605
|
Logger({ level: "WARN", message: res_error });
|
|
1638
1606
|
}
|
|
@@ -1642,17 +1610,25 @@ class Catalog {
|
|
|
1642
1610
|
|
|
1643
1611
|
/**
|
|
1644
1612
|
* @param {Object} arg - Arg object.
|
|
1645
|
-
* @param {string} arg.
|
|
1646
|
-
*
|
|
1647
|
-
*
|
|
1648
|
-
* @param {
|
|
1649
|
-
*
|
|
1650
|
-
*
|
|
1651
|
-
* @
|
|
1613
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
1614
|
+
* identifier of a product. You can get slug value from the endpoint
|
|
1615
|
+
* /service/application/catalog/v1.0/products/
|
|
1616
|
+
* @param {string} arg.size - A string indicating the size of the product,
|
|
1617
|
+
* e.g. S, M, XL. You can get slug value from the endpoint
|
|
1618
|
+
* /service/application/catalog/v1.0/products/sizes
|
|
1619
|
+
* @param {number} [arg.storeId] - The ID of the store that is selling the
|
|
1620
|
+
* product, e.g. 1,2,3.
|
|
1621
|
+
* @param {string} [arg.pincode] - The PIN Code of the area near which the
|
|
1622
|
+
* selling locations should be searched, e.g. 400059.
|
|
1623
|
+
* @param {number} [arg.moq] - An Integer indication the Minimum Order
|
|
1624
|
+
* Quantity of a product, e.g. 100.
|
|
1625
|
+
* @returns {Promise<ProductSizePriceResponseV3>} - Success response
|
|
1626
|
+
* @summary: Get the price of a product size at a PIN Code
|
|
1627
|
+
* @description: Prices may vary for different sizes of a product. Use this API to retrieve the price of a product size at all the selling locations near to a PIN Code.
|
|
1652
1628
|
*/
|
|
1653
|
-
async
|
|
1654
|
-
const { error } = CatalogValidator.
|
|
1655
|
-
{
|
|
1629
|
+
async getProductPriceBySlug({ slug, size, storeId, pincode, moq } = {}) {
|
|
1630
|
+
const { error } = CatalogValidator.getProductPriceBySlug().validate(
|
|
1631
|
+
{ slug, size, storeId, pincode, moq },
|
|
1656
1632
|
{ abortEarly: false, allowUnknown: true }
|
|
1657
1633
|
);
|
|
1658
1634
|
if (error) {
|
|
@@ -1660,21 +1636,24 @@ class Catalog {
|
|
|
1660
1636
|
}
|
|
1661
1637
|
|
|
1662
1638
|
// Showing warrnings if extra unknown parameters are found
|
|
1663
|
-
const {
|
|
1664
|
-
|
|
1639
|
+
const {
|
|
1640
|
+
error: warrning,
|
|
1641
|
+
} = CatalogValidator.getProductPriceBySlug().validate(
|
|
1642
|
+
{ slug, size, storeId, pincode, moq },
|
|
1665
1643
|
{ abortEarly: false, allowUnknown: false }
|
|
1666
1644
|
);
|
|
1667
1645
|
if (warrning) {
|
|
1668
1646
|
Logger({
|
|
1669
1647
|
level: "WARN",
|
|
1670
|
-
message: "Parameter Validation warrnings for
|
|
1648
|
+
message: "Parameter Validation warrnings for getProductPriceBySlug",
|
|
1671
1649
|
});
|
|
1672
1650
|
Logger({ level: "WARN", message: warrning });
|
|
1673
1651
|
}
|
|
1674
1652
|
|
|
1675
1653
|
const query_params = {};
|
|
1676
|
-
query_params["
|
|
1677
|
-
query_params["
|
|
1654
|
+
query_params["store_id"] = storeId;
|
|
1655
|
+
query_params["pincode"] = pincode;
|
|
1656
|
+
query_params["moq"] = moq;
|
|
1678
1657
|
|
|
1679
1658
|
const xHeaders = {};
|
|
1680
1659
|
|
|
@@ -1682,8 +1661,8 @@ class Catalog {
|
|
|
1682
1661
|
this._conf,
|
|
1683
1662
|
"get",
|
|
1684
1663
|
constructUrl({
|
|
1685
|
-
url: this._urls["
|
|
1686
|
-
params: {
|
|
1664
|
+
url: this._urls["getProductPriceBySlug"],
|
|
1665
|
+
params: { slug, size },
|
|
1687
1666
|
}),
|
|
1688
1667
|
query_params,
|
|
1689
1668
|
undefined,
|
|
@@ -1692,7 +1671,7 @@ class Catalog {
|
|
|
1692
1671
|
|
|
1693
1672
|
const {
|
|
1694
1673
|
error: res_error,
|
|
1695
|
-
} = CatalogModel.
|
|
1674
|
+
} = CatalogModel.ProductSizePriceResponseV3().validate(response, {
|
|
1696
1675
|
abortEarly: false,
|
|
1697
1676
|
allowUnknown: false,
|
|
1698
1677
|
});
|
|
@@ -1700,7 +1679,7 @@ class Catalog {
|
|
|
1700
1679
|
if (res_error) {
|
|
1701
1680
|
Logger({
|
|
1702
1681
|
level: "WARN",
|
|
1703
|
-
message: "Response Validation Warnnings for
|
|
1682
|
+
message: "Response Validation Warnnings for getProductPriceBySlug",
|
|
1704
1683
|
});
|
|
1705
1684
|
Logger({ level: "WARN", message: res_error });
|
|
1706
1685
|
}
|
|
@@ -1710,45 +1689,33 @@ class Catalog {
|
|
|
1710
1689
|
|
|
1711
1690
|
/**
|
|
1712
1691
|
* @param {Object} arg - Arg object.
|
|
1713
|
-
* @param {string} arg.
|
|
1714
|
-
*
|
|
1715
|
-
*
|
|
1716
|
-
* @
|
|
1717
|
-
*
|
|
1718
|
-
|
|
1719
|
-
|
|
1720
|
-
|
|
1721
|
-
|
|
1722
|
-
|
|
1723
|
-
|
|
1724
|
-
|
|
1725
|
-
|
|
1726
|
-
|
|
1727
|
-
|
|
1728
|
-
|
|
1729
|
-
});
|
|
1730
|
-
paginator.setPaginator({
|
|
1731
|
-
hasNext: data.page.has_next ? true : false,
|
|
1732
|
-
nextId: data.page.next_id,
|
|
1733
|
-
});
|
|
1734
|
-
return data;
|
|
1735
|
-
};
|
|
1736
|
-
paginator.setCallback(callback);
|
|
1737
|
-
return paginator;
|
|
1738
|
-
}
|
|
1739
|
-
|
|
1740
|
-
/**
|
|
1741
|
-
* @param {Object} arg - Arg object.
|
|
1742
|
-
* @param {string} arg.collectionType - Type of collection followed, i.e.
|
|
1743
|
-
* products, brands, or collections.
|
|
1744
|
-
* @param {string} arg.collectionId - The ID of the collection type.
|
|
1745
|
-
* @returns {Promise<FollowPostResponse>} - Success response
|
|
1746
|
-
* @summary: Follow an entity (product/brand/collection)
|
|
1747
|
-
* @description: Follow a particular entity such as product, brand, collection specified by its ID.
|
|
1692
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
1693
|
+
* identifier of a product. You can get slug value from the endpoint
|
|
1694
|
+
* /service/application/catalog/v1.0/products/
|
|
1695
|
+
* @param {string} arg.size - A string indicating the size of the product,
|
|
1696
|
+
* e.g. S, M, XL. You can get slug value from the endpoint
|
|
1697
|
+
* /service/application/catalog/v1.0/products/sizes
|
|
1698
|
+
* @param {string} [arg.pincode] - The 6-digit PIN Code of the area near
|
|
1699
|
+
* which the selling locations should be searched, e.g. 400059
|
|
1700
|
+
* @param {string} [arg.strategy] - Sort stores on the basis of strategy.
|
|
1701
|
+
* eg, fast-delivery, low-price, optimal.
|
|
1702
|
+
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
1703
|
+
* given set of results.
|
|
1704
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
1705
|
+
* @returns {Promise<ProductSizeSellersResponseV3>} - Success response
|
|
1706
|
+
* @summary: Get the sellers of a product size at a PIN Code
|
|
1707
|
+
* @description: A product of a particular size may be sold by multiple sellers. Use this API to fetch the sellers having the stock of a particular size at a given PIN Code.
|
|
1748
1708
|
*/
|
|
1749
|
-
async
|
|
1750
|
-
|
|
1751
|
-
|
|
1709
|
+
async getProductSellersBySlug({
|
|
1710
|
+
slug,
|
|
1711
|
+
size,
|
|
1712
|
+
pincode,
|
|
1713
|
+
strategy,
|
|
1714
|
+
pageNo,
|
|
1715
|
+
pageSize,
|
|
1716
|
+
} = {}) {
|
|
1717
|
+
const { error } = CatalogValidator.getProductSellersBySlug().validate(
|
|
1718
|
+
{ slug, size, pincode, strategy, pageNo, pageSize },
|
|
1752
1719
|
{ abortEarly: false, allowUnknown: true }
|
|
1753
1720
|
);
|
|
1754
1721
|
if (error) {
|
|
@@ -1756,28 +1723,34 @@ class Catalog {
|
|
|
1756
1723
|
}
|
|
1757
1724
|
|
|
1758
1725
|
// Showing warrnings if extra unknown parameters are found
|
|
1759
|
-
const {
|
|
1760
|
-
|
|
1726
|
+
const {
|
|
1727
|
+
error: warrning,
|
|
1728
|
+
} = CatalogValidator.getProductSellersBySlug().validate(
|
|
1729
|
+
{ slug, size, pincode, strategy, pageNo, pageSize },
|
|
1761
1730
|
{ abortEarly: false, allowUnknown: false }
|
|
1762
1731
|
);
|
|
1763
1732
|
if (warrning) {
|
|
1764
1733
|
Logger({
|
|
1765
1734
|
level: "WARN",
|
|
1766
|
-
message: "Parameter Validation warrnings for
|
|
1735
|
+
message: "Parameter Validation warrnings for getProductSellersBySlug",
|
|
1767
1736
|
});
|
|
1768
1737
|
Logger({ level: "WARN", message: warrning });
|
|
1769
1738
|
}
|
|
1770
1739
|
|
|
1771
1740
|
const query_params = {};
|
|
1741
|
+
query_params["pincode"] = pincode;
|
|
1742
|
+
query_params["strategy"] = strategy;
|
|
1743
|
+
query_params["page_no"] = pageNo;
|
|
1744
|
+
query_params["page_size"] = pageSize;
|
|
1772
1745
|
|
|
1773
1746
|
const xHeaders = {};
|
|
1774
1747
|
|
|
1775
1748
|
const response = await APIClient.execute(
|
|
1776
1749
|
this._conf,
|
|
1777
|
-
"
|
|
1750
|
+
"get",
|
|
1778
1751
|
constructUrl({
|
|
1779
|
-
url: this._urls["
|
|
1780
|
-
params: {
|
|
1752
|
+
url: this._urls["getProductSellersBySlug"],
|
|
1753
|
+
params: { slug, size },
|
|
1781
1754
|
}),
|
|
1782
1755
|
query_params,
|
|
1783
1756
|
undefined,
|
|
@@ -1786,7 +1759,7 @@ class Catalog {
|
|
|
1786
1759
|
|
|
1787
1760
|
const {
|
|
1788
1761
|
error: res_error,
|
|
1789
|
-
} = CatalogModel.
|
|
1762
|
+
} = CatalogModel.ProductSizeSellersResponseV3().validate(response, {
|
|
1790
1763
|
abortEarly: false,
|
|
1791
1764
|
allowUnknown: false,
|
|
1792
1765
|
});
|
|
@@ -1794,7 +1767,7 @@ class Catalog {
|
|
|
1794
1767
|
if (res_error) {
|
|
1795
1768
|
Logger({
|
|
1796
1769
|
level: "WARN",
|
|
1797
|
-
message: "Response Validation Warnnings for
|
|
1770
|
+
message: "Response Validation Warnnings for getProductSellersBySlug",
|
|
1798
1771
|
});
|
|
1799
1772
|
Logger({ level: "WARN", message: res_error });
|
|
1800
1773
|
}
|
|
@@ -1804,16 +1777,64 @@ class Catalog {
|
|
|
1804
1777
|
|
|
1805
1778
|
/**
|
|
1806
1779
|
* @param {Object} arg - Arg object.
|
|
1807
|
-
* @param {string} arg.
|
|
1808
|
-
*
|
|
1809
|
-
*
|
|
1810
|
-
* @
|
|
1811
|
-
*
|
|
1812
|
-
*
|
|
1780
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
1781
|
+
* identifier of a product. You can get slug value from the endpoint
|
|
1782
|
+
* /service/application/catalog/v1.0/products/
|
|
1783
|
+
* @param {string} arg.size - A string indicating the size of the product,
|
|
1784
|
+
* e.g. S, M, XL. You can get slug value from the endpoint
|
|
1785
|
+
* /service/application/catalog/v1.0/products/sizes
|
|
1786
|
+
* @param {string} [arg.pincode] - The 6-digit PIN Code of the area near
|
|
1787
|
+
* which the selling locations should be searched, e.g. 400059
|
|
1788
|
+
* @param {string} [arg.strategy] - Sort stores on the basis of strategy.
|
|
1789
|
+
* eg, fast-delivery, low-price, optimal.
|
|
1790
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
1791
|
+
* @summary: Get the sellers of a product size at a PIN Code
|
|
1792
|
+
* @description: A product of a particular size may be sold by multiple sellers. Use this API to fetch the sellers having the stock of a particular size at a given PIN Code.
|
|
1813
1793
|
*/
|
|
1814
|
-
|
|
1815
|
-
|
|
1816
|
-
|
|
1794
|
+
getProductSellersBySlugPaginator({
|
|
1795
|
+
slug,
|
|
1796
|
+
size,
|
|
1797
|
+
pincode,
|
|
1798
|
+
strategy,
|
|
1799
|
+
pageSize,
|
|
1800
|
+
} = {}) {
|
|
1801
|
+
const paginator = new Paginator();
|
|
1802
|
+
const callback = async () => {
|
|
1803
|
+
const pageId = paginator.nextId;
|
|
1804
|
+
const pageNo = paginator.pageNo;
|
|
1805
|
+
const pageType = "number";
|
|
1806
|
+
const data = await this.getProductSellersBySlug({
|
|
1807
|
+
slug: slug,
|
|
1808
|
+
size: size,
|
|
1809
|
+
pincode: pincode,
|
|
1810
|
+
strategy: strategy,
|
|
1811
|
+
pageNo: pageNo,
|
|
1812
|
+
pageSize: pageSize,
|
|
1813
|
+
});
|
|
1814
|
+
paginator.setPaginator({
|
|
1815
|
+
hasNext: data.page.has_next ? true : false,
|
|
1816
|
+
nextId: data.page.next_id,
|
|
1817
|
+
});
|
|
1818
|
+
return data;
|
|
1819
|
+
};
|
|
1820
|
+
paginator.setCallback(callback);
|
|
1821
|
+
return paginator;
|
|
1822
|
+
}
|
|
1823
|
+
|
|
1824
|
+
/**
|
|
1825
|
+
* @param {Object} arg - Arg object.
|
|
1826
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
1827
|
+
* identifier of a product. You can get slug value from the endpoint
|
|
1828
|
+
* /service/application/catalog/v1.0/products/
|
|
1829
|
+
* @param {number} [arg.storeId] - The ID of the store that is selling the
|
|
1830
|
+
* product, e.g. 1,2,3.
|
|
1831
|
+
* @returns {Promise<ProductSizes>} - Success response
|
|
1832
|
+
* @summary: Get the sizes of a product
|
|
1833
|
+
* @description: A product can have multiple sizes. Use this API to fetch all the available sizes of a product.
|
|
1834
|
+
*/
|
|
1835
|
+
async getProductSizesBySlug({ slug, storeId } = {}) {
|
|
1836
|
+
const { error } = CatalogValidator.getProductSizesBySlug().validate(
|
|
1837
|
+
{ slug, storeId },
|
|
1817
1838
|
{ abortEarly: false, allowUnknown: true }
|
|
1818
1839
|
);
|
|
1819
1840
|
if (error) {
|
|
@@ -1821,45 +1842,46 @@ class Catalog {
|
|
|
1821
1842
|
}
|
|
1822
1843
|
|
|
1823
1844
|
// Showing warrnings if extra unknown parameters are found
|
|
1824
|
-
const {
|
|
1825
|
-
|
|
1845
|
+
const {
|
|
1846
|
+
error: warrning,
|
|
1847
|
+
} = CatalogValidator.getProductSizesBySlug().validate(
|
|
1848
|
+
{ slug, storeId },
|
|
1826
1849
|
{ abortEarly: false, allowUnknown: false }
|
|
1827
1850
|
);
|
|
1828
1851
|
if (warrning) {
|
|
1829
1852
|
Logger({
|
|
1830
1853
|
level: "WARN",
|
|
1831
|
-
message: "Parameter Validation warrnings for
|
|
1854
|
+
message: "Parameter Validation warrnings for getProductSizesBySlug",
|
|
1832
1855
|
});
|
|
1833
1856
|
Logger({ level: "WARN", message: warrning });
|
|
1834
1857
|
}
|
|
1835
1858
|
|
|
1836
1859
|
const query_params = {};
|
|
1860
|
+
query_params["store_id"] = storeId;
|
|
1837
1861
|
|
|
1838
1862
|
const xHeaders = {};
|
|
1839
1863
|
|
|
1840
1864
|
const response = await APIClient.execute(
|
|
1841
1865
|
this._conf,
|
|
1842
|
-
"
|
|
1866
|
+
"get",
|
|
1843
1867
|
constructUrl({
|
|
1844
|
-
url: this._urls["
|
|
1845
|
-
params: {
|
|
1868
|
+
url: this._urls["getProductSizesBySlug"],
|
|
1869
|
+
params: { slug },
|
|
1846
1870
|
}),
|
|
1847
1871
|
query_params,
|
|
1848
1872
|
undefined,
|
|
1849
1873
|
xHeaders
|
|
1850
1874
|
);
|
|
1851
1875
|
|
|
1852
|
-
const {
|
|
1853
|
-
|
|
1854
|
-
|
|
1855
|
-
|
|
1856
|
-
allowUnknown: false,
|
|
1857
|
-
});
|
|
1876
|
+
const { error: res_error } = CatalogModel.ProductSizes().validate(
|
|
1877
|
+
response,
|
|
1878
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1879
|
+
);
|
|
1858
1880
|
|
|
1859
1881
|
if (res_error) {
|
|
1860
1882
|
Logger({
|
|
1861
1883
|
level: "WARN",
|
|
1862
|
-
message: "Response Validation Warnnings for
|
|
1884
|
+
message: "Response Validation Warnnings for getProductSizesBySlug",
|
|
1863
1885
|
});
|
|
1864
1886
|
Logger({ level: "WARN", message: res_error });
|
|
1865
1887
|
}
|
|
@@ -1869,16 +1891,22 @@ class Catalog {
|
|
|
1869
1891
|
|
|
1870
1892
|
/**
|
|
1871
1893
|
* @param {Object} arg - Arg object.
|
|
1872
|
-
* @param {string} arg.
|
|
1873
|
-
*
|
|
1874
|
-
*
|
|
1875
|
-
* @
|
|
1876
|
-
*
|
|
1877
|
-
* @
|
|
1894
|
+
* @param {string} [arg.itemId] - The Item ID of the product (Max. 50 allowed)
|
|
1895
|
+
* @param {string} [arg.alu] - ALU of the product (limited upto 50 ALU
|
|
1896
|
+
* identifier in a single request)
|
|
1897
|
+
* @param {string} [arg.skuCode] - Stock-keeping Unit of the product
|
|
1898
|
+
* (limited upto 50 SKU Code in a single request)
|
|
1899
|
+
* @param {string} [arg.ean] - European Article Number of the product
|
|
1900
|
+
* (limited upto 50 EAN identifier in a single request)
|
|
1901
|
+
* @param {string} [arg.upc] - Universal Product Code of the product
|
|
1902
|
+
* (limited upto 50 UPC identifier in a single request)
|
|
1903
|
+
* @returns {Promise<ProductStockStatusResponse>} - Success response
|
|
1904
|
+
* @summary: Get the stock of a product
|
|
1905
|
+
* @description: Retrieve the available stock of the products. Use this API to retrieve stock of multiple products (up to 50) at a time.
|
|
1878
1906
|
*/
|
|
1879
|
-
async
|
|
1880
|
-
const { error } = CatalogValidator.
|
|
1881
|
-
{
|
|
1907
|
+
async getProductStockByIds({ itemId, alu, skuCode, ean, upc } = {}) {
|
|
1908
|
+
const { error } = CatalogValidator.getProductStockByIds().validate(
|
|
1909
|
+
{ itemId, alu, skuCode, ean, upc },
|
|
1882
1910
|
{ abortEarly: false, allowUnknown: true }
|
|
1883
1911
|
);
|
|
1884
1912
|
if (error) {
|
|
@@ -1888,19 +1916,24 @@ class Catalog {
|
|
|
1888
1916
|
// Showing warrnings if extra unknown parameters are found
|
|
1889
1917
|
const {
|
|
1890
1918
|
error: warrning,
|
|
1891
|
-
} = CatalogValidator.
|
|
1892
|
-
{
|
|
1919
|
+
} = CatalogValidator.getProductStockByIds().validate(
|
|
1920
|
+
{ itemId, alu, skuCode, ean, upc },
|
|
1893
1921
|
{ abortEarly: false, allowUnknown: false }
|
|
1894
1922
|
);
|
|
1895
1923
|
if (warrning) {
|
|
1896
1924
|
Logger({
|
|
1897
1925
|
level: "WARN",
|
|
1898
|
-
message: "Parameter Validation warrnings for
|
|
1926
|
+
message: "Parameter Validation warrnings for getProductStockByIds",
|
|
1899
1927
|
});
|
|
1900
1928
|
Logger({ level: "WARN", message: warrning });
|
|
1901
1929
|
}
|
|
1902
1930
|
|
|
1903
1931
|
const query_params = {};
|
|
1932
|
+
query_params["item_id"] = itemId;
|
|
1933
|
+
query_params["alu"] = alu;
|
|
1934
|
+
query_params["sku_code"] = skuCode;
|
|
1935
|
+
query_params["ean"] = ean;
|
|
1936
|
+
query_params["upc"] = upc;
|
|
1904
1937
|
|
|
1905
1938
|
const xHeaders = {};
|
|
1906
1939
|
|
|
@@ -1908,8 +1941,8 @@ class Catalog {
|
|
|
1908
1941
|
this._conf,
|
|
1909
1942
|
"get",
|
|
1910
1943
|
constructUrl({
|
|
1911
|
-
url: this._urls["
|
|
1912
|
-
params: {
|
|
1944
|
+
url: this._urls["getProductStockByIds"],
|
|
1945
|
+
params: {},
|
|
1913
1946
|
}),
|
|
1914
1947
|
query_params,
|
|
1915
1948
|
undefined,
|
|
@@ -1918,7 +1951,7 @@ class Catalog {
|
|
|
1918
1951
|
|
|
1919
1952
|
const {
|
|
1920
1953
|
error: res_error,
|
|
1921
|
-
} = CatalogModel.
|
|
1954
|
+
} = CatalogModel.ProductStockStatusResponse().validate(response, {
|
|
1922
1955
|
abortEarly: false,
|
|
1923
1956
|
allowUnknown: false,
|
|
1924
1957
|
});
|
|
@@ -1926,7 +1959,7 @@ class Catalog {
|
|
|
1926
1959
|
if (res_error) {
|
|
1927
1960
|
Logger({
|
|
1928
1961
|
level: "WARN",
|
|
1929
|
-
message: "Response Validation Warnnings for
|
|
1962
|
+
message: "Response Validation Warnnings for getProductStockByIds",
|
|
1930
1963
|
});
|
|
1931
1964
|
Logger({ level: "WARN", message: res_error });
|
|
1932
1965
|
}
|
|
@@ -1936,15 +1969,16 @@ class Catalog {
|
|
|
1936
1969
|
|
|
1937
1970
|
/**
|
|
1938
1971
|
* @param {Object} arg - Arg object.
|
|
1939
|
-
* @param {string}
|
|
1940
|
-
*
|
|
1941
|
-
* @
|
|
1942
|
-
* @
|
|
1943
|
-
* @
|
|
1972
|
+
* @param {string} arg.timestamp - Timestamp in UTC format (2020-07-23T10:27:50Z)
|
|
1973
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
1974
|
+
* @param {string} [arg.pageId] - Page ID to retrieve next set of results.
|
|
1975
|
+
* @returns {Promise<ProductStockPolling>} - Success response
|
|
1976
|
+
* @summary: Get the stock of a product
|
|
1977
|
+
* @description: Retrieve the available stock of the products. Use this API to get the stock status of products whose inventory is updated at the specified time
|
|
1944
1978
|
*/
|
|
1945
|
-
async
|
|
1946
|
-
const { error } = CatalogValidator.
|
|
1947
|
-
{
|
|
1979
|
+
async getProductStockForTimeByIds({ timestamp, pageSize, pageId } = {}) {
|
|
1980
|
+
const { error } = CatalogValidator.getProductStockForTimeByIds().validate(
|
|
1981
|
+
{ timestamp, pageSize, pageId },
|
|
1948
1982
|
{ abortEarly: false, allowUnknown: true }
|
|
1949
1983
|
);
|
|
1950
1984
|
if (error) {
|
|
@@ -1952,20 +1986,25 @@ class Catalog {
|
|
|
1952
1986
|
}
|
|
1953
1987
|
|
|
1954
1988
|
// Showing warrnings if extra unknown parameters are found
|
|
1955
|
-
const {
|
|
1956
|
-
|
|
1989
|
+
const {
|
|
1990
|
+
error: warrning,
|
|
1991
|
+
} = CatalogValidator.getProductStockForTimeByIds().validate(
|
|
1992
|
+
{ timestamp, pageSize, pageId },
|
|
1957
1993
|
{ abortEarly: false, allowUnknown: false }
|
|
1958
1994
|
);
|
|
1959
1995
|
if (warrning) {
|
|
1960
1996
|
Logger({
|
|
1961
1997
|
level: "WARN",
|
|
1962
|
-
message:
|
|
1998
|
+
message:
|
|
1999
|
+
"Parameter Validation warrnings for getProductStockForTimeByIds",
|
|
1963
2000
|
});
|
|
1964
2001
|
Logger({ level: "WARN", message: warrning });
|
|
1965
2002
|
}
|
|
1966
2003
|
|
|
1967
2004
|
const query_params = {};
|
|
1968
|
-
query_params["
|
|
2005
|
+
query_params["timestamp"] = timestamp;
|
|
2006
|
+
query_params["page_size"] = pageSize;
|
|
2007
|
+
query_params["page_id"] = pageId;
|
|
1969
2008
|
|
|
1970
2009
|
const xHeaders = {};
|
|
1971
2010
|
|
|
@@ -1973,7 +2012,7 @@ class Catalog {
|
|
|
1973
2012
|
this._conf,
|
|
1974
2013
|
"get",
|
|
1975
2014
|
constructUrl({
|
|
1976
|
-
url: this._urls["
|
|
2015
|
+
url: this._urls["getProductStockForTimeByIds"],
|
|
1977
2016
|
params: {},
|
|
1978
2017
|
}),
|
|
1979
2018
|
query_params,
|
|
@@ -1983,7 +2022,7 @@ class Catalog {
|
|
|
1983
2022
|
|
|
1984
2023
|
const {
|
|
1985
2024
|
error: res_error,
|
|
1986
|
-
} = CatalogModel.
|
|
2025
|
+
} = CatalogModel.ProductStockPolling().validate(response, {
|
|
1987
2026
|
abortEarly: false,
|
|
1988
2027
|
allowUnknown: false,
|
|
1989
2028
|
});
|
|
@@ -1991,7 +2030,8 @@ class Catalog {
|
|
|
1991
2030
|
if (res_error) {
|
|
1992
2031
|
Logger({
|
|
1993
2032
|
level: "WARN",
|
|
1994
|
-
message:
|
|
2033
|
+
message:
|
|
2034
|
+
"Response Validation Warnnings for getProductStockForTimeByIds",
|
|
1995
2035
|
});
|
|
1996
2036
|
Logger({ level: "WARN", message: res_error });
|
|
1997
2037
|
}
|
|
@@ -2001,120 +2041,21 @@ class Catalog {
|
|
|
2001
2041
|
|
|
2002
2042
|
/**
|
|
2003
2043
|
* @param {Object} arg - Arg object.
|
|
2004
|
-
* @param {
|
|
2005
|
-
*
|
|
2006
|
-
* @
|
|
2007
|
-
* @
|
|
2008
|
-
* @param {string} [arg.city] - Search stores by the city in which they are situated.
|
|
2009
|
-
* @param {number} [arg.range] - Use this to retrieve stores within a
|
|
2010
|
-
* particular range in meters, e.g. 10000, to indicate a 10km range
|
|
2011
|
-
* @param {number} [arg.latitude] - Latitude of the location from where one
|
|
2012
|
-
* wants to retreive the nearest stores, e.g. 72.8691788
|
|
2013
|
-
* @param {number} [arg.longitude] - Longitude of the location from where
|
|
2014
|
-
* one wants to retreive the nearest stores, e.g. 19.1174114
|
|
2015
|
-
* @returns {Promise<StoreListingResponse>} - Success response
|
|
2016
|
-
* @summary: Get store meta information.
|
|
2017
|
-
* @description: Use this API to get a list of stores in a specific application.
|
|
2044
|
+
* @param {string} arg.timestamp - Timestamp in UTC format (2020-07-23T10:27:50Z)
|
|
2045
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
2046
|
+
* @summary: Get the stock of a product
|
|
2047
|
+
* @description: Retrieve the available stock of the products. Use this API to get the stock status of products whose inventory is updated at the specified time
|
|
2018
2048
|
*/
|
|
2019
|
-
|
|
2020
|
-
pageNo,
|
|
2021
|
-
pageSize,
|
|
2022
|
-
q,
|
|
2023
|
-
city,
|
|
2024
|
-
range,
|
|
2025
|
-
latitude,
|
|
2026
|
-
longitude,
|
|
2027
|
-
} = {}) {
|
|
2028
|
-
const { error } = CatalogValidator.getStores().validate(
|
|
2029
|
-
{ pageNo, pageSize, q, city, range, latitude, longitude },
|
|
2030
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2031
|
-
);
|
|
2032
|
-
if (error) {
|
|
2033
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2034
|
-
}
|
|
2035
|
-
|
|
2036
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2037
|
-
const { error: warrning } = CatalogValidator.getStores().validate(
|
|
2038
|
-
{ pageNo, pageSize, q, city, range, latitude, longitude },
|
|
2039
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2040
|
-
);
|
|
2041
|
-
if (warrning) {
|
|
2042
|
-
Logger({
|
|
2043
|
-
level: "WARN",
|
|
2044
|
-
message: "Parameter Validation warrnings for getStores",
|
|
2045
|
-
});
|
|
2046
|
-
Logger({ level: "WARN", message: warrning });
|
|
2047
|
-
}
|
|
2048
|
-
|
|
2049
|
-
const query_params = {};
|
|
2050
|
-
query_params["page_no"] = pageNo;
|
|
2051
|
-
query_params["page_size"] = pageSize;
|
|
2052
|
-
query_params["q"] = q;
|
|
2053
|
-
query_params["city"] = city;
|
|
2054
|
-
query_params["range"] = range;
|
|
2055
|
-
query_params["latitude"] = latitude;
|
|
2056
|
-
query_params["longitude"] = longitude;
|
|
2057
|
-
|
|
2058
|
-
const xHeaders = {};
|
|
2059
|
-
|
|
2060
|
-
const response = await APIClient.execute(
|
|
2061
|
-
this._conf,
|
|
2062
|
-
"get",
|
|
2063
|
-
constructUrl({
|
|
2064
|
-
url: this._urls["getStores"],
|
|
2065
|
-
params: {},
|
|
2066
|
-
}),
|
|
2067
|
-
query_params,
|
|
2068
|
-
undefined,
|
|
2069
|
-
xHeaders
|
|
2070
|
-
);
|
|
2071
|
-
|
|
2072
|
-
const {
|
|
2073
|
-
error: res_error,
|
|
2074
|
-
} = CatalogModel.StoreListingResponse().validate(response, {
|
|
2075
|
-
abortEarly: false,
|
|
2076
|
-
allowUnknown: false,
|
|
2077
|
-
});
|
|
2078
|
-
|
|
2079
|
-
if (res_error) {
|
|
2080
|
-
Logger({
|
|
2081
|
-
level: "WARN",
|
|
2082
|
-
message: "Response Validation Warnnings for getStores",
|
|
2083
|
-
});
|
|
2084
|
-
Logger({ level: "WARN", message: res_error });
|
|
2085
|
-
}
|
|
2086
|
-
|
|
2087
|
-
return response;
|
|
2088
|
-
}
|
|
2089
|
-
|
|
2090
|
-
/**
|
|
2091
|
-
* @param {Object} arg - Arg object.
|
|
2092
|
-
* @param {number} [arg.pageSize] - Number of items to retrieve in each page.
|
|
2093
|
-
* @param {string} [arg.q] - Search a store by its name or store_code.
|
|
2094
|
-
* @param {string} [arg.city] - Search stores by the city in which they are situated.
|
|
2095
|
-
* @param {number} [arg.range] - Use this to retrieve stores within a
|
|
2096
|
-
* particular range in meters, e.g. 10000, to indicate a 10km range
|
|
2097
|
-
* @param {number} [arg.latitude] - Latitude of the location from where one
|
|
2098
|
-
* wants to retreive the nearest stores, e.g. 72.8691788
|
|
2099
|
-
* @param {number} [arg.longitude] - Longitude of the location from where
|
|
2100
|
-
* one wants to retreive the nearest stores, e.g. 19.1174114
|
|
2101
|
-
* @summary: Get store meta information.
|
|
2102
|
-
* @description: Use this API to get a list of stores in a specific application.
|
|
2103
|
-
*/
|
|
2104
|
-
getStoresPaginator({ pageSize, q, city, range, latitude, longitude } = {}) {
|
|
2049
|
+
getProductStockForTimeByIdsPaginator({ timestamp, pageSize } = {}) {
|
|
2105
2050
|
const paginator = new Paginator();
|
|
2106
2051
|
const callback = async () => {
|
|
2107
2052
|
const pageId = paginator.nextId;
|
|
2108
2053
|
const pageNo = paginator.pageNo;
|
|
2109
|
-
const pageType = "
|
|
2110
|
-
const data = await this.
|
|
2111
|
-
|
|
2054
|
+
const pageType = "cursor";
|
|
2055
|
+
const data = await this.getProductStockForTimeByIds({
|
|
2056
|
+
timestamp: timestamp,
|
|
2112
2057
|
pageSize: pageSize,
|
|
2113
|
-
|
|
2114
|
-
city: city,
|
|
2115
|
-
range: range,
|
|
2116
|
-
latitude: latitude,
|
|
2117
|
-
longitude: longitude,
|
|
2058
|
+
pageId: pageId,
|
|
2118
2059
|
});
|
|
2119
2060
|
paginator.setPaginator({
|
|
2120
2061
|
hasNext: data.page.has_next ? true : false,
|
|
@@ -2128,32 +2069,16 @@ class Catalog {
|
|
|
2128
2069
|
|
|
2129
2070
|
/**
|
|
2130
2071
|
* @param {Object} arg - Arg object.
|
|
2131
|
-
* @param {
|
|
2132
|
-
*
|
|
2133
|
-
*
|
|
2134
|
-
* @
|
|
2135
|
-
* @
|
|
2136
|
-
* @
|
|
2137
|
-
* particular range in meters, e.g. 10000, to indicate a 10km range
|
|
2138
|
-
* @param {number} [arg.latitude] - Latitude of the location from where one
|
|
2139
|
-
* wants to retreive the nearest stores, e.g. 72.8691788
|
|
2140
|
-
* @param {number} [arg.longitude] - Longitude of the location from where
|
|
2141
|
-
* one wants to retreive the nearest stores, e.g. 19.1174114
|
|
2142
|
-
* @returns {Promise<ApplicationStoreListing>} - Success response
|
|
2143
|
-
* @summary: Get store meta information.
|
|
2144
|
-
* @description: Use this API to get a list of stores in a specific application.
|
|
2072
|
+
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
2073
|
+
* identifier of a product. You can get slug value from the endpoint
|
|
2074
|
+
* /service/application/catalog/v1.0/products/
|
|
2075
|
+
* @returns {Promise<ProductVariantsResponse>} - Success response
|
|
2076
|
+
* @summary: Get variant of a particular product
|
|
2077
|
+
* @description: A product can have a different type of variants such as colour, shade, memory. Use this API to fetch all the available variants of a product using its slug.
|
|
2145
2078
|
*/
|
|
2146
|
-
async
|
|
2147
|
-
|
|
2148
|
-
|
|
2149
|
-
q,
|
|
2150
|
-
city,
|
|
2151
|
-
range,
|
|
2152
|
-
latitude,
|
|
2153
|
-
longitude,
|
|
2154
|
-
} = {}) {
|
|
2155
|
-
const { error } = CatalogValidator.getInStockLocations().validate(
|
|
2156
|
-
{ pageNo, pageSize, q, city, range, latitude, longitude },
|
|
2079
|
+
async getProductVariantsBySlug({ slug } = {}) {
|
|
2080
|
+
const { error } = CatalogValidator.getProductVariantsBySlug().validate(
|
|
2081
|
+
{ slug },
|
|
2157
2082
|
{ abortEarly: false, allowUnknown: true }
|
|
2158
2083
|
);
|
|
2159
2084
|
if (error) {
|
|
@@ -2161,26 +2086,21 @@ class Catalog {
|
|
|
2161
2086
|
}
|
|
2162
2087
|
|
|
2163
2088
|
// Showing warrnings if extra unknown parameters are found
|
|
2164
|
-
const {
|
|
2165
|
-
|
|
2089
|
+
const {
|
|
2090
|
+
error: warrning,
|
|
2091
|
+
} = CatalogValidator.getProductVariantsBySlug().validate(
|
|
2092
|
+
{ slug },
|
|
2166
2093
|
{ abortEarly: false, allowUnknown: false }
|
|
2167
2094
|
);
|
|
2168
2095
|
if (warrning) {
|
|
2169
2096
|
Logger({
|
|
2170
2097
|
level: "WARN",
|
|
2171
|
-
message: "Parameter Validation warrnings for
|
|
2098
|
+
message: "Parameter Validation warrnings for getProductVariantsBySlug",
|
|
2172
2099
|
});
|
|
2173
2100
|
Logger({ level: "WARN", message: warrning });
|
|
2174
2101
|
}
|
|
2175
2102
|
|
|
2176
2103
|
const query_params = {};
|
|
2177
|
-
query_params["page_no"] = pageNo;
|
|
2178
|
-
query_params["page_size"] = pageSize;
|
|
2179
|
-
query_params["q"] = q;
|
|
2180
|
-
query_params["city"] = city;
|
|
2181
|
-
query_params["range"] = range;
|
|
2182
|
-
query_params["latitude"] = latitude;
|
|
2183
|
-
query_params["longitude"] = longitude;
|
|
2184
2104
|
|
|
2185
2105
|
const xHeaders = {};
|
|
2186
2106
|
|
|
@@ -2188,8 +2108,8 @@ class Catalog {
|
|
|
2188
2108
|
this._conf,
|
|
2189
2109
|
"get",
|
|
2190
2110
|
constructUrl({
|
|
2191
|
-
url: this._urls["
|
|
2192
|
-
params: {},
|
|
2111
|
+
url: this._urls["getProductVariantsBySlug"],
|
|
2112
|
+
params: { slug },
|
|
2193
2113
|
}),
|
|
2194
2114
|
query_params,
|
|
2195
2115
|
undefined,
|
|
@@ -2198,7 +2118,7 @@ class Catalog {
|
|
|
2198
2118
|
|
|
2199
2119
|
const {
|
|
2200
2120
|
error: res_error,
|
|
2201
|
-
} = CatalogModel.
|
|
2121
|
+
} = CatalogModel.ProductVariantsResponse().validate(response, {
|
|
2202
2122
|
abortEarly: false,
|
|
2203
2123
|
allowUnknown: false,
|
|
2204
2124
|
});
|
|
@@ -2206,7 +2126,7 @@ class Catalog {
|
|
|
2206
2126
|
if (res_error) {
|
|
2207
2127
|
Logger({
|
|
2208
2128
|
level: "WARN",
|
|
2209
|
-
message: "Response Validation Warnnings for
|
|
2129
|
+
message: "Response Validation Warnnings for getProductVariantsBySlug",
|
|
2210
2130
|
});
|
|
2211
2131
|
Logger({ level: "WARN", message: res_error });
|
|
2212
2132
|
}
|
|
@@ -2216,60 +2136,38 @@ class Catalog {
|
|
|
2216
2136
|
|
|
2217
2137
|
/**
|
|
2218
2138
|
* @param {Object} arg - Arg object.
|
|
2219
|
-
* @param {
|
|
2220
|
-
*
|
|
2221
|
-
* @param {string} [arg.
|
|
2222
|
-
*
|
|
2223
|
-
*
|
|
2224
|
-
*
|
|
2225
|
-
*
|
|
2226
|
-
*
|
|
2227
|
-
*
|
|
2228
|
-
*
|
|
2229
|
-
*
|
|
2139
|
+
* @param {string} [arg.q] - The search query for entering partial or full
|
|
2140
|
+
* name of product, brand, category, or collection.
|
|
2141
|
+
* @param {string} [arg.f] - The search filter parameters. Filter parameters
|
|
2142
|
+
* will be passed in f parameter as shown in the example below. Double
|
|
2143
|
+
* Pipe (||) denotes the OR condition, whereas Triple-colon (:::)
|
|
2144
|
+
* indicates a new filter paramater applied as an AND condition.
|
|
2145
|
+
* @param {boolean} [arg.filters] - This is a boolean value, True for
|
|
2146
|
+
* fetching all filter parameters and False for disabling the filter parameters.
|
|
2147
|
+
* @param {string} [arg.sortOn] - The order in which the list of products
|
|
2148
|
+
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
2149
|
+
* either ascending or descending order. See the supported values below.
|
|
2150
|
+
* @param {string} [arg.pageId] - Page ID to retrieve next set of results.
|
|
2151
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
2152
|
+
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
2153
|
+
* given set of results.
|
|
2154
|
+
* @param {string} [arg.pageType] - Available pagination types are cursor or number.
|
|
2155
|
+
* @returns {Promise<ProductListingResponse>} - Success response
|
|
2156
|
+
* @summary: Get all the products
|
|
2157
|
+
* @description: Use this API to list all the products. You may choose a sort order or make arbitrary search queries by entering the product name, brand, category or collection.
|
|
2230
2158
|
*/
|
|
2231
|
-
|
|
2232
|
-
pageSize,
|
|
2159
|
+
async getProducts({
|
|
2233
2160
|
q,
|
|
2234
|
-
|
|
2235
|
-
|
|
2236
|
-
|
|
2237
|
-
|
|
2161
|
+
f,
|
|
2162
|
+
filters,
|
|
2163
|
+
sortOn,
|
|
2164
|
+
pageId,
|
|
2165
|
+
pageSize,
|
|
2166
|
+
pageNo,
|
|
2167
|
+
pageType,
|
|
2238
2168
|
} = {}) {
|
|
2239
|
-
const
|
|
2240
|
-
|
|
2241
|
-
const pageId = paginator.nextId;
|
|
2242
|
-
const pageNo = paginator.pageNo;
|
|
2243
|
-
const pageType = "number";
|
|
2244
|
-
const data = await this.getInStockLocations({
|
|
2245
|
-
pageNo: pageNo,
|
|
2246
|
-
pageSize: pageSize,
|
|
2247
|
-
q: q,
|
|
2248
|
-
city: city,
|
|
2249
|
-
range: range,
|
|
2250
|
-
latitude: latitude,
|
|
2251
|
-
longitude: longitude,
|
|
2252
|
-
});
|
|
2253
|
-
paginator.setPaginator({
|
|
2254
|
-
hasNext: data.page.has_next ? true : false,
|
|
2255
|
-
nextId: data.page.next_id,
|
|
2256
|
-
});
|
|
2257
|
-
return data;
|
|
2258
|
-
};
|
|
2259
|
-
paginator.setCallback(callback);
|
|
2260
|
-
return paginator;
|
|
2261
|
-
}
|
|
2262
|
-
|
|
2263
|
-
/**
|
|
2264
|
-
* @param {Object} arg - Arg object.
|
|
2265
|
-
* @param {number} arg.locationId - Unique Location ID.
|
|
2266
|
-
* @returns {Promise<StoreDetails>} - Success response
|
|
2267
|
-
* @summary: Get store meta information.
|
|
2268
|
-
* @description: Use this API to get meta details for a store.
|
|
2269
|
-
*/
|
|
2270
|
-
async getLocationDetailsById({ locationId } = {}) {
|
|
2271
|
-
const { error } = CatalogValidator.getLocationDetailsById().validate(
|
|
2272
|
-
{ locationId },
|
|
2169
|
+
const { error } = CatalogValidator.getProducts().validate(
|
|
2170
|
+
{ q, f, filters, sortOn, pageId, pageSize, pageNo, pageType },
|
|
2273
2171
|
{ abortEarly: false, allowUnknown: true }
|
|
2274
2172
|
);
|
|
2275
2173
|
if (error) {
|
|
@@ -2277,21 +2175,27 @@ class Catalog {
|
|
|
2277
2175
|
}
|
|
2278
2176
|
|
|
2279
2177
|
// Showing warrnings if extra unknown parameters are found
|
|
2280
|
-
const {
|
|
2281
|
-
|
|
2282
|
-
} = CatalogValidator.getLocationDetailsById().validate(
|
|
2283
|
-
{ locationId },
|
|
2178
|
+
const { error: warrning } = CatalogValidator.getProducts().validate(
|
|
2179
|
+
{ q, f, filters, sortOn, pageId, pageSize, pageNo, pageType },
|
|
2284
2180
|
{ abortEarly: false, allowUnknown: false }
|
|
2285
2181
|
);
|
|
2286
2182
|
if (warrning) {
|
|
2287
2183
|
Logger({
|
|
2288
2184
|
level: "WARN",
|
|
2289
|
-
message: "Parameter Validation warrnings for
|
|
2185
|
+
message: "Parameter Validation warrnings for getProducts",
|
|
2290
2186
|
});
|
|
2291
2187
|
Logger({ level: "WARN", message: warrning });
|
|
2292
2188
|
}
|
|
2293
2189
|
|
|
2294
2190
|
const query_params = {};
|
|
2191
|
+
query_params["q"] = q;
|
|
2192
|
+
query_params["f"] = f;
|
|
2193
|
+
query_params["filters"] = filters;
|
|
2194
|
+
query_params["sort_on"] = sortOn;
|
|
2195
|
+
query_params["page_id"] = pageId;
|
|
2196
|
+
query_params["page_size"] = pageSize;
|
|
2197
|
+
query_params["page_no"] = pageNo;
|
|
2198
|
+
query_params["page_type"] = pageType;
|
|
2295
2199
|
|
|
2296
2200
|
const xHeaders = {};
|
|
2297
2201
|
|
|
@@ -2299,23 +2203,25 @@ class Catalog {
|
|
|
2299
2203
|
this._conf,
|
|
2300
2204
|
"get",
|
|
2301
2205
|
constructUrl({
|
|
2302
|
-
url: this._urls["
|
|
2303
|
-
params: {
|
|
2206
|
+
url: this._urls["getProducts"],
|
|
2207
|
+
params: {},
|
|
2304
2208
|
}),
|
|
2305
2209
|
query_params,
|
|
2306
2210
|
undefined,
|
|
2307
2211
|
xHeaders
|
|
2308
2212
|
);
|
|
2309
2213
|
|
|
2310
|
-
const {
|
|
2311
|
-
|
|
2312
|
-
|
|
2313
|
-
|
|
2214
|
+
const {
|
|
2215
|
+
error: res_error,
|
|
2216
|
+
} = CatalogModel.ProductListingResponse().validate(response, {
|
|
2217
|
+
abortEarly: false,
|
|
2218
|
+
allowUnknown: false,
|
|
2219
|
+
});
|
|
2314
2220
|
|
|
2315
2221
|
if (res_error) {
|
|
2316
2222
|
Logger({
|
|
2317
2223
|
level: "WARN",
|
|
2318
|
-
message: "Response Validation Warnnings for
|
|
2224
|
+
message: "Response Validation Warnnings for getProducts",
|
|
2319
2225
|
});
|
|
2320
2226
|
Logger({ level: "WARN", message: res_error });
|
|
2321
2227
|
}
|
|
@@ -2325,15 +2231,60 @@ class Catalog {
|
|
|
2325
2231
|
|
|
2326
2232
|
/**
|
|
2327
2233
|
* @param {Object} arg - Arg object.
|
|
2328
|
-
* @param {string} [arg.
|
|
2329
|
-
*
|
|
2330
|
-
* @
|
|
2331
|
-
*
|
|
2332
|
-
*
|
|
2234
|
+
* @param {string} [arg.q] - The search query for entering partial or full
|
|
2235
|
+
* name of product, brand, category, or collection.
|
|
2236
|
+
* @param {string} [arg.f] - The search filter parameters. Filter parameters
|
|
2237
|
+
* will be passed in f parameter as shown in the example below. Double
|
|
2238
|
+
* Pipe (||) denotes the OR condition, whereas Triple-colon (:::)
|
|
2239
|
+
* indicates a new filter paramater applied as an AND condition.
|
|
2240
|
+
* @param {boolean} [arg.filters] - This is a boolean value, True for
|
|
2241
|
+
* fetching all filter parameters and False for disabling the filter parameters.
|
|
2242
|
+
* @param {string} [arg.sortOn] - The order in which the list of products
|
|
2243
|
+
* should be sorted, e.g. popularity, price, latest and discount, in
|
|
2244
|
+
* either ascending or descending order. See the supported values below.
|
|
2245
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each page.
|
|
2246
|
+
* @summary: Get all the products
|
|
2247
|
+
* @description: Use this API to list all the products. You may choose a sort order or make arbitrary search queries by entering the product name, brand, category or collection.
|
|
2248
|
+
*/
|
|
2249
|
+
getProductsPaginator({ q, f, filters, sortOn, pageSize } = {}) {
|
|
2250
|
+
const paginator = new Paginator();
|
|
2251
|
+
const callback = async () => {
|
|
2252
|
+
const pageId = paginator.nextId;
|
|
2253
|
+
const pageNo = paginator.pageNo;
|
|
2254
|
+
const pageType = "cursor";
|
|
2255
|
+
const data = await this.getProducts({
|
|
2256
|
+
q: q,
|
|
2257
|
+
f: f,
|
|
2258
|
+
filters: filters,
|
|
2259
|
+
sortOn: sortOn,
|
|
2260
|
+
pageId: pageId,
|
|
2261
|
+
pageSize: pageSize,
|
|
2262
|
+
pageNo: pageNo,
|
|
2263
|
+
pageType: pageType,
|
|
2264
|
+
});
|
|
2265
|
+
paginator.setPaginator({
|
|
2266
|
+
hasNext: data.page.has_next ? true : false,
|
|
2267
|
+
nextId: data.page.next_id,
|
|
2268
|
+
});
|
|
2269
|
+
return data;
|
|
2270
|
+
};
|
|
2271
|
+
paginator.setCallback(callback);
|
|
2272
|
+
return paginator;
|
|
2273
|
+
}
|
|
2274
|
+
|
|
2275
|
+
/**
|
|
2276
|
+
* @param {Object} arg - Arg object.
|
|
2277
|
+
* @param {string} arg.q - The search query for entering partial or full
|
|
2278
|
+
* name of a product, brand or category. For example, if the given search
|
|
2279
|
+
* query `q` is _ski_, the relevant search suggestions could be _skirt_,
|
|
2280
|
+
* _ski shoes_, __skin cream_ etc.
|
|
2281
|
+
* @returns {Promise<AutoCompleteResponse>} - Success response
|
|
2282
|
+
* @summary: Get relevant suggestions for a search query
|
|
2283
|
+
* @description: Retrieves a list of suggestions for a given search query. Each suggestion is a valid search term that's generated on the basis of query. This is particularly useful to enhance the user experience while using the search tool.
|
|
2333
2284
|
*/
|
|
2334
|
-
async
|
|
2335
|
-
const { error } = CatalogValidator.
|
|
2336
|
-
{
|
|
2285
|
+
async getSearchResults({ q } = {}) {
|
|
2286
|
+
const { error } = CatalogValidator.getSearchResults().validate(
|
|
2287
|
+
{ q },
|
|
2337
2288
|
{ abortEarly: false, allowUnknown: true }
|
|
2338
2289
|
);
|
|
2339
2290
|
if (error) {
|
|
@@ -2341,23 +2292,20 @@ class Catalog {
|
|
|
2341
2292
|
}
|
|
2342
2293
|
|
|
2343
2294
|
// Showing warrnings if extra unknown parameters are found
|
|
2344
|
-
const {
|
|
2345
|
-
|
|
2346
|
-
} = CatalogValidator.getProductBundlesBySlug().validate(
|
|
2347
|
-
{ slug, id },
|
|
2295
|
+
const { error: warrning } = CatalogValidator.getSearchResults().validate(
|
|
2296
|
+
{ q },
|
|
2348
2297
|
{ abortEarly: false, allowUnknown: false }
|
|
2349
2298
|
);
|
|
2350
2299
|
if (warrning) {
|
|
2351
2300
|
Logger({
|
|
2352
2301
|
level: "WARN",
|
|
2353
|
-
message: "Parameter Validation warrnings for
|
|
2302
|
+
message: "Parameter Validation warrnings for getSearchResults",
|
|
2354
2303
|
});
|
|
2355
2304
|
Logger({ level: "WARN", message: warrning });
|
|
2356
2305
|
}
|
|
2357
2306
|
|
|
2358
2307
|
const query_params = {};
|
|
2359
|
-
query_params["
|
|
2360
|
-
query_params["id"] = id;
|
|
2308
|
+
query_params["q"] = q;
|
|
2361
2309
|
|
|
2362
2310
|
const xHeaders = {};
|
|
2363
2311
|
|
|
@@ -2365,7 +2313,7 @@ class Catalog {
|
|
|
2365
2313
|
this._conf,
|
|
2366
2314
|
"get",
|
|
2367
2315
|
constructUrl({
|
|
2368
|
-
url: this._urls["
|
|
2316
|
+
url: this._urls["getSearchResults"],
|
|
2369
2317
|
params: {},
|
|
2370
2318
|
}),
|
|
2371
2319
|
query_params,
|
|
@@ -2373,15 +2321,17 @@ class Catalog {
|
|
|
2373
2321
|
xHeaders
|
|
2374
2322
|
);
|
|
2375
2323
|
|
|
2376
|
-
const {
|
|
2377
|
-
|
|
2378
|
-
|
|
2379
|
-
|
|
2324
|
+
const {
|
|
2325
|
+
error: res_error,
|
|
2326
|
+
} = CatalogModel.AutoCompleteResponse().validate(response, {
|
|
2327
|
+
abortEarly: false,
|
|
2328
|
+
allowUnknown: false,
|
|
2329
|
+
});
|
|
2380
2330
|
|
|
2381
2331
|
if (res_error) {
|
|
2382
2332
|
Logger({
|
|
2383
2333
|
level: "WARN",
|
|
2384
|
-
message: "Response Validation Warnnings for
|
|
2334
|
+
message: "Response Validation Warnnings for getSearchResults",
|
|
2385
2335
|
});
|
|
2386
2336
|
Logger({ level: "WARN", message: res_error });
|
|
2387
2337
|
}
|
|
@@ -2394,22 +2344,15 @@ class Catalog {
|
|
|
2394
2344
|
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
2395
2345
|
* identifier of a product. You can get slug value from the endpoint
|
|
2396
2346
|
* /service/application/catalog/v1.0/products/
|
|
2397
|
-
* @
|
|
2398
|
-
*
|
|
2399
|
-
*
|
|
2400
|
-
* @param {number} [arg.storeId] - The ID of the store that is selling the
|
|
2401
|
-
* product, e.g. 1,2,3.
|
|
2402
|
-
* @param {string} [arg.pincode] - The PIN Code of the area near which the
|
|
2403
|
-
* selling locations should be searched, e.g. 400059.
|
|
2404
|
-
* @param {number} [arg.moq] - An Integer indication the Minimum Order
|
|
2405
|
-
* Quantity of a product, e.g. 100.
|
|
2406
|
-
* @returns {Promise<ProductSizePriceResponseV3>} - Success response
|
|
2407
|
-
* @summary: Get the price of a product size at a PIN Code
|
|
2408
|
-
* @description: Prices may vary for different sizes of a product. Use this API to retrieve the price of a product size at all the selling locations near to a PIN Code.
|
|
2347
|
+
* @returns {Promise<ProductCompareResponse>} - Success response
|
|
2348
|
+
* @summary: Get comparison between similar products
|
|
2349
|
+
* @description: Use this API to compare a given product automatically with similar products. Only one slug is needed.
|
|
2409
2350
|
*/
|
|
2410
|
-
async
|
|
2411
|
-
const {
|
|
2412
|
-
|
|
2351
|
+
async getSimilarComparisonProductBySlug({ slug } = {}) {
|
|
2352
|
+
const {
|
|
2353
|
+
error,
|
|
2354
|
+
} = CatalogValidator.getSimilarComparisonProductBySlug().validate(
|
|
2355
|
+
{ slug },
|
|
2413
2356
|
{ abortEarly: false, allowUnknown: true }
|
|
2414
2357
|
);
|
|
2415
2358
|
if (error) {
|
|
@@ -2419,22 +2362,20 @@ class Catalog {
|
|
|
2419
2362
|
// Showing warrnings if extra unknown parameters are found
|
|
2420
2363
|
const {
|
|
2421
2364
|
error: warrning,
|
|
2422
|
-
} = CatalogValidator.
|
|
2423
|
-
{ slug
|
|
2365
|
+
} = CatalogValidator.getSimilarComparisonProductBySlug().validate(
|
|
2366
|
+
{ slug },
|
|
2424
2367
|
{ abortEarly: false, allowUnknown: false }
|
|
2425
2368
|
);
|
|
2426
2369
|
if (warrning) {
|
|
2427
2370
|
Logger({
|
|
2428
2371
|
level: "WARN",
|
|
2429
|
-
message:
|
|
2372
|
+
message:
|
|
2373
|
+
"Parameter Validation warrnings for getSimilarComparisonProductBySlug",
|
|
2430
2374
|
});
|
|
2431
2375
|
Logger({ level: "WARN", message: warrning });
|
|
2432
2376
|
}
|
|
2433
2377
|
|
|
2434
2378
|
const query_params = {};
|
|
2435
|
-
query_params["store_id"] = storeId;
|
|
2436
|
-
query_params["pincode"] = pincode;
|
|
2437
|
-
query_params["moq"] = moq;
|
|
2438
2379
|
|
|
2439
2380
|
const xHeaders = {};
|
|
2440
2381
|
|
|
@@ -2442,8 +2383,8 @@ class Catalog {
|
|
|
2442
2383
|
this._conf,
|
|
2443
2384
|
"get",
|
|
2444
2385
|
constructUrl({
|
|
2445
|
-
url: this._urls["
|
|
2446
|
-
params: { slug
|
|
2386
|
+
url: this._urls["getSimilarComparisonProductBySlug"],
|
|
2387
|
+
params: { slug },
|
|
2447
2388
|
}),
|
|
2448
2389
|
query_params,
|
|
2449
2390
|
undefined,
|
|
@@ -2452,7 +2393,7 @@ class Catalog {
|
|
|
2452
2393
|
|
|
2453
2394
|
const {
|
|
2454
2395
|
error: res_error,
|
|
2455
|
-
} = CatalogModel.
|
|
2396
|
+
} = CatalogModel.ProductCompareResponse().validate(response, {
|
|
2456
2397
|
abortEarly: false,
|
|
2457
2398
|
allowUnknown: false,
|
|
2458
2399
|
});
|
|
@@ -2460,7 +2401,8 @@ class Catalog {
|
|
|
2460
2401
|
if (res_error) {
|
|
2461
2402
|
Logger({
|
|
2462
2403
|
level: "WARN",
|
|
2463
|
-
message:
|
|
2404
|
+
message:
|
|
2405
|
+
"Response Validation Warnnings for getSimilarComparisonProductBySlug",
|
|
2464
2406
|
});
|
|
2465
2407
|
Logger({ level: "WARN", message: res_error });
|
|
2466
2408
|
}
|
|
@@ -2470,33 +2412,32 @@ class Catalog {
|
|
|
2470
2412
|
|
|
2471
2413
|
/**
|
|
2472
2414
|
* @param {Object} arg - Arg object.
|
|
2473
|
-
* @param {string} arg.slug - A short, human-readable, URL-friendly
|
|
2474
|
-
* identifier of a product. You can get slug value from the endpoint
|
|
2475
|
-
* /service/application/catalog/v1.0/products/
|
|
2476
|
-
* @param {string} arg.size - A string indicating the size of the product,
|
|
2477
|
-
* e.g. S, M, XL. You can get slug value from the endpoint
|
|
2478
|
-
* /service/application/catalog/v1.0/products/sizes
|
|
2479
|
-
* @param {string} [arg.pincode] - The 6-digit PIN Code of the area near
|
|
2480
|
-
* which the selling locations should be searched, e.g. 400059
|
|
2481
|
-
* @param {string} [arg.strategy] - Sort stores on the basis of strategy.
|
|
2482
|
-
* eg, fast-delivery, low-price, optimal.
|
|
2483
2415
|
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
2484
2416
|
* given set of results.
|
|
2485
|
-
* @param {number} [arg.pageSize] -
|
|
2486
|
-
* @
|
|
2487
|
-
* @
|
|
2488
|
-
* @
|
|
2417
|
+
* @param {number} [arg.pageSize] - Number of items to retrieve in each page.
|
|
2418
|
+
* @param {string} [arg.q] - Search a store by its name or store_code.
|
|
2419
|
+
* @param {string} [arg.city] - Search stores by the city in which they are situated.
|
|
2420
|
+
* @param {number} [arg.range] - Use this to retrieve stores within a
|
|
2421
|
+
* particular range in meters, e.g. 10000, to indicate a 10km range
|
|
2422
|
+
* @param {number} [arg.latitude] - Latitude of the location from where one
|
|
2423
|
+
* wants to retreive the nearest stores, e.g. 72.8691788
|
|
2424
|
+
* @param {number} [arg.longitude] - Longitude of the location from where
|
|
2425
|
+
* one wants to retreive the nearest stores, e.g. 19.1174114
|
|
2426
|
+
* @returns {Promise<StoreListingResponse>} - Success response
|
|
2427
|
+
* @summary: Get store meta information.
|
|
2428
|
+
* @description: Use this API to get a list of stores in a specific application.
|
|
2489
2429
|
*/
|
|
2490
|
-
async
|
|
2491
|
-
slug,
|
|
2492
|
-
size,
|
|
2493
|
-
pincode,
|
|
2494
|
-
strategy,
|
|
2430
|
+
async getStores({
|
|
2495
2431
|
pageNo,
|
|
2496
2432
|
pageSize,
|
|
2433
|
+
q,
|
|
2434
|
+
city,
|
|
2435
|
+
range,
|
|
2436
|
+
latitude,
|
|
2437
|
+
longitude,
|
|
2497
2438
|
} = {}) {
|
|
2498
|
-
const { error } = CatalogValidator.
|
|
2499
|
-
{
|
|
2439
|
+
const { error } = CatalogValidator.getStores().validate(
|
|
2440
|
+
{ pageNo, pageSize, q, city, range, latitude, longitude },
|
|
2500
2441
|
{ abortEarly: false, allowUnknown: true }
|
|
2501
2442
|
);
|
|
2502
2443
|
if (error) {
|
|
@@ -2504,25 +2445,26 @@ class Catalog {
|
|
|
2504
2445
|
}
|
|
2505
2446
|
|
|
2506
2447
|
// Showing warrnings if extra unknown parameters are found
|
|
2507
|
-
const {
|
|
2508
|
-
|
|
2509
|
-
} = CatalogValidator.getProductSellersBySlug().validate(
|
|
2510
|
-
{ slug, size, pincode, strategy, pageNo, pageSize },
|
|
2448
|
+
const { error: warrning } = CatalogValidator.getStores().validate(
|
|
2449
|
+
{ pageNo, pageSize, q, city, range, latitude, longitude },
|
|
2511
2450
|
{ abortEarly: false, allowUnknown: false }
|
|
2512
2451
|
);
|
|
2513
2452
|
if (warrning) {
|
|
2514
2453
|
Logger({
|
|
2515
2454
|
level: "WARN",
|
|
2516
|
-
message: "Parameter Validation warrnings for
|
|
2455
|
+
message: "Parameter Validation warrnings for getStores",
|
|
2517
2456
|
});
|
|
2518
2457
|
Logger({ level: "WARN", message: warrning });
|
|
2519
2458
|
}
|
|
2520
2459
|
|
|
2521
2460
|
const query_params = {};
|
|
2522
|
-
query_params["pincode"] = pincode;
|
|
2523
|
-
query_params["strategy"] = strategy;
|
|
2524
2461
|
query_params["page_no"] = pageNo;
|
|
2525
2462
|
query_params["page_size"] = pageSize;
|
|
2463
|
+
query_params["q"] = q;
|
|
2464
|
+
query_params["city"] = city;
|
|
2465
|
+
query_params["range"] = range;
|
|
2466
|
+
query_params["latitude"] = latitude;
|
|
2467
|
+
query_params["longitude"] = longitude;
|
|
2526
2468
|
|
|
2527
2469
|
const xHeaders = {};
|
|
2528
2470
|
|
|
@@ -2530,8 +2472,8 @@ class Catalog {
|
|
|
2530
2472
|
this._conf,
|
|
2531
2473
|
"get",
|
|
2532
2474
|
constructUrl({
|
|
2533
|
-
url: this._urls["
|
|
2534
|
-
params: {
|
|
2475
|
+
url: this._urls["getStores"],
|
|
2476
|
+
params: {},
|
|
2535
2477
|
}),
|
|
2536
2478
|
query_params,
|
|
2537
2479
|
undefined,
|
|
@@ -2540,7 +2482,7 @@ class Catalog {
|
|
|
2540
2482
|
|
|
2541
2483
|
const {
|
|
2542
2484
|
error: res_error,
|
|
2543
|
-
} = CatalogModel.
|
|
2485
|
+
} = CatalogModel.StoreListingResponse().validate(response, {
|
|
2544
2486
|
abortEarly: false,
|
|
2545
2487
|
allowUnknown: false,
|
|
2546
2488
|
});
|
|
@@ -2548,7 +2490,7 @@ class Catalog {
|
|
|
2548
2490
|
if (res_error) {
|
|
2549
2491
|
Logger({
|
|
2550
2492
|
level: "WARN",
|
|
2551
|
-
message: "Response Validation Warnnings for
|
|
2493
|
+
message: "Response Validation Warnnings for getStores",
|
|
2552
2494
|
});
|
|
2553
2495
|
Logger({ level: "WARN", message: res_error });
|
|
2554
2496
|
}
|
|
@@ -2558,39 +2500,32 @@ class Catalog {
|
|
|
2558
2500
|
|
|
2559
2501
|
/**
|
|
2560
2502
|
* @param {Object} arg - Arg object.
|
|
2561
|
-
* @param {
|
|
2562
|
-
*
|
|
2563
|
-
*
|
|
2564
|
-
* @param {
|
|
2565
|
-
* e.g.
|
|
2566
|
-
*
|
|
2567
|
-
*
|
|
2568
|
-
*
|
|
2569
|
-
*
|
|
2570
|
-
*
|
|
2571
|
-
* @
|
|
2572
|
-
* @summary: Get the sellers of a product size at a PIN Code
|
|
2573
|
-
* @description: A product of a particular size may be sold by multiple sellers. Use this API to fetch the sellers having the stock of a particular size at a given PIN Code.
|
|
2503
|
+
* @param {number} [arg.pageSize] - Number of items to retrieve in each page.
|
|
2504
|
+
* @param {string} [arg.q] - Search a store by its name or store_code.
|
|
2505
|
+
* @param {string} [arg.city] - Search stores by the city in which they are situated.
|
|
2506
|
+
* @param {number} [arg.range] - Use this to retrieve stores within a
|
|
2507
|
+
* particular range in meters, e.g. 10000, to indicate a 10km range
|
|
2508
|
+
* @param {number} [arg.latitude] - Latitude of the location from where one
|
|
2509
|
+
* wants to retreive the nearest stores, e.g. 72.8691788
|
|
2510
|
+
* @param {number} [arg.longitude] - Longitude of the location from where
|
|
2511
|
+
* one wants to retreive the nearest stores, e.g. 19.1174114
|
|
2512
|
+
* @summary: Get store meta information.
|
|
2513
|
+
* @description: Use this API to get a list of stores in a specific application.
|
|
2574
2514
|
*/
|
|
2575
|
-
|
|
2576
|
-
slug,
|
|
2577
|
-
size,
|
|
2578
|
-
pincode,
|
|
2579
|
-
strategy,
|
|
2580
|
-
pageSize,
|
|
2581
|
-
} = {}) {
|
|
2515
|
+
getStoresPaginator({ pageSize, q, city, range, latitude, longitude } = {}) {
|
|
2582
2516
|
const paginator = new Paginator();
|
|
2583
2517
|
const callback = async () => {
|
|
2584
2518
|
const pageId = paginator.nextId;
|
|
2585
2519
|
const pageNo = paginator.pageNo;
|
|
2586
2520
|
const pageType = "number";
|
|
2587
|
-
const data = await this.
|
|
2588
|
-
slug: slug,
|
|
2589
|
-
size: size,
|
|
2590
|
-
pincode: pincode,
|
|
2591
|
-
strategy: strategy,
|
|
2521
|
+
const data = await this.getStores({
|
|
2592
2522
|
pageNo: pageNo,
|
|
2593
2523
|
pageSize: pageSize,
|
|
2524
|
+
q: q,
|
|
2525
|
+
city: city,
|
|
2526
|
+
range: range,
|
|
2527
|
+
latitude: latitude,
|
|
2528
|
+
longitude: longitude,
|
|
2594
2529
|
});
|
|
2595
2530
|
paginator.setPaginator({
|
|
2596
2531
|
hasNext: data.page.has_next ? true : false,
|
|
@@ -2601,6 +2536,71 @@ class Catalog {
|
|
|
2601
2536
|
paginator.setCallback(callback);
|
|
2602
2537
|
return paginator;
|
|
2603
2538
|
}
|
|
2539
|
+
|
|
2540
|
+
/**
|
|
2541
|
+
* @param {Object} arg - Arg object.
|
|
2542
|
+
* @param {string} arg.collectionType - Type of collection followed, i.e.
|
|
2543
|
+
* products, brands, or collections.
|
|
2544
|
+
* @param {string} arg.collectionId - The ID of the collection type.
|
|
2545
|
+
* @returns {Promise<FollowPostResponse>} - Success response
|
|
2546
|
+
* @summary: Unfollow an entity (product/brand/collection)
|
|
2547
|
+
* @description: You can undo a followed product, brand or collection by its ID. This action is referred as _unfollow_.
|
|
2548
|
+
*/
|
|
2549
|
+
async unfollowById({ collectionType, collectionId } = {}) {
|
|
2550
|
+
const { error } = CatalogValidator.unfollowById().validate(
|
|
2551
|
+
{ collectionType, collectionId },
|
|
2552
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2553
|
+
);
|
|
2554
|
+
if (error) {
|
|
2555
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2556
|
+
}
|
|
2557
|
+
|
|
2558
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2559
|
+
const { error: warrning } = CatalogValidator.unfollowById().validate(
|
|
2560
|
+
{ collectionType, collectionId },
|
|
2561
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2562
|
+
);
|
|
2563
|
+
if (warrning) {
|
|
2564
|
+
Logger({
|
|
2565
|
+
level: "WARN",
|
|
2566
|
+
message: "Parameter Validation warrnings for unfollowById",
|
|
2567
|
+
});
|
|
2568
|
+
Logger({ level: "WARN", message: warrning });
|
|
2569
|
+
}
|
|
2570
|
+
|
|
2571
|
+
const query_params = {};
|
|
2572
|
+
|
|
2573
|
+
const xHeaders = {};
|
|
2574
|
+
|
|
2575
|
+
const response = await APIClient.execute(
|
|
2576
|
+
this._conf,
|
|
2577
|
+
"delete",
|
|
2578
|
+
constructUrl({
|
|
2579
|
+
url: this._urls["unfollowById"],
|
|
2580
|
+
params: { collectionType, collectionId },
|
|
2581
|
+
}),
|
|
2582
|
+
query_params,
|
|
2583
|
+
undefined,
|
|
2584
|
+
xHeaders
|
|
2585
|
+
);
|
|
2586
|
+
|
|
2587
|
+
const {
|
|
2588
|
+
error: res_error,
|
|
2589
|
+
} = CatalogModel.FollowPostResponse().validate(response, {
|
|
2590
|
+
abortEarly: false,
|
|
2591
|
+
allowUnknown: false,
|
|
2592
|
+
});
|
|
2593
|
+
|
|
2594
|
+
if (res_error) {
|
|
2595
|
+
Logger({
|
|
2596
|
+
level: "WARN",
|
|
2597
|
+
message: "Response Validation Warnnings for unfollowById",
|
|
2598
|
+
});
|
|
2599
|
+
Logger({ level: "WARN", message: res_error });
|
|
2600
|
+
}
|
|
2601
|
+
|
|
2602
|
+
return response;
|
|
2603
|
+
}
|
|
2604
2604
|
}
|
|
2605
2605
|
|
|
2606
2606
|
module.exports = Catalog;
|