@gofynd/fdk-client-javascript 1.0.4 → 1.1.1
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 +19 -0
- package/index.d.ts +4 -1
- package/index.js +19 -3
- package/package.json +13 -4
- package/partner.d.ts +4 -0
- package/partner.js +7 -0
- package/sdk/application/ApplicationAPIClient.js +2 -4
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +6 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +11 -2
- package/sdk/application/Catalog/CatalogApplicationModel.js +4 -2
- package/sdk/application/Catalog/CatalogApplicationValidator.js +2 -0
- package/sdk/application/Content/ContentApplicationModel.js +0 -5
- package/sdk/application/Lead/LeadApplicationModel.js +1 -0
- package/sdk/application/Order/OrderApplicationClient.d.ts +0 -15
- package/sdk/application/Order/OrderApplicationClient.js +0 -68
- package/sdk/application/Order/OrderApplicationModel.d.ts +0 -17
- package/sdk/application/Order/OrderApplicationModel.js +0 -111
- package/sdk/application/Order/OrderApplicationValidator.d.ts +0 -1
- package/sdk/application/Order/OrderApplicationValidator.js +0 -7
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/common/BaseOAuthClient.d.ts +17 -0
- package/sdk/common/BaseOAuthClient.js +67 -0
- package/sdk/common/Constant.d.ts +0 -18
- package/sdk/common/Constant.js +0 -22
- package/sdk/common/RequestSigner.js +0 -5
- package/sdk/partner/OAuthClient.d.ts +14 -0
- package/sdk/partner/OAuthClient.js +112 -0
- package/sdk/{APIClient.d.ts → partner/PartnerAPIClient.d.ts} +2 -1
- package/sdk/{APIClient.js → partner/PartnerAPIClient.js} +13 -6
- package/sdk/{Client.d.ts → partner/PartnerClient.d.ts} +2 -2
- package/sdk/{Client.js → partner/PartnerClient.js} +2 -2
- 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/Billing/BillingPlatformClient.d.ts +24 -0
- package/sdk/platform/Billing/BillingPlatformClient.js +134 -0
- 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 +14 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +29 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +181 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +3 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +17 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +4 -0
- package/sdk/platform/Cart/CartPlatformModel.js +37 -0
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +3 -1
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +5 -0
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +1 -0
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +1 -1
- package/sdk/platform/Catalog/CatalogPlatformClient.js +1 -1
- package/sdk/platform/Catalog/CatalogPlatformModel.js +1 -5
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +0 -183
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +0 -417
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +0 -10
- package/sdk/platform/Communication/CommunicationPlatformClient.js +0 -26
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +4 -0
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +0 -22
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +0 -56
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +22 -1
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +123 -2
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +2 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +12 -0
- package/sdk/platform/Content/ContentPlatformModel.js +0 -5
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +2 -2
- package/sdk/platform/Discount/DiscountPlatformClient.js +1 -1
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +1 -0
- package/sdk/platform/Discount/DiscountPlatformModel.js +15 -0
- package/sdk/platform/Discount/DiscountPlatformValidator.js +1 -1
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +1 -1
- package/sdk/platform/Lead/LeadPlatformModel.js +1 -0
- package/sdk/platform/OAuthClient.js +3 -9
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +1 -47
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +5 -201
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -3
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +1 -26
- package/sdk/platform/Order/OrderPlatformClient.d.ts +51 -183
- package/sdk/platform/Order/OrderPlatformClient.js +243 -931
- package/sdk/platform/Order/OrderPlatformModel.d.ts +4 -20
- package/sdk/platform/Order/OrderPlatformModel.js +38 -182
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +3 -12
- package/sdk/platform/Order/OrderPlatformValidator.js +19 -95
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +24 -10
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +111 -44
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +2 -1
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +13 -5
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +2 -0
- package/sdk/platform/Payment/PaymentPlatformModel.js +12 -0
- package/sdk/platform/PlatformApplicationClient.d.ts +16 -41
- package/sdk/platform/PlatformApplicationClient.js +17 -45
- package/sdk/platform/PlatformClient.d.ts +124 -263
- package/sdk/platform/PlatformClient.js +148 -315
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +14 -16
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +63 -77
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +1 -1
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +7 -8
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +11 -0
- package/sdk/platform/Share/SharePlatformApplicationClient.js +61 -0
- package/sdk/platform/Share/SharePlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Share/SharePlatformApplicationValidator.js +6 -0
- package/sdk/platform/Share/SharePlatformModel.d.ts +2 -0
- package/sdk/platform/Share/SharePlatformModel.js +11 -0
- package/sdk/platform/index.d.ts +0 -1
- package/sdk/platform/index.js +0 -2
- package/sdk/Config.d.ts +0 -9
- package/sdk/Config.js +0 -17
- package/sdk/constructUrl.d.ts +0 -5
- package/sdk/constructUrl.js +0 -13
- package/sdk/index.d.ts +0 -3
- package/sdk/index.js +0 -5
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +0 -109
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +0 -558
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +0 -11
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +0 -56
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +0 -88
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +0 -361
- package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +0 -23
- package/sdk/platform/Analytics/AnalyticsPlatformModel.js +0 -169
- package/sdk/platform/Analytics/AnalyticsPlatformValidator.d.ts +0 -7
- package/sdk/platform/Analytics/AnalyticsPlatformValidator.js +0 -38
|
@@ -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
|
|
@@ -149,15 +157,5 @@ declare class Rewards {
|
|
|
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");
|
|
@@ -14,14 +14,15 @@ class Rewards {
|
|
|
14
14
|
|
|
15
15
|
/**
|
|
16
16
|
* @param {Object} arg - Arg object.
|
|
17
|
+
* @param {string} arg.id - Giveaway ID
|
|
17
18
|
* @param {string} arg.audienceId - Audience id
|
|
18
19
|
* @returns {Promise<GiveawayAudience>} - Success response
|
|
19
20
|
* @summary: Get the Giveaway audience status
|
|
20
21
|
* @description: Get giveaway audience status
|
|
21
22
|
*/
|
|
22
|
-
async getGiveawayAudienceStatus({ audienceId } = {}) {
|
|
23
|
+
async getGiveawayAudienceStatus({ id, audienceId } = {}) {
|
|
23
24
|
const { error } = RewardsValidator.getGiveawayAudienceStatus().validate(
|
|
24
|
-
{ audienceId },
|
|
25
|
+
{ id, audienceId },
|
|
25
26
|
{ abortEarly: false, allowUnknown: true }
|
|
26
27
|
);
|
|
27
28
|
if (error) {
|
|
@@ -32,7 +33,7 @@ class Rewards {
|
|
|
32
33
|
const {
|
|
33
34
|
error: warrning,
|
|
34
35
|
} = RewardsValidator.getGiveawayAudienceStatus().validate(
|
|
35
|
-
{ audienceId },
|
|
36
|
+
{ id, audienceId },
|
|
36
37
|
{ abortEarly: false, allowUnknown: false }
|
|
37
38
|
);
|
|
38
39
|
if (warrning) {
|
|
@@ -48,7 +49,7 @@ class Rewards {
|
|
|
48
49
|
const response = await PlatformAPIClient.execute(
|
|
49
50
|
this.config,
|
|
50
51
|
"get",
|
|
51
|
-
`/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`,
|
|
52
53
|
query_params,
|
|
53
54
|
undefined
|
|
54
55
|
);
|
|
@@ -133,24 +134,13 @@ class Rewards {
|
|
|
133
134
|
/**
|
|
134
135
|
* @param {Object} arg - Arg object.
|
|
135
136
|
* @param {string} arg.name - The name given to the offer.
|
|
136
|
-
* @param {string} arg.cookie - User's session cookie. This cookie is set in
|
|
137
|
-
* browser cookie when logged-in to fynd's authentication system i.e.
|
|
138
|
-
* `Grimlock` or by using grimlock-backend SDK for backend implementation.
|
|
139
137
|
* @returns {Promise<Offer>} - Success response
|
|
140
138
|
* @summary: Get offer by name
|
|
141
139
|
* @description: Use this API to get the offer details and configuration by entering the name of the offer.
|
|
142
140
|
*/
|
|
143
|
-
async getOfferByName({
|
|
144
|
-
name,
|
|
145
|
-
|
|
146
|
-
cookie,
|
|
147
|
-
} = {}) {
|
|
141
|
+
async getOfferByName({ name } = {}) {
|
|
148
142
|
const { error } = RewardsValidator.getOfferByName().validate(
|
|
149
|
-
{
|
|
150
|
-
name,
|
|
151
|
-
|
|
152
|
-
cookie,
|
|
153
|
-
},
|
|
143
|
+
{ name },
|
|
154
144
|
{ abortEarly: false, allowUnknown: true }
|
|
155
145
|
);
|
|
156
146
|
if (error) {
|
|
@@ -159,11 +149,7 @@ class Rewards {
|
|
|
159
149
|
|
|
160
150
|
// Showing warrnings if extra unknown parameters are found
|
|
161
151
|
const { error: warrning } = RewardsValidator.getOfferByName().validate(
|
|
162
|
-
{
|
|
163
|
-
name,
|
|
164
|
-
|
|
165
|
-
cookie,
|
|
166
|
-
},
|
|
152
|
+
{ name },
|
|
167
153
|
{ abortEarly: false, allowUnknown: false }
|
|
168
154
|
);
|
|
169
155
|
if (warrning) {
|
|
@@ -258,6 +244,61 @@ class Rewards {
|
|
|
258
244
|
return response;
|
|
259
245
|
}
|
|
260
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
|
+
|
|
261
302
|
/**
|
|
262
303
|
* @param {Object} arg - Arg object.
|
|
263
304
|
* @param {string} arg.userId - User id
|
|
@@ -810,61 +851,6 @@ class Rewards {
|
|
|
810
851
|
|
|
811
852
|
return response;
|
|
812
853
|
}
|
|
813
|
-
|
|
814
|
-
/**
|
|
815
|
-
* @param {Object} arg - Arg object.
|
|
816
|
-
* @param {string} arg.userId - User id
|
|
817
|
-
* @returns {Promise<UserRes>} - Success response
|
|
818
|
-
* @summary: Get user reward details
|
|
819
|
-
* @description: Use this API to get the user reward details
|
|
820
|
-
*/
|
|
821
|
-
async user({ userId } = {}) {
|
|
822
|
-
const { error } = RewardsValidator.user().validate(
|
|
823
|
-
{ userId },
|
|
824
|
-
{ abortEarly: false, allowUnknown: true }
|
|
825
|
-
);
|
|
826
|
-
if (error) {
|
|
827
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
// Showing warrnings if extra unknown parameters are found
|
|
831
|
-
const { error: warrning } = RewardsValidator.user().validate(
|
|
832
|
-
{ userId },
|
|
833
|
-
{ abortEarly: false, allowUnknown: false }
|
|
834
|
-
);
|
|
835
|
-
if (warrning) {
|
|
836
|
-
Logger({
|
|
837
|
-
level: "WARN",
|
|
838
|
-
message: "Parameter Validation warrnings for user",
|
|
839
|
-
});
|
|
840
|
-
Logger({ level: "WARN", message: warrning });
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
const query_params = {};
|
|
844
|
-
|
|
845
|
-
const response = await PlatformAPIClient.execute(
|
|
846
|
-
this.config,
|
|
847
|
-
"get",
|
|
848
|
-
`/service/platform/rewards/v1.0/company/${this.config.companyId}/application/${this.applicationId}/users/${userId}/`,
|
|
849
|
-
query_params,
|
|
850
|
-
undefined
|
|
851
|
-
);
|
|
852
|
-
|
|
853
|
-
const { error: res_error } = RewardsModel.UserRes().validate(response, {
|
|
854
|
-
abortEarly: false,
|
|
855
|
-
allowUnknown: false,
|
|
856
|
-
});
|
|
857
|
-
|
|
858
|
-
if (res_error) {
|
|
859
|
-
Logger({
|
|
860
|
-
level: "WARN",
|
|
861
|
-
message: "Response Validation Warnnings for user",
|
|
862
|
-
});
|
|
863
|
-
Logger({ level: "WARN", message: res_error });
|
|
864
|
-
}
|
|
865
|
-
|
|
866
|
-
return response;
|
|
867
|
-
}
|
|
868
854
|
}
|
|
869
855
|
|
|
870
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
|
}
|
|
@@ -4,6 +4,7 @@ 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;
|
|
@@ -23,6 +23,17 @@ declare class Share {
|
|
|
23
23
|
getShortLinkByHash({ hash }?: {
|
|
24
24
|
hash: string;
|
|
25
25
|
}): Promise<ShortLinkRes>;
|
|
26
|
+
/**
|
|
27
|
+
* @param {Object} arg - Arg object.
|
|
28
|
+
* @param {string} arg.surlId - Short link ID for which click statistics are
|
|
29
|
+
* to be retrieved.
|
|
30
|
+
* @returns {Promise<ClickStatsResponse>} - Success response
|
|
31
|
+
* @summary: Get click statistics for a short link
|
|
32
|
+
* @description: Retrieve click statistics for a given short link ID.
|
|
33
|
+
*/
|
|
34
|
+
getShortLinkClickStats({ surlId }?: {
|
|
35
|
+
surlId: string;
|
|
36
|
+
}): Promise<ClickStatsResponse>;
|
|
26
37
|
/**
|
|
27
38
|
* @param {Object} arg - Arg object.
|
|
28
39
|
* @param {number} [arg.pageNo] - Current page number
|
|
@@ -130,6 +130,67 @@ class Share {
|
|
|
130
130
|
return response;
|
|
131
131
|
}
|
|
132
132
|
|
|
133
|
+
/**
|
|
134
|
+
* @param {Object} arg - Arg object.
|
|
135
|
+
* @param {string} arg.surlId - Short link ID for which click statistics are
|
|
136
|
+
* to be retrieved.
|
|
137
|
+
* @returns {Promise<ClickStatsResponse>} - Success response
|
|
138
|
+
* @summary: Get click statistics for a short link
|
|
139
|
+
* @description: Retrieve click statistics for a given short link ID.
|
|
140
|
+
*/
|
|
141
|
+
async getShortLinkClickStats({ surlId } = {}) {
|
|
142
|
+
const { error } = ShareValidator.getShortLinkClickStats().validate(
|
|
143
|
+
{ surlId },
|
|
144
|
+
{ abortEarly: false, allowUnknown: true }
|
|
145
|
+
);
|
|
146
|
+
if (error) {
|
|
147
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
148
|
+
}
|
|
149
|
+
|
|
150
|
+
// Showing warrnings if extra unknown parameters are found
|
|
151
|
+
const {
|
|
152
|
+
error: warrning,
|
|
153
|
+
} = ShareValidator.getShortLinkClickStats().validate(
|
|
154
|
+
{ surlId },
|
|
155
|
+
{ abortEarly: false, allowUnknown: false }
|
|
156
|
+
);
|
|
157
|
+
if (warrning) {
|
|
158
|
+
Logger({
|
|
159
|
+
level: "WARN",
|
|
160
|
+
message: "Parameter Validation warrnings for getShortLinkClickStats",
|
|
161
|
+
});
|
|
162
|
+
Logger({ level: "WARN", message: warrning });
|
|
163
|
+
}
|
|
164
|
+
|
|
165
|
+
const query_params = {};
|
|
166
|
+
query_params["surl_id"] = surlId;
|
|
167
|
+
|
|
168
|
+
const response = await PlatformAPIClient.execute(
|
|
169
|
+
this.config,
|
|
170
|
+
"get",
|
|
171
|
+
`/service/platform/share/v1.0/company/${this.config.companyId}/application/${this.applicationId}/links/short-link/click-stats`,
|
|
172
|
+
query_params,
|
|
173
|
+
undefined
|
|
174
|
+
);
|
|
175
|
+
|
|
176
|
+
const {
|
|
177
|
+
error: res_error,
|
|
178
|
+
} = ShareModel.ClickStatsResponse().validate(response, {
|
|
179
|
+
abortEarly: false,
|
|
180
|
+
allowUnknown: false,
|
|
181
|
+
});
|
|
182
|
+
|
|
183
|
+
if (res_error) {
|
|
184
|
+
Logger({
|
|
185
|
+
level: "WARN",
|
|
186
|
+
message: "Response Validation Warnnings for getShortLinkClickStats",
|
|
187
|
+
});
|
|
188
|
+
Logger({ level: "WARN", message: res_error });
|
|
189
|
+
}
|
|
190
|
+
|
|
191
|
+
return response;
|
|
192
|
+
}
|
|
193
|
+
|
|
133
194
|
/**
|
|
134
195
|
* @param {Object} arg - Arg object.
|
|
135
196
|
* @param {number} [arg.pageNo] - Current page number
|
|
@@ -14,6 +14,12 @@ class ShareValidator {
|
|
|
14
14
|
}).required();
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
static getShortLinkClickStats() {
|
|
18
|
+
return Joi.object({
|
|
19
|
+
surlId: Joi.string().allow("").required(),
|
|
20
|
+
}).required();
|
|
21
|
+
}
|
|
22
|
+
|
|
17
23
|
static getShortLinks() {
|
|
18
24
|
return Joi.object({
|
|
19
25
|
pageNo: Joi.number(),
|
|
@@ -12,6 +12,17 @@ class ShareModel {
|
|
|
12
12
|
source: Joi.string().allow(""),
|
|
13
13
|
});
|
|
14
14
|
}
|
|
15
|
+
static ClickStatsItem() {
|
|
16
|
+
return Joi.object({
|
|
17
|
+
display: Joi.string().allow(""),
|
|
18
|
+
total: Joi.number(),
|
|
19
|
+
});
|
|
20
|
+
}
|
|
21
|
+
static ClickStatsResponse() {
|
|
22
|
+
return Joi.object({
|
|
23
|
+
click_stats: Joi.array().items(ShareModel.ClickStatsItem()).required(),
|
|
24
|
+
});
|
|
25
|
+
}
|
|
15
26
|
static ErrorRes() {
|
|
16
27
|
return Joi.object({
|
|
17
28
|
message: Joi.string().allow(""),
|
package/sdk/platform/index.d.ts
CHANGED
|
@@ -18,7 +18,6 @@ export namespace PlatformModel {
|
|
|
18
18
|
const ConfigurationPlatformModel: typeof import("./Configuration/ConfigurationPlatformModel");
|
|
19
19
|
const CartPlatformModel: typeof import("./Cart/CartPlatformModel");
|
|
20
20
|
const RewardsPlatformModel: typeof import("./Rewards/RewardsPlatformModel");
|
|
21
|
-
const AnalyticsPlatformModel: typeof import("./Analytics/AnalyticsPlatformModel");
|
|
22
21
|
const DiscountPlatformModel: typeof import("./Discount/DiscountPlatformModel");
|
|
23
22
|
const PartnerPlatformModel: typeof import("./Partner/PartnerPlatformModel");
|
|
24
23
|
const WebhookPlatformModel: typeof import("./Webhook/WebhookPlatformModel");
|
package/sdk/platform/index.js
CHANGED
|
@@ -36,8 +36,6 @@ module.exports = {
|
|
|
36
36
|
|
|
37
37
|
RewardsPlatformModel: require("./Rewards/RewardsPlatformModel"),
|
|
38
38
|
|
|
39
|
-
AnalyticsPlatformModel: require("./Analytics/AnalyticsPlatformModel"),
|
|
40
|
-
|
|
41
39
|
DiscountPlatformModel: require("./Discount/DiscountPlatformModel"),
|
|
42
40
|
|
|
43
41
|
PartnerPlatformModel: require("./Partner/PartnerPlatformModel"),
|
package/sdk/Config.d.ts
DELETED
package/sdk/Config.js
DELETED
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
const { Logger, setLoggerLevel } = require("../common/Logger");
|
|
2
|
-
|
|
3
|
-
class Config {
|
|
4
|
-
/** @param {object} _conf */
|
|
5
|
-
constructor(_conf) {
|
|
6
|
-
this.domain = _conf.domain || "https://api.fynd.com";
|
|
7
|
-
this.extraHeaders = [];
|
|
8
|
-
this.logLevel = _conf.logLevel || "ERROR";
|
|
9
|
-
this.setLogLevel(this.logLevel);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
setLogLevel(level) {
|
|
13
|
-
setLoggerLevel(level);
|
|
14
|
-
}
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
module.exports = Config;
|
package/sdk/constructUrl.d.ts
DELETED
package/sdk/constructUrl.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
const camelCase = require("camelcase");
|
|
2
|
-
const constructUrl = ({ url, params }) => {
|
|
3
|
-
return url
|
|
4
|
-
.split("/")
|
|
5
|
-
.map((word) => {
|
|
6
|
-
if (word[0] === "{" && word[word.length - 1] === "}") {
|
|
7
|
-
word = params[camelCase(word.slice(1, word.length - 1))];
|
|
8
|
-
}
|
|
9
|
-
return word;
|
|
10
|
-
})
|
|
11
|
-
.join("/");
|
|
12
|
-
};
|
|
13
|
-
module.exports = constructUrl;
|
package/sdk/index.d.ts
DELETED
package/sdk/index.js
DELETED
|
@@ -1,109 +0,0 @@
|
|
|
1
|
-
export = Analytics;
|
|
2
|
-
declare class Analytics {
|
|
3
|
-
constructor(config: any, applicationId: any);
|
|
4
|
-
config: any;
|
|
5
|
-
applicationId: any;
|
|
6
|
-
/**
|
|
7
|
-
* @param {Object} arg - Arg object.
|
|
8
|
-
* @param {string} arg.cartId - Cart Id
|
|
9
|
-
* @returns {Promise<AbandonCartDetail>} - Success response
|
|
10
|
-
* @summary: Get abandon carts details
|
|
11
|
-
* @description: Get abandon cart details
|
|
12
|
-
*/
|
|
13
|
-
getAbandonCartDetail({ cartId }?: {
|
|
14
|
-
cartId: string;
|
|
15
|
-
}): Promise<AbandonCartDetail>;
|
|
16
|
-
/**
|
|
17
|
-
* @param {Object} arg - Arg object.
|
|
18
|
-
* @param {string} arg.fromDate - From date
|
|
19
|
-
* @param {string} arg.toDate - To date
|
|
20
|
-
* @param {number} [arg.pageNo] - Current page number
|
|
21
|
-
* @param {number} [arg.pageSize] - Current page size
|
|
22
|
-
* @returns {Promise<AbandonCartsList>} - Success response
|
|
23
|
-
* @summary: Get abandon carts list
|
|
24
|
-
* @description: Get abandon carts list
|
|
25
|
-
*/
|
|
26
|
-
getAbandonCartList({ fromDate, toDate, pageNo, pageSize }?: {
|
|
27
|
-
fromDate: string;
|
|
28
|
-
toDate: string;
|
|
29
|
-
pageNo?: number;
|
|
30
|
-
pageSize?: number;
|
|
31
|
-
}): Promise<AbandonCartsList>;
|
|
32
|
-
/**
|
|
33
|
-
* @param {Object} arg - Arg object.
|
|
34
|
-
* @param {string} arg.companyId - Company Id
|
|
35
|
-
* @param {string} arg.applicationId - Application Id
|
|
36
|
-
* @param {string} arg.fromDate - From date
|
|
37
|
-
* @param {string} arg.toDate - To date
|
|
38
|
-
* @param {number} [arg.pageSize] - Current page size
|
|
39
|
-
* @summary: Get abandon carts list
|
|
40
|
-
* @description: Get abandon carts list
|
|
41
|
-
*/
|
|
42
|
-
getAbandonCartListPaginator({ companyId, applicationId, fromDate, toDate, pageSize, }?: {
|
|
43
|
-
companyId: string;
|
|
44
|
-
applicationId: string;
|
|
45
|
-
fromDate: string;
|
|
46
|
-
toDate: string;
|
|
47
|
-
pageSize?: number;
|
|
48
|
-
}): Paginator;
|
|
49
|
-
/**
|
|
50
|
-
* @param {Object} arg - Arg object.
|
|
51
|
-
* @param {string} arg.fromDate - From date
|
|
52
|
-
* @param {string} arg.toDate - To date
|
|
53
|
-
* @returns {Promise<string>} - Success response
|
|
54
|
-
* @summary: Get abandon carts csv
|
|
55
|
-
* @description: Get abandon carts csv
|
|
56
|
-
*/
|
|
57
|
-
getAbandonCartsCSV({ fromDate, toDate }?: {
|
|
58
|
-
fromDate: string;
|
|
59
|
-
toDate: string;
|
|
60
|
-
}): Promise<string>;
|
|
61
|
-
/**
|
|
62
|
-
* @param {Object} arg - Arg object.
|
|
63
|
-
* @param {string} arg.componentName - Component name
|
|
64
|
-
* @returns {Promise<StatsRes>} - Success response
|
|
65
|
-
* @summary: Get component statistics
|
|
66
|
-
* @description: Get component statistics
|
|
67
|
-
*/
|
|
68
|
-
getComponentStats({ componentName }?: {
|
|
69
|
-
componentName: string;
|
|
70
|
-
}): Promise<StatsRes>;
|
|
71
|
-
/**
|
|
72
|
-
* @param {Object} arg - Arg object.
|
|
73
|
-
* @param {string} arg.componentName - Component name
|
|
74
|
-
* @returns {Promise<string>} - Success response
|
|
75
|
-
* @summary: Get component statistics csv
|
|
76
|
-
* @description: Get component statistics csv
|
|
77
|
-
*/
|
|
78
|
-
getComponentStatsCSV({ componentName }?: {
|
|
79
|
-
componentName: string;
|
|
80
|
-
}): Promise<string>;
|
|
81
|
-
/**
|
|
82
|
-
* @param {Object} arg - Arg object.
|
|
83
|
-
* @param {string} arg.componentName - Component name
|
|
84
|
-
* @returns {Promise<string>} - Success response
|
|
85
|
-
* @summary: Get component statistics pdf
|
|
86
|
-
* @description: Get component statistics pdf
|
|
87
|
-
*/
|
|
88
|
-
getComponentStatsPDF({ componentName }?: {
|
|
89
|
-
componentName: string;
|
|
90
|
-
}): Promise<string>;
|
|
91
|
-
/**
|
|
92
|
-
* @param {Object} arg - Arg object.
|
|
93
|
-
* @param {string} arg.groupName - Group name
|
|
94
|
-
* @returns {Promise<StatsGroupComponents>} - Success response
|
|
95
|
-
* @summary: Get statistics group components
|
|
96
|
-
* @description: Get statistics group components
|
|
97
|
-
*/
|
|
98
|
-
getStatiscticsGroupComponents({ groupName }?: {
|
|
99
|
-
groupName: string;
|
|
100
|
-
}): Promise<StatsGroupComponents>;
|
|
101
|
-
/**
|
|
102
|
-
* @param {Object} arg - Arg object.
|
|
103
|
-
* @returns {Promise<StatsGroups>} - Success response
|
|
104
|
-
* @summary: Get statistics groups
|
|
105
|
-
* @description: Get statistics groups
|
|
106
|
-
*/
|
|
107
|
-
getStatiscticsGroups({}?: any): Promise<StatsGroups>;
|
|
108
|
-
}
|
|
109
|
-
import Paginator = require("../../common/Paginator");
|