@gofynd/fdk-client-javascript 1.4.1 → 1.4.2-beta.10
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 +3 -2
- package/sdk/application/ApplicationClient.js +20 -0
- package/sdk/application/Cart/CartApplicationClient.d.ts +1 -1
- package/sdk/application/Cart/CartApplicationClient.js +3 -5
- package/sdk/application/Cart/CartApplicationModel.d.ts +1634 -1742
- package/sdk/application/Cart/CartApplicationModel.js +1388 -1464
- package/sdk/application/Cart/CartApplicationValidator.d.ts +0 -4
- package/sdk/application/Cart/CartApplicationValidator.js +0 -4
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +6 -3
- package/sdk/application/Catalog/CatalogApplicationClient.js +20 -7
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +1917 -1917
- package/sdk/application/Catalog/CatalogApplicationModel.js +1613 -1613
- package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +14 -0
- package/sdk/application/Catalog/CatalogApplicationValidator.js +6 -0
- package/sdk/application/Common/CommonApplicationModel.d.ts +235 -235
- package/sdk/application/Common/CommonApplicationModel.js +172 -172
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +72 -72
- package/sdk/application/Communication/CommunicationApplicationModel.js +64 -64
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +1492 -1626
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +1038 -1180
- package/sdk/application/Content/ContentApplicationClient.d.ts +0 -36
- package/sdk/application/Content/ContentApplicationClient.js +0 -246
- package/sdk/application/Content/ContentApplicationModel.d.ts +546 -753
- package/sdk/application/Content/ContentApplicationModel.js +565 -817
- package/sdk/application/Content/ContentApplicationValidator.d.ts +1 -40
- package/sdk/application/Content/ContentApplicationValidator.js +0 -41
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +79 -79
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +84 -84
- package/sdk/application/Lead/LeadApplicationModel.d.ts +417 -417
- package/sdk/application/Lead/LeadApplicationModel.js +301 -301
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +0 -67
- package/sdk/application/Logistic/LogisticApplicationClient.js +0 -547
- package/sdk/application/Logistic/LogisticApplicationModel.d.ts +257 -712
- package/sdk/application/Logistic/LogisticApplicationModel.js +267 -755
- package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +1 -211
- package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -131
- package/sdk/application/Order/OrderApplicationClient.d.ts +3 -3
- package/sdk/application/Order/OrderApplicationClient.js +8 -32
- package/sdk/application/Order/OrderApplicationModel.d.ts +845 -853
- package/sdk/application/Order/OrderApplicationModel.js +816 -824
- package/sdk/application/Order/OrderApplicationValidator.d.ts +0 -20
- package/sdk/application/Order/OrderApplicationValidator.js +0 -8
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +2 -46
- package/sdk/application/Payment/PaymentApplicationClient.js +10 -341
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +1892 -2199
- package/sdk/application/Payment/PaymentApplicationModel.js +1235 -1506
- package/sdk/application/Payment/PaymentApplicationValidator.d.ts +14 -59
- package/sdk/application/Payment/PaymentApplicationValidator.js +10 -64
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +1396 -1429
- package/sdk/application/PosCart/PosCartApplicationModel.js +1233 -1257
- package/sdk/application/Rewards/RewardsApplicationModel.d.ts +214 -214
- package/sdk/application/Rewards/RewardsApplicationModel.js +211 -211
- package/sdk/application/Share/ShareApplicationModel.d.ts +114 -114
- package/sdk/application/Share/ShareApplicationModel.js +121 -121
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +1 -1
- package/sdk/application/Theme/ThemeApplicationClient.js +3 -7
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +783 -969
- package/sdk/application/Theme/ThemeApplicationModel.js +571 -867
- package/sdk/application/Theme/ThemeApplicationValidator.d.ts +0 -10
- package/sdk/application/Theme/ThemeApplicationValidator.js +0 -4
- package/sdk/application/User/UserApplicationClient.d.ts +0 -33
- package/sdk/application/User/UserApplicationClient.js +0 -239
- package/sdk/application/User/UserApplicationModel.d.ts +753 -768
- package/sdk/application/User/UserApplicationModel.js +731 -755
- package/sdk/application/User/UserApplicationValidator.d.ts +1 -34
- package/sdk/application/User/UserApplicationValidator.js +0 -36
- package/sdk/common/Clickstream.d.ts +1 -0
- package/sdk/common/Clickstream.js +254 -0
- package/sdk/common/Utility.js +1 -4
- package/sdk/partner/FileStorage/FileStoragePartnerModel.d.ts +72 -60
- package/sdk/partner/FileStorage/FileStoragePartnerModel.js +70 -58
- package/sdk/partner/PartnerClient.d.ts +0 -6
- package/sdk/partner/PartnerClient.js +0 -9
- package/sdk/partner/Theme/ThemePartnerClient.d.ts +0 -10
- package/sdk/partner/Theme/ThemePartnerClient.js +0 -80
- package/sdk/partner/Theme/ThemePartnerModel.d.ts +1178 -1153
- package/sdk/partner/Theme/ThemePartnerModel.js +830 -974
- package/sdk/partner/Theme/ThemePartnerValidator.d.ts +0 -1
- package/sdk/partner/Theme/ThemePartnerValidator.js +0 -9
- package/sdk/partner/index.d.ts +0 -3
- package/sdk/partner/index.js +0 -6
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +2 -2
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +123 -123
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +109 -109
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +1 -11
- package/sdk/platform/Billing/BillingPlatformClient.js +3 -110
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +734 -800
- package/sdk/platform/Billing/BillingPlatformModel.js +732 -810
- package/sdk/platform/Billing/BillingPlatformValidator.d.ts +4 -43
- package/sdk/platform/Billing/BillingPlatformValidator.js +2 -29
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +11 -1
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +81 -7
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +13 -5
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +12 -4
- package/sdk/platform/Cart/CartPlatformModel.d.ts +3223 -3328
- package/sdk/platform/Cart/CartPlatformModel.js +2875 -2946
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +11 -15
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +21 -52
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.d.ts +0 -27
- package/sdk/platform/Catalog/CatalogPlatformApplicationValidator.js +0 -11
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +15 -27
- package/sdk/platform/Catalog/CatalogPlatformClient.js +93 -189
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +617 -920
- package/sdk/platform/Catalog/CatalogPlatformModel.js +584 -919
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +27 -41
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +19 -31
- package/sdk/platform/Common/CommonPlatformModel.d.ts +255 -255
- package/sdk/platform/Common/CommonPlatformModel.js +187 -187
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +37 -139
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +52 -737
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +3 -133
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +1 -113
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +1079 -1228
- package/sdk/platform/Communication/CommunicationPlatformModel.js +1090 -1262
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +2 -8
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +4 -32
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +629 -658
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +641 -675
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +0 -14
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +0 -6
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +8 -8
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +4 -4
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +2992 -3231
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +2092 -2303
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.d.ts +2 -2
- package/sdk/platform/Configuration/ConfigurationPlatformValidator.js +2 -2
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +0 -391
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +1074 -3656
- package/sdk/platform/Content/ContentPlatformApplicationValidator.d.ts +1 -351
- package/sdk/platform/Content/ContentPlatformApplicationValidator.js +0 -410
- package/sdk/platform/Content/ContentPlatformModel.d.ts +972 -2071
- package/sdk/platform/Content/ContentPlatformModel.js +1039 -2355
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +2 -2
- package/sdk/platform/Discount/DiscountPlatformClient.js +2 -2
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +174 -259
- package/sdk/platform/Discount/DiscountPlatformModel.js +163 -257
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +6 -16
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +8 -117
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +4 -55
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +2 -39
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +821 -892
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +833 -901
- package/sdk/platform/Finance/FinancePlatformClient.d.ts +0 -33
- package/sdk/platform/Finance/FinancePlatformClient.js +0 -240
- package/sdk/platform/Finance/FinancePlatformModel.d.ts +910 -1056
- package/sdk/platform/Finance/FinancePlatformModel.js +884 -1070
- package/sdk/platform/Finance/FinancePlatformValidator.d.ts +1 -38
- package/sdk/platform/Finance/FinancePlatformValidator.js +0 -38
- package/sdk/platform/Inventory/InventoryPlatformModel.d.ts +942 -942
- package/sdk/platform/Inventory/InventoryPlatformModel.js +1003 -1003
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +28 -38
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +56 -137
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.d.ts +29 -41
- package/sdk/platform/Lead/LeadPlatformApplicationValidator.js +21 -33
- package/sdk/platform/Lead/LeadPlatformModel.d.ts +601 -610
- package/sdk/platform/Lead/LeadPlatformModel.js +457 -471
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +1 -11
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +1 -93
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -28
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +0 -18
- package/sdk/platform/Order/OrderPlatformClient.d.ts +22 -143
- package/sdk/platform/Order/OrderPlatformClient.js +160 -1190
- package/sdk/platform/Order/OrderPlatformModel.d.ts +4451 -5275
- package/sdk/platform/Order/OrderPlatformModel.js +4039 -4994
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +21 -257
- package/sdk/platform/Order/OrderPlatformValidator.js +15 -216
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +22 -22
- package/sdk/platform/Partner/PartnerPlatformModel.js +22 -22
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +13 -119
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +40 -750
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +7 -143
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +6 -133
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +1 -1
- package/sdk/platform/Payment/PaymentPlatformClient.js +1 -1
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +2067 -2929
- package/sdk/platform/Payment/PaymentPlatformModel.js +1427 -2090
- package/sdk/platform/PlatformApplicationClient.d.ts +2 -2
- package/sdk/platform/PlatformApplicationClient.js +4 -4
- package/sdk/platform/PlatformClient.d.ts +2 -4
- package/sdk/platform/PlatformClient.js +4 -8
- package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +204 -204
- package/sdk/platform/Rewards/RewardsPlatformModel.js +199 -199
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +66 -142
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +147 -645
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +63 -131
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +47 -126
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +105 -217
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +349 -1138
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +990 -1589
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +986 -1702
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +133 -382
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +102 -266
- package/sdk/platform/Share/SharePlatformModel.d.ts +147 -147
- package/sdk/platform/Share/SharePlatformModel.js +139 -139
- package/sdk/platform/Theme/ThemePlatformClient.d.ts +1 -11
- package/sdk/platform/Theme/ThemePlatformClient.js +3 -87
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +765 -1133
- package/sdk/platform/Theme/ThemePlatformModel.js +561 -1009
- package/sdk/platform/Theme/ThemePlatformValidator.d.ts +4 -28
- package/sdk/platform/Theme/ThemePlatformValidator.js +2 -21
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +1 -116
- package/sdk/platform/User/UserPlatformApplicationClient.js +86 -932
- package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +7 -224
- package/sdk/platform/User/UserPlatformApplicationValidator.js +5 -173
- package/sdk/platform/User/UserPlatformModel.d.ts +428 -765
- package/sdk/platform/User/UserPlatformModel.js +428 -679
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +37 -45
- package/sdk/platform/Webhook/WebhookPlatformClient.js +57 -61
- package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +403 -448
- package/sdk/platform/Webhook/WebhookPlatformModel.js +309 -369
- package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +10 -7
- package/sdk/platform/Webhook/WebhookPlatformValidator.js +6 -6
- package/sdk/platform/index.d.ts +1 -1
- package/sdk/platform/index.js +2 -2
- package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +237 -237
- package/sdk/public/Configuration/ConfigurationPublicModel.js +174 -174
- package/sdk/public/Inventory/InventoryPublicModel.d.ts +237 -237
- package/sdk/public/Inventory/InventoryPublicModel.js +257 -257
- package/sdk/public/Partner/PartnerPublicModel.d.ts +104 -104
- package/sdk/public/Partner/PartnerPublicModel.js +113 -113
- package/sdk/public/PublicClient.d.ts +0 -4
- package/sdk/public/PublicClient.js +0 -8
- package/sdk/public/Webhook/WebhookPublicClient.d.ts +0 -33
- package/sdk/public/Webhook/WebhookPublicClient.js +0 -242
- package/sdk/public/Webhook/WebhookPublicModel.d.ts +15 -161
- package/sdk/public/Webhook/WebhookPublicModel.js +13 -189
- package/sdk/public/Webhook/WebhookPublicValidator.d.ts +1 -23
- package/sdk/public/Webhook/WebhookPublicValidator.js +0 -31
- package/sdk/public/index.d.ts +0 -2
- package/sdk/public/index.js +0 -4
- package/sdk/partner/Lead/LeadPartnerClient.d.ts +0 -125
- package/sdk/partner/Lead/LeadPartnerClient.js +0 -785
- package/sdk/partner/Lead/LeadPartnerModel.d.ts +0 -1127
- package/sdk/partner/Lead/LeadPartnerModel.js +0 -896
- package/sdk/partner/Lead/LeadPartnerValidator.d.ts +0 -12
- package/sdk/partner/Lead/LeadPartnerValidator.js +0 -67
- package/sdk/partner/Logistics/LogisticsPartnerClient.d.ts +0 -155
- package/sdk/partner/Logistics/LogisticsPartnerClient.js +0 -1195
- package/sdk/partner/Logistics/LogisticsPartnerModel.d.ts +0 -372
- package/sdk/partner/Logistics/LogisticsPartnerModel.js +0 -442
- package/sdk/partner/Logistics/LogisticsPartnerValidator.d.ts +0 -16
- package/sdk/partner/Logistics/LogisticsPartnerValidator.js +0 -123
- package/sdk/partner/Webhook/WebhookPartnerClient.d.ts +0 -99
- package/sdk/partner/Webhook/WebhookPartnerClient.js +0 -753
- package/sdk/partner/Webhook/WebhookPartnerModel.d.ts +0 -566
- package/sdk/partner/Webhook/WebhookPartnerModel.js +0 -583
- package/sdk/partner/Webhook/WebhookPartnerValidator.d.ts +0 -12
- package/sdk/partner/Webhook/WebhookPartnerValidator.js +0 -74
- package/sdk/platform/Content/ContentPlatformClient.d.ts +0 -277
- package/sdk/platform/Content/ContentPlatformClient.js +0 -2011
- package/sdk/platform/Content/ContentPlatformValidator.d.ts +0 -247
- package/sdk/platform/Content/ContentPlatformValidator.js +0 -319
- package/sdk/public/Billing/BillingPublicClient.d.ts +0 -23
- package/sdk/public/Billing/BillingPublicClient.js +0 -116
- package/sdk/public/Billing/BillingPublicModel.d.ts +0 -92
- package/sdk/public/Billing/BillingPublicModel.js +0 -96
- package/sdk/public/Billing/BillingPublicValidator.d.ts +0 -18
- package/sdk/public/Billing/BillingPublicValidator.js +0 -19
- package/sdk/public/Content/ContentPublicClient.d.ts +0 -22
- package/sdk/public/Content/ContentPublicClient.js +0 -114
- package/sdk/public/Content/ContentPublicModel.d.ts +0 -53
- package/sdk/public/Content/ContentPublicModel.js +0 -60
- package/sdk/public/Content/ContentPublicValidator.d.ts +0 -18
- package/sdk/public/Content/ContentPublicValidator.js +0 -19
|
@@ -1,753 +0,0 @@
|
|
|
1
|
-
const PartnerAPIClient = require("../PartnerAPIClient");
|
|
2
|
-
const {
|
|
3
|
-
FDKClientValidationError,
|
|
4
|
-
FDKResponseValidationError,
|
|
5
|
-
} = require("../../common/FDKError");
|
|
6
|
-
const Paginator = require("../../common/Paginator");
|
|
7
|
-
const WebhookPartnerValidator = require("./WebhookPartnerValidator");
|
|
8
|
-
const WebhookPartnerModel = require("./WebhookPartnerModel");
|
|
9
|
-
const { Logger } = require("./../../common/Logger");
|
|
10
|
-
const Joi = require("joi");
|
|
11
|
-
|
|
12
|
-
class Webhook {
|
|
13
|
-
constructor(config) {
|
|
14
|
-
this.config = config;
|
|
15
|
-
}
|
|
16
|
-
|
|
17
|
-
/**
|
|
18
|
-
* @param {WebhookPartnerValidator.FetchDeliverySummaryParam} arg - Arg object.
|
|
19
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
20
|
-
* @param {import("../PartnerAPIClient").Options} - Options
|
|
21
|
-
* @returns {Promise<WebhookPartnerModel.DeliverySummaryResponse>} - Success response
|
|
22
|
-
* @name fetchDeliverySummary
|
|
23
|
-
* @summary: Webhook delivery summary
|
|
24
|
-
* @description: Webhook delivery summary - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/webhook/fetchDeliverySummary/).
|
|
25
|
-
*/
|
|
26
|
-
async fetchDeliverySummary(
|
|
27
|
-
{ extensionId, startDate, endDate, requestHeaders } = {
|
|
28
|
-
requestHeaders: {},
|
|
29
|
-
},
|
|
30
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
31
|
-
) {
|
|
32
|
-
const { error } = WebhookPartnerValidator.fetchDeliverySummary().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.fetchDeliverySummary().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 > fetchDeliverySummary \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/delivery_summary`,
|
|
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.DeliverySummaryResponse().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 > fetchDeliverySummary \n ${res_error}`,
|
|
95
|
-
});
|
|
96
|
-
}
|
|
97
|
-
}
|
|
98
|
-
|
|
99
|
-
return response;
|
|
100
|
-
}
|
|
101
|
-
|
|
102
|
-
/**
|
|
103
|
-
* @param {WebhookPartnerValidator.GetDeliveryDetailInsightsParam} arg - Arg object.
|
|
104
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
105
|
-
* @param {import("../PartnerAPIClient").Options} - Options
|
|
106
|
-
* @returns {Promise<WebhookPartnerModel.DeliveryDetailsResponse>} - Success response
|
|
107
|
-
* @name getDeliveryDetailInsights
|
|
108
|
-
* @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://partners.fynd.com/help/docs/sdk/partner/webhook/getDeliveryDetailInsights/).
|
|
110
|
-
*/
|
|
111
|
-
async getDeliveryDetailInsights(
|
|
112
|
-
{ extensionId, body, requestHeaders } = { requestHeaders: {} },
|
|
113
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
114
|
-
) {
|
|
115
|
-
const {
|
|
116
|
-
error,
|
|
117
|
-
} = WebhookPartnerValidator.getDeliveryDetailInsights().validate(
|
|
118
|
-
{
|
|
119
|
-
extensionId,
|
|
120
|
-
body,
|
|
121
|
-
},
|
|
122
|
-
{ abortEarly: false, allowUnknown: true }
|
|
123
|
-
);
|
|
124
|
-
if (error) {
|
|
125
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
126
|
-
}
|
|
127
|
-
|
|
128
|
-
// Showing warrnings if extra unknown parameters are found
|
|
129
|
-
const {
|
|
130
|
-
error: warrning,
|
|
131
|
-
} = WebhookPartnerValidator.getDeliveryDetailInsights().validate(
|
|
132
|
-
{
|
|
133
|
-
extensionId,
|
|
134
|
-
body,
|
|
135
|
-
},
|
|
136
|
-
{ abortEarly: false, allowUnknown: false }
|
|
137
|
-
);
|
|
138
|
-
if (warrning) {
|
|
139
|
-
Logger({
|
|
140
|
-
level: "WARN",
|
|
141
|
-
message: `Parameter Validation warrnings for partner > Webhook > getDeliveryDetailInsights \n ${warrning}`,
|
|
142
|
-
});
|
|
143
|
-
}
|
|
144
|
-
|
|
145
|
-
const query_params = {};
|
|
146
|
-
|
|
147
|
-
const response = await PartnerAPIClient.execute(
|
|
148
|
-
this.config,
|
|
149
|
-
"post",
|
|
150
|
-
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/report/delivery_details`,
|
|
151
|
-
query_params,
|
|
152
|
-
body,
|
|
153
|
-
requestHeaders,
|
|
154
|
-
{ responseHeaders }
|
|
155
|
-
);
|
|
156
|
-
|
|
157
|
-
let responseData = response;
|
|
158
|
-
if (responseHeaders) {
|
|
159
|
-
responseData = response[0];
|
|
160
|
-
}
|
|
161
|
-
|
|
162
|
-
const {
|
|
163
|
-
error: res_error,
|
|
164
|
-
} = WebhookPartnerModel.DeliveryDetailsResponse().validate(responseData, {
|
|
165
|
-
abortEarly: false,
|
|
166
|
-
allowUnknown: true,
|
|
167
|
-
});
|
|
168
|
-
|
|
169
|
-
if (res_error) {
|
|
170
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
171
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
172
|
-
} else {
|
|
173
|
-
Logger({
|
|
174
|
-
level: "WARN",
|
|
175
|
-
message: `Response Validation Warnings for partner > Webhook > getDeliveryDetailInsights \n ${res_error}`,
|
|
176
|
-
});
|
|
177
|
-
}
|
|
178
|
-
}
|
|
179
|
-
|
|
180
|
-
return response;
|
|
181
|
-
}
|
|
182
|
-
|
|
183
|
-
/**
|
|
184
|
-
* @param {WebhookPartnerValidator.FetchDeliveryTsParam} arg - Arg object.
|
|
185
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
186
|
-
* @param {import("../PartnerAPIClient").Options} - Options
|
|
187
|
-
* @returns {Promise<WebhookPartnerModel.DeliveryTsResponse>} - Success response
|
|
188
|
-
* @name fetchDeliveryTs
|
|
189
|
-
* @summary: Webhook delivery ts
|
|
190
|
-
* @description: Webhook delivery ts - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/webhook/fetchDeliveryTs/).
|
|
191
|
-
*/
|
|
192
|
-
async fetchDeliveryTs(
|
|
193
|
-
{ extensionId, startDate, endDate, requestHeaders } = {
|
|
194
|
-
requestHeaders: {},
|
|
195
|
-
},
|
|
196
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
197
|
-
) {
|
|
198
|
-
const { error } = WebhookPartnerValidator.fetchDeliveryTs().validate(
|
|
199
|
-
{
|
|
200
|
-
extensionId,
|
|
201
|
-
startDate,
|
|
202
|
-
endDate,
|
|
203
|
-
},
|
|
204
|
-
{ abortEarly: false, allowUnknown: true }
|
|
205
|
-
);
|
|
206
|
-
if (error) {
|
|
207
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
208
|
-
}
|
|
209
|
-
|
|
210
|
-
// Showing warrnings if extra unknown parameters are found
|
|
211
|
-
const {
|
|
212
|
-
error: warrning,
|
|
213
|
-
} = WebhookPartnerValidator.fetchDeliveryTs().validate(
|
|
214
|
-
{
|
|
215
|
-
extensionId,
|
|
216
|
-
startDate,
|
|
217
|
-
endDate,
|
|
218
|
-
},
|
|
219
|
-
{ abortEarly: false, allowUnknown: false }
|
|
220
|
-
);
|
|
221
|
-
if (warrning) {
|
|
222
|
-
Logger({
|
|
223
|
-
level: "WARN",
|
|
224
|
-
message: `Parameter Validation warrnings for partner > Webhook > fetchDeliveryTs \n ${warrning}`,
|
|
225
|
-
});
|
|
226
|
-
}
|
|
227
|
-
|
|
228
|
-
const query_params = {};
|
|
229
|
-
query_params["start_date"] = startDate;
|
|
230
|
-
query_params["end_date"] = endDate;
|
|
231
|
-
|
|
232
|
-
const response = await PartnerAPIClient.execute(
|
|
233
|
-
this.config,
|
|
234
|
-
"get",
|
|
235
|
-
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/report/delivery_ts`,
|
|
236
|
-
query_params,
|
|
237
|
-
undefined,
|
|
238
|
-
requestHeaders,
|
|
239
|
-
{ responseHeaders }
|
|
240
|
-
);
|
|
241
|
-
|
|
242
|
-
let responseData = response;
|
|
243
|
-
if (responseHeaders) {
|
|
244
|
-
responseData = response[0];
|
|
245
|
-
}
|
|
246
|
-
|
|
247
|
-
const {
|
|
248
|
-
error: res_error,
|
|
249
|
-
} = WebhookPartnerModel.DeliveryTsResponse().validate(responseData, {
|
|
250
|
-
abortEarly: false,
|
|
251
|
-
allowUnknown: true,
|
|
252
|
-
});
|
|
253
|
-
|
|
254
|
-
if (res_error) {
|
|
255
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
256
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
257
|
-
} else {
|
|
258
|
-
Logger({
|
|
259
|
-
level: "WARN",
|
|
260
|
-
message: `Response Validation Warnings for partner > Webhook > fetchDeliveryTs \n ${res_error}`,
|
|
261
|
-
});
|
|
262
|
-
}
|
|
263
|
-
}
|
|
264
|
-
|
|
265
|
-
return response;
|
|
266
|
-
}
|
|
267
|
-
|
|
268
|
-
/**
|
|
269
|
-
* @param {WebhookPartnerValidator.FetchReportFiltersParam} arg - Arg object.
|
|
270
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
271
|
-
* @param {import("../PartnerAPIClient").Options} - Options
|
|
272
|
-
* @returns {Promise<WebhookPartnerModel.FilterReportResponse[]>} - Success response
|
|
273
|
-
* @name fetchReportFilters
|
|
274
|
-
* @summary: Fetch webhook report filters
|
|
275
|
-
* @description: Fetch webhook report filters - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/webhook/fetchReportFilters/).
|
|
276
|
-
*/
|
|
277
|
-
async fetchReportFilters(
|
|
278
|
-
{ extensionId, startDate, endDate, pageNo, pageSize, requestHeaders } = {
|
|
279
|
-
requestHeaders: {},
|
|
280
|
-
},
|
|
281
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
282
|
-
) {
|
|
283
|
-
const { error } = WebhookPartnerValidator.fetchReportFilters().validate(
|
|
284
|
-
{
|
|
285
|
-
extensionId,
|
|
286
|
-
startDate,
|
|
287
|
-
endDate,
|
|
288
|
-
pageNo,
|
|
289
|
-
pageSize,
|
|
290
|
-
},
|
|
291
|
-
{ abortEarly: false, allowUnknown: true }
|
|
292
|
-
);
|
|
293
|
-
if (error) {
|
|
294
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
295
|
-
}
|
|
296
|
-
|
|
297
|
-
// Showing warrnings if extra unknown parameters are found
|
|
298
|
-
const {
|
|
299
|
-
error: warrning,
|
|
300
|
-
} = WebhookPartnerValidator.fetchReportFilters().validate(
|
|
301
|
-
{
|
|
302
|
-
extensionId,
|
|
303
|
-
startDate,
|
|
304
|
-
endDate,
|
|
305
|
-
pageNo,
|
|
306
|
-
pageSize,
|
|
307
|
-
},
|
|
308
|
-
{ abortEarly: false, allowUnknown: false }
|
|
309
|
-
);
|
|
310
|
-
if (warrning) {
|
|
311
|
-
Logger({
|
|
312
|
-
level: "WARN",
|
|
313
|
-
message: `Parameter Validation warrnings for partner > Webhook > fetchReportFilters \n ${warrning}`,
|
|
314
|
-
});
|
|
315
|
-
}
|
|
316
|
-
|
|
317
|
-
const query_params = {};
|
|
318
|
-
query_params["start_date"] = startDate;
|
|
319
|
-
query_params["end_date"] = endDate;
|
|
320
|
-
query_params["page_no"] = pageNo;
|
|
321
|
-
query_params["page_size"] = pageSize;
|
|
322
|
-
|
|
323
|
-
const response = await PartnerAPIClient.execute(
|
|
324
|
-
this.config,
|
|
325
|
-
"get",
|
|
326
|
-
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/report/filters`,
|
|
327
|
-
query_params,
|
|
328
|
-
undefined,
|
|
329
|
-
requestHeaders,
|
|
330
|
-
{ responseHeaders }
|
|
331
|
-
);
|
|
332
|
-
|
|
333
|
-
let responseData = response;
|
|
334
|
-
if (responseHeaders) {
|
|
335
|
-
responseData = response[0];
|
|
336
|
-
}
|
|
337
|
-
|
|
338
|
-
const { error: res_error } = Joi.array()
|
|
339
|
-
.items(WebhookPartnerModel.FilterReportResponse())
|
|
340
|
-
.validate(responseData, { abortEarly: false, allowUnknown: true });
|
|
341
|
-
|
|
342
|
-
if (res_error) {
|
|
343
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
344
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
345
|
-
} else {
|
|
346
|
-
Logger({
|
|
347
|
-
level: "WARN",
|
|
348
|
-
message: `Response Validation Warnings for partner > Webhook > fetchReportFilters \n ${res_error}`,
|
|
349
|
-
});
|
|
350
|
-
}
|
|
351
|
-
}
|
|
352
|
-
|
|
353
|
-
return response;
|
|
354
|
-
}
|
|
355
|
-
|
|
356
|
-
/**
|
|
357
|
-
* @param {WebhookPartnerValidator.CancelReportDownloadParam} arg - Arg object.
|
|
358
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
359
|
-
* @param {import("../PartnerAPIClient").Options} - Options
|
|
360
|
-
* @returns {Promise<WebhookPartnerModel.CancelDownloadResponse>} - Success response
|
|
361
|
-
* @name cancelReportDownload
|
|
362
|
-
* @summary: Cancel report download job
|
|
363
|
-
* @description: Cancel report download job - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/webhook/cancelReportDownload/).
|
|
364
|
-
*/
|
|
365
|
-
async cancelReportDownload(
|
|
366
|
-
{ extensionId, filename, requestHeaders } = { requestHeaders: {} },
|
|
367
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
368
|
-
) {
|
|
369
|
-
const { error } = WebhookPartnerValidator.cancelReportDownload().validate(
|
|
370
|
-
{
|
|
371
|
-
extensionId,
|
|
372
|
-
filename,
|
|
373
|
-
},
|
|
374
|
-
{ abortEarly: false, allowUnknown: true }
|
|
375
|
-
);
|
|
376
|
-
if (error) {
|
|
377
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
378
|
-
}
|
|
379
|
-
|
|
380
|
-
// Showing warrnings if extra unknown parameters are found
|
|
381
|
-
const {
|
|
382
|
-
error: warrning,
|
|
383
|
-
} = WebhookPartnerValidator.cancelReportDownload().validate(
|
|
384
|
-
{
|
|
385
|
-
extensionId,
|
|
386
|
-
filename,
|
|
387
|
-
},
|
|
388
|
-
{ abortEarly: false, allowUnknown: false }
|
|
389
|
-
);
|
|
390
|
-
if (warrning) {
|
|
391
|
-
Logger({
|
|
392
|
-
level: "WARN",
|
|
393
|
-
message: `Parameter Validation warrnings for partner > Webhook > cancelReportDownload \n ${warrning}`,
|
|
394
|
-
});
|
|
395
|
-
}
|
|
396
|
-
|
|
397
|
-
const query_params = {};
|
|
398
|
-
|
|
399
|
-
const response = await PartnerAPIClient.execute(
|
|
400
|
-
this.config,
|
|
401
|
-
"get",
|
|
402
|
-
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/reports/cancel/file/${filename}`,
|
|
403
|
-
query_params,
|
|
404
|
-
undefined,
|
|
405
|
-
requestHeaders,
|
|
406
|
-
{ responseHeaders }
|
|
407
|
-
);
|
|
408
|
-
|
|
409
|
-
let responseData = response;
|
|
410
|
-
if (responseHeaders) {
|
|
411
|
-
responseData = response[0];
|
|
412
|
-
}
|
|
413
|
-
|
|
414
|
-
const {
|
|
415
|
-
error: res_error,
|
|
416
|
-
} = WebhookPartnerModel.CancelDownloadResponse().validate(responseData, {
|
|
417
|
-
abortEarly: false,
|
|
418
|
-
allowUnknown: true,
|
|
419
|
-
});
|
|
420
|
-
|
|
421
|
-
if (res_error) {
|
|
422
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
423
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
424
|
-
} else {
|
|
425
|
-
Logger({
|
|
426
|
-
level: "WARN",
|
|
427
|
-
message: `Response Validation Warnings for partner > Webhook > cancelReportDownload \n ${res_error}`,
|
|
428
|
-
});
|
|
429
|
-
}
|
|
430
|
-
}
|
|
431
|
-
|
|
432
|
-
return response;
|
|
433
|
-
}
|
|
434
|
-
|
|
435
|
-
/**
|
|
436
|
-
* @param {WebhookPartnerValidator.GetHistoricalReportsParam} arg - Arg object.
|
|
437
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
438
|
-
* @param {import("../PartnerAPIClient").Options} - Options
|
|
439
|
-
* @returns {Promise<WebhookPartnerModel.HistoryResponse>} - Success response
|
|
440
|
-
* @name getHistoricalReports
|
|
441
|
-
* @summary: Get report download history.
|
|
442
|
-
* @description: Retrieve history reports for a specific company based on the provided filters.
|
|
443
|
-
* - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/webhook/getHistoricalReports/).
|
|
444
|
-
*/
|
|
445
|
-
async getHistoricalReports(
|
|
446
|
-
{ extensionId, body, requestHeaders } = { requestHeaders: {} },
|
|
447
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
448
|
-
) {
|
|
449
|
-
const { error } = WebhookPartnerValidator.getHistoricalReports().validate(
|
|
450
|
-
{
|
|
451
|
-
extensionId,
|
|
452
|
-
body,
|
|
453
|
-
},
|
|
454
|
-
{ abortEarly: false, allowUnknown: true }
|
|
455
|
-
);
|
|
456
|
-
if (error) {
|
|
457
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
458
|
-
}
|
|
459
|
-
|
|
460
|
-
// Showing warrnings if extra unknown parameters are found
|
|
461
|
-
const {
|
|
462
|
-
error: warrning,
|
|
463
|
-
} = WebhookPartnerValidator.getHistoricalReports().validate(
|
|
464
|
-
{
|
|
465
|
-
extensionId,
|
|
466
|
-
body,
|
|
467
|
-
},
|
|
468
|
-
{ abortEarly: false, allowUnknown: false }
|
|
469
|
-
);
|
|
470
|
-
if (warrning) {
|
|
471
|
-
Logger({
|
|
472
|
-
level: "WARN",
|
|
473
|
-
message: `Parameter Validation warrnings for partner > Webhook > getHistoricalReports \n ${warrning}`,
|
|
474
|
-
});
|
|
475
|
-
}
|
|
476
|
-
|
|
477
|
-
const query_params = {};
|
|
478
|
-
|
|
479
|
-
const response = await PartnerAPIClient.execute(
|
|
480
|
-
this.config,
|
|
481
|
-
"post",
|
|
482
|
-
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/report/history`,
|
|
483
|
-
query_params,
|
|
484
|
-
body,
|
|
485
|
-
requestHeaders,
|
|
486
|
-
{ responseHeaders }
|
|
487
|
-
);
|
|
488
|
-
|
|
489
|
-
let responseData = response;
|
|
490
|
-
if (responseHeaders) {
|
|
491
|
-
responseData = response[0];
|
|
492
|
-
}
|
|
493
|
-
|
|
494
|
-
const {
|
|
495
|
-
error: res_error,
|
|
496
|
-
} = WebhookPartnerModel.HistoryResponse().validate(responseData, {
|
|
497
|
-
abortEarly: false,
|
|
498
|
-
allowUnknown: true,
|
|
499
|
-
});
|
|
500
|
-
|
|
501
|
-
if (res_error) {
|
|
502
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
503
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
504
|
-
} else {
|
|
505
|
-
Logger({
|
|
506
|
-
level: "WARN",
|
|
507
|
-
message: `Response Validation Warnings for partner > Webhook > getHistoricalReports \n ${res_error}`,
|
|
508
|
-
});
|
|
509
|
-
}
|
|
510
|
-
}
|
|
511
|
-
|
|
512
|
-
return response;
|
|
513
|
-
}
|
|
514
|
-
|
|
515
|
-
/**
|
|
516
|
-
* @param {WebhookPartnerValidator.GetInvalidEventListParam} arg - Arg object.
|
|
517
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
518
|
-
* @param {import("../PartnerAPIClient").Options} - Options
|
|
519
|
-
* @returns {Promise<WebhookPartnerModel.InvalidEventsResponse[]>} - Success response
|
|
520
|
-
* @name getInvalidEventList
|
|
521
|
-
* @summary: Get invalid event list
|
|
522
|
-
* @description: Get invalid event list.
|
|
523
|
-
* - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/webhook/getInvalidEventList/).
|
|
524
|
-
*/
|
|
525
|
-
async getInvalidEventList(
|
|
526
|
-
{ extensionId, body, requestHeaders } = { requestHeaders: {} },
|
|
527
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
528
|
-
) {
|
|
529
|
-
const { error } = WebhookPartnerValidator.getInvalidEventList().validate(
|
|
530
|
-
{
|
|
531
|
-
extensionId,
|
|
532
|
-
body,
|
|
533
|
-
},
|
|
534
|
-
{ abortEarly: false, allowUnknown: true }
|
|
535
|
-
);
|
|
536
|
-
if (error) {
|
|
537
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
538
|
-
}
|
|
539
|
-
|
|
540
|
-
// Showing warrnings if extra unknown parameters are found
|
|
541
|
-
const {
|
|
542
|
-
error: warrning,
|
|
543
|
-
} = WebhookPartnerValidator.getInvalidEventList().validate(
|
|
544
|
-
{
|
|
545
|
-
extensionId,
|
|
546
|
-
body,
|
|
547
|
-
},
|
|
548
|
-
{ abortEarly: false, allowUnknown: false }
|
|
549
|
-
);
|
|
550
|
-
if (warrning) {
|
|
551
|
-
Logger({
|
|
552
|
-
level: "WARN",
|
|
553
|
-
message: `Parameter Validation warrnings for partner > Webhook > getInvalidEventList \n ${warrning}`,
|
|
554
|
-
});
|
|
555
|
-
}
|
|
556
|
-
|
|
557
|
-
const query_params = {};
|
|
558
|
-
|
|
559
|
-
const response = await PartnerAPIClient.execute(
|
|
560
|
-
this.config,
|
|
561
|
-
"post",
|
|
562
|
-
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/report/invalid_events`,
|
|
563
|
-
query_params,
|
|
564
|
-
body,
|
|
565
|
-
requestHeaders,
|
|
566
|
-
{ responseHeaders }
|
|
567
|
-
);
|
|
568
|
-
|
|
569
|
-
let responseData = response;
|
|
570
|
-
if (responseHeaders) {
|
|
571
|
-
responseData = response[0];
|
|
572
|
-
}
|
|
573
|
-
|
|
574
|
-
const { error: res_error } = Joi.array()
|
|
575
|
-
.items(WebhookPartnerModel.InvalidEventsResponse())
|
|
576
|
-
.validate(responseData, { abortEarly: false, allowUnknown: true });
|
|
577
|
-
|
|
578
|
-
if (res_error) {
|
|
579
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
580
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
581
|
-
} else {
|
|
582
|
-
Logger({
|
|
583
|
-
level: "WARN",
|
|
584
|
-
message: `Response Validation Warnings for partner > Webhook > getInvalidEventList \n ${res_error}`,
|
|
585
|
-
});
|
|
586
|
-
}
|
|
587
|
-
}
|
|
588
|
-
|
|
589
|
-
return response;
|
|
590
|
-
}
|
|
591
|
-
|
|
592
|
-
/**
|
|
593
|
-
* @param {WebhookPartnerValidator.FetchSubscribersParam} arg - Arg object.
|
|
594
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
595
|
-
* @param {import("../PartnerAPIClient").Options} - Options
|
|
596
|
-
* @returns {Promise<WebhookPartnerModel.SubscriberConfigResponse>} - Success response
|
|
597
|
-
* @name fetchSubscribers
|
|
598
|
-
* @summary: Fetch subscriber by filters
|
|
599
|
-
* @description: Fetch subscriber by filters - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/webhook/fetchSubscribers/).
|
|
600
|
-
*/
|
|
601
|
-
async fetchSubscribers(
|
|
602
|
-
{ extensionId, requestHeaders } = { requestHeaders: {} },
|
|
603
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
604
|
-
) {
|
|
605
|
-
const { error } = WebhookPartnerValidator.fetchSubscribers().validate(
|
|
606
|
-
{
|
|
607
|
-
extensionId,
|
|
608
|
-
},
|
|
609
|
-
{ abortEarly: false, allowUnknown: true }
|
|
610
|
-
);
|
|
611
|
-
if (error) {
|
|
612
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
613
|
-
}
|
|
614
|
-
|
|
615
|
-
// Showing warrnings if extra unknown parameters are found
|
|
616
|
-
const {
|
|
617
|
-
error: warrning,
|
|
618
|
-
} = WebhookPartnerValidator.fetchSubscribers().validate(
|
|
619
|
-
{
|
|
620
|
-
extensionId,
|
|
621
|
-
},
|
|
622
|
-
{ abortEarly: false, allowUnknown: false }
|
|
623
|
-
);
|
|
624
|
-
if (warrning) {
|
|
625
|
-
Logger({
|
|
626
|
-
level: "WARN",
|
|
627
|
-
message: `Parameter Validation warrnings for partner > Webhook > fetchSubscribers \n ${warrning}`,
|
|
628
|
-
});
|
|
629
|
-
}
|
|
630
|
-
|
|
631
|
-
const query_params = {};
|
|
632
|
-
|
|
633
|
-
const response = await PartnerAPIClient.execute(
|
|
634
|
-
this.config,
|
|
635
|
-
"get",
|
|
636
|
-
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/subscriber/`,
|
|
637
|
-
query_params,
|
|
638
|
-
undefined,
|
|
639
|
-
requestHeaders,
|
|
640
|
-
{ responseHeaders }
|
|
641
|
-
);
|
|
642
|
-
|
|
643
|
-
let responseData = response;
|
|
644
|
-
if (responseHeaders) {
|
|
645
|
-
responseData = response[0];
|
|
646
|
-
}
|
|
647
|
-
|
|
648
|
-
const {
|
|
649
|
-
error: res_error,
|
|
650
|
-
} = WebhookPartnerModel.SubscriberConfigResponse().validate(responseData, {
|
|
651
|
-
abortEarly: false,
|
|
652
|
-
allowUnknown: true,
|
|
653
|
-
});
|
|
654
|
-
|
|
655
|
-
if (res_error) {
|
|
656
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
657
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
658
|
-
} else {
|
|
659
|
-
Logger({
|
|
660
|
-
level: "WARN",
|
|
661
|
-
message: `Response Validation Warnings for partner > Webhook > fetchSubscribers \n ${res_error}`,
|
|
662
|
-
});
|
|
663
|
-
}
|
|
664
|
-
}
|
|
665
|
-
|
|
666
|
-
return response;
|
|
667
|
-
}
|
|
668
|
-
|
|
669
|
-
/**
|
|
670
|
-
* @param {WebhookPartnerValidator.UpdateSubscriberParam} arg - Arg object.
|
|
671
|
-
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
672
|
-
* @param {import("../PartnerAPIClient").Options} - Options
|
|
673
|
-
* @returns {Promise<WebhookPartnerModel.UpdateSubscriberResponse>} - Success response
|
|
674
|
-
* @name updateSubscriber
|
|
675
|
-
* @summary: Update subscriber status by id.
|
|
676
|
-
* @description: Update subscriber status by id.
|
|
677
|
-
* - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/partner/webhook/updateSubscriber/).
|
|
678
|
-
*/
|
|
679
|
-
async updateSubscriber(
|
|
680
|
-
{ extensionId, subscriberId, body, requestHeaders } = {
|
|
681
|
-
requestHeaders: {},
|
|
682
|
-
},
|
|
683
|
-
{ responseHeaders } = { responseHeaders: false }
|
|
684
|
-
) {
|
|
685
|
-
const { error } = WebhookPartnerValidator.updateSubscriber().validate(
|
|
686
|
-
{
|
|
687
|
-
extensionId,
|
|
688
|
-
subscriberId,
|
|
689
|
-
body,
|
|
690
|
-
},
|
|
691
|
-
{ abortEarly: false, allowUnknown: true }
|
|
692
|
-
);
|
|
693
|
-
if (error) {
|
|
694
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
695
|
-
}
|
|
696
|
-
|
|
697
|
-
// Showing warrnings if extra unknown parameters are found
|
|
698
|
-
const {
|
|
699
|
-
error: warrning,
|
|
700
|
-
} = WebhookPartnerValidator.updateSubscriber().validate(
|
|
701
|
-
{
|
|
702
|
-
extensionId,
|
|
703
|
-
subscriberId,
|
|
704
|
-
body,
|
|
705
|
-
},
|
|
706
|
-
{ abortEarly: false, allowUnknown: false }
|
|
707
|
-
);
|
|
708
|
-
if (warrning) {
|
|
709
|
-
Logger({
|
|
710
|
-
level: "WARN",
|
|
711
|
-
message: `Parameter Validation warrnings for partner > Webhook > updateSubscriber \n ${warrning}`,
|
|
712
|
-
});
|
|
713
|
-
}
|
|
714
|
-
|
|
715
|
-
const query_params = {};
|
|
716
|
-
|
|
717
|
-
const response = await PartnerAPIClient.execute(
|
|
718
|
-
this.config,
|
|
719
|
-
"patch",
|
|
720
|
-
`/service/partner/webhook/v1.0/organization/${this.config.organizationId}/extension/${extensionId}/subscriber/${subscriberId}`,
|
|
721
|
-
query_params,
|
|
722
|
-
body,
|
|
723
|
-
requestHeaders,
|
|
724
|
-
{ responseHeaders }
|
|
725
|
-
);
|
|
726
|
-
|
|
727
|
-
let responseData = response;
|
|
728
|
-
if (responseHeaders) {
|
|
729
|
-
responseData = response[0];
|
|
730
|
-
}
|
|
731
|
-
|
|
732
|
-
const {
|
|
733
|
-
error: res_error,
|
|
734
|
-
} = WebhookPartnerModel.UpdateSubscriberResponse().validate(responseData, {
|
|
735
|
-
abortEarly: false,
|
|
736
|
-
allowUnknown: true,
|
|
737
|
-
});
|
|
738
|
-
|
|
739
|
-
if (res_error) {
|
|
740
|
-
if (this.config.options.strictResponseCheck === true) {
|
|
741
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
742
|
-
} else {
|
|
743
|
-
Logger({
|
|
744
|
-
level: "WARN",
|
|
745
|
-
message: `Response Validation Warnings for partner > Webhook > updateSubscriber \n ${res_error}`,
|
|
746
|
-
});
|
|
747
|
-
}
|
|
748
|
-
}
|
|
749
|
-
|
|
750
|
-
return response;
|
|
751
|
-
}
|
|
752
|
-
}
|
|
753
|
-
module.exports = Webhook;
|