@gofynd/fdk-client-javascript 3.25.0 → 3.27.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 +1 -1
- package/package.json +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +7 -4
- package/sdk/application/Catalog/CatalogApplicationClient.js +8 -2
- package/sdk/partner/Theme/ThemePartnerModel.d.ts +2 -1
- package/sdk/partner/Theme/ThemePartnerModel.js +3 -0
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +10 -0
- package/sdk/platform/Catalog/CatalogPlatformClient.js +75 -0
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +31 -2
- package/sdk/platform/Catalog/CatalogPlatformModel.js +23 -0
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +5 -1
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +2 -1
- package/sdk/platform/Content/ContentPlatformModel.js +3 -0
- package/sdk/platform/Order/OrderPlatformModel.d.ts +18 -18
- package/sdk/platform/Order/OrderPlatformModel.js +18 -18
- package/sdk/platform/PlatformApplicationClient.d.ts +0 -2
- package/sdk/platform/PlatformApplicationClient.js +0 -4
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +2 -1
- package/sdk/platform/Theme/ThemePlatformModel.js +3 -0
- package/sdk/platform/index.d.ts +0 -1
- package/sdk/platform/index.js +0 -2
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +0 -44
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +0 -263
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +0 -42
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +0 -45
- package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +0 -136
- package/sdk/platform/Analytics/AnalyticsPlatformModel.js +0 -95
|
@@ -2915,18 +2915,18 @@ const Joi = require("joi");
|
|
|
2915
2915
|
|
|
2916
2916
|
/**
|
|
2917
2917
|
* @typedef BundleDetailsSchema
|
|
2918
|
-
* @property {boolean}
|
|
2918
|
+
* @property {boolean} is_base - This serves as the base item, with all other
|
|
2919
2919
|
* items acting as child elements within the bundle to display the hero
|
|
2920
2920
|
* product prominently at the top.
|
|
2921
|
-
* @property {string[]}
|
|
2922
|
-
* @property {string}
|
|
2921
|
+
* @property {string[]} images - An array of image URLs associated with the bundle.
|
|
2922
|
+
* @property {string} group_id - Unique group identifier for the bundle
|
|
2923
2923
|
* generated by seller to club the articles
|
|
2924
|
-
* @property {string}
|
|
2925
|
-
* @property {string}
|
|
2926
|
-
* @property {number}
|
|
2927
|
-
* @property {string}
|
|
2928
|
-
* @property {string}
|
|
2929
|
-
* @property {string}
|
|
2924
|
+
* @property {string} name - Name of the bundle.
|
|
2925
|
+
* @property {string} item_type - Type of the bundle item
|
|
2926
|
+
* @property {number} item_id - Unique identifier of the item.
|
|
2927
|
+
* @property {string} item_code - Item code for the item.
|
|
2928
|
+
* @property {string} item_name - Name of the item.
|
|
2929
|
+
* @property {string} seller_identifier - Identifier for the seller of the bundle.
|
|
2930
2930
|
* @property {number} [bundle_article_quantity] - In orders with multiple
|
|
2931
2931
|
* quantities of the same line item, the line item count remains constant, but
|
|
2932
2932
|
* multiple bundles can exist. To distinguish between these bundles, the
|
|
@@ -8781,15 +8781,15 @@ class OrderPlatformModel {
|
|
|
8781
8781
|
/** @returns {BundleDetailsSchema} */
|
|
8782
8782
|
static BundleDetailsSchema() {
|
|
8783
8783
|
return Joi.object({
|
|
8784
|
-
is_base: Joi.boolean(),
|
|
8785
|
-
images: Joi.array().items(Joi.string().allow("")),
|
|
8786
|
-
group_id: Joi.string().allow(""),
|
|
8787
|
-
name: Joi.string().allow(""),
|
|
8788
|
-
item_type: Joi.string().allow(""),
|
|
8789
|
-
item_id: Joi.number(),
|
|
8790
|
-
item_code: Joi.string().allow(""),
|
|
8791
|
-
item_name: Joi.string().allow(""),
|
|
8792
|
-
seller_identifier: Joi.string().allow(""),
|
|
8784
|
+
is_base: Joi.boolean().required(),
|
|
8785
|
+
images: Joi.array().items(Joi.string().allow("")).required(),
|
|
8786
|
+
group_id: Joi.string().allow("").required(),
|
|
8787
|
+
name: Joi.string().allow("").required(),
|
|
8788
|
+
item_type: Joi.string().allow("").required(),
|
|
8789
|
+
item_id: Joi.number().required(),
|
|
8790
|
+
item_code: Joi.string().allow("").required(),
|
|
8791
|
+
item_name: Joi.string().allow("").required(),
|
|
8792
|
+
seller_identifier: Joi.string().allow("").required(),
|
|
8793
8793
|
bundle_article_quantity: Joi.number(),
|
|
8794
8794
|
brand_name: Joi.string().allow(""),
|
|
8795
8795
|
size: Joi.string().allow(""),
|
|
@@ -15,7 +15,6 @@ declare class PlatformApplicationClient {
|
|
|
15
15
|
config: import("./PlatformConfig");
|
|
16
16
|
companyId: string;
|
|
17
17
|
applicationId: string;
|
|
18
|
-
analytics: Analytics;
|
|
19
18
|
cart: Cart;
|
|
20
19
|
catalog: Catalog;
|
|
21
20
|
communication: Communication;
|
|
@@ -38,7 +37,6 @@ declare class PlatformApplicationClient {
|
|
|
38
37
|
*/
|
|
39
38
|
setExtraHeaders(header: object): void;
|
|
40
39
|
}
|
|
41
|
-
import Analytics = require("./Analytics/AnalyticsPlatformApplicationClient");
|
|
42
40
|
import Cart = require("./Cart/CartPlatformApplicationClient");
|
|
43
41
|
import Catalog = require("./Catalog/CatalogPlatformApplicationClient");
|
|
44
42
|
import Communication = require("./Communication/CommunicationPlatformApplicationClient");
|
|
@@ -1,5 +1,3 @@
|
|
|
1
|
-
const Analytics = require("./Analytics/AnalyticsPlatformApplicationClient");
|
|
2
|
-
|
|
3
1
|
const Cart = require("./Cart/CartPlatformApplicationClient");
|
|
4
2
|
|
|
5
3
|
const Catalog = require("./Catalog/CatalogPlatformApplicationClient");
|
|
@@ -47,8 +45,6 @@ class PlatformApplicationClient {
|
|
|
47
45
|
this.companyId = config.companyId;
|
|
48
46
|
this.applicationId = applicationId;
|
|
49
47
|
|
|
50
|
-
this.analytics = new Analytics(config, applicationId);
|
|
51
|
-
|
|
52
48
|
this.cart = new Cart(config, applicationId);
|
|
53
49
|
|
|
54
50
|
this.catalog = new Catalog(config, applicationId);
|
|
@@ -584,6 +584,7 @@ export = ThemePlatformModel;
|
|
|
584
584
|
* | "profile-company"
|
|
585
585
|
* | "profile-email"
|
|
586
586
|
* | "profile-phone"
|
|
587
|
+
* | "profile-loyalty-rewards"
|
|
587
588
|
* | "rate-us"
|
|
588
589
|
* | "refer-earn"
|
|
589
590
|
* | "settings"
|
|
@@ -1667,4 +1668,4 @@ type ActionPage = {
|
|
|
1667
1668
|
* @returns {PageType}
|
|
1668
1669
|
*/
|
|
1669
1670
|
declare function PageType(): PageType;
|
|
1670
|
-
type PageType = "about-us" | "addresses" | "blog" | "brands" | "cards" | "cart" | "categories" | "brand" | "category" | "collection" | "collections" | "custom" | "contact-us" | "external" | "faq" | "freshchat" | "home" | "notification-settings" | "orders" | "page" | "policy" | "product" | "product-request" | "products" | "profile" | "profile-order-shipment" | "profile-basic" | "profile-company" | "profile-email" | "profile-phone" | "rate-us" | "refer-earn" | "settings" | "shared-cart" | "tnc" | "track-order" | "wishlist" | "sections" | "form" | "cart-delivery" | "cart-payment" | "cart-review" | "login" | "register" | "shipping-policy" | "return-policy" | "order-status" | "locate-us" | "single-page-checkout" | "request-reattempt" | "files";
|
|
1671
|
+
type PageType = "about-us" | "addresses" | "blog" | "brands" | "cards" | "cart" | "categories" | "brand" | "category" | "collection" | "collections" | "custom" | "contact-us" | "external" | "faq" | "freshchat" | "home" | "notification-settings" | "orders" | "page" | "policy" | "product" | "product-request" | "products" | "profile" | "profile-order-shipment" | "profile-basic" | "profile-company" | "profile-email" | "profile-phone" | "profile-loyalty-rewards" | "rate-us" | "refer-earn" | "settings" | "shared-cart" | "tnc" | "track-order" | "wishlist" | "sections" | "form" | "cart-delivery" | "cart-payment" | "cart-review" | "login" | "register" | "shipping-policy" | "return-policy" | "order-status" | "locate-us" | "single-page-checkout" | "request-reattempt" | "files";
|
|
@@ -667,6 +667,7 @@ const Joi = require("joi");
|
|
|
667
667
|
* | "profile-company"
|
|
668
668
|
* | "profile-email"
|
|
669
669
|
* | "profile-phone"
|
|
670
|
+
* | "profile-loyalty-rewards"
|
|
670
671
|
* | "rate-us"
|
|
671
672
|
* | "refer-earn"
|
|
672
673
|
* | "settings"
|
|
@@ -1561,6 +1562,8 @@ class ThemePlatformModel {
|
|
|
1561
1562
|
|
|
1562
1563
|
"profile-phone",
|
|
1563
1564
|
|
|
1565
|
+
"profile-loyalty-rewards",
|
|
1566
|
+
|
|
1564
1567
|
"rate-us",
|
|
1565
1568
|
|
|
1566
1569
|
"refer-earn",
|
package/sdk/platform/index.d.ts
CHANGED
|
@@ -1,7 +1,6 @@
|
|
|
1
1
|
export const PlatformConfig: typeof import("./PlatformConfig");
|
|
2
2
|
export const PlatformClient: typeof import("./PlatformClient");
|
|
3
3
|
export namespace PlatformModel {
|
|
4
|
-
const AnalyticsPlatformModel: typeof import("./Analytics/AnalyticsPlatformModel");
|
|
5
4
|
const AuditTrailPlatformModel: typeof import("./AuditTrail/AuditTrailPlatformModel");
|
|
6
5
|
const BillingPlatformModel: typeof import("./Billing/BillingPlatformModel");
|
|
7
6
|
const CartPlatformModel: typeof import("./Cart/CartPlatformModel");
|
package/sdk/platform/index.js
CHANGED
|
@@ -2,8 +2,6 @@ module.exports = {
|
|
|
2
2
|
PlatformConfig: require("./PlatformConfig"),
|
|
3
3
|
PlatformClient: require("./PlatformClient"),
|
|
4
4
|
PlatformModel: {
|
|
5
|
-
AnalyticsPlatformModel: require("./Analytics/AnalyticsPlatformModel"),
|
|
6
|
-
|
|
7
5
|
AuditTrailPlatformModel: require("./AuditTrail/AuditTrailPlatformModel"),
|
|
8
6
|
|
|
9
7
|
BillingPlatformModel: require("./Billing/BillingPlatformModel"),
|
|
@@ -1,44 +0,0 @@
|
|
|
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<AnalyticsPlatformModel.JobStatus>} - 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://docs.fynd.com/partners/commerce/sdk/platform/analytics/checkJobStatusByNameV2/).
|
|
16
|
-
*/
|
|
17
|
-
checkJobStatusByNameV2({ fileName, requestHeaders }?: AnalyticsPlatformApplicationValidator.CheckJobStatusByNameV2Param, { responseHeaders }?: object): Promise<AnalyticsPlatformModel.JobStatus>;
|
|
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<AnalyticsPlatformModel.JobExecutionResult>} - Success response
|
|
25
|
-
* @name executeJobForProvidedParametersV2
|
|
26
|
-
* @summary: Executes given sql(Base64 Encoded) query
|
|
27
|
-
* @description: Query click events data - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/analytics/executeJobForProvidedParametersV2/).
|
|
28
|
-
*/
|
|
29
|
-
executeJobForProvidedParametersV2({ body, requestHeaders }?: AnalyticsPlatformApplicationValidator.ExecuteJobForProvidedParametersV2Param, { responseHeaders }?: object): Promise<AnalyticsPlatformModel.JobExecutionResult>;
|
|
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://docs.fynd.com/partners/commerce/sdk/platform/analytics/startDownloadForQueryV2/).
|
|
40
|
-
*/
|
|
41
|
-
startDownloadForQueryV2({ exportType, body, requestHeaders }?: AnalyticsPlatformApplicationValidator.StartDownloadForQueryV2Param, { responseHeaders }?: object): Promise<any>;
|
|
42
|
-
}
|
|
43
|
-
import AnalyticsPlatformApplicationValidator = require("./AnalyticsPlatformApplicationValidator");
|
|
44
|
-
import AnalyticsPlatformModel = require("./AnalyticsPlatformModel");
|
|
@@ -1,263 +0,0 @@
|
|
|
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<AnalyticsPlatformModel.JobStatus>} - 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://docs.fynd.com/partners/commerce/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 {
|
|
79
|
-
error: res_error,
|
|
80
|
-
} = AnalyticsPlatformModel.JobStatus().validate(responseData, {
|
|
81
|
-
abortEarly: false,
|
|
82
|
-
allowUnknown: true,
|
|
83
|
-
});
|
|
84
|
-
|
|
85
|
-
if (res_error) {
|
|
86
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
87
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
88
|
-
} else {
|
|
89
|
-
Logger({
|
|
90
|
-
level: "WARN",
|
|
91
|
-
message: `Response Validation Warnings for platform > Analytics > checkJobStatusByNameV2 \n ${res_error}`,
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
}
|
|
95
|
-
|
|
96
|
-
return response;
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
/**
|
|
100
|
-
* @param {AnalyticsPlatformApplicationValidator.ExecuteJobForProvidedParametersV2Param} arg
|
|
101
|
-
* - Arg object
|
|
102
|
-
*
|
|
103
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
104
|
-
* @param {import("../PlatformAPIClient").Options} - Options
|
|
105
|
-
* @returns {Promise<AnalyticsPlatformModel.JobExecutionResult>} - Success response
|
|
106
|
-
* @name executeJobForProvidedParametersV2
|
|
107
|
-
* @summary: Executes given sql(Base64 Encoded) query
|
|
108
|
-
* @description: Query click events data - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/analytics/executeJobForProvidedParametersV2/).
|
|
109
|
-
*/
|
|
110
|
-
async executeJobForProvidedParametersV2(
|
|
111
|
-
{ body, requestHeaders } = { requestHeaders: {} },
|
|
112
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
113
|
-
) {
|
|
114
|
-
const {
|
|
115
|
-
error,
|
|
116
|
-
} = AnalyticsPlatformApplicationValidator.executeJobForProvidedParametersV2().validate(
|
|
117
|
-
{
|
|
118
|
-
body,
|
|
119
|
-
},
|
|
120
|
-
{ abortEarly: false, allowUnknown: true }
|
|
121
|
-
);
|
|
122
|
-
if (error) {
|
|
123
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
124
|
-
}
|
|
125
|
-
|
|
126
|
-
// Showing warrnings if extra unknown parameters are found
|
|
127
|
-
const {
|
|
128
|
-
error: warrning,
|
|
129
|
-
} = AnalyticsPlatformApplicationValidator.executeJobForProvidedParametersV2().validate(
|
|
130
|
-
{
|
|
131
|
-
body,
|
|
132
|
-
},
|
|
133
|
-
{ abortEarly: false, allowUnknown: false }
|
|
134
|
-
);
|
|
135
|
-
if (warrning) {
|
|
136
|
-
Logger({
|
|
137
|
-
level: "WARN",
|
|
138
|
-
message: `Parameter Validation warrnings for platform > Analytics > executeJobForProvidedParametersV2 \n ${warrning}`,
|
|
139
|
-
});
|
|
140
|
-
}
|
|
141
|
-
|
|
142
|
-
const query_params = {};
|
|
143
|
-
|
|
144
|
-
const response = await PlatformAPIClient.execute(
|
|
145
|
-
this.config,
|
|
146
|
-
"post",
|
|
147
|
-
`/service/platform/insights/v2.0/company/${this.config.companyId}/application/${this.applicationId}/job/execute`,
|
|
148
|
-
query_params,
|
|
149
|
-
body,
|
|
150
|
-
requestHeaders,
|
|
151
|
-
{ responseHeaders }
|
|
152
|
-
);
|
|
153
|
-
|
|
154
|
-
let responseData = response;
|
|
155
|
-
if (responseHeaders) {
|
|
156
|
-
responseData = response[0];
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
const {
|
|
160
|
-
error: res_error,
|
|
161
|
-
} = AnalyticsPlatformModel.JobExecutionResult().validate(responseData, {
|
|
162
|
-
abortEarly: false,
|
|
163
|
-
allowUnknown: true,
|
|
164
|
-
});
|
|
165
|
-
|
|
166
|
-
if (res_error) {
|
|
167
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
168
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
169
|
-
} else {
|
|
170
|
-
Logger({
|
|
171
|
-
level: "WARN",
|
|
172
|
-
message: `Response Validation Warnings for platform > Analytics > executeJobForProvidedParametersV2 \n ${res_error}`,
|
|
173
|
-
});
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
|
|
177
|
-
return response;
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
/**
|
|
181
|
-
* @param {AnalyticsPlatformApplicationValidator.StartDownloadForQueryV2Param} arg
|
|
182
|
-
* - Arg object
|
|
183
|
-
*
|
|
184
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
185
|
-
* @param {import("../PlatformAPIClient").Options} - Options
|
|
186
|
-
* @returns {Promise<Object>} - Success response
|
|
187
|
-
* @name startDownloadForQueryV2
|
|
188
|
-
* @summary: Initiates download job
|
|
189
|
-
* @description: Initiates download job and returns job name - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/platform/analytics/startDownloadForQueryV2/).
|
|
190
|
-
*/
|
|
191
|
-
async startDownloadForQueryV2(
|
|
192
|
-
{ exportType, body, requestHeaders } = { requestHeaders: {} },
|
|
193
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
194
|
-
) {
|
|
195
|
-
const {
|
|
196
|
-
error,
|
|
197
|
-
} = AnalyticsPlatformApplicationValidator.startDownloadForQueryV2().validate(
|
|
198
|
-
{
|
|
199
|
-
exportType,
|
|
200
|
-
body,
|
|
201
|
-
},
|
|
202
|
-
{ abortEarly: false, allowUnknown: true }
|
|
203
|
-
);
|
|
204
|
-
if (error) {
|
|
205
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
206
|
-
}
|
|
207
|
-
|
|
208
|
-
// Showing warrnings if extra unknown parameters are found
|
|
209
|
-
const {
|
|
210
|
-
error: warrning,
|
|
211
|
-
} = AnalyticsPlatformApplicationValidator.startDownloadForQueryV2().validate(
|
|
212
|
-
{
|
|
213
|
-
exportType,
|
|
214
|
-
body,
|
|
215
|
-
},
|
|
216
|
-
{ abortEarly: false, allowUnknown: false }
|
|
217
|
-
);
|
|
218
|
-
if (warrning) {
|
|
219
|
-
Logger({
|
|
220
|
-
level: "WARN",
|
|
221
|
-
message: `Parameter Validation warrnings for platform > Analytics > startDownloadForQueryV2 \n ${warrning}`,
|
|
222
|
-
});
|
|
223
|
-
}
|
|
224
|
-
|
|
225
|
-
const query_params = {};
|
|
226
|
-
query_params["export_type"] = exportType;
|
|
227
|
-
|
|
228
|
-
const response = await PlatformAPIClient.execute(
|
|
229
|
-
this.config,
|
|
230
|
-
"post",
|
|
231
|
-
`/service/platform/insights/v2.0/company/${this.config.companyId}/application/${this.applicationId}/job/download`,
|
|
232
|
-
query_params,
|
|
233
|
-
body,
|
|
234
|
-
requestHeaders,
|
|
235
|
-
{ responseHeaders }
|
|
236
|
-
);
|
|
237
|
-
|
|
238
|
-
let responseData = response;
|
|
239
|
-
if (responseHeaders) {
|
|
240
|
-
responseData = response[0];
|
|
241
|
-
}
|
|
242
|
-
|
|
243
|
-
const { error: res_error } = Joi.any().validate(responseData, {
|
|
244
|
-
abortEarly: false,
|
|
245
|
-
allowUnknown: true,
|
|
246
|
-
});
|
|
247
|
-
|
|
248
|
-
if (res_error) {
|
|
249
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
250
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
251
|
-
} else {
|
|
252
|
-
Logger({
|
|
253
|
-
level: "WARN",
|
|
254
|
-
message: `Response Validation Warnings for platform > Analytics > startDownloadForQueryV2 \n ${res_error}`,
|
|
255
|
-
});
|
|
256
|
-
}
|
|
257
|
-
}
|
|
258
|
-
|
|
259
|
-
return response;
|
|
260
|
-
}
|
|
261
|
-
}
|
|
262
|
-
|
|
263
|
-
module.exports = Analytics;
|
|
@@ -1,42 +0,0 @@
|
|
|
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 - Format in which to be exported(eg. CSV or excel).
|
|
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
|
-
/**
|
|
37
|
-
* - Format in which to be exported(eg. CSV or excel).
|
|
38
|
-
*/
|
|
39
|
-
exportType: string;
|
|
40
|
-
body: AnalyticsPlatformModel.FileDownloadRequestBody;
|
|
41
|
-
};
|
|
42
|
-
import AnalyticsPlatformModel = require("./AnalyticsPlatformModel");
|
|
@@ -1,45 +0,0 @@
|
|
|
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 - Format in which to be exported(eg. CSV or excel).
|
|
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;
|
|
@@ -1,136 +0,0 @@
|
|
|
1
|
-
export = AnalyticsPlatformModel;
|
|
2
|
-
/**
|
|
3
|
-
* @typedef Page
|
|
4
|
-
* @property {number} [item_total] - The total number of all items across all pages.
|
|
5
|
-
* @property {string} [next_id] - The identifier for the next page.
|
|
6
|
-
* @property {boolean} [has_previous] - Indicates whether there is a previous page.
|
|
7
|
-
* @property {boolean} [has_next] - Indicates whether there is a next page.
|
|
8
|
-
* @property {number} [current] - The current page number.
|
|
9
|
-
* @property {string} type - The type of the page, can be 'cursor' or 'number'.
|
|
10
|
-
* @property {number} [size] - The number of items per page.
|
|
11
|
-
* @property {number} [page_size] - The number of items per page.
|
|
12
|
-
*/
|
|
13
|
-
/**
|
|
14
|
-
* @typedef FileDownloadRequestBody
|
|
15
|
-
* @property {string} query - Base64 encoded SQL query to execute on ClickHouse.
|
|
16
|
-
* @property {boolean} [split_files] - Flag indicating whether to split the
|
|
17
|
-
* files for larger datasets.
|
|
18
|
-
*/
|
|
19
|
-
/**
|
|
20
|
-
* @typedef JobExecute
|
|
21
|
-
* @property {string} query - Base64 encoded SQL query to execute on ClickHouse.
|
|
22
|
-
* @property {Page} [page]
|
|
23
|
-
*/
|
|
24
|
-
/**
|
|
25
|
-
* @typedef JobExecutionResult
|
|
26
|
-
* @property {Object[]} [rows] - Array of rows resulting from the job execution.
|
|
27
|
-
* @property {Page} [page]
|
|
28
|
-
*/
|
|
29
|
-
/**
|
|
30
|
-
* @typedef JobStatus
|
|
31
|
-
* @property {string} [start_date] - The start date and time of the job.
|
|
32
|
-
* @property {string} [end_date] - The end date and time of the job.
|
|
33
|
-
* @property {string} [status] - The current status of the job.
|
|
34
|
-
* @property {string} [message] - Message providing additional details about the
|
|
35
|
-
* job status.
|
|
36
|
-
* @property {Object[]} [file_metadata] - Metadata about files associated with
|
|
37
|
-
* the job, if any.
|
|
38
|
-
*/
|
|
39
|
-
declare class AnalyticsPlatformModel {
|
|
40
|
-
}
|
|
41
|
-
declare namespace AnalyticsPlatformModel {
|
|
42
|
-
export { Page, FileDownloadRequestBody, JobExecute, JobExecutionResult, JobStatus };
|
|
43
|
-
}
|
|
44
|
-
/** @returns {Page} */
|
|
45
|
-
declare function Page(): Page;
|
|
46
|
-
type Page = {
|
|
47
|
-
/**
|
|
48
|
-
* - The total number of all items across all pages.
|
|
49
|
-
*/
|
|
50
|
-
item_total?: number;
|
|
51
|
-
/**
|
|
52
|
-
* - The identifier for the next page.
|
|
53
|
-
*/
|
|
54
|
-
next_id?: string;
|
|
55
|
-
/**
|
|
56
|
-
* - Indicates whether there is a previous page.
|
|
57
|
-
*/
|
|
58
|
-
has_previous?: boolean;
|
|
59
|
-
/**
|
|
60
|
-
* - Indicates whether there is a next page.
|
|
61
|
-
*/
|
|
62
|
-
has_next?: boolean;
|
|
63
|
-
/**
|
|
64
|
-
* - The current page number.
|
|
65
|
-
*/
|
|
66
|
-
current?: number;
|
|
67
|
-
/**
|
|
68
|
-
* - The type of the page, can be 'cursor' or 'number'.
|
|
69
|
-
*/
|
|
70
|
-
type: string;
|
|
71
|
-
/**
|
|
72
|
-
* - The number of items per page.
|
|
73
|
-
*/
|
|
74
|
-
size?: number;
|
|
75
|
-
/**
|
|
76
|
-
* - The number of items per page.
|
|
77
|
-
*/
|
|
78
|
-
page_size?: number;
|
|
79
|
-
};
|
|
80
|
-
/** @returns {FileDownloadRequestBody} */
|
|
81
|
-
declare function FileDownloadRequestBody(): FileDownloadRequestBody;
|
|
82
|
-
type FileDownloadRequestBody = {
|
|
83
|
-
/**
|
|
84
|
-
* - Base64 encoded SQL query to execute on ClickHouse.
|
|
85
|
-
*/
|
|
86
|
-
query: string;
|
|
87
|
-
/**
|
|
88
|
-
* - Flag indicating whether to split the
|
|
89
|
-
* files for larger datasets.
|
|
90
|
-
*/
|
|
91
|
-
split_files?: boolean;
|
|
92
|
-
};
|
|
93
|
-
/** @returns {JobExecute} */
|
|
94
|
-
declare function JobExecute(): JobExecute;
|
|
95
|
-
type JobExecute = {
|
|
96
|
-
/**
|
|
97
|
-
* - Base64 encoded SQL query to execute on ClickHouse.
|
|
98
|
-
*/
|
|
99
|
-
query: string;
|
|
100
|
-
page?: Page;
|
|
101
|
-
};
|
|
102
|
-
/** @returns {JobExecutionResult} */
|
|
103
|
-
declare function JobExecutionResult(): JobExecutionResult;
|
|
104
|
-
type JobExecutionResult = {
|
|
105
|
-
/**
|
|
106
|
-
* - Array of rows resulting from the job execution.
|
|
107
|
-
*/
|
|
108
|
-
rows?: any[];
|
|
109
|
-
page?: Page;
|
|
110
|
-
};
|
|
111
|
-
/** @returns {JobStatus} */
|
|
112
|
-
declare function JobStatus(): JobStatus;
|
|
113
|
-
type JobStatus = {
|
|
114
|
-
/**
|
|
115
|
-
* - The start date and time of the job.
|
|
116
|
-
*/
|
|
117
|
-
start_date?: string;
|
|
118
|
-
/**
|
|
119
|
-
* - The end date and time of the job.
|
|
120
|
-
*/
|
|
121
|
-
end_date?: string;
|
|
122
|
-
/**
|
|
123
|
-
* - The current status of the job.
|
|
124
|
-
*/
|
|
125
|
-
status?: string;
|
|
126
|
-
/**
|
|
127
|
-
* - Message providing additional details about the
|
|
128
|
-
* job status.
|
|
129
|
-
*/
|
|
130
|
-
message?: string;
|
|
131
|
-
/**
|
|
132
|
-
* - Metadata about files associated with
|
|
133
|
-
* the job, if any.
|
|
134
|
-
*/
|
|
135
|
-
file_metadata?: any[];
|
|
136
|
-
};
|