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