@gofynd/fdk-client-javascript 1.4.15-beta.13 → 1.4.15-beta.15
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 +23 -26
- package/package.json +5 -1
- package/sdk/application/ApplicationClient.d.ts +5 -6
- package/sdk/application/ApplicationClient.js +24 -20
- package/sdk/application/Cart/CartApplicationClient.d.ts +133 -83
- package/sdk/application/Cart/CartApplicationClient.js +444 -76
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +132 -114
- package/sdk/application/Catalog/CatalogApplicationClient.js +209 -126
- package/sdk/application/Common/CommonApplicationClient.d.ts +4 -4
- package/sdk/application/Common/CommonApplicationClient.js +4 -4
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +3 -3
- package/sdk/application/Communication/CommunicationApplicationClient.js +3 -3
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +58 -36
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +73 -29
- package/sdk/application/Content/ContentApplicationClient.d.ts +95 -66
- package/sdk/application/Content/ContentApplicationClient.js +274 -111
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +11 -11
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +10 -10
- package/sdk/application/Finance/FinanceApplicationClient.d.ts +29 -0
- package/sdk/application/Finance/FinanceApplicationClient.js +111 -0
- package/sdk/application/Lead/LeadApplicationClient.d.ts +7 -7
- package/sdk/application/Lead/LeadApplicationClient.js +6 -6
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +37 -57
- package/sdk/application/Logistic/LogisticApplicationClient.js +117 -180
- package/sdk/application/Order/OrderApplicationClient.d.ts +63 -21
- package/sdk/application/Order/OrderApplicationClient.js +217 -17
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +179 -149
- package/sdk/application/Payment/PaymentApplicationClient.js +301 -167
- package/sdk/application/Share/ShareApplicationClient.d.ts +7 -7
- package/sdk/application/Share/ShareApplicationClient.js +7 -7
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +7 -7
- package/sdk/application/Theme/ThemeApplicationClient.js +10 -6
- package/sdk/application/User/UserApplicationClient.d.ts +103 -53
- package/sdk/application/User/UserApplicationClient.js +308 -49
- package/sdk/common/AxiosHelper.js +11 -4
- package/sdk/common/Constant.d.ts +27 -4
- package/sdk/common/Constant.js +33 -6
- package/sdk/common/utils.d.ts +10 -0
- package/sdk/common/utils.js +24 -3
- package/sdk/partner/FileStorage/FileStoragePartnerClient.d.ts +46 -16
- package/sdk/partner/FileStorage/FileStoragePartnerClient.js +266 -40
- package/sdk/partner/FileStorage/FileStoragePartnerModel.d.ts +163 -19
- package/sdk/partner/FileStorage/FileStoragePartnerModel.js +158 -14
- package/sdk/partner/FileStorage/FileStoragePartnerValidator.d.ts +5 -2
- package/sdk/partner/FileStorage/FileStoragePartnerValidator.js +23 -7
- package/sdk/partner/Lead/LeadPartnerClient.d.ts +9 -9
- package/sdk/partner/Lead/LeadPartnerClient.js +9 -9
- package/sdk/partner/Lead/LeadPartnerModel.d.ts +14 -9
- package/sdk/partner/Lead/LeadPartnerModel.js +19 -17
- package/sdk/partner/Logistics/LogisticsPartnerClient.d.ts +264 -49
- package/sdk/partner/Logistics/LogisticsPartnerClient.js +2116 -252
- package/sdk/partner/Logistics/LogisticsPartnerModel.d.ts +2256 -258
- package/sdk/partner/Logistics/LogisticsPartnerModel.js +1187 -230
- package/sdk/partner/Logistics/LogisticsPartnerValidator.d.ts +21 -1
- package/sdk/partner/Logistics/LogisticsPartnerValidator.js +218 -13
- package/sdk/partner/PartnerClient.d.ts +5 -2
- package/sdk/partner/PartnerClient.js +21 -7
- package/sdk/partner/Theme/ThemePartnerClient.d.ts +32 -34
- package/sdk/partner/Theme/ThemePartnerClient.js +42 -44
- package/sdk/partner/Theme/ThemePartnerModel.d.ts +142 -43
- package/sdk/partner/Theme/ThemePartnerModel.js +129 -44
- package/sdk/partner/Theme/ThemePartnerValidator.js +4 -4
- package/sdk/partner/Webhook/WebhookPartnerClient.d.ts +83 -27
- package/sdk/partner/Webhook/WebhookPartnerClient.js +446 -27
- package/sdk/partner/Webhook/WebhookPartnerModel.d.ts +920 -185
- package/sdk/partner/Webhook/WebhookPartnerModel.js +462 -154
- package/sdk/partner/Webhook/WebhookPartnerValidator.d.ts +5 -0
- package/sdk/partner/Webhook/WebhookPartnerValidator.js +41 -3
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.d.ts +8 -7
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationClient.js +17 -11
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.d.ts +4 -1
- package/sdk/platform/Analytics/AnalyticsPlatformApplicationValidator.js +1 -1
- package/sdk/platform/Analytics/AnalyticsPlatformModel.d.ts +68 -13
- package/sdk/platform/Analytics/AnalyticsPlatformModel.js +44 -6
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +3 -33
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +4 -244
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +49 -145
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +20 -171
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.d.ts +1 -39
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +0 -35
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +15 -15
- package/sdk/platform/Billing/BillingPlatformClient.js +18 -18
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +443 -388
- package/sdk/platform/Billing/BillingPlatformModel.js +280 -263
- package/sdk/platform/Billing/BillingPlatformValidator.d.ts +16 -18
- package/sdk/platform/Billing/BillingPlatformValidator.js +8 -9
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +266 -203
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +1446 -500
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +729 -100
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +446 -82
- package/sdk/platform/Cart/CartPlatformModel.d.ts +6927 -1396
- package/sdk/platform/Cart/CartPlatformModel.js +3065 -1316
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +433 -248
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +1662 -559
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +464 -159
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +304 -87
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +383 -234
- package/sdk/platform/Catalog/CatalogPlatformClient.js +2475 -1557
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +9571 -2674
- package/sdk/platform/Catalog/CatalogPlatformModel.js +5081 -2019
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +364 -117
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +281 -104
- package/sdk/platform/Common/CommonPlatformClient.d.ts +5 -4
- package/sdk/platform/Common/CommonPlatformClient.js +6 -5
- package/sdk/platform/Common/CommonPlatformModel.d.ts +36 -25
- package/sdk/platform/Common/CommonPlatformModel.js +25 -14
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +80 -153
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +102 -541
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +36 -49
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +20 -60
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +1 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +1 -1
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +189 -43
- package/sdk/platform/Communication/CommunicationPlatformModel.js +165 -42
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +58 -81
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +68 -116
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +291 -249
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +243 -234
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +12 -12
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +12 -12
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +78 -65
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +101 -88
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +20 -20
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +19 -19
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +68 -34
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +174 -41
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +667 -244
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +474 -155
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +37 -9
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +27 -8
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +366 -280
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1435 -753
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +323 -223
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +335 -205
- package/sdk/platform/Content/ContentPlatformClient.d.ts +304 -106
- package/sdk/platform/Content/ContentPlatformClient.js +1842 -450
- package/sdk/platform/Content/ContentPlatformModel.d.ts +2582 -566
- package/sdk/platform/Content/ContentPlatformModel.js +1426 -558
- package/sdk/platform/Content/ContentPlatformValidator.d.ts +293 -114
- package/sdk/platform/Content/ContentPlatformValidator.js +328 -101
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +59 -23
- package/sdk/platform/Discount/DiscountPlatformClient.js +84 -23
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +403 -110
- package/sdk/platform/Discount/DiscountPlatformModel.js +121 -107
- package/sdk/platform/Discount/DiscountPlatformValidator.d.ts +56 -36
- package/sdk/platform/Discount/DiscountPlatformValidator.js +29 -19
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +12 -110
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +14 -684
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +5 -94
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +4 -115
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +20 -20
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +22 -22
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +90 -920
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +53 -949
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.d.ts +6 -6
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +6 -6
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +10 -10
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +10 -10
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +11 -11
- package/sdk/platform/Lead/LeadPlatformClient.js +11 -11
- package/sdk/platform/Lead/LeadPlatformModel.d.ts +14 -9
- package/sdk/platform/Lead/LeadPlatformModel.js +20 -18
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +56 -9
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +340 -10
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +128 -24
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +81 -19
- package/sdk/platform/Order/OrderPlatformClient.d.ts +517 -160
- package/sdk/platform/Order/OrderPlatformClient.js +1623 -384
- package/sdk/platform/Order/OrderPlatformModel.d.ts +10372 -1587
- package/sdk/platform/Order/OrderPlatformModel.js +5726 -1512
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +539 -123
- package/sdk/platform/Order/OrderPlatformValidator.js +323 -92
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +8 -6
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +11 -9
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.d.ts +6 -4
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +3 -2
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +77 -25
- package/sdk/platform/Partner/PartnerPlatformModel.js +32 -21
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +144 -219
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +307 -796
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +86 -121
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +80 -138
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +30 -30
- package/sdk/platform/Payment/PaymentPlatformClient.js +30 -30
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +901 -761
- package/sdk/platform/Payment/PaymentPlatformModel.js +663 -583
- package/sdk/platform/Payment/PaymentPlatformValidator.d.ts +8 -8
- package/sdk/platform/Payment/PaymentPlatformValidator.js +8 -8
- package/sdk/platform/PlatformApplicationClient.d.ts +0 -2
- package/sdk/platform/PlatformApplicationClient.js +0 -4
- package/sdk/platform/PlatformClient.d.ts +5 -4
- package/sdk/platform/PlatformClient.js +32 -22
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +526 -69
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +3337 -337
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +603 -38
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +529 -32
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +184 -133
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +780 -491
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +9408 -1666
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +5720 -1765
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +257 -180
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +185 -127
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +7 -7
- package/sdk/platform/Share/SharePlatformApplicationClient.js +7 -7
- package/sdk/platform/Share/SharePlatformModel.d.ts +45 -9
- package/sdk/platform/Share/SharePlatformModel.js +31 -6
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +26 -26
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +38 -29
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +18 -3
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +10 -2
- package/sdk/platform/Theme/ThemePlatformClient.d.ts +4 -4
- package/sdk/platform/Theme/ThemePlatformClient.js +4 -4
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +103 -17
- package/sdk/platform/Theme/ThemePlatformModel.js +92 -23
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +167 -45
- package/sdk/platform/User/UserPlatformApplicationClient.js +950 -67
- package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +189 -3
- package/sdk/platform/User/UserPlatformApplicationValidator.js +157 -3
- package/sdk/platform/User/UserPlatformModel.d.ts +880 -47
- package/sdk/platform/User/UserPlatformModel.js +607 -46
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +33 -86
- package/sdk/platform/Webhook/WebhookPlatformClient.js +79 -474
- package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +861 -422
- package/sdk/platform/Webhook/WebhookPlatformModel.js +469 -391
- package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +10 -55
- package/sdk/platform/Webhook/WebhookPlatformValidator.js +12 -72
- package/sdk/platform/index.d.ts +0 -2
- package/sdk/platform/index.js +0 -4
- package/sdk/public/Catalog/CatalogPublicClient.d.ts +22 -0
- package/sdk/public/Catalog/CatalogPublicClient.js +133 -0
- package/sdk/public/Catalog/CatalogPublicModel.d.ts +158 -0
- package/sdk/public/Catalog/CatalogPublicModel.js +116 -0
- package/sdk/public/Catalog/CatalogPublicValidator.d.ts +55 -0
- package/sdk/public/Catalog/CatalogPublicValidator.js +35 -0
- package/sdk/public/Configuration/ConfigurationPublicClient.d.ts +5 -4
- package/sdk/public/Configuration/ConfigurationPublicClient.js +9 -8
- package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +41 -21
- package/sdk/public/Configuration/ConfigurationPublicModel.js +28 -12
- package/sdk/public/Content/ContentPublicClient.d.ts +145 -2
- package/sdk/public/Content/ContentPublicClient.js +1067 -17
- package/sdk/public/Content/ContentPublicModel.d.ts +704 -3
- package/sdk/public/Content/ContentPublicModel.js +751 -3
- package/sdk/public/Content/ContentPublicValidator.d.ts +94 -3
- package/sdk/public/Content/ContentPublicValidator.js +119 -2
- package/sdk/public/Partner/PartnerPublicClient.d.ts +1 -1
- package/sdk/public/Partner/PartnerPublicClient.js +1 -1
- package/sdk/public/Partner/PartnerPublicModel.d.ts +248 -72
- package/sdk/public/Partner/PartnerPublicModel.js +81 -71
- package/sdk/public/Partner/PartnerPublicValidator.d.ts +2 -2
- package/sdk/public/Partner/PartnerPublicValidator.js +1 -1
- package/sdk/public/PublicClient.d.ts +5 -2
- package/sdk/public/PublicClient.js +16 -6
- package/sdk/public/Webhook/WebhookPublicClient.d.ts +13 -13
- package/sdk/public/Webhook/WebhookPublicClient.js +13 -13
- package/sdk/public/Webhook/WebhookPublicModel.d.ts +249 -67
- package/sdk/public/Webhook/WebhookPublicModel.js +81 -61
- package/sdk/public/Webhook/WebhookPublicValidator.d.ts +4 -4
- package/sdk/public/Webhook/WebhookPublicValidator.js +4 -4
- package/sdk/public/index.d.ts +1 -0
- package/sdk/public/index.js +2 -0
- package/utility.d.ts +3 -0
- package/utility.js +7 -0
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +0 -79
- package/sdk/application/Rewards/RewardsApplicationClient.js +0 -315
- package/sdk/application/Webhook/WebhookApplicationClient.d.ts +0 -19
- package/sdk/application/Webhook/WebhookApplicationClient.js +0 -72
- package/sdk/platform/Finance/FinancePlatformClient.d.ts +0 -320
- package/sdk/platform/Finance/FinancePlatformClient.js +0 -2333
- package/sdk/platform/Finance/FinancePlatformModel.d.ts +0 -2890
- package/sdk/platform/Finance/FinancePlatformModel.js +0 -2148
- package/sdk/platform/Finance/FinancePlatformValidator.d.ts +0 -284
- package/sdk/platform/Finance/FinancePlatformValidator.js +0 -354
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +0 -136
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +0 -976
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.d.ts +0 -152
- package/sdk/platform/Rewards/RewardsPlatformApplicationValidator.js +0 -157
- package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +0 -382
- package/sdk/platform/Rewards/RewardsPlatformModel.js +0 -408
|
@@ -14,14 +14,99 @@ class Webhook {
|
|
|
14
14
|
this.config = config;
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
/**
|
|
18
|
+
* @param {WebhookPartnerValidator.ResponseTimeSummaryParam} arg - Arg object.
|
|
19
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
20
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
21
|
+
* @returns {Promise<WebhookPartnerModel.ResponseTimeTs>} - Success response
|
|
22
|
+
* @name responseTimeSummary
|
|
23
|
+
* @summary: Response time summary
|
|
24
|
+
* @description: Response time summary - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/responseTimeSummary/).
|
|
25
|
+
*/
|
|
26
|
+
async responseTimeSummary(
|
|
27
|
+
{ extensionId, startDate, endDate, requestHeaders } = {
|
|
28
|
+
requestHeaders: {},
|
|
29
|
+
},
|
|
30
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
31
|
+
) {
|
|
32
|
+
const { error } = WebhookPartnerValidator.responseTimeSummary().validate(
|
|
33
|
+
{
|
|
34
|
+
extensionId,
|
|
35
|
+
startDate,
|
|
36
|
+
endDate,
|
|
37
|
+
},
|
|
38
|
+
{ abortEarly: false, allowUnknown: true }
|
|
39
|
+
);
|
|
40
|
+
if (error) {
|
|
41
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
42
|
+
}
|
|
43
|
+
|
|
44
|
+
// Showing warrnings if extra unknown parameters are found
|
|
45
|
+
const {
|
|
46
|
+
error: warrning,
|
|
47
|
+
} = WebhookPartnerValidator.responseTimeSummary().validate(
|
|
48
|
+
{
|
|
49
|
+
extensionId,
|
|
50
|
+
startDate,
|
|
51
|
+
endDate,
|
|
52
|
+
},
|
|
53
|
+
{ abortEarly: false, allowUnknown: false }
|
|
54
|
+
);
|
|
55
|
+
if (warrning) {
|
|
56
|
+
Logger({
|
|
57
|
+
level: "WARN",
|
|
58
|
+
message: `Parameter Validation warrnings for partner > Webhook > responseTimeSummary \n ${warrning}`,
|
|
59
|
+
});
|
|
60
|
+
}
|
|
61
|
+
|
|
62
|
+
const query_params = {};
|
|
63
|
+
query_params["start_date"] = startDate;
|
|
64
|
+
query_params["end_date"] = endDate;
|
|
65
|
+
|
|
66
|
+
const response = await PartnerAPIClient.execute(
|
|
67
|
+
this.config,
|
|
68
|
+
"get",
|
|
69
|
+
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/report/response_time_ts`,
|
|
70
|
+
query_params,
|
|
71
|
+
undefined,
|
|
72
|
+
requestHeaders,
|
|
73
|
+
{ responseHeaders }
|
|
74
|
+
);
|
|
75
|
+
|
|
76
|
+
let responseData = response;
|
|
77
|
+
if (responseHeaders) {
|
|
78
|
+
responseData = response[0];
|
|
79
|
+
}
|
|
80
|
+
|
|
81
|
+
const {
|
|
82
|
+
error: res_error,
|
|
83
|
+
} = WebhookPartnerModel.ResponseTimeTs().validate(responseData, {
|
|
84
|
+
abortEarly: false,
|
|
85
|
+
allowUnknown: true,
|
|
86
|
+
});
|
|
87
|
+
|
|
88
|
+
if (res_error) {
|
|
89
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
90
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
91
|
+
} else {
|
|
92
|
+
Logger({
|
|
93
|
+
level: "WARN",
|
|
94
|
+
message: `Response Validation Warnings for partner > Webhook > responseTimeSummary \n ${res_error}`,
|
|
95
|
+
});
|
|
96
|
+
}
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
return response;
|
|
100
|
+
}
|
|
101
|
+
|
|
17
102
|
/**
|
|
18
103
|
* @param {WebhookPartnerValidator.FetchDeliverySummaryParam} arg - Arg object.
|
|
19
104
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
20
105
|
* @param {import("../PartnerAPIClient").Options} - Options
|
|
21
|
-
* @returns {Promise<WebhookPartnerModel.
|
|
106
|
+
* @returns {Promise<WebhookPartnerModel.DeliverySummaryResult>} - Success response
|
|
22
107
|
* @name fetchDeliverySummary
|
|
23
108
|
* @summary: Webhook delivery summary
|
|
24
|
-
* @description: Webhook delivery summary - Check out [method documentation](https://
|
|
109
|
+
* @description: Webhook delivery summary - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/fetchDeliverySummary/).
|
|
25
110
|
*/
|
|
26
111
|
async fetchDeliverySummary(
|
|
27
112
|
{ extensionId, startDate, endDate, requestHeaders } = {
|
|
@@ -80,7 +165,7 @@ class Webhook {
|
|
|
80
165
|
|
|
81
166
|
const {
|
|
82
167
|
error: res_error,
|
|
83
|
-
} = WebhookPartnerModel.
|
|
168
|
+
} = WebhookPartnerModel.DeliverySummaryResult().validate(responseData, {
|
|
84
169
|
abortEarly: false,
|
|
85
170
|
allowUnknown: true,
|
|
86
171
|
});
|
|
@@ -103,10 +188,10 @@ class Webhook {
|
|
|
103
188
|
* @param {WebhookPartnerValidator.GetDeliveryDetailInsightsParam} arg - Arg object.
|
|
104
189
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
105
190
|
* @param {import("../PartnerAPIClient").Options} - Options
|
|
106
|
-
* @returns {Promise<WebhookPartnerModel.
|
|
191
|
+
* @returns {Promise<WebhookPartnerModel.DeliveryDetailsResult>} - Success response
|
|
107
192
|
* @name getDeliveryDetailInsights
|
|
108
193
|
* @summary: Get the insights of delivery details of the events that was pushed to subscribers
|
|
109
|
-
* @description: Get the delivery details insights - Check out [method documentation](https://
|
|
194
|
+
* @description: Get the delivery details insights - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/getDeliveryDetailInsights/).
|
|
110
195
|
*/
|
|
111
196
|
async getDeliveryDetailInsights(
|
|
112
197
|
{ extensionId, body, requestHeaders } = { requestHeaders: {} },
|
|
@@ -161,7 +246,7 @@ class Webhook {
|
|
|
161
246
|
|
|
162
247
|
const {
|
|
163
248
|
error: res_error,
|
|
164
|
-
} = WebhookPartnerModel.
|
|
249
|
+
} = WebhookPartnerModel.DeliveryDetailsResult().validate(responseData, {
|
|
165
250
|
abortEarly: false,
|
|
166
251
|
allowUnknown: true,
|
|
167
252
|
});
|
|
@@ -184,10 +269,10 @@ class Webhook {
|
|
|
184
269
|
* @param {WebhookPartnerValidator.FetchDeliveryTsParam} arg - Arg object.
|
|
185
270
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
186
271
|
* @param {import("../PartnerAPIClient").Options} - Options
|
|
187
|
-
* @returns {Promise<WebhookPartnerModel.
|
|
272
|
+
* @returns {Promise<WebhookPartnerModel.DeliveryTsResult>} - Success response
|
|
188
273
|
* @name fetchDeliveryTs
|
|
189
274
|
* @summary: Webhook delivery ts
|
|
190
|
-
* @description: Webhook delivery ts - Check out [method documentation](https://
|
|
275
|
+
* @description: Webhook delivery ts - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/fetchDeliveryTs/).
|
|
191
276
|
*/
|
|
192
277
|
async fetchDeliveryTs(
|
|
193
278
|
{ extensionId, startDate, endDate, requestHeaders } = {
|
|
@@ -246,7 +331,7 @@ class Webhook {
|
|
|
246
331
|
|
|
247
332
|
const {
|
|
248
333
|
error: res_error,
|
|
249
|
-
} = WebhookPartnerModel.
|
|
334
|
+
} = WebhookPartnerModel.DeliveryTsResult().validate(responseData, {
|
|
250
335
|
abortEarly: false,
|
|
251
336
|
allowUnknown: true,
|
|
252
337
|
});
|
|
@@ -269,10 +354,10 @@ class Webhook {
|
|
|
269
354
|
* @param {WebhookPartnerValidator.FetchReportFiltersParam} arg - Arg object.
|
|
270
355
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
271
356
|
* @param {import("../PartnerAPIClient").Options} - Options
|
|
272
|
-
* @returns {Promise<WebhookPartnerModel.
|
|
357
|
+
* @returns {Promise<WebhookPartnerModel.FilterReportResult[]>} - Success response
|
|
273
358
|
* @name fetchReportFilters
|
|
274
359
|
* @summary: Fetch webhook report filters
|
|
275
|
-
* @description: Fetch webhook report filters - Check out [method documentation](https://
|
|
360
|
+
* @description: Fetch webhook report filters - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/fetchReportFilters/).
|
|
276
361
|
*/
|
|
277
362
|
async fetchReportFilters(
|
|
278
363
|
{ extensionId, startDate, endDate, pageNo, pageSize, requestHeaders } = {
|
|
@@ -336,7 +421,7 @@ class Webhook {
|
|
|
336
421
|
}
|
|
337
422
|
|
|
338
423
|
const { error: res_error } = Joi.array()
|
|
339
|
-
.items(WebhookPartnerModel.
|
|
424
|
+
.items(WebhookPartnerModel.FilterReportResult())
|
|
340
425
|
.validate(responseData, { abortEarly: false, allowUnknown: true });
|
|
341
426
|
|
|
342
427
|
if (res_error) {
|
|
@@ -353,14 +438,93 @@ class Webhook {
|
|
|
353
438
|
return response;
|
|
354
439
|
}
|
|
355
440
|
|
|
441
|
+
/**
|
|
442
|
+
* @param {WebhookPartnerValidator.DownloadDeliveryReportParam} arg - Arg object.
|
|
443
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
444
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
445
|
+
* @returns {Promise<WebhookPartnerModel.DownloadReportResult>} - Success response
|
|
446
|
+
* @name downloadDeliveryReport
|
|
447
|
+
* @summary: Download webhook delivery report
|
|
448
|
+
* @description: Download webhook delivery report - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/downloadDeliveryReport/).
|
|
449
|
+
*/
|
|
450
|
+
async downloadDeliveryReport(
|
|
451
|
+
{ extensionId, body, requestHeaders } = { requestHeaders: {} },
|
|
452
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
453
|
+
) {
|
|
454
|
+
const { error } = WebhookPartnerValidator.downloadDeliveryReport().validate(
|
|
455
|
+
{
|
|
456
|
+
extensionId,
|
|
457
|
+
body,
|
|
458
|
+
},
|
|
459
|
+
{ abortEarly: false, allowUnknown: true }
|
|
460
|
+
);
|
|
461
|
+
if (error) {
|
|
462
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
463
|
+
}
|
|
464
|
+
|
|
465
|
+
// Showing warrnings if extra unknown parameters are found
|
|
466
|
+
const {
|
|
467
|
+
error: warrning,
|
|
468
|
+
} = WebhookPartnerValidator.downloadDeliveryReport().validate(
|
|
469
|
+
{
|
|
470
|
+
extensionId,
|
|
471
|
+
body,
|
|
472
|
+
},
|
|
473
|
+
{ abortEarly: false, allowUnknown: false }
|
|
474
|
+
);
|
|
475
|
+
if (warrning) {
|
|
476
|
+
Logger({
|
|
477
|
+
level: "WARN",
|
|
478
|
+
message: `Parameter Validation warrnings for partner > Webhook > downloadDeliveryReport \n ${warrning}`,
|
|
479
|
+
});
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
const query_params = {};
|
|
483
|
+
|
|
484
|
+
const response = await PartnerAPIClient.execute(
|
|
485
|
+
this.config,
|
|
486
|
+
"post",
|
|
487
|
+
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/report/download`,
|
|
488
|
+
query_params,
|
|
489
|
+
body,
|
|
490
|
+
requestHeaders,
|
|
491
|
+
{ responseHeaders }
|
|
492
|
+
);
|
|
493
|
+
|
|
494
|
+
let responseData = response;
|
|
495
|
+
if (responseHeaders) {
|
|
496
|
+
responseData = response[0];
|
|
497
|
+
}
|
|
498
|
+
|
|
499
|
+
const {
|
|
500
|
+
error: res_error,
|
|
501
|
+
} = WebhookPartnerModel.DownloadReportResult().validate(responseData, {
|
|
502
|
+
abortEarly: false,
|
|
503
|
+
allowUnknown: true,
|
|
504
|
+
});
|
|
505
|
+
|
|
506
|
+
if (res_error) {
|
|
507
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
508
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
509
|
+
} else {
|
|
510
|
+
Logger({
|
|
511
|
+
level: "WARN",
|
|
512
|
+
message: `Response Validation Warnings for partner > Webhook > downloadDeliveryReport \n ${res_error}`,
|
|
513
|
+
});
|
|
514
|
+
}
|
|
515
|
+
}
|
|
516
|
+
|
|
517
|
+
return response;
|
|
518
|
+
}
|
|
519
|
+
|
|
356
520
|
/**
|
|
357
521
|
* @param {WebhookPartnerValidator.CancelReportDownloadParam} arg - Arg object.
|
|
358
522
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
359
523
|
* @param {import("../PartnerAPIClient").Options} - Options
|
|
360
|
-
* @returns {Promise<WebhookPartnerModel.
|
|
524
|
+
* @returns {Promise<WebhookPartnerModel.CancelDownloadResult>} - Success response
|
|
361
525
|
* @name cancelReportDownload
|
|
362
526
|
* @summary: Cancel report download job
|
|
363
|
-
* @description: Cancel report download job - Check out [method documentation](https://
|
|
527
|
+
* @description: Cancel report download job - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/cancelReportDownload/).
|
|
364
528
|
*/
|
|
365
529
|
async cancelReportDownload(
|
|
366
530
|
{ extensionId, filename, requestHeaders } = { requestHeaders: {} },
|
|
@@ -413,7 +577,7 @@ class Webhook {
|
|
|
413
577
|
|
|
414
578
|
const {
|
|
415
579
|
error: res_error,
|
|
416
|
-
} = WebhookPartnerModel.
|
|
580
|
+
} = WebhookPartnerModel.CancelDownloadResult().validate(responseData, {
|
|
417
581
|
abortEarly: false,
|
|
418
582
|
allowUnknown: true,
|
|
419
583
|
});
|
|
@@ -436,11 +600,11 @@ class Webhook {
|
|
|
436
600
|
* @param {WebhookPartnerValidator.GetHistoricalReportsParam} arg - Arg object.
|
|
437
601
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
438
602
|
* @param {import("../PartnerAPIClient").Options} - Options
|
|
439
|
-
* @returns {Promise<WebhookPartnerModel.
|
|
603
|
+
* @returns {Promise<WebhookPartnerModel.HistoryResult>} - Success response
|
|
440
604
|
* @name getHistoricalReports
|
|
441
605
|
* @summary: Get report download history.
|
|
442
606
|
* @description: Retrieve history reports for a specific company based on the provided filters.
|
|
443
|
-
* - Check out [method documentation](https://
|
|
607
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/getHistoricalReports/).
|
|
444
608
|
*/
|
|
445
609
|
async getHistoricalReports(
|
|
446
610
|
{ extensionId, body, requestHeaders } = { requestHeaders: {} },
|
|
@@ -493,7 +657,7 @@ class Webhook {
|
|
|
493
657
|
|
|
494
658
|
const {
|
|
495
659
|
error: res_error,
|
|
496
|
-
} = WebhookPartnerModel.
|
|
660
|
+
} = WebhookPartnerModel.HistoryResult().validate(responseData, {
|
|
497
661
|
abortEarly: false,
|
|
498
662
|
allowUnknown: true,
|
|
499
663
|
});
|
|
@@ -516,11 +680,11 @@ class Webhook {
|
|
|
516
680
|
* @param {WebhookPartnerValidator.GetInvalidEventListParam} arg - Arg object.
|
|
517
681
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
518
682
|
* @param {import("../PartnerAPIClient").Options} - Options
|
|
519
|
-
* @returns {Promise<WebhookPartnerModel.
|
|
683
|
+
* @returns {Promise<WebhookPartnerModel.InvalidEventsResult[]>} - Success response
|
|
520
684
|
* @name getInvalidEventList
|
|
521
685
|
* @summary: Get invalid event list
|
|
522
686
|
* @description: Get invalid event list.
|
|
523
|
-
* - Check out [method documentation](https://
|
|
687
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/getInvalidEventList/).
|
|
524
688
|
*/
|
|
525
689
|
async getInvalidEventList(
|
|
526
690
|
{ extensionId, body, requestHeaders } = { requestHeaders: {} },
|
|
@@ -572,7 +736,7 @@ class Webhook {
|
|
|
572
736
|
}
|
|
573
737
|
|
|
574
738
|
const { error: res_error } = Joi.array()
|
|
575
|
-
.items(WebhookPartnerModel.
|
|
739
|
+
.items(WebhookPartnerModel.InvalidEventsResult())
|
|
576
740
|
.validate(responseData, { abortEarly: false, allowUnknown: true });
|
|
577
741
|
|
|
578
742
|
if (res_error) {
|
|
@@ -593,10 +757,10 @@ class Webhook {
|
|
|
593
757
|
* @param {WebhookPartnerValidator.FetchSubscribersParam} arg - Arg object.
|
|
594
758
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
595
759
|
* @param {import("../PartnerAPIClient").Options} - Options
|
|
596
|
-
* @returns {Promise<WebhookPartnerModel.
|
|
760
|
+
* @returns {Promise<WebhookPartnerModel.SubscriberConfigDetails>} - Success response
|
|
597
761
|
* @name fetchSubscribers
|
|
598
762
|
* @summary: Fetch subscriber by filters
|
|
599
|
-
* @description: Fetch subscriber by filters - Check out [method documentation](https://
|
|
763
|
+
* @description: Fetch subscriber by filters - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/fetchSubscribers/).
|
|
600
764
|
*/
|
|
601
765
|
async fetchSubscribers(
|
|
602
766
|
{ extensionId, requestHeaders } = { requestHeaders: {} },
|
|
@@ -647,7 +811,7 @@ class Webhook {
|
|
|
647
811
|
|
|
648
812
|
const {
|
|
649
813
|
error: res_error,
|
|
650
|
-
} = WebhookPartnerModel.
|
|
814
|
+
} = WebhookPartnerModel.SubscriberConfigDetails().validate(responseData, {
|
|
651
815
|
abortEarly: false,
|
|
652
816
|
allowUnknown: true,
|
|
653
817
|
});
|
|
@@ -670,11 +834,11 @@ class Webhook {
|
|
|
670
834
|
* @param {WebhookPartnerValidator.UpdateSubscriberParam} arg - Arg object.
|
|
671
835
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
672
836
|
* @param {import("../PartnerAPIClient").Options} - Options
|
|
673
|
-
* @returns {Promise<WebhookPartnerModel.
|
|
837
|
+
* @returns {Promise<WebhookPartnerModel.SubscriberUpdateResult>} - Success response
|
|
674
838
|
* @name updateSubscriber
|
|
675
839
|
* @summary: Update subscriber status by id.
|
|
676
840
|
* @description: Update subscriber status by id.
|
|
677
|
-
* - Check out [method documentation](https://
|
|
841
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/updateSubscriber/).
|
|
678
842
|
*/
|
|
679
843
|
async updateSubscriber(
|
|
680
844
|
{ extensionId, subscriberId, body, requestHeaders } = {
|
|
@@ -731,7 +895,7 @@ class Webhook {
|
|
|
731
895
|
|
|
732
896
|
const {
|
|
733
897
|
error: res_error,
|
|
734
|
-
} = WebhookPartnerModel.
|
|
898
|
+
} = WebhookPartnerModel.SubscriberUpdateResult().validate(responseData, {
|
|
735
899
|
abortEarly: false,
|
|
736
900
|
allowUnknown: true,
|
|
737
901
|
});
|
|
@@ -749,5 +913,260 @@ class Webhook {
|
|
|
749
913
|
|
|
750
914
|
return response;
|
|
751
915
|
}
|
|
916
|
+
|
|
917
|
+
/**
|
|
918
|
+
* @param {WebhookPartnerValidator.ValidateFilterConfigurationParam} arg - Arg object.
|
|
919
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
920
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
921
|
+
* @returns {Promise<WebhookPartnerModel.FilterValidationResult>} - Success response
|
|
922
|
+
* @name validateFilterConfiguration
|
|
923
|
+
* @summary: Validate filter configuration.
|
|
924
|
+
* @description: Validate a filter configuration against sample payload data.
|
|
925
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/validateFilterConfiguration/).
|
|
926
|
+
*/
|
|
927
|
+
async validateFilterConfiguration(
|
|
928
|
+
{ extensionId, body, requestHeaders } = { requestHeaders: {} },
|
|
929
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
930
|
+
) {
|
|
931
|
+
const {
|
|
932
|
+
error,
|
|
933
|
+
} = WebhookPartnerValidator.validateFilterConfiguration().validate(
|
|
934
|
+
{
|
|
935
|
+
extensionId,
|
|
936
|
+
body,
|
|
937
|
+
},
|
|
938
|
+
{ abortEarly: false, allowUnknown: true }
|
|
939
|
+
);
|
|
940
|
+
if (error) {
|
|
941
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
942
|
+
}
|
|
943
|
+
|
|
944
|
+
// Showing warrnings if extra unknown parameters are found
|
|
945
|
+
const {
|
|
946
|
+
error: warrning,
|
|
947
|
+
} = WebhookPartnerValidator.validateFilterConfiguration().validate(
|
|
948
|
+
{
|
|
949
|
+
extensionId,
|
|
950
|
+
body,
|
|
951
|
+
},
|
|
952
|
+
{ abortEarly: false, allowUnknown: false }
|
|
953
|
+
);
|
|
954
|
+
if (warrning) {
|
|
955
|
+
Logger({
|
|
956
|
+
level: "WARN",
|
|
957
|
+
message: `Parameter Validation warrnings for partner > Webhook > validateFilterConfiguration \n ${warrning}`,
|
|
958
|
+
});
|
|
959
|
+
}
|
|
960
|
+
|
|
961
|
+
const query_params = {};
|
|
962
|
+
|
|
963
|
+
const response = await PartnerAPIClient.execute(
|
|
964
|
+
this.config,
|
|
965
|
+
"post",
|
|
966
|
+
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/validate/filter`,
|
|
967
|
+
query_params,
|
|
968
|
+
body,
|
|
969
|
+
requestHeaders,
|
|
970
|
+
{ responseHeaders }
|
|
971
|
+
);
|
|
972
|
+
|
|
973
|
+
let responseData = response;
|
|
974
|
+
if (responseHeaders) {
|
|
975
|
+
responseData = response[0];
|
|
976
|
+
}
|
|
977
|
+
|
|
978
|
+
const {
|
|
979
|
+
error: res_error,
|
|
980
|
+
} = WebhookPartnerModel.FilterValidationResult().validate(responseData, {
|
|
981
|
+
abortEarly: false,
|
|
982
|
+
allowUnknown: true,
|
|
983
|
+
});
|
|
984
|
+
|
|
985
|
+
if (res_error) {
|
|
986
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
987
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
988
|
+
} else {
|
|
989
|
+
Logger({
|
|
990
|
+
level: "WARN",
|
|
991
|
+
message: `Response Validation Warnings for partner > Webhook > validateFilterConfiguration \n ${res_error}`,
|
|
992
|
+
});
|
|
993
|
+
}
|
|
994
|
+
}
|
|
995
|
+
|
|
996
|
+
return response;
|
|
997
|
+
}
|
|
998
|
+
|
|
999
|
+
/**
|
|
1000
|
+
* @param {WebhookPartnerValidator.ValidateReducerConfigurationParam} arg -
|
|
1001
|
+
* Arg object.
|
|
1002
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1003
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
1004
|
+
* @returns {Promise<WebhookPartnerModel.ReducerValidationResult>} - Success response
|
|
1005
|
+
* @name validateReducerConfiguration
|
|
1006
|
+
* @summary: Validate reducer configuration.
|
|
1007
|
+
* @description: Validate a reducer configuration against sample payload data.
|
|
1008
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/validateReducerConfiguration/).
|
|
1009
|
+
*/
|
|
1010
|
+
async validateReducerConfiguration(
|
|
1011
|
+
{ extensionId, body, requestHeaders } = { requestHeaders: {} },
|
|
1012
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1013
|
+
) {
|
|
1014
|
+
const {
|
|
1015
|
+
error,
|
|
1016
|
+
} = WebhookPartnerValidator.validateReducerConfiguration().validate(
|
|
1017
|
+
{
|
|
1018
|
+
extensionId,
|
|
1019
|
+
body,
|
|
1020
|
+
},
|
|
1021
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1022
|
+
);
|
|
1023
|
+
if (error) {
|
|
1024
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1025
|
+
}
|
|
1026
|
+
|
|
1027
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1028
|
+
const {
|
|
1029
|
+
error: warrning,
|
|
1030
|
+
} = WebhookPartnerValidator.validateReducerConfiguration().validate(
|
|
1031
|
+
{
|
|
1032
|
+
extensionId,
|
|
1033
|
+
body,
|
|
1034
|
+
},
|
|
1035
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1036
|
+
);
|
|
1037
|
+
if (warrning) {
|
|
1038
|
+
Logger({
|
|
1039
|
+
level: "WARN",
|
|
1040
|
+
message: `Parameter Validation warrnings for partner > Webhook > validateReducerConfiguration \n ${warrning}`,
|
|
1041
|
+
});
|
|
1042
|
+
}
|
|
1043
|
+
|
|
1044
|
+
const query_params = {};
|
|
1045
|
+
|
|
1046
|
+
const response = await PartnerAPIClient.execute(
|
|
1047
|
+
this.config,
|
|
1048
|
+
"post",
|
|
1049
|
+
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/validate/reducer`,
|
|
1050
|
+
query_params,
|
|
1051
|
+
body,
|
|
1052
|
+
requestHeaders,
|
|
1053
|
+
{ responseHeaders }
|
|
1054
|
+
);
|
|
1055
|
+
|
|
1056
|
+
let responseData = response;
|
|
1057
|
+
if (responseHeaders) {
|
|
1058
|
+
responseData = response[0];
|
|
1059
|
+
}
|
|
1060
|
+
|
|
1061
|
+
const {
|
|
1062
|
+
error: res_error,
|
|
1063
|
+
} = WebhookPartnerModel.ReducerValidationResult().validate(responseData, {
|
|
1064
|
+
abortEarly: false,
|
|
1065
|
+
allowUnknown: true,
|
|
1066
|
+
});
|
|
1067
|
+
|
|
1068
|
+
if (res_error) {
|
|
1069
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
1070
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1071
|
+
} else {
|
|
1072
|
+
Logger({
|
|
1073
|
+
level: "WARN",
|
|
1074
|
+
message: `Response Validation Warnings for partner > Webhook > validateReducerConfiguration \n ${res_error}`,
|
|
1075
|
+
});
|
|
1076
|
+
}
|
|
1077
|
+
}
|
|
1078
|
+
|
|
1079
|
+
return response;
|
|
1080
|
+
}
|
|
1081
|
+
|
|
1082
|
+
/**
|
|
1083
|
+
* @param {WebhookPartnerValidator.SaveFilterReducerConfigurationParam} arg
|
|
1084
|
+
* - Arg object.
|
|
1085
|
+
*
|
|
1086
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1087
|
+
* @param {import("../PartnerAPIClient").Options} - Options
|
|
1088
|
+
* @returns {Promise<WebhookPartnerModel.FilterReducerSaveResult>} - Success response
|
|
1089
|
+
* @name saveFilterReducerConfiguration
|
|
1090
|
+
* @summary: Save filter or reducer configuration.
|
|
1091
|
+
* @description: Save filter and/or reducer configuration for a subscriber event mapping.
|
|
1092
|
+
* - Check out [method documentation](https://docs.fynd.com/partners/commerce/sdk/partner/webhook/saveFilterReducerConfiguration/).
|
|
1093
|
+
*/
|
|
1094
|
+
async saveFilterReducerConfiguration(
|
|
1095
|
+
{ extensionId, companyId, subscriberId, body, requestHeaders } = {
|
|
1096
|
+
requestHeaders: {},
|
|
1097
|
+
},
|
|
1098
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1099
|
+
) {
|
|
1100
|
+
const {
|
|
1101
|
+
error,
|
|
1102
|
+
} = WebhookPartnerValidator.saveFilterReducerConfiguration().validate(
|
|
1103
|
+
{
|
|
1104
|
+
extensionId,
|
|
1105
|
+
companyId,
|
|
1106
|
+
subscriberId,
|
|
1107
|
+
body,
|
|
1108
|
+
},
|
|
1109
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1110
|
+
);
|
|
1111
|
+
if (error) {
|
|
1112
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1113
|
+
}
|
|
1114
|
+
|
|
1115
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1116
|
+
const {
|
|
1117
|
+
error: warrning,
|
|
1118
|
+
} = WebhookPartnerValidator.saveFilterReducerConfiguration().validate(
|
|
1119
|
+
{
|
|
1120
|
+
extensionId,
|
|
1121
|
+
companyId,
|
|
1122
|
+
subscriberId,
|
|
1123
|
+
body,
|
|
1124
|
+
},
|
|
1125
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1126
|
+
);
|
|
1127
|
+
if (warrning) {
|
|
1128
|
+
Logger({
|
|
1129
|
+
level: "WARN",
|
|
1130
|
+
message: `Parameter Validation warrnings for partner > Webhook > saveFilterReducerConfiguration \n ${warrning}`,
|
|
1131
|
+
});
|
|
1132
|
+
}
|
|
1133
|
+
|
|
1134
|
+
const query_params = {};
|
|
1135
|
+
|
|
1136
|
+
const response = await PartnerAPIClient.execute(
|
|
1137
|
+
this.config,
|
|
1138
|
+
"put",
|
|
1139
|
+
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/company/${companyId}/subscriber/${subscriberId}/filter_reducer`,
|
|
1140
|
+
query_params,
|
|
1141
|
+
body,
|
|
1142
|
+
requestHeaders,
|
|
1143
|
+
{ responseHeaders }
|
|
1144
|
+
);
|
|
1145
|
+
|
|
1146
|
+
let responseData = response;
|
|
1147
|
+
if (responseHeaders) {
|
|
1148
|
+
responseData = response[0];
|
|
1149
|
+
}
|
|
1150
|
+
|
|
1151
|
+
const {
|
|
1152
|
+
error: res_error,
|
|
1153
|
+
} = WebhookPartnerModel.FilterReducerSaveResult().validate(responseData, {
|
|
1154
|
+
abortEarly: false,
|
|
1155
|
+
allowUnknown: true,
|
|
1156
|
+
});
|
|
1157
|
+
|
|
1158
|
+
if (res_error) {
|
|
1159
|
+
if (this.config.options.strictResponseCheck === true) {
|
|
1160
|
+
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
1161
|
+
} else {
|
|
1162
|
+
Logger({
|
|
1163
|
+
level: "WARN",
|
|
1164
|
+
message: `Response Validation Warnings for partner > Webhook > saveFilterReducerConfiguration \n ${res_error}`,
|
|
1165
|
+
});
|
|
1166
|
+
}
|
|
1167
|
+
}
|
|
1168
|
+
|
|
1169
|
+
return response;
|
|
1170
|
+
}
|
|
752
1171
|
}
|
|
753
1172
|
module.exports = Webhook;
|