@gofynd/fdk-client-javascript 1.0.3 → 1.1.0
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 +51 -2
- package/index.d.ts +7 -4
- package/index.js +22 -7
- package/package.json +23 -14
- package/partner.d.ts +4 -0
- package/partner.js +7 -0
- package/sdk/application/ApplicationAPIClient.js +2 -4
- package/sdk/application/Cart/CartApplicationClient.js +29 -28
- package/sdk/application/Cart/CartApplicationModel.js +3 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +43 -42
- package/sdk/application/Catalog/CatalogApplicationModel.js +5 -3
- package/sdk/application/Common/CommonApplicationClient.js +5 -4
- package/sdk/application/Communication/CommunicationApplicationClient.js +6 -5
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +21 -20
- package/sdk/application/Content/ContentApplicationClient.js +26 -25
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +6 -5
- package/sdk/application/Lead/LeadApplicationClient.js +10 -9
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +1 -3
- package/sdk/application/Logistic/LogisticApplicationClient.js +11 -12
- package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -1
- package/sdk/application/Order/OrderApplicationClient.js +15 -14
- package/sdk/application/Order/OrderApplicationModel.js +9 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +42 -41
- package/sdk/application/PosCart/PosCartApplicationClient.js +30 -29
- package/sdk/application/PosCart/PosCartApplicationModel.js +3 -1
- package/sdk/application/Rewards/RewardsApplicationClient.js +11 -10
- package/sdk/application/Share/ShareApplicationClient.js +10 -9
- package/sdk/application/Theme/ThemeApplicationClient.js +7 -6
- package/sdk/application/User/UserApplicationClient.js +38 -37
- package/sdk/common/AxiosHelper.js +17 -6
- package/sdk/common/BaseOAuthClient.d.ts +17 -0
- package/sdk/common/BaseOAuthClient.js +67 -0
- package/sdk/common/RequestSigner.js +0 -5
- package/sdk/partner/OAuthClient.d.ts +14 -0
- package/sdk/partner/OAuthClient.js +112 -0
- package/sdk/partner/PartnerAPIClient.d.ts +12 -0
- package/sdk/partner/PartnerAPIClient.js +42 -0
- package/sdk/partner/PartnerClient.d.ts +6 -0
- package/sdk/partner/PartnerClient.js +17 -0
- package/sdk/partner/PartnerConfig.d.ts +30 -0
- package/sdk/partner/PartnerConfig.js +39 -0
- package/sdk/partner/index.d.ts +3 -0
- package/sdk/partner/index.js +5 -0
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +3 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +5 -4
- package/sdk/platform/Analytics/AnalyticsPlatformValidator.js +1 -0
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +3 -2
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +1 -0
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -0
- package/sdk/platform/Billing/BillingPlatformClient.js +137 -2
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +4 -0
- package/sdk/platform/Billing/BillingPlatformModel.js +44 -0
- package/sdk/platform/Billing/BillingPlatformValidator.d.ts +2 -0
- package/sdk/platform/Billing/BillingPlatformValidator.js +15 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +27 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +177 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +3 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +17 -1
- package/sdk/platform/Cart/CartPlatformModel.js +7 -3
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +3 -1
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +2 -2
- package/sdk/platform/Catalog/CatalogPlatformClient.js +6 -9
- package/sdk/platform/Catalog/CatalogPlatformModel.js +9 -9
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +2 -1
- package/sdk/platform/Common/CommonPlatformClient.js +7 -18
- package/sdk/platform/Common/CommonPlatformValidator.js +1 -0
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +3 -1
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +4 -3
- package/sdk/platform/Communication/CommunicationPlatformValidator.js +1 -0
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +5 -4
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +1 -0
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +3 -1
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +9 -8
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +3 -1
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Discount/DiscountPlatformClient.js +3 -2
- package/sdk/platform/Discount/DiscountPlatformValidator.js +1 -0
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +3 -3
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +27 -5
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +3 -3
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +28 -6
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +1 -0
- package/sdk/platform/Inventory/InventoryPlatformClient.js +3 -2
- package/sdk/platform/Inventory/InventoryPlatformValidator.js +1 -0
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +3 -1
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Lead/LeadPlatformClient.js +4 -3
- package/sdk/platform/Lead/LeadPlatformValidator.js +1 -0
- package/sdk/platform/OAuthClient.js +3 -9
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +3 -1
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Order/OrderPlatformClient.d.ts +1 -1
- package/sdk/platform/Order/OrderPlatformClient.js +16 -3
- package/sdk/platform/Order/OrderPlatformModel.js +1 -0
- package/sdk/platform/Order/OrderPlatformValidator.js +1 -0
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +3 -1
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +1 -1
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +14 -14
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Payment/PaymentPlatformClient.js +3 -2
- package/sdk/platform/Payment/PaymentPlatformValidator.js +1 -0
- package/sdk/platform/PlatformApplicationClient.d.ts +5 -1
- package/sdk/platform/PlatformApplicationClient.js +4 -0
- package/sdk/platform/PlatformClient.d.ts +51 -12
- package/sdk/platform/PlatformClient.js +54 -11
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +17 -19
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +88 -83
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +8 -9
- package/sdk/platform/Share/SharePlatformApplicationClient.js +3 -1
- package/sdk/platform/Share/SharePlatformApplicationValidator.js +1 -1
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +3 -1
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +1 -1
- package/sdk/platform/User/UserPlatformApplicationClient.js +3 -1
- package/sdk/platform/User/UserPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Webhook/WebhookPlatformClient.js +3 -2
- package/sdk/platform/Webhook/WebhookPlatformValidator.js +1 -0
- package/sdk/public/Configuration/ConfigurationPublicClient.js +2 -0
- package/sdk/public/Inventory/InventoryPublicClient.js +2 -0
- package/sdk/public/Webhook/WebhookPublicClient.js +2 -0
- 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 -8771
- package/documentation/application/CATALOG.md +0 -8690
- package/documentation/application/COMMON.md +0 -325
- package/documentation/application/COMMUNICATION.md +0 -387
- package/documentation/application/CONFIGURATION.md +0 -2212
- package/documentation/application/CONTENT.md +0 -2629
- package/documentation/application/FILESTORAGE.md +0 -442
- package/documentation/application/LEAD.md +0 -1549
- package/documentation/application/LOGISTIC.md +0 -689
- package/documentation/application/ORDER.md +0 -2937
- package/documentation/application/PAYMENT.md +0 -4475
- package/documentation/application/POSCART.md +0 -9375
- package/documentation/application/README.md +0 -21
- package/documentation/application/REWARDS.md +0 -554
- package/documentation/application/SHARE.md +0 -635
- package/documentation/application/THEME.md +0 -5517
- package/documentation/application/USER.md +0 -3798
- package/documentation/platform/ANALYTICS.md +0 -1012
- package/documentation/platform/AUDITTRAIL.md +0 -493
- package/documentation/platform/BILLING.md +0 -1889
- package/documentation/platform/CART.md +0 -4711
- package/documentation/platform/CATALOG.md +0 -20522
- package/documentation/platform/COMMON.md +0 -325
- package/documentation/platform/COMMUNICATION.md +0 -4970
- package/documentation/platform/COMPANYPROFILE.md +0 -1646
- package/documentation/platform/CONFIGURATION.md +0 -6316
- package/documentation/platform/CONTENT.md +0 -8364
- package/documentation/platform/DISCOUNT.md +0 -767
- package/documentation/platform/FILESTORAGE.md +0 -945
- package/documentation/platform/INVENTORY.md +0 -1136
- package/documentation/platform/LEAD.md +0 -4394
- package/documentation/platform/ORDER.md +0 -6525
- package/documentation/platform/PARTNER.md +0 -193
- package/documentation/platform/PAYMENT.md +0 -3138
- package/documentation/platform/README.md +0 -27
- package/documentation/platform/REWARDS.md +0 -919
- package/documentation/platform/SHARE.md +0 -513
- package/documentation/platform/THEME.md +0 -35446
- package/documentation/platform/USER.md +0 -2174
- package/documentation/platform/WEBHOOK.md +0 -485
- package/documentation/public/CONFIGURATION.md +0 -325
- package/documentation/public/INVENTORY.md +0 -508
- package/documentation/public/WEBHOOK.md +0 -246
- package/jest.config.d.ts +0 -4
- package/jest.config.js +0 -6
- package/tests/application/catalog.spec.js +0 -54
- 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
|
@@ -2263,6 +2263,18 @@ class PlatformClient {
|
|
|
2263
2263
|
* @property {number} [discount_amount]
|
|
2264
2264
|
* @property {boolean} [is_valid]
|
|
2265
2265
|
*/
|
|
2266
|
+
/**
|
|
2267
|
+
* @typedef CreateOneTimeCharge
|
|
2268
|
+
* @property {OneTimeChargeItem} charge
|
|
2269
|
+
* @property {boolean} [is_test]
|
|
2270
|
+
* @property {string} name
|
|
2271
|
+
* @property {string} return_url
|
|
2272
|
+
*/
|
|
2273
|
+
/**
|
|
2274
|
+
* @typedef CreateOneTimeChargeResponse
|
|
2275
|
+
* @property {OneTimeChargeEntity} [charge]
|
|
2276
|
+
* @property {string} [confirm_url]
|
|
2277
|
+
*/
|
|
2266
2278
|
/**
|
|
2267
2279
|
* @typedef CreateSubscriptionCharge
|
|
2268
2280
|
* @property {boolean} [is_test]
|
|
@@ -2535,6 +2547,33 @@ class PlatformClient {
|
|
|
2535
2547
|
* @property {string} [end]
|
|
2536
2548
|
* @property {string} [start]
|
|
2537
2549
|
*/
|
|
2550
|
+
/**
|
|
2551
|
+
* @typedef OneTimeChargeEntity
|
|
2552
|
+
* @property {string} [_id]
|
|
2553
|
+
* @property {string} [activated_on]
|
|
2554
|
+
* @property {string} [cancelled_on]
|
|
2555
|
+
* @property {string} [entity_id]
|
|
2556
|
+
* @property {string} [entity_type]
|
|
2557
|
+
* @property {boolean} [is_test]
|
|
2558
|
+
* @property {Object} [meta]
|
|
2559
|
+
* @property {Object} [metadata]
|
|
2560
|
+
* @property {string} [name]
|
|
2561
|
+
* @property {EntityChargePrice} [price]
|
|
2562
|
+
* @property {string} [pricing_type]
|
|
2563
|
+
* @property {string} [return_url]
|
|
2564
|
+
* @property {string} [status]
|
|
2565
|
+
* @property {string} [subscriber_id]
|
|
2566
|
+
*/
|
|
2567
|
+
/**
|
|
2568
|
+
* @typedef OneTimeChargeItem
|
|
2569
|
+
* @property {number} [capped_amount]
|
|
2570
|
+
* @property {boolean} [is_test]
|
|
2571
|
+
* @property {Object} [metadata]
|
|
2572
|
+
* @property {string} name
|
|
2573
|
+
* @property {EntityChargePrice} price
|
|
2574
|
+
* @property {string} pricing_type
|
|
2575
|
+
* @property {string} [term]
|
|
2576
|
+
*/
|
|
2538
2577
|
/**
|
|
2539
2578
|
* @typedef Page
|
|
2540
2579
|
* @property {number} [current]
|
|
@@ -2723,6 +2762,7 @@ class PlatformClient {
|
|
|
2723
2762
|
/**
|
|
2724
2763
|
* @typedef SubscriptionStatus
|
|
2725
2764
|
* @property {boolean} [is_enabled]
|
|
2765
|
+
* @property {number} [mandate_amount]
|
|
2726
2766
|
* @property {Subscription} [subscription]
|
|
2727
2767
|
*/
|
|
2728
2768
|
/**
|
|
@@ -3929,6 +3969,7 @@ class PlatformClient {
|
|
|
3929
3969
|
* @property {number} [employee_discount]
|
|
3930
3970
|
* @property {boolean} [is_priority]
|
|
3931
3971
|
* @property {number} [loyalty_discount]
|
|
3972
|
+
* @property {string} [marketplace_invoice_id]
|
|
3932
3973
|
* @property {string} [order_item_id]
|
|
3933
3974
|
* @property {number} [quantity]
|
|
3934
3975
|
* @property {number} [size_level_total_qty]
|
|
@@ -6839,15 +6880,15 @@ class PlatformClient {
|
|
|
6839
6880
|
* @property {GetAddressSerializer[]} [addresses]
|
|
6840
6881
|
* @property {string} [business_type]
|
|
6841
6882
|
* @property {string} [company_type]
|
|
6842
|
-
* @property {
|
|
6883
|
+
* @property {UserSerializer2} [created_by]
|
|
6843
6884
|
* @property {string} [created_on]
|
|
6844
|
-
* @property {
|
|
6885
|
+
* @property {UserSerializer2} [modified_by]
|
|
6845
6886
|
* @property {string} [modified_on]
|
|
6846
6887
|
* @property {string} [name]
|
|
6847
6888
|
* @property {string} [reject_reason]
|
|
6848
6889
|
* @property {string} [stage]
|
|
6849
6890
|
* @property {number} [uid]
|
|
6850
|
-
* @property {
|
|
6891
|
+
* @property {UserSerializer2} [verified_by]
|
|
6851
6892
|
* @property {string} [verified_on]
|
|
6852
6893
|
*/
|
|
6853
6894
|
/**
|
|
@@ -6924,14 +6965,14 @@ class PlatformClient {
|
|
|
6924
6965
|
* @property {string} code
|
|
6925
6966
|
* @property {GetCompanySerializer} [company]
|
|
6926
6967
|
* @property {SellerPhoneNumber[]} [contact_numbers]
|
|
6927
|
-
* @property {
|
|
6968
|
+
* @property {UserSerializer1} [created_by]
|
|
6928
6969
|
* @property {string} [created_on]
|
|
6929
6970
|
* @property {string} display_name
|
|
6930
6971
|
* @property {Document[]} [documents]
|
|
6931
6972
|
* @property {InvoiceDetailsSerializer} [gst_credentials]
|
|
6932
6973
|
* @property {LocationIntegrationType} [integration_type]
|
|
6933
6974
|
* @property {LocationManagerSerializer} [manager]
|
|
6934
|
-
* @property {
|
|
6975
|
+
* @property {UserSerializer1} [modified_by]
|
|
6935
6976
|
* @property {string} [modified_on]
|
|
6936
6977
|
* @property {string} name
|
|
6937
6978
|
* @property {string[]} [notification_emails]
|
|
@@ -6941,7 +6982,7 @@ class PlatformClient {
|
|
|
6941
6982
|
* @property {string} [store_type]
|
|
6942
6983
|
* @property {LocationDayWiseSerializer[]} [timing]
|
|
6943
6984
|
* @property {number} [uid]
|
|
6944
|
-
* @property {
|
|
6985
|
+
* @property {UserSerializer1} [verified_by]
|
|
6945
6986
|
* @property {string} [verified_on]
|
|
6946
6987
|
* @property {Object} [warnings]
|
|
6947
6988
|
*/
|
|
@@ -7838,7 +7879,7 @@ class PlatformClient {
|
|
|
7838
7879
|
* @property {NetQuantity} [net_quantity]
|
|
7839
7880
|
* @property {number} [no_of_boxes]
|
|
7840
7881
|
* @property {string[]} [product_group_tag]
|
|
7841
|
-
* @property {
|
|
7882
|
+
* @property {ProductPublish1} [product_publish]
|
|
7842
7883
|
* @property {string} [requester]
|
|
7843
7884
|
* @property {ReturnConfig} return_config
|
|
7844
7885
|
* @property {string} [short_description]
|
|
@@ -8034,7 +8075,7 @@ class PlatformClient {
|
|
|
8034
8075
|
* @property {string} [pending]
|
|
8035
8076
|
* @property {string} [primary_color]
|
|
8036
8077
|
* @property {string[]} [product_group_tag]
|
|
8037
|
-
* @property {
|
|
8078
|
+
* @property {ProductPublish} [product_publish]
|
|
8038
8079
|
* @property {ReturnConfigResponse} [return_config]
|
|
8039
8080
|
* @property {string} [short_description]
|
|
8040
8081
|
* @property {string} [size_guide]
|
|
@@ -11116,7 +11157,7 @@ class PlatformClient {
|
|
|
11116
11157
|
* @property {Object} [extra_meta]
|
|
11117
11158
|
* @property {number} [item_id]
|
|
11118
11159
|
* @property {string} [item_size]
|
|
11119
|
-
* @property {Object} [parent_item_identifiers]
|
|
11160
|
+
* @property {Object[]} [parent_item_identifiers]
|
|
11120
11161
|
* @property {boolean} [pos]
|
|
11121
11162
|
* @property {string[]} [product_group_tags]
|
|
11122
11163
|
* @property {number} [quantity]
|
|
@@ -11427,7 +11468,7 @@ class PlatformClient {
|
|
|
11427
11468
|
*/
|
|
11428
11469
|
/**
|
|
11429
11470
|
* @typedef OpenapiCartDetailsRequest
|
|
11430
|
-
* @property {CartItem}
|
|
11471
|
+
* @property {CartItem[]} cart_items
|
|
11431
11472
|
*/
|
|
11432
11473
|
/**
|
|
11433
11474
|
* @typedef OpenapiCartDetailsResponse
|
|
@@ -11438,7 +11479,7 @@ class PlatformClient {
|
|
|
11438
11479
|
*/
|
|
11439
11480
|
/**
|
|
11440
11481
|
* @typedef OpenApiCartServiceabilityRequest
|
|
11441
|
-
* @property {CartItem}
|
|
11482
|
+
* @property {CartItem[]} cart_items
|
|
11442
11483
|
* @property {ShippingAddress} shipping_address
|
|
11443
11484
|
*/
|
|
11444
11485
|
/**
|
|
@@ -11830,6 +11871,8 @@ class PlatformClient {
|
|
|
11830
11871
|
* @property {string} [city]
|
|
11831
11872
|
* @property {string} [country]
|
|
11832
11873
|
* @property {string} [country_code]
|
|
11874
|
+
* @property {string} [country_iso_code]
|
|
11875
|
+
* @property {string} [country_phone_code]
|
|
11833
11876
|
* @property {string} [email]
|
|
11834
11877
|
* @property {string} [landmark]
|
|
11835
11878
|
* @property {Object} [meta]
|
|
@@ -5,12 +5,14 @@ declare class Rewards {
|
|
|
5
5
|
applicationId: any;
|
|
6
6
|
/**
|
|
7
7
|
* @param {Object} arg - Arg object.
|
|
8
|
+
* @param {string} arg.id - Giveaway ID
|
|
8
9
|
* @param {string} arg.audienceId - Audience id
|
|
9
10
|
* @returns {Promise<GiveawayAudience>} - Success response
|
|
10
11
|
* @summary: Get the Giveaway audience status
|
|
11
12
|
* @description: Get giveaway audience status
|
|
12
13
|
*/
|
|
13
|
-
getGiveawayAudienceStatus({ audienceId }?: {
|
|
14
|
+
getGiveawayAudienceStatus({ id, audienceId }?: {
|
|
15
|
+
id: string;
|
|
14
16
|
audienceId: string;
|
|
15
17
|
}): Promise<GiveawayAudience>;
|
|
16
18
|
/**
|
|
@@ -26,16 +28,12 @@ declare class Rewards {
|
|
|
26
28
|
/**
|
|
27
29
|
* @param {Object} arg - Arg object.
|
|
28
30
|
* @param {string} arg.name - The name given to the offer.
|
|
29
|
-
* @param {string} arg.cookie - User's session cookie. This cookie is set in
|
|
30
|
-
* browser cookie when logged-in to fynd's authentication system i.e.
|
|
31
|
-
* `Grimlock` or by using grimlock-backend SDK for backend implementation.
|
|
32
31
|
* @returns {Promise<Offer>} - Success response
|
|
33
32
|
* @summary: Get offer by name
|
|
34
33
|
* @description: Use this API to get the offer details and configuration by entering the name of the offer.
|
|
35
34
|
*/
|
|
36
|
-
getOfferByName({ name
|
|
35
|
+
getOfferByName({ name }?: {
|
|
37
36
|
name: string;
|
|
38
|
-
cookie: string;
|
|
39
37
|
}): Promise<Offer>;
|
|
40
38
|
/**
|
|
41
39
|
* @param {Object} arg - Arg object.
|
|
@@ -44,6 +42,16 @@ declare class Rewards {
|
|
|
44
42
|
* @description: Use this API to get a list of valid android paths required by the Rewards INIT API to validate a fradualent device.
|
|
45
43
|
*/
|
|
46
44
|
getRewardsConfiguration({}?: any): Promise<ConfigurationRes>;
|
|
45
|
+
/**
|
|
46
|
+
* @param {Object} arg - Arg object.
|
|
47
|
+
* @param {string} arg.userId - User id
|
|
48
|
+
* @returns {Promise<UserRes>} - Success response
|
|
49
|
+
* @summary: Get user reward details
|
|
50
|
+
* @description: Use this API to get the user reward details
|
|
51
|
+
*/
|
|
52
|
+
getUserDetails({ userId }?: {
|
|
53
|
+
userId: string;
|
|
54
|
+
}): Promise<UserRes>;
|
|
47
55
|
/**
|
|
48
56
|
* @param {Object} arg - Arg object.
|
|
49
57
|
* @param {string} arg.userId - User id
|
|
@@ -54,7 +62,7 @@ declare class Rewards {
|
|
|
54
62
|
* @summary: Get all transactions of reward points
|
|
55
63
|
* @description: Use this API to get a list of points transactions.
|
|
56
64
|
*/
|
|
57
|
-
getUserPointsHistory({ userId, pageId, pageSize }?: {
|
|
65
|
+
getUserPointsHistory({ userId, pageId, pageSize, }?: {
|
|
58
66
|
userId: string;
|
|
59
67
|
pageId?: string;
|
|
60
68
|
pageSize?: number;
|
|
@@ -133,7 +141,7 @@ declare class Rewards {
|
|
|
133
141
|
* @summary: Update offer by name
|
|
134
142
|
* @description: Use this API to update the offer details
|
|
135
143
|
*/
|
|
136
|
-
updateOfferByName({ name, body }?: {
|
|
144
|
+
updateOfferByName({ name, body, }?: {
|
|
137
145
|
name: string;
|
|
138
146
|
body: Offer;
|
|
139
147
|
}): Promise<Offer>;
|
|
@@ -145,19 +153,9 @@ declare class Rewards {
|
|
|
145
153
|
* @summary: Update user status
|
|
146
154
|
* @description: Use this API to update the user status active/archive
|
|
147
155
|
*/
|
|
148
|
-
updateUserStatus({ userId, body }?: {
|
|
156
|
+
updateUserStatus({ userId, body, }?: {
|
|
149
157
|
userId: string;
|
|
150
158
|
body: AppUser;
|
|
151
159
|
}): Promise<AppUser>;
|
|
152
|
-
/**
|
|
153
|
-
* @param {Object} arg - Arg object.
|
|
154
|
-
* @param {string} arg.userId - User id
|
|
155
|
-
* @returns {Promise<UserRes>} - Success response
|
|
156
|
-
* @summary: Get user reward details
|
|
157
|
-
* @description: Use this API to get the user reward details
|
|
158
|
-
*/
|
|
159
|
-
user({ userId }?: {
|
|
160
|
-
userId: string;
|
|
161
|
-
}): Promise<UserRes>;
|
|
162
160
|
}
|
|
163
161
|
import Paginator = require("../../common/Paginator");
|
|
@@ -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 RewardsValidator = require("./RewardsPlatformApplicationValidator");
|
|
5
5
|
const RewardsModel = require("./RewardsPlatformModel");
|
|
6
6
|
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
const Joi = require("joi");
|
|
7
8
|
|
|
8
9
|
class Rewards {
|
|
9
10
|
constructor(config, applicationId) {
|
|
@@ -13,16 +14,15 @@ class Rewards {
|
|
|
13
14
|
|
|
14
15
|
/**
|
|
15
16
|
* @param {Object} arg - Arg object.
|
|
17
|
+
* @param {string} arg.id - Giveaway ID
|
|
16
18
|
* @param {string} arg.audienceId - Audience id
|
|
17
19
|
* @returns {Promise<GiveawayAudience>} - Success response
|
|
18
20
|
* @summary: Get the Giveaway audience status
|
|
19
21
|
* @description: Get giveaway audience status
|
|
20
22
|
*/
|
|
21
|
-
async getGiveawayAudienceStatus({ audienceId } = {}) {
|
|
23
|
+
async getGiveawayAudienceStatus({ id, audienceId } = {}) {
|
|
22
24
|
const { error } = RewardsValidator.getGiveawayAudienceStatus().validate(
|
|
23
|
-
{
|
|
24
|
-
audienceId,
|
|
25
|
-
},
|
|
25
|
+
{ id, audienceId },
|
|
26
26
|
{ abortEarly: false, allowUnknown: true }
|
|
27
27
|
);
|
|
28
28
|
if (error) {
|
|
@@ -33,9 +33,7 @@ class Rewards {
|
|
|
33
33
|
const {
|
|
34
34
|
error: warrning,
|
|
35
35
|
} = RewardsValidator.getGiveawayAudienceStatus().validate(
|
|
36
|
-
{
|
|
37
|
-
audienceId,
|
|
38
|
-
},
|
|
36
|
+
{ id, audienceId },
|
|
39
37
|
{ abortEarly: false, allowUnknown: false }
|
|
40
38
|
);
|
|
41
39
|
if (warrning) {
|
|
@@ -51,7 +49,7 @@ class Rewards {
|
|
|
51
49
|
const response = await PlatformAPIClient.execute(
|
|
52
50
|
this.config,
|
|
53
51
|
"get",
|
|
54
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/audience/${audienceId}/status`,
|
|
52
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/giveaways/:id/audience/${audienceId}/status`,
|
|
55
53
|
query_params,
|
|
56
54
|
undefined
|
|
57
55
|
);
|
|
@@ -136,19 +134,13 @@ class Rewards {
|
|
|
136
134
|
/**
|
|
137
135
|
* @param {Object} arg - Arg object.
|
|
138
136
|
* @param {string} arg.name - The name given to the offer.
|
|
139
|
-
* @param {string} arg.cookie - User's session cookie. This cookie is set in
|
|
140
|
-
* browser cookie when logged-in to fynd's authentication system i.e.
|
|
141
|
-
* `Grimlock` or by using grimlock-backend SDK for backend implementation.
|
|
142
137
|
* @returns {Promise<Offer>} - Success response
|
|
143
138
|
* @summary: Get offer by name
|
|
144
139
|
* @description: Use this API to get the offer details and configuration by entering the name of the offer.
|
|
145
140
|
*/
|
|
146
|
-
async getOfferByName({ name
|
|
141
|
+
async getOfferByName({ name } = {}) {
|
|
147
142
|
const { error } = RewardsValidator.getOfferByName().validate(
|
|
148
|
-
{
|
|
149
|
-
name,
|
|
150
|
-
cookie,
|
|
151
|
-
},
|
|
143
|
+
{ name },
|
|
152
144
|
{ abortEarly: false, allowUnknown: true }
|
|
153
145
|
);
|
|
154
146
|
if (error) {
|
|
@@ -157,10 +149,7 @@ class Rewards {
|
|
|
157
149
|
|
|
158
150
|
// Showing warrnings if extra unknown parameters are found
|
|
159
151
|
const { error: warrning } = RewardsValidator.getOfferByName().validate(
|
|
160
|
-
{
|
|
161
|
-
name,
|
|
162
|
-
cookie,
|
|
163
|
-
},
|
|
152
|
+
{ name },
|
|
164
153
|
{ abortEarly: false, allowUnknown: false }
|
|
165
154
|
);
|
|
166
155
|
if (warrning) {
|
|
@@ -255,6 +244,61 @@ class Rewards {
|
|
|
255
244
|
return response;
|
|
256
245
|
}
|
|
257
246
|
|
|
247
|
+
/**
|
|
248
|
+
* @param {Object} arg - Arg object.
|
|
249
|
+
* @param {string} arg.userId - User id
|
|
250
|
+
* @returns {Promise<UserRes>} - Success response
|
|
251
|
+
* @summary: Get user reward details
|
|
252
|
+
* @description: Use this API to get the user reward details
|
|
253
|
+
*/
|
|
254
|
+
async getUserDetails({ userId } = {}) {
|
|
255
|
+
const { error } = RewardsValidator.getUserDetails().validate(
|
|
256
|
+
{ userId },
|
|
257
|
+
{ abortEarly: false, allowUnknown: true }
|
|
258
|
+
);
|
|
259
|
+
if (error) {
|
|
260
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
// Showing warrnings if extra unknown parameters are found
|
|
264
|
+
const { error: warrning } = RewardsValidator.getUserDetails().validate(
|
|
265
|
+
{ userId },
|
|
266
|
+
{ abortEarly: false, allowUnknown: false }
|
|
267
|
+
);
|
|
268
|
+
if (warrning) {
|
|
269
|
+
Logger({
|
|
270
|
+
level: "WARN",
|
|
271
|
+
message: "Parameter Validation warrnings for getUserDetails",
|
|
272
|
+
});
|
|
273
|
+
Logger({ level: "WARN", message: warrning });
|
|
274
|
+
}
|
|
275
|
+
|
|
276
|
+
const query_params = {};
|
|
277
|
+
|
|
278
|
+
const response = await PlatformAPIClient.execute(
|
|
279
|
+
this.config,
|
|
280
|
+
"get",
|
|
281
|
+
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/`,
|
|
282
|
+
query_params,
|
|
283
|
+
undefined
|
|
284
|
+
);
|
|
285
|
+
|
|
286
|
+
const { error: res_error } = RewardsModel.UserRes().validate(response, {
|
|
287
|
+
abortEarly: false,
|
|
288
|
+
allowUnknown: false,
|
|
289
|
+
});
|
|
290
|
+
|
|
291
|
+
if (res_error) {
|
|
292
|
+
Logger({
|
|
293
|
+
level: "WARN",
|
|
294
|
+
message: "Response Validation Warnnings for getUserDetails",
|
|
295
|
+
});
|
|
296
|
+
Logger({ level: "WARN", message: res_error });
|
|
297
|
+
}
|
|
298
|
+
|
|
299
|
+
return response;
|
|
300
|
+
}
|
|
301
|
+
|
|
258
302
|
/**
|
|
259
303
|
* @param {Object} arg - Arg object.
|
|
260
304
|
* @param {string} arg.userId - User id
|
|
@@ -265,10 +309,16 @@ class Rewards {
|
|
|
265
309
|
* @summary: Get all transactions of reward points
|
|
266
310
|
* @description: Use this API to get a list of points transactions.
|
|
267
311
|
*/
|
|
268
|
-
async getUserPointsHistory({
|
|
312
|
+
async getUserPointsHistory({
|
|
313
|
+
userId,
|
|
314
|
+
|
|
315
|
+
pageId,
|
|
316
|
+
pageSize,
|
|
317
|
+
} = {}) {
|
|
269
318
|
const { error } = RewardsValidator.getUserPointsHistory().validate(
|
|
270
319
|
{
|
|
271
320
|
userId,
|
|
321
|
+
|
|
272
322
|
pageId,
|
|
273
323
|
pageSize,
|
|
274
324
|
},
|
|
@@ -284,6 +334,7 @@ class Rewards {
|
|
|
284
334
|
} = RewardsValidator.getUserPointsHistory().validate(
|
|
285
335
|
{
|
|
286
336
|
userId,
|
|
337
|
+
|
|
287
338
|
pageId,
|
|
288
339
|
pageSize,
|
|
289
340
|
},
|
|
@@ -673,10 +724,15 @@ class Rewards {
|
|
|
673
724
|
* @summary: Update offer by name
|
|
674
725
|
* @description: Use this API to update the offer details
|
|
675
726
|
*/
|
|
676
|
-
async updateOfferByName({
|
|
727
|
+
async updateOfferByName({
|
|
728
|
+
name,
|
|
729
|
+
|
|
730
|
+
body,
|
|
731
|
+
} = {}) {
|
|
677
732
|
const { error } = RewardsValidator.updateOfferByName().validate(
|
|
678
733
|
{
|
|
679
734
|
name,
|
|
735
|
+
|
|
680
736
|
body,
|
|
681
737
|
},
|
|
682
738
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -689,6 +745,7 @@ class Rewards {
|
|
|
689
745
|
const { error: warrning } = RewardsValidator.updateOfferByName().validate(
|
|
690
746
|
{
|
|
691
747
|
name,
|
|
748
|
+
|
|
692
749
|
body,
|
|
693
750
|
},
|
|
694
751
|
{ abortEarly: false, allowUnknown: false }
|
|
@@ -735,10 +792,15 @@ class Rewards {
|
|
|
735
792
|
* @summary: Update user status
|
|
736
793
|
* @description: Use this API to update the user status active/archive
|
|
737
794
|
*/
|
|
738
|
-
async updateUserStatus({
|
|
795
|
+
async updateUserStatus({
|
|
796
|
+
userId,
|
|
797
|
+
|
|
798
|
+
body,
|
|
799
|
+
} = {}) {
|
|
739
800
|
const { error } = RewardsValidator.updateUserStatus().validate(
|
|
740
801
|
{
|
|
741
802
|
userId,
|
|
803
|
+
|
|
742
804
|
body,
|
|
743
805
|
},
|
|
744
806
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -751,6 +813,7 @@ class Rewards {
|
|
|
751
813
|
const { error: warrning } = RewardsValidator.updateUserStatus().validate(
|
|
752
814
|
{
|
|
753
815
|
userId,
|
|
816
|
+
|
|
754
817
|
body,
|
|
755
818
|
},
|
|
756
819
|
{ abortEarly: false, allowUnknown: false }
|
|
@@ -788,64 +851,6 @@ class Rewards {
|
|
|
788
851
|
|
|
789
852
|
return response;
|
|
790
853
|
}
|
|
791
|
-
|
|
792
|
-
/**
|
|
793
|
-
* @param {Object} arg - Arg object.
|
|
794
|
-
* @param {string} arg.userId - User id
|
|
795
|
-
* @returns {Promise<UserRes>} - Success response
|
|
796
|
-
* @summary: Get user reward details
|
|
797
|
-
* @description: Use this API to get the user reward details
|
|
798
|
-
*/
|
|
799
|
-
async user({ userId } = {}) {
|
|
800
|
-
const { error } = RewardsValidator.user().validate(
|
|
801
|
-
{
|
|
802
|
-
userId,
|
|
803
|
-
},
|
|
804
|
-
{ abortEarly: false, allowUnknown: true }
|
|
805
|
-
);
|
|
806
|
-
if (error) {
|
|
807
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
808
|
-
}
|
|
809
|
-
|
|
810
|
-
// Showing warrnings if extra unknown parameters are found
|
|
811
|
-
const { error: warrning } = RewardsValidator.user().validate(
|
|
812
|
-
{
|
|
813
|
-
userId,
|
|
814
|
-
},
|
|
815
|
-
{ abortEarly: false, allowUnknown: false }
|
|
816
|
-
);
|
|
817
|
-
if (warrning) {
|
|
818
|
-
Logger({
|
|
819
|
-
level: "WARN",
|
|
820
|
-
message: "Parameter Validation warrnings for user",
|
|
821
|
-
});
|
|
822
|
-
Logger({ level: "WARN", message: warrning });
|
|
823
|
-
}
|
|
824
|
-
|
|
825
|
-
const query_params = {};
|
|
826
|
-
|
|
827
|
-
const response = await PlatformAPIClient.execute(
|
|
828
|
-
this.config,
|
|
829
|
-
"get",
|
|
830
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/`,
|
|
831
|
-
query_params,
|
|
832
|
-
undefined
|
|
833
|
-
);
|
|
834
|
-
|
|
835
|
-
const { error: res_error } = RewardsModel.UserRes().validate(response, {
|
|
836
|
-
abortEarly: false,
|
|
837
|
-
allowUnknown: false,
|
|
838
|
-
});
|
|
839
|
-
|
|
840
|
-
if (res_error) {
|
|
841
|
-
Logger({
|
|
842
|
-
level: "WARN",
|
|
843
|
-
message: "Response Validation Warnnings for user",
|
|
844
|
-
});
|
|
845
|
-
Logger({ level: "WARN", message: res_error });
|
|
846
|
-
}
|
|
847
|
-
|
|
848
|
-
return response;
|
|
849
|
-
}
|
|
850
854
|
}
|
|
855
|
+
|
|
851
856
|
module.exports = Rewards;
|
|
@@ -4,6 +4,7 @@ declare class RewardsValidator {
|
|
|
4
4
|
static getGiveawayById(): any;
|
|
5
5
|
static getOfferByName(): any;
|
|
6
6
|
static getRewardsConfiguration(): any;
|
|
7
|
+
static getUserDetails(): any;
|
|
7
8
|
static getUserPointsHistory(): any;
|
|
8
9
|
static saveGiveAway(): any;
|
|
9
10
|
static setRewardsConfiguration(): any;
|
|
@@ -12,5 +13,4 @@ declare class RewardsValidator {
|
|
|
12
13
|
static updateGiveAway(): any;
|
|
13
14
|
static updateOfferByName(): any;
|
|
14
15
|
static updateUserStatus(): any;
|
|
15
|
-
static user(): any;
|
|
16
16
|
}
|
|
@@ -1,9 +1,10 @@
|
|
|
1
1
|
const Joi = require("joi");
|
|
2
|
-
const RewardsModel = require("./RewardsPlatformModel");
|
|
3
2
|
|
|
3
|
+
const RewardsModel = require("./RewardsPlatformModel");
|
|
4
4
|
class RewardsValidator {
|
|
5
5
|
static getGiveawayAudienceStatus() {
|
|
6
6
|
return Joi.object({
|
|
7
|
+
id: Joi.string().allow("").required(),
|
|
7
8
|
audienceId: Joi.string().allow("").required(),
|
|
8
9
|
}).required();
|
|
9
10
|
}
|
|
@@ -17,8 +18,6 @@ class RewardsValidator {
|
|
|
17
18
|
static getOfferByName() {
|
|
18
19
|
return Joi.object({
|
|
19
20
|
name: Joi.string().allow("").required(),
|
|
20
|
-
|
|
21
|
-
cookie: Joi.string().allow("").required(),
|
|
22
21
|
}).required();
|
|
23
22
|
}
|
|
24
23
|
|
|
@@ -26,6 +25,12 @@ class RewardsValidator {
|
|
|
26
25
|
return Joi.object({}).required();
|
|
27
26
|
}
|
|
28
27
|
|
|
28
|
+
static getUserDetails() {
|
|
29
|
+
return Joi.object({
|
|
30
|
+
userId: Joi.string().allow("").required(),
|
|
31
|
+
}).required();
|
|
32
|
+
}
|
|
33
|
+
|
|
29
34
|
static getUserPointsHistory() {
|
|
30
35
|
return Joi.object({
|
|
31
36
|
userId: Joi.string().allow("").required(),
|
|
@@ -80,12 +85,6 @@ class RewardsValidator {
|
|
|
80
85
|
body: RewardsModel.AppUser().required(),
|
|
81
86
|
}).required();
|
|
82
87
|
}
|
|
83
|
-
|
|
84
|
-
static user() {
|
|
85
|
-
return Joi.object({
|
|
86
|
-
userId: Joi.string().allow("").required(),
|
|
87
|
-
}).required();
|
|
88
|
-
}
|
|
89
88
|
}
|
|
90
89
|
|
|
91
90
|
module.exports = RewardsValidator;
|
|
@@ -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 ShareValidator = require("./SharePlatformApplicationValidator");
|
|
5
5
|
const ShareModel = require("./SharePlatformModel");
|
|
6
6
|
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
const Joi = require("joi");
|
|
7
8
|
|
|
8
9
|
class Share {
|
|
9
10
|
constructor(config, applicationId) {
|
|
@@ -310,4 +311,5 @@ class Share {
|
|
|
310
311
|
return response;
|
|
311
312
|
}
|
|
312
313
|
}
|
|
314
|
+
|
|
313
315
|
module.exports = Share;
|
|
@@ -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 ThemeValidator = require("./ThemePlatformApplicationValidator");
|
|
5
5
|
const ThemeModel = require("./ThemePlatformModel");
|
|
6
6
|
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
const Joi = require("joi");
|
|
7
8
|
|
|
8
9
|
class Theme {
|
|
9
10
|
constructor(config, applicationId) {
|
|
@@ -1469,4 +1470,5 @@ class Theme {
|
|
|
1469
1470
|
return response;
|
|
1470
1471
|
}
|
|
1471
1472
|
}
|
|
1473
|
+
|
|
1472
1474
|
module.exports = Theme;
|
|
@@ -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) {
|
|
@@ -1090,4 +1091,5 @@ class User {
|
|
|
1090
1091
|
return response;
|
|
1091
1092
|
}
|
|
1092
1093
|
}
|
|
1094
|
+
|
|
1093
1095
|
module.exports = User;
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
const Paginator = require("../../common/Paginator");
|
|
2
|
-
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
1
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
2
|
+
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
|
+
const Paginator = require("../../common/Paginator");
|
|
4
4
|
const WebhookValidator = require("./WebhookPlatformValidator");
|
|
5
5
|
const WebhookModel = require("./WebhookPlatformModel");
|
|
6
6
|
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
const Joi = require("joi");
|
|
7
8
|
|
|
8
9
|
class Webhook {
|
|
9
10
|
constructor(config) {
|