@gofynd/fdk-client-javascript 1.2.0 → 1.3.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +44 -7
- package/package.json +1 -2
- package/sdk/application/ApplicationAPIClient.d.ts +3 -3
- package/sdk/application/ApplicationAPIClient.js +6 -4
- package/sdk/application/ApplicationClient.d.ts +2 -3
- package/sdk/application/ApplicationClient.js +1 -45
- package/sdk/application/ApplicationConfig.d.ts +46 -6
- package/sdk/application/ApplicationConfig.js +15 -16
- package/sdk/application/Cart/CartApplicationClient.d.ts +61 -33
- package/sdk/application/Cart/CartApplicationClient.js +225 -134
- package/sdk/application/Cart/CartApplicationModel.d.ts +4 -4
- package/sdk/application/Cart/CartApplicationModel.js +4 -4
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +61 -30
- package/sdk/application/Catalog/CatalogApplicationClient.js +234 -146
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +115 -13
- package/sdk/application/Catalog/CatalogApplicationModel.js +77 -12
- package/sdk/application/Common/CommonApplicationClient.d.ts +5 -3
- package/sdk/application/Common/CommonApplicationClient.js +13 -11
- package/sdk/application/Common/CommonApplicationModel.d.ts +3 -83
- package/sdk/application/Common/CommonApplicationModel.js +2 -58
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +9 -3
- package/sdk/application/Communication/CommunicationApplicationClient.js +25 -13
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +1 -34
- package/sdk/application/Communication/CommunicationApplicationModel.js +0 -36
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +46 -16
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +144 -68
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +1 -219
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +0 -226
- package/sdk/application/Content/ContentApplicationClient.d.ts +49 -21
- package/sdk/application/Content/ContentApplicationClient.js +159 -80
- package/sdk/application/Content/ContentApplicationModel.d.ts +5 -622
- package/sdk/application/Content/ContentApplicationModel.js +11 -763
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +6 -3
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +20 -14
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +1 -152
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +0 -180
- package/sdk/application/Lead/LeadApplicationClient.d.ts +14 -7
- package/sdk/application/Lead/LeadApplicationClient.js +50 -31
- package/sdk/application/Lead/LeadApplicationModel.d.ts +22 -741
- package/sdk/application/Lead/LeadApplicationModel.js +21 -481
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +11 -5
- package/sdk/application/Logistic/LogisticApplicationClient.js +41 -20
- package/sdk/application/Order/OrderApplicationClient.d.ts +24 -12
- package/sdk/application/Order/OrderApplicationClient.js +88 -56
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +91 -42
- package/sdk/application/Payment/PaymentApplicationClient.js +293 -194
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +36 -36
- package/sdk/application/Payment/PaymentApplicationModel.js +36 -36
- package/sdk/application/PosCart/PosCartApplicationClient.d.ts +59 -32
- package/sdk/application/PosCart/PosCartApplicationClient.js +214 -130
- package/sdk/application/PosCart/PosCartApplicationModel.d.ts +2 -2
- package/sdk/application/PosCart/PosCartApplicationModel.js +2 -2
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +16 -7
- package/sdk/application/Rewards/RewardsApplicationClient.js +56 -29
- package/sdk/application/Share/ShareApplicationClient.d.ts +15 -7
- package/sdk/application/Share/ShareApplicationClient.js +51 -31
- package/sdk/application/Share/ShareApplicationModel.d.ts +1 -33
- package/sdk/application/Share/ShareApplicationModel.js +0 -38
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +9 -4
- package/sdk/application/Theme/ThemeApplicationClient.js +35 -18
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +982 -312
- package/sdk/application/Theme/ThemeApplicationModel.js +621 -284
- package/sdk/application/User/UserApplicationClient.d.ts +74 -35
- package/sdk/application/User/UserApplicationClient.js +252 -161
- package/sdk/application/User/UserApplicationModel.d.ts +3 -401
- package/sdk/application/User/UserApplicationModel.js +2 -490
- package/sdk/common/AxiosHelper.js +1 -2
- package/sdk/common/FDKError.d.ts +3 -0
- package/sdk/common/FDKError.js +8 -0
- package/sdk/common/utils.d.ts +3 -0
- package/sdk/common/utils.js +29 -0
- package/sdk/partner/PartnerAPIClient.d.ts +5 -4
- package/sdk/partner/PartnerAPIClient.js +7 -4
- package/sdk/partner/PartnerClient.d.ts +2 -0
- package/sdk/partner/PartnerClient.js +3 -0
- package/sdk/partner/Theme/ThemePartnerClient.d.ts +299 -0
- package/sdk/partner/Theme/ThemePartnerClient.js +768 -0
- package/sdk/partner/Theme/ThemePartnerModel.d.ts +1706 -0
- package/sdk/partner/Theme/ThemePartnerModel.js +1409 -0
- package/sdk/partner/Theme/ThemePartnerValidator.d.ts +22 -0
- package/sdk/partner/Theme/ThemePartnerValidator.js +157 -0
- package/sdk/partner/index.d.ts +3 -1
- package/sdk/partner/index.js +3 -1
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.d.ts +8 -4
- package/sdk/platform/AuditTrail/AuditTrailPlatformClient.js +38 -16
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.d.ts +1 -13
- package/sdk/platform/AuditTrail/AuditTrailPlatformModel.js +0 -12
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.d.ts +10 -0
- package/sdk/platform/AuditTrail/AuditTrailPlatformValidator.js +4 -0
- package/sdk/platform/Billing/BillingPlatformClient.d.ts +59 -14
- package/sdk/platform/Billing/BillingPlatformClient.js +315 -64
- package/sdk/platform/Billing/BillingPlatformModel.d.ts +56 -196
- package/sdk/platform/Billing/BillingPlatformModel.js +63 -217
- package/sdk/platform/Billing/BillingPlatformValidator.d.ts +23 -1
- package/sdk/platform/Billing/BillingPlatformValidator.js +31 -0
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +124 -63
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +431 -265
- package/sdk/platform/Cart/CartPlatformModel.d.ts +253 -53
- package/sdk/platform/Cart/CartPlatformModel.js +104 -54
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.d.ts +120 -53
- package/sdk/platform/Catalog/CatalogPlatformApplicationClient.js +398 -247
- package/sdk/platform/Catalog/CatalogPlatformClient.d.ts +155 -78
- package/sdk/platform/Catalog/CatalogPlatformClient.js +561 -355
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +10 -12
- package/sdk/platform/Catalog/CatalogPlatformModel.js +10 -12
- package/sdk/platform/Catalog/CatalogPlatformValidator.d.ts +30 -0
- package/sdk/platform/Catalog/CatalogPlatformValidator.js +13 -0
- package/sdk/platform/Common/CommonPlatformClient.d.ts +5 -3
- package/sdk/platform/Common/CommonPlatformClient.js +13 -11
- package/sdk/platform/Common/CommonPlatformModel.d.ts +39 -64
- package/sdk/platform/Common/CommonPlatformModel.js +23 -57
- package/sdk/platform/Common/CommonPlatformValidator.d.ts +5 -10
- package/sdk/platform/Common/CommonPlatformValidator.js +3 -4
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.d.ts +370 -120
- package/sdk/platform/Communication/CommunicationPlatformApplicationClient.js +2328 -888
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.d.ts +143 -24
- package/sdk/platform/Communication/CommunicationPlatformApplicationValidator.js +179 -15
- package/sdk/platform/Communication/CommunicationPlatformClient.d.ts +2 -1
- package/sdk/platform/Communication/CommunicationPlatformClient.js +6 -5
- package/sdk/platform/Communication/CommunicationPlatformModel.d.ts +386 -308
- package/sdk/platform/Communication/CommunicationPlatformModel.js +415 -355
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.d.ts +38 -13
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformClient.js +171 -57
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.d.ts +53 -1
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformModel.js +54 -0
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.d.ts +5 -1
- package/sdk/platform/CompanyProfile/CompanyProfilePlatformValidator.js +7 -0
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.d.ts +96 -29
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationClient.js +311 -126
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.d.ts +5 -1
- package/sdk/platform/Configuration/ConfigurationPlatformApplicationValidator.js +7 -0
- package/sdk/platform/Configuration/ConfigurationPlatformClient.d.ts +36 -18
- package/sdk/platform/Configuration/ConfigurationPlatformClient.js +121 -86
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +13 -180
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +5 -113
- package/sdk/platform/Content/ContentPlatformApplicationClient.d.ts +162 -70
- package/sdk/platform/Content/ContentPlatformApplicationClient.js +528 -309
- package/sdk/platform/Content/ContentPlatformModel.d.ts +9 -198
- package/sdk/platform/Content/ContentPlatformModel.js +8 -231
- package/sdk/platform/Discount/DiscountPlatformClient.d.ts +48 -11
- package/sdk/platform/Discount/DiscountPlatformClient.js +142 -48
- package/sdk/platform/Discount/DiscountPlatformModel.d.ts +40 -1
- package/sdk/platform/Discount/DiscountPlatformModel.js +27 -0
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.d.ts +84 -18
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationClient.js +486 -53
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.d.ts +71 -7
- package/sdk/platform/FileStorage/FileStoragePlatformApplicationValidator.js +81 -5
- package/sdk/platform/FileStorage/FileStoragePlatformClient.d.ts +13 -18
- package/sdk/platform/FileStorage/FileStoragePlatformClient.js +58 -65
- package/sdk/platform/FileStorage/FileStoragePlatformModel.d.ts +198 -71
- package/sdk/platform/FileStorage/FileStoragePlatformModel.js +212 -64
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.d.ts +18 -10
- package/sdk/platform/FileStorage/FileStoragePlatformValidator.js +11 -6
- package/sdk/platform/Finance/FinancePlatformClient.d.ts +177 -40
- package/sdk/platform/Finance/FinancePlatformClient.js +1028 -132
- package/sdk/platform/Finance/FinancePlatformModel.d.ts +670 -22
- package/sdk/platform/Finance/FinancePlatformModel.js +809 -23
- package/sdk/platform/Finance/FinancePlatformValidator.d.ts +111 -1
- package/sdk/platform/Finance/FinancePlatformValidator.js +134 -0
- package/sdk/platform/Inventory/InventoryPlatformClient.d.ts +24 -12
- package/sdk/platform/Inventory/InventoryPlatformClient.js +94 -52
- package/sdk/platform/Lead/LeadPlatformApplicationClient.d.ts +27 -13
- package/sdk/platform/Lead/LeadPlatformApplicationClient.js +101 -55
- package/sdk/platform/Lead/LeadPlatformClient.d.ts +50 -39
- package/sdk/platform/Lead/LeadPlatformClient.js +171 -112
- package/sdk/platform/Lead/LeadPlatformModel.d.ts +32 -390
- package/sdk/platform/Lead/LeadPlatformModel.js +31 -214
- package/sdk/platform/Lead/LeadPlatformValidator.d.ts +33 -33
- package/sdk/platform/Lead/LeadPlatformValidator.js +23 -23
- package/sdk/platform/OAuthClient.js +6 -2
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +4 -2
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +12 -10
- package/sdk/platform/Order/OrderPlatformClient.d.ts +165 -71
- package/sdk/platform/Order/OrderPlatformClient.js +738 -205
- package/sdk/platform/Order/OrderPlatformModel.d.ts +261 -3
- package/sdk/platform/Order/OrderPlatformModel.js +225 -2
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +104 -3
- package/sdk/platform/Order/OrderPlatformValidator.js +85 -2
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.d.ts +4 -22
- package/sdk/platform/Partner/PartnerPlatformApplicationClient.js +12 -159
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.d.ts +1 -30
- package/sdk/platform/Partner/PartnerPlatformApplicationValidator.js +0 -26
- package/sdk/platform/Partner/PartnerPlatformModel.d.ts +1 -690
- package/sdk/platform/Partner/PartnerPlatformModel.js +0 -809
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.d.ts +167 -32
- package/sdk/platform/Payment/PaymentPlatformApplicationClient.js +793 -145
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.d.ts +91 -1
- package/sdk/platform/Payment/PaymentPlatformApplicationValidator.js +91 -0
- package/sdk/platform/Payment/PaymentPlatformClient.d.ts +20 -10
- package/sdk/platform/Payment/PaymentPlatformClient.js +68 -47
- package/sdk/platform/Payment/PaymentPlatformModel.d.ts +549 -7
- package/sdk/platform/Payment/PaymentPlatformModel.js +305 -6
- package/sdk/platform/PlatformAPIClient.d.ts +3 -3
- package/sdk/platform/PlatformAPIClient.js +2 -2
- package/sdk/platform/PlatformClient.d.ts +2 -2
- package/sdk/platform/PlatformClient.js +4 -4
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.d.ts +28 -12
- package/sdk/platform/Rewards/RewardsPlatformApplicationClient.js +90 -53
- package/sdk/platform/Rewards/RewardsPlatformModel.d.ts +1 -12
- package/sdk/platform/Rewards/RewardsPlatformModel.js +0 -14
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.d.ts +62 -26
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationClient.js +210 -93
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.d.ts +20 -11
- package/sdk/platform/Serviceability/ServiceabilityPlatformApplicationValidator.js +23 -11
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +36 -18
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +142 -78
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +12 -3
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +14 -2
- package/sdk/platform/Share/SharePlatformApplicationClient.d.ts +10 -26
- package/sdk/platform/Share/SharePlatformApplicationClient.js +36 -67
- package/sdk/platform/Share/SharePlatformModel.d.ts +4 -4
- package/sdk/platform/Share/SharePlatformModel.js +4 -4
- package/sdk/platform/Theme/ThemePlatformApplicationClient.d.ts +127 -57
- package/sdk/platform/Theme/ThemePlatformApplicationClient.js +564 -189
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.d.ts +63 -26
- package/sdk/platform/Theme/ThemePlatformApplicationValidator.js +62 -22
- package/sdk/platform/Theme/ThemePlatformClient.d.ts +37 -0
- package/sdk/platform/Theme/ThemePlatformClient.js +235 -0
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +1167 -261
- package/sdk/platform/Theme/ThemePlatformModel.js +801 -244
- package/sdk/platform/Theme/ThemePlatformValidator.d.ts +32 -0
- package/sdk/platform/Theme/ThemePlatformValidator.js +38 -0
- package/sdk/platform/User/UserPlatformApplicationClient.d.ts +35 -17
- package/sdk/platform/User/UserPlatformApplicationClient.js +132 -73
- package/sdk/platform/User/UserPlatformApplicationValidator.d.ts +7 -0
- package/sdk/platform/User/UserPlatformApplicationValidator.js +3 -0
- package/sdk/platform/User/UserPlatformModel.d.ts +1 -738
- package/sdk/platform/User/UserPlatformModel.js +3 -899
- package/sdk/platform/Webhook/WebhookPlatformClient.d.ts +120 -7
- package/sdk/platform/Webhook/WebhookPlatformClient.js +799 -41
- package/sdk/platform/Webhook/WebhookPlatformModel.d.ts +476 -86
- package/sdk/platform/Webhook/WebhookPlatformModel.js +388 -89
- package/sdk/platform/Webhook/WebhookPlatformValidator.d.ts +96 -9
- package/sdk/platform/Webhook/WebhookPlatformValidator.js +117 -5
- package/sdk/public/Configuration/ConfigurationPublicClient.d.ts +5 -3
- package/sdk/public/Configuration/ConfigurationPublicClient.js +13 -11
- package/sdk/public/Configuration/ConfigurationPublicModel.d.ts +3 -106
- package/sdk/public/Configuration/ConfigurationPublicModel.js +2 -59
- package/sdk/public/Inventory/InventoryPublicClient.d.ts +12 -6
- package/sdk/public/Inventory/InventoryPublicClient.js +42 -27
- package/sdk/public/Partner/PartnerPublicClient.d.ts +22 -0
- package/sdk/public/Partner/PartnerPublicClient.js +110 -0
- package/sdk/public/Partner/PartnerPublicModel.d.ts +240 -0
- package/sdk/public/Partner/PartnerPublicModel.js +280 -0
- package/sdk/public/Partner/PartnerPublicValidator.d.ts +18 -0
- package/sdk/public/Partner/PartnerPublicValidator.js +19 -0
- package/sdk/public/PublicAPIClient.d.ts +14 -1
- package/sdk/public/PublicAPIClient.js +7 -1
- package/sdk/public/PublicClient.d.ts +2 -0
- package/sdk/public/PublicClient.js +4 -0
- package/sdk/public/Webhook/WebhookPublicClient.d.ts +5 -2
- package/sdk/public/Webhook/WebhookPublicClient.js +15 -9
- package/sdk/public/Webhook/WebhookPublicModel.d.ts +1 -191
- package/sdk/public/Webhook/WebhookPublicModel.js +0 -229
- package/sdk/public/index.d.ts +1 -0
- package/sdk/public/index.js +2 -0
- package/sdk/application/ApplicationModels.d.ts +0 -48
- package/sdk/application/ApplicationModels.js +0 -38
- package/sdk/platform/Partner/PartnerPlatformClient.d.ts +0 -106
- package/sdk/platform/Partner/PartnerPlatformClient.js +0 -878
- package/sdk/platform/Partner/PartnerPlatformValidator.d.ts +0 -208
- package/sdk/platform/Partner/PartnerPlatformValidator.js +0 -169
|
@@ -16,13 +16,17 @@ class Communication {
|
|
|
16
16
|
* @param {CommunicationPlatformApplicationValidator.CreateAudienceParam} arg
|
|
17
17
|
* - Arg object
|
|
18
18
|
*
|
|
19
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
19
20
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
20
21
|
* @returns {Promise<CommunicationPlatformModel.Audience>} - Success response
|
|
21
22
|
* @name createAudience
|
|
22
23
|
* @summary: Create audience
|
|
23
|
-
* @description:
|
|
24
|
+
* @description: Audience is used to import CSV files containing emails, phone numbers, and other variables in order to populate email/SMS templates for bulk delivery via a Campaign. Use this API to create audience. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/createAudience/).
|
|
24
25
|
*/
|
|
25
|
-
async createAudience(
|
|
26
|
+
async createAudience(
|
|
27
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
28
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
29
|
+
) {
|
|
26
30
|
const {
|
|
27
31
|
error,
|
|
28
32
|
} = CommunicationPlatformApplicationValidator.createAudience().validate(
|
|
@@ -59,12 +63,12 @@ class Communication {
|
|
|
59
63
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources`,
|
|
60
64
|
query_params,
|
|
61
65
|
body,
|
|
62
|
-
|
|
63
|
-
{
|
|
66
|
+
requestHeaders,
|
|
67
|
+
{ responseHeaders }
|
|
64
68
|
);
|
|
65
69
|
|
|
66
70
|
let responseData = response;
|
|
67
|
-
if (
|
|
71
|
+
if (responseHeaders) {
|
|
68
72
|
responseData = response[0];
|
|
69
73
|
}
|
|
70
74
|
|
|
@@ -85,17 +89,234 @@ class Communication {
|
|
|
85
89
|
return response;
|
|
86
90
|
}
|
|
87
91
|
|
|
92
|
+
/**
|
|
93
|
+
* @param {CommunicationPlatformApplicationValidator.CreateBigQueryHeadersParam} arg
|
|
94
|
+
* - Arg object
|
|
95
|
+
*
|
|
96
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
97
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
98
|
+
* @returns {Promise<Object>} - Success response
|
|
99
|
+
* @name createBigQueryHeaders
|
|
100
|
+
* @summary: Create big query headers
|
|
101
|
+
* @description: Create big query headers - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/createBigQueryHeaders/).
|
|
102
|
+
*/
|
|
103
|
+
async createBigQueryHeaders(
|
|
104
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
105
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
106
|
+
) {
|
|
107
|
+
const {
|
|
108
|
+
error,
|
|
109
|
+
} = CommunicationPlatformApplicationValidator.createBigQueryHeaders().validate(
|
|
110
|
+
{},
|
|
111
|
+
{ abortEarly: false, allowUnknown: true }
|
|
112
|
+
);
|
|
113
|
+
if (error) {
|
|
114
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
115
|
+
}
|
|
116
|
+
|
|
117
|
+
// Showing warrnings if extra unknown parameters are found
|
|
118
|
+
const {
|
|
119
|
+
error: warrning,
|
|
120
|
+
} = CommunicationPlatformApplicationValidator.createBigQueryHeaders().validate(
|
|
121
|
+
{},
|
|
122
|
+
{ abortEarly: false, allowUnknown: false }
|
|
123
|
+
);
|
|
124
|
+
if (warrning) {
|
|
125
|
+
Logger({
|
|
126
|
+
level: "WARN",
|
|
127
|
+
message: `Parameter Validation warrnings for platform > Communication > createBigQueryHeaders \n ${warrning}`,
|
|
128
|
+
});
|
|
129
|
+
}
|
|
130
|
+
|
|
131
|
+
const query_params = {};
|
|
132
|
+
|
|
133
|
+
const response = await PlatformAPIClient.execute(
|
|
134
|
+
this.config,
|
|
135
|
+
"post",
|
|
136
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/bigquery-headers`,
|
|
137
|
+
query_params,
|
|
138
|
+
undefined,
|
|
139
|
+
requestHeaders,
|
|
140
|
+
{ responseHeaders }
|
|
141
|
+
);
|
|
142
|
+
|
|
143
|
+
let responseData = response;
|
|
144
|
+
if (responseHeaders) {
|
|
145
|
+
responseData = response[0];
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
149
|
+
abortEarly: false,
|
|
150
|
+
allowUnknown: false,
|
|
151
|
+
});
|
|
152
|
+
|
|
153
|
+
if (res_error) {
|
|
154
|
+
Logger({
|
|
155
|
+
level: "WARN",
|
|
156
|
+
message: `Response Validation Warnnings for platform > Communication > createBigQueryHeaders \n ${res_error}`,
|
|
157
|
+
});
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return response;
|
|
161
|
+
}
|
|
162
|
+
|
|
163
|
+
/**
|
|
164
|
+
* @param {CommunicationPlatformApplicationValidator.CreateBigQueryNCountParam} arg
|
|
165
|
+
* - Arg object
|
|
166
|
+
*
|
|
167
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
168
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
169
|
+
* @returns {Promise<Object>} - Success response
|
|
170
|
+
* @name createBigQueryNCount
|
|
171
|
+
* @summary: Create big query n count
|
|
172
|
+
* @description: Create big query n count - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/createBigQueryNCount/).
|
|
173
|
+
*/
|
|
174
|
+
async createBigQueryNCount(
|
|
175
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
176
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
177
|
+
) {
|
|
178
|
+
const {
|
|
179
|
+
error,
|
|
180
|
+
} = CommunicationPlatformApplicationValidator.createBigQueryNCount().validate(
|
|
181
|
+
{},
|
|
182
|
+
{ abortEarly: false, allowUnknown: true }
|
|
183
|
+
);
|
|
184
|
+
if (error) {
|
|
185
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
186
|
+
}
|
|
187
|
+
|
|
188
|
+
// Showing warrnings if extra unknown parameters are found
|
|
189
|
+
const {
|
|
190
|
+
error: warrning,
|
|
191
|
+
} = CommunicationPlatformApplicationValidator.createBigQueryNCount().validate(
|
|
192
|
+
{},
|
|
193
|
+
{ abortEarly: false, allowUnknown: false }
|
|
194
|
+
);
|
|
195
|
+
if (warrning) {
|
|
196
|
+
Logger({
|
|
197
|
+
level: "WARN",
|
|
198
|
+
message: `Parameter Validation warrnings for platform > Communication > createBigQueryNCount \n ${warrning}`,
|
|
199
|
+
});
|
|
200
|
+
}
|
|
201
|
+
|
|
202
|
+
const query_params = {};
|
|
203
|
+
|
|
204
|
+
const response = await PlatformAPIClient.execute(
|
|
205
|
+
this.config,
|
|
206
|
+
"post",
|
|
207
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/bigquery-n-records`,
|
|
208
|
+
query_params,
|
|
209
|
+
undefined,
|
|
210
|
+
requestHeaders,
|
|
211
|
+
{ responseHeaders }
|
|
212
|
+
);
|
|
213
|
+
|
|
214
|
+
let responseData = response;
|
|
215
|
+
if (responseHeaders) {
|
|
216
|
+
responseData = response[0];
|
|
217
|
+
}
|
|
218
|
+
|
|
219
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
220
|
+
abortEarly: false,
|
|
221
|
+
allowUnknown: false,
|
|
222
|
+
});
|
|
223
|
+
|
|
224
|
+
if (res_error) {
|
|
225
|
+
Logger({
|
|
226
|
+
level: "WARN",
|
|
227
|
+
message: `Response Validation Warnnings for platform > Communication > createBigQueryNCount \n ${res_error}`,
|
|
228
|
+
});
|
|
229
|
+
}
|
|
230
|
+
|
|
231
|
+
return response;
|
|
232
|
+
}
|
|
233
|
+
|
|
234
|
+
/**
|
|
235
|
+
* @param {CommunicationPlatformApplicationValidator.CreateBigQueryRowCountParam} arg
|
|
236
|
+
* - Arg object
|
|
237
|
+
*
|
|
238
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
239
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
240
|
+
* @returns {Promise<Object>} - Success response
|
|
241
|
+
* @name createBigQueryRowCount
|
|
242
|
+
* @summary: Create big query row count
|
|
243
|
+
* @description: Create big query row count - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/createBigQueryRowCount/).
|
|
244
|
+
*/
|
|
245
|
+
async createBigQueryRowCount(
|
|
246
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
247
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
248
|
+
) {
|
|
249
|
+
const {
|
|
250
|
+
error,
|
|
251
|
+
} = CommunicationPlatformApplicationValidator.createBigQueryRowCount().validate(
|
|
252
|
+
{},
|
|
253
|
+
{ abortEarly: false, allowUnknown: true }
|
|
254
|
+
);
|
|
255
|
+
if (error) {
|
|
256
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
257
|
+
}
|
|
258
|
+
|
|
259
|
+
// Showing warrnings if extra unknown parameters are found
|
|
260
|
+
const {
|
|
261
|
+
error: warrning,
|
|
262
|
+
} = CommunicationPlatformApplicationValidator.createBigQueryRowCount().validate(
|
|
263
|
+
{},
|
|
264
|
+
{ abortEarly: false, allowUnknown: false }
|
|
265
|
+
);
|
|
266
|
+
if (warrning) {
|
|
267
|
+
Logger({
|
|
268
|
+
level: "WARN",
|
|
269
|
+
message: `Parameter Validation warrnings for platform > Communication > createBigQueryRowCount \n ${warrning}`,
|
|
270
|
+
});
|
|
271
|
+
}
|
|
272
|
+
|
|
273
|
+
const query_params = {};
|
|
274
|
+
|
|
275
|
+
const response = await PlatformAPIClient.execute(
|
|
276
|
+
this.config,
|
|
277
|
+
"post",
|
|
278
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/bigquery-row-count`,
|
|
279
|
+
query_params,
|
|
280
|
+
undefined,
|
|
281
|
+
requestHeaders,
|
|
282
|
+
{ responseHeaders }
|
|
283
|
+
);
|
|
284
|
+
|
|
285
|
+
let responseData = response;
|
|
286
|
+
if (responseHeaders) {
|
|
287
|
+
responseData = response[0];
|
|
288
|
+
}
|
|
289
|
+
|
|
290
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
291
|
+
abortEarly: false,
|
|
292
|
+
allowUnknown: false,
|
|
293
|
+
});
|
|
294
|
+
|
|
295
|
+
if (res_error) {
|
|
296
|
+
Logger({
|
|
297
|
+
level: "WARN",
|
|
298
|
+
message: `Response Validation Warnnings for platform > Communication > createBigQueryRowCount \n ${res_error}`,
|
|
299
|
+
});
|
|
300
|
+
}
|
|
301
|
+
|
|
302
|
+
return response;
|
|
303
|
+
}
|
|
304
|
+
|
|
88
305
|
/**
|
|
89
306
|
* @param {CommunicationPlatformApplicationValidator.CreateCampaignParam} arg
|
|
90
307
|
* - Arg object
|
|
91
308
|
*
|
|
309
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
92
310
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
93
311
|
* @returns {Promise<CommunicationPlatformModel.Campaign>} - Success response
|
|
94
312
|
* @name createCampaign
|
|
95
313
|
* @summary: Create campaign
|
|
96
314
|
* @description: Create campaign - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/createCampaign/).
|
|
97
315
|
*/
|
|
98
|
-
async createCampaign(
|
|
316
|
+
async createCampaign(
|
|
317
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
318
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
319
|
+
) {
|
|
99
320
|
const {
|
|
100
321
|
error,
|
|
101
322
|
} = CommunicationPlatformApplicationValidator.createCampaign().validate(
|
|
@@ -132,12 +353,12 @@ class Communication {
|
|
|
132
353
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns`,
|
|
133
354
|
query_params,
|
|
134
355
|
body,
|
|
135
|
-
|
|
136
|
-
{
|
|
356
|
+
requestHeaders,
|
|
357
|
+
{ responseHeaders }
|
|
137
358
|
);
|
|
138
359
|
|
|
139
360
|
let responseData = response;
|
|
140
|
-
if (
|
|
361
|
+
if (responseHeaders) {
|
|
141
362
|
responseData = response[0];
|
|
142
363
|
}
|
|
143
364
|
|
|
@@ -162,13 +383,17 @@ class Communication {
|
|
|
162
383
|
* @param {CommunicationPlatformApplicationValidator.CreateEmailProviderParam} arg
|
|
163
384
|
* - Arg object
|
|
164
385
|
*
|
|
386
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
165
387
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
166
388
|
* @returns {Promise<CommunicationPlatformModel.EmailProvider>} - Success response
|
|
167
389
|
* @name createEmailProvider
|
|
168
390
|
* @summary: Create email provider
|
|
169
391
|
* @description: Create email provider - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/createEmailProvider/).
|
|
170
392
|
*/
|
|
171
|
-
async createEmailProvider(
|
|
393
|
+
async createEmailProvider(
|
|
394
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
395
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
396
|
+
) {
|
|
172
397
|
const {
|
|
173
398
|
error,
|
|
174
399
|
} = CommunicationPlatformApplicationValidator.createEmailProvider().validate(
|
|
@@ -205,12 +430,12 @@ class Communication {
|
|
|
205
430
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers`,
|
|
206
431
|
query_params,
|
|
207
432
|
body,
|
|
208
|
-
|
|
209
|
-
{
|
|
433
|
+
requestHeaders,
|
|
434
|
+
{ responseHeaders }
|
|
210
435
|
);
|
|
211
436
|
|
|
212
437
|
let responseData = response;
|
|
213
|
-
if (
|
|
438
|
+
if (responseHeaders) {
|
|
214
439
|
responseData = response[0];
|
|
215
440
|
}
|
|
216
441
|
|
|
@@ -235,13 +460,17 @@ class Communication {
|
|
|
235
460
|
* @param {CommunicationPlatformApplicationValidator.CreateEmailTemplateParam} arg
|
|
236
461
|
* - Arg object
|
|
237
462
|
*
|
|
463
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
238
464
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
239
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
465
|
+
* @returns {Promise<CommunicationPlatformModel.EmailTemplate>} - Success response
|
|
240
466
|
* @name createEmailTemplate
|
|
241
467
|
* @summary: Create email template
|
|
242
|
-
* @description:
|
|
468
|
+
* @description: Email templates are predefined formats linked to various events for delivering messages to users. Use this API to create an email template. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/createEmailTemplate/).
|
|
243
469
|
*/
|
|
244
|
-
async createEmailTemplate(
|
|
470
|
+
async createEmailTemplate(
|
|
471
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
472
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
473
|
+
) {
|
|
245
474
|
const {
|
|
246
475
|
error,
|
|
247
476
|
} = CommunicationPlatformApplicationValidator.createEmailTemplate().validate(
|
|
@@ -278,18 +507,18 @@ class Communication {
|
|
|
278
507
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates`,
|
|
279
508
|
query_params,
|
|
280
509
|
body,
|
|
281
|
-
|
|
282
|
-
{
|
|
510
|
+
requestHeaders,
|
|
511
|
+
{ responseHeaders }
|
|
283
512
|
);
|
|
284
513
|
|
|
285
514
|
let responseData = response;
|
|
286
|
-
if (
|
|
515
|
+
if (responseHeaders) {
|
|
287
516
|
responseData = response[0];
|
|
288
517
|
}
|
|
289
518
|
|
|
290
519
|
const {
|
|
291
520
|
error: res_error,
|
|
292
|
-
} = CommunicationPlatformModel.
|
|
521
|
+
} = CommunicationPlatformModel.EmailTemplate().validate(responseData, {
|
|
293
522
|
abortEarly: false,
|
|
294
523
|
allowUnknown: false,
|
|
295
524
|
});
|
|
@@ -308,13 +537,17 @@ class Communication {
|
|
|
308
537
|
* @param {CommunicationPlatformApplicationValidator.CreateSmsProviderParam} arg
|
|
309
538
|
* - Arg object
|
|
310
539
|
*
|
|
540
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
311
541
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
312
|
-
* @returns {Promise<
|
|
542
|
+
* @returns {Promise<Object>} - Success response
|
|
313
543
|
* @name createSmsProvider
|
|
314
544
|
* @summary: Create sms provider
|
|
315
545
|
* @description: Create sms provider - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/createSmsProvider/).
|
|
316
546
|
*/
|
|
317
|
-
async createSmsProvider(
|
|
547
|
+
async createSmsProvider(
|
|
548
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
549
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
550
|
+
) {
|
|
318
551
|
const {
|
|
319
552
|
error,
|
|
320
553
|
} = CommunicationPlatformApplicationValidator.createSmsProvider().validate(
|
|
@@ -351,18 +584,16 @@ class Communication {
|
|
|
351
584
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers`,
|
|
352
585
|
query_params,
|
|
353
586
|
body,
|
|
354
|
-
|
|
355
|
-
{
|
|
587
|
+
requestHeaders,
|
|
588
|
+
{ responseHeaders }
|
|
356
589
|
);
|
|
357
590
|
|
|
358
591
|
let responseData = response;
|
|
359
|
-
if (
|
|
592
|
+
if (responseHeaders) {
|
|
360
593
|
responseData = response[0];
|
|
361
594
|
}
|
|
362
595
|
|
|
363
|
-
const {
|
|
364
|
-
error: res_error,
|
|
365
|
-
} = CommunicationPlatformModel.SmsProvider().validate(responseData, {
|
|
596
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
366
597
|
abortEarly: false,
|
|
367
598
|
allowUnknown: false,
|
|
368
599
|
});
|
|
@@ -381,13 +612,17 @@ class Communication {
|
|
|
381
612
|
* @param {CommunicationPlatformApplicationValidator.CreateSmsTemplateParam} arg
|
|
382
613
|
* - Arg object
|
|
383
614
|
*
|
|
615
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
384
616
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
385
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
617
|
+
* @returns {Promise<CommunicationPlatformModel.SmsTemplate>} - Success response
|
|
386
618
|
* @name createSmsTemplate
|
|
387
619
|
* @summary: Create sms template
|
|
388
|
-
* @description:
|
|
620
|
+
* @description: SMS templates are predefined message formats linked to various events for delivering messages to users. Use this API to create an sms template. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/createSmsTemplate/).
|
|
389
621
|
*/
|
|
390
|
-
async createSmsTemplate(
|
|
622
|
+
async createSmsTemplate(
|
|
623
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
624
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
625
|
+
) {
|
|
391
626
|
const {
|
|
392
627
|
error,
|
|
393
628
|
} = CommunicationPlatformApplicationValidator.createSmsTemplate().validate(
|
|
@@ -424,18 +659,18 @@ class Communication {
|
|
|
424
659
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates`,
|
|
425
660
|
query_params,
|
|
426
661
|
body,
|
|
427
|
-
|
|
428
|
-
{
|
|
662
|
+
requestHeaders,
|
|
663
|
+
{ responseHeaders }
|
|
429
664
|
);
|
|
430
665
|
|
|
431
666
|
let responseData = response;
|
|
432
|
-
if (
|
|
667
|
+
if (responseHeaders) {
|
|
433
668
|
responseData = response[0];
|
|
434
669
|
}
|
|
435
670
|
|
|
436
671
|
const {
|
|
437
672
|
error: res_error,
|
|
438
|
-
} = CommunicationPlatformModel.
|
|
673
|
+
} = CommunicationPlatformModel.SmsTemplate().validate(responseData, {
|
|
439
674
|
abortEarly: false,
|
|
440
675
|
allowUnknown: false,
|
|
441
676
|
});
|
|
@@ -451,21 +686,23 @@ class Communication {
|
|
|
451
686
|
}
|
|
452
687
|
|
|
453
688
|
/**
|
|
454
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
689
|
+
* @param {CommunicationPlatformApplicationValidator.DeleteAudienceByIdParam} arg
|
|
455
690
|
* - Arg object
|
|
456
691
|
*
|
|
692
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
457
693
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
458
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
459
|
-
*
|
|
460
|
-
*
|
|
461
|
-
* @
|
|
462
|
-
* @summary: Delete email template by id
|
|
463
|
-
* @description: Delete email template by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/deleteEmailTemplateById/).
|
|
694
|
+
* @returns {Promise<CommunicationPlatformModel.GenericDelete>} - Success response
|
|
695
|
+
* @name deleteAudienceById
|
|
696
|
+
* @summary: Delete audience by id
|
|
697
|
+
* @description: Audience is used to import CSV files containing emails, phone numbers, and other variables in order to populate email/SMS templates for bulk delivery via a Campaign. Use this API to delete audience by id. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/deleteAudienceById/).
|
|
464
698
|
*/
|
|
465
|
-
async
|
|
699
|
+
async deleteAudienceById(
|
|
700
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
701
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
702
|
+
) {
|
|
466
703
|
const {
|
|
467
704
|
error,
|
|
468
|
-
} = CommunicationPlatformApplicationValidator.
|
|
705
|
+
} = CommunicationPlatformApplicationValidator.deleteAudienceById().validate(
|
|
469
706
|
{
|
|
470
707
|
id,
|
|
471
708
|
},
|
|
@@ -478,7 +715,7 @@ class Communication {
|
|
|
478
715
|
// Showing warrnings if extra unknown parameters are found
|
|
479
716
|
const {
|
|
480
717
|
error: warrning,
|
|
481
|
-
} = CommunicationPlatformApplicationValidator.
|
|
718
|
+
} = CommunicationPlatformApplicationValidator.deleteAudienceById().validate(
|
|
482
719
|
{
|
|
483
720
|
id,
|
|
484
721
|
},
|
|
@@ -487,7 +724,7 @@ class Communication {
|
|
|
487
724
|
if (warrning) {
|
|
488
725
|
Logger({
|
|
489
726
|
level: "WARN",
|
|
490
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
727
|
+
message: `Parameter Validation warrnings for platform > Communication > deleteAudienceById \n ${warrning}`,
|
|
491
728
|
});
|
|
492
729
|
}
|
|
493
730
|
|
|
@@ -496,29 +733,29 @@ class Communication {
|
|
|
496
733
|
const response = await PlatformAPIClient.execute(
|
|
497
734
|
this.config,
|
|
498
735
|
"delete",
|
|
499
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
736
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/${id}`,
|
|
500
737
|
query_params,
|
|
501
738
|
undefined,
|
|
502
|
-
|
|
503
|
-
{
|
|
739
|
+
requestHeaders,
|
|
740
|
+
{ responseHeaders }
|
|
504
741
|
);
|
|
505
742
|
|
|
506
743
|
let responseData = response;
|
|
507
|
-
if (
|
|
744
|
+
if (responseHeaders) {
|
|
508
745
|
responseData = response[0];
|
|
509
746
|
}
|
|
510
747
|
|
|
511
748
|
const {
|
|
512
749
|
error: res_error,
|
|
513
|
-
} = CommunicationPlatformModel.
|
|
514
|
-
|
|
515
|
-
|
|
516
|
-
);
|
|
750
|
+
} = CommunicationPlatformModel.GenericDelete().validate(responseData, {
|
|
751
|
+
abortEarly: false,
|
|
752
|
+
allowUnknown: false,
|
|
753
|
+
});
|
|
517
754
|
|
|
518
755
|
if (res_error) {
|
|
519
756
|
Logger({
|
|
520
757
|
level: "WARN",
|
|
521
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
758
|
+
message: `Response Validation Warnnings for platform > Communication > deleteAudienceById \n ${res_error}`,
|
|
522
759
|
});
|
|
523
760
|
}
|
|
524
761
|
|
|
@@ -526,21 +763,23 @@ class Communication {
|
|
|
526
763
|
}
|
|
527
764
|
|
|
528
765
|
/**
|
|
529
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
766
|
+
* @param {CommunicationPlatformApplicationValidator.DeleteEmailProviderByIdParam} arg
|
|
530
767
|
* - Arg object
|
|
531
768
|
*
|
|
769
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
532
770
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
533
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
534
|
-
*
|
|
535
|
-
*
|
|
536
|
-
* @
|
|
537
|
-
* @summary: Delete sms template by id
|
|
538
|
-
* @description: Delete sms template by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/deleteSmsTemplateById/).
|
|
771
|
+
* @returns {Promise<CommunicationPlatformModel.GenericDelete>} - Success response
|
|
772
|
+
* @name deleteEmailProviderById
|
|
773
|
+
* @summary: Delete email provider by id
|
|
774
|
+
* @description: Delete email provider by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/deleteEmailProviderById/).
|
|
539
775
|
*/
|
|
540
|
-
async
|
|
776
|
+
async deleteEmailProviderById(
|
|
777
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
778
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
779
|
+
) {
|
|
541
780
|
const {
|
|
542
781
|
error,
|
|
543
|
-
} = CommunicationPlatformApplicationValidator.
|
|
782
|
+
} = CommunicationPlatformApplicationValidator.deleteEmailProviderById().validate(
|
|
544
783
|
{
|
|
545
784
|
id,
|
|
546
785
|
},
|
|
@@ -553,7 +792,7 @@ class Communication {
|
|
|
553
792
|
// Showing warrnings if extra unknown parameters are found
|
|
554
793
|
const {
|
|
555
794
|
error: warrning,
|
|
556
|
-
} = CommunicationPlatformApplicationValidator.
|
|
795
|
+
} = CommunicationPlatformApplicationValidator.deleteEmailProviderById().validate(
|
|
557
796
|
{
|
|
558
797
|
id,
|
|
559
798
|
},
|
|
@@ -562,7 +801,7 @@ class Communication {
|
|
|
562
801
|
if (warrning) {
|
|
563
802
|
Logger({
|
|
564
803
|
level: "WARN",
|
|
565
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
804
|
+
message: `Parameter Validation warrnings for platform > Communication > deleteEmailProviderById \n ${warrning}`,
|
|
566
805
|
});
|
|
567
806
|
}
|
|
568
807
|
|
|
@@ -571,29 +810,29 @@ class Communication {
|
|
|
571
810
|
const response = await PlatformAPIClient.execute(
|
|
572
811
|
this.config,
|
|
573
812
|
"delete",
|
|
574
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
813
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers/${id}`,
|
|
575
814
|
query_params,
|
|
576
815
|
undefined,
|
|
577
|
-
|
|
578
|
-
{
|
|
816
|
+
requestHeaders,
|
|
817
|
+
{ responseHeaders }
|
|
579
818
|
);
|
|
580
819
|
|
|
581
820
|
let responseData = response;
|
|
582
|
-
if (
|
|
821
|
+
if (responseHeaders) {
|
|
583
822
|
responseData = response[0];
|
|
584
823
|
}
|
|
585
824
|
|
|
586
825
|
const {
|
|
587
826
|
error: res_error,
|
|
588
|
-
} = CommunicationPlatformModel.
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
);
|
|
827
|
+
} = CommunicationPlatformModel.GenericDelete().validate(responseData, {
|
|
828
|
+
abortEarly: false,
|
|
829
|
+
allowUnknown: false,
|
|
830
|
+
});
|
|
592
831
|
|
|
593
832
|
if (res_error) {
|
|
594
833
|
Logger({
|
|
595
834
|
level: "WARN",
|
|
596
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
835
|
+
message: `Response Validation Warnnings for platform > Communication > deleteEmailProviderById \n ${res_error}`,
|
|
597
836
|
});
|
|
598
837
|
}
|
|
599
838
|
|
|
@@ -601,19 +840,23 @@ class Communication {
|
|
|
601
840
|
}
|
|
602
841
|
|
|
603
842
|
/**
|
|
604
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
843
|
+
* @param {CommunicationPlatformApplicationValidator.DeleteEmailTemplateByIdParam} arg
|
|
605
844
|
* - Arg object
|
|
606
845
|
*
|
|
846
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
607
847
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
608
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
609
|
-
* @name
|
|
610
|
-
* @summary:
|
|
611
|
-
* @description:
|
|
848
|
+
* @returns {Promise<CommunicationPlatformModel.GenericDelete>} - Success response
|
|
849
|
+
* @name deleteEmailTemplateById
|
|
850
|
+
* @summary: Delete email template by id
|
|
851
|
+
* @description: Email templates are predefined formats linked to various events for delivering messages to users. Use this API to delete an email template by id. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/deleteEmailTemplateById/).
|
|
612
852
|
*/
|
|
613
|
-
async
|
|
853
|
+
async deleteEmailTemplateById(
|
|
854
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
855
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
856
|
+
) {
|
|
614
857
|
const {
|
|
615
858
|
error,
|
|
616
|
-
} = CommunicationPlatformApplicationValidator.
|
|
859
|
+
} = CommunicationPlatformApplicationValidator.deleteEmailTemplateById().validate(
|
|
617
860
|
{
|
|
618
861
|
id,
|
|
619
862
|
},
|
|
@@ -626,7 +869,7 @@ class Communication {
|
|
|
626
869
|
// Showing warrnings if extra unknown parameters are found
|
|
627
870
|
const {
|
|
628
871
|
error: warrning,
|
|
629
|
-
} = CommunicationPlatformApplicationValidator.
|
|
872
|
+
} = CommunicationPlatformApplicationValidator.deleteEmailTemplateById().validate(
|
|
630
873
|
{
|
|
631
874
|
id,
|
|
632
875
|
},
|
|
@@ -635,7 +878,7 @@ class Communication {
|
|
|
635
878
|
if (warrning) {
|
|
636
879
|
Logger({
|
|
637
880
|
level: "WARN",
|
|
638
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
881
|
+
message: `Parameter Validation warrnings for platform > Communication > deleteEmailTemplateById \n ${warrning}`,
|
|
639
882
|
});
|
|
640
883
|
}
|
|
641
884
|
|
|
@@ -643,22 +886,22 @@ class Communication {
|
|
|
643
886
|
|
|
644
887
|
const response = await PlatformAPIClient.execute(
|
|
645
888
|
this.config,
|
|
646
|
-
"
|
|
647
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
889
|
+
"delete",
|
|
890
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
|
|
648
891
|
query_params,
|
|
649
892
|
undefined,
|
|
650
|
-
|
|
651
|
-
{
|
|
893
|
+
requestHeaders,
|
|
894
|
+
{ responseHeaders }
|
|
652
895
|
);
|
|
653
896
|
|
|
654
897
|
let responseData = response;
|
|
655
|
-
if (
|
|
898
|
+
if (responseHeaders) {
|
|
656
899
|
responseData = response[0];
|
|
657
900
|
}
|
|
658
901
|
|
|
659
902
|
const {
|
|
660
903
|
error: res_error,
|
|
661
|
-
} = CommunicationPlatformModel.
|
|
904
|
+
} = CommunicationPlatformModel.GenericDelete().validate(responseData, {
|
|
662
905
|
abortEarly: false,
|
|
663
906
|
allowUnknown: false,
|
|
664
907
|
});
|
|
@@ -666,7 +909,7 @@ class Communication {
|
|
|
666
909
|
if (res_error) {
|
|
667
910
|
Logger({
|
|
668
911
|
level: "WARN",
|
|
669
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
912
|
+
message: `Response Validation Warnnings for platform > Communication > deleteEmailTemplateById \n ${res_error}`,
|
|
670
913
|
});
|
|
671
914
|
}
|
|
672
915
|
|
|
@@ -674,26 +917,25 @@ class Communication {
|
|
|
674
917
|
}
|
|
675
918
|
|
|
676
919
|
/**
|
|
677
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
920
|
+
* @param {CommunicationPlatformApplicationValidator.DeleteSmsProviderByIdParam} arg
|
|
678
921
|
* - Arg object
|
|
679
922
|
*
|
|
923
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
680
924
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
681
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
682
|
-
* @name
|
|
683
|
-
* @summary:
|
|
684
|
-
* @description:
|
|
925
|
+
* @returns {Promise<CommunicationPlatformModel.GenericDelete>} - Success response
|
|
926
|
+
* @name deleteSmsProviderById
|
|
927
|
+
* @summary: Delete sms provider by id
|
|
928
|
+
* @description: Delete sms provider by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/deleteSmsProviderById/).
|
|
685
929
|
*/
|
|
686
|
-
async
|
|
687
|
-
{
|
|
688
|
-
{
|
|
930
|
+
async deleteSmsProviderById(
|
|
931
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
932
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
689
933
|
) {
|
|
690
934
|
const {
|
|
691
935
|
error,
|
|
692
|
-
} = CommunicationPlatformApplicationValidator.
|
|
936
|
+
} = CommunicationPlatformApplicationValidator.deleteSmsProviderById().validate(
|
|
693
937
|
{
|
|
694
|
-
|
|
695
|
-
pageSize,
|
|
696
|
-
sort,
|
|
938
|
+
id,
|
|
697
939
|
},
|
|
698
940
|
{ abortEarly: false, allowUnknown: true }
|
|
699
941
|
);
|
|
@@ -704,44 +946,39 @@ class Communication {
|
|
|
704
946
|
// Showing warrnings if extra unknown parameters are found
|
|
705
947
|
const {
|
|
706
948
|
error: warrning,
|
|
707
|
-
} = CommunicationPlatformApplicationValidator.
|
|
949
|
+
} = CommunicationPlatformApplicationValidator.deleteSmsProviderById().validate(
|
|
708
950
|
{
|
|
709
|
-
|
|
710
|
-
pageSize,
|
|
711
|
-
sort,
|
|
951
|
+
id,
|
|
712
952
|
},
|
|
713
953
|
{ abortEarly: false, allowUnknown: false }
|
|
714
954
|
);
|
|
715
955
|
if (warrning) {
|
|
716
956
|
Logger({
|
|
717
957
|
level: "WARN",
|
|
718
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
958
|
+
message: `Parameter Validation warrnings for platform > Communication > deleteSmsProviderById \n ${warrning}`,
|
|
719
959
|
});
|
|
720
960
|
}
|
|
721
961
|
|
|
722
962
|
const query_params = {};
|
|
723
|
-
query_params["page_no"] = pageNo;
|
|
724
|
-
query_params["page_size"] = pageSize;
|
|
725
|
-
query_params["sort"] = sort;
|
|
726
963
|
|
|
727
964
|
const response = await PlatformAPIClient.execute(
|
|
728
965
|
this.config,
|
|
729
|
-
"
|
|
730
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
966
|
+
"delete",
|
|
967
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers/${id}`,
|
|
731
968
|
query_params,
|
|
732
969
|
undefined,
|
|
733
|
-
|
|
734
|
-
{
|
|
970
|
+
requestHeaders,
|
|
971
|
+
{ responseHeaders }
|
|
735
972
|
);
|
|
736
973
|
|
|
737
974
|
let responseData = response;
|
|
738
|
-
if (
|
|
975
|
+
if (responseHeaders) {
|
|
739
976
|
responseData = response[0];
|
|
740
977
|
}
|
|
741
978
|
|
|
742
979
|
const {
|
|
743
980
|
error: res_error,
|
|
744
|
-
} = CommunicationPlatformModel.
|
|
981
|
+
} = CommunicationPlatformModel.GenericDelete().validate(responseData, {
|
|
745
982
|
abortEarly: false,
|
|
746
983
|
allowUnknown: false,
|
|
747
984
|
});
|
|
@@ -749,7 +986,7 @@ class Communication {
|
|
|
749
986
|
if (res_error) {
|
|
750
987
|
Logger({
|
|
751
988
|
level: "WARN",
|
|
752
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
989
|
+
message: `Response Validation Warnnings for platform > Communication > deleteSmsProviderById \n ${res_error}`,
|
|
753
990
|
});
|
|
754
991
|
}
|
|
755
992
|
|
|
@@ -757,55 +994,25 @@ class Communication {
|
|
|
757
994
|
}
|
|
758
995
|
|
|
759
996
|
/**
|
|
760
|
-
* @param {
|
|
761
|
-
* @param {string} arg.companyId - Company id
|
|
762
|
-
* @param {string} arg.applicationId - Application id
|
|
763
|
-
* @param {number} [arg.pageSize] - Current request items count
|
|
764
|
-
* @param {Object} [arg.sort] - To sort based on created_at
|
|
765
|
-
* @returns {Paginator<CommunicationPlatformModel.Audiences>}
|
|
766
|
-
* @summary: Get audiences
|
|
767
|
-
* @description: Get audiences
|
|
768
|
-
*/
|
|
769
|
-
getAudiencesPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
770
|
-
const paginator = new Paginator();
|
|
771
|
-
const callback = async () => {
|
|
772
|
-
const pageId = paginator.nextId;
|
|
773
|
-
const pageNo = paginator.pageNo;
|
|
774
|
-
const pageType = "number";
|
|
775
|
-
const data = await this.getAudiences({
|
|
776
|
-
companyId: companyId,
|
|
777
|
-
applicationId: applicationId,
|
|
778
|
-
pageNo: pageNo,
|
|
779
|
-
pageSize: pageSize,
|
|
780
|
-
sort: sort,
|
|
781
|
-
});
|
|
782
|
-
paginator.setPaginator({
|
|
783
|
-
hasNext: data.page.has_next ? true : false,
|
|
784
|
-
nextId: data.page.next_id,
|
|
785
|
-
});
|
|
786
|
-
return data;
|
|
787
|
-
};
|
|
788
|
-
paginator.setCallback(callback.bind(this));
|
|
789
|
-
return paginator;
|
|
790
|
-
}
|
|
791
|
-
|
|
792
|
-
/**
|
|
793
|
-
* @param {CommunicationPlatformApplicationValidator.GetBigqueryHeadersParam} arg
|
|
997
|
+
* @param {CommunicationPlatformApplicationValidator.DeleteSmsTemplateByIdParam} arg
|
|
794
998
|
* - Arg object
|
|
795
999
|
*
|
|
1000
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
796
1001
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
797
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
798
|
-
*
|
|
799
|
-
* @
|
|
800
|
-
* @
|
|
801
|
-
* @description: Get bigquery headers - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getBigqueryHeaders/).
|
|
1002
|
+
* @returns {Promise<CommunicationPlatformModel.GenericDelete>} - Success response
|
|
1003
|
+
* @name deleteSmsTemplateById
|
|
1004
|
+
* @summary: Delete sms template by id
|
|
1005
|
+
* @description: SMS templates are predefined message formats linked to various events for delivering messages to users. Use this API to delete an sms template by ID. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/deleteSmsTemplateById/).
|
|
802
1006
|
*/
|
|
803
|
-
async
|
|
1007
|
+
async deleteSmsTemplateById(
|
|
1008
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
1009
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1010
|
+
) {
|
|
804
1011
|
const {
|
|
805
1012
|
error,
|
|
806
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1013
|
+
} = CommunicationPlatformApplicationValidator.deleteSmsTemplateById().validate(
|
|
807
1014
|
{
|
|
808
|
-
|
|
1015
|
+
id,
|
|
809
1016
|
},
|
|
810
1017
|
{ abortEarly: false, allowUnknown: true }
|
|
811
1018
|
);
|
|
@@ -816,16 +1023,16 @@ class Communication {
|
|
|
816
1023
|
// Showing warrnings if extra unknown parameters are found
|
|
817
1024
|
const {
|
|
818
1025
|
error: warrning,
|
|
819
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1026
|
+
} = CommunicationPlatformApplicationValidator.deleteSmsTemplateById().validate(
|
|
820
1027
|
{
|
|
821
|
-
|
|
1028
|
+
id,
|
|
822
1029
|
},
|
|
823
1030
|
{ abortEarly: false, allowUnknown: false }
|
|
824
1031
|
);
|
|
825
1032
|
if (warrning) {
|
|
826
1033
|
Logger({
|
|
827
1034
|
level: "WARN",
|
|
828
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
1035
|
+
message: `Parameter Validation warrnings for platform > Communication > deleteSmsTemplateById \n ${warrning}`,
|
|
829
1036
|
});
|
|
830
1037
|
}
|
|
831
1038
|
|
|
@@ -833,22 +1040,22 @@ class Communication {
|
|
|
833
1040
|
|
|
834
1041
|
const response = await PlatformAPIClient.execute(
|
|
835
1042
|
this.config,
|
|
836
|
-
"
|
|
837
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1043
|
+
"delete",
|
|
1044
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
|
|
838
1045
|
query_params,
|
|
839
|
-
body,
|
|
840
1046
|
undefined,
|
|
841
|
-
|
|
1047
|
+
requestHeaders,
|
|
1048
|
+
{ responseHeaders }
|
|
842
1049
|
);
|
|
843
1050
|
|
|
844
1051
|
let responseData = response;
|
|
845
|
-
if (
|
|
1052
|
+
if (responseHeaders) {
|
|
846
1053
|
responseData = response[0];
|
|
847
1054
|
}
|
|
848
1055
|
|
|
849
1056
|
const {
|
|
850
1057
|
error: res_error,
|
|
851
|
-
} = CommunicationPlatformModel.
|
|
1058
|
+
} = CommunicationPlatformModel.GenericDelete().validate(responseData, {
|
|
852
1059
|
abortEarly: false,
|
|
853
1060
|
allowUnknown: false,
|
|
854
1061
|
});
|
|
@@ -856,7 +1063,7 @@ class Communication {
|
|
|
856
1063
|
if (res_error) {
|
|
857
1064
|
Logger({
|
|
858
1065
|
level: "WARN",
|
|
859
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
1066
|
+
message: `Response Validation Warnnings for platform > Communication > deleteSmsTemplateById \n ${res_error}`,
|
|
860
1067
|
});
|
|
861
1068
|
}
|
|
862
1069
|
|
|
@@ -864,22 +1071,24 @@ class Communication {
|
|
|
864
1071
|
}
|
|
865
1072
|
|
|
866
1073
|
/**
|
|
867
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
1074
|
+
* @param {CommunicationPlatformApplicationValidator.GetAppProvidersParam} arg
|
|
868
1075
|
* - Arg object
|
|
869
1076
|
*
|
|
1077
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
870
1078
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
871
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
872
|
-
* @name
|
|
873
|
-
* @summary: Get
|
|
874
|
-
* @description:
|
|
1079
|
+
* @returns {Promise<CommunicationPlatformModel.AppProvider>} - Success response
|
|
1080
|
+
* @name getAppProviders
|
|
1081
|
+
* @summary: Get app providers
|
|
1082
|
+
* @description: Using this API will return a list of application providers. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getAppProviders/).
|
|
875
1083
|
*/
|
|
876
|
-
async
|
|
1084
|
+
async getAppProviders(
|
|
1085
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
1086
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1087
|
+
) {
|
|
877
1088
|
const {
|
|
878
1089
|
error,
|
|
879
|
-
} = CommunicationPlatformApplicationValidator.
|
|
880
|
-
{
|
|
881
|
-
id,
|
|
882
|
-
},
|
|
1090
|
+
} = CommunicationPlatformApplicationValidator.getAppProviders().validate(
|
|
1091
|
+
{},
|
|
883
1092
|
{ abortEarly: false, allowUnknown: true }
|
|
884
1093
|
);
|
|
885
1094
|
if (error) {
|
|
@@ -889,16 +1098,14 @@ class Communication {
|
|
|
889
1098
|
// Showing warrnings if extra unknown parameters are found
|
|
890
1099
|
const {
|
|
891
1100
|
error: warrning,
|
|
892
|
-
} = CommunicationPlatformApplicationValidator.
|
|
893
|
-
{
|
|
894
|
-
id,
|
|
895
|
-
},
|
|
1101
|
+
} = CommunicationPlatformApplicationValidator.getAppProviders().validate(
|
|
1102
|
+
{},
|
|
896
1103
|
{ abortEarly: false, allowUnknown: false }
|
|
897
1104
|
);
|
|
898
1105
|
if (warrning) {
|
|
899
1106
|
Logger({
|
|
900
1107
|
level: "WARN",
|
|
901
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
1108
|
+
message: `Parameter Validation warrnings for platform > Communication > getAppProviders \n ${warrning}`,
|
|
902
1109
|
});
|
|
903
1110
|
}
|
|
904
1111
|
|
|
@@ -907,21 +1114,21 @@ class Communication {
|
|
|
907
1114
|
const response = await PlatformAPIClient.execute(
|
|
908
1115
|
this.config,
|
|
909
1116
|
"get",
|
|
910
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1117
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/app-provider/get-provider`,
|
|
911
1118
|
query_params,
|
|
912
1119
|
undefined,
|
|
913
|
-
|
|
914
|
-
{
|
|
1120
|
+
requestHeaders,
|
|
1121
|
+
{ responseHeaders }
|
|
915
1122
|
);
|
|
916
1123
|
|
|
917
1124
|
let responseData = response;
|
|
918
|
-
if (
|
|
1125
|
+
if (responseHeaders) {
|
|
919
1126
|
responseData = response[0];
|
|
920
1127
|
}
|
|
921
1128
|
|
|
922
1129
|
const {
|
|
923
1130
|
error: res_error,
|
|
924
|
-
} = CommunicationPlatformModel.
|
|
1131
|
+
} = CommunicationPlatformModel.AppProvider().validate(responseData, {
|
|
925
1132
|
abortEarly: false,
|
|
926
1133
|
allowUnknown: false,
|
|
927
1134
|
});
|
|
@@ -929,7 +1136,7 @@ class Communication {
|
|
|
929
1136
|
if (res_error) {
|
|
930
1137
|
Logger({
|
|
931
1138
|
level: "WARN",
|
|
932
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
1139
|
+
message: `Response Validation Warnnings for platform > Communication > getAppProviders \n ${res_error}`,
|
|
933
1140
|
});
|
|
934
1141
|
}
|
|
935
1142
|
|
|
@@ -937,26 +1144,25 @@ class Communication {
|
|
|
937
1144
|
}
|
|
938
1145
|
|
|
939
1146
|
/**
|
|
940
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
1147
|
+
* @param {CommunicationPlatformApplicationValidator.GetAudienceByIdParam} arg
|
|
941
1148
|
* - Arg object
|
|
942
1149
|
*
|
|
1150
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
943
1151
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
944
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
945
|
-
* @name
|
|
946
|
-
* @summary: Get
|
|
947
|
-
* @description:
|
|
1152
|
+
* @returns {Promise<CommunicationPlatformModel.Audience>} - Success response
|
|
1153
|
+
* @name getAudienceById
|
|
1154
|
+
* @summary: Get audience by id
|
|
1155
|
+
* @description: Audience is used to import CSV files containing emails, phone numbers, and other variables in order to populate email/SMS templates for bulk delivery via a Campaign. Use this API to get audiences by Id. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getAudienceById/).
|
|
948
1156
|
*/
|
|
949
|
-
async
|
|
950
|
-
{
|
|
951
|
-
{
|
|
1157
|
+
async getAudienceById(
|
|
1158
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
1159
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
952
1160
|
) {
|
|
953
1161
|
const {
|
|
954
1162
|
error,
|
|
955
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1163
|
+
} = CommunicationPlatformApplicationValidator.getAudienceById().validate(
|
|
956
1164
|
{
|
|
957
|
-
|
|
958
|
-
pageSize,
|
|
959
|
-
sort,
|
|
1165
|
+
id,
|
|
960
1166
|
},
|
|
961
1167
|
{ abortEarly: false, allowUnknown: true }
|
|
962
1168
|
);
|
|
@@ -967,44 +1173,39 @@ class Communication {
|
|
|
967
1173
|
// Showing warrnings if extra unknown parameters are found
|
|
968
1174
|
const {
|
|
969
1175
|
error: warrning,
|
|
970
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1176
|
+
} = CommunicationPlatformApplicationValidator.getAudienceById().validate(
|
|
971
1177
|
{
|
|
972
|
-
|
|
973
|
-
pageSize,
|
|
974
|
-
sort,
|
|
1178
|
+
id,
|
|
975
1179
|
},
|
|
976
1180
|
{ abortEarly: false, allowUnknown: false }
|
|
977
1181
|
);
|
|
978
1182
|
if (warrning) {
|
|
979
1183
|
Logger({
|
|
980
1184
|
level: "WARN",
|
|
981
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
1185
|
+
message: `Parameter Validation warrnings for platform > Communication > getAudienceById \n ${warrning}`,
|
|
982
1186
|
});
|
|
983
1187
|
}
|
|
984
1188
|
|
|
985
1189
|
const query_params = {};
|
|
986
|
-
query_params["page_no"] = pageNo;
|
|
987
|
-
query_params["page_size"] = pageSize;
|
|
988
|
-
query_params["sort"] = sort;
|
|
989
1190
|
|
|
990
1191
|
const response = await PlatformAPIClient.execute(
|
|
991
1192
|
this.config,
|
|
992
1193
|
"get",
|
|
993
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1194
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/${id}`,
|
|
994
1195
|
query_params,
|
|
995
1196
|
undefined,
|
|
996
|
-
|
|
997
|
-
{
|
|
1197
|
+
requestHeaders,
|
|
1198
|
+
{ responseHeaders }
|
|
998
1199
|
);
|
|
999
1200
|
|
|
1000
1201
|
let responseData = response;
|
|
1001
|
-
if (
|
|
1202
|
+
if (responseHeaders) {
|
|
1002
1203
|
responseData = response[0];
|
|
1003
1204
|
}
|
|
1004
1205
|
|
|
1005
1206
|
const {
|
|
1006
1207
|
error: res_error,
|
|
1007
|
-
} = CommunicationPlatformModel.
|
|
1208
|
+
} = CommunicationPlatformModel.Audience().validate(responseData, {
|
|
1008
1209
|
abortEarly: false,
|
|
1009
1210
|
allowUnknown: false,
|
|
1010
1211
|
});
|
|
@@ -1012,7 +1213,7 @@ class Communication {
|
|
|
1012
1213
|
if (res_error) {
|
|
1013
1214
|
Logger({
|
|
1014
1215
|
level: "WARN",
|
|
1015
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
1216
|
+
message: `Response Validation Warnnings for platform > Communication > getAudienceById \n ${res_error}`,
|
|
1016
1217
|
});
|
|
1017
1218
|
}
|
|
1018
1219
|
|
|
@@ -1020,60 +1221,27 @@ class Communication {
|
|
|
1020
1221
|
}
|
|
1021
1222
|
|
|
1022
1223
|
/**
|
|
1023
|
-
* @param {
|
|
1024
|
-
* @param {string} arg.companyId - Company id
|
|
1025
|
-
* @param {string} arg.applicationId - Application id
|
|
1026
|
-
* @param {number} [arg.pageSize] - Current request items count
|
|
1027
|
-
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1028
|
-
* @returns {Paginator<CommunicationPlatformModel.Campaigns>}
|
|
1029
|
-
* @summary: Get campaigns
|
|
1030
|
-
* @description: Get campaigns
|
|
1031
|
-
*/
|
|
1032
|
-
getCampaignsPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
1033
|
-
const paginator = new Paginator();
|
|
1034
|
-
const callback = async () => {
|
|
1035
|
-
const pageId = paginator.nextId;
|
|
1036
|
-
const pageNo = paginator.pageNo;
|
|
1037
|
-
const pageType = "number";
|
|
1038
|
-
const data = await this.getCampaigns({
|
|
1039
|
-
companyId: companyId,
|
|
1040
|
-
applicationId: applicationId,
|
|
1041
|
-
pageNo: pageNo,
|
|
1042
|
-
pageSize: pageSize,
|
|
1043
|
-
sort: sort,
|
|
1044
|
-
});
|
|
1045
|
-
paginator.setPaginator({
|
|
1046
|
-
hasNext: data.page.has_next ? true : false,
|
|
1047
|
-
nextId: data.page.next_id,
|
|
1048
|
-
});
|
|
1049
|
-
return data;
|
|
1050
|
-
};
|
|
1051
|
-
paginator.setCallback(callback.bind(this));
|
|
1052
|
-
return paginator;
|
|
1053
|
-
}
|
|
1054
|
-
|
|
1055
|
-
/**
|
|
1056
|
-
* @param {CommunicationPlatformApplicationValidator.GetCommunicationLogsParam} arg
|
|
1224
|
+
* @param {CommunicationPlatformApplicationValidator.GetAudiencesParam} arg
|
|
1057
1225
|
* - Arg object
|
|
1058
1226
|
*
|
|
1227
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1059
1228
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1060
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
1061
|
-
* @name
|
|
1062
|
-
* @summary: Get
|
|
1063
|
-
* @description:
|
|
1229
|
+
* @returns {Promise<CommunicationPlatformModel.Audiences>} - Success response
|
|
1230
|
+
* @name getAudiences
|
|
1231
|
+
* @summary: Get audiences
|
|
1232
|
+
* @description: Audience is used to import CSV files containing emails, phone numbers, and other variables in order to populate email/SMS templates for bulk delivery via a Campaign. Use this API to get audiences. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getAudiences/).
|
|
1064
1233
|
*/
|
|
1065
|
-
async
|
|
1066
|
-
{
|
|
1067
|
-
{
|
|
1234
|
+
async getAudiences(
|
|
1235
|
+
{ pageNo, pageSize, sort, requestHeaders } = { requestHeaders: {} },
|
|
1236
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1068
1237
|
) {
|
|
1069
1238
|
const {
|
|
1070
1239
|
error,
|
|
1071
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1240
|
+
} = CommunicationPlatformApplicationValidator.getAudiences().validate(
|
|
1072
1241
|
{
|
|
1073
|
-
|
|
1242
|
+
pageNo,
|
|
1074
1243
|
pageSize,
|
|
1075
1244
|
sort,
|
|
1076
|
-
query,
|
|
1077
1245
|
},
|
|
1078
1246
|
{ abortEarly: false, allowUnknown: true }
|
|
1079
1247
|
);
|
|
@@ -1084,46 +1252,44 @@ class Communication {
|
|
|
1084
1252
|
// Showing warrnings if extra unknown parameters are found
|
|
1085
1253
|
const {
|
|
1086
1254
|
error: warrning,
|
|
1087
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1255
|
+
} = CommunicationPlatformApplicationValidator.getAudiences().validate(
|
|
1088
1256
|
{
|
|
1089
|
-
|
|
1257
|
+
pageNo,
|
|
1090
1258
|
pageSize,
|
|
1091
1259
|
sort,
|
|
1092
|
-
query,
|
|
1093
1260
|
},
|
|
1094
1261
|
{ abortEarly: false, allowUnknown: false }
|
|
1095
1262
|
);
|
|
1096
1263
|
if (warrning) {
|
|
1097
1264
|
Logger({
|
|
1098
1265
|
level: "WARN",
|
|
1099
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
1266
|
+
message: `Parameter Validation warrnings for platform > Communication > getAudiences \n ${warrning}`,
|
|
1100
1267
|
});
|
|
1101
1268
|
}
|
|
1102
1269
|
|
|
1103
1270
|
const query_params = {};
|
|
1104
|
-
query_params["
|
|
1271
|
+
query_params["page_no"] = pageNo;
|
|
1105
1272
|
query_params["page_size"] = pageSize;
|
|
1106
1273
|
query_params["sort"] = sort;
|
|
1107
|
-
query_params["query"] = query;
|
|
1108
1274
|
|
|
1109
1275
|
const response = await PlatformAPIClient.execute(
|
|
1110
1276
|
this.config,
|
|
1111
1277
|
"get",
|
|
1112
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1278
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources`,
|
|
1113
1279
|
query_params,
|
|
1114
1280
|
undefined,
|
|
1115
|
-
|
|
1116
|
-
{
|
|
1281
|
+
requestHeaders,
|
|
1282
|
+
{ responseHeaders }
|
|
1117
1283
|
);
|
|
1118
1284
|
|
|
1119
1285
|
let responseData = response;
|
|
1120
|
-
if (
|
|
1286
|
+
if (responseHeaders) {
|
|
1121
1287
|
responseData = response[0];
|
|
1122
1288
|
}
|
|
1123
1289
|
|
|
1124
1290
|
const {
|
|
1125
1291
|
error: res_error,
|
|
1126
|
-
} = CommunicationPlatformModel.
|
|
1292
|
+
} = CommunicationPlatformModel.Audiences().validate(responseData, {
|
|
1127
1293
|
abortEarly: false,
|
|
1128
1294
|
allowUnknown: false,
|
|
1129
1295
|
});
|
|
@@ -1131,7 +1297,7 @@ class Communication {
|
|
|
1131
1297
|
if (res_error) {
|
|
1132
1298
|
Logger({
|
|
1133
1299
|
level: "WARN",
|
|
1134
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
1300
|
+
message: `Response Validation Warnnings for platform > Communication > getAudiences \n ${res_error}`,
|
|
1135
1301
|
});
|
|
1136
1302
|
}
|
|
1137
1303
|
|
|
@@ -1143,31 +1309,23 @@ class Communication {
|
|
|
1143
1309
|
* @param {string} arg.companyId - Company id
|
|
1144
1310
|
* @param {string} arg.applicationId - Application id
|
|
1145
1311
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1146
|
-
* @param {Object} [arg.sort] - To sort based on
|
|
1147
|
-
* @
|
|
1148
|
-
* @
|
|
1149
|
-
* @
|
|
1150
|
-
* @description: Get communication logs
|
|
1312
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1313
|
+
* @returns {Paginator<CommunicationPlatformModel.Audiences>}
|
|
1314
|
+
* @summary: Get audiences
|
|
1315
|
+
* @description: Audience is used to import CSV files containing emails, phone numbers, and other variables in order to populate email/SMS templates for bulk delivery via a Campaign. Use this API to get audiences.
|
|
1151
1316
|
*/
|
|
1152
|
-
|
|
1153
|
-
companyId,
|
|
1154
|
-
applicationId,
|
|
1155
|
-
pageSize,
|
|
1156
|
-
sort,
|
|
1157
|
-
query,
|
|
1158
|
-
} = {}) {
|
|
1317
|
+
getAudiencesPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
1159
1318
|
const paginator = new Paginator();
|
|
1160
1319
|
const callback = async () => {
|
|
1161
1320
|
const pageId = paginator.nextId;
|
|
1162
1321
|
const pageNo = paginator.pageNo;
|
|
1163
|
-
const pageType = "
|
|
1164
|
-
const data = await this.
|
|
1322
|
+
const pageType = "number";
|
|
1323
|
+
const data = await this.getAudiences({
|
|
1165
1324
|
companyId: companyId,
|
|
1166
1325
|
applicationId: applicationId,
|
|
1167
|
-
|
|
1326
|
+
pageNo: pageNo,
|
|
1168
1327
|
pageSize: pageSize,
|
|
1169
1328
|
sort: sort,
|
|
1170
|
-
query: query,
|
|
1171
1329
|
});
|
|
1172
1330
|
paginator.setPaginator({
|
|
1173
1331
|
hasNext: data.page.has_next ? true : false,
|
|
@@ -1180,19 +1338,23 @@ class Communication {
|
|
|
1180
1338
|
}
|
|
1181
1339
|
|
|
1182
1340
|
/**
|
|
1183
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
1341
|
+
* @param {CommunicationPlatformApplicationValidator.GetBigQueryHeadersByIdParam} arg
|
|
1184
1342
|
* - Arg object
|
|
1185
1343
|
*
|
|
1344
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1186
1345
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1187
|
-
* @returns {Promise<
|
|
1188
|
-
* @name
|
|
1189
|
-
* @summary: Get
|
|
1190
|
-
* @description: Get
|
|
1346
|
+
* @returns {Promise<Object>} - Success response
|
|
1347
|
+
* @name getBigQueryHeadersById
|
|
1348
|
+
* @summary: Get big query headers by id
|
|
1349
|
+
* @description: Get big query headers by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getBigQueryHeadersById/).
|
|
1191
1350
|
*/
|
|
1192
|
-
async
|
|
1351
|
+
async getBigQueryHeadersById(
|
|
1352
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
1353
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1354
|
+
) {
|
|
1193
1355
|
const {
|
|
1194
1356
|
error,
|
|
1195
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1357
|
+
} = CommunicationPlatformApplicationValidator.getBigQueryHeadersById().validate(
|
|
1196
1358
|
{
|
|
1197
1359
|
id,
|
|
1198
1360
|
},
|
|
@@ -1205,7 +1367,7 @@ class Communication {
|
|
|
1205
1367
|
// Showing warrnings if extra unknown parameters are found
|
|
1206
1368
|
const {
|
|
1207
1369
|
error: warrning,
|
|
1208
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1370
|
+
} = CommunicationPlatformApplicationValidator.getBigQueryHeadersById().validate(
|
|
1209
1371
|
{
|
|
1210
1372
|
id,
|
|
1211
1373
|
},
|
|
@@ -1214,7 +1376,7 @@ class Communication {
|
|
|
1214
1376
|
if (warrning) {
|
|
1215
1377
|
Logger({
|
|
1216
1378
|
level: "WARN",
|
|
1217
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
1379
|
+
message: `Parameter Validation warrnings for platform > Communication > getBigQueryHeadersById \n ${warrning}`,
|
|
1218
1380
|
});
|
|
1219
1381
|
}
|
|
1220
1382
|
|
|
@@ -1223,21 +1385,19 @@ class Communication {
|
|
|
1223
1385
|
const response = await PlatformAPIClient.execute(
|
|
1224
1386
|
this.config,
|
|
1225
1387
|
"get",
|
|
1226
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1388
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/bigquery-headers/${id}`,
|
|
1227
1389
|
query_params,
|
|
1228
1390
|
undefined,
|
|
1229
|
-
|
|
1230
|
-
{
|
|
1391
|
+
requestHeaders,
|
|
1392
|
+
{ responseHeaders }
|
|
1231
1393
|
);
|
|
1232
1394
|
|
|
1233
1395
|
let responseData = response;
|
|
1234
|
-
if (
|
|
1396
|
+
if (responseHeaders) {
|
|
1235
1397
|
responseData = response[0];
|
|
1236
1398
|
}
|
|
1237
1399
|
|
|
1238
|
-
const {
|
|
1239
|
-
error: res_error,
|
|
1240
|
-
} = CommunicationPlatformModel.EmailProvider().validate(responseData, {
|
|
1400
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
1241
1401
|
abortEarly: false,
|
|
1242
1402
|
allowUnknown: false,
|
|
1243
1403
|
});
|
|
@@ -1245,7 +1405,7 @@ class Communication {
|
|
|
1245
1405
|
if (res_error) {
|
|
1246
1406
|
Logger({
|
|
1247
1407
|
level: "WARN",
|
|
1248
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
1408
|
+
message: `Response Validation Warnnings for platform > Communication > getBigQueryHeadersById \n ${res_error}`,
|
|
1249
1409
|
});
|
|
1250
1410
|
}
|
|
1251
1411
|
|
|
@@ -1253,26 +1413,25 @@ class Communication {
|
|
|
1253
1413
|
}
|
|
1254
1414
|
|
|
1255
1415
|
/**
|
|
1256
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
1416
|
+
* @param {CommunicationPlatformApplicationValidator.GetBigQueryRowCountByIdParam} arg
|
|
1257
1417
|
* - Arg object
|
|
1258
1418
|
*
|
|
1419
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1259
1420
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1260
|
-
* @returns {Promise<
|
|
1261
|
-
* @name
|
|
1262
|
-
* @summary: Get
|
|
1263
|
-
* @description: Get
|
|
1421
|
+
* @returns {Promise<Object>} - Success response
|
|
1422
|
+
* @name getBigQueryRowCountById
|
|
1423
|
+
* @summary: Get big query row count by id
|
|
1424
|
+
* @description: Get big query row count by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getBigQueryRowCountById/).
|
|
1264
1425
|
*/
|
|
1265
|
-
async
|
|
1266
|
-
{
|
|
1267
|
-
{
|
|
1426
|
+
async getBigQueryRowCountById(
|
|
1427
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
1428
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1268
1429
|
) {
|
|
1269
1430
|
const {
|
|
1270
1431
|
error,
|
|
1271
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1432
|
+
} = CommunicationPlatformApplicationValidator.getBigQueryRowCountById().validate(
|
|
1272
1433
|
{
|
|
1273
|
-
|
|
1274
|
-
pageSize,
|
|
1275
|
-
sort,
|
|
1434
|
+
id,
|
|
1276
1435
|
},
|
|
1277
1436
|
{ abortEarly: false, allowUnknown: true }
|
|
1278
1437
|
);
|
|
@@ -1283,44 +1442,37 @@ class Communication {
|
|
|
1283
1442
|
// Showing warrnings if extra unknown parameters are found
|
|
1284
1443
|
const {
|
|
1285
1444
|
error: warrning,
|
|
1286
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1445
|
+
} = CommunicationPlatformApplicationValidator.getBigQueryRowCountById().validate(
|
|
1287
1446
|
{
|
|
1288
|
-
|
|
1289
|
-
pageSize,
|
|
1290
|
-
sort,
|
|
1447
|
+
id,
|
|
1291
1448
|
},
|
|
1292
1449
|
{ abortEarly: false, allowUnknown: false }
|
|
1293
1450
|
);
|
|
1294
1451
|
if (warrning) {
|
|
1295
1452
|
Logger({
|
|
1296
1453
|
level: "WARN",
|
|
1297
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
1454
|
+
message: `Parameter Validation warrnings for platform > Communication > getBigQueryRowCountById \n ${warrning}`,
|
|
1298
1455
|
});
|
|
1299
1456
|
}
|
|
1300
1457
|
|
|
1301
1458
|
const query_params = {};
|
|
1302
|
-
query_params["page_no"] = pageNo;
|
|
1303
|
-
query_params["page_size"] = pageSize;
|
|
1304
|
-
query_params["sort"] = sort;
|
|
1305
1459
|
|
|
1306
1460
|
const response = await PlatformAPIClient.execute(
|
|
1307
1461
|
this.config,
|
|
1308
1462
|
"get",
|
|
1309
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1463
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/bigquery-row-count/${id}`,
|
|
1310
1464
|
query_params,
|
|
1311
1465
|
undefined,
|
|
1312
|
-
|
|
1313
|
-
{
|
|
1466
|
+
requestHeaders,
|
|
1467
|
+
{ responseHeaders }
|
|
1314
1468
|
);
|
|
1315
1469
|
|
|
1316
1470
|
let responseData = response;
|
|
1317
|
-
if (
|
|
1471
|
+
if (responseHeaders) {
|
|
1318
1472
|
responseData = response[0];
|
|
1319
1473
|
}
|
|
1320
1474
|
|
|
1321
|
-
const {
|
|
1322
|
-
error: res_error,
|
|
1323
|
-
} = CommunicationPlatformModel.EmailProviders().validate(responseData, {
|
|
1475
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
1324
1476
|
abortEarly: false,
|
|
1325
1477
|
allowUnknown: false,
|
|
1326
1478
|
});
|
|
@@ -1328,7 +1480,7 @@ class Communication {
|
|
|
1328
1480
|
if (res_error) {
|
|
1329
1481
|
Logger({
|
|
1330
1482
|
level: "WARN",
|
|
1331
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
1483
|
+
message: `Response Validation Warnnings for platform > Communication > getBigQueryRowCountById \n ${res_error}`,
|
|
1332
1484
|
});
|
|
1333
1485
|
}
|
|
1334
1486
|
|
|
@@ -1336,57 +1488,23 @@ class Communication {
|
|
|
1336
1488
|
}
|
|
1337
1489
|
|
|
1338
1490
|
/**
|
|
1339
|
-
* @param {
|
|
1340
|
-
*
|
|
1341
|
-
*
|
|
1342
|
-
* @param {
|
|
1343
|
-
* @param {
|
|
1344
|
-
* @returns {
|
|
1345
|
-
* @
|
|
1346
|
-
* @
|
|
1491
|
+
* @param {CommunicationPlatformApplicationValidator.GetCampaignByIdParam} arg
|
|
1492
|
+
* - Arg object
|
|
1493
|
+
*
|
|
1494
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1495
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1496
|
+
* @returns {Promise<CommunicationPlatformModel.Campaign>} - Success response
|
|
1497
|
+
* @name getCampaignById
|
|
1498
|
+
* @summary: Get campaign by id
|
|
1499
|
+
* @description: Get campaign by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getCampaignById/).
|
|
1347
1500
|
*/
|
|
1348
|
-
|
|
1349
|
-
|
|
1350
|
-
|
|
1351
|
-
|
|
1352
|
-
sort,
|
|
1353
|
-
} = {}) {
|
|
1354
|
-
const paginator = new Paginator();
|
|
1355
|
-
const callback = async () => {
|
|
1356
|
-
const pageId = paginator.nextId;
|
|
1357
|
-
const pageNo = paginator.pageNo;
|
|
1358
|
-
const pageType = "number";
|
|
1359
|
-
const data = await this.getEmailProviders({
|
|
1360
|
-
companyId: companyId,
|
|
1361
|
-
applicationId: applicationId,
|
|
1362
|
-
pageNo: pageNo,
|
|
1363
|
-
pageSize: pageSize,
|
|
1364
|
-
sort: sort,
|
|
1365
|
-
});
|
|
1366
|
-
paginator.setPaginator({
|
|
1367
|
-
hasNext: data.page.has_next ? true : false,
|
|
1368
|
-
nextId: data.page.next_id,
|
|
1369
|
-
});
|
|
1370
|
-
return data;
|
|
1371
|
-
};
|
|
1372
|
-
paginator.setCallback(callback.bind(this));
|
|
1373
|
-
return paginator;
|
|
1374
|
-
}
|
|
1375
|
-
|
|
1376
|
-
/**
|
|
1377
|
-
* @param {CommunicationPlatformApplicationValidator.GetEmailTemplateByIdParam} arg
|
|
1378
|
-
* - Arg object
|
|
1379
|
-
*
|
|
1380
|
-
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1381
|
-
* @returns {Promise<CommunicationPlatformModel.EmailTemplate>} - Success response
|
|
1382
|
-
* @name getEmailTemplateById
|
|
1383
|
-
* @summary: Get email template by id
|
|
1384
|
-
* @description: Get email template by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getEmailTemplateById/).
|
|
1385
|
-
*/
|
|
1386
|
-
async getEmailTemplateById({ id } = {}, { headers } = { headers: false }) {
|
|
1501
|
+
async getCampaignById(
|
|
1502
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
1503
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1504
|
+
) {
|
|
1387
1505
|
const {
|
|
1388
1506
|
error,
|
|
1389
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1507
|
+
} = CommunicationPlatformApplicationValidator.getCampaignById().validate(
|
|
1390
1508
|
{
|
|
1391
1509
|
id,
|
|
1392
1510
|
},
|
|
@@ -1399,7 +1517,7 @@ class Communication {
|
|
|
1399
1517
|
// Showing warrnings if extra unknown parameters are found
|
|
1400
1518
|
const {
|
|
1401
1519
|
error: warrning,
|
|
1402
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1520
|
+
} = CommunicationPlatformApplicationValidator.getCampaignById().validate(
|
|
1403
1521
|
{
|
|
1404
1522
|
id,
|
|
1405
1523
|
},
|
|
@@ -1408,7 +1526,7 @@ class Communication {
|
|
|
1408
1526
|
if (warrning) {
|
|
1409
1527
|
Logger({
|
|
1410
1528
|
level: "WARN",
|
|
1411
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
1529
|
+
message: `Parameter Validation warrnings for platform > Communication > getCampaignById \n ${warrning}`,
|
|
1412
1530
|
});
|
|
1413
1531
|
}
|
|
1414
1532
|
|
|
@@ -1417,21 +1535,21 @@ class Communication {
|
|
|
1417
1535
|
const response = await PlatformAPIClient.execute(
|
|
1418
1536
|
this.config,
|
|
1419
1537
|
"get",
|
|
1420
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1538
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns/${id}`,
|
|
1421
1539
|
query_params,
|
|
1422
1540
|
undefined,
|
|
1423
|
-
|
|
1424
|
-
{
|
|
1541
|
+
requestHeaders,
|
|
1542
|
+
{ responseHeaders }
|
|
1425
1543
|
);
|
|
1426
1544
|
|
|
1427
1545
|
let responseData = response;
|
|
1428
|
-
if (
|
|
1546
|
+
if (responseHeaders) {
|
|
1429
1547
|
responseData = response[0];
|
|
1430
1548
|
}
|
|
1431
1549
|
|
|
1432
1550
|
const {
|
|
1433
1551
|
error: res_error,
|
|
1434
|
-
} = CommunicationPlatformModel.
|
|
1552
|
+
} = CommunicationPlatformModel.Campaign().validate(responseData, {
|
|
1435
1553
|
abortEarly: false,
|
|
1436
1554
|
allowUnknown: false,
|
|
1437
1555
|
});
|
|
@@ -1439,7 +1557,7 @@ class Communication {
|
|
|
1439
1557
|
if (res_error) {
|
|
1440
1558
|
Logger({
|
|
1441
1559
|
level: "WARN",
|
|
1442
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
1560
|
+
message: `Response Validation Warnnings for platform > Communication > getCampaignById \n ${res_error}`,
|
|
1443
1561
|
});
|
|
1444
1562
|
}
|
|
1445
1563
|
|
|
@@ -1447,22 +1565,23 @@ class Communication {
|
|
|
1447
1565
|
}
|
|
1448
1566
|
|
|
1449
1567
|
/**
|
|
1450
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
1568
|
+
* @param {CommunicationPlatformApplicationValidator.GetCampaignsParam} arg
|
|
1451
1569
|
* - Arg object
|
|
1452
1570
|
*
|
|
1571
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1453
1572
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1454
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
1455
|
-
* @name
|
|
1456
|
-
* @summary: Get
|
|
1457
|
-
* @description: Get
|
|
1573
|
+
* @returns {Promise<CommunicationPlatformModel.Campaigns>} - Success response
|
|
1574
|
+
* @name getCampaigns
|
|
1575
|
+
* @summary: Get campaigns
|
|
1576
|
+
* @description: Get campaigns - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getCampaigns/).
|
|
1458
1577
|
*/
|
|
1459
|
-
async
|
|
1460
|
-
{ pageNo, pageSize, sort } = {},
|
|
1461
|
-
{
|
|
1578
|
+
async getCampaigns(
|
|
1579
|
+
{ pageNo, pageSize, sort, requestHeaders } = { requestHeaders: {} },
|
|
1580
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1462
1581
|
) {
|
|
1463
1582
|
const {
|
|
1464
1583
|
error,
|
|
1465
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1584
|
+
} = CommunicationPlatformApplicationValidator.getCampaigns().validate(
|
|
1466
1585
|
{
|
|
1467
1586
|
pageNo,
|
|
1468
1587
|
pageSize,
|
|
@@ -1477,7 +1596,7 @@ class Communication {
|
|
|
1477
1596
|
// Showing warrnings if extra unknown parameters are found
|
|
1478
1597
|
const {
|
|
1479
1598
|
error: warrning,
|
|
1480
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1599
|
+
} = CommunicationPlatformApplicationValidator.getCampaigns().validate(
|
|
1481
1600
|
{
|
|
1482
1601
|
pageNo,
|
|
1483
1602
|
pageSize,
|
|
@@ -1488,7 +1607,7 @@ class Communication {
|
|
|
1488
1607
|
if (warrning) {
|
|
1489
1608
|
Logger({
|
|
1490
1609
|
level: "WARN",
|
|
1491
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
1610
|
+
message: `Parameter Validation warrnings for platform > Communication > getCampaigns \n ${warrning}`,
|
|
1492
1611
|
});
|
|
1493
1612
|
}
|
|
1494
1613
|
|
|
@@ -1500,21 +1619,21 @@ class Communication {
|
|
|
1500
1619
|
const response = await PlatformAPIClient.execute(
|
|
1501
1620
|
this.config,
|
|
1502
1621
|
"get",
|
|
1503
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1622
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns`,
|
|
1504
1623
|
query_params,
|
|
1505
1624
|
undefined,
|
|
1506
|
-
|
|
1507
|
-
{
|
|
1625
|
+
requestHeaders,
|
|
1626
|
+
{ responseHeaders }
|
|
1508
1627
|
);
|
|
1509
1628
|
|
|
1510
1629
|
let responseData = response;
|
|
1511
|
-
if (
|
|
1630
|
+
if (responseHeaders) {
|
|
1512
1631
|
responseData = response[0];
|
|
1513
1632
|
}
|
|
1514
1633
|
|
|
1515
1634
|
const {
|
|
1516
1635
|
error: res_error,
|
|
1517
|
-
} = CommunicationPlatformModel.
|
|
1636
|
+
} = CommunicationPlatformModel.Campaigns().validate(responseData, {
|
|
1518
1637
|
abortEarly: false,
|
|
1519
1638
|
allowUnknown: false,
|
|
1520
1639
|
});
|
|
@@ -1522,7 +1641,7 @@ class Communication {
|
|
|
1522
1641
|
if (res_error) {
|
|
1523
1642
|
Logger({
|
|
1524
1643
|
level: "WARN",
|
|
1525
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
1644
|
+
message: `Response Validation Warnnings for platform > Communication > getCampaigns \n ${res_error}`,
|
|
1526
1645
|
});
|
|
1527
1646
|
}
|
|
1528
1647
|
|
|
@@ -1535,22 +1654,17 @@ class Communication {
|
|
|
1535
1654
|
* @param {string} arg.applicationId - Application id
|
|
1536
1655
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1537
1656
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1538
|
-
* @returns {Paginator<CommunicationPlatformModel.
|
|
1539
|
-
* @summary: Get
|
|
1540
|
-
* @description: Get
|
|
1657
|
+
* @returns {Paginator<CommunicationPlatformModel.Campaigns>}
|
|
1658
|
+
* @summary: Get campaigns
|
|
1659
|
+
* @description: Get campaigns
|
|
1541
1660
|
*/
|
|
1542
|
-
|
|
1543
|
-
companyId,
|
|
1544
|
-
applicationId,
|
|
1545
|
-
pageSize,
|
|
1546
|
-
sort,
|
|
1547
|
-
} = {}) {
|
|
1661
|
+
getCampaignsPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
1548
1662
|
const paginator = new Paginator();
|
|
1549
1663
|
const callback = async () => {
|
|
1550
1664
|
const pageId = paginator.nextId;
|
|
1551
1665
|
const pageNo = paginator.pageNo;
|
|
1552
1666
|
const pageType = "number";
|
|
1553
|
-
const data = await this.
|
|
1667
|
+
const data = await this.getCampaigns({
|
|
1554
1668
|
companyId: companyId,
|
|
1555
1669
|
applicationId: applicationId,
|
|
1556
1670
|
pageNo: pageNo,
|
|
@@ -1568,27 +1682,28 @@ class Communication {
|
|
|
1568
1682
|
}
|
|
1569
1683
|
|
|
1570
1684
|
/**
|
|
1571
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
1685
|
+
* @param {CommunicationPlatformApplicationValidator.GetCommunicationLogsParam} arg
|
|
1572
1686
|
* - Arg object
|
|
1573
1687
|
*
|
|
1688
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1574
1689
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1575
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
1576
|
-
*
|
|
1577
|
-
* @
|
|
1578
|
-
* @
|
|
1579
|
-
* @description: Get event subscriptions - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getEventSubscriptions/).
|
|
1690
|
+
* @returns {Promise<CommunicationPlatformModel.Logs>} - Success response
|
|
1691
|
+
* @name getCommunicationLogs
|
|
1692
|
+
* @summary: Get communication logs
|
|
1693
|
+
* @description: Get communication logs - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getCommunicationLogs/).
|
|
1580
1694
|
*/
|
|
1581
|
-
async
|
|
1582
|
-
{
|
|
1583
|
-
{
|
|
1695
|
+
async getCommunicationLogs(
|
|
1696
|
+
{ pageId, pageSize, sort, query, requestHeaders } = { requestHeaders: {} },
|
|
1697
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1584
1698
|
) {
|
|
1585
1699
|
const {
|
|
1586
1700
|
error,
|
|
1587
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1701
|
+
} = CommunicationPlatformApplicationValidator.getCommunicationLogs().validate(
|
|
1588
1702
|
{
|
|
1589
|
-
|
|
1703
|
+
pageId,
|
|
1590
1704
|
pageSize,
|
|
1591
|
-
|
|
1705
|
+
sort,
|
|
1706
|
+
query,
|
|
1592
1707
|
},
|
|
1593
1708
|
{ abortEarly: false, allowUnknown: true }
|
|
1594
1709
|
);
|
|
@@ -1599,44 +1714,46 @@ class Communication {
|
|
|
1599
1714
|
// Showing warrnings if extra unknown parameters are found
|
|
1600
1715
|
const {
|
|
1601
1716
|
error: warrning,
|
|
1602
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1717
|
+
} = CommunicationPlatformApplicationValidator.getCommunicationLogs().validate(
|
|
1603
1718
|
{
|
|
1604
|
-
|
|
1719
|
+
pageId,
|
|
1605
1720
|
pageSize,
|
|
1606
|
-
|
|
1721
|
+
sort,
|
|
1722
|
+
query,
|
|
1607
1723
|
},
|
|
1608
1724
|
{ abortEarly: false, allowUnknown: false }
|
|
1609
1725
|
);
|
|
1610
1726
|
if (warrning) {
|
|
1611
1727
|
Logger({
|
|
1612
1728
|
level: "WARN",
|
|
1613
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
1729
|
+
message: `Parameter Validation warrnings for platform > Communication > getCommunicationLogs \n ${warrning}`,
|
|
1614
1730
|
});
|
|
1615
1731
|
}
|
|
1616
1732
|
|
|
1617
1733
|
const query_params = {};
|
|
1618
|
-
query_params["
|
|
1734
|
+
query_params["page_id"] = pageId;
|
|
1619
1735
|
query_params["page_size"] = pageSize;
|
|
1620
|
-
query_params["
|
|
1736
|
+
query_params["sort"] = sort;
|
|
1737
|
+
query_params["query"] = query;
|
|
1621
1738
|
|
|
1622
1739
|
const response = await PlatformAPIClient.execute(
|
|
1623
1740
|
this.config,
|
|
1624
1741
|
"get",
|
|
1625
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1742
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/log`,
|
|
1626
1743
|
query_params,
|
|
1627
1744
|
undefined,
|
|
1628
|
-
|
|
1629
|
-
{
|
|
1745
|
+
requestHeaders,
|
|
1746
|
+
{ responseHeaders }
|
|
1630
1747
|
);
|
|
1631
1748
|
|
|
1632
1749
|
let responseData = response;
|
|
1633
|
-
if (
|
|
1750
|
+
if (responseHeaders) {
|
|
1634
1751
|
responseData = response[0];
|
|
1635
1752
|
}
|
|
1636
1753
|
|
|
1637
1754
|
const {
|
|
1638
1755
|
error: res_error,
|
|
1639
|
-
} = CommunicationPlatformModel.
|
|
1756
|
+
} = CommunicationPlatformModel.Logs().validate(responseData, {
|
|
1640
1757
|
abortEarly: false,
|
|
1641
1758
|
allowUnknown: false,
|
|
1642
1759
|
});
|
|
@@ -1644,7 +1761,7 @@ class Communication {
|
|
|
1644
1761
|
if (res_error) {
|
|
1645
1762
|
Logger({
|
|
1646
1763
|
level: "WARN",
|
|
1647
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
1764
|
+
message: `Response Validation Warnnings for platform > Communication > getCommunicationLogs \n ${res_error}`,
|
|
1648
1765
|
});
|
|
1649
1766
|
}
|
|
1650
1767
|
|
|
@@ -1656,28 +1773,31 @@ class Communication {
|
|
|
1656
1773
|
* @param {string} arg.companyId - Company id
|
|
1657
1774
|
* @param {string} arg.applicationId - Application id
|
|
1658
1775
|
* @param {number} [arg.pageSize] - Current request items count
|
|
1659
|
-
* @param {
|
|
1660
|
-
* @
|
|
1661
|
-
* @
|
|
1662
|
-
* @
|
|
1776
|
+
* @param {Object} [arg.sort] - To sort based on _id
|
|
1777
|
+
* @param {Object} [arg.query] -
|
|
1778
|
+
* @returns {Paginator<CommunicationPlatformModel.Logs>}
|
|
1779
|
+
* @summary: Get communication logs
|
|
1780
|
+
* @description: Get communication logs
|
|
1663
1781
|
*/
|
|
1664
|
-
|
|
1782
|
+
getCommunicationLogsPaginator({
|
|
1665
1783
|
companyId,
|
|
1666
1784
|
applicationId,
|
|
1667
1785
|
pageSize,
|
|
1668
|
-
|
|
1786
|
+
sort,
|
|
1787
|
+
query,
|
|
1669
1788
|
} = {}) {
|
|
1670
1789
|
const paginator = new Paginator();
|
|
1671
1790
|
const callback = async () => {
|
|
1672
1791
|
const pageId = paginator.nextId;
|
|
1673
1792
|
const pageNo = paginator.pageNo;
|
|
1674
|
-
const pageType = "
|
|
1675
|
-
const data = await this.
|
|
1793
|
+
const pageType = "cursor";
|
|
1794
|
+
const data = await this.getCommunicationLogs({
|
|
1676
1795
|
companyId: companyId,
|
|
1677
1796
|
applicationId: applicationId,
|
|
1678
|
-
|
|
1797
|
+
pageId: pageId,
|
|
1679
1798
|
pageSize: pageSize,
|
|
1680
|
-
|
|
1799
|
+
sort: sort,
|
|
1800
|
+
query: query,
|
|
1681
1801
|
});
|
|
1682
1802
|
paginator.setPaginator({
|
|
1683
1803
|
hasNext: data.page.has_next ? true : false,
|
|
@@ -1690,25 +1810,25 @@ class Communication {
|
|
|
1690
1810
|
}
|
|
1691
1811
|
|
|
1692
1812
|
/**
|
|
1693
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
1813
|
+
* @param {CommunicationPlatformApplicationValidator.GetDefaultSmsProvidersParam} arg
|
|
1814
|
+
* - Arg object
|
|
1815
|
+
*
|
|
1816
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1694
1817
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1695
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
1696
|
-
*
|
|
1697
|
-
* @
|
|
1698
|
-
* @
|
|
1818
|
+
* @returns {Promise<CommunicationPlatformModel.DefaultSmsProviders[]>} -
|
|
1819
|
+
* Success response
|
|
1820
|
+
* @name getDefaultSmsProviders
|
|
1821
|
+
* @summary: Get default sms providers
|
|
1822
|
+
* @description: Get default sms providers - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getDefaultSmsProviders/).
|
|
1699
1823
|
*/
|
|
1700
|
-
async
|
|
1701
|
-
{
|
|
1702
|
-
{
|
|
1824
|
+
async getDefaultSmsProviders(
|
|
1825
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
1826
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1703
1827
|
) {
|
|
1704
1828
|
const {
|
|
1705
1829
|
error,
|
|
1706
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1707
|
-
{
|
|
1708
|
-
pageNo,
|
|
1709
|
-
pageSize,
|
|
1710
|
-
sort,
|
|
1711
|
-
},
|
|
1830
|
+
} = CommunicationPlatformApplicationValidator.getDefaultSmsProviders().validate(
|
|
1831
|
+
{},
|
|
1712
1832
|
{ abortEarly: false, allowUnknown: true }
|
|
1713
1833
|
);
|
|
1714
1834
|
if (error) {
|
|
@@ -1718,52 +1838,42 @@ class Communication {
|
|
|
1718
1838
|
// Showing warrnings if extra unknown parameters are found
|
|
1719
1839
|
const {
|
|
1720
1840
|
error: warrning,
|
|
1721
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1722
|
-
{
|
|
1723
|
-
pageNo,
|
|
1724
|
-
pageSize,
|
|
1725
|
-
sort,
|
|
1726
|
-
},
|
|
1841
|
+
} = CommunicationPlatformApplicationValidator.getDefaultSmsProviders().validate(
|
|
1842
|
+
{},
|
|
1727
1843
|
{ abortEarly: false, allowUnknown: false }
|
|
1728
1844
|
);
|
|
1729
1845
|
if (warrning) {
|
|
1730
1846
|
Logger({
|
|
1731
1847
|
level: "WARN",
|
|
1732
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
1848
|
+
message: `Parameter Validation warrnings for platform > Communication > getDefaultSmsProviders \n ${warrning}`,
|
|
1733
1849
|
});
|
|
1734
1850
|
}
|
|
1735
1851
|
|
|
1736
1852
|
const query_params = {};
|
|
1737
|
-
query_params["page_no"] = pageNo;
|
|
1738
|
-
query_params["page_size"] = pageSize;
|
|
1739
|
-
query_params["sort"] = sort;
|
|
1740
1853
|
|
|
1741
1854
|
const response = await PlatformAPIClient.execute(
|
|
1742
1855
|
this.config,
|
|
1743
1856
|
"get",
|
|
1744
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1857
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/default-providers`,
|
|
1745
1858
|
query_params,
|
|
1746
1859
|
undefined,
|
|
1747
|
-
|
|
1748
|
-
{
|
|
1860
|
+
requestHeaders,
|
|
1861
|
+
{ responseHeaders }
|
|
1749
1862
|
);
|
|
1750
1863
|
|
|
1751
1864
|
let responseData = response;
|
|
1752
|
-
if (
|
|
1865
|
+
if (responseHeaders) {
|
|
1753
1866
|
responseData = response[0];
|
|
1754
1867
|
}
|
|
1755
1868
|
|
|
1756
|
-
const {
|
|
1757
|
-
|
|
1758
|
-
|
|
1759
|
-
abortEarly: false,
|
|
1760
|
-
allowUnknown: false,
|
|
1761
|
-
});
|
|
1869
|
+
const { error: res_error } = Joi.array()
|
|
1870
|
+
.items(CommunicationPlatformModel.DefaultSmsProviders())
|
|
1871
|
+
.validate(responseData, { abortEarly: false, allowUnknown: false });
|
|
1762
1872
|
|
|
1763
1873
|
if (res_error) {
|
|
1764
1874
|
Logger({
|
|
1765
1875
|
level: "WARN",
|
|
1766
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
1876
|
+
message: `Response Validation Warnnings for platform > Communication > getDefaultSmsProviders \n ${res_error}`,
|
|
1767
1877
|
});
|
|
1768
1878
|
}
|
|
1769
1879
|
|
|
@@ -1771,58 +1881,25 @@ class Communication {
|
|
|
1771
1881
|
}
|
|
1772
1882
|
|
|
1773
1883
|
/**
|
|
1774
|
-
* @param {
|
|
1775
|
-
*
|
|
1776
|
-
*
|
|
1777
|
-
* @param {
|
|
1778
|
-
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1779
|
-
* @returns {Paginator<CommunicationPlatformModel.JobLogs>}
|
|
1780
|
-
* @summary: Get job logs
|
|
1781
|
-
* @description: Get job logs
|
|
1782
|
-
*/
|
|
1783
|
-
getJobLogsPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
1784
|
-
const paginator = new Paginator();
|
|
1785
|
-
const callback = async () => {
|
|
1786
|
-
const pageId = paginator.nextId;
|
|
1787
|
-
const pageNo = paginator.pageNo;
|
|
1788
|
-
const pageType = "number";
|
|
1789
|
-
const data = await this.getJobLogs({
|
|
1790
|
-
companyId: companyId,
|
|
1791
|
-
applicationId: applicationId,
|
|
1792
|
-
pageNo: pageNo,
|
|
1793
|
-
pageSize: pageSize,
|
|
1794
|
-
sort: sort,
|
|
1795
|
-
});
|
|
1796
|
-
paginator.setPaginator({
|
|
1797
|
-
hasNext: data.page.has_next ? true : false,
|
|
1798
|
-
nextId: data.page.next_id,
|
|
1799
|
-
});
|
|
1800
|
-
return data;
|
|
1801
|
-
};
|
|
1802
|
-
paginator.setCallback(callback.bind(this));
|
|
1803
|
-
return paginator;
|
|
1804
|
-
}
|
|
1805
|
-
|
|
1806
|
-
/**
|
|
1807
|
-
* @param {CommunicationPlatformApplicationValidator.GetJobsParam} arg - Arg object
|
|
1884
|
+
* @param {CommunicationPlatformApplicationValidator.GetDummyDatasourcesParam} arg
|
|
1885
|
+
* - Arg object
|
|
1886
|
+
*
|
|
1887
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1808
1888
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1809
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
1810
|
-
*
|
|
1811
|
-
* @
|
|
1812
|
-
* @
|
|
1889
|
+
* @returns {Promise<CommunicationPlatformModel.DummyDatasources[]>} -
|
|
1890
|
+
* Success response
|
|
1891
|
+
* @name getDummyDatasources
|
|
1892
|
+
* @summary: Get dummy data sources
|
|
1893
|
+
* @description: Audience is used to import CSV files containing emails, phone numbers, and other variables in order to populate email/SMS templates for bulk delivery via a Campaign. Use this API to get dummy data sources. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getDummyDatasources/).
|
|
1813
1894
|
*/
|
|
1814
|
-
async
|
|
1815
|
-
{
|
|
1816
|
-
{
|
|
1895
|
+
async getDummyDatasources(
|
|
1896
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
1897
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1817
1898
|
) {
|
|
1818
1899
|
const {
|
|
1819
1900
|
error,
|
|
1820
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1821
|
-
{
|
|
1822
|
-
pageNo,
|
|
1823
|
-
pageSize,
|
|
1824
|
-
sort,
|
|
1825
|
-
},
|
|
1901
|
+
} = CommunicationPlatformApplicationValidator.getDummyDatasources().validate(
|
|
1902
|
+
{},
|
|
1826
1903
|
{ abortEarly: false, allowUnknown: true }
|
|
1827
1904
|
);
|
|
1828
1905
|
if (error) {
|
|
@@ -1832,44 +1909,1236 @@ class Communication {
|
|
|
1832
1909
|
// Showing warrnings if extra unknown parameters are found
|
|
1833
1910
|
const {
|
|
1834
1911
|
error: warrning,
|
|
1835
|
-
} = CommunicationPlatformApplicationValidator.
|
|
1836
|
-
{
|
|
1837
|
-
pageNo,
|
|
1838
|
-
pageSize,
|
|
1839
|
-
sort,
|
|
1840
|
-
},
|
|
1912
|
+
} = CommunicationPlatformApplicationValidator.getDummyDatasources().validate(
|
|
1913
|
+
{},
|
|
1841
1914
|
{ abortEarly: false, allowUnknown: false }
|
|
1842
1915
|
);
|
|
1843
1916
|
if (warrning) {
|
|
1844
1917
|
Logger({
|
|
1845
1918
|
level: "WARN",
|
|
1846
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
1919
|
+
message: `Parameter Validation warrnings for platform > Communication > getDummyDatasources \n ${warrning}`,
|
|
1847
1920
|
});
|
|
1848
1921
|
}
|
|
1849
1922
|
|
|
1850
1923
|
const query_params = {};
|
|
1851
|
-
query_params["page_no"] = pageNo;
|
|
1852
|
-
query_params["page_size"] = pageSize;
|
|
1853
|
-
query_params["sort"] = sort;
|
|
1854
1924
|
|
|
1855
1925
|
const response = await PlatformAPIClient.execute(
|
|
1856
1926
|
this.config,
|
|
1857
1927
|
"get",
|
|
1858
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
1928
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/dummy-data-sources`,
|
|
1929
|
+
query_params,
|
|
1930
|
+
undefined,
|
|
1931
|
+
requestHeaders,
|
|
1932
|
+
{ responseHeaders }
|
|
1933
|
+
);
|
|
1934
|
+
|
|
1935
|
+
let responseData = response;
|
|
1936
|
+
if (responseHeaders) {
|
|
1937
|
+
responseData = response[0];
|
|
1938
|
+
}
|
|
1939
|
+
|
|
1940
|
+
const { error: res_error } = Joi.array()
|
|
1941
|
+
.items(CommunicationPlatformModel.DummyDatasources())
|
|
1942
|
+
.validate(responseData, { abortEarly: false, allowUnknown: false });
|
|
1943
|
+
|
|
1944
|
+
if (res_error) {
|
|
1945
|
+
Logger({
|
|
1946
|
+
level: "WARN",
|
|
1947
|
+
message: `Response Validation Warnnings for platform > Communication > getDummyDatasources \n ${res_error}`,
|
|
1948
|
+
});
|
|
1949
|
+
}
|
|
1950
|
+
|
|
1951
|
+
return response;
|
|
1952
|
+
}
|
|
1953
|
+
|
|
1954
|
+
/**
|
|
1955
|
+
* @param {CommunicationPlatformApplicationValidator.GetDummyDatasourcesMetaParam} arg
|
|
1956
|
+
* - Arg object
|
|
1957
|
+
*
|
|
1958
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1959
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1960
|
+
* @returns {Promise<CommunicationPlatformModel.DummyDatasourcesMeta>} -
|
|
1961
|
+
* Success response
|
|
1962
|
+
* @name getDummyDatasourcesMeta
|
|
1963
|
+
* @summary: Get dummy data sources meta
|
|
1964
|
+
* @description: Audience is used to import CSV files containing emails, phone numbers, and other variables in order to populate email/SMS templates for bulk delivery via a Campaign. Use this API to get dummy data sources meta. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getDummyDatasourcesMeta/).
|
|
1965
|
+
*/
|
|
1966
|
+
async getDummyDatasourcesMeta(
|
|
1967
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
1968
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1969
|
+
) {
|
|
1970
|
+
const {
|
|
1971
|
+
error,
|
|
1972
|
+
} = CommunicationPlatformApplicationValidator.getDummyDatasourcesMeta().validate(
|
|
1973
|
+
{
|
|
1974
|
+
id,
|
|
1975
|
+
},
|
|
1976
|
+
{ abortEarly: false, allowUnknown: true }
|
|
1977
|
+
);
|
|
1978
|
+
if (error) {
|
|
1979
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
1980
|
+
}
|
|
1981
|
+
|
|
1982
|
+
// Showing warrnings if extra unknown parameters are found
|
|
1983
|
+
const {
|
|
1984
|
+
error: warrning,
|
|
1985
|
+
} = CommunicationPlatformApplicationValidator.getDummyDatasourcesMeta().validate(
|
|
1986
|
+
{
|
|
1987
|
+
id,
|
|
1988
|
+
},
|
|
1989
|
+
{ abortEarly: false, allowUnknown: false }
|
|
1990
|
+
);
|
|
1991
|
+
if (warrning) {
|
|
1992
|
+
Logger({
|
|
1993
|
+
level: "WARN",
|
|
1994
|
+
message: `Parameter Validation warrnings for platform > Communication > getDummyDatasourcesMeta \n ${warrning}`,
|
|
1995
|
+
});
|
|
1996
|
+
}
|
|
1997
|
+
|
|
1998
|
+
const query_params = {};
|
|
1999
|
+
|
|
2000
|
+
const response = await PlatformAPIClient.execute(
|
|
2001
|
+
this.config,
|
|
2002
|
+
"get",
|
|
2003
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/dummy-data-sources-meta/${id}`,
|
|
2004
|
+
query_params,
|
|
2005
|
+
undefined,
|
|
2006
|
+
requestHeaders,
|
|
2007
|
+
{ responseHeaders }
|
|
2008
|
+
);
|
|
2009
|
+
|
|
2010
|
+
let responseData = response;
|
|
2011
|
+
if (responseHeaders) {
|
|
2012
|
+
responseData = response[0];
|
|
2013
|
+
}
|
|
2014
|
+
|
|
2015
|
+
const {
|
|
2016
|
+
error: res_error,
|
|
2017
|
+
} = CommunicationPlatformModel.DummyDatasourcesMeta().validate(
|
|
2018
|
+
responseData,
|
|
2019
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2020
|
+
);
|
|
2021
|
+
|
|
2022
|
+
if (res_error) {
|
|
2023
|
+
Logger({
|
|
2024
|
+
level: "WARN",
|
|
2025
|
+
message: `Response Validation Warnnings for platform > Communication > getDummyDatasourcesMeta \n ${res_error}`,
|
|
2026
|
+
});
|
|
2027
|
+
}
|
|
2028
|
+
|
|
2029
|
+
return response;
|
|
2030
|
+
}
|
|
2031
|
+
|
|
2032
|
+
/**
|
|
2033
|
+
* @param {CommunicationPlatformApplicationValidator.GetEmailProviderByIdParam} arg
|
|
2034
|
+
* - Arg object
|
|
2035
|
+
*
|
|
2036
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2037
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2038
|
+
* @returns {Promise<CommunicationPlatformModel.EmailProvider>} - Success response
|
|
2039
|
+
* @name getEmailProviderById
|
|
2040
|
+
* @summary: Get email provider by id
|
|
2041
|
+
* @description: Get email provider by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getEmailProviderById/).
|
|
2042
|
+
*/
|
|
2043
|
+
async getEmailProviderById(
|
|
2044
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
2045
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2046
|
+
) {
|
|
2047
|
+
const {
|
|
2048
|
+
error,
|
|
2049
|
+
} = CommunicationPlatformApplicationValidator.getEmailProviderById().validate(
|
|
2050
|
+
{
|
|
2051
|
+
id,
|
|
2052
|
+
},
|
|
2053
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2054
|
+
);
|
|
2055
|
+
if (error) {
|
|
2056
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2057
|
+
}
|
|
2058
|
+
|
|
2059
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2060
|
+
const {
|
|
2061
|
+
error: warrning,
|
|
2062
|
+
} = CommunicationPlatformApplicationValidator.getEmailProviderById().validate(
|
|
2063
|
+
{
|
|
2064
|
+
id,
|
|
2065
|
+
},
|
|
2066
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2067
|
+
);
|
|
2068
|
+
if (warrning) {
|
|
2069
|
+
Logger({
|
|
2070
|
+
level: "WARN",
|
|
2071
|
+
message: `Parameter Validation warrnings for platform > Communication > getEmailProviderById \n ${warrning}`,
|
|
2072
|
+
});
|
|
2073
|
+
}
|
|
2074
|
+
|
|
2075
|
+
const query_params = {};
|
|
2076
|
+
|
|
2077
|
+
const response = await PlatformAPIClient.execute(
|
|
2078
|
+
this.config,
|
|
2079
|
+
"get",
|
|
2080
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers/${id}`,
|
|
2081
|
+
query_params,
|
|
2082
|
+
undefined,
|
|
2083
|
+
requestHeaders,
|
|
2084
|
+
{ responseHeaders }
|
|
2085
|
+
);
|
|
2086
|
+
|
|
2087
|
+
let responseData = response;
|
|
2088
|
+
if (responseHeaders) {
|
|
2089
|
+
responseData = response[0];
|
|
2090
|
+
}
|
|
2091
|
+
|
|
2092
|
+
const {
|
|
2093
|
+
error: res_error,
|
|
2094
|
+
} = CommunicationPlatformModel.EmailProvider().validate(responseData, {
|
|
2095
|
+
abortEarly: false,
|
|
2096
|
+
allowUnknown: false,
|
|
2097
|
+
});
|
|
2098
|
+
|
|
2099
|
+
if (res_error) {
|
|
2100
|
+
Logger({
|
|
2101
|
+
level: "WARN",
|
|
2102
|
+
message: `Response Validation Warnnings for platform > Communication > getEmailProviderById \n ${res_error}`,
|
|
2103
|
+
});
|
|
2104
|
+
}
|
|
2105
|
+
|
|
2106
|
+
return response;
|
|
2107
|
+
}
|
|
2108
|
+
|
|
2109
|
+
/**
|
|
2110
|
+
* @param {CommunicationPlatformApplicationValidator.GetEmailProvidersParam} arg
|
|
2111
|
+
* - Arg object
|
|
2112
|
+
*
|
|
2113
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2114
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2115
|
+
* @returns {Promise<CommunicationPlatformModel.EmailProviders>} - Success response
|
|
2116
|
+
* @name getEmailProviders
|
|
2117
|
+
* @summary: Get email providers
|
|
2118
|
+
* @description: Get email providers - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getEmailProviders/).
|
|
2119
|
+
*/
|
|
2120
|
+
async getEmailProviders(
|
|
2121
|
+
{ pageNo, pageSize, sort, requestHeaders } = { requestHeaders: {} },
|
|
2122
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2123
|
+
) {
|
|
2124
|
+
const {
|
|
2125
|
+
error,
|
|
2126
|
+
} = CommunicationPlatformApplicationValidator.getEmailProviders().validate(
|
|
2127
|
+
{
|
|
2128
|
+
pageNo,
|
|
2129
|
+
pageSize,
|
|
2130
|
+
sort,
|
|
2131
|
+
},
|
|
2132
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2133
|
+
);
|
|
2134
|
+
if (error) {
|
|
2135
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2136
|
+
}
|
|
2137
|
+
|
|
2138
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2139
|
+
const {
|
|
2140
|
+
error: warrning,
|
|
2141
|
+
} = CommunicationPlatformApplicationValidator.getEmailProviders().validate(
|
|
2142
|
+
{
|
|
2143
|
+
pageNo,
|
|
2144
|
+
pageSize,
|
|
2145
|
+
sort,
|
|
2146
|
+
},
|
|
2147
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2148
|
+
);
|
|
2149
|
+
if (warrning) {
|
|
2150
|
+
Logger({
|
|
2151
|
+
level: "WARN",
|
|
2152
|
+
message: `Parameter Validation warrnings for platform > Communication > getEmailProviders \n ${warrning}`,
|
|
2153
|
+
});
|
|
2154
|
+
}
|
|
2155
|
+
|
|
2156
|
+
const query_params = {};
|
|
2157
|
+
query_params["page_no"] = pageNo;
|
|
2158
|
+
query_params["page_size"] = pageSize;
|
|
2159
|
+
query_params["sort"] = sort;
|
|
2160
|
+
|
|
2161
|
+
const response = await PlatformAPIClient.execute(
|
|
2162
|
+
this.config,
|
|
2163
|
+
"get",
|
|
2164
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers`,
|
|
2165
|
+
query_params,
|
|
2166
|
+
undefined,
|
|
2167
|
+
requestHeaders,
|
|
2168
|
+
{ responseHeaders }
|
|
2169
|
+
);
|
|
2170
|
+
|
|
2171
|
+
let responseData = response;
|
|
2172
|
+
if (responseHeaders) {
|
|
2173
|
+
responseData = response[0];
|
|
2174
|
+
}
|
|
2175
|
+
|
|
2176
|
+
const {
|
|
2177
|
+
error: res_error,
|
|
2178
|
+
} = CommunicationPlatformModel.EmailProviders().validate(responseData, {
|
|
2179
|
+
abortEarly: false,
|
|
2180
|
+
allowUnknown: false,
|
|
2181
|
+
});
|
|
2182
|
+
|
|
2183
|
+
if (res_error) {
|
|
2184
|
+
Logger({
|
|
2185
|
+
level: "WARN",
|
|
2186
|
+
message: `Response Validation Warnnings for platform > Communication > getEmailProviders \n ${res_error}`,
|
|
2187
|
+
});
|
|
2188
|
+
}
|
|
2189
|
+
|
|
2190
|
+
return response;
|
|
2191
|
+
}
|
|
2192
|
+
|
|
2193
|
+
/**
|
|
2194
|
+
* @param {Object} arg - Arg object.
|
|
2195
|
+
* @param {string} arg.companyId - Company id
|
|
2196
|
+
* @param {string} arg.applicationId - Application id
|
|
2197
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
2198
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2199
|
+
* @returns {Paginator<CommunicationPlatformModel.EmailProviders>}
|
|
2200
|
+
* @summary: Get email providers
|
|
2201
|
+
* @description: Get email providers
|
|
2202
|
+
*/
|
|
2203
|
+
getEmailProvidersPaginator({
|
|
2204
|
+
companyId,
|
|
2205
|
+
applicationId,
|
|
2206
|
+
pageSize,
|
|
2207
|
+
sort,
|
|
2208
|
+
} = {}) {
|
|
2209
|
+
const paginator = new Paginator();
|
|
2210
|
+
const callback = async () => {
|
|
2211
|
+
const pageId = paginator.nextId;
|
|
2212
|
+
const pageNo = paginator.pageNo;
|
|
2213
|
+
const pageType = "number";
|
|
2214
|
+
const data = await this.getEmailProviders({
|
|
2215
|
+
companyId: companyId,
|
|
2216
|
+
applicationId: applicationId,
|
|
2217
|
+
pageNo: pageNo,
|
|
2218
|
+
pageSize: pageSize,
|
|
2219
|
+
sort: sort,
|
|
2220
|
+
});
|
|
2221
|
+
paginator.setPaginator({
|
|
2222
|
+
hasNext: data.page.has_next ? true : false,
|
|
2223
|
+
nextId: data.page.next_id,
|
|
2224
|
+
});
|
|
2225
|
+
return data;
|
|
2226
|
+
};
|
|
2227
|
+
paginator.setCallback(callback.bind(this));
|
|
2228
|
+
return paginator;
|
|
2229
|
+
}
|
|
2230
|
+
|
|
2231
|
+
/**
|
|
2232
|
+
* @param {CommunicationPlatformApplicationValidator.GetEmailTemplateByIdParam} arg
|
|
2233
|
+
* - Arg object
|
|
2234
|
+
*
|
|
2235
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2236
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2237
|
+
* @returns {Promise<CommunicationPlatformModel.EmailTemplate>} - Success response
|
|
2238
|
+
* @name getEmailTemplateById
|
|
2239
|
+
* @summary: Get email template by id
|
|
2240
|
+
* @description: Email templates are predefined formats linked to various events for delivering messages to users. Use this API to get an email template by id. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getEmailTemplateById/).
|
|
2241
|
+
*/
|
|
2242
|
+
async getEmailTemplateById(
|
|
2243
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
2244
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2245
|
+
) {
|
|
2246
|
+
const {
|
|
2247
|
+
error,
|
|
2248
|
+
} = CommunicationPlatformApplicationValidator.getEmailTemplateById().validate(
|
|
2249
|
+
{
|
|
2250
|
+
id,
|
|
2251
|
+
},
|
|
2252
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2253
|
+
);
|
|
2254
|
+
if (error) {
|
|
2255
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2256
|
+
}
|
|
2257
|
+
|
|
2258
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2259
|
+
const {
|
|
2260
|
+
error: warrning,
|
|
2261
|
+
} = CommunicationPlatformApplicationValidator.getEmailTemplateById().validate(
|
|
2262
|
+
{
|
|
2263
|
+
id,
|
|
2264
|
+
},
|
|
2265
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2266
|
+
);
|
|
2267
|
+
if (warrning) {
|
|
2268
|
+
Logger({
|
|
2269
|
+
level: "WARN",
|
|
2270
|
+
message: `Parameter Validation warrnings for platform > Communication > getEmailTemplateById \n ${warrning}`,
|
|
2271
|
+
});
|
|
2272
|
+
}
|
|
2273
|
+
|
|
2274
|
+
const query_params = {};
|
|
2275
|
+
|
|
2276
|
+
const response = await PlatformAPIClient.execute(
|
|
2277
|
+
this.config,
|
|
2278
|
+
"get",
|
|
2279
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
|
|
2280
|
+
query_params,
|
|
2281
|
+
undefined,
|
|
2282
|
+
requestHeaders,
|
|
2283
|
+
{ responseHeaders }
|
|
2284
|
+
);
|
|
2285
|
+
|
|
2286
|
+
let responseData = response;
|
|
2287
|
+
if (responseHeaders) {
|
|
2288
|
+
responseData = response[0];
|
|
2289
|
+
}
|
|
2290
|
+
|
|
2291
|
+
const {
|
|
2292
|
+
error: res_error,
|
|
2293
|
+
} = CommunicationPlatformModel.EmailTemplate().validate(responseData, {
|
|
2294
|
+
abortEarly: false,
|
|
2295
|
+
allowUnknown: false,
|
|
2296
|
+
});
|
|
2297
|
+
|
|
2298
|
+
if (res_error) {
|
|
2299
|
+
Logger({
|
|
2300
|
+
level: "WARN",
|
|
2301
|
+
message: `Response Validation Warnnings for platform > Communication > getEmailTemplateById \n ${res_error}`,
|
|
2302
|
+
});
|
|
2303
|
+
}
|
|
2304
|
+
|
|
2305
|
+
return response;
|
|
2306
|
+
}
|
|
2307
|
+
|
|
2308
|
+
/**
|
|
2309
|
+
* @param {CommunicationPlatformApplicationValidator.GetEmailTemplatesParam} arg
|
|
2310
|
+
* - Arg object
|
|
2311
|
+
*
|
|
2312
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2313
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2314
|
+
* @returns {Promise<CommunicationPlatformModel.EmailTemplates>} - Success response
|
|
2315
|
+
* @name getEmailTemplates
|
|
2316
|
+
* @summary: Get email templates
|
|
2317
|
+
* @description: Email templates are predefined formats linked to various events for delivering messages to users. Use this API to get all email templates. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getEmailTemplates/).
|
|
2318
|
+
*/
|
|
2319
|
+
async getEmailTemplates(
|
|
2320
|
+
{ pageNo, pageSize, sort, requestHeaders } = { requestHeaders: {} },
|
|
2321
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2322
|
+
) {
|
|
2323
|
+
const {
|
|
2324
|
+
error,
|
|
2325
|
+
} = CommunicationPlatformApplicationValidator.getEmailTemplates().validate(
|
|
2326
|
+
{
|
|
2327
|
+
pageNo,
|
|
2328
|
+
pageSize,
|
|
2329
|
+
sort,
|
|
2330
|
+
},
|
|
2331
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2332
|
+
);
|
|
2333
|
+
if (error) {
|
|
2334
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2335
|
+
}
|
|
2336
|
+
|
|
2337
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2338
|
+
const {
|
|
2339
|
+
error: warrning,
|
|
2340
|
+
} = CommunicationPlatformApplicationValidator.getEmailTemplates().validate(
|
|
2341
|
+
{
|
|
2342
|
+
pageNo,
|
|
2343
|
+
pageSize,
|
|
2344
|
+
sort,
|
|
2345
|
+
},
|
|
2346
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2347
|
+
);
|
|
2348
|
+
if (warrning) {
|
|
2349
|
+
Logger({
|
|
2350
|
+
level: "WARN",
|
|
2351
|
+
message: `Parameter Validation warrnings for platform > Communication > getEmailTemplates \n ${warrning}`,
|
|
2352
|
+
});
|
|
2353
|
+
}
|
|
2354
|
+
|
|
2355
|
+
const query_params = {};
|
|
2356
|
+
query_params["page_no"] = pageNo;
|
|
2357
|
+
query_params["page_size"] = pageSize;
|
|
2358
|
+
query_params["sort"] = sort;
|
|
2359
|
+
|
|
2360
|
+
const response = await PlatformAPIClient.execute(
|
|
2361
|
+
this.config,
|
|
2362
|
+
"get",
|
|
2363
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates`,
|
|
2364
|
+
query_params,
|
|
2365
|
+
undefined,
|
|
2366
|
+
requestHeaders,
|
|
2367
|
+
{ responseHeaders }
|
|
2368
|
+
);
|
|
2369
|
+
|
|
2370
|
+
let responseData = response;
|
|
2371
|
+
if (responseHeaders) {
|
|
2372
|
+
responseData = response[0];
|
|
2373
|
+
}
|
|
2374
|
+
|
|
2375
|
+
const {
|
|
2376
|
+
error: res_error,
|
|
2377
|
+
} = CommunicationPlatformModel.EmailTemplates().validate(responseData, {
|
|
2378
|
+
abortEarly: false,
|
|
2379
|
+
allowUnknown: false,
|
|
2380
|
+
});
|
|
2381
|
+
|
|
2382
|
+
if (res_error) {
|
|
2383
|
+
Logger({
|
|
2384
|
+
level: "WARN",
|
|
2385
|
+
message: `Response Validation Warnnings for platform > Communication > getEmailTemplates \n ${res_error}`,
|
|
2386
|
+
});
|
|
2387
|
+
}
|
|
2388
|
+
|
|
2389
|
+
return response;
|
|
2390
|
+
}
|
|
2391
|
+
|
|
2392
|
+
/**
|
|
2393
|
+
* @param {Object} arg - Arg object.
|
|
2394
|
+
* @param {string} arg.companyId - Company id
|
|
2395
|
+
* @param {string} arg.applicationId - Application id
|
|
2396
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
2397
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2398
|
+
* @returns {Paginator<CommunicationPlatformModel.EmailTemplates>}
|
|
2399
|
+
* @summary: Get email templates
|
|
2400
|
+
* @description: Email templates are predefined formats linked to various events for delivering messages to users. Use this API to get all email templates.
|
|
2401
|
+
*/
|
|
2402
|
+
getEmailTemplatesPaginator({
|
|
2403
|
+
companyId,
|
|
2404
|
+
applicationId,
|
|
2405
|
+
pageSize,
|
|
2406
|
+
sort,
|
|
2407
|
+
} = {}) {
|
|
2408
|
+
const paginator = new Paginator();
|
|
2409
|
+
const callback = async () => {
|
|
2410
|
+
const pageId = paginator.nextId;
|
|
2411
|
+
const pageNo = paginator.pageNo;
|
|
2412
|
+
const pageType = "number";
|
|
2413
|
+
const data = await this.getEmailTemplates({
|
|
2414
|
+
companyId: companyId,
|
|
2415
|
+
applicationId: applicationId,
|
|
2416
|
+
pageNo: pageNo,
|
|
2417
|
+
pageSize: pageSize,
|
|
2418
|
+
sort: sort,
|
|
2419
|
+
});
|
|
2420
|
+
paginator.setPaginator({
|
|
2421
|
+
hasNext: data.page.has_next ? true : false,
|
|
2422
|
+
nextId: data.page.next_id,
|
|
2423
|
+
});
|
|
2424
|
+
return data;
|
|
2425
|
+
};
|
|
2426
|
+
paginator.setCallback(callback.bind(this));
|
|
2427
|
+
return paginator;
|
|
2428
|
+
}
|
|
2429
|
+
|
|
2430
|
+
/**
|
|
2431
|
+
* @param {CommunicationPlatformApplicationValidator.GetEventSubscriptionsParam} arg
|
|
2432
|
+
* - Arg object
|
|
2433
|
+
*
|
|
2434
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2435
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2436
|
+
* @returns {Promise<CommunicationPlatformModel.EventSubscriptions>} -
|
|
2437
|
+
* Success response
|
|
2438
|
+
* @name getEventSubscriptions
|
|
2439
|
+
* @summary: Get event subscriptions
|
|
2440
|
+
* @description: Get event subscriptions - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getEventSubscriptions/).
|
|
2441
|
+
*/
|
|
2442
|
+
async getEventSubscriptions(
|
|
2443
|
+
{ pageNo, pageSize, populate, requestHeaders } = { requestHeaders: {} },
|
|
2444
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2445
|
+
) {
|
|
2446
|
+
const {
|
|
2447
|
+
error,
|
|
2448
|
+
} = CommunicationPlatformApplicationValidator.getEventSubscriptions().validate(
|
|
2449
|
+
{
|
|
2450
|
+
pageNo,
|
|
2451
|
+
pageSize,
|
|
2452
|
+
populate,
|
|
2453
|
+
},
|
|
2454
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2455
|
+
);
|
|
2456
|
+
if (error) {
|
|
2457
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2458
|
+
}
|
|
2459
|
+
|
|
2460
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2461
|
+
const {
|
|
2462
|
+
error: warrning,
|
|
2463
|
+
} = CommunicationPlatformApplicationValidator.getEventSubscriptions().validate(
|
|
2464
|
+
{
|
|
2465
|
+
pageNo,
|
|
2466
|
+
pageSize,
|
|
2467
|
+
populate,
|
|
2468
|
+
},
|
|
2469
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2470
|
+
);
|
|
2471
|
+
if (warrning) {
|
|
2472
|
+
Logger({
|
|
2473
|
+
level: "WARN",
|
|
2474
|
+
message: `Parameter Validation warrnings for platform > Communication > getEventSubscriptions \n ${warrning}`,
|
|
2475
|
+
});
|
|
2476
|
+
}
|
|
2477
|
+
|
|
2478
|
+
const query_params = {};
|
|
2479
|
+
query_params["page_no"] = pageNo;
|
|
2480
|
+
query_params["page_size"] = pageSize;
|
|
2481
|
+
query_params["populate"] = populate;
|
|
2482
|
+
|
|
2483
|
+
const response = await PlatformAPIClient.execute(
|
|
2484
|
+
this.config,
|
|
2485
|
+
"get",
|
|
2486
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/event/event-subscriptions`,
|
|
2487
|
+
query_params,
|
|
2488
|
+
undefined,
|
|
2489
|
+
requestHeaders,
|
|
2490
|
+
{ responseHeaders }
|
|
2491
|
+
);
|
|
2492
|
+
|
|
2493
|
+
let responseData = response;
|
|
2494
|
+
if (responseHeaders) {
|
|
2495
|
+
responseData = response[0];
|
|
2496
|
+
}
|
|
2497
|
+
|
|
2498
|
+
const {
|
|
2499
|
+
error: res_error,
|
|
2500
|
+
} = CommunicationPlatformModel.EventSubscriptions().validate(responseData, {
|
|
2501
|
+
abortEarly: false,
|
|
2502
|
+
allowUnknown: false,
|
|
2503
|
+
});
|
|
2504
|
+
|
|
2505
|
+
if (res_error) {
|
|
2506
|
+
Logger({
|
|
2507
|
+
level: "WARN",
|
|
2508
|
+
message: `Response Validation Warnnings for platform > Communication > getEventSubscriptions \n ${res_error}`,
|
|
2509
|
+
});
|
|
2510
|
+
}
|
|
2511
|
+
|
|
2512
|
+
return response;
|
|
2513
|
+
}
|
|
2514
|
+
|
|
2515
|
+
/**
|
|
2516
|
+
* @param {Object} arg - Arg object.
|
|
2517
|
+
* @param {string} arg.companyId - Company id
|
|
2518
|
+
* @param {string} arg.applicationId - Application id
|
|
2519
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
2520
|
+
* @param {string} [arg.populate] - Populate fields
|
|
2521
|
+
* @returns {Paginator<CommunicationPlatformModel.EventSubscriptions>}
|
|
2522
|
+
* @summary: Get event subscriptions
|
|
2523
|
+
* @description: Get event subscriptions
|
|
2524
|
+
*/
|
|
2525
|
+
getEventSubscriptionsPaginator({
|
|
2526
|
+
companyId,
|
|
2527
|
+
applicationId,
|
|
2528
|
+
pageSize,
|
|
2529
|
+
populate,
|
|
2530
|
+
} = {}) {
|
|
2531
|
+
const paginator = new Paginator();
|
|
2532
|
+
const callback = async () => {
|
|
2533
|
+
const pageId = paginator.nextId;
|
|
2534
|
+
const pageNo = paginator.pageNo;
|
|
2535
|
+
const pageType = "number";
|
|
2536
|
+
const data = await this.getEventSubscriptions({
|
|
2537
|
+
companyId: companyId,
|
|
2538
|
+
applicationId: applicationId,
|
|
2539
|
+
pageNo: pageNo,
|
|
2540
|
+
pageSize: pageSize,
|
|
2541
|
+
populate: populate,
|
|
2542
|
+
});
|
|
2543
|
+
paginator.setPaginator({
|
|
2544
|
+
hasNext: data.page.has_next ? true : false,
|
|
2545
|
+
nextId: data.page.next_id,
|
|
2546
|
+
});
|
|
2547
|
+
return data;
|
|
2548
|
+
};
|
|
2549
|
+
paginator.setCallback(callback.bind(this));
|
|
2550
|
+
return paginator;
|
|
2551
|
+
}
|
|
2552
|
+
|
|
2553
|
+
/**
|
|
2554
|
+
* @param {CommunicationPlatformApplicationValidator.GetGlobalProvidersParam} arg
|
|
2555
|
+
* - Arg object
|
|
2556
|
+
*
|
|
2557
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2558
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2559
|
+
* @returns {Promise<CommunicationPlatformModel.GlobalProviders>} - Success response
|
|
2560
|
+
* @name getGlobalProviders
|
|
2561
|
+
* @summary: Get global providers
|
|
2562
|
+
* @description: Using this API, will retrieve a list of global providers. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getGlobalProviders/).
|
|
2563
|
+
*/
|
|
2564
|
+
async getGlobalProviders(
|
|
2565
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
2566
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2567
|
+
) {
|
|
2568
|
+
const {
|
|
2569
|
+
error,
|
|
2570
|
+
} = CommunicationPlatformApplicationValidator.getGlobalProviders().validate(
|
|
2571
|
+
{},
|
|
2572
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2573
|
+
);
|
|
2574
|
+
if (error) {
|
|
2575
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2576
|
+
}
|
|
2577
|
+
|
|
2578
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2579
|
+
const {
|
|
2580
|
+
error: warrning,
|
|
2581
|
+
} = CommunicationPlatformApplicationValidator.getGlobalProviders().validate(
|
|
2582
|
+
{},
|
|
2583
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2584
|
+
);
|
|
2585
|
+
if (warrning) {
|
|
2586
|
+
Logger({
|
|
2587
|
+
level: "WARN",
|
|
2588
|
+
message: `Parameter Validation warrnings for platform > Communication > getGlobalProviders \n ${warrning}`,
|
|
2589
|
+
});
|
|
2590
|
+
}
|
|
2591
|
+
|
|
2592
|
+
const query_params = {};
|
|
2593
|
+
|
|
2594
|
+
const response = await PlatformAPIClient.execute(
|
|
2595
|
+
this.config,
|
|
2596
|
+
"get",
|
|
2597
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/app-provider/global-providers`,
|
|
2598
|
+
query_params,
|
|
2599
|
+
undefined,
|
|
2600
|
+
requestHeaders,
|
|
2601
|
+
{ responseHeaders }
|
|
2602
|
+
);
|
|
2603
|
+
|
|
2604
|
+
let responseData = response;
|
|
2605
|
+
if (responseHeaders) {
|
|
2606
|
+
responseData = response[0];
|
|
2607
|
+
}
|
|
2608
|
+
|
|
2609
|
+
const {
|
|
2610
|
+
error: res_error,
|
|
2611
|
+
} = CommunicationPlatformModel.GlobalProviders().validate(responseData, {
|
|
2612
|
+
abortEarly: false,
|
|
2613
|
+
allowUnknown: false,
|
|
2614
|
+
});
|
|
2615
|
+
|
|
2616
|
+
if (res_error) {
|
|
2617
|
+
Logger({
|
|
2618
|
+
level: "WARN",
|
|
2619
|
+
message: `Response Validation Warnnings for platform > Communication > getGlobalProviders \n ${res_error}`,
|
|
2620
|
+
});
|
|
2621
|
+
}
|
|
2622
|
+
|
|
2623
|
+
return response;
|
|
2624
|
+
}
|
|
2625
|
+
|
|
2626
|
+
/**
|
|
2627
|
+
* @param {CommunicationPlatformApplicationValidator.GetGlobalVariablesParam} arg
|
|
2628
|
+
* - Arg object
|
|
2629
|
+
*
|
|
2630
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2631
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2632
|
+
* @returns {Promise<CommunicationPlatformModel.GlobalVariablesGetResponse>}
|
|
2633
|
+
* - Success response
|
|
2634
|
+
*
|
|
2635
|
+
* @name getGlobalVariables
|
|
2636
|
+
* @summary: get global variables
|
|
2637
|
+
* @description: get global variables - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getGlobalVariables/).
|
|
2638
|
+
*/
|
|
2639
|
+
async getGlobalVariables(
|
|
2640
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
2641
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2642
|
+
) {
|
|
2643
|
+
const {
|
|
2644
|
+
error,
|
|
2645
|
+
} = CommunicationPlatformApplicationValidator.getGlobalVariables().validate(
|
|
2646
|
+
{},
|
|
2647
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2648
|
+
);
|
|
2649
|
+
if (error) {
|
|
2650
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2651
|
+
}
|
|
2652
|
+
|
|
2653
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2654
|
+
const {
|
|
2655
|
+
error: warrning,
|
|
2656
|
+
} = CommunicationPlatformApplicationValidator.getGlobalVariables().validate(
|
|
2657
|
+
{},
|
|
2658
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2659
|
+
);
|
|
2660
|
+
if (warrning) {
|
|
2661
|
+
Logger({
|
|
2662
|
+
level: "WARN",
|
|
2663
|
+
message: `Parameter Validation warrnings for platform > Communication > getGlobalVariables \n ${warrning}`,
|
|
2664
|
+
});
|
|
2665
|
+
}
|
|
2666
|
+
|
|
2667
|
+
const query_params = {};
|
|
2668
|
+
|
|
2669
|
+
const response = await PlatformAPIClient.execute(
|
|
2670
|
+
this.config,
|
|
2671
|
+
"get",
|
|
2672
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/global-variables`,
|
|
2673
|
+
query_params,
|
|
2674
|
+
undefined,
|
|
2675
|
+
requestHeaders,
|
|
2676
|
+
{ responseHeaders }
|
|
2677
|
+
);
|
|
2678
|
+
|
|
2679
|
+
let responseData = response;
|
|
2680
|
+
if (responseHeaders) {
|
|
2681
|
+
responseData = response[0];
|
|
2682
|
+
}
|
|
2683
|
+
|
|
2684
|
+
const {
|
|
2685
|
+
error: res_error,
|
|
2686
|
+
} = CommunicationPlatformModel.GlobalVariablesGetResponse().validate(
|
|
2687
|
+
responseData,
|
|
2688
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2689
|
+
);
|
|
2690
|
+
|
|
2691
|
+
if (res_error) {
|
|
2692
|
+
Logger({
|
|
2693
|
+
level: "WARN",
|
|
2694
|
+
message: `Response Validation Warnnings for platform > Communication > getGlobalVariables \n ${res_error}`,
|
|
2695
|
+
});
|
|
2696
|
+
}
|
|
2697
|
+
|
|
2698
|
+
return response;
|
|
2699
|
+
}
|
|
2700
|
+
|
|
2701
|
+
/**
|
|
2702
|
+
* @param {CommunicationPlatformApplicationValidator.GetJobLogsParam} arg - Arg object
|
|
2703
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2704
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2705
|
+
* @returns {Promise<CommunicationPlatformModel.JobLogs>} - Success response
|
|
2706
|
+
* @name getJobLogs
|
|
2707
|
+
* @summary: Get job logs
|
|
2708
|
+
* @description: Get job logs - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getJobLogs/).
|
|
2709
|
+
*/
|
|
2710
|
+
async getJobLogs(
|
|
2711
|
+
{ pageNo, pageSize, sort, requestHeaders } = { requestHeaders: {} },
|
|
2712
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2713
|
+
) {
|
|
2714
|
+
const {
|
|
2715
|
+
error,
|
|
2716
|
+
} = CommunicationPlatformApplicationValidator.getJobLogs().validate(
|
|
2717
|
+
{
|
|
2718
|
+
pageNo,
|
|
2719
|
+
pageSize,
|
|
2720
|
+
sort,
|
|
2721
|
+
},
|
|
2722
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2723
|
+
);
|
|
2724
|
+
if (error) {
|
|
2725
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2726
|
+
}
|
|
2727
|
+
|
|
2728
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2729
|
+
const {
|
|
2730
|
+
error: warrning,
|
|
2731
|
+
} = CommunicationPlatformApplicationValidator.getJobLogs().validate(
|
|
2732
|
+
{
|
|
2733
|
+
pageNo,
|
|
2734
|
+
pageSize,
|
|
2735
|
+
sort,
|
|
2736
|
+
},
|
|
2737
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2738
|
+
);
|
|
2739
|
+
if (warrning) {
|
|
2740
|
+
Logger({
|
|
2741
|
+
level: "WARN",
|
|
2742
|
+
message: `Parameter Validation warrnings for platform > Communication > getJobLogs \n ${warrning}`,
|
|
2743
|
+
});
|
|
2744
|
+
}
|
|
2745
|
+
|
|
2746
|
+
const query_params = {};
|
|
2747
|
+
query_params["page_no"] = pageNo;
|
|
2748
|
+
query_params["page_size"] = pageSize;
|
|
2749
|
+
query_params["sort"] = sort;
|
|
2750
|
+
|
|
2751
|
+
const response = await PlatformAPIClient.execute(
|
|
2752
|
+
this.config,
|
|
2753
|
+
"get",
|
|
2754
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/logs`,
|
|
2755
|
+
query_params,
|
|
2756
|
+
undefined,
|
|
2757
|
+
requestHeaders,
|
|
2758
|
+
{ responseHeaders }
|
|
2759
|
+
);
|
|
2760
|
+
|
|
2761
|
+
let responseData = response;
|
|
2762
|
+
if (responseHeaders) {
|
|
2763
|
+
responseData = response[0];
|
|
2764
|
+
}
|
|
2765
|
+
|
|
2766
|
+
const {
|
|
2767
|
+
error: res_error,
|
|
2768
|
+
} = CommunicationPlatformModel.JobLogs().validate(responseData, {
|
|
2769
|
+
abortEarly: false,
|
|
2770
|
+
allowUnknown: false,
|
|
2771
|
+
});
|
|
2772
|
+
|
|
2773
|
+
if (res_error) {
|
|
2774
|
+
Logger({
|
|
2775
|
+
level: "WARN",
|
|
2776
|
+
message: `Response Validation Warnnings for platform > Communication > getJobLogs \n ${res_error}`,
|
|
2777
|
+
});
|
|
2778
|
+
}
|
|
2779
|
+
|
|
2780
|
+
return response;
|
|
2781
|
+
}
|
|
2782
|
+
|
|
2783
|
+
/**
|
|
2784
|
+
* @param {Object} arg - Arg object.
|
|
2785
|
+
* @param {string} arg.companyId - Company id
|
|
2786
|
+
* @param {string} arg.applicationId - Application id
|
|
2787
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
2788
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2789
|
+
* @returns {Paginator<CommunicationPlatformModel.JobLogs>}
|
|
2790
|
+
* @summary: Get job logs
|
|
2791
|
+
* @description: Get job logs
|
|
2792
|
+
*/
|
|
2793
|
+
getJobLogsPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
2794
|
+
const paginator = new Paginator();
|
|
2795
|
+
const callback = async () => {
|
|
2796
|
+
const pageId = paginator.nextId;
|
|
2797
|
+
const pageNo = paginator.pageNo;
|
|
2798
|
+
const pageType = "number";
|
|
2799
|
+
const data = await this.getJobLogs({
|
|
2800
|
+
companyId: companyId,
|
|
2801
|
+
applicationId: applicationId,
|
|
2802
|
+
pageNo: pageNo,
|
|
2803
|
+
pageSize: pageSize,
|
|
2804
|
+
sort: sort,
|
|
2805
|
+
});
|
|
2806
|
+
paginator.setPaginator({
|
|
2807
|
+
hasNext: data.page.has_next ? true : false,
|
|
2808
|
+
nextId: data.page.next_id,
|
|
2809
|
+
});
|
|
2810
|
+
return data;
|
|
2811
|
+
};
|
|
2812
|
+
paginator.setCallback(callback.bind(this));
|
|
2813
|
+
return paginator;
|
|
2814
|
+
}
|
|
2815
|
+
|
|
2816
|
+
/**
|
|
2817
|
+
* @param {CommunicationPlatformApplicationValidator.GetJobsParam} arg - Arg object
|
|
2818
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2819
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2820
|
+
* @returns {Promise<CommunicationPlatformModel.Jobs>} - Success response
|
|
2821
|
+
* @name getJobs
|
|
2822
|
+
* @summary: Get jobs
|
|
2823
|
+
* @description: Get jobs - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getJobs/).
|
|
2824
|
+
*/
|
|
2825
|
+
async getJobs(
|
|
2826
|
+
{ pageNo, pageSize, sort, requestHeaders } = { requestHeaders: {} },
|
|
2827
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2828
|
+
) {
|
|
2829
|
+
const {
|
|
2830
|
+
error,
|
|
2831
|
+
} = CommunicationPlatformApplicationValidator.getJobs().validate(
|
|
2832
|
+
{
|
|
2833
|
+
pageNo,
|
|
2834
|
+
pageSize,
|
|
2835
|
+
sort,
|
|
2836
|
+
},
|
|
2837
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2838
|
+
);
|
|
2839
|
+
if (error) {
|
|
2840
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2841
|
+
}
|
|
2842
|
+
|
|
2843
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2844
|
+
const {
|
|
2845
|
+
error: warrning,
|
|
2846
|
+
} = CommunicationPlatformApplicationValidator.getJobs().validate(
|
|
2847
|
+
{
|
|
2848
|
+
pageNo,
|
|
2849
|
+
pageSize,
|
|
2850
|
+
sort,
|
|
2851
|
+
},
|
|
2852
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2853
|
+
);
|
|
2854
|
+
if (warrning) {
|
|
2855
|
+
Logger({
|
|
2856
|
+
level: "WARN",
|
|
2857
|
+
message: `Parameter Validation warrnings for platform > Communication > getJobs \n ${warrning}`,
|
|
2858
|
+
});
|
|
2859
|
+
}
|
|
2860
|
+
|
|
2861
|
+
const query_params = {};
|
|
2862
|
+
query_params["page_no"] = pageNo;
|
|
2863
|
+
query_params["page_size"] = pageSize;
|
|
2864
|
+
query_params["sort"] = sort;
|
|
2865
|
+
|
|
2866
|
+
const response = await PlatformAPIClient.execute(
|
|
2867
|
+
this.config,
|
|
2868
|
+
"get",
|
|
2869
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/jobs`,
|
|
2870
|
+
query_params,
|
|
2871
|
+
undefined,
|
|
2872
|
+
requestHeaders,
|
|
2873
|
+
{ responseHeaders }
|
|
2874
|
+
);
|
|
2875
|
+
|
|
2876
|
+
let responseData = response;
|
|
2877
|
+
if (responseHeaders) {
|
|
2878
|
+
responseData = response[0];
|
|
2879
|
+
}
|
|
2880
|
+
|
|
2881
|
+
const {
|
|
2882
|
+
error: res_error,
|
|
2883
|
+
} = CommunicationPlatformModel.Jobs().validate(responseData, {
|
|
2884
|
+
abortEarly: false,
|
|
2885
|
+
allowUnknown: false,
|
|
2886
|
+
});
|
|
2887
|
+
|
|
2888
|
+
if (res_error) {
|
|
2889
|
+
Logger({
|
|
2890
|
+
level: "WARN",
|
|
2891
|
+
message: `Response Validation Warnnings for platform > Communication > getJobs \n ${res_error}`,
|
|
2892
|
+
});
|
|
2893
|
+
}
|
|
2894
|
+
|
|
2895
|
+
return response;
|
|
2896
|
+
}
|
|
2897
|
+
|
|
2898
|
+
/**
|
|
2899
|
+
* @param {Object} arg - Arg object.
|
|
2900
|
+
* @param {string} arg.companyId - Company id
|
|
2901
|
+
* @param {string} arg.applicationId - Application id
|
|
2902
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
2903
|
+
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2904
|
+
* @returns {Paginator<CommunicationPlatformModel.Jobs>}
|
|
2905
|
+
* @summary: Get jobs
|
|
2906
|
+
* @description: Get jobs
|
|
2907
|
+
*/
|
|
2908
|
+
getJobsPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
2909
|
+
const paginator = new Paginator();
|
|
2910
|
+
const callback = async () => {
|
|
2911
|
+
const pageId = paginator.nextId;
|
|
2912
|
+
const pageNo = paginator.pageNo;
|
|
2913
|
+
const pageType = "number";
|
|
2914
|
+
const data = await this.getJobs({
|
|
2915
|
+
companyId: companyId,
|
|
2916
|
+
applicationId: applicationId,
|
|
2917
|
+
pageNo: pageNo,
|
|
2918
|
+
pageSize: pageSize,
|
|
2919
|
+
sort: sort,
|
|
2920
|
+
});
|
|
2921
|
+
paginator.setPaginator({
|
|
2922
|
+
hasNext: data.page.has_next ? true : false,
|
|
2923
|
+
nextId: data.page.next_id,
|
|
2924
|
+
});
|
|
2925
|
+
return data;
|
|
2926
|
+
};
|
|
2927
|
+
paginator.setCallback(callback.bind(this));
|
|
2928
|
+
return paginator;
|
|
2929
|
+
}
|
|
2930
|
+
|
|
2931
|
+
/**
|
|
2932
|
+
* @param {CommunicationPlatformApplicationValidator.GetNSampleRecordsFromCsvParam} arg
|
|
2933
|
+
* - Arg object
|
|
2934
|
+
*
|
|
2935
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2936
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2937
|
+
* @returns {Promise<CommunicationPlatformModel.GetNRecordsCsvRes>} - Success response
|
|
2938
|
+
* @name getNSampleRecordsFromCsv
|
|
2939
|
+
* @summary: Get n sample records from csv
|
|
2940
|
+
* @description: Audience is used to import CSV files containing emails, phone numbers, and other variables in order to populate email/SMS templates for bulk delivery via a Campaign. Use this API to get n sample records from csv - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getNSampleRecordsFromCsv/).
|
|
2941
|
+
*/
|
|
2942
|
+
async getNSampleRecordsFromCsv(
|
|
2943
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
2944
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2945
|
+
) {
|
|
2946
|
+
const {
|
|
2947
|
+
error,
|
|
2948
|
+
} = CommunicationPlatformApplicationValidator.getNSampleRecordsFromCsv().validate(
|
|
2949
|
+
{
|
|
2950
|
+
body,
|
|
2951
|
+
},
|
|
2952
|
+
{ abortEarly: false, allowUnknown: true }
|
|
2953
|
+
);
|
|
2954
|
+
if (error) {
|
|
2955
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
2956
|
+
}
|
|
2957
|
+
|
|
2958
|
+
// Showing warrnings if extra unknown parameters are found
|
|
2959
|
+
const {
|
|
2960
|
+
error: warrning,
|
|
2961
|
+
} = CommunicationPlatformApplicationValidator.getNSampleRecordsFromCsv().validate(
|
|
2962
|
+
{
|
|
2963
|
+
body,
|
|
2964
|
+
},
|
|
2965
|
+
{ abortEarly: false, allowUnknown: false }
|
|
2966
|
+
);
|
|
2967
|
+
if (warrning) {
|
|
2968
|
+
Logger({
|
|
2969
|
+
level: "WARN",
|
|
2970
|
+
message: `Parameter Validation warrnings for platform > Communication > getNSampleRecordsFromCsv \n ${warrning}`,
|
|
2971
|
+
});
|
|
2972
|
+
}
|
|
2973
|
+
|
|
2974
|
+
const query_params = {};
|
|
2975
|
+
|
|
2976
|
+
const response = await PlatformAPIClient.execute(
|
|
2977
|
+
this.config,
|
|
2978
|
+
"post",
|
|
2979
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/get-n-records`,
|
|
2980
|
+
query_params,
|
|
2981
|
+
body,
|
|
2982
|
+
requestHeaders,
|
|
2983
|
+
{ responseHeaders }
|
|
2984
|
+
);
|
|
2985
|
+
|
|
2986
|
+
let responseData = response;
|
|
2987
|
+
if (responseHeaders) {
|
|
2988
|
+
responseData = response[0];
|
|
2989
|
+
}
|
|
2990
|
+
|
|
2991
|
+
const {
|
|
2992
|
+
error: res_error,
|
|
2993
|
+
} = CommunicationPlatformModel.GetNRecordsCsvRes().validate(responseData, {
|
|
2994
|
+
abortEarly: false,
|
|
2995
|
+
allowUnknown: false,
|
|
2996
|
+
});
|
|
2997
|
+
|
|
2998
|
+
if (res_error) {
|
|
2999
|
+
Logger({
|
|
3000
|
+
level: "WARN",
|
|
3001
|
+
message: `Response Validation Warnnings for platform > Communication > getNSampleRecordsFromCsv \n ${res_error}`,
|
|
3002
|
+
});
|
|
3003
|
+
}
|
|
3004
|
+
|
|
3005
|
+
return response;
|
|
3006
|
+
}
|
|
3007
|
+
|
|
3008
|
+
/**
|
|
3009
|
+
* @param {CommunicationPlatformApplicationValidator.GetNSampleRecordsFromCsvByGetParam} arg
|
|
3010
|
+
* - Arg object
|
|
3011
|
+
*
|
|
3012
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
3013
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
3014
|
+
* @returns {Promise<CommunicationPlatformModel.GetNRecordsCsvRes>} - Success response
|
|
3015
|
+
* @name getNSampleRecordsFromCsvByGet
|
|
3016
|
+
* @summary: Get n sample records from csv
|
|
3017
|
+
* @description: Audience is used to import CSV files containing emails, phone numbers, and other variables in order to populate email/SMS templates for bulk delivery via a Campaign. Use this API to get n sample records from csv. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getNSampleRecordsFromCsvByGet/).
|
|
3018
|
+
*/
|
|
3019
|
+
async getNSampleRecordsFromCsvByGet(
|
|
3020
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
3021
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3022
|
+
) {
|
|
3023
|
+
const {
|
|
3024
|
+
error,
|
|
3025
|
+
} = CommunicationPlatformApplicationValidator.getNSampleRecordsFromCsvByGet().validate(
|
|
3026
|
+
{},
|
|
3027
|
+
{ abortEarly: false, allowUnknown: true }
|
|
3028
|
+
);
|
|
3029
|
+
if (error) {
|
|
3030
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
3031
|
+
}
|
|
3032
|
+
|
|
3033
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3034
|
+
const {
|
|
3035
|
+
error: warrning,
|
|
3036
|
+
} = CommunicationPlatformApplicationValidator.getNSampleRecordsFromCsvByGet().validate(
|
|
3037
|
+
{},
|
|
3038
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3039
|
+
);
|
|
3040
|
+
if (warrning) {
|
|
3041
|
+
Logger({
|
|
3042
|
+
level: "WARN",
|
|
3043
|
+
message: `Parameter Validation warrnings for platform > Communication > getNSampleRecordsFromCsvByGet \n ${warrning}`,
|
|
3044
|
+
});
|
|
3045
|
+
}
|
|
3046
|
+
|
|
3047
|
+
const query_params = {};
|
|
3048
|
+
|
|
3049
|
+
const response = await PlatformAPIClient.execute(
|
|
3050
|
+
this.config,
|
|
3051
|
+
"get",
|
|
3052
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/get-n-records`,
|
|
3053
|
+
query_params,
|
|
3054
|
+
undefined,
|
|
3055
|
+
requestHeaders,
|
|
3056
|
+
{ responseHeaders }
|
|
3057
|
+
);
|
|
3058
|
+
|
|
3059
|
+
let responseData = response;
|
|
3060
|
+
if (responseHeaders) {
|
|
3061
|
+
responseData = response[0];
|
|
3062
|
+
}
|
|
3063
|
+
|
|
3064
|
+
const {
|
|
3065
|
+
error: res_error,
|
|
3066
|
+
} = CommunicationPlatformModel.GetNRecordsCsvRes().validate(responseData, {
|
|
3067
|
+
abortEarly: false,
|
|
3068
|
+
allowUnknown: false,
|
|
3069
|
+
});
|
|
3070
|
+
|
|
3071
|
+
if (res_error) {
|
|
3072
|
+
Logger({
|
|
3073
|
+
level: "WARN",
|
|
3074
|
+
message: `Response Validation Warnnings for platform > Communication > getNSampleRecordsFromCsvByGet \n ${res_error}`,
|
|
3075
|
+
});
|
|
3076
|
+
}
|
|
3077
|
+
|
|
3078
|
+
return response;
|
|
3079
|
+
}
|
|
3080
|
+
|
|
3081
|
+
/**
|
|
3082
|
+
* @param {CommunicationPlatformApplicationValidator.GetSmsProviderByIdParam} arg
|
|
3083
|
+
* - Arg object
|
|
3084
|
+
*
|
|
3085
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
3086
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
3087
|
+
* @returns {Promise<Object>} - Success response
|
|
3088
|
+
* @name getSmsProviderById
|
|
3089
|
+
* @summary: Get sms provider by id
|
|
3090
|
+
* @description: Get sms provider by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getSmsProviderById/).
|
|
3091
|
+
*/
|
|
3092
|
+
async getSmsProviderById(
|
|
3093
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
3094
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3095
|
+
) {
|
|
3096
|
+
const {
|
|
3097
|
+
error,
|
|
3098
|
+
} = CommunicationPlatformApplicationValidator.getSmsProviderById().validate(
|
|
3099
|
+
{
|
|
3100
|
+
id,
|
|
3101
|
+
},
|
|
3102
|
+
{ abortEarly: false, allowUnknown: true }
|
|
3103
|
+
);
|
|
3104
|
+
if (error) {
|
|
3105
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
3106
|
+
}
|
|
3107
|
+
|
|
3108
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3109
|
+
const {
|
|
3110
|
+
error: warrning,
|
|
3111
|
+
} = CommunicationPlatformApplicationValidator.getSmsProviderById().validate(
|
|
3112
|
+
{
|
|
3113
|
+
id,
|
|
3114
|
+
},
|
|
3115
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3116
|
+
);
|
|
3117
|
+
if (warrning) {
|
|
3118
|
+
Logger({
|
|
3119
|
+
level: "WARN",
|
|
3120
|
+
message: `Parameter Validation warrnings for platform > Communication > getSmsProviderById \n ${warrning}`,
|
|
3121
|
+
});
|
|
3122
|
+
}
|
|
3123
|
+
|
|
3124
|
+
const query_params = {};
|
|
3125
|
+
|
|
3126
|
+
const response = await PlatformAPIClient.execute(
|
|
3127
|
+
this.config,
|
|
3128
|
+
"get",
|
|
3129
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers/${id}`,
|
|
1859
3130
|
query_params,
|
|
1860
3131
|
undefined,
|
|
1861
|
-
|
|
1862
|
-
{
|
|
3132
|
+
requestHeaders,
|
|
3133
|
+
{ responseHeaders }
|
|
1863
3134
|
);
|
|
1864
3135
|
|
|
1865
3136
|
let responseData = response;
|
|
1866
|
-
if (
|
|
3137
|
+
if (responseHeaders) {
|
|
1867
3138
|
responseData = response[0];
|
|
1868
3139
|
}
|
|
1869
3140
|
|
|
1870
|
-
const {
|
|
1871
|
-
error: res_error,
|
|
1872
|
-
} = CommunicationPlatformModel.Jobs().validate(responseData, {
|
|
3141
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
1873
3142
|
abortEarly: false,
|
|
1874
3143
|
allowUnknown: false,
|
|
1875
3144
|
});
|
|
@@ -1877,7 +3146,7 @@ class Communication {
|
|
|
1877
3146
|
if (res_error) {
|
|
1878
3147
|
Logger({
|
|
1879
3148
|
level: "WARN",
|
|
1880
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
3149
|
+
message: `Response Validation Warnnings for platform > Communication > getSmsProviderById \n ${res_error}`,
|
|
1881
3150
|
});
|
|
1882
3151
|
}
|
|
1883
3152
|
|
|
@@ -1885,57 +3154,27 @@ class Communication {
|
|
|
1885
3154
|
}
|
|
1886
3155
|
|
|
1887
3156
|
/**
|
|
1888
|
-
* @param {
|
|
1889
|
-
* @param {string} arg.companyId - Company id
|
|
1890
|
-
* @param {string} arg.applicationId - Application id
|
|
1891
|
-
* @param {number} [arg.pageSize] - Current request items count
|
|
1892
|
-
* @param {Object} [arg.sort] - To sort based on created_at
|
|
1893
|
-
* @returns {Paginator<CommunicationPlatformModel.Jobs>}
|
|
1894
|
-
* @summary: Get jobs
|
|
1895
|
-
* @description: Get jobs
|
|
1896
|
-
*/
|
|
1897
|
-
getJobsPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
1898
|
-
const paginator = new Paginator();
|
|
1899
|
-
const callback = async () => {
|
|
1900
|
-
const pageId = paginator.nextId;
|
|
1901
|
-
const pageNo = paginator.pageNo;
|
|
1902
|
-
const pageType = "number";
|
|
1903
|
-
const data = await this.getJobs({
|
|
1904
|
-
companyId: companyId,
|
|
1905
|
-
applicationId: applicationId,
|
|
1906
|
-
pageNo: pageNo,
|
|
1907
|
-
pageSize: pageSize,
|
|
1908
|
-
sort: sort,
|
|
1909
|
-
});
|
|
1910
|
-
paginator.setPaginator({
|
|
1911
|
-
hasNext: data.page.has_next ? true : false,
|
|
1912
|
-
nextId: data.page.next_id,
|
|
1913
|
-
});
|
|
1914
|
-
return data;
|
|
1915
|
-
};
|
|
1916
|
-
paginator.setCallback(callback.bind(this));
|
|
1917
|
-
return paginator;
|
|
1918
|
-
}
|
|
1919
|
-
|
|
1920
|
-
/**
|
|
1921
|
-
* @param {CommunicationPlatformApplicationValidator.GetNSampleRecordsFromCsvParam} arg
|
|
3157
|
+
* @param {CommunicationPlatformApplicationValidator.GetSmsProvidersParam} arg
|
|
1922
3158
|
* - Arg object
|
|
1923
3159
|
*
|
|
3160
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
1924
3161
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
1925
|
-
* @returns {Promise<
|
|
1926
|
-
* @name
|
|
1927
|
-
* @summary: Get
|
|
1928
|
-
* @description: Get
|
|
3162
|
+
* @returns {Promise<Object>} - Success response
|
|
3163
|
+
* @name getSmsProviders
|
|
3164
|
+
* @summary: Get sms providers
|
|
3165
|
+
* @description: Get sms providers - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getSmsProviders/).
|
|
1929
3166
|
*/
|
|
1930
|
-
async
|
|
1931
|
-
{
|
|
1932
|
-
{
|
|
3167
|
+
async getSmsProviders(
|
|
3168
|
+
{ pageNo, pageSize, sort, requestHeaders } = { requestHeaders: {} },
|
|
3169
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
1933
3170
|
) {
|
|
1934
3171
|
const {
|
|
1935
3172
|
error,
|
|
1936
|
-
} = CommunicationPlatformApplicationValidator.
|
|
3173
|
+
} = CommunicationPlatformApplicationValidator.getSmsProviders().validate(
|
|
1937
3174
|
{
|
|
1938
|
-
|
|
3175
|
+
pageNo,
|
|
3176
|
+
pageSize,
|
|
3177
|
+
sort,
|
|
1939
3178
|
},
|
|
1940
3179
|
{ abortEarly: false, allowUnknown: true }
|
|
1941
3180
|
);
|
|
@@ -1946,39 +3185,42 @@ class Communication {
|
|
|
1946
3185
|
// Showing warrnings if extra unknown parameters are found
|
|
1947
3186
|
const {
|
|
1948
3187
|
error: warrning,
|
|
1949
|
-
} = CommunicationPlatformApplicationValidator.
|
|
3188
|
+
} = CommunicationPlatformApplicationValidator.getSmsProviders().validate(
|
|
1950
3189
|
{
|
|
1951
|
-
|
|
3190
|
+
pageNo,
|
|
3191
|
+
pageSize,
|
|
3192
|
+
sort,
|
|
1952
3193
|
},
|
|
1953
3194
|
{ abortEarly: false, allowUnknown: false }
|
|
1954
3195
|
);
|
|
1955
3196
|
if (warrning) {
|
|
1956
3197
|
Logger({
|
|
1957
3198
|
level: "WARN",
|
|
1958
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
3199
|
+
message: `Parameter Validation warrnings for platform > Communication > getSmsProviders \n ${warrning}`,
|
|
1959
3200
|
});
|
|
1960
3201
|
}
|
|
1961
3202
|
|
|
1962
3203
|
const query_params = {};
|
|
3204
|
+
query_params["page_no"] = pageNo;
|
|
3205
|
+
query_params["page_size"] = pageSize;
|
|
3206
|
+
query_params["sort"] = sort;
|
|
1963
3207
|
|
|
1964
3208
|
const response = await PlatformAPIClient.execute(
|
|
1965
3209
|
this.config,
|
|
1966
|
-
"
|
|
1967
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
3210
|
+
"get",
|
|
3211
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers`,
|
|
1968
3212
|
query_params,
|
|
1969
|
-
body,
|
|
1970
3213
|
undefined,
|
|
1971
|
-
|
|
3214
|
+
requestHeaders,
|
|
3215
|
+
{ responseHeaders }
|
|
1972
3216
|
);
|
|
1973
3217
|
|
|
1974
3218
|
let responseData = response;
|
|
1975
|
-
if (
|
|
3219
|
+
if (responseHeaders) {
|
|
1976
3220
|
responseData = response[0];
|
|
1977
3221
|
}
|
|
1978
3222
|
|
|
1979
|
-
const {
|
|
1980
|
-
error: res_error,
|
|
1981
|
-
} = CommunicationPlatformModel.GetNRecordsCsvRes().validate(responseData, {
|
|
3223
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
1982
3224
|
abortEarly: false,
|
|
1983
3225
|
allowUnknown: false,
|
|
1984
3226
|
});
|
|
@@ -1986,7 +3228,7 @@ class Communication {
|
|
|
1986
3228
|
if (res_error) {
|
|
1987
3229
|
Logger({
|
|
1988
3230
|
level: "WARN",
|
|
1989
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
3231
|
+
message: `Response Validation Warnnings for platform > Communication > getSmsProviders \n ${res_error}`,
|
|
1990
3232
|
});
|
|
1991
3233
|
}
|
|
1992
3234
|
|
|
@@ -1994,19 +3236,23 @@ class Communication {
|
|
|
1994
3236
|
}
|
|
1995
3237
|
|
|
1996
3238
|
/**
|
|
1997
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
3239
|
+
* @param {CommunicationPlatformApplicationValidator.GetSmsTemplateByIdParam} arg
|
|
1998
3240
|
* - Arg object
|
|
1999
3241
|
*
|
|
3242
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2000
3243
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2001
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
2002
|
-
* @name
|
|
2003
|
-
* @summary: Get sms
|
|
2004
|
-
* @description:
|
|
3244
|
+
* @returns {Promise<CommunicationPlatformModel.SmsTemplate>} - Success response
|
|
3245
|
+
* @name getSmsTemplateById
|
|
3246
|
+
* @summary: Get sms template by id
|
|
3247
|
+
* @description: SMS templates are predefined message formats linked to various events for delivering messages to users. Use this API to get an sms template by ID. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getSmsTemplateById/).
|
|
2005
3248
|
*/
|
|
2006
|
-
async
|
|
3249
|
+
async getSmsTemplateById(
|
|
3250
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
3251
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3252
|
+
) {
|
|
2007
3253
|
const {
|
|
2008
3254
|
error,
|
|
2009
|
-
} = CommunicationPlatformApplicationValidator.
|
|
3255
|
+
} = CommunicationPlatformApplicationValidator.getSmsTemplateById().validate(
|
|
2010
3256
|
{
|
|
2011
3257
|
id,
|
|
2012
3258
|
},
|
|
@@ -2019,7 +3265,7 @@ class Communication {
|
|
|
2019
3265
|
// Showing warrnings if extra unknown parameters are found
|
|
2020
3266
|
const {
|
|
2021
3267
|
error: warrning,
|
|
2022
|
-
} = CommunicationPlatformApplicationValidator.
|
|
3268
|
+
} = CommunicationPlatformApplicationValidator.getSmsTemplateById().validate(
|
|
2023
3269
|
{
|
|
2024
3270
|
id,
|
|
2025
3271
|
},
|
|
@@ -2028,7 +3274,7 @@ class Communication {
|
|
|
2028
3274
|
if (warrning) {
|
|
2029
3275
|
Logger({
|
|
2030
3276
|
level: "WARN",
|
|
2031
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
3277
|
+
message: `Parameter Validation warrnings for platform > Communication > getSmsTemplateById \n ${warrning}`,
|
|
2032
3278
|
});
|
|
2033
3279
|
}
|
|
2034
3280
|
|
|
@@ -2037,21 +3283,21 @@ class Communication {
|
|
|
2037
3283
|
const response = await PlatformAPIClient.execute(
|
|
2038
3284
|
this.config,
|
|
2039
3285
|
"get",
|
|
2040
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/
|
|
3286
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
|
|
2041
3287
|
query_params,
|
|
2042
3288
|
undefined,
|
|
2043
|
-
|
|
2044
|
-
{
|
|
3289
|
+
requestHeaders,
|
|
3290
|
+
{ responseHeaders }
|
|
2045
3291
|
);
|
|
2046
3292
|
|
|
2047
3293
|
let responseData = response;
|
|
2048
|
-
if (
|
|
3294
|
+
if (responseHeaders) {
|
|
2049
3295
|
responseData = response[0];
|
|
2050
3296
|
}
|
|
2051
3297
|
|
|
2052
3298
|
const {
|
|
2053
3299
|
error: res_error,
|
|
2054
|
-
} = CommunicationPlatformModel.
|
|
3300
|
+
} = CommunicationPlatformModel.SmsTemplate().validate(responseData, {
|
|
2055
3301
|
abortEarly: false,
|
|
2056
3302
|
allowUnknown: false,
|
|
2057
3303
|
});
|
|
@@ -2059,7 +3305,7 @@ class Communication {
|
|
|
2059
3305
|
if (res_error) {
|
|
2060
3306
|
Logger({
|
|
2061
3307
|
level: "WARN",
|
|
2062
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
3308
|
+
message: `Response Validation Warnnings for platform > Communication > getSmsTemplateById \n ${res_error}`,
|
|
2063
3309
|
});
|
|
2064
3310
|
}
|
|
2065
3311
|
|
|
@@ -2067,22 +3313,23 @@ class Communication {
|
|
|
2067
3313
|
}
|
|
2068
3314
|
|
|
2069
3315
|
/**
|
|
2070
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
3316
|
+
* @param {CommunicationPlatformApplicationValidator.GetSmsTemplatesParam} arg
|
|
2071
3317
|
* - Arg object
|
|
2072
3318
|
*
|
|
3319
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2073
3320
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2074
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
2075
|
-
* @name
|
|
2076
|
-
* @summary: Get sms
|
|
2077
|
-
* @description:
|
|
3321
|
+
* @returns {Promise<CommunicationPlatformModel.SmsTemplates>} - Success response
|
|
3322
|
+
* @name getSmsTemplates
|
|
3323
|
+
* @summary: Get sms templates
|
|
3324
|
+
* @description: SMS templates are predefined message formats linked to various events for delivering messages to users. Use this API to get all sms templates. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getSmsTemplates/).
|
|
2078
3325
|
*/
|
|
2079
|
-
async
|
|
2080
|
-
{ pageNo, pageSize, sort } = {},
|
|
2081
|
-
{
|
|
3326
|
+
async getSmsTemplates(
|
|
3327
|
+
{ pageNo, pageSize, sort, requestHeaders } = { requestHeaders: {} },
|
|
3328
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2082
3329
|
) {
|
|
2083
3330
|
const {
|
|
2084
3331
|
error,
|
|
2085
|
-
} = CommunicationPlatformApplicationValidator.
|
|
3332
|
+
} = CommunicationPlatformApplicationValidator.getSmsTemplates().validate(
|
|
2086
3333
|
{
|
|
2087
3334
|
pageNo,
|
|
2088
3335
|
pageSize,
|
|
@@ -2097,7 +3344,7 @@ class Communication {
|
|
|
2097
3344
|
// Showing warrnings if extra unknown parameters are found
|
|
2098
3345
|
const {
|
|
2099
3346
|
error: warrning,
|
|
2100
|
-
} = CommunicationPlatformApplicationValidator.
|
|
3347
|
+
} = CommunicationPlatformApplicationValidator.getSmsTemplates().validate(
|
|
2101
3348
|
{
|
|
2102
3349
|
pageNo,
|
|
2103
3350
|
pageSize,
|
|
@@ -2108,7 +3355,7 @@ class Communication {
|
|
|
2108
3355
|
if (warrning) {
|
|
2109
3356
|
Logger({
|
|
2110
3357
|
level: "WARN",
|
|
2111
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
3358
|
+
message: `Parameter Validation warrnings for platform > Communication > getSmsTemplates \n ${warrning}`,
|
|
2112
3359
|
});
|
|
2113
3360
|
}
|
|
2114
3361
|
|
|
@@ -2120,21 +3367,21 @@ class Communication {
|
|
|
2120
3367
|
const response = await PlatformAPIClient.execute(
|
|
2121
3368
|
this.config,
|
|
2122
3369
|
"get",
|
|
2123
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/
|
|
3370
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates`,
|
|
2124
3371
|
query_params,
|
|
2125
3372
|
undefined,
|
|
2126
|
-
|
|
2127
|
-
{
|
|
3373
|
+
requestHeaders,
|
|
3374
|
+
{ responseHeaders }
|
|
2128
3375
|
);
|
|
2129
3376
|
|
|
2130
3377
|
let responseData = response;
|
|
2131
|
-
if (
|
|
3378
|
+
if (responseHeaders) {
|
|
2132
3379
|
responseData = response[0];
|
|
2133
3380
|
}
|
|
2134
3381
|
|
|
2135
3382
|
const {
|
|
2136
3383
|
error: res_error,
|
|
2137
|
-
} = CommunicationPlatformModel.
|
|
3384
|
+
} = CommunicationPlatformModel.SmsTemplates().validate(responseData, {
|
|
2138
3385
|
abortEarly: false,
|
|
2139
3386
|
allowUnknown: false,
|
|
2140
3387
|
});
|
|
@@ -2142,7 +3389,7 @@ class Communication {
|
|
|
2142
3389
|
if (res_error) {
|
|
2143
3390
|
Logger({
|
|
2144
3391
|
level: "WARN",
|
|
2145
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
3392
|
+
message: `Response Validation Warnnings for platform > Communication > getSmsTemplates \n ${res_error}`,
|
|
2146
3393
|
});
|
|
2147
3394
|
}
|
|
2148
3395
|
|
|
@@ -2155,17 +3402,17 @@ class Communication {
|
|
|
2155
3402
|
* @param {string} arg.applicationId - Application id
|
|
2156
3403
|
* @param {number} [arg.pageSize] - Current request items count
|
|
2157
3404
|
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2158
|
-
* @returns {Paginator<CommunicationPlatformModel.
|
|
2159
|
-
* @summary: Get sms
|
|
2160
|
-
* @description:
|
|
3405
|
+
* @returns {Paginator<CommunicationPlatformModel.SmsTemplates>}
|
|
3406
|
+
* @summary: Get sms templates
|
|
3407
|
+
* @description: SMS templates are predefined message formats linked to various events for delivering messages to users. Use this API to get all sms templates.
|
|
2161
3408
|
*/
|
|
2162
|
-
|
|
3409
|
+
getSmsTemplatesPaginator({ companyId, applicationId, pageSize, sort } = {}) {
|
|
2163
3410
|
const paginator = new Paginator();
|
|
2164
3411
|
const callback = async () => {
|
|
2165
3412
|
const pageId = paginator.nextId;
|
|
2166
3413
|
const pageNo = paginator.pageNo;
|
|
2167
3414
|
const pageType = "number";
|
|
2168
|
-
const data = await this.
|
|
3415
|
+
const data = await this.getSmsTemplates({
|
|
2169
3416
|
companyId: companyId,
|
|
2170
3417
|
applicationId: applicationId,
|
|
2171
3418
|
pageNo: pageNo,
|
|
@@ -2183,19 +3430,23 @@ class Communication {
|
|
|
2183
3430
|
}
|
|
2184
3431
|
|
|
2185
3432
|
/**
|
|
2186
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
3433
|
+
* @param {CommunicationPlatformApplicationValidator.GetStatsOfCampaignByIdParam} arg
|
|
2187
3434
|
* - Arg object
|
|
2188
3435
|
*
|
|
3436
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2189
3437
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2190
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
2191
|
-
* @name
|
|
2192
|
-
* @summary: Get
|
|
2193
|
-
* @description: Get
|
|
3438
|
+
* @returns {Promise<CommunicationPlatformModel.GetStats>} - Success response
|
|
3439
|
+
* @name getStatsOfCampaignById
|
|
3440
|
+
* @summary: Get stats of campaign by id
|
|
3441
|
+
* @description: Get stats of campaign by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getStatsOfCampaignById/).
|
|
2194
3442
|
*/
|
|
2195
|
-
async
|
|
3443
|
+
async getStatsOfCampaignById(
|
|
3444
|
+
{ id, requestHeaders } = { requestHeaders: {} },
|
|
3445
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3446
|
+
) {
|
|
2196
3447
|
const {
|
|
2197
3448
|
error,
|
|
2198
|
-
} = CommunicationPlatformApplicationValidator.
|
|
3449
|
+
} = CommunicationPlatformApplicationValidator.getStatsOfCampaignById().validate(
|
|
2199
3450
|
{
|
|
2200
3451
|
id,
|
|
2201
3452
|
},
|
|
@@ -2208,7 +3459,7 @@ class Communication {
|
|
|
2208
3459
|
// Showing warrnings if extra unknown parameters are found
|
|
2209
3460
|
const {
|
|
2210
3461
|
error: warrning,
|
|
2211
|
-
} = CommunicationPlatformApplicationValidator.
|
|
3462
|
+
} = CommunicationPlatformApplicationValidator.getStatsOfCampaignById().validate(
|
|
2212
3463
|
{
|
|
2213
3464
|
id,
|
|
2214
3465
|
},
|
|
@@ -2217,7 +3468,7 @@ class Communication {
|
|
|
2217
3468
|
if (warrning) {
|
|
2218
3469
|
Logger({
|
|
2219
3470
|
level: "WARN",
|
|
2220
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
3471
|
+
message: `Parameter Validation warrnings for platform > Communication > getStatsOfCampaignById \n ${warrning}`,
|
|
2221
3472
|
});
|
|
2222
3473
|
}
|
|
2223
3474
|
|
|
@@ -2226,21 +3477,102 @@ class Communication {
|
|
|
2226
3477
|
const response = await PlatformAPIClient.execute(
|
|
2227
3478
|
this.config,
|
|
2228
3479
|
"get",
|
|
2229
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
3480
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/get-stats/${id}`,
|
|
2230
3481
|
query_params,
|
|
2231
3482
|
undefined,
|
|
3483
|
+
requestHeaders,
|
|
3484
|
+
{ responseHeaders }
|
|
3485
|
+
);
|
|
3486
|
+
|
|
3487
|
+
let responseData = response;
|
|
3488
|
+
if (responseHeaders) {
|
|
3489
|
+
responseData = response[0];
|
|
3490
|
+
}
|
|
3491
|
+
|
|
3492
|
+
const {
|
|
3493
|
+
error: res_error,
|
|
3494
|
+
} = CommunicationPlatformModel.GetStats().validate(responseData, {
|
|
3495
|
+
abortEarly: false,
|
|
3496
|
+
allowUnknown: false,
|
|
3497
|
+
});
|
|
3498
|
+
|
|
3499
|
+
if (res_error) {
|
|
3500
|
+
Logger({
|
|
3501
|
+
level: "WARN",
|
|
3502
|
+
message: `Response Validation Warnnings for platform > Communication > getStatsOfCampaignById \n ${res_error}`,
|
|
3503
|
+
});
|
|
3504
|
+
}
|
|
3505
|
+
|
|
3506
|
+
return response;
|
|
3507
|
+
}
|
|
3508
|
+
|
|
3509
|
+
/**
|
|
3510
|
+
* @param {CommunicationPlatformApplicationValidator.GetSubscribedEmailTemplatesParam} arg
|
|
3511
|
+
* - Arg object
|
|
3512
|
+
*
|
|
3513
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
3514
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
3515
|
+
* @returns {Promise<CommunicationPlatformModel.EmailTemplates>} - Success response
|
|
3516
|
+
* @name getSubscribedEmailTemplates
|
|
3517
|
+
* @summary: Get subscribed email templates
|
|
3518
|
+
* @description: Email templates are predefined formats linked to various events for delivering messages to users. Use this API to get all subscribed email templates. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getSubscribedEmailTemplates/).
|
|
3519
|
+
*/
|
|
3520
|
+
async getSubscribedEmailTemplates(
|
|
3521
|
+
{ pageNo, pageSize, requestHeaders } = { requestHeaders: {} },
|
|
3522
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3523
|
+
) {
|
|
3524
|
+
const {
|
|
3525
|
+
error,
|
|
3526
|
+
} = CommunicationPlatformApplicationValidator.getSubscribedEmailTemplates().validate(
|
|
3527
|
+
{
|
|
3528
|
+
pageNo,
|
|
3529
|
+
pageSize,
|
|
3530
|
+
},
|
|
3531
|
+
{ abortEarly: false, allowUnknown: true }
|
|
3532
|
+
);
|
|
3533
|
+
if (error) {
|
|
3534
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
3535
|
+
}
|
|
3536
|
+
|
|
3537
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3538
|
+
const {
|
|
3539
|
+
error: warrning,
|
|
3540
|
+
} = CommunicationPlatformApplicationValidator.getSubscribedEmailTemplates().validate(
|
|
3541
|
+
{
|
|
3542
|
+
pageNo,
|
|
3543
|
+
pageSize,
|
|
3544
|
+
},
|
|
3545
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3546
|
+
);
|
|
3547
|
+
if (warrning) {
|
|
3548
|
+
Logger({
|
|
3549
|
+
level: "WARN",
|
|
3550
|
+
message: `Parameter Validation warrnings for platform > Communication > getSubscribedEmailTemplates \n ${warrning}`,
|
|
3551
|
+
});
|
|
3552
|
+
}
|
|
3553
|
+
|
|
3554
|
+
const query_params = {};
|
|
3555
|
+
query_params["page_no"] = pageNo;
|
|
3556
|
+
query_params["page_size"] = pageSize;
|
|
3557
|
+
|
|
3558
|
+
const response = await PlatformAPIClient.execute(
|
|
3559
|
+
this.config,
|
|
3560
|
+
"get",
|
|
3561
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/subscribedTemplates`,
|
|
3562
|
+
query_params,
|
|
2232
3563
|
undefined,
|
|
2233
|
-
|
|
3564
|
+
requestHeaders,
|
|
3565
|
+
{ responseHeaders }
|
|
2234
3566
|
);
|
|
2235
3567
|
|
|
2236
3568
|
let responseData = response;
|
|
2237
|
-
if (
|
|
3569
|
+
if (responseHeaders) {
|
|
2238
3570
|
responseData = response[0];
|
|
2239
3571
|
}
|
|
2240
3572
|
|
|
2241
3573
|
const {
|
|
2242
3574
|
error: res_error,
|
|
2243
|
-
} = CommunicationPlatformModel.
|
|
3575
|
+
} = CommunicationPlatformModel.EmailTemplates().validate(responseData, {
|
|
2244
3576
|
abortEarly: false,
|
|
2245
3577
|
allowUnknown: false,
|
|
2246
3578
|
});
|
|
@@ -2248,7 +3580,7 @@ class Communication {
|
|
|
2248
3580
|
if (res_error) {
|
|
2249
3581
|
Logger({
|
|
2250
3582
|
level: "WARN",
|
|
2251
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
3583
|
+
message: `Response Validation Warnnings for platform > Communication > getSubscribedEmailTemplates \n ${res_error}`,
|
|
2252
3584
|
});
|
|
2253
3585
|
}
|
|
2254
3586
|
|
|
@@ -2256,26 +3588,61 @@ class Communication {
|
|
|
2256
3588
|
}
|
|
2257
3589
|
|
|
2258
3590
|
/**
|
|
2259
|
-
* @param {
|
|
3591
|
+
* @param {Object} arg - Arg object.
|
|
3592
|
+
* @param {string} arg.companyId - Company id
|
|
3593
|
+
* @param {string} arg.applicationId - Application id
|
|
3594
|
+
* @param {number} [arg.pageSize] - Current request items count
|
|
3595
|
+
* @returns {Paginator<CommunicationPlatformModel.EmailTemplates>}
|
|
3596
|
+
* @summary: Get subscribed email templates
|
|
3597
|
+
* @description: Email templates are predefined formats linked to various events for delivering messages to users. Use this API to get all subscribed email templates.
|
|
3598
|
+
*/
|
|
3599
|
+
getSubscribedEmailTemplatesPaginator({
|
|
3600
|
+
companyId,
|
|
3601
|
+
applicationId,
|
|
3602
|
+
pageSize,
|
|
3603
|
+
} = {}) {
|
|
3604
|
+
const paginator = new Paginator();
|
|
3605
|
+
const callback = async () => {
|
|
3606
|
+
const pageId = paginator.nextId;
|
|
3607
|
+
const pageNo = paginator.pageNo;
|
|
3608
|
+
const pageType = "number";
|
|
3609
|
+
const data = await this.getSubscribedEmailTemplates({
|
|
3610
|
+
companyId: companyId,
|
|
3611
|
+
applicationId: applicationId,
|
|
3612
|
+
pageNo: pageNo,
|
|
3613
|
+
pageSize: pageSize,
|
|
3614
|
+
});
|
|
3615
|
+
paginator.setPaginator({
|
|
3616
|
+
hasNext: data.page.has_next ? true : false,
|
|
3617
|
+
nextId: data.page.next_id,
|
|
3618
|
+
});
|
|
3619
|
+
return data;
|
|
3620
|
+
};
|
|
3621
|
+
paginator.setCallback(callback.bind(this));
|
|
3622
|
+
return paginator;
|
|
3623
|
+
}
|
|
3624
|
+
|
|
3625
|
+
/**
|
|
3626
|
+
* @param {CommunicationPlatformApplicationValidator.GetSubscribedSmsTemplatesParam} arg
|
|
2260
3627
|
* - Arg object
|
|
2261
3628
|
*
|
|
3629
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2262
3630
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2263
3631
|
* @returns {Promise<CommunicationPlatformModel.SmsTemplates>} - Success response
|
|
2264
|
-
* @name
|
|
2265
|
-
* @summary: Get sms templates
|
|
2266
|
-
* @description:
|
|
3632
|
+
* @name getSubscribedSmsTemplates
|
|
3633
|
+
* @summary: Get subscribed sms templates
|
|
3634
|
+
* @description: SMS templates are predefined message formats linked to various events for delivering messages to users. Use this API to get all subscribed sms templates. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getSubscribedSmsTemplates/).
|
|
2267
3635
|
*/
|
|
2268
|
-
async
|
|
2269
|
-
{ pageNo, pageSize,
|
|
2270
|
-
{
|
|
3636
|
+
async getSubscribedSmsTemplates(
|
|
3637
|
+
{ pageNo, pageSize, requestHeaders } = { requestHeaders: {} },
|
|
3638
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2271
3639
|
) {
|
|
2272
3640
|
const {
|
|
2273
3641
|
error,
|
|
2274
|
-
} = CommunicationPlatformApplicationValidator.
|
|
3642
|
+
} = CommunicationPlatformApplicationValidator.getSubscribedSmsTemplates().validate(
|
|
2275
3643
|
{
|
|
2276
3644
|
pageNo,
|
|
2277
3645
|
pageSize,
|
|
2278
|
-
sort,
|
|
2279
3646
|
},
|
|
2280
3647
|
{ abortEarly: false, allowUnknown: true }
|
|
2281
3648
|
);
|
|
@@ -2286,38 +3653,36 @@ class Communication {
|
|
|
2286
3653
|
// Showing warrnings if extra unknown parameters are found
|
|
2287
3654
|
const {
|
|
2288
3655
|
error: warrning,
|
|
2289
|
-
} = CommunicationPlatformApplicationValidator.
|
|
3656
|
+
} = CommunicationPlatformApplicationValidator.getSubscribedSmsTemplates().validate(
|
|
2290
3657
|
{
|
|
2291
3658
|
pageNo,
|
|
2292
3659
|
pageSize,
|
|
2293
|
-
sort,
|
|
2294
3660
|
},
|
|
2295
3661
|
{ abortEarly: false, allowUnknown: false }
|
|
2296
3662
|
);
|
|
2297
3663
|
if (warrning) {
|
|
2298
3664
|
Logger({
|
|
2299
3665
|
level: "WARN",
|
|
2300
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
3666
|
+
message: `Parameter Validation warrnings for platform > Communication > getSubscribedSmsTemplates \n ${warrning}`,
|
|
2301
3667
|
});
|
|
2302
3668
|
}
|
|
2303
3669
|
|
|
2304
3670
|
const query_params = {};
|
|
2305
3671
|
query_params["page_no"] = pageNo;
|
|
2306
3672
|
query_params["page_size"] = pageSize;
|
|
2307
|
-
query_params["sort"] = sort;
|
|
2308
3673
|
|
|
2309
3674
|
const response = await PlatformAPIClient.execute(
|
|
2310
3675
|
this.config,
|
|
2311
3676
|
"get",
|
|
2312
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/
|
|
3677
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/subscribedTemplates`,
|
|
2313
3678
|
query_params,
|
|
2314
3679
|
undefined,
|
|
2315
|
-
|
|
2316
|
-
{
|
|
3680
|
+
requestHeaders,
|
|
3681
|
+
{ responseHeaders }
|
|
2317
3682
|
);
|
|
2318
3683
|
|
|
2319
3684
|
let responseData = response;
|
|
2320
|
-
if (
|
|
3685
|
+
if (responseHeaders) {
|
|
2321
3686
|
responseData = response[0];
|
|
2322
3687
|
}
|
|
2323
3688
|
|
|
@@ -2331,7 +3696,7 @@ class Communication {
|
|
|
2331
3696
|
if (res_error) {
|
|
2332
3697
|
Logger({
|
|
2333
3698
|
level: "WARN",
|
|
2334
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
3699
|
+
message: `Response Validation Warnnings for platform > Communication > getSubscribedSmsTemplates \n ${res_error}`,
|
|
2335
3700
|
});
|
|
2336
3701
|
}
|
|
2337
3702
|
|
|
@@ -2343,23 +3708,25 @@ class Communication {
|
|
|
2343
3708
|
* @param {string} arg.companyId - Company id
|
|
2344
3709
|
* @param {string} arg.applicationId - Application id
|
|
2345
3710
|
* @param {number} [arg.pageSize] - Current request items count
|
|
2346
|
-
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2347
3711
|
* @returns {Paginator<CommunicationPlatformModel.SmsTemplates>}
|
|
2348
|
-
* @summary: Get sms templates
|
|
2349
|
-
* @description:
|
|
3712
|
+
* @summary: Get subscribed sms templates
|
|
3713
|
+
* @description: SMS templates are predefined message formats linked to various events for delivering messages to users. Use this API to get all subscribed sms templates.
|
|
2350
3714
|
*/
|
|
2351
|
-
|
|
3715
|
+
getSubscribedSmsTemplatesPaginator({
|
|
3716
|
+
companyId,
|
|
3717
|
+
applicationId,
|
|
3718
|
+
pageSize,
|
|
3719
|
+
} = {}) {
|
|
2352
3720
|
const paginator = new Paginator();
|
|
2353
3721
|
const callback = async () => {
|
|
2354
3722
|
const pageId = paginator.nextId;
|
|
2355
3723
|
const pageNo = paginator.pageNo;
|
|
2356
3724
|
const pageType = "number";
|
|
2357
|
-
const data = await this.
|
|
3725
|
+
const data = await this.getSubscribedSmsTemplates({
|
|
2358
3726
|
companyId: companyId,
|
|
2359
3727
|
applicationId: applicationId,
|
|
2360
3728
|
pageNo: pageNo,
|
|
2361
3729
|
pageSize: pageSize,
|
|
2362
|
-
sort: sort,
|
|
2363
3730
|
});
|
|
2364
3731
|
paginator.setPaginator({
|
|
2365
3732
|
hasNext: data.page.has_next ? true : false,
|
|
@@ -2372,22 +3739,24 @@ class Communication {
|
|
|
2372
3739
|
}
|
|
2373
3740
|
|
|
2374
3741
|
/**
|
|
2375
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
3742
|
+
* @param {CommunicationPlatformApplicationValidator.GetSystemAudiencesParam} arg
|
|
2376
3743
|
* - Arg object
|
|
2377
3744
|
*
|
|
3745
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2378
3746
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2379
|
-
* @returns {Promise<
|
|
2380
|
-
* @name
|
|
2381
|
-
* @summary: Get
|
|
2382
|
-
* @description: Get
|
|
3747
|
+
* @returns {Promise<Object>} - Success response
|
|
3748
|
+
* @name getSystemAudiences
|
|
3749
|
+
* @summary: Get system audiences
|
|
3750
|
+
* @description: Get system audiences - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getSystemAudiences/).
|
|
2383
3751
|
*/
|
|
2384
|
-
async
|
|
3752
|
+
async getSystemAudiences(
|
|
3753
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
3754
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3755
|
+
) {
|
|
2385
3756
|
const {
|
|
2386
3757
|
error,
|
|
2387
|
-
} = CommunicationPlatformApplicationValidator.
|
|
2388
|
-
{
|
|
2389
|
-
id,
|
|
2390
|
-
},
|
|
3758
|
+
} = CommunicationPlatformApplicationValidator.getSystemAudiences().validate(
|
|
3759
|
+
{},
|
|
2391
3760
|
{ abortEarly: false, allowUnknown: true }
|
|
2392
3761
|
);
|
|
2393
3762
|
if (error) {
|
|
@@ -2397,16 +3766,14 @@ class Communication {
|
|
|
2397
3766
|
// Showing warrnings if extra unknown parameters are found
|
|
2398
3767
|
const {
|
|
2399
3768
|
error: warrning,
|
|
2400
|
-
} = CommunicationPlatformApplicationValidator.
|
|
2401
|
-
{
|
|
2402
|
-
id,
|
|
2403
|
-
},
|
|
3769
|
+
} = CommunicationPlatformApplicationValidator.getSystemAudiences().validate(
|
|
3770
|
+
{},
|
|
2404
3771
|
{ abortEarly: false, allowUnknown: false }
|
|
2405
3772
|
);
|
|
2406
3773
|
if (warrning) {
|
|
2407
3774
|
Logger({
|
|
2408
3775
|
level: "WARN",
|
|
2409
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
3776
|
+
message: `Parameter Validation warrnings for platform > Communication > getSystemAudiences \n ${warrning}`,
|
|
2410
3777
|
});
|
|
2411
3778
|
}
|
|
2412
3779
|
|
|
@@ -2415,21 +3782,19 @@ class Communication {
|
|
|
2415
3782
|
const response = await PlatformAPIClient.execute(
|
|
2416
3783
|
this.config,
|
|
2417
3784
|
"get",
|
|
2418
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
3785
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/system-datasources`,
|
|
2419
3786
|
query_params,
|
|
2420
3787
|
undefined,
|
|
2421
|
-
|
|
2422
|
-
{
|
|
3788
|
+
requestHeaders,
|
|
3789
|
+
{ responseHeaders }
|
|
2423
3790
|
);
|
|
2424
3791
|
|
|
2425
3792
|
let responseData = response;
|
|
2426
|
-
if (
|
|
3793
|
+
if (responseHeaders) {
|
|
2427
3794
|
responseData = response[0];
|
|
2428
3795
|
}
|
|
2429
3796
|
|
|
2430
|
-
const {
|
|
2431
|
-
error: res_error,
|
|
2432
|
-
} = CommunicationPlatformModel.GetStats().validate(responseData, {
|
|
3797
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
2433
3798
|
abortEarly: false,
|
|
2434
3799
|
allowUnknown: false,
|
|
2435
3800
|
});
|
|
@@ -2437,7 +3802,7 @@ class Communication {
|
|
|
2437
3802
|
if (res_error) {
|
|
2438
3803
|
Logger({
|
|
2439
3804
|
level: "WARN",
|
|
2440
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
3805
|
+
message: `Response Validation Warnnings for platform > Communication > getSystemAudiences \n ${res_error}`,
|
|
2441
3806
|
});
|
|
2442
3807
|
}
|
|
2443
3808
|
|
|
@@ -2448,25 +3813,22 @@ class Communication {
|
|
|
2448
3813
|
* @param {CommunicationPlatformApplicationValidator.GetSystemEmailTemplatesParam} arg
|
|
2449
3814
|
* - Arg object
|
|
2450
3815
|
*
|
|
3816
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2451
3817
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2452
3818
|
* @returns {Promise<CommunicationPlatformModel.SystemEmailTemplates>} -
|
|
2453
3819
|
* Success response
|
|
2454
3820
|
* @name getSystemEmailTemplates
|
|
2455
3821
|
* @summary: Get system email templates
|
|
2456
|
-
* @description:
|
|
3822
|
+
* @description: Email templates are predefined formats linked to various events for delivering messages to users. Use this API to get all system email templates. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getSystemEmailTemplates/).
|
|
2457
3823
|
*/
|
|
2458
3824
|
async getSystemEmailTemplates(
|
|
2459
|
-
{
|
|
2460
|
-
{
|
|
3825
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
3826
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2461
3827
|
) {
|
|
2462
3828
|
const {
|
|
2463
3829
|
error,
|
|
2464
3830
|
} = CommunicationPlatformApplicationValidator.getSystemEmailTemplates().validate(
|
|
2465
|
-
{
|
|
2466
|
-
pageNo,
|
|
2467
|
-
pageSize,
|
|
2468
|
-
sort,
|
|
2469
|
-
},
|
|
3831
|
+
{},
|
|
2470
3832
|
{ abortEarly: false, allowUnknown: true }
|
|
2471
3833
|
);
|
|
2472
3834
|
if (error) {
|
|
@@ -2477,11 +3839,7 @@ class Communication {
|
|
|
2477
3839
|
const {
|
|
2478
3840
|
error: warrning,
|
|
2479
3841
|
} = CommunicationPlatformApplicationValidator.getSystemEmailTemplates().validate(
|
|
2480
|
-
{
|
|
2481
|
-
pageNo,
|
|
2482
|
-
pageSize,
|
|
2483
|
-
sort,
|
|
2484
|
-
},
|
|
3842
|
+
{},
|
|
2485
3843
|
{ abortEarly: false, allowUnknown: false }
|
|
2486
3844
|
);
|
|
2487
3845
|
if (warrning) {
|
|
@@ -2492,9 +3850,6 @@ class Communication {
|
|
|
2492
3850
|
}
|
|
2493
3851
|
|
|
2494
3852
|
const query_params = {};
|
|
2495
|
-
query_params["page_no"] = pageNo;
|
|
2496
|
-
query_params["page_size"] = pageSize;
|
|
2497
|
-
query_params["sort"] = sort;
|
|
2498
3853
|
|
|
2499
3854
|
const response = await PlatformAPIClient.execute(
|
|
2500
3855
|
this.config,
|
|
@@ -2502,12 +3857,12 @@ class Communication {
|
|
|
2502
3857
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/system-templates`,
|
|
2503
3858
|
query_params,
|
|
2504
3859
|
undefined,
|
|
2505
|
-
|
|
2506
|
-
{
|
|
3860
|
+
requestHeaders,
|
|
3861
|
+
{ responseHeaders }
|
|
2507
3862
|
);
|
|
2508
3863
|
|
|
2509
3864
|
let responseData = response;
|
|
2510
|
-
if (
|
|
3865
|
+
if (responseHeaders) {
|
|
2511
3866
|
responseData = response[0];
|
|
2512
3867
|
}
|
|
2513
3868
|
|
|
@@ -2529,65 +3884,98 @@ class Communication {
|
|
|
2529
3884
|
}
|
|
2530
3885
|
|
|
2531
3886
|
/**
|
|
2532
|
-
* @param {
|
|
2533
|
-
*
|
|
2534
|
-
*
|
|
2535
|
-
* @param {
|
|
2536
|
-
* @param {
|
|
2537
|
-
* @returns {
|
|
2538
|
-
*
|
|
2539
|
-
* @
|
|
3887
|
+
* @param {CommunicationPlatformApplicationValidator.GetSystemSmsTemplatesParam} arg
|
|
3888
|
+
* - Arg object
|
|
3889
|
+
*
|
|
3890
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
3891
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
3892
|
+
* @returns {Promise<CommunicationPlatformModel.SystemSmsTemplates[]>} -
|
|
3893
|
+
* Success response
|
|
3894
|
+
* @name getSystemSmsTemplates
|
|
3895
|
+
* @summary: Get system sms templates
|
|
3896
|
+
* @description: SMS templates are predefined message formats linked to various events for delivering messages to users. Use this API to get all system sms templates. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/getSystemSmsTemplates/).
|
|
2540
3897
|
*/
|
|
2541
|
-
|
|
2542
|
-
|
|
2543
|
-
|
|
2544
|
-
|
|
2545
|
-
|
|
2546
|
-
|
|
2547
|
-
|
|
2548
|
-
|
|
2549
|
-
|
|
2550
|
-
|
|
2551
|
-
|
|
2552
|
-
|
|
2553
|
-
|
|
2554
|
-
|
|
2555
|
-
|
|
2556
|
-
|
|
2557
|
-
|
|
3898
|
+
async getSystemSmsTemplates(
|
|
3899
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
3900
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3901
|
+
) {
|
|
3902
|
+
const {
|
|
3903
|
+
error,
|
|
3904
|
+
} = CommunicationPlatformApplicationValidator.getSystemSmsTemplates().validate(
|
|
3905
|
+
{},
|
|
3906
|
+
{ abortEarly: false, allowUnknown: true }
|
|
3907
|
+
);
|
|
3908
|
+
if (error) {
|
|
3909
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
3910
|
+
}
|
|
3911
|
+
|
|
3912
|
+
// Showing warrnings if extra unknown parameters are found
|
|
3913
|
+
const {
|
|
3914
|
+
error: warrning,
|
|
3915
|
+
} = CommunicationPlatformApplicationValidator.getSystemSmsTemplates().validate(
|
|
3916
|
+
{},
|
|
3917
|
+
{ abortEarly: false, allowUnknown: false }
|
|
3918
|
+
);
|
|
3919
|
+
if (warrning) {
|
|
3920
|
+
Logger({
|
|
3921
|
+
level: "WARN",
|
|
3922
|
+
message: `Parameter Validation warrnings for platform > Communication > getSystemSmsTemplates \n ${warrning}`,
|
|
2558
3923
|
});
|
|
2559
|
-
|
|
2560
|
-
|
|
2561
|
-
|
|
3924
|
+
}
|
|
3925
|
+
|
|
3926
|
+
const query_params = {};
|
|
3927
|
+
|
|
3928
|
+
const response = await PlatformAPIClient.execute(
|
|
3929
|
+
this.config,
|
|
3930
|
+
"get",
|
|
3931
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/system-templates`,
|
|
3932
|
+
query_params,
|
|
3933
|
+
undefined,
|
|
3934
|
+
requestHeaders,
|
|
3935
|
+
{ responseHeaders }
|
|
3936
|
+
);
|
|
3937
|
+
|
|
3938
|
+
let responseData = response;
|
|
3939
|
+
if (responseHeaders) {
|
|
3940
|
+
responseData = response[0];
|
|
3941
|
+
}
|
|
3942
|
+
|
|
3943
|
+
const { error: res_error } = Joi.array()
|
|
3944
|
+
.items(CommunicationPlatformModel.SystemSmsTemplates())
|
|
3945
|
+
.validate(responseData, { abortEarly: false, allowUnknown: false });
|
|
3946
|
+
|
|
3947
|
+
if (res_error) {
|
|
3948
|
+
Logger({
|
|
3949
|
+
level: "WARN",
|
|
3950
|
+
message: `Response Validation Warnnings for platform > Communication > getSystemSmsTemplates \n ${res_error}`,
|
|
2562
3951
|
});
|
|
2563
|
-
|
|
2564
|
-
|
|
2565
|
-
|
|
2566
|
-
return paginator;
|
|
3952
|
+
}
|
|
3953
|
+
|
|
3954
|
+
return response;
|
|
2567
3955
|
}
|
|
2568
3956
|
|
|
2569
3957
|
/**
|
|
2570
|
-
* @param {CommunicationPlatformApplicationValidator.
|
|
3958
|
+
* @param {CommunicationPlatformApplicationValidator.PostGlobalVariablesParam} arg
|
|
2571
3959
|
* - Arg object
|
|
2572
3960
|
*
|
|
3961
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2573
3962
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2574
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
2575
|
-
* Success response
|
|
2576
|
-
*
|
|
2577
|
-
* @
|
|
2578
|
-
* @
|
|
3963
|
+
* @returns {Promise<CommunicationPlatformModel.GlobalVariablesPostResponse>}
|
|
3964
|
+
* - Success response
|
|
3965
|
+
*
|
|
3966
|
+
* @name postGlobalVariables
|
|
3967
|
+
* @summary: post global variables
|
|
3968
|
+
* @description: psot global variables - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/postGlobalVariables/).
|
|
2579
3969
|
*/
|
|
2580
|
-
async
|
|
2581
|
-
{
|
|
2582
|
-
{
|
|
3970
|
+
async postGlobalVariables(
|
|
3971
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
3972
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2583
3973
|
) {
|
|
2584
3974
|
const {
|
|
2585
3975
|
error,
|
|
2586
|
-
} = CommunicationPlatformApplicationValidator.
|
|
3976
|
+
} = CommunicationPlatformApplicationValidator.postGlobalVariables().validate(
|
|
2587
3977
|
{
|
|
2588
|
-
|
|
2589
|
-
pageSize,
|
|
2590
|
-
sort,
|
|
3978
|
+
body,
|
|
2591
3979
|
},
|
|
2592
3980
|
{ abortEarly: false, allowUnknown: true }
|
|
2593
3981
|
);
|
|
@@ -2598,100 +3986,58 @@ class Communication {
|
|
|
2598
3986
|
// Showing warrnings if extra unknown parameters are found
|
|
2599
3987
|
const {
|
|
2600
3988
|
error: warrning,
|
|
2601
|
-
} = CommunicationPlatformApplicationValidator.
|
|
3989
|
+
} = CommunicationPlatformApplicationValidator.postGlobalVariables().validate(
|
|
2602
3990
|
{
|
|
2603
|
-
|
|
2604
|
-
pageSize,
|
|
2605
|
-
sort,
|
|
3991
|
+
body,
|
|
2606
3992
|
},
|
|
2607
3993
|
{ abortEarly: false, allowUnknown: false }
|
|
2608
3994
|
);
|
|
2609
3995
|
if (warrning) {
|
|
2610
3996
|
Logger({
|
|
2611
3997
|
level: "WARN",
|
|
2612
|
-
message: `Parameter Validation warrnings for platform > Communication >
|
|
3998
|
+
message: `Parameter Validation warrnings for platform > Communication > postGlobalVariables \n ${warrning}`,
|
|
2613
3999
|
});
|
|
2614
4000
|
}
|
|
2615
4001
|
|
|
2616
4002
|
const query_params = {};
|
|
2617
|
-
query_params["page_no"] = pageNo;
|
|
2618
|
-
query_params["page_size"] = pageSize;
|
|
2619
|
-
query_params["sort"] = sort;
|
|
2620
4003
|
|
|
2621
4004
|
const response = await PlatformAPIClient.execute(
|
|
2622
4005
|
this.config,
|
|
2623
|
-
"
|
|
2624
|
-
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/
|
|
4006
|
+
"post",
|
|
4007
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/global-variables`,
|
|
2625
4008
|
query_params,
|
|
2626
|
-
|
|
2627
|
-
|
|
2628
|
-
{
|
|
4009
|
+
body,
|
|
4010
|
+
requestHeaders,
|
|
4011
|
+
{ responseHeaders }
|
|
2629
4012
|
);
|
|
2630
4013
|
|
|
2631
4014
|
let responseData = response;
|
|
2632
|
-
if (
|
|
4015
|
+
if (responseHeaders) {
|
|
2633
4016
|
responseData = response[0];
|
|
2634
4017
|
}
|
|
2635
4018
|
|
|
2636
4019
|
const {
|
|
2637
4020
|
error: res_error,
|
|
2638
|
-
} = CommunicationPlatformModel.
|
|
2639
|
-
|
|
2640
|
-
allowUnknown: false
|
|
2641
|
-
|
|
4021
|
+
} = CommunicationPlatformModel.GlobalVariablesPostResponse().validate(
|
|
4022
|
+
responseData,
|
|
4023
|
+
{ abortEarly: false, allowUnknown: false }
|
|
4024
|
+
);
|
|
2642
4025
|
|
|
2643
4026
|
if (res_error) {
|
|
2644
4027
|
Logger({
|
|
2645
4028
|
level: "WARN",
|
|
2646
|
-
message: `Response Validation Warnnings for platform > Communication >
|
|
4029
|
+
message: `Response Validation Warnnings for platform > Communication > postGlobalVariables \n ${res_error}`,
|
|
2647
4030
|
});
|
|
2648
4031
|
}
|
|
2649
4032
|
|
|
2650
4033
|
return response;
|
|
2651
4034
|
}
|
|
2652
4035
|
|
|
2653
|
-
/**
|
|
2654
|
-
* @param {Object} arg - Arg object.
|
|
2655
|
-
* @param {string} arg.companyId - Company id
|
|
2656
|
-
* @param {string} arg.applicationId - Application id
|
|
2657
|
-
* @param {number} [arg.pageSize] - Current request items count
|
|
2658
|
-
* @param {Object} [arg.sort] - To sort based on created_at
|
|
2659
|
-
* @returns {Paginator<CommunicationPlatformModel.SystemSmsTemplates>}
|
|
2660
|
-
* @summary: Get system sms templates
|
|
2661
|
-
* @description: Get system sms templates
|
|
2662
|
-
*/
|
|
2663
|
-
getSystemSystemTemplatesPaginator({
|
|
2664
|
-
companyId,
|
|
2665
|
-
applicationId,
|
|
2666
|
-
pageSize,
|
|
2667
|
-
sort,
|
|
2668
|
-
} = {}) {
|
|
2669
|
-
const paginator = new Paginator();
|
|
2670
|
-
const callback = async () => {
|
|
2671
|
-
const pageId = paginator.nextId;
|
|
2672
|
-
const pageNo = paginator.pageNo;
|
|
2673
|
-
const pageType = "number";
|
|
2674
|
-
const data = await this.getSystemSystemTemplates({
|
|
2675
|
-
companyId: companyId,
|
|
2676
|
-
applicationId: applicationId,
|
|
2677
|
-
pageNo: pageNo,
|
|
2678
|
-
pageSize: pageSize,
|
|
2679
|
-
sort: sort,
|
|
2680
|
-
});
|
|
2681
|
-
paginator.setPaginator({
|
|
2682
|
-
hasNext: data.page.has_next ? true : false,
|
|
2683
|
-
nextId: data.page.next_id,
|
|
2684
|
-
});
|
|
2685
|
-
return data;
|
|
2686
|
-
};
|
|
2687
|
-
paginator.setCallback(callback.bind(this));
|
|
2688
|
-
return paginator;
|
|
2689
|
-
}
|
|
2690
|
-
|
|
2691
4036
|
/**
|
|
2692
4037
|
* @param {CommunicationPlatformApplicationValidator.SendCommunicationAsynchronouslyParam} arg
|
|
2693
4038
|
* - Arg object
|
|
2694
4039
|
*
|
|
4040
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2695
4041
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2696
4042
|
* @returns {Promise<CommunicationPlatformModel.EngineResponse>} - Success response
|
|
2697
4043
|
* @name sendCommunicationAsynchronously
|
|
@@ -2699,8 +4045,8 @@ class Communication {
|
|
|
2699
4045
|
* @description: Send email or sms asynchronously - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/sendCommunicationAsynchronously/).
|
|
2700
4046
|
*/
|
|
2701
4047
|
async sendCommunicationAsynchronously(
|
|
2702
|
-
{ body } = {},
|
|
2703
|
-
{
|
|
4048
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
4049
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2704
4050
|
) {
|
|
2705
4051
|
const {
|
|
2706
4052
|
error,
|
|
@@ -2738,12 +4084,12 @@ class Communication {
|
|
|
2738
4084
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/engine/send-async`,
|
|
2739
4085
|
query_params,
|
|
2740
4086
|
body,
|
|
2741
|
-
|
|
2742
|
-
{
|
|
4087
|
+
requestHeaders,
|
|
4088
|
+
{ responseHeaders }
|
|
2743
4089
|
);
|
|
2744
4090
|
|
|
2745
4091
|
let responseData = response;
|
|
2746
|
-
if (
|
|
4092
|
+
if (responseHeaders) {
|
|
2747
4093
|
responseData = response[0];
|
|
2748
4094
|
}
|
|
2749
4095
|
|
|
@@ -2768,6 +4114,7 @@ class Communication {
|
|
|
2768
4114
|
* @param {CommunicationPlatformApplicationValidator.SendCommunicationSynchronouslyParam} arg
|
|
2769
4115
|
* - Arg object
|
|
2770
4116
|
*
|
|
4117
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2771
4118
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2772
4119
|
* @returns {Promise<CommunicationPlatformModel.EngineResponse>} - Success response
|
|
2773
4120
|
* @name sendCommunicationSynchronously
|
|
@@ -2775,8 +4122,8 @@ class Communication {
|
|
|
2775
4122
|
* @description: Send email or sms synchronously - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/sendCommunicationSynchronously/).
|
|
2776
4123
|
*/
|
|
2777
4124
|
async sendCommunicationSynchronously(
|
|
2778
|
-
{ body } = {},
|
|
2779
|
-
{
|
|
4125
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
4126
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
2780
4127
|
) {
|
|
2781
4128
|
const {
|
|
2782
4129
|
error,
|
|
@@ -2814,12 +4161,12 @@ class Communication {
|
|
|
2814
4161
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/engine/send-instant`,
|
|
2815
4162
|
query_params,
|
|
2816
4163
|
body,
|
|
2817
|
-
|
|
2818
|
-
{
|
|
4164
|
+
requestHeaders,
|
|
4165
|
+
{ responseHeaders }
|
|
2819
4166
|
);
|
|
2820
4167
|
|
|
2821
4168
|
let responseData = response;
|
|
2822
|
-
if (
|
|
4169
|
+
if (responseHeaders) {
|
|
2823
4170
|
responseData = response[0];
|
|
2824
4171
|
}
|
|
2825
4172
|
|
|
@@ -2842,13 +4189,17 @@ class Communication {
|
|
|
2842
4189
|
|
|
2843
4190
|
/**
|
|
2844
4191
|
* @param {CommunicationPlatformApplicationValidator.SendOtpParam} arg - Arg object
|
|
4192
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2845
4193
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2846
4194
|
* @returns {Promise<CommunicationPlatformModel.SendOtpCommsRes>} - Success response
|
|
2847
4195
|
* @name sendOtp
|
|
2848
4196
|
* @summary: Send OTP using email and sms
|
|
2849
4197
|
* @description: Send OTP Comms via email and sms - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/sendOtp/).
|
|
2850
4198
|
*/
|
|
2851
|
-
async sendOtp(
|
|
4199
|
+
async sendOtp(
|
|
4200
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
4201
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
4202
|
+
) {
|
|
2852
4203
|
const {
|
|
2853
4204
|
error,
|
|
2854
4205
|
} = CommunicationPlatformApplicationValidator.sendOtp().validate(
|
|
@@ -2885,12 +4236,12 @@ class Communication {
|
|
|
2885
4236
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/otp/send-otp-comms`,
|
|
2886
4237
|
query_params,
|
|
2887
4238
|
body,
|
|
2888
|
-
|
|
2889
|
-
{
|
|
4239
|
+
requestHeaders,
|
|
4240
|
+
{ responseHeaders }
|
|
2890
4241
|
);
|
|
2891
4242
|
|
|
2892
4243
|
let responseData = response;
|
|
2893
|
-
if (
|
|
4244
|
+
if (responseHeaders) {
|
|
2894
4245
|
responseData = response[0];
|
|
2895
4246
|
}
|
|
2896
4247
|
|
|
@@ -2915,6 +4266,7 @@ class Communication {
|
|
|
2915
4266
|
* @param {CommunicationPlatformApplicationValidator.TriggerCampaignJobParam} arg
|
|
2916
4267
|
* - Arg object
|
|
2917
4268
|
*
|
|
4269
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2918
4270
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2919
4271
|
* @returns {Promise<CommunicationPlatformModel.TriggerJobResponse>} -
|
|
2920
4272
|
* Success response
|
|
@@ -2922,7 +4274,10 @@ class Communication {
|
|
|
2922
4274
|
* @summary: Trigger campaign job
|
|
2923
4275
|
* @description: Trigger campaign job - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/triggerCampaignJob/).
|
|
2924
4276
|
*/
|
|
2925
|
-
async triggerCampaignJob(
|
|
4277
|
+
async triggerCampaignJob(
|
|
4278
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
4279
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
4280
|
+
) {
|
|
2926
4281
|
const {
|
|
2927
4282
|
error,
|
|
2928
4283
|
} = CommunicationPlatformApplicationValidator.triggerCampaignJob().validate(
|
|
@@ -2959,12 +4314,12 @@ class Communication {
|
|
|
2959
4314
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/jobs/trigger-job`,
|
|
2960
4315
|
query_params,
|
|
2961
4316
|
body,
|
|
2962
|
-
|
|
2963
|
-
{
|
|
4317
|
+
requestHeaders,
|
|
4318
|
+
{ responseHeaders }
|
|
2964
4319
|
);
|
|
2965
4320
|
|
|
2966
4321
|
let responseData = response;
|
|
2967
|
-
if (
|
|
4322
|
+
if (responseHeaders) {
|
|
2968
4323
|
responseData = response[0];
|
|
2969
4324
|
}
|
|
2970
4325
|
|
|
@@ -2985,19 +4340,97 @@ class Communication {
|
|
|
2985
4340
|
return response;
|
|
2986
4341
|
}
|
|
2987
4342
|
|
|
4343
|
+
/**
|
|
4344
|
+
* @param {CommunicationPlatformApplicationValidator.UpdateAppProvidersParam} arg
|
|
4345
|
+
* - Arg object
|
|
4346
|
+
*
|
|
4347
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
4348
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
4349
|
+
* @returns {Promise<CommunicationPlatformModel.AppProvider>} - Success response
|
|
4350
|
+
* @name updateAppProviders
|
|
4351
|
+
* @summary: update app providers
|
|
4352
|
+
* @description: Using this API will update the application providers. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/updateAppProviders/).
|
|
4353
|
+
*/
|
|
4354
|
+
async updateAppProviders(
|
|
4355
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
4356
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
4357
|
+
) {
|
|
4358
|
+
const {
|
|
4359
|
+
error,
|
|
4360
|
+
} = CommunicationPlatformApplicationValidator.updateAppProviders().validate(
|
|
4361
|
+
{
|
|
4362
|
+
body,
|
|
4363
|
+
},
|
|
4364
|
+
{ abortEarly: false, allowUnknown: true }
|
|
4365
|
+
);
|
|
4366
|
+
if (error) {
|
|
4367
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
4368
|
+
}
|
|
4369
|
+
|
|
4370
|
+
// Showing warrnings if extra unknown parameters are found
|
|
4371
|
+
const {
|
|
4372
|
+
error: warrning,
|
|
4373
|
+
} = CommunicationPlatformApplicationValidator.updateAppProviders().validate(
|
|
4374
|
+
{
|
|
4375
|
+
body,
|
|
4376
|
+
},
|
|
4377
|
+
{ abortEarly: false, allowUnknown: false }
|
|
4378
|
+
);
|
|
4379
|
+
if (warrning) {
|
|
4380
|
+
Logger({
|
|
4381
|
+
level: "WARN",
|
|
4382
|
+
message: `Parameter Validation warrnings for platform > Communication > updateAppProviders \n ${warrning}`,
|
|
4383
|
+
});
|
|
4384
|
+
}
|
|
4385
|
+
|
|
4386
|
+
const query_params = {};
|
|
4387
|
+
|
|
4388
|
+
const response = await PlatformAPIClient.execute(
|
|
4389
|
+
this.config,
|
|
4390
|
+
"post",
|
|
4391
|
+
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/app-provider/update-provider`,
|
|
4392
|
+
query_params,
|
|
4393
|
+
body,
|
|
4394
|
+
requestHeaders,
|
|
4395
|
+
{ responseHeaders }
|
|
4396
|
+
);
|
|
4397
|
+
|
|
4398
|
+
let responseData = response;
|
|
4399
|
+
if (responseHeaders) {
|
|
4400
|
+
responseData = response[0];
|
|
4401
|
+
}
|
|
4402
|
+
|
|
4403
|
+
const {
|
|
4404
|
+
error: res_error,
|
|
4405
|
+
} = CommunicationPlatformModel.AppProvider().validate(responseData, {
|
|
4406
|
+
abortEarly: false,
|
|
4407
|
+
allowUnknown: false,
|
|
4408
|
+
});
|
|
4409
|
+
|
|
4410
|
+
if (res_error) {
|
|
4411
|
+
Logger({
|
|
4412
|
+
level: "WARN",
|
|
4413
|
+
message: `Response Validation Warnnings for platform > Communication > updateAppProviders \n ${res_error}`,
|
|
4414
|
+
});
|
|
4415
|
+
}
|
|
4416
|
+
|
|
4417
|
+
return response;
|
|
4418
|
+
}
|
|
4419
|
+
|
|
2988
4420
|
/**
|
|
2989
4421
|
* @param {CommunicationPlatformApplicationValidator.UpdateAudienceByIdParam} arg
|
|
2990
4422
|
* - Arg object
|
|
2991
4423
|
*
|
|
4424
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
2992
4425
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
2993
4426
|
* @returns {Promise<CommunicationPlatformModel.Audience>} - Success response
|
|
2994
4427
|
* @name updateAudienceById
|
|
2995
4428
|
* @summary: Update audience by id
|
|
2996
|
-
* @description:
|
|
4429
|
+
* @description: Audience is used to import CSV files containing emails, phone numbers, and other variables in order to populate email/SMS templates for bulk delivery via a Campaign. Use this API to update audience by id. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/updateAudienceById/).
|
|
2997
4430
|
*/
|
|
2998
4431
|
async updateAudienceById(
|
|
2999
|
-
{ id, body } = {},
|
|
3000
|
-
{
|
|
4432
|
+
{ id, body, requestHeaders } = { requestHeaders: {} },
|
|
4433
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3001
4434
|
) {
|
|
3002
4435
|
const {
|
|
3003
4436
|
error,
|
|
@@ -3037,12 +4470,12 @@ class Communication {
|
|
|
3037
4470
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sources/datasources/${id}`,
|
|
3038
4471
|
query_params,
|
|
3039
4472
|
body,
|
|
3040
|
-
|
|
3041
|
-
{
|
|
4473
|
+
requestHeaders,
|
|
4474
|
+
{ responseHeaders }
|
|
3042
4475
|
);
|
|
3043
4476
|
|
|
3044
4477
|
let responseData = response;
|
|
3045
|
-
if (
|
|
4478
|
+
if (responseHeaders) {
|
|
3046
4479
|
responseData = response[0];
|
|
3047
4480
|
}
|
|
3048
4481
|
|
|
@@ -3067,6 +4500,7 @@ class Communication {
|
|
|
3067
4500
|
* @param {CommunicationPlatformApplicationValidator.UpdateCampaignByIdParam} arg
|
|
3068
4501
|
* - Arg object
|
|
3069
4502
|
*
|
|
4503
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
3070
4504
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
3071
4505
|
* @returns {Promise<CommunicationPlatformModel.Campaign>} - Success response
|
|
3072
4506
|
* @name updateCampaignById
|
|
@@ -3074,8 +4508,8 @@ class Communication {
|
|
|
3074
4508
|
* @description: Update campaign by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/updateCampaignById/).
|
|
3075
4509
|
*/
|
|
3076
4510
|
async updateCampaignById(
|
|
3077
|
-
{ id, body } = {},
|
|
3078
|
-
{
|
|
4511
|
+
{ id, body, requestHeaders } = { requestHeaders: {} },
|
|
4512
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3079
4513
|
) {
|
|
3080
4514
|
const {
|
|
3081
4515
|
error,
|
|
@@ -3115,12 +4549,12 @@ class Communication {
|
|
|
3115
4549
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/campaigns/campaigns/${id}`,
|
|
3116
4550
|
query_params,
|
|
3117
4551
|
body,
|
|
3118
|
-
|
|
3119
|
-
{
|
|
4552
|
+
requestHeaders,
|
|
4553
|
+
{ responseHeaders }
|
|
3120
4554
|
);
|
|
3121
4555
|
|
|
3122
4556
|
let responseData = response;
|
|
3123
|
-
if (
|
|
4557
|
+
if (responseHeaders) {
|
|
3124
4558
|
responseData = response[0];
|
|
3125
4559
|
}
|
|
3126
4560
|
|
|
@@ -3145,6 +4579,7 @@ class Communication {
|
|
|
3145
4579
|
* @param {CommunicationPlatformApplicationValidator.UpdateEmailProviderByIdParam} arg
|
|
3146
4580
|
* - Arg object
|
|
3147
4581
|
*
|
|
4582
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
3148
4583
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
3149
4584
|
* @returns {Promise<CommunicationPlatformModel.EmailProvider>} - Success response
|
|
3150
4585
|
* @name updateEmailProviderById
|
|
@@ -3152,8 +4587,8 @@ class Communication {
|
|
|
3152
4587
|
* @description: Update email provider by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/updateEmailProviderById/).
|
|
3153
4588
|
*/
|
|
3154
4589
|
async updateEmailProviderById(
|
|
3155
|
-
{ id, body } = {},
|
|
3156
|
-
{
|
|
4590
|
+
{ id, body, requestHeaders } = { requestHeaders: {} },
|
|
4591
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3157
4592
|
) {
|
|
3158
4593
|
const {
|
|
3159
4594
|
error,
|
|
@@ -3193,12 +4628,12 @@ class Communication {
|
|
|
3193
4628
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/providers/${id}`,
|
|
3194
4629
|
query_params,
|
|
3195
4630
|
body,
|
|
3196
|
-
|
|
3197
|
-
{
|
|
4631
|
+
requestHeaders,
|
|
4632
|
+
{ responseHeaders }
|
|
3198
4633
|
);
|
|
3199
4634
|
|
|
3200
4635
|
let responseData = response;
|
|
3201
|
-
if (
|
|
4636
|
+
if (responseHeaders) {
|
|
3202
4637
|
responseData = response[0];
|
|
3203
4638
|
}
|
|
3204
4639
|
|
|
@@ -3223,15 +4658,16 @@ class Communication {
|
|
|
3223
4658
|
* @param {CommunicationPlatformApplicationValidator.UpdateEmailTemplateByIdParam} arg
|
|
3224
4659
|
* - Arg object
|
|
3225
4660
|
*
|
|
4661
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
3226
4662
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
3227
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
4663
|
+
* @returns {Promise<CommunicationPlatformModel.EmailTemplate>} - Success response
|
|
3228
4664
|
* @name updateEmailTemplateById
|
|
3229
4665
|
* @summary: Update email template by id
|
|
3230
|
-
* @description:
|
|
4666
|
+
* @description: Email templates are predefined formats linked to various events for delivering messages to users. Use this API to update an email template by id. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/updateEmailTemplateById/).
|
|
3231
4667
|
*/
|
|
3232
4668
|
async updateEmailTemplateById(
|
|
3233
|
-
{ id, body } = {},
|
|
3234
|
-
{
|
|
4669
|
+
{ id, body, requestHeaders } = { requestHeaders: {} },
|
|
4670
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3235
4671
|
) {
|
|
3236
4672
|
const {
|
|
3237
4673
|
error,
|
|
@@ -3271,18 +4707,18 @@ class Communication {
|
|
|
3271
4707
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/email/templates/${id}`,
|
|
3272
4708
|
query_params,
|
|
3273
4709
|
body,
|
|
3274
|
-
|
|
3275
|
-
{
|
|
4710
|
+
requestHeaders,
|
|
4711
|
+
{ responseHeaders }
|
|
3276
4712
|
);
|
|
3277
4713
|
|
|
3278
4714
|
let responseData = response;
|
|
3279
|
-
if (
|
|
4715
|
+
if (responseHeaders) {
|
|
3280
4716
|
responseData = response[0];
|
|
3281
4717
|
}
|
|
3282
4718
|
|
|
3283
4719
|
const {
|
|
3284
4720
|
error: res_error,
|
|
3285
|
-
} = CommunicationPlatformModel.
|
|
4721
|
+
} = CommunicationPlatformModel.EmailTemplate().validate(responseData, {
|
|
3286
4722
|
abortEarly: false,
|
|
3287
4723
|
allowUnknown: false,
|
|
3288
4724
|
});
|
|
@@ -3301,15 +4737,16 @@ class Communication {
|
|
|
3301
4737
|
* @param {CommunicationPlatformApplicationValidator.UpdateSmsProviderByIdParam} arg
|
|
3302
4738
|
* - Arg object
|
|
3303
4739
|
*
|
|
4740
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
3304
4741
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
3305
|
-
* @returns {Promise<
|
|
4742
|
+
* @returns {Promise<Object>} - Success response
|
|
3306
4743
|
* @name updateSmsProviderById
|
|
3307
4744
|
* @summary: Update sms provider by id
|
|
3308
4745
|
* @description: Update sms provider by id - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/updateSmsProviderById/).
|
|
3309
4746
|
*/
|
|
3310
4747
|
async updateSmsProviderById(
|
|
3311
|
-
{ id, body } = {},
|
|
3312
|
-
{
|
|
4748
|
+
{ id, body, requestHeaders } = { requestHeaders: {} },
|
|
4749
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3313
4750
|
) {
|
|
3314
4751
|
const {
|
|
3315
4752
|
error,
|
|
@@ -3349,18 +4786,16 @@ class Communication {
|
|
|
3349
4786
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/providers/${id}`,
|
|
3350
4787
|
query_params,
|
|
3351
4788
|
body,
|
|
3352
|
-
|
|
3353
|
-
{
|
|
4789
|
+
requestHeaders,
|
|
4790
|
+
{ responseHeaders }
|
|
3354
4791
|
);
|
|
3355
4792
|
|
|
3356
4793
|
let responseData = response;
|
|
3357
|
-
if (
|
|
4794
|
+
if (responseHeaders) {
|
|
3358
4795
|
responseData = response[0];
|
|
3359
4796
|
}
|
|
3360
4797
|
|
|
3361
|
-
const {
|
|
3362
|
-
error: res_error,
|
|
3363
|
-
} = CommunicationPlatformModel.SmsProvider().validate(responseData, {
|
|
4798
|
+
const { error: res_error } = Joi.any().validate(responseData, {
|
|
3364
4799
|
abortEarly: false,
|
|
3365
4800
|
allowUnknown: false,
|
|
3366
4801
|
});
|
|
@@ -3379,15 +4814,16 @@ class Communication {
|
|
|
3379
4814
|
* @param {CommunicationPlatformApplicationValidator.UpdateSmsTemplateByIdParam} arg
|
|
3380
4815
|
* - Arg object
|
|
3381
4816
|
*
|
|
4817
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
3382
4818
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
3383
|
-
* @returns {Promise<CommunicationPlatformModel.
|
|
4819
|
+
* @returns {Promise<CommunicationPlatformModel.SmsTemplate>} - Success response
|
|
3384
4820
|
* @name updateSmsTemplateById
|
|
3385
4821
|
* @summary: Update sms template by id
|
|
3386
|
-
* @description:
|
|
4822
|
+
* @description: SMS templates are predefined message formats linked to various events for delivering messages to users. Use this API to update an sms template by ID. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/updateSmsTemplateById/).
|
|
3387
4823
|
*/
|
|
3388
4824
|
async updateSmsTemplateById(
|
|
3389
|
-
{ id, body } = {},
|
|
3390
|
-
{
|
|
4825
|
+
{ id, body, requestHeaders } = { requestHeaders: {} },
|
|
4826
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
3391
4827
|
) {
|
|
3392
4828
|
const {
|
|
3393
4829
|
error,
|
|
@@ -3427,18 +4863,18 @@ class Communication {
|
|
|
3427
4863
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/sms/templates/${id}`,
|
|
3428
4864
|
query_params,
|
|
3429
4865
|
body,
|
|
3430
|
-
|
|
3431
|
-
{
|
|
4866
|
+
requestHeaders,
|
|
4867
|
+
{ responseHeaders }
|
|
3432
4868
|
);
|
|
3433
4869
|
|
|
3434
4870
|
let responseData = response;
|
|
3435
|
-
if (
|
|
4871
|
+
if (responseHeaders) {
|
|
3436
4872
|
responseData = response[0];
|
|
3437
4873
|
}
|
|
3438
4874
|
|
|
3439
4875
|
const {
|
|
3440
4876
|
error: res_error,
|
|
3441
|
-
} = CommunicationPlatformModel.
|
|
4877
|
+
} = CommunicationPlatformModel.SmsTemplate().validate(responseData, {
|
|
3442
4878
|
abortEarly: false,
|
|
3443
4879
|
allowUnknown: false,
|
|
3444
4880
|
});
|
|
@@ -3455,6 +4891,7 @@ class Communication {
|
|
|
3455
4891
|
|
|
3456
4892
|
/**
|
|
3457
4893
|
* @param {CommunicationPlatformApplicationValidator.VerfiyOtpParam} arg - Arg object
|
|
4894
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
3458
4895
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
3459
4896
|
* @returns {Promise<CommunicationPlatformModel.VerifyOtpCommsSuccessRes>}
|
|
3460
4897
|
* - Success response
|
|
@@ -3463,7 +4900,10 @@ class Communication {
|
|
|
3463
4900
|
* @summary: Verify OTP sent via email and sms
|
|
3464
4901
|
* @description: Verify OTP sent via email and sms - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/communication/verfiyOtp/).
|
|
3465
4902
|
*/
|
|
3466
|
-
async verfiyOtp(
|
|
4903
|
+
async verfiyOtp(
|
|
4904
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
4905
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
4906
|
+
) {
|
|
3467
4907
|
const {
|
|
3468
4908
|
error,
|
|
3469
4909
|
} = CommunicationPlatformApplicationValidator.verfiyOtp().validate(
|
|
@@ -3500,12 +4940,12 @@ class Communication {
|
|
|
3500
4940
|
`/service/platform/communication/v1.0/company/${this.config.companyId}/application/${this.applicationId}/otp/verify-otp-comms`,
|
|
3501
4941
|
query_params,
|
|
3502
4942
|
body,
|
|
3503
|
-
|
|
3504
|
-
{
|
|
4943
|
+
requestHeaders,
|
|
4944
|
+
{ responseHeaders }
|
|
3505
4945
|
);
|
|
3506
4946
|
|
|
3507
4947
|
let responseData = response;
|
|
3508
|
-
if (
|
|
4948
|
+
if (responseHeaders) {
|
|
3509
4949
|
responseData = response[0];
|
|
3510
4950
|
}
|
|
3511
4951
|
|