@gofynd/fdk-client-javascript 3.26.0 → 3.28.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.
Files changed (42) hide show
  1. package/README.md +1 -1
  2. package/package.json +1 -1
  3. package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +4 -2
  4. package/sdk/application/Configuration/ConfigurationApplicationClient.js +5 -0
  5. package/sdk/application/Payment/PaymentApplicationClient.d.ts +11 -1
  6. package/sdk/application/Payment/PaymentApplicationClient.js +50 -0
  7. package/sdk/platform/Cart/CartPlatformModel.d.ts +61 -1
  8. package/sdk/platform/Cart/CartPlatformModel.js +40 -0
  9. package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +10 -0
  10. package/sdk/platform/Catalog/CatalogPlatformClient.js +75 -0
  11. package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +203 -1
  12. package/sdk/platform/Catalog/CatalogPlatformModel.js +103 -0
  13. package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +5 -1
  14. package/sdk/platform/Catalog/CatalogPlatformValidator.js +7 -0
  15. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -0
  16. package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +52 -0
  17. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +20 -0
  18. package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +41 -0
  19. package/sdk/platform/Lead/LeadPlatformModel.d.ts +30 -1
  20. package/sdk/platform/Lead/LeadPlatformModel.js +19 -0
  21. package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -0
  22. package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +163 -0
  23. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +27 -1
  24. package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +26 -0
  25. package/sdk/platform/Payment/PaymentPlatformModel.d.ts +106 -1
  26. package/sdk/platform/Payment/PaymentPlatformModel.js +79 -0
  27. package/sdk/platform/PlatformApplicationClient.d.ts +0 -2
  28. package/sdk/platform/PlatformApplicationClient.js +0 -4
  29. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +14 -0
  30. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +83 -0
  31. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +10 -1
  32. package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +12 -0
  33. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +121 -1
  34. package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +112 -0
  35. package/sdk/platform/index.d.ts +0 -1
  36. package/sdk/platform/index.js +0 -2
  37. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +0 -44
  38. package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +0 -263
  39. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +0 -42
  40. package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +0 -45
  41. package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +0 -136
  42. package/sdk/platform/Analytics/AnalyticsPlatformModel.js +0 -95
@@ -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
- };
@@ -1,95 +0,0 @@
1
- const Joi = require("joi");
2
-
3
- /**
4
- * @typedef Page
5
- * @property {number} [item_total] - The total number of all items across all pages.
6
- * @property {string} [next_id] - The identifier for the next page.
7
- * @property {boolean} [has_previous] - Indicates whether there is a previous page.
8
- * @property {boolean} [has_next] - Indicates whether there is a next page.
9
- * @property {number} [current] - The current page number.
10
- * @property {string} type - The type of the page, can be 'cursor' or 'number'.
11
- * @property {number} [size] - The number of items per page.
12
- * @property {number} [page_size] - The number of items per page.
13
- */
14
-
15
- /**
16
- * @typedef FileDownloadRequestBody
17
- * @property {string} query - Base64 encoded SQL query to execute on ClickHouse.
18
- * @property {boolean} [split_files] - Flag indicating whether to split the
19
- * files for larger datasets.
20
- */
21
-
22
- /**
23
- * @typedef JobExecute
24
- * @property {string} query - Base64 encoded SQL query to execute on ClickHouse.
25
- * @property {Page} [page]
26
- */
27
-
28
- /**
29
- * @typedef JobExecutionResult
30
- * @property {Object[]} [rows] - Array of rows resulting from the job execution.
31
- * @property {Page} [page]
32
- */
33
-
34
- /**
35
- * @typedef JobStatus
36
- * @property {string} [start_date] - The start date and time of the job.
37
- * @property {string} [end_date] - The end date and time of the job.
38
- * @property {string} [status] - The current status of the job.
39
- * @property {string} [message] - Message providing additional details about the
40
- * job status.
41
- * @property {Object[]} [file_metadata] - Metadata about files associated with
42
- * the job, if any.
43
- */
44
-
45
- class AnalyticsPlatformModel {
46
- /** @returns {Page} */
47
- static Page() {
48
- return Joi.object({
49
- item_total: Joi.number(),
50
- next_id: Joi.string().allow(""),
51
- has_previous: Joi.boolean(),
52
- has_next: Joi.boolean(),
53
- current: Joi.number(),
54
- type: Joi.string().allow("").required(),
55
- size: Joi.number(),
56
- page_size: Joi.number(),
57
- });
58
- }
59
-
60
- /** @returns {FileDownloadRequestBody} */
61
- static FileDownloadRequestBody() {
62
- return Joi.object({
63
- query: Joi.string().allow("").required(),
64
- split_files: Joi.boolean(),
65
- });
66
- }
67
-
68
- /** @returns {JobExecute} */
69
- static JobExecute() {
70
- return Joi.object({
71
- query: Joi.string().allow("").required(),
72
- page: AnalyticsPlatformModel.Page(),
73
- });
74
- }
75
-
76
- /** @returns {JobExecutionResult} */
77
- static JobExecutionResult() {
78
- return Joi.object({
79
- rows: Joi.array().items(Joi.any()),
80
- page: AnalyticsPlatformModel.Page(),
81
- });
82
- }
83
-
84
- /** @returns {JobStatus} */
85
- static JobStatus() {
86
- return Joi.object({
87
- start_date: Joi.string().allow(""),
88
- end_date: Joi.string().allow("").allow(null),
89
- status: Joi.string().allow(""),
90
- message: Joi.string().allow(""),
91
- file_metadata: Joi.array().items(Joi.any()).allow(null, ""),
92
- });
93
- }
94
- }
95
- module.exports = AnalyticsPlatformModel;