@gofynd/fdk-client-javascript 1.0.0 → 1.0.2
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/documentation/application/CART.md +251 -251
- package/documentation/application/CATALOG.md +393 -393
- package/documentation/application/CONTENT.md +15 -1
- package/documentation/application/ORDER.md +268 -268
- package/documentation/application/PAYMENT.md +249 -249
- package/documentation/application/POSCART.md +297 -297
- package/documentation/platform/CART.md +499 -499
- package/documentation/platform/CATALOG.md +3497 -3097
- package/documentation/platform/COMPANYPROFILE.md +207 -207
- package/documentation/platform/CONTENT.md +123 -1
- package/documentation/platform/ORDER.md +1518 -1324
- package/documentation/platform/PARTNER.md +7 -7
- package/documentation/platform/PAYMENT.md +96 -96
- package/index.js +7 -1
- package/package.json +1 -1
- package/sdk/application/ApplicationConfig.js +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +865 -52
- package/sdk/application/Cart/CartApplicationModel.d.ts +7 -7
- package/sdk/application/Cart/CartApplicationModel.js +335 -335
- package/sdk/application/Cart/CartApplicationValidator.js +1 -0
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +1 -1
- package/sdk/application/Catalog/CatalogApplicationClient.js +1034 -60
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +19 -19
- package/sdk/application/Catalog/CatalogApplicationModel.js +532 -532
- package/sdk/application/Catalog/CatalogApplicationValidator.js +1 -0
- package/sdk/application/Common/CommonApplicationClient.js +66 -4
- package/sdk/application/Common/CommonApplicationValidator.js +1 -0
- package/sdk/application/Communication/CommunicationApplicationClient.js +108 -6
- package/sdk/application/Communication/CommunicationApplicationValidator.js +1 -0
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +1 -1
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +558 -32
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +1 -0
- package/sdk/application/Content/ContentApplicationClient.js +621 -38
- package/sdk/application/Content/ContentApplicationModel.d.ts +1 -0
- package/sdk/application/Content/ContentApplicationModel.js +11 -1
- package/sdk/application/Content/ContentApplicationValidator.js +1 -0
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +101 -6
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +1 -0
- package/sdk/application/Lead/LeadApplicationClient.js +229 -14
- package/sdk/application/Lead/LeadApplicationValidator.js +1 -0
- package/sdk/application/Logistic/LogisticApplicationClient.js +134 -8
- package/sdk/application/Logistic/LogisticApplicationValidator.js +1 -0
- package/sdk/application/Order/OrderApplicationClient.d.ts +1 -1
- package/sdk/application/Order/OrderApplicationClient.js +403 -24
- package/sdk/application/Order/OrderApplicationModel.d.ts +20 -20
- package/sdk/application/Order/OrderApplicationModel.js +334 -334
- package/sdk/application/Order/OrderApplicationValidator.js +1 -0
- package/sdk/application/Payment/PaymentApplicationClient.js +1381 -78
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +2 -2
- package/sdk/application/Payment/PaymentApplicationModel.js +350 -350
- package/sdk/application/Payment/PaymentApplicationValidator.js +1 -0
- package/sdk/application/PosCart/PosCartApplicationClient.js +914 -54
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +15 -15
- package/sdk/application/PosCart/PosCartApplicationModel.js +389 -389
- package/sdk/application/PosCart/PosCartApplicationValidator.js +1 -0
- package/sdk/application/Rewards/RewardsApplicationClient.js +235 -14
- package/sdk/application/Rewards/RewardsApplicationValidator.js +1 -0
- package/sdk/application/Share/ShareApplicationClient.js +226 -14
- package/sdk/application/Share/ShareApplicationValidator.js +1 -0
- package/sdk/application/Theme/ThemeApplicationClient.js +130 -8
- package/sdk/application/Theme/ThemeApplicationValidator.js +1 -0
- package/sdk/application/User/UserApplicationClient.js +1133 -70
- package/sdk/application/User/UserApplicationValidator.js +1 -0
- package/sdk/common/AxiosHelper.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +16 -8
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +287 -16
- package/sdk/platform/Analytics/AnalyticsPlatformClient.d.ts +8 -4
- package/sdk/platform/Analytics/AnalyticsPlatformClient.js +153 -8
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +141 -8
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +24 -12
- package/sdk/platform/Billing/BillingPlatformClient.js +429 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +34 -17
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +617 -34
- package/sdk/platform/Cart/CartPlatformModel.d.ts +35 -35
- package/sdk/platform/Cart/CartPlatformModel.js +617 -617
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +191 -138
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +2202 -302
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +11 -11
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +45 -45
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +344 -226
- package/sdk/platform/Catalog/CatalogPlatformClient.js +3282 -488
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +110 -100
- package/sdk/platform/Catalog/CatalogPlatformModel.js +2073 -1795
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +23 -21
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +103 -84
- package/sdk/platform/Common/CommonPlatformClient.d.ts +4 -2
- package/sdk/platform/Common/CommonPlatformClient.js +73 -4
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -40
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +1499 -80
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +41 -2
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +27 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +486 -26
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +9 -9
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +274 -274
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +56 -28
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +1022 -56
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +693 -36
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +148 -67
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +2446 -140
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -0
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Content/ContentPlatformModel.d.ts +4 -0
- package/sdk/platform/Content/ContentPlatformModel.js +43 -1
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +21 -10
- package/sdk/platform/Discount/DiscountPlatformClient.js +400 -22
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +148 -8
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +12 -6
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +214 -12
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +27 -14
- package/sdk/platform/Inventory/InventoryPlatformClient.js +449 -24
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +447 -26
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +22 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +384 -22
- package/sdk/platform/OAuthClient.js +8 -8
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +6 -3
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +125 -6
- package/sdk/platform/Order/OrderPlatformClient.d.ts +108 -47
- package/sdk/platform/Order/OrderPlatformClient.js +1641 -100
- package/sdk/platform/Order/OrderPlatformModel.d.ts +69 -58
- package/sdk/platform/Order/OrderPlatformModel.js +1485 -1493
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +2 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +15 -4
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +74 -4
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -1
- package/sdk/platform/Partner/PartnerPlatformModel.js +8 -8
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +22 -11
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +418 -22
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +21 -11
- package/sdk/platform/Payment/PaymentPlatformClient.js +374 -20
- package/sdk/platform/Payment/PaymentPlatformModel.js +139 -139
- package/sdk/platform/PlatformApplicationClient.d.ts +2973 -2827
- package/sdk/platform/PlatformApplicationClient.js +3461 -3263
- package/sdk/platform/PlatformClient.d.ts +2973 -2827
- package/sdk/platform/PlatformClient.js +3461 -3263
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +26 -13
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +449 -26
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +8 -4
- package/sdk/platform/Share/SharePlatformApplicationClient.js +139 -8
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +47 -23
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +816 -48
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +24 -12
- package/sdk/platform/User/UserPlatformApplicationClient.js +417 -24
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +12 -6
- package/sdk/platform/Webhook/WebhookPlatformClient.js +229 -12
- package/sdk/public/Configuration/ConfigurationPublicClient.js +72 -4
- package/sdk/public/Configuration/ConfigurationPublicValidator.js +3 -1
- package/sdk/public/Inventory/InventoryPublicClient.js +210 -12
- package/sdk/public/Inventory/InventoryPublicValidator.js +3 -1
- package/sdk/public/Webhook/WebhookPublicClient.js +74 -4
- package/sdk/public/Webhook/WebhookPublicValidator.js +3 -1
|
@@ -2,6 +2,9 @@ const Paginator = require("../../common/Paginator");
|
|
|
2
2
|
const { FDKClientValidationError } = require("../../common/FDKError");
|
|
3
3
|
const PlatformAPIClient = require("../PlatformAPIClient");
|
|
4
4
|
const CompanyProfileValidator = require("./CompanyProfilePlatformValidator");
|
|
5
|
+
const CompanyProfileModel = require("./CompanyProfilePlatformModel");
|
|
6
|
+
const { Logger } = require("./../../common/Logger");
|
|
7
|
+
|
|
5
8
|
class CompanyProfile {
|
|
6
9
|
constructor(config) {
|
|
7
10
|
this.config = config;
|
|
@@ -9,10 +12,11 @@ class CompanyProfile {
|
|
|
9
12
|
|
|
10
13
|
/**
|
|
11
14
|
* @param {Object} arg - Arg object.
|
|
15
|
+
* @returns {Promise<GetCompanyProfileSerializerResponse>} - Success response
|
|
12
16
|
* @summary: Get company profile
|
|
13
17
|
* @description: This API allows to view the company profile of the seller account.
|
|
14
18
|
*/
|
|
15
|
-
cbsOnboardGet({} = {}) {
|
|
19
|
+
async cbsOnboardGet({} = {}) {
|
|
16
20
|
const { error } = CompanyProfileValidator.cbsOnboardGet().validate(
|
|
17
21
|
{},
|
|
18
22
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -21,11 +25,26 @@ class CompanyProfile {
|
|
|
21
25
|
return Promise.reject(new FDKClientValidationError(error));
|
|
22
26
|
}
|
|
23
27
|
|
|
28
|
+
// Showing warrnings if extra unknown parameters are found
|
|
29
|
+
const {
|
|
30
|
+
error: warrning,
|
|
31
|
+
} = CompanyProfileValidator.cbsOnboardGet().validate(
|
|
32
|
+
{},
|
|
33
|
+
{ abortEarly: false, allowUnknown: false }
|
|
34
|
+
);
|
|
35
|
+
if (warrning) {
|
|
36
|
+
Logger({
|
|
37
|
+
level: "WARN",
|
|
38
|
+
message: "Parameter Validation warrnings for cbsOnboardGet",
|
|
39
|
+
});
|
|
40
|
+
Logger({ level: "WARN", message: warrning });
|
|
41
|
+
}
|
|
42
|
+
|
|
24
43
|
const query_params = {};
|
|
25
44
|
|
|
26
45
|
const xHeaders = {};
|
|
27
46
|
|
|
28
|
-
|
|
47
|
+
const response = await PlatformAPIClient.execute(
|
|
29
48
|
this.config,
|
|
30
49
|
"get",
|
|
31
50
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}`,
|
|
@@ -33,15 +52,33 @@ class CompanyProfile {
|
|
|
33
52
|
undefined,
|
|
34
53
|
xHeaders
|
|
35
54
|
);
|
|
55
|
+
|
|
56
|
+
const {
|
|
57
|
+
error: res_error,
|
|
58
|
+
} = CompanyProfileModel.GetCompanyProfileSerializerResponse().validate(
|
|
59
|
+
response,
|
|
60
|
+
{ abortEarly: false, allowUnknown: false }
|
|
61
|
+
);
|
|
62
|
+
|
|
63
|
+
if (res_error) {
|
|
64
|
+
Logger({
|
|
65
|
+
level: "WARN",
|
|
66
|
+
message: "Response Validation Warnnings for cbsOnboardGet",
|
|
67
|
+
});
|
|
68
|
+
Logger({ level: "WARN", message: res_error });
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
return response;
|
|
36
72
|
}
|
|
37
73
|
|
|
38
74
|
/**
|
|
39
75
|
* @param {Object} arg - Arg object.
|
|
40
76
|
* @param {UpdateCompany} arg.body
|
|
77
|
+
* @returns {Promise<ProfileSuccessResponse>} - Success response
|
|
41
78
|
* @summary: Edit company profile
|
|
42
79
|
* @description: This API allows to edit the company profile of the seller account.
|
|
43
80
|
*/
|
|
44
|
-
updateCompany({ body } = {}) {
|
|
81
|
+
async updateCompany({ body } = {}) {
|
|
45
82
|
const { error } = CompanyProfileValidator.updateCompany().validate(
|
|
46
83
|
{
|
|
47
84
|
body,
|
|
@@ -52,11 +89,28 @@ class CompanyProfile {
|
|
|
52
89
|
return Promise.reject(new FDKClientValidationError(error));
|
|
53
90
|
}
|
|
54
91
|
|
|
92
|
+
// Showing warrnings if extra unknown parameters are found
|
|
93
|
+
const {
|
|
94
|
+
error: warrning,
|
|
95
|
+
} = CompanyProfileValidator.updateCompany().validate(
|
|
96
|
+
{
|
|
97
|
+
body,
|
|
98
|
+
},
|
|
99
|
+
{ abortEarly: false, allowUnknown: false }
|
|
100
|
+
);
|
|
101
|
+
if (warrning) {
|
|
102
|
+
Logger({
|
|
103
|
+
level: "WARN",
|
|
104
|
+
message: "Parameter Validation warrnings for updateCompany",
|
|
105
|
+
});
|
|
106
|
+
Logger({ level: "WARN", message: warrning });
|
|
107
|
+
}
|
|
108
|
+
|
|
55
109
|
const query_params = {};
|
|
56
110
|
|
|
57
111
|
const xHeaders = {};
|
|
58
112
|
|
|
59
|
-
|
|
113
|
+
const response = await PlatformAPIClient.execute(
|
|
60
114
|
this.config,
|
|
61
115
|
"patch",
|
|
62
116
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}`,
|
|
@@ -64,14 +118,32 @@ class CompanyProfile {
|
|
|
64
118
|
body,
|
|
65
119
|
xHeaders
|
|
66
120
|
);
|
|
121
|
+
|
|
122
|
+
const {
|
|
123
|
+
error: res_error,
|
|
124
|
+
} = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
|
|
125
|
+
abortEarly: false,
|
|
126
|
+
allowUnknown: false,
|
|
127
|
+
});
|
|
128
|
+
|
|
129
|
+
if (res_error) {
|
|
130
|
+
Logger({
|
|
131
|
+
level: "WARN",
|
|
132
|
+
message: "Response Validation Warnnings for updateCompany",
|
|
133
|
+
});
|
|
134
|
+
Logger({ level: "WARN", message: res_error });
|
|
135
|
+
}
|
|
136
|
+
|
|
137
|
+
return response;
|
|
67
138
|
}
|
|
68
139
|
|
|
69
140
|
/**
|
|
70
141
|
* @param {Object} arg - Arg object.
|
|
142
|
+
* @returns {Promise<MetricsSerializer>} - Success response
|
|
71
143
|
* @summary: Get company metrics
|
|
72
144
|
* @description: This API allows to view the company metrics, i.e. the status of its brand and stores. Also its allows to view the number of products, company documents & store documents which are verified and unverified.
|
|
73
145
|
*/
|
|
74
|
-
getCompanyMetrics({} = {}) {
|
|
146
|
+
async getCompanyMetrics({} = {}) {
|
|
75
147
|
const { error } = CompanyProfileValidator.getCompanyMetrics().validate(
|
|
76
148
|
{},
|
|
77
149
|
{ abortEarly: false, allowUnknown: true }
|
|
@@ -80,11 +152,26 @@ class CompanyProfile {
|
|
|
80
152
|
return Promise.reject(new FDKClientValidationError(error));
|
|
81
153
|
}
|
|
82
154
|
|
|
155
|
+
// Showing warrnings if extra unknown parameters are found
|
|
156
|
+
const {
|
|
157
|
+
error: warrning,
|
|
158
|
+
} = CompanyProfileValidator.getCompanyMetrics().validate(
|
|
159
|
+
{},
|
|
160
|
+
{ abortEarly: false, allowUnknown: false }
|
|
161
|
+
);
|
|
162
|
+
if (warrning) {
|
|
163
|
+
Logger({
|
|
164
|
+
level: "WARN",
|
|
165
|
+
message: "Parameter Validation warrnings for getCompanyMetrics",
|
|
166
|
+
});
|
|
167
|
+
Logger({ level: "WARN", message: warrning });
|
|
168
|
+
}
|
|
169
|
+
|
|
83
170
|
const query_params = {};
|
|
84
171
|
|
|
85
172
|
const xHeaders = {};
|
|
86
173
|
|
|
87
|
-
|
|
174
|
+
const response = await PlatformAPIClient.execute(
|
|
88
175
|
this.config,
|
|
89
176
|
"get",
|
|
90
177
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/metrics`,
|
|
@@ -92,15 +179,33 @@ class CompanyProfile {
|
|
|
92
179
|
undefined,
|
|
93
180
|
xHeaders
|
|
94
181
|
);
|
|
182
|
+
|
|
183
|
+
const {
|
|
184
|
+
error: res_error,
|
|
185
|
+
} = CompanyProfileModel.MetricsSerializer().validate(response, {
|
|
186
|
+
abortEarly: false,
|
|
187
|
+
allowUnknown: false,
|
|
188
|
+
});
|
|
189
|
+
|
|
190
|
+
if (res_error) {
|
|
191
|
+
Logger({
|
|
192
|
+
level: "WARN",
|
|
193
|
+
message: "Response Validation Warnnings for getCompanyMetrics",
|
|
194
|
+
});
|
|
195
|
+
Logger({ level: "WARN", message: res_error });
|
|
196
|
+
}
|
|
197
|
+
|
|
198
|
+
return response;
|
|
95
199
|
}
|
|
96
200
|
|
|
97
201
|
/**
|
|
98
202
|
* @param {Object} arg - Arg object.
|
|
99
203
|
* @param {string} arg.brandId - Id of the brand to be viewed.
|
|
204
|
+
* @returns {Promise<GetBrandResponseSerializer>} - Success response
|
|
100
205
|
* @summary: Get a single brand.
|
|
101
206
|
* @description: This API helps to get data associated to a particular brand.
|
|
102
207
|
*/
|
|
103
|
-
getBrand({ brandId } = {}) {
|
|
208
|
+
async getBrand({ brandId } = {}) {
|
|
104
209
|
const { error } = CompanyProfileValidator.getBrand().validate(
|
|
105
210
|
{
|
|
106
211
|
brandId,
|
|
@@ -111,11 +216,26 @@ class CompanyProfile {
|
|
|
111
216
|
return Promise.reject(new FDKClientValidationError(error));
|
|
112
217
|
}
|
|
113
218
|
|
|
219
|
+
// Showing warrnings if extra unknown parameters are found
|
|
220
|
+
const { error: warrning } = CompanyProfileValidator.getBrand().validate(
|
|
221
|
+
{
|
|
222
|
+
brandId,
|
|
223
|
+
},
|
|
224
|
+
{ abortEarly: false, allowUnknown: false }
|
|
225
|
+
);
|
|
226
|
+
if (warrning) {
|
|
227
|
+
Logger({
|
|
228
|
+
level: "WARN",
|
|
229
|
+
message: "Parameter Validation warrnings for getBrand",
|
|
230
|
+
});
|
|
231
|
+
Logger({ level: "WARN", message: warrning });
|
|
232
|
+
}
|
|
233
|
+
|
|
114
234
|
const query_params = {};
|
|
115
235
|
|
|
116
236
|
const xHeaders = {};
|
|
117
237
|
|
|
118
|
-
|
|
238
|
+
const response = await PlatformAPIClient.execute(
|
|
119
239
|
this.config,
|
|
120
240
|
"get",
|
|
121
241
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/brand/${brandId}`,
|
|
@@ -123,16 +243,34 @@ class CompanyProfile {
|
|
|
123
243
|
undefined,
|
|
124
244
|
xHeaders
|
|
125
245
|
);
|
|
246
|
+
|
|
247
|
+
const {
|
|
248
|
+
error: res_error,
|
|
249
|
+
} = CompanyProfileModel.GetBrandResponseSerializer().validate(response, {
|
|
250
|
+
abortEarly: false,
|
|
251
|
+
allowUnknown: false,
|
|
252
|
+
});
|
|
253
|
+
|
|
254
|
+
if (res_error) {
|
|
255
|
+
Logger({
|
|
256
|
+
level: "WARN",
|
|
257
|
+
message: "Response Validation Warnnings for getBrand",
|
|
258
|
+
});
|
|
259
|
+
Logger({ level: "WARN", message: res_error });
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
return response;
|
|
126
263
|
}
|
|
127
264
|
|
|
128
265
|
/**
|
|
129
266
|
* @param {Object} arg - Arg object.
|
|
130
267
|
* @param {string} arg.brandId - Id of the brand to be viewed.
|
|
131
268
|
* @param {CreateUpdateBrandRequestSerializer} arg.body
|
|
269
|
+
* @returns {Promise<ProfileSuccessResponse>} - Success response
|
|
132
270
|
* @summary: Edit a brand.
|
|
133
271
|
* @description: This API allows to edit meta of a brand.
|
|
134
272
|
*/
|
|
135
|
-
editBrand({ brandId, body } = {}) {
|
|
273
|
+
async editBrand({ brandId, body } = {}) {
|
|
136
274
|
const { error } = CompanyProfileValidator.editBrand().validate(
|
|
137
275
|
{
|
|
138
276
|
brandId,
|
|
@@ -144,11 +282,27 @@ class CompanyProfile {
|
|
|
144
282
|
return Promise.reject(new FDKClientValidationError(error));
|
|
145
283
|
}
|
|
146
284
|
|
|
285
|
+
// Showing warrnings if extra unknown parameters are found
|
|
286
|
+
const { error: warrning } = CompanyProfileValidator.editBrand().validate(
|
|
287
|
+
{
|
|
288
|
+
brandId,
|
|
289
|
+
body,
|
|
290
|
+
},
|
|
291
|
+
{ abortEarly: false, allowUnknown: false }
|
|
292
|
+
);
|
|
293
|
+
if (warrning) {
|
|
294
|
+
Logger({
|
|
295
|
+
level: "WARN",
|
|
296
|
+
message: "Parameter Validation warrnings for editBrand",
|
|
297
|
+
});
|
|
298
|
+
Logger({ level: "WARN", message: warrning });
|
|
299
|
+
}
|
|
300
|
+
|
|
147
301
|
const query_params = {};
|
|
148
302
|
|
|
149
303
|
const xHeaders = {};
|
|
150
304
|
|
|
151
|
-
|
|
305
|
+
const response = await PlatformAPIClient.execute(
|
|
152
306
|
this.config,
|
|
153
307
|
"put",
|
|
154
308
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/brand/${brandId}`,
|
|
@@ -156,15 +310,33 @@ class CompanyProfile {
|
|
|
156
310
|
body,
|
|
157
311
|
xHeaders
|
|
158
312
|
);
|
|
313
|
+
|
|
314
|
+
const {
|
|
315
|
+
error: res_error,
|
|
316
|
+
} = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
|
|
317
|
+
abortEarly: false,
|
|
318
|
+
allowUnknown: false,
|
|
319
|
+
});
|
|
320
|
+
|
|
321
|
+
if (res_error) {
|
|
322
|
+
Logger({
|
|
323
|
+
level: "WARN",
|
|
324
|
+
message: "Response Validation Warnnings for editBrand",
|
|
325
|
+
});
|
|
326
|
+
Logger({ level: "WARN", message: res_error });
|
|
327
|
+
}
|
|
328
|
+
|
|
329
|
+
return response;
|
|
159
330
|
}
|
|
160
331
|
|
|
161
332
|
/**
|
|
162
333
|
* @param {Object} arg - Arg object.
|
|
163
334
|
* @param {CreateUpdateBrandRequestSerializer} arg.body
|
|
335
|
+
* @returns {Promise<ProfileSuccessResponse>} - Success response
|
|
164
336
|
* @summary: Create a Brand.
|
|
165
337
|
* @description: This API allows to create a brand associated to a company.
|
|
166
338
|
*/
|
|
167
|
-
createBrand({ body } = {}) {
|
|
339
|
+
async createBrand({ body } = {}) {
|
|
168
340
|
const { error } = CompanyProfileValidator.createBrand().validate(
|
|
169
341
|
{
|
|
170
342
|
body,
|
|
@@ -175,11 +347,26 @@ class CompanyProfile {
|
|
|
175
347
|
return Promise.reject(new FDKClientValidationError(error));
|
|
176
348
|
}
|
|
177
349
|
|
|
350
|
+
// Showing warrnings if extra unknown parameters are found
|
|
351
|
+
const { error: warrning } = CompanyProfileValidator.createBrand().validate(
|
|
352
|
+
{
|
|
353
|
+
body,
|
|
354
|
+
},
|
|
355
|
+
{ abortEarly: false, allowUnknown: false }
|
|
356
|
+
);
|
|
357
|
+
if (warrning) {
|
|
358
|
+
Logger({
|
|
359
|
+
level: "WARN",
|
|
360
|
+
message: "Parameter Validation warrnings for createBrand",
|
|
361
|
+
});
|
|
362
|
+
Logger({ level: "WARN", message: warrning });
|
|
363
|
+
}
|
|
364
|
+
|
|
178
365
|
const query_params = {};
|
|
179
366
|
|
|
180
367
|
const xHeaders = {};
|
|
181
368
|
|
|
182
|
-
|
|
369
|
+
const response = await PlatformAPIClient.execute(
|
|
183
370
|
this.config,
|
|
184
371
|
"post",
|
|
185
372
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/brand/`,
|
|
@@ -187,6 +374,23 @@ class CompanyProfile {
|
|
|
187
374
|
body,
|
|
188
375
|
xHeaders
|
|
189
376
|
);
|
|
377
|
+
|
|
378
|
+
const {
|
|
379
|
+
error: res_error,
|
|
380
|
+
} = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
|
|
381
|
+
abortEarly: false,
|
|
382
|
+
allowUnknown: false,
|
|
383
|
+
});
|
|
384
|
+
|
|
385
|
+
if (res_error) {
|
|
386
|
+
Logger({
|
|
387
|
+
level: "WARN",
|
|
388
|
+
message: "Response Validation Warnnings for createBrand",
|
|
389
|
+
});
|
|
390
|
+
Logger({ level: "WARN", message: res_error });
|
|
391
|
+
}
|
|
392
|
+
|
|
393
|
+
return response;
|
|
190
394
|
}
|
|
191
395
|
|
|
192
396
|
/**
|
|
@@ -196,10 +400,11 @@ class CompanyProfile {
|
|
|
196
400
|
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
197
401
|
* page. Default is 10.
|
|
198
402
|
* @param {string} [arg.q] - Search term for name.
|
|
403
|
+
* @returns {Promise<CompanyBrandListSerializer>} - Success response
|
|
199
404
|
* @summary: Get brands associated to a company
|
|
200
405
|
* @description: This API helps to get view brands associated to a particular company.
|
|
201
406
|
*/
|
|
202
|
-
getBrands({ pageNo, pageSize, q } = {}) {
|
|
407
|
+
async getBrands({ pageNo, pageSize, q } = {}) {
|
|
203
408
|
const { error } = CompanyProfileValidator.getBrands().validate(
|
|
204
409
|
{
|
|
205
410
|
pageNo,
|
|
@@ -212,6 +417,23 @@ class CompanyProfile {
|
|
|
212
417
|
return Promise.reject(new FDKClientValidationError(error));
|
|
213
418
|
}
|
|
214
419
|
|
|
420
|
+
// Showing warrnings if extra unknown parameters are found
|
|
421
|
+
const { error: warrning } = CompanyProfileValidator.getBrands().validate(
|
|
422
|
+
{
|
|
423
|
+
pageNo,
|
|
424
|
+
pageSize,
|
|
425
|
+
q,
|
|
426
|
+
},
|
|
427
|
+
{ abortEarly: false, allowUnknown: false }
|
|
428
|
+
);
|
|
429
|
+
if (warrning) {
|
|
430
|
+
Logger({
|
|
431
|
+
level: "WARN",
|
|
432
|
+
message: "Parameter Validation warrnings for getBrands",
|
|
433
|
+
});
|
|
434
|
+
Logger({ level: "WARN", message: warrning });
|
|
435
|
+
}
|
|
436
|
+
|
|
215
437
|
const query_params = {};
|
|
216
438
|
query_params["page_no"] = pageNo;
|
|
217
439
|
query_params["page_size"] = pageSize;
|
|
@@ -219,7 +441,7 @@ class CompanyProfile {
|
|
|
219
441
|
|
|
220
442
|
const xHeaders = {};
|
|
221
443
|
|
|
222
|
-
|
|
444
|
+
const response = await PlatformAPIClient.execute(
|
|
223
445
|
this.config,
|
|
224
446
|
"get",
|
|
225
447
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/company-brand`,
|
|
@@ -227,6 +449,23 @@ class CompanyProfile {
|
|
|
227
449
|
undefined,
|
|
228
450
|
xHeaders
|
|
229
451
|
);
|
|
452
|
+
|
|
453
|
+
const {
|
|
454
|
+
error: res_error,
|
|
455
|
+
} = CompanyProfileModel.CompanyBrandListSerializer().validate(response, {
|
|
456
|
+
abortEarly: false,
|
|
457
|
+
allowUnknown: false,
|
|
458
|
+
});
|
|
459
|
+
|
|
460
|
+
if (res_error) {
|
|
461
|
+
Logger({
|
|
462
|
+
level: "WARN",
|
|
463
|
+
message: "Response Validation Warnnings for getBrands",
|
|
464
|
+
});
|
|
465
|
+
Logger({ level: "WARN", message: res_error });
|
|
466
|
+
}
|
|
467
|
+
|
|
468
|
+
return response;
|
|
230
469
|
}
|
|
231
470
|
|
|
232
471
|
/**
|
|
@@ -261,10 +500,11 @@ class CompanyProfile {
|
|
|
261
500
|
/**
|
|
262
501
|
* @param {Object} arg - Arg object.
|
|
263
502
|
* @param {CompanyBrandPostRequestSerializer} arg.body
|
|
503
|
+
* @returns {Promise<ProfileSuccessResponse>} - Success response
|
|
264
504
|
* @summary: Create a company brand mapping.
|
|
265
505
|
* @description: This API allows to create a company brand mapping, for a already existing brand in the system.
|
|
266
506
|
*/
|
|
267
|
-
createCompanyBrandMapping({ body } = {}) {
|
|
507
|
+
async createCompanyBrandMapping({ body } = {}) {
|
|
268
508
|
const {
|
|
269
509
|
error,
|
|
270
510
|
} = CompanyProfileValidator.createCompanyBrandMapping().validate(
|
|
@@ -277,11 +517,28 @@ class CompanyProfile {
|
|
|
277
517
|
return Promise.reject(new FDKClientValidationError(error));
|
|
278
518
|
}
|
|
279
519
|
|
|
520
|
+
// Showing warrnings if extra unknown parameters are found
|
|
521
|
+
const {
|
|
522
|
+
error: warrning,
|
|
523
|
+
} = CompanyProfileValidator.createCompanyBrandMapping().validate(
|
|
524
|
+
{
|
|
525
|
+
body,
|
|
526
|
+
},
|
|
527
|
+
{ abortEarly: false, allowUnknown: false }
|
|
528
|
+
);
|
|
529
|
+
if (warrning) {
|
|
530
|
+
Logger({
|
|
531
|
+
level: "WARN",
|
|
532
|
+
message: "Parameter Validation warrnings for createCompanyBrandMapping",
|
|
533
|
+
});
|
|
534
|
+
Logger({ level: "WARN", message: warrning });
|
|
535
|
+
}
|
|
536
|
+
|
|
280
537
|
const query_params = {};
|
|
281
538
|
|
|
282
539
|
const xHeaders = {};
|
|
283
540
|
|
|
284
|
-
|
|
541
|
+
const response = await PlatformAPIClient.execute(
|
|
285
542
|
this.config,
|
|
286
543
|
"post",
|
|
287
544
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/company-brand`,
|
|
@@ -289,6 +546,23 @@ class CompanyProfile {
|
|
|
289
546
|
body,
|
|
290
547
|
xHeaders
|
|
291
548
|
);
|
|
549
|
+
|
|
550
|
+
const {
|
|
551
|
+
error: res_error,
|
|
552
|
+
} = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
|
|
553
|
+
abortEarly: false,
|
|
554
|
+
allowUnknown: false,
|
|
555
|
+
});
|
|
556
|
+
|
|
557
|
+
if (res_error) {
|
|
558
|
+
Logger({
|
|
559
|
+
level: "WARN",
|
|
560
|
+
message: "Response Validation Warnnings for createCompanyBrandMapping",
|
|
561
|
+
});
|
|
562
|
+
Logger({ level: "WARN", message: res_error });
|
|
563
|
+
}
|
|
564
|
+
|
|
565
|
+
return response;
|
|
292
566
|
}
|
|
293
567
|
|
|
294
568
|
/**
|
|
@@ -303,10 +577,18 @@ class CompanyProfile {
|
|
|
303
577
|
* @param {number} [arg.pageSize] - Number of items to retrieve in each
|
|
304
578
|
* page. Default is 10.
|
|
305
579
|
* @param {number[]} [arg.locationIds] - Helps to filter stores on the basis of uids.
|
|
580
|
+
* @returns {Promise<LocationListSerializer>} - Success response
|
|
306
581
|
* @summary: Get list of locations
|
|
307
582
|
* @description: This API allows to view all the locations associated to a company.
|
|
308
583
|
*/
|
|
309
|
-
getLocations({
|
|
584
|
+
async getLocations({
|
|
585
|
+
storeType,
|
|
586
|
+
q,
|
|
587
|
+
stage,
|
|
588
|
+
pageNo,
|
|
589
|
+
pageSize,
|
|
590
|
+
locationIds,
|
|
591
|
+
} = {}) {
|
|
310
592
|
const { error } = CompanyProfileValidator.getLocations().validate(
|
|
311
593
|
{
|
|
312
594
|
storeType,
|
|
@@ -322,6 +604,26 @@ class CompanyProfile {
|
|
|
322
604
|
return Promise.reject(new FDKClientValidationError(error));
|
|
323
605
|
}
|
|
324
606
|
|
|
607
|
+
// Showing warrnings if extra unknown parameters are found
|
|
608
|
+
const { error: warrning } = CompanyProfileValidator.getLocations().validate(
|
|
609
|
+
{
|
|
610
|
+
storeType,
|
|
611
|
+
q,
|
|
612
|
+
stage,
|
|
613
|
+
pageNo,
|
|
614
|
+
pageSize,
|
|
615
|
+
locationIds,
|
|
616
|
+
},
|
|
617
|
+
{ abortEarly: false, allowUnknown: false }
|
|
618
|
+
);
|
|
619
|
+
if (warrning) {
|
|
620
|
+
Logger({
|
|
621
|
+
level: "WARN",
|
|
622
|
+
message: "Parameter Validation warrnings for getLocations",
|
|
623
|
+
});
|
|
624
|
+
Logger({ level: "WARN", message: warrning });
|
|
625
|
+
}
|
|
626
|
+
|
|
325
627
|
const query_params = {};
|
|
326
628
|
query_params["store_type"] = storeType;
|
|
327
629
|
query_params["q"] = q;
|
|
@@ -332,7 +634,7 @@ class CompanyProfile {
|
|
|
332
634
|
|
|
333
635
|
const xHeaders = {};
|
|
334
636
|
|
|
335
|
-
|
|
637
|
+
const response = await PlatformAPIClient.execute(
|
|
336
638
|
this.config,
|
|
337
639
|
"get",
|
|
338
640
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/location`,
|
|
@@ -340,6 +642,23 @@ class CompanyProfile {
|
|
|
340
642
|
undefined,
|
|
341
643
|
xHeaders
|
|
342
644
|
);
|
|
645
|
+
|
|
646
|
+
const {
|
|
647
|
+
error: res_error,
|
|
648
|
+
} = CompanyProfileModel.LocationListSerializer().validate(response, {
|
|
649
|
+
abortEarly: false,
|
|
650
|
+
allowUnknown: false,
|
|
651
|
+
});
|
|
652
|
+
|
|
653
|
+
if (res_error) {
|
|
654
|
+
Logger({
|
|
655
|
+
level: "WARN",
|
|
656
|
+
message: "Response Validation Warnnings for getLocations",
|
|
657
|
+
});
|
|
658
|
+
Logger({ level: "WARN", message: res_error });
|
|
659
|
+
}
|
|
660
|
+
|
|
661
|
+
return response;
|
|
343
662
|
}
|
|
344
663
|
|
|
345
664
|
/**
|
|
@@ -382,10 +701,11 @@ class CompanyProfile {
|
|
|
382
701
|
/**
|
|
383
702
|
* @param {Object} arg - Arg object.
|
|
384
703
|
* @param {LocationSerializer} arg.body
|
|
704
|
+
* @returns {Promise<ProfileSuccessResponse>} - Success response
|
|
385
705
|
* @summary: Create a location associated to a company.
|
|
386
706
|
* @description: This API allows to edit a location associated to a company.
|
|
387
707
|
*/
|
|
388
|
-
createLocation({ body } = {}) {
|
|
708
|
+
async createLocation({ body } = {}) {
|
|
389
709
|
const { error } = CompanyProfileValidator.createLocation().validate(
|
|
390
710
|
{
|
|
391
711
|
body,
|
|
@@ -396,11 +716,28 @@ class CompanyProfile {
|
|
|
396
716
|
return Promise.reject(new FDKClientValidationError(error));
|
|
397
717
|
}
|
|
398
718
|
|
|
719
|
+
// Showing warrnings if extra unknown parameters are found
|
|
720
|
+
const {
|
|
721
|
+
error: warrning,
|
|
722
|
+
} = CompanyProfileValidator.createLocation().validate(
|
|
723
|
+
{
|
|
724
|
+
body,
|
|
725
|
+
},
|
|
726
|
+
{ abortEarly: false, allowUnknown: false }
|
|
727
|
+
);
|
|
728
|
+
if (warrning) {
|
|
729
|
+
Logger({
|
|
730
|
+
level: "WARN",
|
|
731
|
+
message: "Parameter Validation warrnings for createLocation",
|
|
732
|
+
});
|
|
733
|
+
Logger({ level: "WARN", message: warrning });
|
|
734
|
+
}
|
|
735
|
+
|
|
399
736
|
const query_params = {};
|
|
400
737
|
|
|
401
738
|
const xHeaders = {};
|
|
402
739
|
|
|
403
|
-
|
|
740
|
+
const response = await PlatformAPIClient.execute(
|
|
404
741
|
this.config,
|
|
405
742
|
"post",
|
|
406
743
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/location`,
|
|
@@ -408,15 +745,33 @@ class CompanyProfile {
|
|
|
408
745
|
body,
|
|
409
746
|
xHeaders
|
|
410
747
|
);
|
|
748
|
+
|
|
749
|
+
const {
|
|
750
|
+
error: res_error,
|
|
751
|
+
} = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
|
|
752
|
+
abortEarly: false,
|
|
753
|
+
allowUnknown: false,
|
|
754
|
+
});
|
|
755
|
+
|
|
756
|
+
if (res_error) {
|
|
757
|
+
Logger({
|
|
758
|
+
level: "WARN",
|
|
759
|
+
message: "Response Validation Warnnings for createLocation",
|
|
760
|
+
});
|
|
761
|
+
Logger({ level: "WARN", message: res_error });
|
|
762
|
+
}
|
|
763
|
+
|
|
764
|
+
return response;
|
|
411
765
|
}
|
|
412
766
|
|
|
413
767
|
/**
|
|
414
768
|
* @param {Object} arg - Arg object.
|
|
415
769
|
* @param {string} arg.locationId - Id of the location which you want to view.
|
|
770
|
+
* @returns {Promise<GetLocationSerializer>} - Success response
|
|
416
771
|
* @summary: Get details of a specific location.
|
|
417
772
|
* @description: This API helps to get data associated to a specific location.
|
|
418
773
|
*/
|
|
419
|
-
getLocationDetail({ locationId } = {}) {
|
|
774
|
+
async getLocationDetail({ locationId } = {}) {
|
|
420
775
|
const { error } = CompanyProfileValidator.getLocationDetail().validate(
|
|
421
776
|
{
|
|
422
777
|
locationId,
|
|
@@ -427,11 +782,28 @@ class CompanyProfile {
|
|
|
427
782
|
return Promise.reject(new FDKClientValidationError(error));
|
|
428
783
|
}
|
|
429
784
|
|
|
785
|
+
// Showing warrnings if extra unknown parameters are found
|
|
786
|
+
const {
|
|
787
|
+
error: warrning,
|
|
788
|
+
} = CompanyProfileValidator.getLocationDetail().validate(
|
|
789
|
+
{
|
|
790
|
+
locationId,
|
|
791
|
+
},
|
|
792
|
+
{ abortEarly: false, allowUnknown: false }
|
|
793
|
+
);
|
|
794
|
+
if (warrning) {
|
|
795
|
+
Logger({
|
|
796
|
+
level: "WARN",
|
|
797
|
+
message: "Parameter Validation warrnings for getLocationDetail",
|
|
798
|
+
});
|
|
799
|
+
Logger({ level: "WARN", message: warrning });
|
|
800
|
+
}
|
|
801
|
+
|
|
430
802
|
const query_params = {};
|
|
431
803
|
|
|
432
804
|
const xHeaders = {};
|
|
433
805
|
|
|
434
|
-
|
|
806
|
+
const response = await PlatformAPIClient.execute(
|
|
435
807
|
this.config,
|
|
436
808
|
"get",
|
|
437
809
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/location/${locationId}`,
|
|
@@ -439,16 +811,34 @@ class CompanyProfile {
|
|
|
439
811
|
undefined,
|
|
440
812
|
xHeaders
|
|
441
813
|
);
|
|
814
|
+
|
|
815
|
+
const {
|
|
816
|
+
error: res_error,
|
|
817
|
+
} = CompanyProfileModel.GetLocationSerializer().validate(response, {
|
|
818
|
+
abortEarly: false,
|
|
819
|
+
allowUnknown: false,
|
|
820
|
+
});
|
|
821
|
+
|
|
822
|
+
if (res_error) {
|
|
823
|
+
Logger({
|
|
824
|
+
level: "WARN",
|
|
825
|
+
message: "Response Validation Warnnings for getLocationDetail",
|
|
826
|
+
});
|
|
827
|
+
Logger({ level: "WARN", message: res_error });
|
|
828
|
+
}
|
|
829
|
+
|
|
830
|
+
return response;
|
|
442
831
|
}
|
|
443
832
|
|
|
444
833
|
/**
|
|
445
834
|
* @param {Object} arg - Arg object.
|
|
446
835
|
* @param {string} arg.locationId - Id of the location which you want to edit.
|
|
447
836
|
* @param {LocationSerializer} arg.body
|
|
837
|
+
* @returns {Promise<ProfileSuccessResponse>} - Success response
|
|
448
838
|
* @summary: Edit a location asscoiated to a company.
|
|
449
839
|
* @description: This API allows to edit a location associated to a company.
|
|
450
840
|
*/
|
|
451
|
-
updateLocation({ locationId, body } = {}) {
|
|
841
|
+
async updateLocation({ locationId, body } = {}) {
|
|
452
842
|
const { error } = CompanyProfileValidator.updateLocation().validate(
|
|
453
843
|
{
|
|
454
844
|
locationId,
|
|
@@ -460,11 +850,29 @@ class CompanyProfile {
|
|
|
460
850
|
return Promise.reject(new FDKClientValidationError(error));
|
|
461
851
|
}
|
|
462
852
|
|
|
853
|
+
// Showing warrnings if extra unknown parameters are found
|
|
854
|
+
const {
|
|
855
|
+
error: warrning,
|
|
856
|
+
} = CompanyProfileValidator.updateLocation().validate(
|
|
857
|
+
{
|
|
858
|
+
locationId,
|
|
859
|
+
body,
|
|
860
|
+
},
|
|
861
|
+
{ abortEarly: false, allowUnknown: false }
|
|
862
|
+
);
|
|
863
|
+
if (warrning) {
|
|
864
|
+
Logger({
|
|
865
|
+
level: "WARN",
|
|
866
|
+
message: "Parameter Validation warrnings for updateLocation",
|
|
867
|
+
});
|
|
868
|
+
Logger({ level: "WARN", message: warrning });
|
|
869
|
+
}
|
|
870
|
+
|
|
463
871
|
const query_params = {};
|
|
464
872
|
|
|
465
873
|
const xHeaders = {};
|
|
466
874
|
|
|
467
|
-
|
|
875
|
+
const response = await PlatformAPIClient.execute(
|
|
468
876
|
this.config,
|
|
469
877
|
"put",
|
|
470
878
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/location/${locationId}`,
|
|
@@ -472,15 +880,33 @@ class CompanyProfile {
|
|
|
472
880
|
body,
|
|
473
881
|
xHeaders
|
|
474
882
|
);
|
|
883
|
+
|
|
884
|
+
const {
|
|
885
|
+
error: res_error,
|
|
886
|
+
} = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
|
|
887
|
+
abortEarly: false,
|
|
888
|
+
allowUnknown: false,
|
|
889
|
+
});
|
|
890
|
+
|
|
891
|
+
if (res_error) {
|
|
892
|
+
Logger({
|
|
893
|
+
level: "WARN",
|
|
894
|
+
message: "Response Validation Warnnings for updateLocation",
|
|
895
|
+
});
|
|
896
|
+
Logger({ level: "WARN", message: res_error });
|
|
897
|
+
}
|
|
898
|
+
|
|
899
|
+
return response;
|
|
475
900
|
}
|
|
476
901
|
|
|
477
902
|
/**
|
|
478
903
|
* @param {Object} arg - Arg object.
|
|
479
904
|
* @param {BulkLocationSerializer} arg.body
|
|
905
|
+
* @returns {Promise<ProfileSuccessResponse>} - Success response
|
|
480
906
|
* @summary: Create a location asscoiated to a company in bulk.
|
|
481
907
|
* @description: This API allows to create a location associated to a company.
|
|
482
908
|
*/
|
|
483
|
-
createLocationBulk({ body } = {}) {
|
|
909
|
+
async createLocationBulk({ body } = {}) {
|
|
484
910
|
const { error } = CompanyProfileValidator.createLocationBulk().validate(
|
|
485
911
|
{
|
|
486
912
|
body,
|
|
@@ -491,11 +917,28 @@ class CompanyProfile {
|
|
|
491
917
|
return Promise.reject(new FDKClientValidationError(error));
|
|
492
918
|
}
|
|
493
919
|
|
|
920
|
+
// Showing warrnings if extra unknown parameters are found
|
|
921
|
+
const {
|
|
922
|
+
error: warrning,
|
|
923
|
+
} = CompanyProfileValidator.createLocationBulk().validate(
|
|
924
|
+
{
|
|
925
|
+
body,
|
|
926
|
+
},
|
|
927
|
+
{ abortEarly: false, allowUnknown: false }
|
|
928
|
+
);
|
|
929
|
+
if (warrning) {
|
|
930
|
+
Logger({
|
|
931
|
+
level: "WARN",
|
|
932
|
+
message: "Parameter Validation warrnings for createLocationBulk",
|
|
933
|
+
});
|
|
934
|
+
Logger({ level: "WARN", message: warrning });
|
|
935
|
+
}
|
|
936
|
+
|
|
494
937
|
const query_params = {};
|
|
495
938
|
|
|
496
939
|
const xHeaders = {};
|
|
497
940
|
|
|
498
|
-
|
|
941
|
+
const response = await PlatformAPIClient.execute(
|
|
499
942
|
this.config,
|
|
500
943
|
"post",
|
|
501
944
|
`/service/platform/company-profile/v1.0/company/${this.config.companyId}/location/bulk`,
|
|
@@ -503,6 +946,23 @@ class CompanyProfile {
|
|
|
503
946
|
body,
|
|
504
947
|
xHeaders
|
|
505
948
|
);
|
|
949
|
+
|
|
950
|
+
const {
|
|
951
|
+
error: res_error,
|
|
952
|
+
} = CompanyProfileModel.ProfileSuccessResponse().validate(response, {
|
|
953
|
+
abortEarly: false,
|
|
954
|
+
allowUnknown: false,
|
|
955
|
+
});
|
|
956
|
+
|
|
957
|
+
if (res_error) {
|
|
958
|
+
Logger({
|
|
959
|
+
level: "WARN",
|
|
960
|
+
message: "Response Validation Warnnings for createLocationBulk",
|
|
961
|
+
});
|
|
962
|
+
Logger({ level: "WARN", message: res_error });
|
|
963
|
+
}
|
|
964
|
+
|
|
965
|
+
return response;
|
|
506
966
|
}
|
|
507
967
|
}
|
|
508
968
|
|