@gofynd/fdk-client-javascript 1.4.15-beta.1 → 1.4.15-beta.11
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 +2 -2
- package/application.d.ts +1 -2
- package/application.js +2 -3
- package/index.d.ts +1 -2
- package/index.js +7 -1
- package/package.json +3 -4
- package/sdk/application/ApplicationClient.js +0 -18
- package/sdk/application/Cart/CartApplicationClient.d.ts +55 -90
- package/sdk/application/Cart/CartApplicationClient.js +60 -1185
- package/sdk/application/Catalog/CatalogApplicationClient.d.ts +90 -142
- package/sdk/application/Catalog/CatalogApplicationClient.js +187 -1293
- package/sdk/application/Common/CommonApplicationClient.d.ts +4 -8
- package/sdk/application/Common/CommonApplicationClient.js +5 -89
- package/sdk/application/Communication/CommunicationApplicationClient.d.ts +6 -19
- package/sdk/application/Communication/CommunicationApplicationClient.js +6 -145
- package/sdk/application/Configuration/ConfigurationApplicationClient.d.ts +32 -73
- package/sdk/application/Configuration/ConfigurationApplicationClient.js +31 -718
- package/sdk/application/Content/ContentApplicationClient.d.ts +46 -78
- package/sdk/application/Content/ContentApplicationClient.js +77 -914
- package/sdk/application/FileStorage/FileStorageApplicationClient.d.ts +6 -11
- package/sdk/application/FileStorage/FileStorageApplicationClient.js +19 -125
- package/sdk/application/Lead/LeadApplicationClient.d.ts +10 -18
- package/sdk/application/Lead/LeadApplicationClient.js +32 -202
- package/sdk/application/Logistic/LogisticApplicationClient.d.ts +22 -39
- package/sdk/application/Logistic/LogisticApplicationClient.js +50 -478
- package/sdk/application/Order/OrderApplicationClient.d.ts +22 -42
- package/sdk/application/Order/OrderApplicationClient.js +86 -472
- package/sdk/application/Payment/PaymentApplicationClient.d.ts +92 -212
- package/sdk/application/Payment/PaymentApplicationClient.js +57 -2102
- package/sdk/application/Rewards/RewardsApplicationClient.d.ts +14 -28
- package/sdk/application/Rewards/RewardsApplicationClient.js +16 -305
- package/sdk/application/Share/ShareApplicationClient.d.ts +14 -24
- package/sdk/application/Share/ShareApplicationClient.js +34 -294
- package/sdk/application/Theme/ThemeApplicationClient.d.ts +8 -14
- package/sdk/application/Theme/ThemeApplicationClient.js +28 -162
- package/sdk/application/User/UserApplicationClient.d.ts +85 -136
- package/sdk/application/User/UserApplicationClient.js +45 -1815
- package/sdk/application/Webhook/WebhookApplicationClient.d.ts +2 -5
- package/sdk/application/Webhook/WebhookApplicationClient.js +4 -47
- package/sdk/application/index.d.ts +0 -18
- package/sdk/application/index.js +0 -33
- package/sdk/common/Utility.d.ts +1 -1
- package/sdk/common/Utility.js +10 -7
- package/sdk/common/Validator.d.ts +1 -0
- package/sdk/common/Validator.js +20 -0
- package/sdk/common/utils.d.ts +0 -1
- package/sdk/common/utils.js +0 -14
- package/sdk/partner/OAuthClient.js +1 -0
- package/sdk/partner/Theme/ThemePartnerModel.d.ts +3 -40
- package/sdk/partner/Theme/ThemePartnerModel.js +2 -24
- package/sdk/platform/Cart/CartPlatformApplicationClient.d.ts +39 -1
- package/sdk/platform/Cart/CartPlatformApplicationClient.js +247 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.d.ts +33 -1
- package/sdk/platform/Cart/CartPlatformApplicationValidator.js +37 -0
- package/sdk/platform/Cart/CartPlatformModel.d.ts +193 -1
- package/sdk/platform/Cart/CartPlatformModel.js +132 -0
- package/sdk/platform/Catalog/CatalogPlatformModel.d.ts +0 -7
- package/sdk/platform/Catalog/CatalogPlatformModel.js +1 -4
- package/sdk/platform/Configuration/ConfigurationPlatformModel.d.ts +14 -0
- package/sdk/platform/Configuration/ConfigurationPlatformModel.js +6 -0
- package/sdk/platform/Order/OrderPlatformApplicationClient.d.ts +0 -10
- package/sdk/platform/Order/OrderPlatformApplicationClient.js +0 -92
- package/sdk/platform/Order/OrderPlatformApplicationValidator.d.ts +1 -28
- package/sdk/platform/Order/OrderPlatformApplicationValidator.js +0 -18
- package/sdk/platform/Order/OrderPlatformClient.d.ts +10 -0
- package/sdk/platform/Order/OrderPlatformClient.js +99 -0
- package/sdk/platform/Order/OrderPlatformModel.d.ts +7 -0
- package/sdk/platform/Order/OrderPlatformModel.js +3 -0
- package/sdk/platform/Order/OrderPlatformValidator.d.ts +33 -1
- package/sdk/platform/Order/OrderPlatformValidator.js +20 -0
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.d.ts +1 -1
- package/sdk/platform/Serviceability/ServiceabilityPlatformClient.js +4 -4
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.d.ts +56 -19
- package/sdk/platform/Serviceability/ServiceabilityPlatformModel.js +42 -18
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.d.ts +3 -3
- package/sdk/platform/Serviceability/ServiceabilityPlatformValidator.js +2 -2
- package/sdk/platform/Theme/ThemePlatformModel.d.ts +3 -40
- package/sdk/platform/Theme/ThemePlatformModel.js +2 -24
- package/sdk/public/Configuration/ConfigurationPublicClient.js +5 -2
- package/sdk/public/Content/ContentPublicClient.d.ts +1 -1
- package/sdk/public/Content/ContentPublicClient.js +14 -2
- package/sdk/public/Partner/PartnerPublicClient.d.ts +1 -1
- package/sdk/public/Partner/PartnerPublicClient.js +14 -2
- package/sdk/public/Webhook/WebhookPublicClient.js +5 -2
- package/sdk/application/Cart/CartApplicationModel.d.ts +0 -3994
- package/sdk/application/Cart/CartApplicationModel.js +0 -2497
- package/sdk/application/Cart/CartApplicationValidator.d.ts +0 -769
- package/sdk/application/Cart/CartApplicationValidator.js +0 -530
- package/sdk/application/Catalog/CatalogApplicationModel.d.ts +0 -3857
- package/sdk/application/Catalog/CatalogApplicationModel.js +0 -2629
- package/sdk/application/Catalog/CatalogApplicationValidator.d.ts +0 -791
- package/sdk/application/Catalog/CatalogApplicationValidator.js +0 -551
- package/sdk/application/Common/CommonApplicationModel.d.ts +0 -449
- package/sdk/application/Common/CommonApplicationModel.js +0 -308
- package/sdk/application/Common/CommonApplicationValidator.d.ts +0 -46
- package/sdk/application/Common/CommonApplicationValidator.js +0 -38
- package/sdk/application/Communication/CommunicationApplicationModel.d.ts +0 -293
- package/sdk/application/Communication/CommunicationApplicationModel.js +0 -201
- package/sdk/application/Communication/CommunicationApplicationValidator.d.ts +0 -29
- package/sdk/application/Communication/CommunicationApplicationValidator.js +0 -38
- package/sdk/application/Configuration/ConfigurationApplicationModel.d.ts +0 -2556
- package/sdk/application/Configuration/ConfigurationApplicationModel.js +0 -1887
- package/sdk/application/Configuration/ConfigurationApplicationValidator.d.ts +0 -179
- package/sdk/application/Configuration/ConfigurationApplicationValidator.js +0 -176
- package/sdk/application/Content/ContentApplicationModel.d.ts +0 -2133
- package/sdk/application/Content/ContentApplicationModel.js +0 -1589
- package/sdk/application/Content/ContentApplicationValidator.d.ts +0 -284
- package/sdk/application/Content/ContentApplicationValidator.js +0 -264
- package/sdk/application/FileStorage/FileStorageApplicationModel.d.ts +0 -272
- package/sdk/application/FileStorage/FileStorageApplicationModel.js +0 -190
- package/sdk/application/FileStorage/FileStorageApplicationValidator.d.ts +0 -56
- package/sdk/application/FileStorage/FileStorageApplicationValidator.js +0 -53
- package/sdk/application/Lead/LeadApplicationModel.d.ts +0 -590
- package/sdk/application/Lead/LeadApplicationModel.js +0 -480
- package/sdk/application/Lead/LeadApplicationValidator.d.ts +0 -68
- package/sdk/application/Lead/LeadApplicationValidator.js +0 -71
- package/sdk/application/Logistic/LogisticApplicationModel.d.ts +0 -1675
- package/sdk/application/Logistic/LogisticApplicationModel.js +0 -1121
- package/sdk/application/Logistic/LogisticApplicationValidator.d.ts +0 -254
- package/sdk/application/Logistic/LogisticApplicationValidator.js +0 -190
- package/sdk/application/Order/OrderApplicationModel.d.ts +0 -2296
- package/sdk/application/Order/OrderApplicationModel.js +0 -1471
- package/sdk/application/Order/OrderApplicationValidator.d.ts +0 -265
- package/sdk/application/Order/OrderApplicationValidator.js +0 -197
- package/sdk/application/Payment/PaymentApplicationModel.d.ts +0 -4058
- package/sdk/application/Payment/PaymentApplicationModel.js +0 -2630
- package/sdk/application/Payment/PaymentApplicationValidator.d.ts +0 -576
- package/sdk/application/Payment/PaymentApplicationValidator.js +0 -594
- package/sdk/application/Rewards/RewardsApplicationModel.d.ts +0 -365
- package/sdk/application/Rewards/RewardsApplicationModel.js +0 -396
- package/sdk/application/Rewards/RewardsApplicationValidator.d.ts +0 -73
- package/sdk/application/Rewards/RewardsApplicationValidator.js +0 -84
- package/sdk/application/Share/ShareApplicationModel.d.ts +0 -339
- package/sdk/application/Share/ShareApplicationModel.js +0 -234
- package/sdk/application/Share/ShareApplicationValidator.d.ts +0 -90
- package/sdk/application/Share/ShareApplicationValidator.js +0 -91
- package/sdk/application/Theme/ThemeApplicationModel.d.ts +0 -1713
- package/sdk/application/Theme/ThemeApplicationModel.js +0 -1426
- package/sdk/application/Theme/ThemeApplicationValidator.d.ts +0 -66
- package/sdk/application/Theme/ThemeApplicationValidator.js +0 -58
- package/sdk/application/User/UserApplicationModel.d.ts +0 -1943
- package/sdk/application/User/UserApplicationModel.js +0 -1382
- package/sdk/application/User/UserApplicationValidator.d.ts +0 -560
- package/sdk/application/User/UserApplicationValidator.js +0 -573
- package/sdk/application/Webhook/WebhookApplicationModel.d.ts +0 -52
- package/sdk/application/Webhook/WebhookApplicationModel.js +0 -46
- package/sdk/application/Webhook/WebhookApplicationValidator.d.ts +0 -16
- package/sdk/application/Webhook/WebhookApplicationValidator.js +0 -19
- package/sdk/common/Clickstream.d.ts +0 -1
- package/sdk/common/Clickstream.js +0 -464
|
@@ -9,25 +9,21 @@ declare class Common {
|
|
|
9
9
|
_urls: {};
|
|
10
10
|
updateUrls(urls: any): void;
|
|
11
11
|
/**
|
|
12
|
-
* @param {CommonApplicationValidator.GetLocationsParam} arg - Arg object.
|
|
13
12
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
14
13
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
15
|
-
* @returns {Promise<
|
|
14
|
+
* @returns {Promise<Locations>} - Success response
|
|
16
15
|
* @name getLocations
|
|
17
16
|
* @summary: Get a location
|
|
18
17
|
* @description: Get countries , state , cities data associated with the sales channel. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/common/getLocations/).
|
|
19
18
|
*/
|
|
20
|
-
getLocations({ locationType, id, requestHeaders }?:
|
|
19
|
+
getLocations({ locationType, id, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<Locations>;
|
|
21
20
|
/**
|
|
22
|
-
* @param {CommonApplicationValidator.SearchApplicationParam} arg - Arg object.
|
|
23
21
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
24
22
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
25
|
-
* @returns {Promise<
|
|
23
|
+
* @returns {Promise<ApplicationResponse>} - Success response
|
|
26
24
|
* @name searchApplication
|
|
27
25
|
* @summary: Get sales channel
|
|
28
26
|
* @description: Get an active sales channel based on a provided query. The query can be a valid sales channel ID or a verified domain name. If the sales channel is found, a success response is returned. If not, a 404 error response is returned. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/common/searchApplication/).
|
|
29
27
|
*/
|
|
30
|
-
searchApplication({ authorization, query, requestHeaders }?:
|
|
28
|
+
searchApplication({ authorization, query, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<ApplicationResponse>;
|
|
31
29
|
}
|
|
32
|
-
import CommonApplicationValidator = require("./CommonApplicationValidator");
|
|
33
|
-
import CommonApplicationModel = require("./CommonApplicationModel");
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
const ApplicationAPIClient = require("../ApplicationAPIClient");
|
|
2
1
|
const {
|
|
3
2
|
FDKClientValidationError,
|
|
4
3
|
FDKResponseValidationError,
|
|
5
4
|
} = require("../../common/FDKError");
|
|
5
|
+
|
|
6
|
+
const ApplicationAPIClient = require("../ApplicationAPIClient");
|
|
6
7
|
const constructUrl = require("../constructUrl");
|
|
7
8
|
const Paginator = require("../../common/Paginator");
|
|
8
|
-
const
|
|
9
|
-
const CommonApplicationModel = require("./CommonApplicationModel");
|
|
10
|
-
const { Logger } = require("./../../common/Logger");
|
|
11
|
-
const Joi = require("joi");
|
|
9
|
+
const { validateRequiredParams } = require("../../common/Validator");
|
|
12
10
|
|
|
13
11
|
class Common {
|
|
14
12
|
constructor(_conf) {
|
|
@@ -35,10 +33,9 @@ class Common {
|
|
|
35
33
|
}
|
|
36
34
|
|
|
37
35
|
/**
|
|
38
|
-
* @param {CommonApplicationValidator.GetLocationsParam} arg - Arg object.
|
|
39
36
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
40
37
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
41
|
-
* @returns {Promise<
|
|
38
|
+
* @returns {Promise<Locations>} - Success response
|
|
42
39
|
* @name getLocations
|
|
43
40
|
* @summary: Get a location
|
|
44
41
|
* @description: Get countries , state , cities data associated with the sales channel. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/common/getLocations/).
|
|
@@ -47,28 +44,6 @@ class Common {
|
|
|
47
44
|
{ locationType, id, requestHeaders } = { requestHeaders: {} },
|
|
48
45
|
{ responseHeaders } = { responseHeaders: false }
|
|
49
46
|
) {
|
|
50
|
-
const { error } = CommonApplicationValidator.getLocations().validate(
|
|
51
|
-
{ locationType, id },
|
|
52
|
-
{ abortEarly: false, allowUnknown: true }
|
|
53
|
-
);
|
|
54
|
-
if (error) {
|
|
55
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
// Showing warrnings if extra unknown parameters are found
|
|
59
|
-
const {
|
|
60
|
-
error: warrning,
|
|
61
|
-
} = CommonApplicationValidator.getLocations().validate(
|
|
62
|
-
{ locationType, id },
|
|
63
|
-
{ abortEarly: false, allowUnknown: false }
|
|
64
|
-
);
|
|
65
|
-
if (warrning) {
|
|
66
|
-
Logger({
|
|
67
|
-
level: "WARN",
|
|
68
|
-
message: `Parameter Validation warrnings for application > Common > getLocations \n ${warrning}`,
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
47
|
const query_params = {};
|
|
73
48
|
query_params["location_type"] = locationType;
|
|
74
49
|
query_params["id"] = id;
|
|
@@ -93,32 +68,13 @@ class Common {
|
|
|
93
68
|
responseData = response[0];
|
|
94
69
|
}
|
|
95
70
|
|
|
96
|
-
const {
|
|
97
|
-
error: res_error,
|
|
98
|
-
} = CommonApplicationModel.Locations().validate(responseData, {
|
|
99
|
-
abortEarly: false,
|
|
100
|
-
allowUnknown: true,
|
|
101
|
-
});
|
|
102
|
-
|
|
103
|
-
if (res_error) {
|
|
104
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
105
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
106
|
-
} else {
|
|
107
|
-
Logger({
|
|
108
|
-
level: "WARN",
|
|
109
|
-
message: `Response Validation Warnings for application > Common > getLocations \n ${res_error}`,
|
|
110
|
-
});
|
|
111
|
-
}
|
|
112
|
-
}
|
|
113
|
-
|
|
114
71
|
return response;
|
|
115
72
|
}
|
|
116
73
|
|
|
117
74
|
/**
|
|
118
|
-
* @param {CommonApplicationValidator.SearchApplicationParam} arg - Arg object.
|
|
119
75
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
120
76
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
121
|
-
* @returns {Promise<
|
|
77
|
+
* @returns {Promise<ApplicationResponse>} - Success response
|
|
122
78
|
* @name searchApplication
|
|
123
79
|
* @summary: Get sales channel
|
|
124
80
|
* @description: Get an active sales channel based on a provided query. The query can be a valid sales channel ID or a verified domain name. If the sales channel is found, a success response is returned. If not, a 404 error response is returned. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/common/searchApplication/).
|
|
@@ -127,28 +83,6 @@ class Common {
|
|
|
127
83
|
{ authorization, query, requestHeaders } = { requestHeaders: {} },
|
|
128
84
|
{ responseHeaders } = { responseHeaders: false }
|
|
129
85
|
) {
|
|
130
|
-
const { error } = CommonApplicationValidator.searchApplication().validate(
|
|
131
|
-
{ authorization, query },
|
|
132
|
-
{ abortEarly: false, allowUnknown: true }
|
|
133
|
-
);
|
|
134
|
-
if (error) {
|
|
135
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
136
|
-
}
|
|
137
|
-
|
|
138
|
-
// Showing warrnings if extra unknown parameters are found
|
|
139
|
-
const {
|
|
140
|
-
error: warrning,
|
|
141
|
-
} = CommonApplicationValidator.searchApplication().validate(
|
|
142
|
-
{ authorization, query },
|
|
143
|
-
{ abortEarly: false, allowUnknown: false }
|
|
144
|
-
);
|
|
145
|
-
if (warrning) {
|
|
146
|
-
Logger({
|
|
147
|
-
level: "WARN",
|
|
148
|
-
message: `Parameter Validation warrnings for application > Common > searchApplication \n ${warrning}`,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
|
|
152
86
|
const query_params = {};
|
|
153
87
|
query_params["query"] = query;
|
|
154
88
|
|
|
@@ -173,24 +107,6 @@ class Common {
|
|
|
173
107
|
responseData = response[0];
|
|
174
108
|
}
|
|
175
109
|
|
|
176
|
-
const {
|
|
177
|
-
error: res_error,
|
|
178
|
-
} = CommonApplicationModel.ApplicationResponse().validate(responseData, {
|
|
179
|
-
abortEarly: false,
|
|
180
|
-
allowUnknown: true,
|
|
181
|
-
});
|
|
182
|
-
|
|
183
|
-
if (res_error) {
|
|
184
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
185
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
186
|
-
} else {
|
|
187
|
-
Logger({
|
|
188
|
-
level: "WARN",
|
|
189
|
-
message: `Response Validation Warnings for application > Common > searchApplication \n ${res_error}`,
|
|
190
|
-
});
|
|
191
|
-
}
|
|
192
|
-
}
|
|
193
|
-
|
|
194
110
|
return response;
|
|
195
111
|
}
|
|
196
112
|
}
|
|
@@ -10,43 +10,30 @@ declare class Communication {
|
|
|
10
10
|
_urls: {};
|
|
11
11
|
updateUrls(urls: any): void;
|
|
12
12
|
/**
|
|
13
|
-
* @param {CommunicationApplicationValidator.GetCommunicationConsentParam} arg
|
|
14
|
-
* - Arg object.
|
|
15
|
-
*
|
|
16
13
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
17
14
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
18
|
-
* @returns {Promise<
|
|
19
|
-
* Success response
|
|
15
|
+
* @returns {Promise<CommunicationConsent>} - Success response
|
|
20
16
|
* @name getCommunicationConsent
|
|
21
17
|
* @summary: Retrieve consent status
|
|
22
18
|
* @description: Get the consent provided by the user for receiving communication. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/communication/getCommunicationConsent/).
|
|
23
19
|
*/
|
|
24
|
-
getCommunicationConsent({ requestHeaders }?:
|
|
20
|
+
getCommunicationConsent({ requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<CommunicationConsent>;
|
|
25
21
|
/**
|
|
26
|
-
* @param {CommunicationApplicationValidator.UpsertAppPushtokenParam} arg -
|
|
27
|
-
* Arg object.
|
|
28
22
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
29
23
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
30
|
-
* @returns {Promise<
|
|
24
|
+
* @returns {Promise<PushtokenRes>} - Success response
|
|
31
25
|
* @name upsertAppPushtoken
|
|
32
26
|
* @summary: Update or adds app push token
|
|
33
27
|
* @description: Update or inserts the push token of the user. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/communication/upsertAppPushtoken/).
|
|
34
28
|
*/
|
|
35
|
-
upsertAppPushtoken({ body, requestHeaders }?:
|
|
29
|
+
upsertAppPushtoken({ body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<PushtokenRes>;
|
|
36
30
|
/**
|
|
37
|
-
* @param {CommunicationApplicationValidator.UpsertCommunicationConsentParam} arg
|
|
38
|
-
* - Arg object.
|
|
39
|
-
*
|
|
40
31
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
41
32
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
42
|
-
* @returns {Promise<
|
|
43
|
-
* - Success response
|
|
44
|
-
*
|
|
33
|
+
* @returns {Promise<CommunicationConsentRes>} - Success response
|
|
45
34
|
* @name upsertCommunicationConsent
|
|
46
35
|
* @summary: Update or adds consent settings
|
|
47
36
|
* @description: Update or insert the consent provided by the user for receiving communication messages. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/communication/upsertCommunicationConsent/).
|
|
48
37
|
*/
|
|
49
|
-
upsertCommunicationConsent({ body, requestHeaders }?:
|
|
38
|
+
upsertCommunicationConsent({ body, requestHeaders }?: object, { responseHeaders }?: import("../ApplicationAPIClient").Options): Promise<CommunicationConsentRes>;
|
|
50
39
|
}
|
|
51
|
-
import CommunicationApplicationModel = require("./CommunicationApplicationModel");
|
|
52
|
-
import CommunicationApplicationValidator = require("./CommunicationApplicationValidator");
|
|
@@ -1,14 +1,12 @@
|
|
|
1
|
-
const ApplicationAPIClient = require("../ApplicationAPIClient");
|
|
2
1
|
const {
|
|
3
2
|
FDKClientValidationError,
|
|
4
3
|
FDKResponseValidationError,
|
|
5
4
|
} = require("../../common/FDKError");
|
|
5
|
+
|
|
6
|
+
const ApplicationAPIClient = require("../ApplicationAPIClient");
|
|
6
7
|
const constructUrl = require("../constructUrl");
|
|
7
8
|
const Paginator = require("../../common/Paginator");
|
|
8
|
-
const
|
|
9
|
-
const CommunicationApplicationModel = require("./CommunicationApplicationModel");
|
|
10
|
-
const { Logger } = require("./../../common/Logger");
|
|
11
|
-
const Joi = require("joi");
|
|
9
|
+
const { validateRequiredParams } = require("../../common/Validator");
|
|
12
10
|
|
|
13
11
|
class Communication {
|
|
14
12
|
constructor(_conf) {
|
|
@@ -37,13 +35,9 @@ class Communication {
|
|
|
37
35
|
}
|
|
38
36
|
|
|
39
37
|
/**
|
|
40
|
-
* @param {CommunicationApplicationValidator.GetCommunicationConsentParam} arg
|
|
41
|
-
* - Arg object.
|
|
42
|
-
*
|
|
43
38
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
44
39
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
45
|
-
* @returns {Promise<
|
|
46
|
-
* Success response
|
|
40
|
+
* @returns {Promise<CommunicationConsent>} - Success response
|
|
47
41
|
* @name getCommunicationConsent
|
|
48
42
|
* @summary: Retrieve consent status
|
|
49
43
|
* @description: Get the consent provided by the user for receiving communication. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/communication/getCommunicationConsent/).
|
|
@@ -52,30 +46,6 @@ class Communication {
|
|
|
52
46
|
{ requestHeaders } = { requestHeaders: {} },
|
|
53
47
|
{ responseHeaders } = { responseHeaders: false }
|
|
54
48
|
) {
|
|
55
|
-
const {
|
|
56
|
-
error,
|
|
57
|
-
} = CommunicationApplicationValidator.getCommunicationConsent().validate(
|
|
58
|
-
{},
|
|
59
|
-
{ abortEarly: false, allowUnknown: true }
|
|
60
|
-
);
|
|
61
|
-
if (error) {
|
|
62
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
63
|
-
}
|
|
64
|
-
|
|
65
|
-
// Showing warrnings if extra unknown parameters are found
|
|
66
|
-
const {
|
|
67
|
-
error: warrning,
|
|
68
|
-
} = CommunicationApplicationValidator.getCommunicationConsent().validate(
|
|
69
|
-
{},
|
|
70
|
-
{ abortEarly: false, allowUnknown: false }
|
|
71
|
-
);
|
|
72
|
-
if (warrning) {
|
|
73
|
-
Logger({
|
|
74
|
-
level: "WARN",
|
|
75
|
-
message: `Parameter Validation warrnings for application > Communication > getCommunicationConsent \n ${warrning}`,
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
49
|
const query_params = {};
|
|
80
50
|
|
|
81
51
|
const xHeaders = {};
|
|
@@ -98,33 +68,13 @@ class Communication {
|
|
|
98
68
|
responseData = response[0];
|
|
99
69
|
}
|
|
100
70
|
|
|
101
|
-
const {
|
|
102
|
-
error: res_error,
|
|
103
|
-
} = CommunicationApplicationModel.CommunicationConsent().validate(
|
|
104
|
-
responseData,
|
|
105
|
-
{ abortEarly: false, allowUnknown: true }
|
|
106
|
-
);
|
|
107
|
-
|
|
108
|
-
if (res_error) {
|
|
109
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
110
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
111
|
-
} else {
|
|
112
|
-
Logger({
|
|
113
|
-
level: "WARN",
|
|
114
|
-
message: `Response Validation Warnings for application > Communication > getCommunicationConsent \n ${res_error}`,
|
|
115
|
-
});
|
|
116
|
-
}
|
|
117
|
-
}
|
|
118
|
-
|
|
119
71
|
return response;
|
|
120
72
|
}
|
|
121
73
|
|
|
122
74
|
/**
|
|
123
|
-
* @param {CommunicationApplicationValidator.UpsertAppPushtokenParam} arg -
|
|
124
|
-
* Arg object.
|
|
125
75
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
126
76
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
127
|
-
* @returns {Promise<
|
|
77
|
+
* @returns {Promise<PushtokenRes>} - Success response
|
|
128
78
|
* @name upsertAppPushtoken
|
|
129
79
|
* @summary: Update or adds app push token
|
|
130
80
|
* @description: Update or inserts the push token of the user. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/communication/upsertAppPushtoken/).
|
|
@@ -133,30 +83,6 @@ class Communication {
|
|
|
133
83
|
{ body, requestHeaders } = { requestHeaders: {} },
|
|
134
84
|
{ responseHeaders } = { responseHeaders: false }
|
|
135
85
|
) {
|
|
136
|
-
const {
|
|
137
|
-
error,
|
|
138
|
-
} = CommunicationApplicationValidator.upsertAppPushtoken().validate(
|
|
139
|
-
{ body },
|
|
140
|
-
{ abortEarly: false, allowUnknown: true }
|
|
141
|
-
);
|
|
142
|
-
if (error) {
|
|
143
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
// Showing warrnings if extra unknown parameters are found
|
|
147
|
-
const {
|
|
148
|
-
error: warrning,
|
|
149
|
-
} = CommunicationApplicationValidator.upsertAppPushtoken().validate(
|
|
150
|
-
{ body },
|
|
151
|
-
{ abortEarly: false, allowUnknown: false }
|
|
152
|
-
);
|
|
153
|
-
if (warrning) {
|
|
154
|
-
Logger({
|
|
155
|
-
level: "WARN",
|
|
156
|
-
message: `Parameter Validation warrnings for application > Communication > upsertAppPushtoken \n ${warrning}`,
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
|
|
160
86
|
const query_params = {};
|
|
161
87
|
|
|
162
88
|
const xHeaders = {};
|
|
@@ -179,36 +105,13 @@ class Communication {
|
|
|
179
105
|
responseData = response[0];
|
|
180
106
|
}
|
|
181
107
|
|
|
182
|
-
const {
|
|
183
|
-
error: res_error,
|
|
184
|
-
} = CommunicationApplicationModel.PushtokenRes().validate(responseData, {
|
|
185
|
-
abortEarly: false,
|
|
186
|
-
allowUnknown: true,
|
|
187
|
-
});
|
|
188
|
-
|
|
189
|
-
if (res_error) {
|
|
190
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
191
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
192
|
-
} else {
|
|
193
|
-
Logger({
|
|
194
|
-
level: "WARN",
|
|
195
|
-
message: `Response Validation Warnings for application > Communication > upsertAppPushtoken \n ${res_error}`,
|
|
196
|
-
});
|
|
197
|
-
}
|
|
198
|
-
}
|
|
199
|
-
|
|
200
108
|
return response;
|
|
201
109
|
}
|
|
202
110
|
|
|
203
111
|
/**
|
|
204
|
-
* @param {CommunicationApplicationValidator.UpsertCommunicationConsentParam} arg
|
|
205
|
-
* - Arg object.
|
|
206
|
-
*
|
|
207
112
|
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
208
113
|
* @param {import("../ApplicationAPIClient").Options} - Options
|
|
209
|
-
* @returns {Promise<
|
|
210
|
-
* - Success response
|
|
211
|
-
*
|
|
114
|
+
* @returns {Promise<CommunicationConsentRes>} - Success response
|
|
212
115
|
* @name upsertCommunicationConsent
|
|
213
116
|
* @summary: Update or adds consent settings
|
|
214
117
|
* @description: Update or insert the consent provided by the user for receiving communication messages. - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/application/communication/upsertCommunicationConsent/).
|
|
@@ -217,30 +120,6 @@ class Communication {
|
|
|
217
120
|
{ body, requestHeaders } = { requestHeaders: {} },
|
|
218
121
|
{ responseHeaders } = { responseHeaders: false }
|
|
219
122
|
) {
|
|
220
|
-
const {
|
|
221
|
-
error,
|
|
222
|
-
} = CommunicationApplicationValidator.upsertCommunicationConsent().validate(
|
|
223
|
-
{ body },
|
|
224
|
-
{ abortEarly: false, allowUnknown: true }
|
|
225
|
-
);
|
|
226
|
-
if (error) {
|
|
227
|
-
return Promise.reject(new FDKClientValidationError(error));
|
|
228
|
-
}
|
|
229
|
-
|
|
230
|
-
// Showing warrnings if extra unknown parameters are found
|
|
231
|
-
const {
|
|
232
|
-
error: warrning,
|
|
233
|
-
} = CommunicationApplicationValidator.upsertCommunicationConsent().validate(
|
|
234
|
-
{ body },
|
|
235
|
-
{ abortEarly: false, allowUnknown: false }
|
|
236
|
-
);
|
|
237
|
-
if (warrning) {
|
|
238
|
-
Logger({
|
|
239
|
-
level: "WARN",
|
|
240
|
-
message: `Parameter Validation warrnings for application > Communication > upsertCommunicationConsent \n ${warrning}`,
|
|
241
|
-
});
|
|
242
|
-
}
|
|
243
|
-
|
|
244
123
|
const query_params = {};
|
|
245
124
|
|
|
246
125
|
const xHeaders = {};
|
|
@@ -263,24 +142,6 @@ class Communication {
|
|
|
263
142
|
responseData = response[0];
|
|
264
143
|
}
|
|
265
144
|
|
|
266
|
-
const {
|
|
267
|
-
error: res_error,
|
|
268
|
-
} = CommunicationApplicationModel.CommunicationConsentRes().validate(
|
|
269
|
-
responseData,
|
|
270
|
-
{ abortEarly: false, allowUnknown: true }
|
|
271
|
-
);
|
|
272
|
-
|
|
273
|
-
if (res_error) {
|
|
274
|
-
if (this._conf.options.strictResponseCheck === true) {
|
|
275
|
-
return Promise.reject(new FDKResponseValidationError(res_error));
|
|
276
|
-
} else {
|
|
277
|
-
Logger({
|
|
278
|
-
level: "WARN",
|
|
279
|
-
message: `Response Validation Warnings for application > Communication > upsertCommunicationConsent \n ${res_error}`,
|
|
280
|
-
});
|
|
281
|
-
}
|
|
282
|
-
}
|
|
283
|
-
|
|
284
145
|
return response;
|
|
285
146
|
}
|
|
286
147
|
}
|