@gofynd/fdk-client-javascript 1.4.11 → 1.4.12-beta.1
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/Cart/CartApplicationClient.d.ts +8 -19
- package/sdk/application/Cart/CartApplicationClient.js +8 -89
- package/sdk/application/Cart/CartApplicationModel.d.ts +1 -178
- package/sdk/application/Cart/CartApplicationModel.js +0 -92
- package/sdk/application/Cart/CartApplicationValidator.d.ts +1 -20
- package/sdk/application/Cart/CartApplicationValidator.js +0 -16
- package/sdk/application/Content/ContentApplicationModel.d.ts +3 -2
- package/sdk/application/Content/ContentApplicationModel.js +5 -2
- package/sdk/application/Logistic/LogisticApplicationModel.js +3 -3
- package/sdk/application/Order/OrderApplicationModel.js +1 -1
- package/sdk/application/Payment/PaymentApplicationModel.js +2 -2
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +3 -2
- package/sdk/application/Theme/ThemeApplicationModel.js +5 -2
- package/sdk/common/Clickstream.js +46 -15
- package/sdk/common/Constant.d.ts +5 -0
- package/sdk/common/Constant.js +5 -0
- package/sdk/partner/Theme/ThemePartnerModel.d.ts +3 -2
- package/sdk/partner/Theme/ThemePartnerModel.js +5 -2
- package/sdk/partner/Webhook/WebhookPartnerModel.js +1 -1
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +8 -20
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +8 -92
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +1 -15
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +0 -14
- package/sdk/platform/Cart/CartPlatformModel.d.ts +1 -87
- package/sdk/platform/Cart/CartPlatformModel.js +0 -88
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +10 -51
- package/sdk/platform/Catalog/CatalogPlatformClient.js +79 -400
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +8 -242
- package/sdk/platform/Catalog/CatalogPlatformModel.js +8 -171
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +15 -61
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +13 -65
- package/sdk/platform/Content/ContentPlatformModel.d.ts +3 -2
- package/sdk/platform/Content/ContentPlatformModel.js +5 -2
- package/sdk/platform/Finance/FinancePlatformModel.js +1 -1
- package/sdk/platform/Order/OrderPlatformModel.d.ts +30 -0
- package/sdk/platform/Order/OrderPlatformModel.js +23 -9
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +38 -4
- package/sdk/platform/Payment/PaymentPlatformModel.js +17 -7
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +3 -2
- package/sdk/platform/Theme/ThemePlatformModel.js +5 -2
- package/sdk/platform/Webhook/WebhookPlatformModel.js +1 -1
|
@@ -494,165 +494,6 @@ class Catalog {
|
|
|
494
494
|
return response;
|
|
495
495
|
}
|
|
496
496
|
|
|
497
|
-
/**
|
|
498
|
-
* @param {CatalogPlatformValidator.CreateCategoriesParam} arg - Arg object
|
|
499
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
500
|
-
* @param {import("../PlatformAPIClient").Options} - Options
|
|
501
|
-
* @returns {Promise<CatalogPlatformModel.CategoryCreateResponse>} - Success response
|
|
502
|
-
* @name createCategories
|
|
503
|
-
* @summary: Create categories
|
|
504
|
-
* @description: Allows to create product categories for specific company. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/catalog/createCategories/).
|
|
505
|
-
*/
|
|
506
|
-
async createCategories(
|
|
507
|
-
{ body, requestHeaders } = { requestHeaders: {} },
|
|
508
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
509
|
-
) {
|
|
510
|
-
const { error } = CatalogPlatformValidator.createCategories().validate(
|
|
511
|
-
{
|
|
512
|
-
body,
|
|
513
|
-
},
|
|
514
|
-
{ abortEarly: false, allowUnknown: true }
|
|
515
|
-
);
|
|
516
|
-
if (error) {
|
|
517
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
518
|
-
}
|
|
519
|
-
|
|
520
|
-
// Showing warrnings if extra unknown parameters are found
|
|
521
|
-
const {
|
|
522
|
-
error: warrning,
|
|
523
|
-
} = CatalogPlatformValidator.createCategories().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 platform > Catalog > createCategories \n ${warrning}`,
|
|
533
|
-
});
|
|
534
|
-
}
|
|
535
|
-
|
|
536
|
-
const query_params = {};
|
|
537
|
-
|
|
538
|
-
const xHeaders = {};
|
|
539
|
-
|
|
540
|
-
const response = await PlatformAPIClient.execute(
|
|
541
|
-
this.config,
|
|
542
|
-
"post",
|
|
543
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/category/`,
|
|
544
|
-
query_params,
|
|
545
|
-
body,
|
|
546
|
-
{ ...xHeaders, ...requestHeaders },
|
|
547
|
-
{ responseHeaders }
|
|
548
|
-
);
|
|
549
|
-
|
|
550
|
-
let responseData = response;
|
|
551
|
-
if (responseHeaders) {
|
|
552
|
-
responseData = response[0];
|
|
553
|
-
}
|
|
554
|
-
|
|
555
|
-
const {
|
|
556
|
-
error: res_error,
|
|
557
|
-
} = CatalogPlatformModel.CategoryCreateResponse().validate(responseData, {
|
|
558
|
-
abortEarly: false,
|
|
559
|
-
allowUnknown: true,
|
|
560
|
-
});
|
|
561
|
-
|
|
562
|
-
if (res_error) {
|
|
563
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
564
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
565
|
-
} else {
|
|
566
|
-
Logger({
|
|
567
|
-
level: "WARN",
|
|
568
|
-
message: `Response Validation Warnings for platform > Catalog > createCategories \n ${res_error}`,
|
|
569
|
-
});
|
|
570
|
-
}
|
|
571
|
-
}
|
|
572
|
-
|
|
573
|
-
return response;
|
|
574
|
-
}
|
|
575
|
-
|
|
576
|
-
/**
|
|
577
|
-
* @param {CatalogPlatformValidator.CreateDepartmentsParam} arg - Arg object
|
|
578
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
579
|
-
* @param {import("../PlatformAPIClient").Options} - Options
|
|
580
|
-
* @returns {Promise<CatalogPlatformModel.DepartmentCreateResponse>} -
|
|
581
|
-
* Success response
|
|
582
|
-
* @name createDepartments
|
|
583
|
-
* @summary: Create departments
|
|
584
|
-
* @description: Create departments for a specific company. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/catalog/createDepartments/).
|
|
585
|
-
*/
|
|
586
|
-
async createDepartments(
|
|
587
|
-
{ body, requestHeaders } = { requestHeaders: {} },
|
|
588
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
589
|
-
) {
|
|
590
|
-
const { error } = CatalogPlatformValidator.createDepartments().validate(
|
|
591
|
-
{
|
|
592
|
-
body,
|
|
593
|
-
},
|
|
594
|
-
{ abortEarly: false, allowUnknown: true }
|
|
595
|
-
);
|
|
596
|
-
if (error) {
|
|
597
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
598
|
-
}
|
|
599
|
-
|
|
600
|
-
// Showing warrnings if extra unknown parameters are found
|
|
601
|
-
const {
|
|
602
|
-
error: warrning,
|
|
603
|
-
} = CatalogPlatformValidator.createDepartments().validate(
|
|
604
|
-
{
|
|
605
|
-
body,
|
|
606
|
-
},
|
|
607
|
-
{ abortEarly: false, allowUnknown: false }
|
|
608
|
-
);
|
|
609
|
-
if (warrning) {
|
|
610
|
-
Logger({
|
|
611
|
-
level: "WARN",
|
|
612
|
-
message: `Parameter Validation warrnings for platform > Catalog > createDepartments \n ${warrning}`,
|
|
613
|
-
});
|
|
614
|
-
}
|
|
615
|
-
|
|
616
|
-
const query_params = {};
|
|
617
|
-
|
|
618
|
-
const xHeaders = {};
|
|
619
|
-
|
|
620
|
-
const response = await PlatformAPIClient.execute(
|
|
621
|
-
this.config,
|
|
622
|
-
"post",
|
|
623
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/departments/`,
|
|
624
|
-
query_params,
|
|
625
|
-
body,
|
|
626
|
-
{ ...xHeaders, ...requestHeaders },
|
|
627
|
-
{ responseHeaders }
|
|
628
|
-
);
|
|
629
|
-
|
|
630
|
-
let responseData = response;
|
|
631
|
-
if (responseHeaders) {
|
|
632
|
-
responseData = response[0];
|
|
633
|
-
}
|
|
634
|
-
|
|
635
|
-
const {
|
|
636
|
-
error: res_error,
|
|
637
|
-
} = CatalogPlatformModel.DepartmentCreateResponse().validate(responseData, {
|
|
638
|
-
abortEarly: false,
|
|
639
|
-
allowUnknown: true,
|
|
640
|
-
});
|
|
641
|
-
|
|
642
|
-
if (res_error) {
|
|
643
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
644
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
645
|
-
} else {
|
|
646
|
-
Logger({
|
|
647
|
-
level: "WARN",
|
|
648
|
-
message: `Response Validation Warnings for platform > Catalog > createDepartments \n ${res_error}`,
|
|
649
|
-
});
|
|
650
|
-
}
|
|
651
|
-
}
|
|
652
|
-
|
|
653
|
-
return response;
|
|
654
|
-
}
|
|
655
|
-
|
|
656
497
|
/**
|
|
657
498
|
* @param {CatalogPlatformValidator.CreateInventoryExportParam} arg - Arg object
|
|
658
499
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -2202,6 +2043,85 @@ class Catalog {
|
|
|
2202
2043
|
return response;
|
|
2203
2044
|
}
|
|
2204
2045
|
|
|
2046
|
+
/**
|
|
2047
|
+
* @param {CatalogPlatformValidator.GetAttributeParam} arg - Arg object
|
|
2048
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2049
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2050
|
+
* @returns {Promise<CatalogPlatformModel.AttributeDetail>} - Success response
|
|
2051
|
+
* @name getAttribute
|
|
2052
|
+
* @summary: Get attribute detail by slug
|
|
2053
|
+
* @description: Retrieve the attribute detail for catalog listings by attribute slug passed for a specific company. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/catalog/getAttribute/).
|
|
2054
|
+
*/
|
|
2055
|
+
async getAttribute(
|
|
2056
|
+
{ attributeSlug, requestHeaders } = { requestHeaders: {} },
|
|
2057
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2058
|
+
) {
|
|
2059
|
+
const { error } = CatalogPlatformValidator.getAttribute().validate(
|
|
2060
|
+
{
|
|
2061
|
+
attributeSlug,
|
|
2062
|
+
},
|
|
2063
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2064
|
+
);
|
|
2065
|
+
if (error) {
|
|
2066
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2067
|
+
}
|
|
2068
|
+
|
|
2069
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2070
|
+
const {
|
|
2071
|
+
error: warrning,
|
|
2072
|
+
} = CatalogPlatformValidator.getAttribute().validate(
|
|
2073
|
+
{
|
|
2074
|
+
attributeSlug,
|
|
2075
|
+
},
|
|
2076
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2077
|
+
);
|
|
2078
|
+
if (warrning) {
|
|
2079
|
+
Logger({
|
|
2080
|
+
level: "WARN",
|
|
2081
|
+
message: `Parameter Validation warrnings for platform > Catalog > getAttribute \n ${warrning}`,
|
|
2082
|
+
});
|
|
2083
|
+
}
|
|
2084
|
+
|
|
2085
|
+
const query_params = {};
|
|
2086
|
+
|
|
2087
|
+
const xHeaders = {};
|
|
2088
|
+
|
|
2089
|
+
const response = await PlatformAPIClient.execute(
|
|
2090
|
+
this.config,
|
|
2091
|
+
"get",
|
|
2092
|
+
`/service/platform/catalog/v1.0/company/${this.config.companyId}/product-attributes/${attributeSlug}`,
|
|
2093
|
+
query_params,
|
|
2094
|
+
undefined,
|
|
2095
|
+
{ ...xHeaders, ...requestHeaders },
|
|
2096
|
+
{ responseHeaders }
|
|
2097
|
+
);
|
|
2098
|
+
|
|
2099
|
+
let responseData = response;
|
|
2100
|
+
if (responseHeaders) {
|
|
2101
|
+
responseData = response[0];
|
|
2102
|
+
}
|
|
2103
|
+
|
|
2104
|
+
const {
|
|
2105
|
+
error: res_error,
|
|
2106
|
+
} = CatalogPlatformModel.AttributeDetail().validate(responseData, {
|
|
2107
|
+
abortEarly: false,
|
|
2108
|
+
allowUnknown: true,
|
|
2109
|
+
});
|
|
2110
|
+
|
|
2111
|
+
if (res_error) {
|
|
2112
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
2113
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2114
|
+
} else {
|
|
2115
|
+
Logger({
|
|
2116
|
+
level: "WARN",
|
|
2117
|
+
message: `Response Validation Warnings for platform > Catalog > getAttribute \n ${res_error}`,
|
|
2118
|
+
});
|
|
2119
|
+
}
|
|
2120
|
+
}
|
|
2121
|
+
|
|
2122
|
+
return response;
|
|
2123
|
+
}
|
|
2124
|
+
|
|
2205
2125
|
/**
|
|
2206
2126
|
* @param {CatalogPlatformValidator.GetCategoryDataParam} arg - Arg object
|
|
2207
2127
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -2605,85 +2525,6 @@ class Catalog {
|
|
|
2605
2525
|
return response;
|
|
2606
2526
|
}
|
|
2607
2527
|
|
|
2608
|
-
/**
|
|
2609
|
-
* @param {CatalogPlatformValidator.GetGenderAttributeParam} arg - Arg object
|
|
2610
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2611
|
-
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2612
|
-
* @returns {Promise<CatalogPlatformModel.GenderDetail>} - Success response
|
|
2613
|
-
* @name getGenderAttribute
|
|
2614
|
-
* @summary: Get gender attribute by slug
|
|
2615
|
-
* @description: Retrieve the gender attribute for catalog listings by attribute slug passed for a specific company. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/catalog/getGenderAttribute/).
|
|
2616
|
-
*/
|
|
2617
|
-
async getGenderAttribute(
|
|
2618
|
-
{ attributeSlug, requestHeaders } = { requestHeaders: {} },
|
|
2619
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
2620
|
-
) {
|
|
2621
|
-
const { error } = CatalogPlatformValidator.getGenderAttribute().validate(
|
|
2622
|
-
{
|
|
2623
|
-
attributeSlug,
|
|
2624
|
-
},
|
|
2625
|
-
{ abortEarly: false, allowUnknown: true }
|
|
2626
|
-
);
|
|
2627
|
-
if (error) {
|
|
2628
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
2629
|
-
}
|
|
2630
|
-
|
|
2631
|
-
// Showing warrnings if extra unknown parameters are found
|
|
2632
|
-
const {
|
|
2633
|
-
error: warrning,
|
|
2634
|
-
} = CatalogPlatformValidator.getGenderAttribute().validate(
|
|
2635
|
-
{
|
|
2636
|
-
attributeSlug,
|
|
2637
|
-
},
|
|
2638
|
-
{ abortEarly: false, allowUnknown: false }
|
|
2639
|
-
);
|
|
2640
|
-
if (warrning) {
|
|
2641
|
-
Logger({
|
|
2642
|
-
level: "WARN",
|
|
2643
|
-
message: `Parameter Validation warrnings for platform > Catalog > getGenderAttribute \n ${warrning}`,
|
|
2644
|
-
});
|
|
2645
|
-
}
|
|
2646
|
-
|
|
2647
|
-
const query_params = {};
|
|
2648
|
-
|
|
2649
|
-
const xHeaders = {};
|
|
2650
|
-
|
|
2651
|
-
const response = await PlatformAPIClient.execute(
|
|
2652
|
-
this.config,
|
|
2653
|
-
"get",
|
|
2654
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/product-attributes/${attributeSlug}`,
|
|
2655
|
-
query_params,
|
|
2656
|
-
undefined,
|
|
2657
|
-
{ ...xHeaders, ...requestHeaders },
|
|
2658
|
-
{ responseHeaders }
|
|
2659
|
-
);
|
|
2660
|
-
|
|
2661
|
-
let responseData = response;
|
|
2662
|
-
if (responseHeaders) {
|
|
2663
|
-
responseData = response[0];
|
|
2664
|
-
}
|
|
2665
|
-
|
|
2666
|
-
const {
|
|
2667
|
-
error: res_error,
|
|
2668
|
-
} = CatalogPlatformModel.GenderDetail().validate(responseData, {
|
|
2669
|
-
abortEarly: false,
|
|
2670
|
-
allowUnknown: true,
|
|
2671
|
-
});
|
|
2672
|
-
|
|
2673
|
-
if (res_error) {
|
|
2674
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
2675
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
2676
|
-
} else {
|
|
2677
|
-
Logger({
|
|
2678
|
-
level: "WARN",
|
|
2679
|
-
message: `Response Validation Warnings for platform > Catalog > getGenderAttribute \n ${res_error}`,
|
|
2680
|
-
});
|
|
2681
|
-
}
|
|
2682
|
-
}
|
|
2683
|
-
|
|
2684
|
-
return response;
|
|
2685
|
-
}
|
|
2686
|
-
|
|
2687
2528
|
/**
|
|
2688
2529
|
* @param {CatalogPlatformValidator.GetHsnCodeParam} arg - Arg object
|
|
2689
2530
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
@@ -6181,168 +6022,6 @@ class Catalog {
|
|
|
6181
6022
|
return response;
|
|
6182
6023
|
}
|
|
6183
6024
|
|
|
6184
|
-
/**
|
|
6185
|
-
* @param {CatalogPlatformValidator.UpdateCategoryParam} arg - Arg object
|
|
6186
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
6187
|
-
* @param {import("../PlatformAPIClient").Options} - Options
|
|
6188
|
-
* @returns {Promise<CatalogPlatformModel.CategoryUpdateResponse>} - Success response
|
|
6189
|
-
* @name updateCategory
|
|
6190
|
-
* @summary: Update category
|
|
6191
|
-
* @description: Modify data for an existing category by its uid for a specific company. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/catalog/updateCategory/).
|
|
6192
|
-
*/
|
|
6193
|
-
async updateCategory(
|
|
6194
|
-
{ uid, body, requestHeaders } = { requestHeaders: {} },
|
|
6195
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
6196
|
-
) {
|
|
6197
|
-
const { error } = CatalogPlatformValidator.updateCategory().validate(
|
|
6198
|
-
{
|
|
6199
|
-
uid,
|
|
6200
|
-
body,
|
|
6201
|
-
},
|
|
6202
|
-
{ abortEarly: false, allowUnknown: true }
|
|
6203
|
-
);
|
|
6204
|
-
if (error) {
|
|
6205
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
6206
|
-
}
|
|
6207
|
-
|
|
6208
|
-
// Showing warrnings if extra unknown parameters are found
|
|
6209
|
-
const {
|
|
6210
|
-
error: warrning,
|
|
6211
|
-
} = CatalogPlatformValidator.updateCategory().validate(
|
|
6212
|
-
{
|
|
6213
|
-
uid,
|
|
6214
|
-
body,
|
|
6215
|
-
},
|
|
6216
|
-
{ abortEarly: false, allowUnknown: false }
|
|
6217
|
-
);
|
|
6218
|
-
if (warrning) {
|
|
6219
|
-
Logger({
|
|
6220
|
-
level: "WARN",
|
|
6221
|
-
message: `Parameter Validation warrnings for platform > Catalog > updateCategory \n ${warrning}`,
|
|
6222
|
-
});
|
|
6223
|
-
}
|
|
6224
|
-
|
|
6225
|
-
const query_params = {};
|
|
6226
|
-
|
|
6227
|
-
const xHeaders = {};
|
|
6228
|
-
|
|
6229
|
-
const response = await PlatformAPIClient.execute(
|
|
6230
|
-
this.config,
|
|
6231
|
-
"put",
|
|
6232
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/category/${uid}/`,
|
|
6233
|
-
query_params,
|
|
6234
|
-
body,
|
|
6235
|
-
{ ...xHeaders, ...requestHeaders },
|
|
6236
|
-
{ responseHeaders }
|
|
6237
|
-
);
|
|
6238
|
-
|
|
6239
|
-
let responseData = response;
|
|
6240
|
-
if (responseHeaders) {
|
|
6241
|
-
responseData = response[0];
|
|
6242
|
-
}
|
|
6243
|
-
|
|
6244
|
-
const {
|
|
6245
|
-
error: res_error,
|
|
6246
|
-
} = CatalogPlatformModel.CategoryUpdateResponse().validate(responseData, {
|
|
6247
|
-
abortEarly: false,
|
|
6248
|
-
allowUnknown: true,
|
|
6249
|
-
});
|
|
6250
|
-
|
|
6251
|
-
if (res_error) {
|
|
6252
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
6253
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
6254
|
-
} else {
|
|
6255
|
-
Logger({
|
|
6256
|
-
level: "WARN",
|
|
6257
|
-
message: `Response Validation Warnings for platform > Catalog > updateCategory \n ${res_error}`,
|
|
6258
|
-
});
|
|
6259
|
-
}
|
|
6260
|
-
}
|
|
6261
|
-
|
|
6262
|
-
return response;
|
|
6263
|
-
}
|
|
6264
|
-
|
|
6265
|
-
/**
|
|
6266
|
-
* @param {CatalogPlatformValidator.UpdateDepartmentParam} arg - Arg object
|
|
6267
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
6268
|
-
* @param {import("../PlatformAPIClient").Options} - Options
|
|
6269
|
-
* @returns {Promise<CatalogPlatformModel.DepartmentModel>} - Success response
|
|
6270
|
-
* @name updateDepartment
|
|
6271
|
-
* @summary: Update department
|
|
6272
|
-
* @description: Modify the department data by their uid for a specifc company. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/catalog/updateDepartment/).
|
|
6273
|
-
*/
|
|
6274
|
-
async updateDepartment(
|
|
6275
|
-
{ uid, body, requestHeaders } = { requestHeaders: {} },
|
|
6276
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
6277
|
-
) {
|
|
6278
|
-
const { error } = CatalogPlatformValidator.updateDepartment().validate(
|
|
6279
|
-
{
|
|
6280
|
-
uid,
|
|
6281
|
-
body,
|
|
6282
|
-
},
|
|
6283
|
-
{ abortEarly: false, allowUnknown: true }
|
|
6284
|
-
);
|
|
6285
|
-
if (error) {
|
|
6286
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
6287
|
-
}
|
|
6288
|
-
|
|
6289
|
-
// Showing warrnings if extra unknown parameters are found
|
|
6290
|
-
const {
|
|
6291
|
-
error: warrning,
|
|
6292
|
-
} = CatalogPlatformValidator.updateDepartment().validate(
|
|
6293
|
-
{
|
|
6294
|
-
uid,
|
|
6295
|
-
body,
|
|
6296
|
-
},
|
|
6297
|
-
{ abortEarly: false, allowUnknown: false }
|
|
6298
|
-
);
|
|
6299
|
-
if (warrning) {
|
|
6300
|
-
Logger({
|
|
6301
|
-
level: "WARN",
|
|
6302
|
-
message: `Parameter Validation warrnings for platform > Catalog > updateDepartment \n ${warrning}`,
|
|
6303
|
-
});
|
|
6304
|
-
}
|
|
6305
|
-
|
|
6306
|
-
const query_params = {};
|
|
6307
|
-
|
|
6308
|
-
const xHeaders = {};
|
|
6309
|
-
|
|
6310
|
-
const response = await PlatformAPIClient.execute(
|
|
6311
|
-
this.config,
|
|
6312
|
-
"put",
|
|
6313
|
-
`/service/platform/catalog/v1.0/company/${this.config.companyId}/departments/${uid}/`,
|
|
6314
|
-
query_params,
|
|
6315
|
-
body,
|
|
6316
|
-
{ ...xHeaders, ...requestHeaders },
|
|
6317
|
-
{ responseHeaders }
|
|
6318
|
-
);
|
|
6319
|
-
|
|
6320
|
-
let responseData = response;
|
|
6321
|
-
if (responseHeaders) {
|
|
6322
|
-
responseData = response[0];
|
|
6323
|
-
}
|
|
6324
|
-
|
|
6325
|
-
const {
|
|
6326
|
-
error: res_error,
|
|
6327
|
-
} = CatalogPlatformModel.DepartmentModel().validate(responseData, {
|
|
6328
|
-
abortEarly: false,
|
|
6329
|
-
allowUnknown: true,
|
|
6330
|
-
});
|
|
6331
|
-
|
|
6332
|
-
if (res_error) {
|
|
6333
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
6334
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
6335
|
-
} else {
|
|
6336
|
-
Logger({
|
|
6337
|
-
level: "WARN",
|
|
6338
|
-
message: `Response Validation Warnings for platform > Catalog > updateDepartment \n ${res_error}`,
|
|
6339
|
-
});
|
|
6340
|
-
}
|
|
6341
|
-
}
|
|
6342
|
-
|
|
6343
|
-
return response;
|
|
6344
|
-
}
|
|
6345
|
-
|
|
6346
6025
|
/**
|
|
6347
6026
|
* @param {CatalogPlatformValidator.UpdateHsnCodeParam} arg - Arg object
|
|
6348
6027
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|