@gofynd/fdk-client-javascript 1.2.0 → 1.3.1-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +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 +6 -4
- package/sdk/application/Cart/CartApplicationModel.js +6 -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 +90 -7
- package/sdk/platform/Webhook/WebhookPlatformValidator.js +113 -3
- 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
|
@@ -18,6 +18,7 @@ class FileStorage {
|
|
|
18
18
|
* @param {FileStoragePlatformApplicationValidator.AppCompleteUploadParam} arg
|
|
19
19
|
* - Arg object
|
|
20
20
|
*
|
|
21
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
21
22
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
22
23
|
* @returns {Promise<FileStoragePlatformModel.CompleteResponse>} - Success response
|
|
23
24
|
* @name appCompleteUpload
|
|
@@ -43,8 +44,8 @@ class FileStorage {
|
|
|
43
44
|
* - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/filestorage/appCompleteUpload/).
|
|
44
45
|
*/
|
|
45
46
|
async appCompleteUpload(
|
|
46
|
-
{ namespace, body } = {},
|
|
47
|
-
{
|
|
47
|
+
{ namespace, body, requestHeaders } = { requestHeaders: {} },
|
|
48
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
48
49
|
) {
|
|
49
50
|
const {
|
|
50
51
|
error,
|
|
@@ -83,15 +84,15 @@ class FileStorage {
|
|
|
83
84
|
const response = await PlatformAPIClient.execute(
|
|
84
85
|
this.config,
|
|
85
86
|
"post",
|
|
86
|
-
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/namespaces/${namespace}/upload/complete
|
|
87
|
+
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/namespaces/${namespace}/upload/complete`,
|
|
87
88
|
query_params,
|
|
88
89
|
body,
|
|
89
|
-
|
|
90
|
-
{
|
|
90
|
+
requestHeaders,
|
|
91
|
+
{ responseHeaders }
|
|
91
92
|
);
|
|
92
93
|
|
|
93
94
|
let responseData = response;
|
|
94
|
-
if (
|
|
95
|
+
if (responseHeaders) {
|
|
95
96
|
responseData = response[0];
|
|
96
97
|
}
|
|
97
98
|
|
|
@@ -114,13 +115,17 @@ class FileStorage {
|
|
|
114
115
|
|
|
115
116
|
/**
|
|
116
117
|
* @param {FileStoragePlatformApplicationValidator.AppCopyFilesParam} arg - Arg object
|
|
118
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
117
119
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
118
|
-
* @returns {Promise<FileStoragePlatformModel.
|
|
120
|
+
* @returns {Promise<FileStoragePlatformModel.BulkUploadSyncMode>} - Success response
|
|
119
121
|
* @name appCopyFiles
|
|
120
122
|
* @summary: Copy Files
|
|
121
123
|
* @description: Copy Files - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/filestorage/appCopyFiles/).
|
|
122
124
|
*/
|
|
123
|
-
async appCopyFiles(
|
|
125
|
+
async appCopyFiles(
|
|
126
|
+
{ body, sync, requestHeaders } = { requestHeaders: {} },
|
|
127
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
128
|
+
) {
|
|
124
129
|
const {
|
|
125
130
|
error,
|
|
126
131
|
} = FileStoragePlatformApplicationValidator.appCopyFiles().validate(
|
|
@@ -157,21 +162,21 @@ class FileStorage {
|
|
|
157
162
|
const response = await PlatformAPIClient.execute(
|
|
158
163
|
this.config,
|
|
159
164
|
"post",
|
|
160
|
-
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/uploads/copy
|
|
165
|
+
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/uploads/copy`,
|
|
161
166
|
query_params,
|
|
162
167
|
body,
|
|
163
|
-
|
|
164
|
-
{
|
|
168
|
+
requestHeaders,
|
|
169
|
+
{ responseHeaders }
|
|
165
170
|
);
|
|
166
171
|
|
|
167
172
|
let responseData = response;
|
|
168
|
-
if (
|
|
173
|
+
if (responseHeaders) {
|
|
169
174
|
responseData = response[0];
|
|
170
175
|
}
|
|
171
176
|
|
|
172
177
|
const {
|
|
173
178
|
error: res_error,
|
|
174
|
-
} = FileStoragePlatformModel.
|
|
179
|
+
} = FileStoragePlatformModel.BulkUploadSyncMode().validate(responseData, {
|
|
175
180
|
abortEarly: false,
|
|
176
181
|
allowUnknown: false,
|
|
177
182
|
});
|
|
@@ -190,6 +195,7 @@ class FileStorage {
|
|
|
190
195
|
* @param {FileStoragePlatformApplicationValidator.AppStartUploadParam} arg
|
|
191
196
|
* - Arg object
|
|
192
197
|
*
|
|
198
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
193
199
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
194
200
|
* @returns {Promise<FileStoragePlatformModel.StartResponse>} - Success response
|
|
195
201
|
* @name appStartUpload
|
|
@@ -215,8 +221,8 @@ class FileStorage {
|
|
|
215
221
|
* - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/filestorage/appStartUpload/).
|
|
216
222
|
*/
|
|
217
223
|
async appStartUpload(
|
|
218
|
-
{ namespace, body } = {},
|
|
219
|
-
{
|
|
224
|
+
{ namespace, body, requestHeaders } = { requestHeaders: {} },
|
|
225
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
220
226
|
) {
|
|
221
227
|
const {
|
|
222
228
|
error,
|
|
@@ -255,15 +261,15 @@ class FileStorage {
|
|
|
255
261
|
const response = await PlatformAPIClient.execute(
|
|
256
262
|
this.config,
|
|
257
263
|
"post",
|
|
258
|
-
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/namespaces/${namespace}/upload/start
|
|
264
|
+
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/namespaces/${namespace}/upload/start`,
|
|
259
265
|
query_params,
|
|
260
266
|
body,
|
|
261
|
-
|
|
262
|
-
{
|
|
267
|
+
requestHeaders,
|
|
268
|
+
{ responseHeaders }
|
|
263
269
|
);
|
|
264
270
|
|
|
265
271
|
let responseData = response;
|
|
266
|
-
if (
|
|
272
|
+
if (responseHeaders) {
|
|
267
273
|
responseData = response[0];
|
|
268
274
|
}
|
|
269
275
|
|
|
@@ -286,6 +292,7 @@ class FileStorage {
|
|
|
286
292
|
|
|
287
293
|
/**
|
|
288
294
|
* @param {FileStoragePlatformApplicationValidator.AppbrowseParam} arg - Arg object
|
|
295
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
289
296
|
* @param {import("../PlatformAPIClient").Options} - Options
|
|
290
297
|
* @returns {Promise<FileStoragePlatformModel.BrowseResponse>} - Success response
|
|
291
298
|
* @name appbrowse
|
|
@@ -293,8 +300,8 @@ class FileStorage {
|
|
|
293
300
|
* @description: Browse Files - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/filestorage/appbrowse/).
|
|
294
301
|
*/
|
|
295
302
|
async appbrowse(
|
|
296
|
-
{ namespace,
|
|
297
|
-
{
|
|
303
|
+
{ namespace, page, limit, requestHeaders } = { requestHeaders: {} },
|
|
304
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
298
305
|
) {
|
|
299
306
|
const {
|
|
300
307
|
error,
|
|
@@ -302,7 +309,8 @@ class FileStorage {
|
|
|
302
309
|
{
|
|
303
310
|
namespace,
|
|
304
311
|
|
|
305
|
-
|
|
312
|
+
page,
|
|
313
|
+
limit,
|
|
306
314
|
},
|
|
307
315
|
{ abortEarly: false, allowUnknown: true }
|
|
308
316
|
);
|
|
@@ -317,7 +325,8 @@ class FileStorage {
|
|
|
317
325
|
{
|
|
318
326
|
namespace,
|
|
319
327
|
|
|
320
|
-
|
|
328
|
+
page,
|
|
329
|
+
limit,
|
|
321
330
|
},
|
|
322
331
|
{ abortEarly: false, allowUnknown: false }
|
|
323
332
|
);
|
|
@@ -329,20 +338,21 @@ class FileStorage {
|
|
|
329
338
|
}
|
|
330
339
|
|
|
331
340
|
const query_params = {};
|
|
332
|
-
query_params["
|
|
341
|
+
query_params["page"] = page;
|
|
342
|
+
query_params["limit"] = limit;
|
|
333
343
|
|
|
334
344
|
const response = await PlatformAPIClient.execute(
|
|
335
345
|
this.config,
|
|
336
346
|
"get",
|
|
337
|
-
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/namespaces/${namespace}/browse
|
|
347
|
+
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/namespaces/${namespace}/browse`,
|
|
338
348
|
query_params,
|
|
339
349
|
undefined,
|
|
340
|
-
|
|
341
|
-
{
|
|
350
|
+
requestHeaders,
|
|
351
|
+
{ responseHeaders }
|
|
342
352
|
);
|
|
343
353
|
|
|
344
354
|
let responseData = response;
|
|
345
|
-
if (
|
|
355
|
+
if (responseHeaders) {
|
|
346
356
|
responseData = response[0];
|
|
347
357
|
}
|
|
348
358
|
|
|
@@ -364,34 +374,457 @@ class FileStorage {
|
|
|
364
374
|
}
|
|
365
375
|
|
|
366
376
|
/**
|
|
367
|
-
* @param {
|
|
368
|
-
*
|
|
369
|
-
*
|
|
370
|
-
* @param {
|
|
371
|
-
* @
|
|
372
|
-
* @
|
|
373
|
-
* @
|
|
377
|
+
* @param {FileStoragePlatformApplicationValidator.GetDefaultHtmlTemplateParam} arg
|
|
378
|
+
* - Arg object
|
|
379
|
+
*
|
|
380
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
381
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
382
|
+
* @returns {Promise<FileStoragePlatformModel.PdfConfigSuccess[]>} - Success response
|
|
383
|
+
* @name getDefaultHtmlTemplate
|
|
384
|
+
* @summary: Get html template for sales channel
|
|
385
|
+
* @description: Get default html template for invoice or label - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/filestorage/getDefaultHtmlTemplate/).
|
|
386
|
+
*/
|
|
387
|
+
async getDefaultHtmlTemplate(
|
|
388
|
+
{ pdfTypeId, format, requestHeaders } = { requestHeaders: {} },
|
|
389
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
390
|
+
) {
|
|
391
|
+
const {
|
|
392
|
+
error,
|
|
393
|
+
} = FileStoragePlatformApplicationValidator.getDefaultHtmlTemplate().validate(
|
|
394
|
+
{
|
|
395
|
+
pdfTypeId,
|
|
396
|
+
format,
|
|
397
|
+
},
|
|
398
|
+
{ abortEarly: false, allowUnknown: true }
|
|
399
|
+
);
|
|
400
|
+
if (error) {
|
|
401
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
402
|
+
}
|
|
403
|
+
|
|
404
|
+
// Showing warrnings if extra unknown parameters are found
|
|
405
|
+
const {
|
|
406
|
+
error: warrning,
|
|
407
|
+
} = FileStoragePlatformApplicationValidator.getDefaultHtmlTemplate().validate(
|
|
408
|
+
{
|
|
409
|
+
pdfTypeId,
|
|
410
|
+
format,
|
|
411
|
+
},
|
|
412
|
+
{ abortEarly: false, allowUnknown: false }
|
|
413
|
+
);
|
|
414
|
+
if (warrning) {
|
|
415
|
+
Logger({
|
|
416
|
+
level: "WARN",
|
|
417
|
+
message: `Parameter Validation warrnings for platform > FileStorage > getDefaultHtmlTemplate \n ${warrning}`,
|
|
418
|
+
});
|
|
419
|
+
}
|
|
420
|
+
|
|
421
|
+
const query_params = {};
|
|
422
|
+
query_params["pdf_type_id"] = pdfTypeId;
|
|
423
|
+
query_params["format"] = format;
|
|
424
|
+
|
|
425
|
+
const response = await PlatformAPIClient.execute(
|
|
426
|
+
this.config,
|
|
427
|
+
"get",
|
|
428
|
+
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pdf/config`,
|
|
429
|
+
query_params,
|
|
430
|
+
undefined,
|
|
431
|
+
requestHeaders,
|
|
432
|
+
{ responseHeaders }
|
|
433
|
+
);
|
|
434
|
+
|
|
435
|
+
let responseData = response;
|
|
436
|
+
if (responseHeaders) {
|
|
437
|
+
responseData = response[0];
|
|
438
|
+
}
|
|
439
|
+
|
|
440
|
+
const { error: res_error } = Joi.array()
|
|
441
|
+
.items(FileStoragePlatformModel.PdfConfigSuccess())
|
|
442
|
+
.validate(responseData, { abortEarly: false, allowUnknown: false });
|
|
443
|
+
|
|
444
|
+
if (res_error) {
|
|
445
|
+
Logger({
|
|
446
|
+
level: "WARN",
|
|
447
|
+
message: `Response Validation Warnnings for platform > FileStorage > getDefaultHtmlTemplate \n ${res_error}`,
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
|
|
451
|
+
return response;
|
|
452
|
+
}
|
|
453
|
+
|
|
454
|
+
/**
|
|
455
|
+
* @param {FileStoragePlatformApplicationValidator.GetDefaultPdfDataParam} arg
|
|
456
|
+
* - Arg object
|
|
457
|
+
*
|
|
458
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
459
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
460
|
+
* @returns {Promise<FileStoragePlatformModel.DummyTemplateDataItems[]>} -
|
|
461
|
+
* Success response
|
|
462
|
+
* @name getDefaultPdfData
|
|
463
|
+
* @summary: Get Dummy pdf data for invoice or label
|
|
464
|
+
* @description: Get Dummy pdf data for invoice or label - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/filestorage/getDefaultPdfData/).
|
|
465
|
+
*/
|
|
466
|
+
async getDefaultPdfData(
|
|
467
|
+
{ pdfTypeId, requestHeaders } = { requestHeaders: {} },
|
|
468
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
469
|
+
) {
|
|
470
|
+
const {
|
|
471
|
+
error,
|
|
472
|
+
} = FileStoragePlatformApplicationValidator.getDefaultPdfData().validate(
|
|
473
|
+
{
|
|
474
|
+
pdfTypeId,
|
|
475
|
+
},
|
|
476
|
+
{ abortEarly: false, allowUnknown: true }
|
|
477
|
+
);
|
|
478
|
+
if (error) {
|
|
479
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
480
|
+
}
|
|
481
|
+
|
|
482
|
+
// Showing warrnings if extra unknown parameters are found
|
|
483
|
+
const {
|
|
484
|
+
error: warrning,
|
|
485
|
+
} = FileStoragePlatformApplicationValidator.getDefaultPdfData().validate(
|
|
486
|
+
{
|
|
487
|
+
pdfTypeId,
|
|
488
|
+
},
|
|
489
|
+
{ abortEarly: false, allowUnknown: false }
|
|
490
|
+
);
|
|
491
|
+
if (warrning) {
|
|
492
|
+
Logger({
|
|
493
|
+
level: "WARN",
|
|
494
|
+
message: `Parameter Validation warrnings for platform > FileStorage > getDefaultPdfData \n ${warrning}`,
|
|
495
|
+
});
|
|
496
|
+
}
|
|
497
|
+
|
|
498
|
+
const query_params = {};
|
|
499
|
+
query_params["pdf_type_id"] = pdfTypeId;
|
|
500
|
+
|
|
501
|
+
const response = await PlatformAPIClient.execute(
|
|
502
|
+
this.config,
|
|
503
|
+
"get",
|
|
504
|
+
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pdf/mapper`,
|
|
505
|
+
query_params,
|
|
506
|
+
undefined,
|
|
507
|
+
requestHeaders,
|
|
508
|
+
{ responseHeaders }
|
|
509
|
+
);
|
|
510
|
+
|
|
511
|
+
let responseData = response;
|
|
512
|
+
if (responseHeaders) {
|
|
513
|
+
responseData = response[0];
|
|
514
|
+
}
|
|
515
|
+
|
|
516
|
+
const { error: res_error } = Joi.array()
|
|
517
|
+
.items(FileStoragePlatformModel.DummyTemplateDataItems())
|
|
518
|
+
.validate(responseData, { abortEarly: false, allowUnknown: false });
|
|
519
|
+
|
|
520
|
+
if (res_error) {
|
|
521
|
+
Logger({
|
|
522
|
+
level: "WARN",
|
|
523
|
+
message: `Response Validation Warnnings for platform > FileStorage > getDefaultPdfData \n ${res_error}`,
|
|
524
|
+
});
|
|
525
|
+
}
|
|
526
|
+
|
|
527
|
+
return response;
|
|
528
|
+
}
|
|
529
|
+
|
|
530
|
+
/**
|
|
531
|
+
* @param {FileStoragePlatformApplicationValidator.GetDefaultPdfTemplateParam} arg
|
|
532
|
+
* - Arg object
|
|
533
|
+
*
|
|
534
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
535
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
536
|
+
* @returns {Promise<
|
|
537
|
+
* FileStoragePlatformModel.PdfDefaultTemplateSuccess[]
|
|
538
|
+
* >}
|
|
539
|
+
* - Success response
|
|
540
|
+
*
|
|
541
|
+
* @name getDefaultPdfTemplate
|
|
542
|
+
* @summary: Default html template
|
|
543
|
+
* @description: Get default html template data for invoice or label - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/filestorage/getDefaultPdfTemplate/).
|
|
544
|
+
*/
|
|
545
|
+
async getDefaultPdfTemplate(
|
|
546
|
+
{ pdfTypeId, format, requestHeaders } = { requestHeaders: {} },
|
|
547
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
548
|
+
) {
|
|
549
|
+
const {
|
|
550
|
+
error,
|
|
551
|
+
} = FileStoragePlatformApplicationValidator.getDefaultPdfTemplate().validate(
|
|
552
|
+
{
|
|
553
|
+
pdfTypeId,
|
|
554
|
+
format,
|
|
555
|
+
},
|
|
556
|
+
{ abortEarly: false, allowUnknown: true }
|
|
557
|
+
);
|
|
558
|
+
if (error) {
|
|
559
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
560
|
+
}
|
|
561
|
+
|
|
562
|
+
// Showing warrnings if extra unknown parameters are found
|
|
563
|
+
const {
|
|
564
|
+
error: warrning,
|
|
565
|
+
} = FileStoragePlatformApplicationValidator.getDefaultPdfTemplate().validate(
|
|
566
|
+
{
|
|
567
|
+
pdfTypeId,
|
|
568
|
+
format,
|
|
569
|
+
},
|
|
570
|
+
{ abortEarly: false, allowUnknown: false }
|
|
571
|
+
);
|
|
572
|
+
if (warrning) {
|
|
573
|
+
Logger({
|
|
574
|
+
level: "WARN",
|
|
575
|
+
message: `Parameter Validation warrnings for platform > FileStorage > getDefaultPdfTemplate \n ${warrning}`,
|
|
576
|
+
});
|
|
577
|
+
}
|
|
578
|
+
|
|
579
|
+
const query_params = {};
|
|
580
|
+
query_params["pdf_type_id"] = pdfTypeId;
|
|
581
|
+
query_params["format"] = format;
|
|
582
|
+
|
|
583
|
+
const response = await PlatformAPIClient.execute(
|
|
584
|
+
this.config,
|
|
585
|
+
"get",
|
|
586
|
+
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pdf/default-template`,
|
|
587
|
+
query_params,
|
|
588
|
+
undefined,
|
|
589
|
+
requestHeaders,
|
|
590
|
+
{ responseHeaders }
|
|
591
|
+
);
|
|
592
|
+
|
|
593
|
+
let responseData = response;
|
|
594
|
+
if (responseHeaders) {
|
|
595
|
+
responseData = response[0];
|
|
596
|
+
}
|
|
597
|
+
|
|
598
|
+
const { error: res_error } = Joi.array()
|
|
599
|
+
.items(FileStoragePlatformModel.PdfDefaultTemplateSuccess())
|
|
600
|
+
.validate(responseData, { abortEarly: false, allowUnknown: false });
|
|
601
|
+
|
|
602
|
+
if (res_error) {
|
|
603
|
+
Logger({
|
|
604
|
+
level: "WARN",
|
|
605
|
+
message: `Response Validation Warnnings for platform > FileStorage > getDefaultPdfTemplate \n ${res_error}`,
|
|
606
|
+
});
|
|
607
|
+
}
|
|
608
|
+
|
|
609
|
+
return response;
|
|
610
|
+
}
|
|
611
|
+
|
|
612
|
+
/**
|
|
613
|
+
* @param {FileStoragePlatformApplicationValidator.GetPdfTypesParam} arg - Arg object
|
|
614
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
615
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
616
|
+
* @returns {Promise<FileStoragePlatformModel.InvoiceTypesResponse[]>} -
|
|
617
|
+
* Success response
|
|
618
|
+
* @name getPdfTypes
|
|
619
|
+
* @summary: Get all the supported invoice pdf types
|
|
620
|
+
* @description: Get all the supported invoice pdf types such as Invoice, Label, Deliver challan - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/filestorage/getPdfTypes/).
|
|
374
621
|
*/
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
-
|
|
379
|
-
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
622
|
+
async getPdfTypes(
|
|
623
|
+
{ requestHeaders } = { requestHeaders: {} },
|
|
624
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
625
|
+
) {
|
|
626
|
+
const {
|
|
627
|
+
error,
|
|
628
|
+
} = FileStoragePlatformApplicationValidator.getPdfTypes().validate(
|
|
629
|
+
{},
|
|
630
|
+
{ abortEarly: false, allowUnknown: true }
|
|
631
|
+
);
|
|
632
|
+
if (error) {
|
|
633
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
// Showing warrnings if extra unknown parameters are found
|
|
637
|
+
const {
|
|
638
|
+
error: warrning,
|
|
639
|
+
} = FileStoragePlatformApplicationValidator.getPdfTypes().validate(
|
|
640
|
+
{},
|
|
641
|
+
{ abortEarly: false, allowUnknown: false }
|
|
642
|
+
);
|
|
643
|
+
if (warrning) {
|
|
644
|
+
Logger({
|
|
645
|
+
level: "WARN",
|
|
646
|
+
message: `Parameter Validation warrnings for platform > FileStorage > getPdfTypes \n ${warrning}`,
|
|
386
647
|
});
|
|
387
|
-
|
|
388
|
-
|
|
389
|
-
|
|
648
|
+
}
|
|
649
|
+
|
|
650
|
+
const query_params = {};
|
|
651
|
+
|
|
652
|
+
const response = await PlatformAPIClient.execute(
|
|
653
|
+
this.config,
|
|
654
|
+
"get",
|
|
655
|
+
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pdf/types`,
|
|
656
|
+
query_params,
|
|
657
|
+
undefined,
|
|
658
|
+
requestHeaders,
|
|
659
|
+
{ responseHeaders }
|
|
660
|
+
);
|
|
661
|
+
|
|
662
|
+
let responseData = response;
|
|
663
|
+
if (responseHeaders) {
|
|
664
|
+
responseData = response[0];
|
|
665
|
+
}
|
|
666
|
+
|
|
667
|
+
const { error: res_error } = Joi.array()
|
|
668
|
+
.items(FileStoragePlatformModel.InvoiceTypesResponse())
|
|
669
|
+
.validate(responseData, { abortEarly: false, allowUnknown: false });
|
|
670
|
+
|
|
671
|
+
if (res_error) {
|
|
672
|
+
Logger({
|
|
673
|
+
level: "WARN",
|
|
674
|
+
message: `Response Validation Warnnings for platform > FileStorage > getPdfTypes \n ${res_error}`,
|
|
390
675
|
});
|
|
391
|
-
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
676
|
+
}
|
|
677
|
+
|
|
678
|
+
return response;
|
|
679
|
+
}
|
|
680
|
+
|
|
681
|
+
/**
|
|
682
|
+
* @param {FileStoragePlatformApplicationValidator.PreviewTemplateParam} arg
|
|
683
|
+
* - Arg object
|
|
684
|
+
*
|
|
685
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
686
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
687
|
+
* @returns {Promise<string>} - Success response
|
|
688
|
+
* @name previewTemplate
|
|
689
|
+
* @summary: Preview HTML template
|
|
690
|
+
* @description: Rendered HTML template with dummy json data - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/filestorage/previewTemplate/).
|
|
691
|
+
*/
|
|
692
|
+
async previewTemplate(
|
|
693
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
694
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
695
|
+
) {
|
|
696
|
+
const {
|
|
697
|
+
error,
|
|
698
|
+
} = FileStoragePlatformApplicationValidator.previewTemplate().validate(
|
|
699
|
+
{
|
|
700
|
+
body,
|
|
701
|
+
},
|
|
702
|
+
{ abortEarly: false, allowUnknown: true }
|
|
703
|
+
);
|
|
704
|
+
if (error) {
|
|
705
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
706
|
+
}
|
|
707
|
+
|
|
708
|
+
// Showing warrnings if extra unknown parameters are found
|
|
709
|
+
const {
|
|
710
|
+
error: warrning,
|
|
711
|
+
} = FileStoragePlatformApplicationValidator.previewTemplate().validate(
|
|
712
|
+
{
|
|
713
|
+
body,
|
|
714
|
+
},
|
|
715
|
+
{ abortEarly: false, allowUnknown: false }
|
|
716
|
+
);
|
|
717
|
+
if (warrning) {
|
|
718
|
+
Logger({
|
|
719
|
+
level: "WARN",
|
|
720
|
+
message: `Parameter Validation warrnings for platform > FileStorage > previewTemplate \n ${warrning}`,
|
|
721
|
+
});
|
|
722
|
+
}
|
|
723
|
+
|
|
724
|
+
const query_params = {};
|
|
725
|
+
|
|
726
|
+
const response = await PlatformAPIClient.execute(
|
|
727
|
+
this.config,
|
|
728
|
+
"post",
|
|
729
|
+
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pdf/render`,
|
|
730
|
+
query_params,
|
|
731
|
+
body,
|
|
732
|
+
requestHeaders,
|
|
733
|
+
{ responseHeaders }
|
|
734
|
+
);
|
|
735
|
+
|
|
736
|
+
let responseData = response;
|
|
737
|
+
if (responseHeaders) {
|
|
738
|
+
responseData = response[0];
|
|
739
|
+
}
|
|
740
|
+
|
|
741
|
+
const { error: res_error } = Joi.string()
|
|
742
|
+
.allow("")
|
|
743
|
+
.validate(responseData, { abortEarly: false, allowUnknown: false });
|
|
744
|
+
|
|
745
|
+
if (res_error) {
|
|
746
|
+
Logger({
|
|
747
|
+
level: "WARN",
|
|
748
|
+
message: `Response Validation Warnnings for platform > FileStorage > previewTemplate \n ${res_error}`,
|
|
749
|
+
});
|
|
750
|
+
}
|
|
751
|
+
|
|
752
|
+
return response;
|
|
753
|
+
}
|
|
754
|
+
|
|
755
|
+
/**
|
|
756
|
+
* @param {FileStoragePlatformApplicationValidator.SaveHtmlTemplateParam} arg
|
|
757
|
+
* - Arg object
|
|
758
|
+
*
|
|
759
|
+
* @param {object} [arg.requestHeaders={}] - Request headers. Default is `{}`
|
|
760
|
+
* @param {import("../PlatformAPIClient").Options} - Options
|
|
761
|
+
* @returns {Promise<FileStoragePlatformModel.PdfConfigSaveSuccess[]>} -
|
|
762
|
+
* Success response
|
|
763
|
+
* @name saveHtmlTemplate
|
|
764
|
+
* @summary: Update html template for invoice or label
|
|
765
|
+
* @description: Update html template for invoice such as Invoice, Label, Deliver challan - Check out [method documentation](https://partners.fynd.com/help/docs/sdk/platform/filestorage/saveHtmlTemplate/).
|
|
766
|
+
*/
|
|
767
|
+
async saveHtmlTemplate(
|
|
768
|
+
{ body, requestHeaders } = { requestHeaders: {} },
|
|
769
|
+
{ responseHeaders } = { responseHeaders: false }
|
|
770
|
+
) {
|
|
771
|
+
const {
|
|
772
|
+
error,
|
|
773
|
+
} = FileStoragePlatformApplicationValidator.saveHtmlTemplate().validate(
|
|
774
|
+
{
|
|
775
|
+
body,
|
|
776
|
+
},
|
|
777
|
+
{ abortEarly: false, allowUnknown: true }
|
|
778
|
+
);
|
|
779
|
+
if (error) {
|
|
780
|
+
return Promise.reject(new FDKClientValidationError(error));
|
|
781
|
+
}
|
|
782
|
+
|
|
783
|
+
// Showing warrnings if extra unknown parameters are found
|
|
784
|
+
const {
|
|
785
|
+
error: warrning,
|
|
786
|
+
} = FileStoragePlatformApplicationValidator.saveHtmlTemplate().validate(
|
|
787
|
+
{
|
|
788
|
+
body,
|
|
789
|
+
},
|
|
790
|
+
{ abortEarly: false, allowUnknown: false }
|
|
791
|
+
);
|
|
792
|
+
if (warrning) {
|
|
793
|
+
Logger({
|
|
794
|
+
level: "WARN",
|
|
795
|
+
message: `Parameter Validation warrnings for platform > FileStorage > saveHtmlTemplate \n ${warrning}`,
|
|
796
|
+
});
|
|
797
|
+
}
|
|
798
|
+
|
|
799
|
+
const query_params = {};
|
|
800
|
+
|
|
801
|
+
const response = await PlatformAPIClient.execute(
|
|
802
|
+
this.config,
|
|
803
|
+
"put",
|
|
804
|
+
`/service/platform/assets/v1.0/company/${this.config.companyId}/application/${this.applicationId}/pdf/config`,
|
|
805
|
+
query_params,
|
|
806
|
+
body,
|
|
807
|
+
requestHeaders,
|
|
808
|
+
{ responseHeaders }
|
|
809
|
+
);
|
|
810
|
+
|
|
811
|
+
let responseData = response;
|
|
812
|
+
if (responseHeaders) {
|
|
813
|
+
responseData = response[0];
|
|
814
|
+
}
|
|
815
|
+
|
|
816
|
+
const { error: res_error } = Joi.array()
|
|
817
|
+
.items(FileStoragePlatformModel.PdfConfigSaveSuccess())
|
|
818
|
+
.validate(responseData, { abortEarly: false, allowUnknown: false });
|
|
819
|
+
|
|
820
|
+
if (res_error) {
|
|
821
|
+
Logger({
|
|
822
|
+
level: "WARN",
|
|
823
|
+
message: `Response Validation Warnnings for platform > FileStorage > saveHtmlTemplate \n ${res_error}`,
|
|
824
|
+
});
|
|
825
|
+
}
|
|
826
|
+
|
|
827
|
+
return response;
|
|
395
828
|
}
|
|
396
829
|
}
|
|
397
830
|
|