@gofynd/fdk-client-javascript 1.4.5 → 1.4.7
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 +1 -1
- package/package.json +2 -2
- package/sdk/application/ApplicationClient.d.ts +2 -2
- package/sdk/application/ApplicationClient.js +2 -2
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +5 -5
- package/sdk/application/Catalog/CatalogApplicationClient.js +5 -5
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +6 -0
- package/sdk/application/Catalog/CatalogApplicationModel.js +6 -0
- package/sdk/application/Content/ContentApplicationModel.d.ts +2 -0
- package/sdk/application/Content/ContentApplicationModel.js +2 -0
- package/sdk/application/Logistic/LogisticApplicationModel.js +2 -2
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +1 -1
- package/sdk/application/Order/OrderApplicationModel.d.ts +70 -9
- package/sdk/application/Order/OrderApplicationModel.js +43 -7
- package/sdk/application/Order/OrderApplicationValidator.d.ts +2 -2
- package/sdk/application/Order/OrderApplicationValidator.js +1 -1
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +18 -18
- package/sdk/application/Payment/PaymentApplicationModel.js +41 -35
- package/sdk/application/Webhook/WebhookApplicationClient.d.ts +22 -0
- package/sdk/application/Webhook/WebhookApplicationClient.js +115 -0
- package/sdk/application/Webhook/WebhookApplicationModel.d.ts +37 -0
- package/sdk/application/Webhook/WebhookApplicationModel.js +46 -0
- package/sdk/application/Webhook/WebhookApplicationValidator.d.ts +16 -0
- package/sdk/application/Webhook/WebhookApplicationValidator.js +19 -0
- package/sdk/application/index.d.ts +1 -1
- package/sdk/application/index.js +2 -2
- package/sdk/partner/Webhook/WebhookPartnerClient.d.ts +2 -2
- package/sdk/partner/Webhook/WebhookPartnerClient.js +2 -2
- package/sdk/partner/Webhook/WebhookPartnerModel.d.ts +23 -19
- package/sdk/partner/Webhook/WebhookPartnerModel.js +20 -23
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +43 -0
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +257 -0
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +39 -0
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +45 -0
- package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +60 -0
- package/sdk/platform/Analytics/AnalyticsPlatformModel.js +57 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +10 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +80 -0
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +13 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +12 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +2 -0
- package/sdk/platform/Cart/CartPlatformModel.js +2 -0
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +34 -7
- package/sdk/platform/Catalog/CatalogPlatformClient.js +88 -13
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +120 -17
- package/sdk/platform/Catalog/CatalogPlatformModel.js +153 -27
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +71 -7
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +32 -5
- package/sdk/platform/Content/ContentPlatformModel.d.ts +2 -0
- package/sdk/platform/Content/ContentPlatformModel.js +2 -0
- package/sdk/platform/Order/OrderPlatformClient.d.ts +11 -1
- package/sdk/platform/Order/OrderPlatformClient.js +82 -5
- package/sdk/platform/Order/OrderPlatformModel.d.ts +163 -15
- package/sdk/platform/Order/OrderPlatformModel.js +157 -55
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +58 -17
- package/sdk/platform/Order/OrderPlatformValidator.js +28 -16
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +2 -2
- package/sdk/platform/Payment/PaymentPlatformModel.js +24 -18
- package/sdk/platform/PlatformApplicationClient.d.ts +2 -0
- package/sdk/platform/PlatformApplicationClient.js +4 -0
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +24 -0
- package/sdk/platform/Webhook/WebhookPlatformClient.js +164 -0
- package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +71 -18
- package/sdk/platform/Webhook/WebhookPlatformModel.js +76 -23
- package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +19 -1
- package/sdk/platform/Webhook/WebhookPlatformValidator.js +24 -0
- package/sdk/platform/index.d.ts +1 -0
- package/sdk/platform/index.js +2 -0
- package/sdk/public/Webhook/WebhookPublicClient.d.ts +2 -2
- package/sdk/public/Webhook/WebhookPublicClient.js +2 -2
- package/sdk/public/Webhook/WebhookPublicModel.d.ts +2 -0
- package/sdk/public/Webhook/WebhookPublicModel.js +3 -1
- package/sdk/application/PosCart/PosCartApplicationClient.d.ts +0 -323
- package/sdk/application/PosCart/PosCartApplicationClient.js +0 -2364
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +0 -1857
- package/sdk/application/PosCart/PosCartApplicationModel.js +0 -1906
- package/sdk/application/PosCart/PosCartApplicationValidator.d.ts +0 -483
- package/sdk/application/PosCart/PosCartApplicationValidator.js +0 -492
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
export = WebhookPartnerModel;
|
|
2
|
-
/**
|
|
3
|
-
* @typedef UpdateSubscriberResponse
|
|
4
|
-
* @property {string} [message]
|
|
5
|
-
*/
|
|
6
2
|
/**
|
|
7
3
|
* @typedef UpdateSubscriberRequest
|
|
8
4
|
* @property {string} [status]
|
|
9
5
|
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef UpdateSubscriberResponse
|
|
8
|
+
* @property {string} [message]
|
|
9
|
+
*/
|
|
10
10
|
/**
|
|
11
11
|
* @typedef Association
|
|
12
12
|
* @property {number} [company_id]
|
|
@@ -24,6 +24,7 @@ export = WebhookPartnerModel;
|
|
|
24
24
|
* @property {number} [id]
|
|
25
25
|
* @property {number} [event_id]
|
|
26
26
|
* @property {number} [subscriber_id]
|
|
27
|
+
* @property {string} [topic]
|
|
27
28
|
* @property {string} [created_on]
|
|
28
29
|
*/
|
|
29
30
|
/**
|
|
@@ -38,6 +39,7 @@ export = WebhookPartnerModel;
|
|
|
38
39
|
* @property {string} [description]
|
|
39
40
|
* @property {string} [created_on]
|
|
40
41
|
* @property {string} [updated_on]
|
|
42
|
+
* @property {string} [group]
|
|
41
43
|
* @property {SubscriberEventMapping} [subscriber_event_mapping]
|
|
42
44
|
*/
|
|
43
45
|
/**
|
|
@@ -61,10 +63,6 @@ export = WebhookPartnerModel;
|
|
|
61
63
|
* @property {string} [category]
|
|
62
64
|
* @property {number} [count]
|
|
63
65
|
*/
|
|
64
|
-
/**
|
|
65
|
-
* @typedef DownloadReponse
|
|
66
|
-
* @property {string} [file_name]
|
|
67
|
-
*/
|
|
68
66
|
/**
|
|
69
67
|
* @typedef HistoryFilters
|
|
70
68
|
* @property {string[]} [events]
|
|
@@ -74,6 +72,8 @@ export = WebhookPartnerModel;
|
|
|
74
72
|
* @property {string} [start_date] - The start date and time of the history report.
|
|
75
73
|
* @property {number[]} [subscribers] - An array of subscriber IDs associated
|
|
76
74
|
* with the history report.
|
|
75
|
+
* @property {string[]} [webhook_type] - An array of webhook type to identify
|
|
76
|
+
* thetype of subscriber i.e (KAFKA or REST).
|
|
77
77
|
*/
|
|
78
78
|
/**
|
|
79
79
|
* @typedef Url
|
|
@@ -215,6 +215,7 @@ export = WebhookPartnerModel;
|
|
|
215
215
|
* @property {string} [modified_by]
|
|
216
216
|
* @property {string} [name]
|
|
217
217
|
* @property {string} [webhook_url]
|
|
218
|
+
* @property {string} [provider]
|
|
218
219
|
* @property {Association} [association]
|
|
219
220
|
* @property {Object} [custom_headers]
|
|
220
221
|
* @property {string} [status]
|
|
@@ -229,18 +230,18 @@ export = WebhookPartnerModel;
|
|
|
229
230
|
declare class WebhookPartnerModel {
|
|
230
231
|
}
|
|
231
232
|
declare namespace WebhookPartnerModel {
|
|
232
|
-
export {
|
|
233
|
+
export { UpdateSubscriberRequest, UpdateSubscriberResponse, Association, AuthMeta, SubscriberEventMapping, EventConfigResponse, SubscriberConfigResponse, InvalidEventsRequest, InvalidEventsResponse, HistoryFilters, Url, CdnObject, UploadServiceObject, HistoryAssociation, HistoryItems, HistoryResponse, HistoryPayload, CancelDownloadResponse, FilterReportResponse, DeliveryTsResponse, DeliveryTsSchema, DeliveryDetailsRequest, EventDeliveryDetailSchema, DeliveryDetailsResponse, EventProcessReportObject, Page, DeliveryEventLevelSchema, DeliverySummaryResponse, DeliverySummarySchema, ItemSchema };
|
|
233
234
|
}
|
|
234
|
-
/** @returns {UpdateSubscriberResponse} */
|
|
235
|
-
declare function UpdateSubscriberResponse(): UpdateSubscriberResponse;
|
|
236
|
-
type UpdateSubscriberResponse = {
|
|
237
|
-
message?: string;
|
|
238
|
-
};
|
|
239
235
|
/** @returns {UpdateSubscriberRequest} */
|
|
240
236
|
declare function UpdateSubscriberRequest(): UpdateSubscriberRequest;
|
|
241
237
|
type UpdateSubscriberRequest = {
|
|
242
238
|
status?: string;
|
|
243
239
|
};
|
|
240
|
+
/** @returns {UpdateSubscriberResponse} */
|
|
241
|
+
declare function UpdateSubscriberResponse(): UpdateSubscriberResponse;
|
|
242
|
+
type UpdateSubscriberResponse = {
|
|
243
|
+
message?: string;
|
|
244
|
+
};
|
|
244
245
|
/** @returns {Association} */
|
|
245
246
|
declare function Association(): Association;
|
|
246
247
|
type Association = {
|
|
@@ -261,6 +262,7 @@ type SubscriberEventMapping = {
|
|
|
261
262
|
id?: number;
|
|
262
263
|
event_id?: number;
|
|
263
264
|
subscriber_id?: number;
|
|
265
|
+
topic?: string;
|
|
264
266
|
created_on?: string;
|
|
265
267
|
};
|
|
266
268
|
/** @returns {EventConfigResponse} */
|
|
@@ -276,6 +278,7 @@ type EventConfigResponse = {
|
|
|
276
278
|
description?: string;
|
|
277
279
|
created_on?: string;
|
|
278
280
|
updated_on?: string;
|
|
281
|
+
group?: string;
|
|
279
282
|
subscriber_event_mapping?: SubscriberEventMapping;
|
|
280
283
|
};
|
|
281
284
|
/** @returns {SubscriberConfigResponse} */
|
|
@@ -302,11 +305,6 @@ type InvalidEventsResponse = {
|
|
|
302
305
|
category?: string;
|
|
303
306
|
count?: number;
|
|
304
307
|
};
|
|
305
|
-
/** @returns {DownloadReponse} */
|
|
306
|
-
declare function DownloadReponse(): DownloadReponse;
|
|
307
|
-
type DownloadReponse = {
|
|
308
|
-
file_name?: string;
|
|
309
|
-
};
|
|
310
308
|
/** @returns {HistoryFilters} */
|
|
311
309
|
declare function HistoryFilters(): HistoryFilters;
|
|
312
310
|
type HistoryFilters = {
|
|
@@ -329,6 +327,11 @@ type HistoryFilters = {
|
|
|
329
327
|
* with the history report.
|
|
330
328
|
*/
|
|
331
329
|
subscribers?: number[];
|
|
330
|
+
/**
|
|
331
|
+
* - An array of webhook type to identify
|
|
332
|
+
* thetype of subscriber i.e (KAFKA or REST).
|
|
333
|
+
*/
|
|
334
|
+
webhook_type?: string[];
|
|
332
335
|
};
|
|
333
336
|
/** @returns {Url} */
|
|
334
337
|
declare function Url(): Url;
|
|
@@ -553,6 +556,7 @@ type ItemSchema = {
|
|
|
553
556
|
modified_by?: string;
|
|
554
557
|
name?: string;
|
|
555
558
|
webhook_url?: string;
|
|
559
|
+
provider?: string;
|
|
556
560
|
association?: Association;
|
|
557
561
|
custom_headers?: any;
|
|
558
562
|
status?: string;
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
const Joi = require("joi");
|
|
2
2
|
|
|
3
3
|
/**
|
|
4
|
-
* @typedef
|
|
5
|
-
* @property {string} [
|
|
4
|
+
* @typedef UpdateSubscriberRequest
|
|
5
|
+
* @property {string} [status]
|
|
6
6
|
*/
|
|
7
7
|
|
|
8
8
|
/**
|
|
9
|
-
* @typedef
|
|
10
|
-
* @property {string} [
|
|
9
|
+
* @typedef UpdateSubscriberResponse
|
|
10
|
+
* @property {string} [message]
|
|
11
11
|
*/
|
|
12
12
|
|
|
13
13
|
/**
|
|
@@ -29,6 +29,7 @@ const Joi = require("joi");
|
|
|
29
29
|
* @property {number} [id]
|
|
30
30
|
* @property {number} [event_id]
|
|
31
31
|
* @property {number} [subscriber_id]
|
|
32
|
+
* @property {string} [topic]
|
|
32
33
|
* @property {string} [created_on]
|
|
33
34
|
*/
|
|
34
35
|
|
|
@@ -44,6 +45,7 @@ const Joi = require("joi");
|
|
|
44
45
|
* @property {string} [description]
|
|
45
46
|
* @property {string} [created_on]
|
|
46
47
|
* @property {string} [updated_on]
|
|
48
|
+
* @property {string} [group]
|
|
47
49
|
* @property {SubscriberEventMapping} [subscriber_event_mapping]
|
|
48
50
|
*/
|
|
49
51
|
|
|
@@ -71,11 +73,6 @@ const Joi = require("joi");
|
|
|
71
73
|
* @property {number} [count]
|
|
72
74
|
*/
|
|
73
75
|
|
|
74
|
-
/**
|
|
75
|
-
* @typedef DownloadReponse
|
|
76
|
-
* @property {string} [file_name]
|
|
77
|
-
*/
|
|
78
|
-
|
|
79
76
|
/**
|
|
80
77
|
* @typedef HistoryFilters
|
|
81
78
|
* @property {string[]} [events]
|
|
@@ -85,6 +82,8 @@ const Joi = require("joi");
|
|
|
85
82
|
* @property {string} [start_date] - The start date and time of the history report.
|
|
86
83
|
* @property {number[]} [subscribers] - An array of subscriber IDs associated
|
|
87
84
|
* with the history report.
|
|
85
|
+
* @property {string[]} [webhook_type] - An array of webhook type to identify
|
|
86
|
+
* thetype of subscriber i.e (KAFKA or REST).
|
|
88
87
|
*/
|
|
89
88
|
|
|
90
89
|
/**
|
|
@@ -246,6 +245,7 @@ const Joi = require("joi");
|
|
|
246
245
|
* @property {string} [modified_by]
|
|
247
246
|
* @property {string} [name]
|
|
248
247
|
* @property {string} [webhook_url]
|
|
248
|
+
* @property {string} [provider]
|
|
249
249
|
* @property {Association} [association]
|
|
250
250
|
* @property {Object} [custom_headers]
|
|
251
251
|
* @property {string} [status]
|
|
@@ -259,17 +259,17 @@ const Joi = require("joi");
|
|
|
259
259
|
*/
|
|
260
260
|
|
|
261
261
|
class WebhookPartnerModel {
|
|
262
|
-
/** @returns {
|
|
263
|
-
static
|
|
262
|
+
/** @returns {UpdateSubscriberRequest} */
|
|
263
|
+
static UpdateSubscriberRequest() {
|
|
264
264
|
return Joi.object({
|
|
265
|
-
|
|
265
|
+
status: Joi.string().allow(""),
|
|
266
266
|
});
|
|
267
267
|
}
|
|
268
268
|
|
|
269
|
-
/** @returns {
|
|
270
|
-
static
|
|
269
|
+
/** @returns {UpdateSubscriberResponse} */
|
|
270
|
+
static UpdateSubscriberResponse() {
|
|
271
271
|
return Joi.object({
|
|
272
|
-
|
|
272
|
+
message: Joi.string().allow(""),
|
|
273
273
|
});
|
|
274
274
|
}
|
|
275
275
|
|
|
@@ -297,6 +297,7 @@ class WebhookPartnerModel {
|
|
|
297
297
|
id: Joi.number(),
|
|
298
298
|
event_id: Joi.number(),
|
|
299
299
|
subscriber_id: Joi.number(),
|
|
300
|
+
topic: Joi.string().allow("").allow(null),
|
|
300
301
|
created_on: Joi.string().allow(""),
|
|
301
302
|
});
|
|
302
303
|
}
|
|
@@ -308,12 +309,13 @@ class WebhookPartnerModel {
|
|
|
308
309
|
event_name: Joi.string().allow(""),
|
|
309
310
|
event_type: Joi.string().allow(""),
|
|
310
311
|
event_category: Joi.string().allow(""),
|
|
311
|
-
event_schema: Joi.object().pattern(/\S/, Joi.any()),
|
|
312
|
+
event_schema: Joi.object().pattern(/\S/, Joi.any()).allow(null, ""),
|
|
312
313
|
version: Joi.string().allow(""),
|
|
313
314
|
display_name: Joi.string().allow(""),
|
|
314
315
|
description: Joi.string().allow("").allow(null),
|
|
315
316
|
created_on: Joi.string().allow(""),
|
|
316
317
|
updated_on: Joi.string().allow(""),
|
|
318
|
+
group: Joi.string().allow("").allow(null),
|
|
317
319
|
subscriber_event_mapping: WebhookPartnerModel.SubscriberEventMapping(),
|
|
318
320
|
});
|
|
319
321
|
}
|
|
@@ -348,13 +350,6 @@ class WebhookPartnerModel {
|
|
|
348
350
|
});
|
|
349
351
|
}
|
|
350
352
|
|
|
351
|
-
/** @returns {DownloadReponse} */
|
|
352
|
-
static DownloadReponse() {
|
|
353
|
-
return Joi.object({
|
|
354
|
-
file_name: Joi.string().allow(""),
|
|
355
|
-
});
|
|
356
|
-
}
|
|
357
|
-
|
|
358
353
|
/** @returns {HistoryFilters} */
|
|
359
354
|
static HistoryFilters() {
|
|
360
355
|
return Joi.object({
|
|
@@ -364,6 +359,7 @@ class WebhookPartnerModel {
|
|
|
364
359
|
end_date: Joi.string().allow(""),
|
|
365
360
|
start_date: Joi.string().allow(""),
|
|
366
361
|
subscribers: Joi.array().items(Joi.number()),
|
|
362
|
+
webhook_type: Joi.array().items(Joi.string().allow("")),
|
|
367
363
|
});
|
|
368
364
|
}
|
|
369
365
|
|
|
@@ -565,6 +561,7 @@ class WebhookPartnerModel {
|
|
|
565
561
|
modified_by: Joi.string().allow(""),
|
|
566
562
|
name: Joi.string().allow(""),
|
|
567
563
|
webhook_url: Joi.string().allow(""),
|
|
564
|
+
provider: Joi.string().allow(""),
|
|
568
565
|
association: WebhookPartnerModel.Association(),
|
|
569
566
|
custom_headers: Joi.any(),
|
|
570
567
|
status: Joi.string().allow(""),
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
export = Analytics;
|
|
2
|
+
declare class Analytics {
|
|
3
|
+
constructor(config: any, applicationId: any);
|
|
4
|
+
config: any;
|
|
5
|
+
applicationId: any;
|
|
6
|
+
/**
|
|
7
|
+
* @param {AnalyticsPlatformApplicationValidator.CheckJobStatusByNameV2Param} arg
|
|
8
|
+
* - Arg object
|
|
9
|
+
*
|
|
10
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
11
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
12
|
+
* @returns {Promise<Object>} - Success response
|
|
13
|
+
* @name checkJobStatusByNameV2
|
|
14
|
+
* @summary: Checks download job status
|
|
15
|
+
* @description: Takes job name in path param to check the status of job Returns file URL if downloading is done else returns status of job - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/analytics/checkJobStatusByNameV2/).
|
|
16
|
+
*/
|
|
17
|
+
checkJobStatusByNameV2({ fileName, requestHeaders }?: AnalyticsPlatformApplicationValidator.CheckJobStatusByNameV2Param, { responseHeaders }?: object): Promise<any>;
|
|
18
|
+
/**
|
|
19
|
+
* @param {AnalyticsPlatformApplicationValidator.ExecuteJobForProvidedParametersV2Param} arg
|
|
20
|
+
* - Arg object
|
|
21
|
+
*
|
|
22
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
23
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
24
|
+
* @returns {Promise<Object>} - Success response
|
|
25
|
+
* @name executeJobForProvidedParametersV2
|
|
26
|
+
* @summary: Executes given sql(Base64 Encoded) query
|
|
27
|
+
* @description: Query click events data - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/analytics/executeJobForProvidedParametersV2/).
|
|
28
|
+
*/
|
|
29
|
+
executeJobForProvidedParametersV2({ body, requestHeaders }?: AnalyticsPlatformApplicationValidator.ExecuteJobForProvidedParametersV2Param, { responseHeaders }?: object): Promise<any>;
|
|
30
|
+
/**
|
|
31
|
+
* @param {AnalyticsPlatformApplicationValidator.StartDownloadForQueryV2Param} arg
|
|
32
|
+
* - Arg object
|
|
33
|
+
*
|
|
34
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
35
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
36
|
+
* @returns {Promise<Object>} - Success response
|
|
37
|
+
* @name startDownloadForQueryV2
|
|
38
|
+
* @summary: Initiates download job
|
|
39
|
+
* @description: Initiates download job and returns job name - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/analytics/startDownloadForQueryV2/).
|
|
40
|
+
*/
|
|
41
|
+
startDownloadForQueryV2({ exportType, body, requestHeaders }?: AnalyticsPlatformApplicationValidator.StartDownloadForQueryV2Param, { responseHeaders }?: object): Promise<any>;
|
|
42
|
+
}
|
|
43
|
+
import AnalyticsPlatformApplicationValidator = require("./AnalyticsPlatformApplicationValidator");
|
|
@@ -0,0 +1,257 @@
|
|
|
1
|
+
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
2
|
+
const {
|
|
3
|
+
FDKClientValidationError,
|
|
4
|
+
FDKResponseValidationError,
|
|
5
|
+
} = require("../../common/FDKError");
|
|
6
|
+
const Paginator = require("../../common/Paginator");
|
|
7
|
+
const AnalyticsPlatformApplicationValidator = require("./AnalyticsPlatformApplicationValidator");
|
|
8
|
+
const AnalyticsPlatformModel = require("./AnalyticsPlatformModel");
|
|
9
|
+
const { Logger } = require("./../../common/Logger");
|
|
10
|
+
const Joi = require("joi");
|
|
11
|
+
|
|
12
|
+
class Analytics {
|
|
13
|
+
constructor(config, applicationId) {
|
|
14
|
+
this.config = config;
|
|
15
|
+
this.applicationId = applicationId;
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
/**
|
|
19
|
+
* @param {AnalyticsPlatformApplicationValidator.CheckJobStatusByNameV2Param} arg
|
|
20
|
+
* - Arg object
|
|
21
|
+
*
|
|
22
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
23
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
24
|
+
* @returns {Promise<Object>} - Success response
|
|
25
|
+
* @name checkJobStatusByNameV2
|
|
26
|
+
* @summary: Checks download job status
|
|
27
|
+
* @description: Takes job name in path param to check the status of job Returns file URL if downloading is done else returns status of job - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/analytics/checkJobStatusByNameV2/).
|
|
28
|
+
*/
|
|
29
|
+
async checkJobStatusByNameV2(
|
|
30
|
+
{ fileName, requestHeaders } = { requestHeaders: {} },
|
|
31
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
32
|
+
) {
|
|
33
|
+
const {
|
|
34
|
+
error,
|
|
35
|
+
} = AnalyticsPlatformApplicationValidator.checkJobStatusByNameV2().validate(
|
|
36
|
+
{
|
|
37
|
+
fileName,
|
|
38
|
+
},
|
|
39
|
+
{ abortEarly: false, allowUnknown: true }
|
|
40
|
+
);
|
|
41
|
+
if (error) {
|
|
42
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
// Showing warrnings if extra unknown parameters are found
|
|
46
|
+
const {
|
|
47
|
+
error: warrning,
|
|
48
|
+
} = AnalyticsPlatformApplicationValidator.checkJobStatusByNameV2().validate(
|
|
49
|
+
{
|
|
50
|
+
fileName,
|
|
51
|
+
},
|
|
52
|
+
{ abortEarly: false, allowUnknown: false }
|
|
53
|
+
);
|
|
54
|
+
if (warrning) {
|
|
55
|
+
Logger({
|
|
56
|
+
level: "WARN",
|
|
57
|
+
message: `Parameter Validation warrnings for platform > Analytics > checkJobStatusByNameV2 \n ${warrning}`,
|
|
58
|
+
});
|
|
59
|
+
}
|
|
60
|
+
|
|
61
|
+
const query_params = {};
|
|
62
|
+
|
|
63
|
+
const response = await PlatformAPIClient.execute(
|
|
64
|
+
this.config,
|
|
65
|
+
"get",
|
|
66
|
+
`/service/platform/insights/v2.0/company/${this.config.companyId}/application/${this.applicationId}/job/${fileName}/status`,
|
|
67
|
+
query_params,
|
|
68
|
+
undefined,
|
|
69
|
+
requestHeaders,
|
|
70
|
+
{ responseHeaders }
|
|
71
|
+
);
|
|
72
|
+
|
|
73
|
+
let responseData = response;
|
|
74
|
+
if (responseHeaders) {
|
|
75
|
+
responseData = response[0];
|
|
76
|
+
}
|
|
77
|
+
|
|
78
|
+
const { error: res_error } = Joi.object()
|
|
79
|
+
.pattern(/\S/, Joi.any())
|
|
80
|
+
.validate(responseData, { abortEarly: false, allowUnknown: true });
|
|
81
|
+
|
|
82
|
+
if (res_error) {
|
|
83
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
84
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
85
|
+
} else {
|
|
86
|
+
Logger({
|
|
87
|
+
level: "WARN",
|
|
88
|
+
message: `Response Validation Warnings for platform > Analytics > checkJobStatusByNameV2 \n ${res_error}`,
|
|
89
|
+
});
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
return response;
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
/**
|
|
97
|
+
* @param {AnalyticsPlatformApplicationValidator.ExecuteJobForProvidedParametersV2Param} arg
|
|
98
|
+
* - Arg object
|
|
99
|
+
*
|
|
100
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
101
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
102
|
+
* @returns {Promise<Object>} - Success response
|
|
103
|
+
* @name executeJobForProvidedParametersV2
|
|
104
|
+
* @summary: Executes given sql(Base64 Encoded) query
|
|
105
|
+
* @description: Query click events data - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/analytics/executeJobForProvidedParametersV2/).
|
|
106
|
+
*/
|
|
107
|
+
async executeJobForProvidedParametersV2(
|
|
108
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
109
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
110
|
+
) {
|
|
111
|
+
const {
|
|
112
|
+
error,
|
|
113
|
+
} = AnalyticsPlatformApplicationValidator.executeJobForProvidedParametersV2().validate(
|
|
114
|
+
{
|
|
115
|
+
body,
|
|
116
|
+
},
|
|
117
|
+
{ abortEarly: false, allowUnknown: true }
|
|
118
|
+
);
|
|
119
|
+
if (error) {
|
|
120
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
121
|
+
}
|
|
122
|
+
|
|
123
|
+
// Showing warrnings if extra unknown parameters are found
|
|
124
|
+
const {
|
|
125
|
+
error: warrning,
|
|
126
|
+
} = AnalyticsPlatformApplicationValidator.executeJobForProvidedParametersV2().validate(
|
|
127
|
+
{
|
|
128
|
+
body,
|
|
129
|
+
},
|
|
130
|
+
{ abortEarly: false, allowUnknown: false }
|
|
131
|
+
);
|
|
132
|
+
if (warrning) {
|
|
133
|
+
Logger({
|
|
134
|
+
level: "WARN",
|
|
135
|
+
message: `Parameter Validation warrnings for platform > Analytics > executeJobForProvidedParametersV2 \n ${warrning}`,
|
|
136
|
+
});
|
|
137
|
+
}
|
|
138
|
+
|
|
139
|
+
const query_params = {};
|
|
140
|
+
|
|
141
|
+
const response = await PlatformAPIClient.execute(
|
|
142
|
+
this.config,
|
|
143
|
+
"post",
|
|
144
|
+
`/service/platform/insights/v2.0/company/${this.config.companyId}/application/${this.applicationId}/job/execute`,
|
|
145
|
+
query_params,
|
|
146
|
+
body,
|
|
147
|
+
requestHeaders,
|
|
148
|
+
{ responseHeaders }
|
|
149
|
+
);
|
|
150
|
+
|
|
151
|
+
let responseData = response;
|
|
152
|
+
if (responseHeaders) {
|
|
153
|
+
responseData = response[0];
|
|
154
|
+
}
|
|
155
|
+
|
|
156
|
+
const { error: res_error } = Joi.object()
|
|
157
|
+
.pattern(/\S/, Joi.any())
|
|
158
|
+
.validate(responseData, { abortEarly: false, allowUnknown: true });
|
|
159
|
+
|
|
160
|
+
if (res_error) {
|
|
161
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
162
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
163
|
+
} else {
|
|
164
|
+
Logger({
|
|
165
|
+
level: "WARN",
|
|
166
|
+
message: `Response Validation Warnings for platform > Analytics > executeJobForProvidedParametersV2 \n ${res_error}`,
|
|
167
|
+
});
|
|
168
|
+
}
|
|
169
|
+
}
|
|
170
|
+
|
|
171
|
+
return response;
|
|
172
|
+
}
|
|
173
|
+
|
|
174
|
+
/**
|
|
175
|
+
* @param {AnalyticsPlatformApplicationValidator.StartDownloadForQueryV2Param} arg
|
|
176
|
+
* - Arg object
|
|
177
|
+
*
|
|
178
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
179
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
180
|
+
* @returns {Promise<Object>} - Success response
|
|
181
|
+
* @name startDownloadForQueryV2
|
|
182
|
+
* @summary: Initiates download job
|
|
183
|
+
* @description: Initiates download job and returns job name - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/analytics/startDownloadForQueryV2/).
|
|
184
|
+
*/
|
|
185
|
+
async startDownloadForQueryV2(
|
|
186
|
+
{ exportType, body, requestHeaders } = { requestHeaders: {} },
|
|
187
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
188
|
+
) {
|
|
189
|
+
const {
|
|
190
|
+
error,
|
|
191
|
+
} = AnalyticsPlatformApplicationValidator.startDownloadForQueryV2().validate(
|
|
192
|
+
{
|
|
193
|
+
exportType,
|
|
194
|
+
body,
|
|
195
|
+
},
|
|
196
|
+
{ abortEarly: false, allowUnknown: true }
|
|
197
|
+
);
|
|
198
|
+
if (error) {
|
|
199
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
// Showing warrnings if extra unknown parameters are found
|
|
203
|
+
const {
|
|
204
|
+
error: warrning,
|
|
205
|
+
} = AnalyticsPlatformApplicationValidator.startDownloadForQueryV2().validate(
|
|
206
|
+
{
|
|
207
|
+
exportType,
|
|
208
|
+
body,
|
|
209
|
+
},
|
|
210
|
+
{ abortEarly: false, allowUnknown: false }
|
|
211
|
+
);
|
|
212
|
+
if (warrning) {
|
|
213
|
+
Logger({
|
|
214
|
+
level: "WARN",
|
|
215
|
+
message: `Parameter Validation warrnings for platform > Analytics > startDownloadForQueryV2 \n ${warrning}`,
|
|
216
|
+
});
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const query_params = {};
|
|
220
|
+
query_params["export_type"] = exportType;
|
|
221
|
+
|
|
222
|
+
const response = await PlatformAPIClient.execute(
|
|
223
|
+
this.config,
|
|
224
|
+
"post",
|
|
225
|
+
`/service/platform/insights/v2.0/company/${this.config.companyId}/application/${this.applicationId}/job/download`,
|
|
226
|
+
query_params,
|
|
227
|
+
body,
|
|
228
|
+
requestHeaders,
|
|
229
|
+
{ responseHeaders }
|
|
230
|
+
);
|
|
231
|
+
|
|
232
|
+
let responseData = response;
|
|
233
|
+
if (responseHeaders) {
|
|
234
|
+
responseData = response[0];
|
|
235
|
+
}
|
|
236
|
+
|
|
237
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
238
|
+
abortEarly: false,
|
|
239
|
+
allowUnknown: true,
|
|
240
|
+
});
|
|
241
|
+
|
|
242
|
+
if (res_error) {
|
|
243
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
244
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
245
|
+
} else {
|
|
246
|
+
Logger({
|
|
247
|
+
level: "WARN",
|
|
248
|
+
message: `Response Validation Warnings for platform > Analytics > startDownloadForQueryV2 \n ${res_error}`,
|
|
249
|
+
});
|
|
250
|
+
}
|
|
251
|
+
}
|
|
252
|
+
|
|
253
|
+
return response;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
|
|
257
|
+
module.exports = Analytics;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
export = AnalyticsPlatformApplicationValidator;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef CheckJobStatusByNameV2Param
|
|
4
|
+
* @property {string} fileName - Download job name
|
|
5
|
+
*/
|
|
6
|
+
/**
|
|
7
|
+
* @typedef ExecuteJobForProvidedParametersV2Param
|
|
8
|
+
* @property {AnalyticsPlatformModel.JobExecute} body
|
|
9
|
+
*/
|
|
10
|
+
/**
|
|
11
|
+
* @typedef StartDownloadForQueryV2Param
|
|
12
|
+
* @property {string} exportType
|
|
13
|
+
* @property {AnalyticsPlatformModel.FileDownloadRequestBody} body
|
|
14
|
+
*/
|
|
15
|
+
declare class AnalyticsPlatformApplicationValidator {
|
|
16
|
+
/** @returns {CheckJobStatusByNameV2Param} */
|
|
17
|
+
static checkJobStatusByNameV2(): CheckJobStatusByNameV2Param;
|
|
18
|
+
/** @returns {ExecuteJobForProvidedParametersV2Param} */
|
|
19
|
+
static executeJobForProvidedParametersV2(): ExecuteJobForProvidedParametersV2Param;
|
|
20
|
+
/** @returns {StartDownloadForQueryV2Param} */
|
|
21
|
+
static startDownloadForQueryV2(): StartDownloadForQueryV2Param;
|
|
22
|
+
}
|
|
23
|
+
declare namespace AnalyticsPlatformApplicationValidator {
|
|
24
|
+
export { CheckJobStatusByNameV2Param, ExecuteJobForProvidedParametersV2Param, StartDownloadForQueryV2Param };
|
|
25
|
+
}
|
|
26
|
+
type CheckJobStatusByNameV2Param = {
|
|
27
|
+
/**
|
|
28
|
+
* - Download job name
|
|
29
|
+
*/
|
|
30
|
+
fileName: string;
|
|
31
|
+
};
|
|
32
|
+
type ExecuteJobForProvidedParametersV2Param = {
|
|
33
|
+
body: AnalyticsPlatformModel.JobExecute;
|
|
34
|
+
};
|
|
35
|
+
type StartDownloadForQueryV2Param = {
|
|
36
|
+
exportType: string;
|
|
37
|
+
body: AnalyticsPlatformModel.FileDownloadRequestBody;
|
|
38
|
+
};
|
|
39
|
+
import AnalyticsPlatformModel = require("./AnalyticsPlatformModel");
|
|
@@ -0,0 +1,45 @@
|
|
|
1
|
+
const Joi = require("joi");
|
|
2
|
+
|
|
3
|
+
const AnalyticsPlatformModel = require("./AnalyticsPlatformModel");
|
|
4
|
+
|
|
5
|
+
/**
|
|
6
|
+
* @typedef CheckJobStatusByNameV2Param
|
|
7
|
+
* @property {string} fileName - Download job name
|
|
8
|
+
*/
|
|
9
|
+
|
|
10
|
+
/**
|
|
11
|
+
* @typedef ExecuteJobForProvidedParametersV2Param
|
|
12
|
+
* @property {AnalyticsPlatformModel.JobExecute} body
|
|
13
|
+
*/
|
|
14
|
+
|
|
15
|
+
/**
|
|
16
|
+
* @typedef StartDownloadForQueryV2Param
|
|
17
|
+
* @property {string} exportType
|
|
18
|
+
* @property {AnalyticsPlatformModel.FileDownloadRequestBody} body
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
class AnalyticsPlatformApplicationValidator {
|
|
22
|
+
/** @returns {CheckJobStatusByNameV2Param} */
|
|
23
|
+
static checkJobStatusByNameV2() {
|
|
24
|
+
return Joi.object({
|
|
25
|
+
fileName: Joi.string().allow("").required(),
|
|
26
|
+
}).required();
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
/** @returns {ExecuteJobForProvidedParametersV2Param} */
|
|
30
|
+
static executeJobForProvidedParametersV2() {
|
|
31
|
+
return Joi.object({
|
|
32
|
+
body: AnalyticsPlatformModel.JobExecute().required(),
|
|
33
|
+
}).required();
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
/** @returns {StartDownloadForQueryV2Param} */
|
|
37
|
+
static startDownloadForQueryV2() {
|
|
38
|
+
return Joi.object({
|
|
39
|
+
exportType: Joi.string().allow("").required(),
|
|
40
|
+
body: AnalyticsPlatformModel.FileDownloadRequestBody().required(),
|
|
41
|
+
}).required();
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
|
|
45
|
+
module.exports = AnalyticsPlatformApplicationValidator;
|