@gofynd/fdk-client-javascript 1.4.6 → 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 -0
- package/sdk/application/ApplicationClient.js +2 -0
- 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/Order/OrderApplicationModel.d.ts +70 -9
- package/sdk/application/Order/OrderApplicationModel.js +43 -7
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +18 -18
- package/sdk/application/Payment/PaymentApplicationModel.js +18 -18
- 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 -0
- package/sdk/application/index.js +2 -0
- 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 +19 -22
- 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 +9 -5
- package/sdk/platform/Catalog/CatalogPlatformClient.js +19 -12
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +118 -17
- package/sdk/platform/Catalog/CatalogPlatformModel.js +137 -15
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +12 -7
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +7 -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 +92 -14
- 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 +2 -2
- 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 +75 -22
- 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 +2 -0
|
@@ -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;
|
|
@@ -0,0 +1,60 @@
|
|
|
1
|
+
export = AnalyticsPlatformModel;
|
|
2
|
+
/**
|
|
3
|
+
* @typedef Page
|
|
4
|
+
* @property {number} [item_total]
|
|
5
|
+
* @property {string} [next_id]
|
|
6
|
+
* @property {boolean} [has_previous]
|
|
7
|
+
* @property {boolean} [has_next]
|
|
8
|
+
* @property {number} [current]
|
|
9
|
+
* @property {string} type
|
|
10
|
+
* @property {number} [size]
|
|
11
|
+
*/
|
|
12
|
+
/**
|
|
13
|
+
* @typedef FileDownloadRequestBody
|
|
14
|
+
* @property {string} query - Base64 encoded query to execute on clickhouse.
|
|
15
|
+
* @property {boolean} [split_files] - Flag to indicate whether to split files
|
|
16
|
+
* for larger data.
|
|
17
|
+
*/
|
|
18
|
+
/**
|
|
19
|
+
* @typedef JobExecute
|
|
20
|
+
* @property {string} query - Base64 encoded query to execute on clickhouse.
|
|
21
|
+
* @property {Page} [page]
|
|
22
|
+
*/
|
|
23
|
+
declare class AnalyticsPlatformModel {
|
|
24
|
+
}
|
|
25
|
+
declare namespace AnalyticsPlatformModel {
|
|
26
|
+
export { Page, FileDownloadRequestBody, JobExecute };
|
|
27
|
+
}
|
|
28
|
+
/** @returns {Page} */
|
|
29
|
+
declare function Page(): Page;
|
|
30
|
+
type Page = {
|
|
31
|
+
item_total?: number;
|
|
32
|
+
next_id?: string;
|
|
33
|
+
has_previous?: boolean;
|
|
34
|
+
has_next?: boolean;
|
|
35
|
+
current?: number;
|
|
36
|
+
type: string;
|
|
37
|
+
size?: number;
|
|
38
|
+
};
|
|
39
|
+
/** @returns {FileDownloadRequestBody} */
|
|
40
|
+
declare function FileDownloadRequestBody(): FileDownloadRequestBody;
|
|
41
|
+
type FileDownloadRequestBody = {
|
|
42
|
+
/**
|
|
43
|
+
* - Base64 encoded query to execute on clickhouse.
|
|
44
|
+
*/
|
|
45
|
+
query: string;
|
|
46
|
+
/**
|
|
47
|
+
* - Flag to indicate whether to split files
|
|
48
|
+
* for larger data.
|
|
49
|
+
*/
|
|
50
|
+
split_files?: boolean;
|
|
51
|
+
};
|
|
52
|
+
/** @returns {JobExecute} */
|
|
53
|
+
declare function JobExecute(): JobExecute;
|
|
54
|
+
type JobExecute = {
|
|
55
|
+
/**
|
|
56
|
+
* - Base64 encoded query to execute on clickhouse.
|
|
57
|
+
*/
|
|
58
|
+
query: string;
|
|
59
|
+
page?: Page;
|
|
60
|
+
};
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
const Joi = require("joi");
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* @typedef Page
|
|
5
|
+
* @property {number} [item_total]
|
|
6
|
+
* @property {string} [next_id]
|
|
7
|
+
* @property {boolean} [has_previous]
|
|
8
|
+
* @property {boolean} [has_next]
|
|
9
|
+
* @property {number} [current]
|
|
10
|
+
* @property {string} type
|
|
11
|
+
* @property {number} [size]
|
|
12
|
+
*/
|
|
13
|
+
|
|
14
|
+
/**
|
|
15
|
+
* @typedef FileDownloadRequestBody
|
|
16
|
+
* @property {string} query - Base64 encoded query to execute on clickhouse.
|
|
17
|
+
* @property {boolean} [split_files] - Flag to indicate whether to split files
|
|
18
|
+
* for larger data.
|
|
19
|
+
*/
|
|
20
|
+
|
|
21
|
+
/**
|
|
22
|
+
* @typedef JobExecute
|
|
23
|
+
* @property {string} query - Base64 encoded query to execute on clickhouse.
|
|
24
|
+
* @property {Page} [page]
|
|
25
|
+
*/
|
|
26
|
+
|
|
27
|
+
class AnalyticsPlatformModel {
|
|
28
|
+
/** @returns {Page} */
|
|
29
|
+
static Page() {
|
|
30
|
+
return Joi.object({
|
|
31
|
+
item_total: Joi.number(),
|
|
32
|
+
next_id: Joi.string().allow(""),
|
|
33
|
+
has_previous: Joi.boolean(),
|
|
34
|
+
has_next: Joi.boolean(),
|
|
35
|
+
current: Joi.number(),
|
|
36
|
+
type: Joi.string().allow("").required(),
|
|
37
|
+
size: Joi.number(),
|
|
38
|
+
});
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
/** @returns {FileDownloadRequestBody} */
|
|
42
|
+
static FileDownloadRequestBody() {
|
|
43
|
+
return Joi.object({
|
|
44
|
+
query: Joi.string().allow("").required(),
|
|
45
|
+
split_files: Joi.boolean(),
|
|
46
|
+
});
|
|
47
|
+
}
|
|
48
|
+
|
|
49
|
+
/** @returns {JobExecute} */
|
|
50
|
+
static JobExecute() {
|
|
51
|
+
return Joi.object({
|
|
52
|
+
query: Joi.string().allow("").required(),
|
|
53
|
+
page: AnalyticsPlatformModel.Page(),
|
|
54
|
+
});
|
|
55
|
+
}
|
|
56
|
+
}
|
|
57
|
+
module.exports = AnalyticsPlatformModel;
|
|
@@ -288,6 +288,16 @@ declare class Cart {
|
|
|
288
288
|
* @description: Retrieve the total count of items currently present in the customer's cart. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/cart/getItemCount/).
|
|
289
289
|
*/
|
|
290
290
|
getItemCount({ id, buyNow, requestHeaders }?: CartPlatformApplicationValidator.GetItemCountParam, { responseHeaders }?: object): Promise<CartPlatformModel.CartItemCountResponse>;
|
|
291
|
+
/**
|
|
292
|
+
* @param {CartPlatformApplicationValidator.GetPriceAdjustmentsParam} arg - Arg object
|
|
293
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
294
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
295
|
+
* @returns {Promise<CartPlatformModel.PriceAdjustmentResponse>} - Success response
|
|
296
|
+
* @name getPriceAdjustments
|
|
297
|
+
* @summary: Get a list of all price adjustments associated with a cart
|
|
298
|
+
* @description: This API helps to get price adjustments data associated to a particular cart - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/cart/getPriceAdjustments/).
|
|
299
|
+
*/
|
|
300
|
+
getPriceAdjustments({ cartId, requestHeaders }?: CartPlatformApplicationValidator.GetPriceAdjustmentsParam, { responseHeaders }?: object): Promise<CartPlatformModel.PriceAdjustmentResponse>;
|
|
291
301
|
/**
|
|
292
302
|
* @param {CartPlatformApplicationValidator.GetPromosCouponConfigParam} arg
|
|
293
303
|
* - Arg object
|
|
@@ -2321,6 +2321,86 @@ class Cart {
|
|
|
2321
2321
|
return response;
|
|
2322
2322
|
}
|
|
2323
2323
|
|
|
2324
|
+
/**
|
|
2325
|
+
* @param {CartPlatformApplicationValidator.GetPriceAdjustmentsParam} arg - Arg object
|
|
2326
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2327
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2328
|
+
* @returns {Promise<CartPlatformModel.PriceAdjustmentResponse>} - Success response
|
|
2329
|
+
* @name getPriceAdjustments
|
|
2330
|
+
* @summary: Get a list of all price adjustments associated with a cart
|
|
2331
|
+
* @description: This API helps to get price adjustments data associated to a particular cart - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/cart/getPriceAdjustments/).
|
|
2332
|
+
*/
|
|
2333
|
+
async getPriceAdjustments(
|
|
2334
|
+
{ cartId, requestHeaders } = { requestHeaders: {} },
|
|
2335
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2336
|
+
) {
|
|
2337
|
+
const {
|
|
2338
|
+
error,
|
|
2339
|
+
} = CartPlatformApplicationValidator.getPriceAdjustments().validate(
|
|
2340
|
+
{
|
|
2341
|
+
cartId,
|
|
2342
|
+
},
|
|
2343
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2344
|
+
);
|
|
2345
|
+
if (error) {
|
|
2346
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2347
|
+
}
|
|
2348
|
+
|
|
2349
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2350
|
+
const {
|
|
2351
|
+
error: warrning,
|
|
2352
|
+
} = CartPlatformApplicationValidator.getPriceAdjustments().validate(
|
|
2353
|
+
{
|
|
2354
|
+
cartId,
|
|
2355
|
+
},
|
|
2356
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2357
|
+
);
|
|
2358
|
+
if (warrning) {
|
|
2359
|
+
Logger({
|
|
2360
|
+
level: "WARN",
|
|
2361
|
+
message: `Parameter Validation warrnings for platform > Cart > getPriceAdjustments \n ${warrning}`,
|
|
2362
|
+
});
|
|
2363
|
+
}
|
|
2364
|
+
|
|
2365
|
+
const query_params = {};
|
|
2366
|
+
query_params["cart_id"] = cartId;
|
|
2367
|
+
|
|
2368
|
+
const response = await PlatformAPIClient.execute(
|
|
2369
|
+
this.config,
|
|
2370
|
+
"get",
|
|
2371
|
+
`/service/platform/cart/v1.0/company/${this.config.companyId}/application/${this.applicationId}/price-adjustment`,
|
|
2372
|
+
query_params,
|
|
2373
|
+
undefined,
|
|
2374
|
+
requestHeaders,
|
|
2375
|
+
{ responseHeaders }
|
|
2376
|
+
);
|
|
2377
|
+
|
|
2378
|
+
let responseData = response;
|
|
2379
|
+
if (responseHeaders) {
|
|
2380
|
+
responseData = response[0];
|
|
2381
|
+
}
|
|
2382
|
+
|
|
2383
|
+
const {
|
|
2384
|
+
error: res_error,
|
|
2385
|
+
} = CartPlatformModel.PriceAdjustmentResponse().validate(responseData, {
|
|
2386
|
+
abortEarly: false,
|
|
2387
|
+
allowUnknown: true,
|
|
2388
|
+
});
|
|
2389
|
+
|
|
2390
|
+
if (res_error) {
|
|
2391
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
2392
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2393
|
+
} else {
|
|
2394
|
+
Logger({
|
|
2395
|
+
level: "WARN",
|
|
2396
|
+
message: `Response Validation Warnings for platform > Cart > getPriceAdjustments \n ${res_error}`,
|
|
2397
|
+
});
|
|
2398
|
+
}
|
|
2399
|
+
}
|
|
2400
|
+
|
|
2401
|
+
return response;
|
|
2402
|
+
}
|
|
2403
|
+
|
|
2324
2404
|
/**
|
|
2325
2405
|
* @param {CartPlatformApplicationValidator.GetPromosCouponConfigParam} arg
|
|
2326
2406
|
* - Arg object
|
|
@@ -153,6 +153,10 @@ export = CartPlatformApplicationValidator;
|
|
|
153
153
|
* @property {string} [id] - The unique identifier of the cart.
|
|
154
154
|
* @property {boolean} [buyNow] - Boolean value to get buy_now cart.
|
|
155
155
|
*/
|
|
156
|
+
/**
|
|
157
|
+
* @typedef GetPriceAdjustmentsParam
|
|
158
|
+
* @property {string} cartId - Cart Id
|
|
159
|
+
*/
|
|
156
160
|
/**
|
|
157
161
|
* @typedef GetPromosCouponConfigParam
|
|
158
162
|
* @property {string} [entityType] - Entity_type as promotion or coupon
|
|
@@ -410,6 +414,8 @@ declare class CartPlatformApplicationValidator {
|
|
|
410
414
|
static getCoupons(): GetCouponsParam;
|
|
411
415
|
/** @returns {GetItemCountParam} */
|
|
412
416
|
static getItemCount(): GetItemCountParam;
|
|
417
|
+
/** @returns {GetPriceAdjustmentsParam} */
|
|
418
|
+
static getPriceAdjustments(): GetPriceAdjustmentsParam;
|
|
413
419
|
/** @returns {GetPromosCouponConfigParam} */
|
|
414
420
|
static getPromosCouponConfig(): GetPromosCouponConfigParam;
|
|
415
421
|
/** @returns {GetPromotionByIdParam} */
|
|
@@ -472,7 +478,7 @@ declare class CartPlatformApplicationValidator {
|
|
|
472
478
|
static validateCouponForPayment(): ValidateCouponForPaymentParam;
|
|
473
479
|
}
|
|
474
480
|
declare namespace CartPlatformApplicationValidator {
|
|
475
|
-
export { AddAddressParam, AddItemsParam, AddPriceAdjustmentParam, ApplyCouponParam, CheckCartServiceabilityParam, CheckoutCartParam, CreateCartMetaConfigParam, CreateCouponParam, CreatePromotionParam, DeleteCartParam, FetchAndvalidateCartItemsParam, FetchCartMetaConfigParam, GetAbandonedCartParam, GetAbandonedCartDetailsParam, GetAddressByIdParam, GetAddressesParam, GetAppCouponsParam, GetAvailableDeliveryModesParam, GetCartParam, GetCartListParam, GetCartShareLinkParam, GetCartSharedItemsParam, GetCouponByIdParam, GetCouponCodeExistsParam, GetCouponOptionValuesParam, GetCouponsParam, GetItemCountParam, GetPromosCouponConfigParam, GetPromotionByIdParam, GetPromotionCodeExistsParam, GetPromotionsParam, GetShipmentsParam, GetStoreAddressByUidParam, OverrideCartParam, PlatformAddItemsParam, PlatformCheckoutCartParam, PlatformCheckoutCartV2Param, PlatformUpdateCartParam, RemoveAddressParam, RemoveCouponParam, RemovePriceAdjustmentParam, SelectAddressParam, SelectPaymentModeParam, SelectPaymentModeV2Param, UpdateAddressParam, UpdateCartParam, UpdateCartMetaParam, UpdateCartMetaConfigParam, UpdateCartUserParam, UpdateCartWithSharedItemsParam, UpdateCouponParam, UpdateCouponPartiallyParam, UpdatePriceAdjustmentParam, UpdatePromotionParam, UpdatePromotionPartiallyParam, UpdateShipmentsParam, ValidateCouponForPaymentParam };
|
|
481
|
+
export { AddAddressParam, AddItemsParam, AddPriceAdjustmentParam, ApplyCouponParam, CheckCartServiceabilityParam, CheckoutCartParam, CreateCartMetaConfigParam, CreateCouponParam, CreatePromotionParam, DeleteCartParam, FetchAndvalidateCartItemsParam, FetchCartMetaConfigParam, GetAbandonedCartParam, GetAbandonedCartDetailsParam, GetAddressByIdParam, GetAddressesParam, GetAppCouponsParam, GetAvailableDeliveryModesParam, GetCartParam, GetCartListParam, GetCartShareLinkParam, GetCartSharedItemsParam, GetCouponByIdParam, GetCouponCodeExistsParam, GetCouponOptionValuesParam, GetCouponsParam, GetItemCountParam, GetPriceAdjustmentsParam, GetPromosCouponConfigParam, GetPromotionByIdParam, GetPromotionCodeExistsParam, GetPromotionsParam, GetShipmentsParam, GetStoreAddressByUidParam, OverrideCartParam, PlatformAddItemsParam, PlatformCheckoutCartParam, PlatformCheckoutCartV2Param, PlatformUpdateCartParam, RemoveAddressParam, RemoveCouponParam, RemovePriceAdjustmentParam, SelectAddressParam, SelectPaymentModeParam, SelectPaymentModeV2Param, UpdateAddressParam, UpdateCartParam, UpdateCartMetaParam, UpdateCartMetaConfigParam, UpdateCartUserParam, UpdateCartWithSharedItemsParam, UpdateCouponParam, UpdateCouponPartiallyParam, UpdatePriceAdjustmentParam, UpdatePromotionParam, UpdatePromotionPartiallyParam, UpdateShipmentsParam, ValidateCouponForPaymentParam };
|
|
476
482
|
}
|
|
477
483
|
type AddAddressParam = {
|
|
478
484
|
body: CartPlatformModel.PlatformAddress;
|
|
@@ -634,6 +640,12 @@ type GetItemCountParam = {
|
|
|
634
640
|
*/
|
|
635
641
|
buyNow?: boolean;
|
|
636
642
|
};
|
|
643
|
+
type GetPriceAdjustmentsParam = {
|
|
644
|
+
/**
|
|
645
|
+
* - Cart Id
|
|
646
|
+
*/
|
|
647
|
+
cartId: string;
|
|
648
|
+
};
|
|
637
649
|
type GetPromosCouponConfigParam = {
|
|
638
650
|
/**
|
|
639
651
|
* - Entity_type as promotion or coupon
|
|
@@ -183,6 +183,11 @@ const CartPlatformModel = require("./CartPlatformModel");
|
|
|
183
183
|
* @property {boolean} [buyNow] - Boolean value to get buy_now cart.
|
|
184
184
|
*/
|
|
185
185
|
|
|
186
|
+
/**
|
|
187
|
+
* @typedef GetPriceAdjustmentsParam
|
|
188
|
+
* @property {string} cartId - Cart Id
|
|
189
|
+
*/
|
|
190
|
+
|
|
186
191
|
/**
|
|
187
192
|
* @typedef GetPromosCouponConfigParam
|
|
188
193
|
* @property {string} [entityType] - Entity_type as promotion or coupon
|
|
@@ -650,6 +655,13 @@ class CartPlatformApplicationValidator {
|
|
|
650
655
|
}).required();
|
|
651
656
|
}
|
|
652
657
|
|
|
658
|
+
/** @returns {GetPriceAdjustmentsParam} */
|
|
659
|
+
static getPriceAdjustments() {
|
|
660
|
+
return Joi.object({
|
|
661
|
+
cartId: Joi.string().allow("").required(),
|
|
662
|
+
}).required();
|
|
663
|
+
}
|
|
664
|
+
|
|
653
665
|
/** @returns {GetPromosCouponConfigParam} */
|
|
654
666
|
static getPromosCouponConfig() {
|
|
655
667
|
return Joi.object({
|
|
@@ -1204,6 +1204,7 @@ export = CartPlatformModel;
|
|
|
1204
1204
|
* @property {string} currency_code
|
|
1205
1205
|
* @property {string} aggregator
|
|
1206
1206
|
* @property {string} order_type
|
|
1207
|
+
* @property {string} [callback_url]
|
|
1207
1208
|
* @property {OverrideCartItem[]} cart_items
|
|
1208
1209
|
* @property {number} [ordering_store]
|
|
1209
1210
|
* @property {Object} [shipping_address]
|
|
@@ -3420,6 +3421,7 @@ type OverrideCheckoutReq = {
|
|
|
3420
3421
|
currency_code: string;
|
|
3421
3422
|
aggregator: string;
|
|
3422
3423
|
order_type: string;
|
|
3424
|
+
callback_url?: string;
|
|
3423
3425
|
cart_items: OverrideCartItem[];
|
|
3424
3426
|
ordering_store?: number;
|
|
3425
3427
|
shipping_address?: any;
|
|
@@ -1333,6 +1333,7 @@ const Joi = require("joi");
|
|
|
1333
1333
|
* @property {string} currency_code
|
|
1334
1334
|
* @property {string} aggregator
|
|
1335
1335
|
* @property {string} order_type
|
|
1336
|
+
* @property {string} [callback_url]
|
|
1336
1337
|
* @property {OverrideCartItem[]} cart_items
|
|
1337
1338
|
* @property {number} [ordering_store]
|
|
1338
1339
|
* @property {Object} [shipping_address]
|
|
@@ -3501,6 +3502,7 @@ class CartPlatformModel {
|
|
|
3501
3502
|
currency_code: Joi.string().allow("").required(),
|
|
3502
3503
|
aggregator: Joi.string().allow("").required(),
|
|
3503
3504
|
order_type: Joi.string().allow("").required(),
|
|
3505
|
+
callback_url: Joi.string().allow(""),
|
|
3504
3506
|
cart_items: Joi.array()
|
|
3505
3507
|
.items(CartPlatformModel.OverrideCartItem())
|
|
3506
3508
|
.required(),
|