@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,9 +1,10 @@
|
|
|
1
|
-
const Paginator = require("../../common/Paginator");
|
|
2
1
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
3
2
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
|
+
const Paginator = require("../../common/Paginator");
|
|
4
4
|
const UserValidator = require("./UserPlatformApplicationValidator");
|
|
5
5
|
const UserModel = require("./UserPlatformModel");
|
|
6
6
|
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
const Joi = require("joi");
|
|
7
8
|
|
|
8
9
|
class User {
|
|
9
10
|
constructor(config, applicationId) {
|
|
@@ -13,22 +14,15 @@ class User {
|
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @param {Object} arg - Arg object.
|
|
16
|
-
* @param {
|
|
17
|
-
*
|
|
18
|
-
* @
|
|
19
|
-
*
|
|
20
|
-
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
21
|
-
* given set of results. Default value is 1.
|
|
22
|
-
* @returns {Promise<CustomerListResponseSchema>} - Success response
|
|
23
|
-
* @summary: Get a list of customers
|
|
24
|
-
* @description: Use this API to retrieve a list of customers who have registered in the application.
|
|
17
|
+
* @param {ArchiveUserRequestSchema} arg.body
|
|
18
|
+
* @returns {Promise<ArchiveUserSuccess>} - Success response
|
|
19
|
+
* @summary: archive user
|
|
20
|
+
* @description: archive user
|
|
25
21
|
*/
|
|
26
|
-
async
|
|
27
|
-
const { error } = UserValidator.
|
|
22
|
+
async archiveUser({ body } = {}) {
|
|
23
|
+
const { error } = UserValidator.archiveUser().validate(
|
|
28
24
|
{
|
|
29
|
-
|
|
30
|
-
pageSize,
|
|
31
|
-
pageNo,
|
|
25
|
+
body,
|
|
32
26
|
},
|
|
33
27
|
{ abortEarly: false, allowUnknown: true }
|
|
34
28
|
);
|
|
@@ -37,38 +31,33 @@ class User {
|
|
|
37
31
|
}
|
|
38
32
|
|
|
39
33
|
// Showing warrnings if extra unknown parameters are found
|
|
40
|
-
const { error: warrning } = UserValidator.
|
|
34
|
+
const { error: warrning } = UserValidator.archiveUser().validate(
|
|
41
35
|
{
|
|
42
|
-
|
|
43
|
-
pageSize,
|
|
44
|
-
pageNo,
|
|
36
|
+
body,
|
|
45
37
|
},
|
|
46
38
|
{ abortEarly: false, allowUnknown: false }
|
|
47
39
|
);
|
|
48
40
|
if (warrning) {
|
|
49
41
|
Logger({
|
|
50
42
|
level: "WARN",
|
|
51
|
-
message: "Parameter Validation warrnings for
|
|
43
|
+
message: "Parameter Validation warrnings for archiveUser",
|
|
52
44
|
});
|
|
53
45
|
Logger({ level: "WARN", message: warrning });
|
|
54
46
|
}
|
|
55
47
|
|
|
56
48
|
const query_params = {};
|
|
57
|
-
query_params["q"] = q;
|
|
58
|
-
query_params["page_size"] = pageSize;
|
|
59
|
-
query_params["page_no"] = pageNo;
|
|
60
49
|
|
|
61
50
|
const response = await PlatformAPIClient.execute(
|
|
62
51
|
this.config,
|
|
63
|
-
"
|
|
64
|
-
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/
|
|
52
|
+
"put",
|
|
53
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/archive`,
|
|
65
54
|
query_params,
|
|
66
|
-
|
|
55
|
+
body
|
|
67
56
|
);
|
|
68
57
|
|
|
69
58
|
const {
|
|
70
59
|
error: res_error,
|
|
71
|
-
} = UserModel.
|
|
60
|
+
} = UserModel.ArchiveUserSuccess().validate(response, {
|
|
72
61
|
abortEarly: false,
|
|
73
62
|
allowUnknown: false,
|
|
74
63
|
});
|
|
@@ -76,7 +65,7 @@ class User {
|
|
|
76
65
|
if (res_error) {
|
|
77
66
|
Logger({
|
|
78
67
|
level: "WARN",
|
|
79
|
-
message: "Response Validation Warnnings for
|
|
68
|
+
message: "Response Validation Warnnings for archiveUser",
|
|
80
69
|
});
|
|
81
70
|
Logger({ level: "WARN", message: res_error });
|
|
82
71
|
}
|
|
@@ -86,16 +75,15 @@ class User {
|
|
|
86
75
|
|
|
87
76
|
/**
|
|
88
77
|
* @param {Object} arg - Arg object.
|
|
89
|
-
* @param {
|
|
90
|
-
*
|
|
91
|
-
* @
|
|
92
|
-
* @
|
|
93
|
-
* @description: Use this API to retrieve an existing user from a list.
|
|
78
|
+
* @param {BlockUserRequestSchema} arg.body
|
|
79
|
+
* @returns {Promise<BlockUserSuccess>} - Success response
|
|
80
|
+
* @summary: Block/Unblock user
|
|
81
|
+
* @description: Block/Unblock user
|
|
94
82
|
*/
|
|
95
|
-
async
|
|
96
|
-
const { error } = UserValidator.
|
|
83
|
+
async blockOrUnblockUsers({ body } = {}) {
|
|
84
|
+
const { error } = UserValidator.blockOrUnblockUsers().validate(
|
|
97
85
|
{
|
|
98
|
-
|
|
86
|
+
body,
|
|
99
87
|
},
|
|
100
88
|
{ abortEarly: false, allowUnknown: true }
|
|
101
89
|
);
|
|
@@ -104,42 +92,39 @@ class User {
|
|
|
104
92
|
}
|
|
105
93
|
|
|
106
94
|
// Showing warrnings if extra unknown parameters are found
|
|
107
|
-
const { error: warrning } = UserValidator.
|
|
95
|
+
const { error: warrning } = UserValidator.blockOrUnblockUsers().validate(
|
|
108
96
|
{
|
|
109
|
-
|
|
97
|
+
body,
|
|
110
98
|
},
|
|
111
99
|
{ abortEarly: false, allowUnknown: false }
|
|
112
100
|
);
|
|
113
101
|
if (warrning) {
|
|
114
102
|
Logger({
|
|
115
103
|
level: "WARN",
|
|
116
|
-
message: "Parameter Validation warrnings for
|
|
104
|
+
message: "Parameter Validation warrnings for blockOrUnblockUsers",
|
|
117
105
|
});
|
|
118
106
|
Logger({ level: "WARN", message: warrning });
|
|
119
107
|
}
|
|
120
108
|
|
|
121
109
|
const query_params = {};
|
|
122
|
-
query_params["q"] = q;
|
|
123
110
|
|
|
124
111
|
const response = await PlatformAPIClient.execute(
|
|
125
112
|
this.config,
|
|
126
|
-
"
|
|
127
|
-
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/
|
|
113
|
+
"put",
|
|
114
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/activation`,
|
|
128
115
|
query_params,
|
|
129
|
-
|
|
116
|
+
body
|
|
130
117
|
);
|
|
131
118
|
|
|
132
|
-
const {
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
allowUnknown: false,
|
|
137
|
-
});
|
|
119
|
+
const { error: res_error } = UserModel.BlockUserSuccess().validate(
|
|
120
|
+
response,
|
|
121
|
+
{ abortEarly: false, allowUnknown: false }
|
|
122
|
+
);
|
|
138
123
|
|
|
139
124
|
if (res_error) {
|
|
140
125
|
Logger({
|
|
141
126
|
level: "WARN",
|
|
142
|
-
message: "Response Validation Warnnings for
|
|
127
|
+
message: "Response Validation Warnnings for blockOrUnblockUsers",
|
|
143
128
|
});
|
|
144
129
|
Logger({ level: "WARN", message: res_error });
|
|
145
130
|
}
|
|
@@ -210,13 +195,13 @@ class User {
|
|
|
210
195
|
|
|
211
196
|
/**
|
|
212
197
|
* @param {Object} arg - Arg object.
|
|
213
|
-
* @param {
|
|
214
|
-
* @returns {Promise<
|
|
215
|
-
* @summary:
|
|
216
|
-
* @description:
|
|
198
|
+
* @param {CreateUserGroupSchema} arg.body
|
|
199
|
+
* @returns {Promise<UserGroupResponseSchema>} - Success response
|
|
200
|
+
* @summary: Create an User Group
|
|
201
|
+
* @description: Use this API to create new user Group
|
|
217
202
|
*/
|
|
218
|
-
async
|
|
219
|
-
const { error } = UserValidator.
|
|
203
|
+
async createUserGroup({ body } = {}) {
|
|
204
|
+
const { error } = UserValidator.createUserGroup().validate(
|
|
220
205
|
{
|
|
221
206
|
body,
|
|
222
207
|
},
|
|
@@ -227,7 +212,7 @@ class User {
|
|
|
227
212
|
}
|
|
228
213
|
|
|
229
214
|
// Showing warrnings if extra unknown parameters are found
|
|
230
|
-
const { error: warrning } = UserValidator.
|
|
215
|
+
const { error: warrning } = UserValidator.createUserGroup().validate(
|
|
231
216
|
{
|
|
232
217
|
body,
|
|
233
218
|
},
|
|
@@ -236,7 +221,7 @@ class User {
|
|
|
236
221
|
if (warrning) {
|
|
237
222
|
Logger({
|
|
238
223
|
level: "WARN",
|
|
239
|
-
message: "Parameter Validation warrnings for
|
|
224
|
+
message: "Parameter Validation warrnings for createUserGroup",
|
|
240
225
|
});
|
|
241
226
|
Logger({ level: "WARN", message: warrning });
|
|
242
227
|
}
|
|
@@ -245,21 +230,23 @@ class User {
|
|
|
245
230
|
|
|
246
231
|
const response = await PlatformAPIClient.execute(
|
|
247
232
|
this.config,
|
|
248
|
-
"
|
|
249
|
-
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
233
|
+
"post",
|
|
234
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/user_group`,
|
|
250
235
|
query_params,
|
|
251
236
|
body
|
|
252
237
|
);
|
|
253
238
|
|
|
254
|
-
const {
|
|
255
|
-
|
|
256
|
-
|
|
257
|
-
|
|
239
|
+
const {
|
|
240
|
+
error: res_error,
|
|
241
|
+
} = UserModel.UserGroupResponseSchema().validate(response, {
|
|
242
|
+
abortEarly: false,
|
|
243
|
+
allowUnknown: false,
|
|
244
|
+
});
|
|
258
245
|
|
|
259
246
|
if (res_error) {
|
|
260
247
|
Logger({
|
|
261
248
|
level: "WARN",
|
|
262
|
-
message: "Response Validation Warnnings for
|
|
249
|
+
message: "Response Validation Warnnings for createUserGroup",
|
|
263
250
|
});
|
|
264
251
|
Logger({ level: "WARN", message: res_error });
|
|
265
252
|
}
|
|
@@ -269,13 +256,13 @@ class User {
|
|
|
269
256
|
|
|
270
257
|
/**
|
|
271
258
|
* @param {Object} arg - Arg object.
|
|
272
|
-
* @param {
|
|
273
|
-
* @returns {Promise<
|
|
274
|
-
* @summary:
|
|
275
|
-
* @description:
|
|
259
|
+
* @param {CreateUserSessionRequestSchema} arg.body
|
|
260
|
+
* @returns {Promise<CreateUserSessionResponseSchema>} - Success response
|
|
261
|
+
* @summary: Create user session
|
|
262
|
+
* @description: Create user session
|
|
276
263
|
*/
|
|
277
|
-
async
|
|
278
|
-
const { error } = UserValidator.
|
|
264
|
+
async createUserSession({ body } = {}) {
|
|
265
|
+
const { error } = UserValidator.createUserSession().validate(
|
|
279
266
|
{
|
|
280
267
|
body,
|
|
281
268
|
},
|
|
@@ -286,7 +273,7 @@ class User {
|
|
|
286
273
|
}
|
|
287
274
|
|
|
288
275
|
// Showing warrnings if extra unknown parameters are found
|
|
289
|
-
const { error: warrning } = UserValidator.
|
|
276
|
+
const { error: warrning } = UserValidator.createUserSession().validate(
|
|
290
277
|
{
|
|
291
278
|
body,
|
|
292
279
|
},
|
|
@@ -295,7 +282,7 @@ class User {
|
|
|
295
282
|
if (warrning) {
|
|
296
283
|
Logger({
|
|
297
284
|
level: "WARN",
|
|
298
|
-
message: "Parameter Validation warrnings for
|
|
285
|
+
message: "Parameter Validation warrnings for createUserSession",
|
|
299
286
|
});
|
|
300
287
|
Logger({ level: "WARN", message: warrning });
|
|
301
288
|
}
|
|
@@ -304,15 +291,15 @@ class User {
|
|
|
304
291
|
|
|
305
292
|
const response = await PlatformAPIClient.execute(
|
|
306
293
|
this.config,
|
|
307
|
-
"
|
|
308
|
-
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/
|
|
294
|
+
"post",
|
|
295
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/session`,
|
|
309
296
|
query_params,
|
|
310
297
|
body
|
|
311
298
|
);
|
|
312
299
|
|
|
313
300
|
const {
|
|
314
301
|
error: res_error,
|
|
315
|
-
} = UserModel.
|
|
302
|
+
} = UserModel.CreateUserSessionResponseSchema().validate(response, {
|
|
316
303
|
abortEarly: false,
|
|
317
304
|
allowUnknown: false,
|
|
318
305
|
});
|
|
@@ -320,7 +307,7 @@ class User {
|
|
|
320
307
|
if (res_error) {
|
|
321
308
|
Logger({
|
|
322
309
|
level: "WARN",
|
|
323
|
-
message: "Response Validation Warnnings for
|
|
310
|
+
message: "Response Validation Warnnings for createUserSession",
|
|
324
311
|
});
|
|
325
312
|
Logger({ level: "WARN", message: res_error });
|
|
326
313
|
}
|
|
@@ -330,15 +317,17 @@ class User {
|
|
|
330
317
|
|
|
331
318
|
/**
|
|
332
319
|
* @param {Object} arg - Arg object.
|
|
333
|
-
* @param {
|
|
334
|
-
* @
|
|
335
|
-
* @
|
|
336
|
-
* @
|
|
320
|
+
* @param {string} arg.id - ID of a customer.
|
|
321
|
+
* @param {string} arg.reason - Reason to delete sessions.
|
|
322
|
+
* @returns {Promise<SessionDeleteResponseSchema>} - Success response
|
|
323
|
+
* @summary: Delete a list of all session for a user
|
|
324
|
+
* @description: Use this API to Delete a list of session of customers who have registered in the application.
|
|
337
325
|
*/
|
|
338
|
-
async
|
|
339
|
-
const { error } = UserValidator.
|
|
326
|
+
async deleteActiveSessions({ id, reason } = {}) {
|
|
327
|
+
const { error } = UserValidator.deleteActiveSessions().validate(
|
|
340
328
|
{
|
|
341
|
-
|
|
329
|
+
id,
|
|
330
|
+
reason,
|
|
342
331
|
},
|
|
343
332
|
{ abortEarly: false, allowUnknown: true }
|
|
344
333
|
);
|
|
@@ -347,33 +336,36 @@ class User {
|
|
|
347
336
|
}
|
|
348
337
|
|
|
349
338
|
// Showing warrnings if extra unknown parameters are found
|
|
350
|
-
const { error: warrning } = UserValidator.
|
|
339
|
+
const { error: warrning } = UserValidator.deleteActiveSessions().validate(
|
|
351
340
|
{
|
|
352
|
-
|
|
341
|
+
id,
|
|
342
|
+
reason,
|
|
353
343
|
},
|
|
354
344
|
{ abortEarly: false, allowUnknown: false }
|
|
355
345
|
);
|
|
356
346
|
if (warrning) {
|
|
357
347
|
Logger({
|
|
358
348
|
level: "WARN",
|
|
359
|
-
message: "Parameter Validation warrnings for
|
|
349
|
+
message: "Parameter Validation warrnings for deleteActiveSessions",
|
|
360
350
|
});
|
|
361
351
|
Logger({ level: "WARN", message: warrning });
|
|
362
352
|
}
|
|
363
353
|
|
|
364
354
|
const query_params = {};
|
|
355
|
+
query_params["id"] = id;
|
|
356
|
+
query_params["reason"] = reason;
|
|
365
357
|
|
|
366
358
|
const response = await PlatformAPIClient.execute(
|
|
367
359
|
this.config,
|
|
368
|
-
"
|
|
369
|
-
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/
|
|
360
|
+
"delete",
|
|
361
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/sessions`,
|
|
370
362
|
query_params,
|
|
371
|
-
|
|
363
|
+
undefined
|
|
372
364
|
);
|
|
373
365
|
|
|
374
366
|
const {
|
|
375
367
|
error: res_error,
|
|
376
|
-
} = UserModel.
|
|
368
|
+
} = UserModel.SessionDeleteResponseSchema().validate(response, {
|
|
377
369
|
abortEarly: false,
|
|
378
370
|
allowUnknown: false,
|
|
379
371
|
});
|
|
@@ -381,7 +373,7 @@ class User {
|
|
|
381
373
|
if (res_error) {
|
|
382
374
|
Logger({
|
|
383
375
|
level: "WARN",
|
|
384
|
-
message: "Response Validation Warnnings for
|
|
376
|
+
message: "Response Validation Warnnings for deleteActiveSessions",
|
|
385
377
|
});
|
|
386
378
|
Logger({ level: "WARN", message: res_error });
|
|
387
379
|
}
|
|
@@ -391,17 +383,19 @@ class User {
|
|
|
391
383
|
|
|
392
384
|
/**
|
|
393
385
|
* @param {Object} arg - Arg object.
|
|
394
|
-
* @param {string} arg.
|
|
395
|
-
* @param {
|
|
396
|
-
* @
|
|
397
|
-
* @
|
|
398
|
-
* @
|
|
386
|
+
* @param {string} arg.id - ID of a customer.
|
|
387
|
+
* @param {string} arg.sessionId - Session ID of a customer.
|
|
388
|
+
* @param {string} arg.reason - Reason for deleting session.
|
|
389
|
+
* @returns {Promise<SessionDeleteResponseSchema>} - Success response
|
|
390
|
+
* @summary: Delete a session for a user
|
|
391
|
+
* @description: Use this API to Delete a session of customers who have registered in the application.
|
|
399
392
|
*/
|
|
400
|
-
async
|
|
401
|
-
const { error } = UserValidator.
|
|
393
|
+
async deleteSession({ id, sessionId, reason } = {}) {
|
|
394
|
+
const { error } = UserValidator.deleteSession().validate(
|
|
402
395
|
{
|
|
403
|
-
|
|
404
|
-
|
|
396
|
+
id,
|
|
397
|
+
sessionId,
|
|
398
|
+
reason,
|
|
405
399
|
},
|
|
406
400
|
{ abortEarly: false, allowUnknown: true }
|
|
407
401
|
);
|
|
@@ -410,34 +404,38 @@ class User {
|
|
|
410
404
|
}
|
|
411
405
|
|
|
412
406
|
// Showing warrnings if extra unknown parameters are found
|
|
413
|
-
const { error: warrning } = UserValidator.
|
|
407
|
+
const { error: warrning } = UserValidator.deleteSession().validate(
|
|
414
408
|
{
|
|
415
|
-
|
|
416
|
-
|
|
409
|
+
id,
|
|
410
|
+
sessionId,
|
|
411
|
+
reason,
|
|
417
412
|
},
|
|
418
413
|
{ abortEarly: false, allowUnknown: false }
|
|
419
414
|
);
|
|
420
415
|
if (warrning) {
|
|
421
416
|
Logger({
|
|
422
417
|
level: "WARN",
|
|
423
|
-
message: "Parameter Validation warrnings for
|
|
418
|
+
message: "Parameter Validation warrnings for deleteSession",
|
|
424
419
|
});
|
|
425
420
|
Logger({ level: "WARN", message: warrning });
|
|
426
421
|
}
|
|
427
422
|
|
|
428
423
|
const query_params = {};
|
|
424
|
+
query_params["id"] = id;
|
|
425
|
+
query_params["session_id"] = sessionId;
|
|
426
|
+
query_params["reason"] = reason;
|
|
429
427
|
|
|
430
428
|
const response = await PlatformAPIClient.execute(
|
|
431
429
|
this.config,
|
|
432
|
-
"
|
|
433
|
-
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers
|
|
430
|
+
"delete",
|
|
431
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/session`,
|
|
434
432
|
query_params,
|
|
435
|
-
|
|
433
|
+
undefined
|
|
436
434
|
);
|
|
437
435
|
|
|
438
436
|
const {
|
|
439
437
|
error: res_error,
|
|
440
|
-
} = UserModel.
|
|
438
|
+
} = UserModel.SessionDeleteResponseSchema().validate(response, {
|
|
441
439
|
abortEarly: false,
|
|
442
440
|
allowUnknown: false,
|
|
443
441
|
});
|
|
@@ -445,7 +443,7 @@ class User {
|
|
|
445
443
|
if (res_error) {
|
|
446
444
|
Logger({
|
|
447
445
|
level: "WARN",
|
|
448
|
-
message: "Response Validation Warnnings for
|
|
446
|
+
message: "Response Validation Warnnings for deleteSession",
|
|
449
447
|
});
|
|
450
448
|
Logger({ level: "WARN", message: res_error });
|
|
451
449
|
}
|
|
@@ -455,15 +453,15 @@ class User {
|
|
|
455
453
|
|
|
456
454
|
/**
|
|
457
455
|
* @param {Object} arg - Arg object.
|
|
458
|
-
* @param {
|
|
459
|
-
* @returns {Promise<
|
|
460
|
-
* @summary:
|
|
461
|
-
* @description:
|
|
456
|
+
* @param {string} arg.id - ID of a customer.
|
|
457
|
+
* @returns {Promise<SessionListResponseSchema>} - Success response
|
|
458
|
+
* @summary: Get a list of all session with info for a user
|
|
459
|
+
* @description: Use this API to retrieve a list of session with info of customers who have registered in the application.
|
|
462
460
|
*/
|
|
463
|
-
async
|
|
464
|
-
const { error } = UserValidator.
|
|
461
|
+
async getActiveSessions({ id } = {}) {
|
|
462
|
+
const { error } = UserValidator.getActiveSessions().validate(
|
|
465
463
|
{
|
|
466
|
-
|
|
464
|
+
id,
|
|
467
465
|
},
|
|
468
466
|
{ abortEarly: false, allowUnknown: true }
|
|
469
467
|
);
|
|
@@ -472,33 +470,34 @@ class User {
|
|
|
472
470
|
}
|
|
473
471
|
|
|
474
472
|
// Showing warrnings if extra unknown parameters are found
|
|
475
|
-
const { error: warrning } = UserValidator.
|
|
473
|
+
const { error: warrning } = UserValidator.getActiveSessions().validate(
|
|
476
474
|
{
|
|
477
|
-
|
|
475
|
+
id,
|
|
478
476
|
},
|
|
479
477
|
{ abortEarly: false, allowUnknown: false }
|
|
480
478
|
);
|
|
481
479
|
if (warrning) {
|
|
482
480
|
Logger({
|
|
483
481
|
level: "WARN",
|
|
484
|
-
message: "Parameter Validation warrnings for
|
|
482
|
+
message: "Parameter Validation warrnings for getActiveSessions",
|
|
485
483
|
});
|
|
486
484
|
Logger({ level: "WARN", message: warrning });
|
|
487
485
|
}
|
|
488
486
|
|
|
489
487
|
const query_params = {};
|
|
488
|
+
query_params["id"] = id;
|
|
490
489
|
|
|
491
490
|
const response = await PlatformAPIClient.execute(
|
|
492
491
|
this.config,
|
|
493
|
-
"
|
|
494
|
-
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/
|
|
492
|
+
"get",
|
|
493
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/sessions`,
|
|
495
494
|
query_params,
|
|
496
|
-
|
|
495
|
+
undefined
|
|
497
496
|
);
|
|
498
497
|
|
|
499
498
|
const {
|
|
500
499
|
error: res_error,
|
|
501
|
-
} = UserModel.
|
|
500
|
+
} = UserModel.SessionListResponseSchema().validate(response, {
|
|
502
501
|
abortEarly: false,
|
|
503
502
|
allowUnknown: false,
|
|
504
503
|
});
|
|
@@ -506,7 +505,7 @@ class User {
|
|
|
506
505
|
if (res_error) {
|
|
507
506
|
Logger({
|
|
508
507
|
level: "WARN",
|
|
509
|
-
message: "Response Validation Warnnings for
|
|
508
|
+
message: "Response Validation Warnnings for getActiveSessions",
|
|
510
509
|
});
|
|
511
510
|
Logger({ level: "WARN", message: res_error });
|
|
512
511
|
}
|
|
@@ -516,15 +515,22 @@ class User {
|
|
|
516
515
|
|
|
517
516
|
/**
|
|
518
517
|
* @param {Object} arg - Arg object.
|
|
519
|
-
* @param {
|
|
520
|
-
*
|
|
521
|
-
* @
|
|
522
|
-
*
|
|
518
|
+
* @param {Object} [arg.q] - The search query. Mobile number or email ID of
|
|
519
|
+
* a customer.
|
|
520
|
+
* @param {number} [arg.pageSize] - The number of items to retrieve in each
|
|
521
|
+
* page. Default value is 10.
|
|
522
|
+
* @param {number} [arg.pageNo] - The page number to navigate through the
|
|
523
|
+
* given set of results. Default value is 1.
|
|
524
|
+
* @returns {Promise<CustomerListResponseSchema>} - Success response
|
|
525
|
+
* @summary: Get a list of customers
|
|
526
|
+
* @description: Use this API to retrieve a list of customers who have registered in the application.
|
|
523
527
|
*/
|
|
524
|
-
async
|
|
525
|
-
const { error } = UserValidator.
|
|
528
|
+
async getCustomers({ q, pageSize, pageNo } = {}) {
|
|
529
|
+
const { error } = UserValidator.getCustomers().validate(
|
|
526
530
|
{
|
|
527
|
-
|
|
531
|
+
q,
|
|
532
|
+
pageSize,
|
|
533
|
+
pageNo,
|
|
528
534
|
},
|
|
529
535
|
{ abortEarly: false, allowUnknown: true }
|
|
530
536
|
);
|
|
@@ -533,34 +539,38 @@ class User {
|
|
|
533
539
|
}
|
|
534
540
|
|
|
535
541
|
// Showing warrnings if extra unknown parameters are found
|
|
536
|
-
const { error: warrning } = UserValidator.
|
|
542
|
+
const { error: warrning } = UserValidator.getCustomers().validate(
|
|
537
543
|
{
|
|
538
|
-
|
|
544
|
+
q,
|
|
545
|
+
pageSize,
|
|
546
|
+
pageNo,
|
|
539
547
|
},
|
|
540
548
|
{ abortEarly: false, allowUnknown: false }
|
|
541
549
|
);
|
|
542
550
|
if (warrning) {
|
|
543
551
|
Logger({
|
|
544
552
|
level: "WARN",
|
|
545
|
-
message: "Parameter Validation warrnings for
|
|
553
|
+
message: "Parameter Validation warrnings for getCustomers",
|
|
546
554
|
});
|
|
547
555
|
Logger({ level: "WARN", message: warrning });
|
|
548
556
|
}
|
|
549
557
|
|
|
550
558
|
const query_params = {};
|
|
551
|
-
query_params["
|
|
559
|
+
query_params["q"] = q;
|
|
560
|
+
query_params["page_size"] = pageSize;
|
|
561
|
+
query_params["page_no"] = pageNo;
|
|
552
562
|
|
|
553
563
|
const response = await PlatformAPIClient.execute(
|
|
554
564
|
this.config,
|
|
555
565
|
"get",
|
|
556
|
-
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/
|
|
566
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/list`,
|
|
557
567
|
query_params,
|
|
558
568
|
undefined
|
|
559
569
|
);
|
|
560
570
|
|
|
561
571
|
const {
|
|
562
572
|
error: res_error,
|
|
563
|
-
} = UserModel.
|
|
573
|
+
} = UserModel.CustomerListResponseSchema().validate(response, {
|
|
564
574
|
abortEarly: false,
|
|
565
575
|
allowUnknown: false,
|
|
566
576
|
});
|
|
@@ -568,7 +578,7 @@ class User {
|
|
|
568
578
|
if (res_error) {
|
|
569
579
|
Logger({
|
|
570
580
|
level: "WARN",
|
|
571
|
-
message: "Response Validation Warnnings for
|
|
581
|
+
message: "Response Validation Warnnings for getCustomers",
|
|
572
582
|
});
|
|
573
583
|
Logger({ level: "WARN", message: res_error });
|
|
574
584
|
}
|
|
@@ -578,15 +588,69 @@ class User {
|
|
|
578
588
|
|
|
579
589
|
/**
|
|
580
590
|
* @param {Object} arg - Arg object.
|
|
581
|
-
* @
|
|
582
|
-
* @
|
|
583
|
-
* @
|
|
584
|
-
* @description: Use this API to Delete a list of session of customers who have registered in the application.
|
|
591
|
+
* @returns {Promise<PlatformSchema>} - Success response
|
|
592
|
+
* @summary: Get platform configurations
|
|
593
|
+
* @description: Use this API to get all the platform configurations such as mobile image, desktop image, social logins, and all other text.
|
|
585
594
|
*/
|
|
586
|
-
async
|
|
587
|
-
const { error } = UserValidator.
|
|
595
|
+
async getPlatformConfig({} = {}) {
|
|
596
|
+
const { error } = UserValidator.getPlatformConfig().validate(
|
|
597
|
+
{},
|
|
598
|
+
{ abortEarly: false, allowUnknown: true }
|
|
599
|
+
);
|
|
600
|
+
if (error) {
|
|
601
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
602
|
+
}
|
|
603
|
+
|
|
604
|
+
// Showing warrnings if extra unknown parameters are found
|
|
605
|
+
const { error: warrning } = UserValidator.getPlatformConfig().validate(
|
|
606
|
+
{},
|
|
607
|
+
{ abortEarly: false, allowUnknown: false }
|
|
608
|
+
);
|
|
609
|
+
if (warrning) {
|
|
610
|
+
Logger({
|
|
611
|
+
level: "WARN",
|
|
612
|
+
message: "Parameter Validation warrnings for getPlatformConfig",
|
|
613
|
+
});
|
|
614
|
+
Logger({ level: "WARN", message: warrning });
|
|
615
|
+
}
|
|
616
|
+
|
|
617
|
+
const query_params = {};
|
|
618
|
+
|
|
619
|
+
const response = await PlatformAPIClient.execute(
|
|
620
|
+
this.config,
|
|
621
|
+
"get",
|
|
622
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/platform/config`,
|
|
623
|
+
query_params,
|
|
624
|
+
undefined
|
|
625
|
+
);
|
|
626
|
+
|
|
627
|
+
const { error: res_error } = UserModel.PlatformSchema().validate(response, {
|
|
628
|
+
abortEarly: false,
|
|
629
|
+
allowUnknown: false,
|
|
630
|
+
});
|
|
631
|
+
|
|
632
|
+
if (res_error) {
|
|
633
|
+
Logger({
|
|
634
|
+
level: "WARN",
|
|
635
|
+
message: "Response Validation Warnnings for getPlatformConfig",
|
|
636
|
+
});
|
|
637
|
+
Logger({ level: "WARN", message: res_error });
|
|
638
|
+
}
|
|
639
|
+
|
|
640
|
+
return response;
|
|
641
|
+
}
|
|
642
|
+
|
|
643
|
+
/**
|
|
644
|
+
* @param {Object} arg - Arg object.
|
|
645
|
+
* @param {string} arg.groupId - Numeric ID allotted to a User Group
|
|
646
|
+
* @returns {Promise<UserGroupResponseSchema>} - Success response
|
|
647
|
+
* @summary: Get an User Group by Id
|
|
648
|
+
* @description: Use this API to get details of an existing user Group
|
|
649
|
+
*/
|
|
650
|
+
async getUserGroupById({ groupId } = {}) {
|
|
651
|
+
const { error } = UserValidator.getUserGroupById().validate(
|
|
588
652
|
{
|
|
589
|
-
|
|
653
|
+
groupId,
|
|
590
654
|
},
|
|
591
655
|
{ abortEarly: false, allowUnknown: true }
|
|
592
656
|
);
|
|
@@ -595,34 +659,33 @@ class User {
|
|
|
595
659
|
}
|
|
596
660
|
|
|
597
661
|
// Showing warrnings if extra unknown parameters are found
|
|
598
|
-
const { error: warrning } = UserValidator.
|
|
662
|
+
const { error: warrning } = UserValidator.getUserGroupById().validate(
|
|
599
663
|
{
|
|
600
|
-
|
|
664
|
+
groupId,
|
|
601
665
|
},
|
|
602
666
|
{ abortEarly: false, allowUnknown: false }
|
|
603
667
|
);
|
|
604
668
|
if (warrning) {
|
|
605
669
|
Logger({
|
|
606
670
|
level: "WARN",
|
|
607
|
-
message: "Parameter Validation warrnings for
|
|
671
|
+
message: "Parameter Validation warrnings for getUserGroupById",
|
|
608
672
|
});
|
|
609
673
|
Logger({ level: "WARN", message: warrning });
|
|
610
674
|
}
|
|
611
675
|
|
|
612
676
|
const query_params = {};
|
|
613
|
-
query_params["id"] = id;
|
|
614
677
|
|
|
615
678
|
const response = await PlatformAPIClient.execute(
|
|
616
679
|
this.config,
|
|
617
|
-
"
|
|
618
|
-
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
680
|
+
"get",
|
|
681
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/user_group/${groupId}`,
|
|
619
682
|
query_params,
|
|
620
683
|
undefined
|
|
621
684
|
);
|
|
622
685
|
|
|
623
686
|
const {
|
|
624
687
|
error: res_error,
|
|
625
|
-
} = UserModel.
|
|
688
|
+
} = UserModel.UserGroupResponseSchema().validate(response, {
|
|
626
689
|
abortEarly: false,
|
|
627
690
|
allowUnknown: false,
|
|
628
691
|
});
|
|
@@ -630,7 +693,7 @@ class User {
|
|
|
630
693
|
if (res_error) {
|
|
631
694
|
Logger({
|
|
632
695
|
level: "WARN",
|
|
633
|
-
message: "Response Validation Warnnings for
|
|
696
|
+
message: "Response Validation Warnnings for getUserGroupById",
|
|
634
697
|
});
|
|
635
698
|
Logger({ level: "WARN", message: res_error });
|
|
636
699
|
}
|
|
@@ -640,13 +703,25 @@ class User {
|
|
|
640
703
|
|
|
641
704
|
/**
|
|
642
705
|
* @param {Object} arg - Arg object.
|
|
643
|
-
* @
|
|
644
|
-
* @
|
|
645
|
-
* @
|
|
706
|
+
* @param {string} [arg.pageNo] - Page number for pagination result
|
|
707
|
+
* @param {string} [arg.pageSize] - Page size for pagination result
|
|
708
|
+
* @param {string} [arg.name] - To seartch for User Groups which contains
|
|
709
|
+
* given string in their name
|
|
710
|
+
* @param {string} [arg.status] - To get User Groups with given status
|
|
711
|
+
* @param {number} [arg.groupUid] - To get User Groups with given uid
|
|
712
|
+
* @returns {Promise<UserGroupListResponseSchema>} - Success response
|
|
713
|
+
* @summary: Get User Groups mathcing criteria
|
|
714
|
+
* @description: Use this API to get User Groups mathing criteria passed in query
|
|
646
715
|
*/
|
|
647
|
-
async
|
|
648
|
-
const { error } = UserValidator.
|
|
649
|
-
{
|
|
716
|
+
async getUserGroups({ pageNo, pageSize, name, status, groupUid } = {}) {
|
|
717
|
+
const { error } = UserValidator.getUserGroups().validate(
|
|
718
|
+
{
|
|
719
|
+
pageNo,
|
|
720
|
+
pageSize,
|
|
721
|
+
name,
|
|
722
|
+
status,
|
|
723
|
+
groupUid,
|
|
724
|
+
},
|
|
650
725
|
{ abortEarly: false, allowUnknown: true }
|
|
651
726
|
);
|
|
652
727
|
if (error) {
|
|
@@ -654,29 +729,42 @@ class User {
|
|
|
654
729
|
}
|
|
655
730
|
|
|
656
731
|
// Showing warrnings if extra unknown parameters are found
|
|
657
|
-
const { error: warrning } = UserValidator.
|
|
658
|
-
{
|
|
732
|
+
const { error: warrning } = UserValidator.getUserGroups().validate(
|
|
733
|
+
{
|
|
734
|
+
pageNo,
|
|
735
|
+
pageSize,
|
|
736
|
+
name,
|
|
737
|
+
status,
|
|
738
|
+
groupUid,
|
|
739
|
+
},
|
|
659
740
|
{ abortEarly: false, allowUnknown: false }
|
|
660
741
|
);
|
|
661
742
|
if (warrning) {
|
|
662
743
|
Logger({
|
|
663
744
|
level: "WARN",
|
|
664
|
-
message: "Parameter Validation warrnings for
|
|
745
|
+
message: "Parameter Validation warrnings for getUserGroups",
|
|
665
746
|
});
|
|
666
747
|
Logger({ level: "WARN", message: warrning });
|
|
667
748
|
}
|
|
668
749
|
|
|
669
750
|
const query_params = {};
|
|
751
|
+
query_params["page_no"] = pageNo;
|
|
752
|
+
query_params["page_size"] = pageSize;
|
|
753
|
+
query_params["name"] = name;
|
|
754
|
+
query_params["status"] = status;
|
|
755
|
+
query_params["group_uid"] = groupUid;
|
|
670
756
|
|
|
671
757
|
const response = await PlatformAPIClient.execute(
|
|
672
758
|
this.config,
|
|
673
759
|
"get",
|
|
674
|
-
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
760
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/user_group`,
|
|
675
761
|
query_params,
|
|
676
762
|
undefined
|
|
677
763
|
);
|
|
678
764
|
|
|
679
|
-
const {
|
|
765
|
+
const {
|
|
766
|
+
error: res_error,
|
|
767
|
+
} = UserModel.UserGroupListResponseSchema().validate(response, {
|
|
680
768
|
abortEarly: false,
|
|
681
769
|
allowUnknown: false,
|
|
682
770
|
});
|
|
@@ -684,7 +772,131 @@ class User {
|
|
|
684
772
|
if (res_error) {
|
|
685
773
|
Logger({
|
|
686
774
|
level: "WARN",
|
|
687
|
-
message: "Response Validation Warnnings for
|
|
775
|
+
message: "Response Validation Warnnings for getUserGroups",
|
|
776
|
+
});
|
|
777
|
+
Logger({ level: "WARN", message: res_error });
|
|
778
|
+
}
|
|
779
|
+
|
|
780
|
+
return response;
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
/**
|
|
784
|
+
* @param {Object} arg - Arg object.
|
|
785
|
+
* @param {string} [arg.q] - The search query. Mobile number or email ID of
|
|
786
|
+
* a customer.
|
|
787
|
+
* @returns {Promise<UserSearchResponseSchema>} - Success response
|
|
788
|
+
* @summary: Search an existing user.
|
|
789
|
+
* @description: Use this API to retrieve an existing user from a list.
|
|
790
|
+
*/
|
|
791
|
+
async searchUsers({ q } = {}) {
|
|
792
|
+
const { error } = UserValidator.searchUsers().validate(
|
|
793
|
+
{
|
|
794
|
+
q,
|
|
795
|
+
},
|
|
796
|
+
{ abortEarly: false, allowUnknown: true }
|
|
797
|
+
);
|
|
798
|
+
if (error) {
|
|
799
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
800
|
+
}
|
|
801
|
+
|
|
802
|
+
// Showing warrnings if extra unknown parameters are found
|
|
803
|
+
const { error: warrning } = UserValidator.searchUsers().validate(
|
|
804
|
+
{
|
|
805
|
+
q,
|
|
806
|
+
},
|
|
807
|
+
{ abortEarly: false, allowUnknown: false }
|
|
808
|
+
);
|
|
809
|
+
if (warrning) {
|
|
810
|
+
Logger({
|
|
811
|
+
level: "WARN",
|
|
812
|
+
message: "Parameter Validation warrnings for searchUsers",
|
|
813
|
+
});
|
|
814
|
+
Logger({ level: "WARN", message: warrning });
|
|
815
|
+
}
|
|
816
|
+
|
|
817
|
+
const query_params = {};
|
|
818
|
+
query_params["q"] = q;
|
|
819
|
+
|
|
820
|
+
const response = await PlatformAPIClient.execute(
|
|
821
|
+
this.config,
|
|
822
|
+
"get",
|
|
823
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/search`,
|
|
824
|
+
query_params,
|
|
825
|
+
undefined
|
|
826
|
+
);
|
|
827
|
+
|
|
828
|
+
const {
|
|
829
|
+
error: res_error,
|
|
830
|
+
} = UserModel.UserSearchResponseSchema().validate(response, {
|
|
831
|
+
abortEarly: false,
|
|
832
|
+
allowUnknown: false,
|
|
833
|
+
});
|
|
834
|
+
|
|
835
|
+
if (res_error) {
|
|
836
|
+
Logger({
|
|
837
|
+
level: "WARN",
|
|
838
|
+
message: "Response Validation Warnnings for searchUsers",
|
|
839
|
+
});
|
|
840
|
+
Logger({ level: "WARN", message: res_error });
|
|
841
|
+
}
|
|
842
|
+
|
|
843
|
+
return response;
|
|
844
|
+
}
|
|
845
|
+
|
|
846
|
+
/**
|
|
847
|
+
* @param {Object} arg - Arg object.
|
|
848
|
+
* @param {UnDeleteUserRequestSchema} arg.body
|
|
849
|
+
* @returns {Promise<UnDeleteUserSuccess>} - Success response
|
|
850
|
+
* @summary: undelete user who deleted from application and have not elapsed the platform configured delete days
|
|
851
|
+
* @description: undelete user who deleted from application and have not elapsed the platform configured delete days
|
|
852
|
+
*/
|
|
853
|
+
async unDeleteUser({ body } = {}) {
|
|
854
|
+
const { error } = UserValidator.unDeleteUser().validate(
|
|
855
|
+
{
|
|
856
|
+
body,
|
|
857
|
+
},
|
|
858
|
+
{ abortEarly: false, allowUnknown: true }
|
|
859
|
+
);
|
|
860
|
+
if (error) {
|
|
861
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
862
|
+
}
|
|
863
|
+
|
|
864
|
+
// Showing warrnings if extra unknown parameters are found
|
|
865
|
+
const { error: warrning } = UserValidator.unDeleteUser().validate(
|
|
866
|
+
{
|
|
867
|
+
body,
|
|
868
|
+
},
|
|
869
|
+
{ abortEarly: false, allowUnknown: false }
|
|
870
|
+
);
|
|
871
|
+
if (warrning) {
|
|
872
|
+
Logger({
|
|
873
|
+
level: "WARN",
|
|
874
|
+
message: "Parameter Validation warrnings for unDeleteUser",
|
|
875
|
+
});
|
|
876
|
+
Logger({ level: "WARN", message: warrning });
|
|
877
|
+
}
|
|
878
|
+
|
|
879
|
+
const query_params = {};
|
|
880
|
+
|
|
881
|
+
const response = await PlatformAPIClient.execute(
|
|
882
|
+
this.config,
|
|
883
|
+
"put",
|
|
884
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/undelete`,
|
|
885
|
+
query_params,
|
|
886
|
+
body
|
|
887
|
+
);
|
|
888
|
+
|
|
889
|
+
const {
|
|
890
|
+
error: res_error,
|
|
891
|
+
} = UserModel.UnDeleteUserSuccess().validate(response, {
|
|
892
|
+
abortEarly: false,
|
|
893
|
+
allowUnknown: false,
|
|
894
|
+
});
|
|
895
|
+
|
|
896
|
+
if (res_error) {
|
|
897
|
+
Logger({
|
|
898
|
+
level: "WARN",
|
|
899
|
+
message: "Response Validation Warnnings for unDeleteUser",
|
|
688
900
|
});
|
|
689
901
|
Logger({ level: "WARN", message: res_error });
|
|
690
902
|
}
|
|
@@ -750,5 +962,134 @@ class User {
|
|
|
750
962
|
|
|
751
963
|
return response;
|
|
752
964
|
}
|
|
965
|
+
|
|
966
|
+
/**
|
|
967
|
+
* @param {Object} arg - Arg object.
|
|
968
|
+
* @param {string} arg.userId - User ID
|
|
969
|
+
* @param {UpdateUserRequestSchema} arg.body
|
|
970
|
+
* @returns {Promise<CreateUserResponseSchema>} - Success response
|
|
971
|
+
* @summary: Update user
|
|
972
|
+
* @description: Use this API to update user details, Note: Existing emails and phone numbers of user will be replaced directly if phone_numbers or emails field sent in request data.
|
|
973
|
+
*/
|
|
974
|
+
async updateUser({ userId, body } = {}) {
|
|
975
|
+
const { error } = UserValidator.updateUser().validate(
|
|
976
|
+
{
|
|
977
|
+
userId,
|
|
978
|
+
body,
|
|
979
|
+
},
|
|
980
|
+
{ abortEarly: false, allowUnknown: true }
|
|
981
|
+
);
|
|
982
|
+
if (error) {
|
|
983
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
984
|
+
}
|
|
985
|
+
|
|
986
|
+
// Showing warrnings if extra unknown parameters are found
|
|
987
|
+
const { error: warrning } = UserValidator.updateUser().validate(
|
|
988
|
+
{
|
|
989
|
+
userId,
|
|
990
|
+
body,
|
|
991
|
+
},
|
|
992
|
+
{ abortEarly: false, allowUnknown: false }
|
|
993
|
+
);
|
|
994
|
+
if (warrning) {
|
|
995
|
+
Logger({
|
|
996
|
+
level: "WARN",
|
|
997
|
+
message: "Parameter Validation warrnings for updateUser",
|
|
998
|
+
});
|
|
999
|
+
Logger({ level: "WARN", message: warrning });
|
|
1000
|
+
}
|
|
1001
|
+
|
|
1002
|
+
const query_params = {};
|
|
1003
|
+
|
|
1004
|
+
const response = await PlatformAPIClient.execute(
|
|
1005
|
+
this.config,
|
|
1006
|
+
"put",
|
|
1007
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/customers/${userId}`,
|
|
1008
|
+
query_params,
|
|
1009
|
+
body
|
|
1010
|
+
);
|
|
1011
|
+
|
|
1012
|
+
const {
|
|
1013
|
+
error: res_error,
|
|
1014
|
+
} = UserModel.CreateUserResponseSchema().validate(response, {
|
|
1015
|
+
abortEarly: false,
|
|
1016
|
+
allowUnknown: false,
|
|
1017
|
+
});
|
|
1018
|
+
|
|
1019
|
+
if (res_error) {
|
|
1020
|
+
Logger({
|
|
1021
|
+
level: "WARN",
|
|
1022
|
+
message: "Response Validation Warnnings for updateUser",
|
|
1023
|
+
});
|
|
1024
|
+
Logger({ level: "WARN", message: res_error });
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
return response;
|
|
1028
|
+
}
|
|
1029
|
+
|
|
1030
|
+
/**
|
|
1031
|
+
* @param {Object} arg - Arg object.
|
|
1032
|
+
* @param {string} arg.groupId - Numeric ID allotted to a User Group
|
|
1033
|
+
* @param {UpdateUserGroupSchema} arg.body
|
|
1034
|
+
* @returns {Promise<UserGroupResponseSchema>} - Success response
|
|
1035
|
+
* @summary: Update an User Group
|
|
1036
|
+
* @description: Use this API to update an existing user Group
|
|
1037
|
+
*/
|
|
1038
|
+
async updateUserGroup({ groupId, body } = {}) {
|
|
1039
|
+
const { error } = UserValidator.updateUserGroup().validate(
|
|
1040
|
+
{
|
|
1041
|
+
groupId,
|
|
1042
|
+
body,
|
|
1043
|
+
},
|
|
1044
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1045
|
+
);
|
|
1046
|
+
if (error) {
|
|
1047
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1048
|
+
}
|
|
1049
|
+
|
|
1050
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1051
|
+
const { error: warrning } = UserValidator.updateUserGroup().validate(
|
|
1052
|
+
{
|
|
1053
|
+
groupId,
|
|
1054
|
+
body,
|
|
1055
|
+
},
|
|
1056
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1057
|
+
);
|
|
1058
|
+
if (warrning) {
|
|
1059
|
+
Logger({
|
|
1060
|
+
level: "WARN",
|
|
1061
|
+
message: "Parameter Validation warrnings for updateUserGroup",
|
|
1062
|
+
});
|
|
1063
|
+
Logger({ level: "WARN", message: warrning });
|
|
1064
|
+
}
|
|
1065
|
+
|
|
1066
|
+
const query_params = {};
|
|
1067
|
+
|
|
1068
|
+
const response = await PlatformAPIClient.execute(
|
|
1069
|
+
this.config,
|
|
1070
|
+
"put",
|
|
1071
|
+
`/service/platform/user/v1.0/company/${this.config.companyId}/application/${this.applicationId}/user_group/${groupId}`,
|
|
1072
|
+
query_params,
|
|
1073
|
+
body
|
|
1074
|
+
);
|
|
1075
|
+
|
|
1076
|
+
const {
|
|
1077
|
+
error: res_error,
|
|
1078
|
+
} = UserModel.UserGroupResponseSchema().validate(response, {
|
|
1079
|
+
abortEarly: false,
|
|
1080
|
+
allowUnknown: false,
|
|
1081
|
+
});
|
|
1082
|
+
|
|
1083
|
+
if (res_error) {
|
|
1084
|
+
Logger({
|
|
1085
|
+
level: "WARN",
|
|
1086
|
+
message: "Response Validation Warnnings for updateUserGroup",
|
|
1087
|
+
});
|
|
1088
|
+
Logger({ level: "WARN", message: res_error });
|
|
1089
|
+
}
|
|
1090
|
+
|
|
1091
|
+
return response;
|
|
1092
|
+
}
|
|
753
1093
|
}
|
|
1094
|
+
|
|
754
1095
|
module.exports = User;
|