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