boldsign 1.0.3 → 2.0.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.
Files changed (533) hide show
  1. package/.openapi-generator/FILES +157 -156
  2. package/.openapi-generator/VERSION +1 -1
  3. package/.openapi-generator-ignore +23 -23
  4. package/LICENSE +21 -21
  5. package/README.md +307 -306
  6. package/api/apis.ts +163 -163
  7. package/api/brandingApi.ts +1193 -1183
  8. package/api/contactsApi.ts +772 -772
  9. package/api/customFieldApi.ts +817 -817
  10. package/api/documentApi.ts +2953 -2953
  11. package/api/identityVerificationApi.ts +586 -586
  12. package/api/index.ts +36 -36
  13. package/api/planApi.ts +274 -274
  14. package/api/senderIdentitiesApi.ts +898 -898
  15. package/api/teamsApi.ts +661 -661
  16. package/api/templateApi.ts +1915 -1915
  17. package/api/userApi.ts +968 -968
  18. package/api.ts +3 -3
  19. package/boldsign-2.0.0.tgz +0 -0
  20. package/dist/api/apis.d.ts +1 -1
  21. package/dist/api/apis.js +1 -1
  22. package/dist/api/brandingApi.d.ts +2 -2
  23. package/dist/api/brandingApi.js +10 -4
  24. package/dist/api/brandingApi.js.map +1 -1
  25. package/dist/model/auditTrail.d.ts +3 -1
  26. package/dist/model/auditTrail.js +2 -0
  27. package/dist/model/auditTrail.js.map +1 -1
  28. package/dist/model/collaborationSettings.d.ts +17 -0
  29. package/dist/model/collaborationSettings.js +33 -0
  30. package/dist/model/collaborationSettings.js.map +1 -0
  31. package/dist/model/createTemplateRequest.d.ts +1 -1
  32. package/dist/model/createTemplateRequest.js +5 -5
  33. package/dist/model/createTemplateRequest.js.map +1 -1
  34. package/dist/model/documentFiles.d.ts +1 -0
  35. package/dist/model/documentFiles.js +5 -0
  36. package/dist/model/documentFiles.js.map +1 -1
  37. package/dist/model/documentFormFields.d.ts +4 -0
  38. package/dist/model/documentFormFields.js +15 -0
  39. package/dist/model/documentFormFields.js.map +1 -1
  40. package/dist/model/documentSigner.d.ts +1 -0
  41. package/dist/model/documentSigner.js +5 -0
  42. package/dist/model/documentSigner.js.map +1 -1
  43. package/dist/model/documentSignerDetails.d.ts +1 -0
  44. package/dist/model/documentSignerDetails.js +5 -0
  45. package/dist/model/documentSignerDetails.js.map +1 -1
  46. package/dist/model/embeddedCreateTemplateRequest.d.ts +1 -1
  47. package/dist/model/embeddedCreateTemplateRequest.js +5 -5
  48. package/dist/model/embeddedCreateTemplateRequest.js.map +1 -1
  49. package/dist/model/embeddedDocumentRequest.d.ts +1 -1
  50. package/dist/model/embeddedDocumentRequest.js +5 -5
  51. package/dist/model/embeddedDocumentRequest.js.map +1 -1
  52. package/dist/model/embeddedMergeTemplateFormRequest.d.ts +1 -1
  53. package/dist/model/embeddedMergeTemplateFormRequest.js +5 -5
  54. package/dist/model/embeddedMergeTemplateFormRequest.js.map +1 -1
  55. package/dist/model/embeddedSendTemplateFormRequest.d.ts +1 -1
  56. package/dist/model/embeddedSendTemplateFormRequest.js +5 -5
  57. package/dist/model/embeddedSendTemplateFormRequest.js.map +1 -1
  58. package/dist/model/formField.d.ts +2 -0
  59. package/dist/model/formField.js +5 -0
  60. package/dist/model/formField.js.map +1 -1
  61. package/dist/model/index.d.ts +2 -1
  62. package/dist/model/index.js +6 -3
  63. package/dist/model/index.js.map +1 -1
  64. package/dist/model/mergeAndSendForSignForm.d.ts +1 -1
  65. package/dist/model/mergeAndSendForSignForm.js +5 -5
  66. package/dist/model/mergeAndSendForSignForm.js.map +1 -1
  67. package/dist/model/sendForSign.d.ts +1 -1
  68. package/dist/model/sendForSign.js +5 -5
  69. package/dist/model/sendForSign.js.map +1 -1
  70. package/dist/model/sendForSignFromTemplateForm.d.ts +1 -1
  71. package/dist/model/sendForSignFromTemplateForm.js +5 -5
  72. package/dist/model/sendForSignFromTemplateForm.js.map +1 -1
  73. package/dist/model/templateFormFields.d.ts +2 -0
  74. package/dist/model/templateFormFields.js +5 -0
  75. package/dist/model/templateFormFields.js.map +1 -1
  76. package/dist/model/textTagDefinition.d.ts +2 -0
  77. package/dist/model/textTagDefinition.js +5 -0
  78. package/dist/model/textTagDefinition.js.map +1 -1
  79. package/dist/model/viewBrandDetails.d.ts +1 -0
  80. package/dist/model/viewBrandDetails.js +5 -0
  81. package/dist/model/viewBrandDetails.js.map +1 -1
  82. package/dist/tests/config.d.ts +5 -0
  83. package/dist/tests/config.js +43 -0
  84. package/dist/tests/config.js.map +1 -0
  85. package/dist/tests/integration/BrandingApiTest.spec.d.ts +1 -0
  86. package/dist/tests/integration/BrandingApiTest.spec.js +310 -0
  87. package/dist/tests/integration/BrandingApiTest.spec.js.map +1 -0
  88. package/dist/tests/integration/ContactsApiTest.spec.d.ts +1 -0
  89. package/dist/tests/integration/ContactsApiTest.spec.js +249 -0
  90. package/dist/tests/integration/ContactsApiTest.spec.js.map +1 -0
  91. package/dist/tests/integration/CustomFieldApiTest.spec.d.ts +1 -0
  92. package/dist/tests/integration/CustomFieldApiTest.spec.js +289 -0
  93. package/dist/tests/integration/CustomFieldApiTest.spec.js.map +1 -0
  94. package/dist/tests/integration/DocumentApiTest.spec.d.ts +1 -0
  95. package/dist/tests/integration/DocumentApiTest.spec.js +1710 -0
  96. package/dist/tests/integration/DocumentApiTest.spec.js.map +1 -0
  97. package/dist/tests/integration/IdentityVerificationApiTest.spec.d.ts +1 -0
  98. package/dist/tests/integration/IdentityVerificationApiTest.spec.js +160 -0
  99. package/dist/tests/integration/IdentityVerificationApiTest.spec.js.map +1 -0
  100. package/dist/tests/integration/TemplateApiTest.spec.d.ts +1 -0
  101. package/dist/tests/integration/TemplateApiTest.spec.js +1518 -0
  102. package/dist/tests/integration/TemplateApiTest.spec.js.map +1 -0
  103. package/dist/tests/integration/planApiTest.spec.d.ts +1 -0
  104. package/dist/tests/integration/planApiTest.spec.js +41 -0
  105. package/dist/tests/integration/planApiTest.spec.js.map +1 -0
  106. package/dist/tests/integration/senderIdentity.spec.d.ts +1 -0
  107. package/dist/tests/integration/senderIdentity.spec.js +481 -0
  108. package/dist/tests/integration/senderIdentity.spec.js.map +1 -0
  109. package/dist/tests/integration/teamsApiTest.spec.d.ts +1 -0
  110. package/dist/tests/integration/teamsApiTest.spec.js +230 -0
  111. package/dist/tests/integration/teamsApiTest.spec.js.map +1 -0
  112. package/dist/tests/integration/usersApiTest.spec.d.ts +1 -0
  113. package/dist/tests/integration/usersApiTest.spec.js +290 -0
  114. package/dist/tests/integration/usersApiTest.spec.js.map +1 -0
  115. package/dist/tests/performance/performanceApiTest.spec.d.ts +1 -0
  116. package/dist/tests/performance/performanceApiTest.spec.js +368 -0
  117. package/dist/tests/performance/performanceApiTest.spec.js.map +1 -0
  118. package/dist/tests/unit/brandingApi.spec.d.ts +1 -0
  119. package/dist/tests/unit/brandingApi.spec.js +174 -0
  120. package/dist/tests/unit/brandingApi.spec.js.map +1 -0
  121. package/dist/tests/unit/contactsApi.spec.d.ts +1 -0
  122. package/dist/tests/unit/contactsApi.spec.js +154 -0
  123. package/dist/tests/unit/contactsApi.spec.js.map +1 -0
  124. package/dist/tests/unit/customFieldApi.spec.d.ts +1 -0
  125. package/dist/tests/unit/customFieldApi.spec.js +140 -0
  126. package/dist/tests/unit/customFieldApi.spec.js.map +1 -0
  127. package/dist/tests/unit/documentApi.spec.d.ts +1 -0
  128. package/dist/tests/unit/documentApi.spec.js +476 -0
  129. package/dist/tests/unit/documentApi.spec.js.map +1 -0
  130. package/dist/tests/unit/planApi.spec.d.ts +1 -0
  131. package/dist/tests/unit/planApi.spec.js +69 -0
  132. package/dist/tests/unit/planApi.spec.js.map +1 -0
  133. package/dist/tests/unit/senderIdentitiesApi.spec.d.ts +1 -0
  134. package/dist/tests/unit/senderIdentitiesApi.spec.js +148 -0
  135. package/dist/tests/unit/senderIdentitiesApi.spec.js.map +1 -0
  136. package/dist/tests/unit/teamApi.spec.d.ts +1 -0
  137. package/dist/tests/unit/teamApi.spec.js +116 -0
  138. package/dist/tests/unit/teamApi.spec.js.map +1 -0
  139. package/dist/tests/unit/templateApi.spec.d.ts +1 -0
  140. package/dist/tests/unit/templateApi.spec.js +285 -0
  141. package/dist/tests/unit/templateApi.spec.js.map +1 -0
  142. package/dist/tests/unit/userApi.spec.d.ts +1 -0
  143. package/dist/tests/unit/userApi.spec.js +163 -0
  144. package/dist/tests/unit/userApi.spec.js.map +1 -0
  145. package/docs/AccessCodeDetail.md +19 -19
  146. package/docs/AccessCodeDetails.md +13 -13
  147. package/docs/Added.md +13 -13
  148. package/docs/Address.md +16 -16
  149. package/docs/AttachmentInfo.md +14 -14
  150. package/docs/AuditTrail.md +21 -21
  151. package/docs/AuthenticationSettings.md +11 -11
  152. package/docs/Base64File.md +12 -12
  153. package/docs/BehalfDocument.md +27 -27
  154. package/docs/BehalfDocumentRecords.md +12 -12
  155. package/docs/BehalfOf.md +12 -12
  156. package/docs/BillingViewModel.md +11 -11
  157. package/docs/BrandCreated.md +11 -11
  158. package/docs/BrandCustomFieldDetails.md +16 -16
  159. package/docs/BrandingApi.md +260 -258
  160. package/docs/BrandingMessage.md +11 -11
  161. package/docs/BrandingRecords.md +11 -11
  162. package/docs/ChangeRecipient.md +18 -18
  163. package/docs/CollaborationSettings.md +14 -0
  164. package/docs/ConditionalRule.md +13 -13
  165. package/docs/ContactCreated.md +12 -12
  166. package/docs/ContactDetails.md +15 -15
  167. package/docs/ContactPageDetails.md +13 -13
  168. package/docs/ContactsApi.md +176 -176
  169. package/docs/ContactsDetails.md +16 -16
  170. package/docs/ContactsList.md +12 -12
  171. package/docs/CreateContactResponse.md +11 -11
  172. package/docs/CreateSenderIdentityRequest.md +16 -16
  173. package/docs/CreateTeamRequest.md +11 -11
  174. package/docs/CreateTemplateRequest.md +35 -35
  175. package/docs/CreateUser.md +14 -14
  176. package/docs/CustomDomainSettings.md +12 -12
  177. package/docs/CustomFieldApi.md +174 -174
  178. package/docs/CustomFieldCollection.md +11 -11
  179. package/docs/CustomFieldMessage.md +12 -12
  180. package/docs/CustomFormField.md +43 -43
  181. package/docs/Date.md +13 -13
  182. package/docs/DeleteCustomFieldReply.md +11 -11
  183. package/docs/Document.md +26 -26
  184. package/docs/DocumentApi.md +756 -756
  185. package/docs/DocumentCC.md +11 -11
  186. package/docs/DocumentCcDetails.md +12 -12
  187. package/docs/DocumentCreated.md +11 -11
  188. package/docs/DocumentExpirySettings.md +16 -16
  189. package/docs/DocumentFiles.md +14 -13
  190. package/docs/DocumentFormFields.md +52 -49
  191. package/docs/DocumentInfo.md +14 -14
  192. package/docs/DocumentProperties.md +50 -50
  193. package/docs/DocumentReassign.md +13 -13
  194. package/docs/DocumentRecords.md +12 -12
  195. package/docs/DocumentSenderDetail.md +14 -14
  196. package/docs/DocumentSigner.md +32 -31
  197. package/docs/DocumentSignerDetails.md +38 -37
  198. package/docs/DocumentTags.md +12 -12
  199. package/docs/DownloadImageRequest.md +16 -16
  200. package/docs/EditSenderIdentityRequest.md +14 -14
  201. package/docs/EditTemplateRequest.md +29 -29
  202. package/docs/EditableDateFieldSettings.md +13 -13
  203. package/docs/EmbeddedCreateTemplateRequest.md +46 -46
  204. package/docs/EmbeddedCustomFieldCreated.md +11 -11
  205. package/docs/EmbeddedDocumentRequest.md +55 -55
  206. package/docs/EmbeddedFileDetails.md +16 -16
  207. package/docs/EmbeddedFileLink.md +11 -11
  208. package/docs/EmbeddedMergeTemplateFormRequest.md +56 -56
  209. package/docs/EmbeddedSendCreated.md +12 -12
  210. package/docs/EmbeddedSendTemplateFormRequest.md +53 -53
  211. package/docs/EmbeddedSigningLink.md +11 -11
  212. package/docs/EmbeddedTemplateCreated.md +12 -12
  213. package/docs/EmbeddedTemplateEditRequest.md +21 -21
  214. package/docs/EmbeddedTemplateEdited.md +11 -11
  215. package/docs/Error.md +12 -12
  216. package/docs/ErrorResult.md +11 -11
  217. package/docs/ExistingFormField.md +15 -15
  218. package/docs/ExtendExpiry.md +14 -14
  219. package/docs/FileInfo.md +14 -14
  220. package/docs/Font.md +18 -18
  221. package/docs/FormField.md +51 -50
  222. package/docs/FormGroup.md +15 -15
  223. package/docs/FormulaFieldSettings.md +12 -12
  224. package/docs/IdDocument.md +21 -21
  225. package/docs/IdReport.md +14 -14
  226. package/docs/IdVerification.md +18 -18
  227. package/docs/IdentityVerificationApi.md +109 -109
  228. package/docs/IdentityVerificationSettings.md +16 -16
  229. package/docs/ImageInfo.md +13 -13
  230. package/docs/MergeAndSendForSignForm.md +46 -46
  231. package/docs/ModificationDetails.md +12 -12
  232. package/docs/NotificationSettings.md +22 -22
  233. package/docs/PageDetails.md +16 -16
  234. package/docs/PhoneNumber.md +12 -12
  235. package/docs/PlanApi.md +38 -38
  236. package/docs/PrefillField.md +12 -12
  237. package/docs/PrefillFieldRequest.md +12 -12
  238. package/docs/ProblemDetails.md +15 -15
  239. package/docs/RecipientChangeLog.md +12 -12
  240. package/docs/RecipientNotificationSettings.md +22 -22
  241. package/docs/Rectangle.md +14 -14
  242. package/docs/ReminderMessage.md +13 -13
  243. package/docs/ReminderSettings.md +13 -13
  244. package/docs/RemoveAuthentication.md +14 -14
  245. package/docs/Removed.md +13 -13
  246. package/docs/RevokeDocument.md +12 -12
  247. package/docs/Role.md +33 -33
  248. package/docs/Roles.md +33 -33
  249. package/docs/SendForSign.md +45 -45
  250. package/docs/SendForSignFromTemplateForm.md +43 -43
  251. package/docs/SenderIdentitiesApi.md +209 -209
  252. package/docs/SenderIdentityCreated.md +11 -11
  253. package/docs/SenderIdentityList.md +12 -12
  254. package/docs/SenderIdentityViewModel.md +19 -19
  255. package/docs/SignerAuthenticationSettings.md +12 -12
  256. package/docs/Size.md +12 -12
  257. package/docs/TeamCreated.md +11 -11
  258. package/docs/TeamDocumentRecords.md +12 -12
  259. package/docs/TeamListResponse.md +12 -12
  260. package/docs/TeamPageDetails.md +12 -12
  261. package/docs/TeamResponse.md +15 -15
  262. package/docs/TeamUpdateRequest.md +12 -12
  263. package/docs/TeamUsers.md +16 -16
  264. package/docs/Teams.md +14 -14
  265. package/docs/TeamsApi.md +141 -141
  266. package/docs/Template.md +29 -29
  267. package/docs/TemplateApi.md +484 -484
  268. package/docs/TemplateCC.md +12 -12
  269. package/docs/TemplateCreated.md +11 -11
  270. package/docs/TemplateFormFields.md +51 -50
  271. package/docs/TemplateProperties.md +37 -37
  272. package/docs/TemplateRecords.md +12 -12
  273. package/docs/TemplateRole.md +28 -28
  274. package/docs/TemplateSenderDetail.md +12 -12
  275. package/docs/TemplateSenderDetails.md +13 -13
  276. package/docs/TemplateSharedTemplateDetail.md +12 -12
  277. package/docs/TemplateSignerDetails.md +27 -27
  278. package/docs/TemplateTag.md +14 -14
  279. package/docs/TextTagDefinition.md +41 -40
  280. package/docs/TextTagOffset.md +12 -12
  281. package/docs/UpdateUser.md +14 -14
  282. package/docs/UpdateUserMetaData.md +12 -12
  283. package/docs/UserApi.md +240 -240
  284. package/docs/UserPageDetails.md +12 -12
  285. package/docs/UserProperties.md +21 -21
  286. package/docs/UserRecords.md +12 -12
  287. package/docs/UsersDetails.md +21 -21
  288. package/docs/Validation.md +13 -13
  289. package/docs/VerificationDataRequest.md +15 -15
  290. package/docs/ViewBrandDetails.md +35 -34
  291. package/docs/ViewCustomFieldDetails.md +17 -17
  292. package/examples/DocumentProperties.ts +14 -14
  293. package/examples/brandCreate.ts +28 -28
  294. package/examples/brandDelete.ts +14 -14
  295. package/examples/brandGet.ts +14 -14
  296. package/examples/brandList.ts +13 -13
  297. package/examples/brandResetDefault.ts +14 -14
  298. package/examples/brandUpdate.ts +20 -20
  299. package/examples/contactCreate.ts +25 -25
  300. package/examples/contactDelete.ts +14 -14
  301. package/examples/contactGet.ts +14 -14
  302. package/examples/contactList.ts +15 -15
  303. package/examples/contactUpdate.ts +25 -25
  304. package/examples/customFieldCreate.ts +27 -27
  305. package/examples/customFieldDelete.ts +14 -14
  306. package/examples/customFieldEdit.ts +29 -29
  307. package/examples/customFieldEmbeddedCreateUrl.ts +18 -18
  308. package/examples/customFieldList.ts +14 -14
  309. package/examples/documentAddAuthentication.ts +19 -19
  310. package/examples/documentAddTags.ts +18 -18
  311. package/examples/documentChangeAccessCode.ts +19 -19
  312. package/examples/documentChangeRecipients.ts +21 -21
  313. package/examples/documentDelete.ts +15 -15
  314. package/examples/documentDeleteTags.ts +18 -18
  315. package/examples/documentDownload.ts +15 -15
  316. package/examples/documentDownloadAttachment.ts +16 -16
  317. package/examples/documentDownloadAuditTrial.ts +15 -15
  318. package/examples/documentEmbeddedRequestLink.ts +48 -48
  319. package/examples/documentEmbeddedSignLink.ts +22 -22
  320. package/examples/documentExtendExpiry.ts +19 -19
  321. package/examples/documentList.ts +18 -18
  322. package/examples/documentListBehalf.ts +14 -14
  323. package/examples/documentListTeam.ts +14 -14
  324. package/examples/documentPrefillFieldCheckBox.ts +22 -22
  325. package/examples/documentPrefillFieldDropDown.ts +22 -22
  326. package/examples/documentPrefillFieldEditableDate.ts +22 -22
  327. package/examples/documentPrefillFieldImage.ts +22 -22
  328. package/examples/documentPrefillFieldRadioButton.ts +22 -22
  329. package/examples/documentPrefillFieldTextBox.ts +22 -22
  330. package/examples/documentRemoveAuthentication.ts +18 -18
  331. package/examples/documentRevoke.ts +18 -18
  332. package/examples/documentSend.ts +46 -46
  333. package/examples/documentSendOnBehalf.ts +52 -52
  334. package/examples/documentSendReminder.ts +19 -19
  335. package/examples/embeddedManualVerification.ts +22 -22
  336. package/examples/identityVerificationImage.ts +23 -23
  337. package/examples/identityVerificationReport.ts +21 -21
  338. package/examples/listTemplate.ts +15 -15
  339. package/examples/plan.ts +13 -13
  340. package/examples/senderIdentityCreate.ts +20 -20
  341. package/examples/senderIdentityDelete.ts +14 -14
  342. package/examples/senderIdentityList.ts +15 -15
  343. package/examples/senderIdentityRerequest.ts +14 -14
  344. package/examples/senderIdentityResendInvitation.ts +14 -14
  345. package/examples/senderIdentityUpdate.ts +19 -19
  346. package/examples/teamCreate.ts +17 -17
  347. package/examples/teamGet.ts +14 -14
  348. package/examples/teamList.ts +15 -15
  349. package/examples/teamUpdate.ts +18 -18
  350. package/examples/templateAddTag.ts +19 -19
  351. package/examples/templateCreate.ts +28 -28
  352. package/examples/templateDelete.ts +14 -14
  353. package/examples/templateDeleteTag.ts +19 -19
  354. package/examples/templateDetails.ts +14 -14
  355. package/examples/templateDownload.ts +14 -14
  356. package/examples/templateEdit.ts +21 -21
  357. package/examples/templateEmbeddedCreate.ts +28 -28
  358. package/examples/templateEmbeddedEdit.ts +23 -23
  359. package/examples/templateEmbeddedRequestLink.ts +33 -33
  360. package/examples/templateMergerEmbeddedRequestUrl.ts +36 -36
  361. package/examples/templateSendDocument.ts +59 -59
  362. package/examples/templateSendDocumentUsingMultipleTemplate.ts +39 -39
  363. package/examples/userCreate.ts +19 -19
  364. package/examples/userGet.ts +14 -14
  365. package/examples/userInvitationCancel.ts +14 -14
  366. package/examples/userList.ts +15 -15
  367. package/examples/userResendInvitation.ts +14 -14
  368. package/examples/userUpdateRole.ts +18 -18
  369. package/git_push.sh +57 -57
  370. package/model/accessCodeDetail.ts +91 -91
  371. package/model/accessCodeDetails.ts +44 -44
  372. package/model/added.ts +43 -43
  373. package/model/address.ts +61 -61
  374. package/model/attachmentInfo.ts +49 -49
  375. package/model/auditTrail.ts +177 -175
  376. package/model/authenticationSettings.ts +40 -40
  377. package/model/base64File.ts +37 -37
  378. package/model/behalfDocument.ts +142 -142
  379. package/model/behalfDocumentRecords.ts +39 -39
  380. package/model/behalfOf.ts +37 -37
  381. package/model/billingViewModel.ts +31 -31
  382. package/model/brandCreated.ts +31 -31
  383. package/model/brandCustomFieldDetails.ts +62 -62
  384. package/model/brandingMessage.ts +31 -31
  385. package/model/brandingRecords.ts +32 -32
  386. package/model/changeRecipient.ts +74 -74
  387. package/model/collaborationSettings.ts +49 -0
  388. package/model/conditionalRule.ts +43 -43
  389. package/model/contactCreated.ts +37 -37
  390. package/model/contactDetails.ts +56 -56
  391. package/model/contactPageDetails.ts +43 -43
  392. package/model/contactsDetails.ts +62 -62
  393. package/model/contactsList.ts +39 -39
  394. package/model/createContactResponse.ts +32 -32
  395. package/model/createSenderIdentityRequest.ts +62 -62
  396. package/model/createTeamRequest.ts +31 -31
  397. package/model/createTemplateRequest.ts +181 -181
  398. package/model/createUser.ts +56 -56
  399. package/model/customDomainSettings.ts +37 -37
  400. package/model/customFieldCollection.ts +32 -32
  401. package/model/customFieldMessage.ts +37 -37
  402. package/model/customFormField.ts +275 -275
  403. package/model/deleteCustomFieldReply.ts +31 -31
  404. package/model/document.ts +135 -135
  405. package/model/documentCC.ts +31 -31
  406. package/model/documentCcDetails.ts +37 -37
  407. package/model/documentCreated.ts +31 -31
  408. package/model/documentExpirySettings.ts +69 -69
  409. package/model/documentFiles.ts +49 -43
  410. package/model/documentFormFields.ts +311 -292
  411. package/model/documentInfo.ts +90 -90
  412. package/model/documentProperties.ts +316 -316
  413. package/model/documentReassign.ts +43 -43
  414. package/model/documentRecords.ts +39 -39
  415. package/model/documentSenderDetail.ts +49 -49
  416. package/model/documentSigner.ts +221 -215
  417. package/model/documentSignerDetails.ts +265 -259
  418. package/model/documentTags.ts +37 -37
  419. package/model/downloadImageRequest.ts +61 -61
  420. package/model/editSenderIdentityRequest.ts +50 -50
  421. package/model/editTemplateRequest.ts +144 -144
  422. package/model/editableDateFieldSettings.ts +43 -43
  423. package/model/embeddedCreateTemplateRequest.ts +271 -271
  424. package/model/embeddedCustomFieldCreated.ts +31 -31
  425. package/model/embeddedDocumentRequest.ts +337 -337
  426. package/model/embeddedFileDetails.ts +61 -61
  427. package/model/embeddedFileLink.ts +31 -31
  428. package/model/embeddedMergeTemplateFormRequest.ts +343 -343
  429. package/model/embeddedSendCreated.ts +37 -37
  430. package/model/embeddedSendTemplateFormRequest.ts +324 -324
  431. package/model/embeddedSigningLink.ts +31 -31
  432. package/model/embeddedTemplateCreated.ts +37 -37
  433. package/model/embeddedTemplateEditRequest.ts +115 -115
  434. package/model/embeddedTemplateEdited.ts +31 -31
  435. package/model/errorResult.ts +31 -31
  436. package/model/existingFormField.ts +55 -55
  437. package/model/extendExpiry.ts +49 -49
  438. package/model/fileInfo.ts +49 -49
  439. package/model/font.ts +89 -89
  440. package/model/formField.ts +327 -320
  441. package/model/formGroup.ts +63 -63
  442. package/model/formulaFieldSettings.ts +37 -37
  443. package/model/idDocument.ts +93 -93
  444. package/model/idReport.ts +50 -50
  445. package/model/idVerification.ts +73 -73
  446. package/model/identityVerificationSettings.ts +75 -75
  447. package/model/imageInfo.ts +43 -43
  448. package/model/index.ts +546 -543
  449. package/model/mergeAndSendForSignForm.ts +261 -261
  450. package/model/modelDate.ts +43 -43
  451. package/model/modelError.ts +37 -37
  452. package/model/models.ts +244 -244
  453. package/model/modificationDetails.ts +37 -37
  454. package/model/notificationSettings.ts +97 -97
  455. package/model/pageDetails.ts +61 -61
  456. package/model/phoneNumber.ts +37 -37
  457. package/model/prefillField.ts +37 -37
  458. package/model/prefillFieldRequest.ts +38 -38
  459. package/model/problemDetails.ts +55 -55
  460. package/model/recipientChangeLog.ts +39 -39
  461. package/model/recipientNotificationSettings.ts +97 -97
  462. package/model/rectangle.ts +49 -49
  463. package/model/reminderMessage.ts +44 -44
  464. package/model/reminderSettings.ts +43 -43
  465. package/model/removeAuthentication.ts +50 -50
  466. package/model/removed.ts +43 -43
  467. package/model/revokeDocument.ts +37 -37
  468. package/model/role.ts +229 -229
  469. package/model/roles.ts +225 -225
  470. package/model/sendForSign.ts +255 -255
  471. package/model/sendForSignFromTemplateForm.ts +242 -242
  472. package/model/senderIdentityCreated.ts +31 -31
  473. package/model/senderIdentityList.ts +39 -39
  474. package/model/senderIdentityViewModel.ts +80 -80
  475. package/model/signerAuthenticationSettings.ts +37 -37
  476. package/model/size.ts +37 -37
  477. package/model/teamCreated.ts +31 -31
  478. package/model/teamDocumentRecords.ts +39 -39
  479. package/model/teamListResponse.ts +39 -39
  480. package/model/teamPageDetails.ts +37 -37
  481. package/model/teamResponse.ts +56 -56
  482. package/model/teamUpdateRequest.ts +37 -37
  483. package/model/teamUsers.ts +73 -73
  484. package/model/teams.ts +49 -49
  485. package/model/template.ts +159 -159
  486. package/model/templateCC.ts +37 -37
  487. package/model/templateCreated.ts +31 -31
  488. package/model/templateFormFields.ts +304 -297
  489. package/model/templateProperties.ts +202 -202
  490. package/model/templateRecords.ts +39 -39
  491. package/model/templateRole.ts +195 -195
  492. package/model/templateSenderDetail.ts +37 -37
  493. package/model/templateSenderDetails.ts +43 -43
  494. package/model/templateSharedTemplateDetail.ts +43 -43
  495. package/model/templateSignerDetails.ts +160 -160
  496. package/model/templateTag.ts +49 -49
  497. package/model/textTagDefinition.ts +255 -248
  498. package/model/textTagOffset.ts +37 -37
  499. package/model/updateUser.ts +60 -60
  500. package/model/updateUserMetaData.ts +37 -37
  501. package/model/userPageDetails.ts +37 -37
  502. package/model/userProperties.ts +91 -91
  503. package/model/userRecords.ts +39 -39
  504. package/model/usersDetails.ts +91 -91
  505. package/model/validation.ts +52 -52
  506. package/model/verificationDataRequest.ts +55 -55
  507. package/model/viewBrandDetails.ts +183 -177
  508. package/model/viewCustomFieldDetails.ts +68 -68
  509. package/package.json +52 -52
  510. package/tests/config.ts +20 -0
  511. package/tests/documents/agreement.pdf +0 -0
  512. package/tests/documents/logo.jpg +0 -0
  513. package/tests/integration/BrandingApiTest.spec.ts +254 -0
  514. package/tests/integration/ContactsApiTest.spec.ts +222 -0
  515. package/tests/integration/CustomFieldApiTest.spec.ts +231 -0
  516. package/tests/integration/DocumentApiTest.spec.ts +1624 -0
  517. package/tests/integration/IdentityVerificationApiTest.spec.ts +114 -0
  518. package/tests/integration/TemplateApiTest.spec.ts +1420 -0
  519. package/tests/integration/planApiTest.spec.ts +26 -0
  520. package/tests/integration/senderIdentity.spec.ts +397 -0
  521. package/tests/integration/teamsApiTest.spec.ts +226 -0
  522. package/tests/integration/usersApiTest.spec.ts +251 -0
  523. package/tests/performance/performanceApiTest.spec.ts +362 -0
  524. package/tests/unit/brandingApi.spec.ts +163 -0
  525. package/tests/unit/contactsApi.spec.ts +143 -0
  526. package/tests/unit/customFieldApi.spec.ts +123 -0
  527. package/tests/unit/documentApi.spec.ts +545 -0
  528. package/tests/unit/planApi.spec.ts +34 -0
  529. package/tests/unit/senderIdentitiesApi.spec.ts +148 -0
  530. package/tests/unit/teamApi.spec.ts +94 -0
  531. package/tests/unit/templateApi.spec.ts +307 -0
  532. package/tests/unit/userApi.spec.ts +162 -0
  533. package/tsconfig.json +24 -24
@@ -1,1915 +1,1915 @@
1
- /**
2
- * BoldSign API
3
- * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
- *
5
- * The version of the OpenAPI document: 1
6
- *
7
- *
8
- * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
- * https://openapi-generator.tech
10
- * Do not edit the class manually.
11
- */
12
-
13
- import axios, { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
14
-
15
- import {
16
- ObjectSerializer, Authentication, VoidAuth, Interceptor,
17
- HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth, RequestFile,
18
- CreateTemplateRequest,DocumentCreated,EditTemplateRequest,EmbeddedCreateTemplateRequest,EmbeddedMergeTemplateFormRequest,EmbeddedSendCreated,EmbeddedSendTemplateFormRequest,EmbeddedTemplateCreated,EmbeddedTemplateEditRequest,EmbeddedTemplateEdited,ErrorResult,MergeAndSendForSignForm,SendForSignFromTemplateForm,TemplateCreated,TemplateProperties,TemplateRecords,TemplateTag,
19
- } from '../model';
20
-
21
- import {
22
- HttpError,
23
- optionsI,
24
- returnTypeT,
25
- returnTypeI,
26
- generateFormData,
27
- toFormData,
28
- queryParamsSerializer,
29
- USER_AGENT,
30
- } from './';
31
-
32
- let defaultBasePath = 'https://api.boldsign.com';
33
-
34
- // ===============================================
35
- // This file is autogenerated - Please do not edit
36
- // ===============================================
37
-
38
-
39
- export class TemplateApi {
40
- protected _basePath = defaultBasePath;
41
- protected _defaultHeaders : any = { 'User-Agent': USER_AGENT };
42
- protected _useQuerystring : boolean = true;
43
-
44
- protected authentications = {
45
- 'default': <Authentication>new VoidAuth(),
46
- 'Bearer': new ApiKeyAuth('header', 'Authorization'),
47
- 'X-API-KEY': new ApiKeyAuth('header', 'X-API-KEY'),
48
- }
49
-
50
- protected interceptors: Interceptor[] = [];
51
-
52
- constructor(basePath?: string) {
53
- if (basePath) {
54
- this.basePath = basePath;
55
- }
56
- }
57
-
58
- set useQuerystring(value: boolean) {
59
- this._useQuerystring = value;
60
- }
61
-
62
- set basePath(basePath: string) {
63
- this._basePath = basePath;
64
- }
65
-
66
- set defaultHeaders(defaultHeaders: any) {
67
- this._defaultHeaders = { ...defaultHeaders, "User-Agent": USER_AGENT };
68
- }
69
-
70
- get defaultHeaders() {
71
- return this._defaultHeaders;
72
- }
73
-
74
- get basePath() {
75
- return this._basePath;
76
- }
77
-
78
- public setDefaultAuthentication(auth: Authentication) {
79
- this.authentications.default = auth;
80
- }
81
-
82
- public setApiKey(apikey: string) {
83
- this.authentications["X-API-KEY"].apiKey = apikey;
84
- }
85
-
86
- public setAccessToken(accessToken: string) {
87
- this.authentications["Bearer"].apiKey = 'bearer ' + accessToken;
88
- }
89
-
90
- public addInterceptor(interceptor: Interceptor) {
91
- this.interceptors.push(interceptor);
92
- }
93
-
94
- /**
95
- *
96
- * @summary Add the Tags in Templates.
97
- * @param templateTag ContainsTemplateId and Label Names for AddingTags.
98
- * @param options
99
- */
100
- public async addTag (templateTag?: TemplateTag, options: optionsI = {headers: {}}) : Promise<returnTypeI> {
101
- templateTag = deserializeIfNeeded(templateTag, "TemplateTag");
102
- const localVarPath = this.basePath + '/v1/template/addTags';
103
- let localVarQueryParameters: any = {};
104
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
105
- const produces = ['application/json;odata.metadata=minimal;odata.streaming=true', 'application/json;odata.metadata=minimal;odata.streaming=false', 'application/json;odata.metadata=minimal', 'application/json;odata.metadata=full;odata.streaming=true', 'application/json;odata.metadata=full;odata.streaming=false', 'application/json;odata.metadata=full', 'application/json;odata.metadata=none;odata.streaming=true', 'application/json;odata.metadata=none;odata.streaming=false', 'application/json;odata.metadata=none', 'application/json;odata.streaming=true', 'application/json;odata.streaming=false', 'application/json', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=full;IEEE754Compatible=false', 'application/json;odata.metadata=full;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=true', 'application/json;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.streaming=false;IEEE754Compatible=true', 'application/json;IEEE754Compatible=false', 'application/json;IEEE754Compatible=true', 'application/xml', 'text/plain', 'application/octet-stream', 'text/json'];
106
- // give precedence to 'application/json'
107
- if (produces.indexOf('application/json') >= 0) {
108
- localVarHeaderParams['content-type'] = 'application/json';
109
- } else {
110
- localVarHeaderParams['content-type'] = produces.join(',');
111
- }
112
- let localVarFormParams: any = {};
113
- let localVarBodyParams: any = undefined;
114
-
115
- (<any>Object).assign(localVarHeaderParams, options.headers);
116
-
117
- let localVarUseFormData = false;
118
-
119
- const result = generateFormData(templateTag, TemplateTag);
120
- localVarUseFormData = result.localVarUseFormData;
121
-
122
- let data = {};
123
- if (localVarUseFormData) {
124
- const formData = toFormData(result.data);
125
- data = formData;
126
- localVarHeaderParams = {
127
- ...localVarHeaderParams,
128
- ...formData.getHeaders(),
129
- };
130
- } else {
131
- data = ObjectSerializer.serialize(
132
- templateTag,
133
- "TemplateTag"
134
- );
135
- }
136
-
137
- let localVarRequestOptions: AxiosRequestConfig = {
138
- method: 'PATCH',
139
- params: localVarQueryParameters,
140
- headers: localVarHeaderParams,
141
- url: localVarPath,
142
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
143
- maxContentLength: Infinity,
144
- maxBodyLength: Infinity,
145
- responseType: "json",
146
- };
147
-
148
- if (localVarRequestOptions.method !== 'GET') {
149
- localVarRequestOptions.data = data;
150
- }
151
- let authenticationPromise = Promise.resolve();
152
-
153
- if (this.authentications["X-API-KEY"].apiKey) {
154
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
155
- }
156
- if (this.authentications["Bearer"].apiKey) {
157
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
158
- }
159
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
160
-
161
- let interceptorPromise = authenticationPromise;
162
- for (const interceptor of this.interceptors) {
163
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
164
- }
165
-
166
- return interceptorPromise.then(() => {
167
- return new Promise<returnTypeI>((resolve, reject) => {
168
- axios.request(localVarRequestOptions)
169
- .then((response) => {
170
- handleSuccessfulResponse(
171
- resolve,
172
- reject,
173
- response,
174
-
175
- );
176
- }, (error: AxiosError) => {
177
- if (error.response == null) {
178
- reject(error);
179
- return;
180
- }
181
-
182
- if (handleErrorCodeResponse(
183
- reject,
184
- error.response,
185
- 400,
186
- "ErrorResult",
187
- )) {
188
- return;
189
- }
190
- if (handleErrorCodeResponse(
191
- reject,
192
- error.response,
193
- 401,
194
- "ErrorResult",
195
- )) {
196
- return;
197
- }
198
-
199
-
200
- reject(error);
201
- });
202
- });
203
- });
204
- }
205
- /**
206
- *
207
- * @summary Generates a send URL using a template which embeds document sending process into your application.
208
- * @param templateId The template id.
209
- * @param embeddedSendTemplateFormRequest Embedded send template json request.
210
- * @param options
211
- */
212
- public async createEmbeddedRequestUrlTemplate (templateId: string, embeddedSendTemplateFormRequest?: EmbeddedSendTemplateFormRequest, options: optionsI = {headers: {}}) : Promise<EmbeddedSendCreated> {
213
- embeddedSendTemplateFormRequest = deserializeIfNeeded(embeddedSendTemplateFormRequest, "EmbeddedSendTemplateFormRequest");
214
- const localVarPath = this.basePath + '/v1/template/createEmbeddedRequestUrl';
215
- let localVarQueryParameters: any = {};
216
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
217
- const produces = ['application/json'];
218
- // give precedence to 'application/json'
219
- if (produces.indexOf('application/json') >= 0) {
220
- localVarHeaderParams['content-type'] = 'application/json';
221
- } else {
222
- localVarHeaderParams['content-type'] = produces.join(',');
223
- }
224
- let localVarFormParams: any = {};
225
- let localVarBodyParams: any = undefined;
226
-
227
- // verify required parameter 'templateId' is not null or undefined
228
- if (templateId === null || templateId === undefined) {
229
- throw new Error('Required parameter templateId was null or undefined when calling createEmbeddedRequestUrlTemplate.');
230
- }
231
-
232
- if (templateId !== undefined) {
233
- localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
234
- }
235
-
236
- (<any>Object).assign(localVarHeaderParams, options.headers);
237
-
238
- let localVarUseFormData = false;
239
-
240
- const result = generateFormData(embeddedSendTemplateFormRequest, EmbeddedSendTemplateFormRequest);
241
- localVarUseFormData = result.localVarUseFormData;
242
-
243
- let data = {};
244
- if (localVarUseFormData) {
245
- const formData = toFormData(result.data);
246
- data = formData;
247
- localVarHeaderParams = {
248
- ...localVarHeaderParams,
249
- ...formData.getHeaders(),
250
- };
251
- } else {
252
- data = ObjectSerializer.serialize(
253
- embeddedSendTemplateFormRequest,
254
- "EmbeddedSendTemplateFormRequest"
255
- );
256
- }
257
-
258
- let localVarRequestOptions: AxiosRequestConfig = {
259
- method: 'POST',
260
- params: localVarQueryParameters,
261
- headers: localVarHeaderParams,
262
- url: localVarPath,
263
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
264
- maxContentLength: Infinity,
265
- maxBodyLength: Infinity,
266
- responseType: "json",
267
- };
268
-
269
- if (localVarRequestOptions.method !== 'GET') {
270
- localVarRequestOptions.data = data;
271
- }
272
- let authenticationPromise = Promise.resolve();
273
-
274
- if (this.authentications["X-API-KEY"].apiKey) {
275
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
276
- }
277
- if (this.authentications["Bearer"].apiKey) {
278
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
279
- }
280
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
281
-
282
- let interceptorPromise = authenticationPromise;
283
- for (const interceptor of this.interceptors) {
284
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
285
- }
286
-
287
- return interceptorPromise.then(() => {
288
- return new Promise<EmbeddedSendCreated>((resolve, reject) => {
289
- axios.request(localVarRequestOptions)
290
- .then((response) => {
291
- handleSuccessfulResponse<EmbeddedSendCreated>(
292
- resolve,
293
- reject,
294
- response,
295
- "EmbeddedSendCreated",
296
- );
297
- }, (error: AxiosError) => {
298
- if (error.response == null) {
299
- reject(error);
300
- return;
301
- }
302
-
303
- if (handleErrorCodeResponse(
304
- reject,
305
- error.response,
306
- 201,
307
- "EmbeddedSendCreated",
308
- )) {
309
- return;
310
- }
311
- if (handleErrorCodeResponse(
312
- reject,
313
- error.response,
314
- 422,
315
- "ErrorResult",
316
- )) {
317
- return;
318
- }
319
- if (handleErrorCodeResponse(
320
- reject,
321
- error.response,
322
- 401,
323
- "ErrorResult",
324
- )) {
325
- return;
326
- }
327
-
328
-
329
- reject(error);
330
- });
331
- });
332
- });
333
- }
334
- /**
335
- *
336
- * @summary Generates a create URL to embeds template create process into your application.
337
- * @param embeddedCreateTemplateRequest The create embedded template request body.
338
- * @param options
339
- */
340
- public async createEmbeddedTemplateUrl (embeddedCreateTemplateRequest?: EmbeddedCreateTemplateRequest, options: optionsI = {headers: {}}) : Promise<EmbeddedTemplateCreated> {
341
- embeddedCreateTemplateRequest = deserializeIfNeeded(embeddedCreateTemplateRequest, "EmbeddedCreateTemplateRequest");
342
- const localVarPath = this.basePath + '/v1/template/createEmbeddedTemplateUrl';
343
- let localVarQueryParameters: any = {};
344
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
345
- const produces = ['application/json'];
346
- // give precedence to 'application/json'
347
- if (produces.indexOf('application/json') >= 0) {
348
- localVarHeaderParams['content-type'] = 'application/json';
349
- } else {
350
- localVarHeaderParams['content-type'] = produces.join(',');
351
- }
352
- let localVarFormParams: any = {};
353
- let localVarBodyParams: any = undefined;
354
-
355
- (<any>Object).assign(localVarHeaderParams, options.headers);
356
-
357
- let localVarUseFormData = false;
358
-
359
- const result = generateFormData(embeddedCreateTemplateRequest, EmbeddedCreateTemplateRequest);
360
- localVarUseFormData = result.localVarUseFormData;
361
-
362
- let data = {};
363
- if (localVarUseFormData) {
364
- const formData = toFormData(result.data);
365
- data = formData;
366
- localVarHeaderParams = {
367
- ...localVarHeaderParams,
368
- ...formData.getHeaders(),
369
- };
370
- } else {
371
- data = ObjectSerializer.serialize(
372
- embeddedCreateTemplateRequest,
373
- "EmbeddedCreateTemplateRequest"
374
- );
375
- }
376
-
377
- let localVarRequestOptions: AxiosRequestConfig = {
378
- method: 'POST',
379
- params: localVarQueryParameters,
380
- headers: localVarHeaderParams,
381
- url: localVarPath,
382
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
383
- maxContentLength: Infinity,
384
- maxBodyLength: Infinity,
385
- responseType: "json",
386
- };
387
-
388
- if (localVarRequestOptions.method !== 'GET') {
389
- localVarRequestOptions.data = data;
390
- }
391
- let authenticationPromise = Promise.resolve();
392
-
393
- if (this.authentications["X-API-KEY"].apiKey) {
394
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
395
- }
396
- if (this.authentications["Bearer"].apiKey) {
397
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
398
- }
399
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
400
-
401
- let interceptorPromise = authenticationPromise;
402
- for (const interceptor of this.interceptors) {
403
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
404
- }
405
-
406
- return interceptorPromise.then(() => {
407
- return new Promise<EmbeddedTemplateCreated>((resolve, reject) => {
408
- axios.request(localVarRequestOptions)
409
- .then((response) => {
410
- handleSuccessfulResponse<EmbeddedTemplateCreated>(
411
- resolve,
412
- reject,
413
- response,
414
- "EmbeddedTemplateCreated",
415
- );
416
- }, (error: AxiosError) => {
417
- if (error.response == null) {
418
- reject(error);
419
- return;
420
- }
421
-
422
- if (handleErrorCodeResponse(
423
- reject,
424
- error.response,
425
- 201,
426
- "EmbeddedTemplateCreated",
427
- )) {
428
- return;
429
- }
430
- if (handleErrorCodeResponse(
431
- reject,
432
- error.response,
433
- 401,
434
- "ErrorResult",
435
- )) {
436
- return;
437
- }
438
- if (handleErrorCodeResponse(
439
- reject,
440
- error.response,
441
- 422,
442
- "ErrorResult",
443
- )) {
444
- return;
445
- }
446
-
447
-
448
- reject(error);
449
- });
450
- });
451
- });
452
- }
453
- /**
454
- *
455
- * @summary Creates a new template.
456
- * @param createTemplateRequest The create template request body.
457
- * @param options
458
- */
459
- public async createTemplate (createTemplateRequest?: CreateTemplateRequest, options: optionsI = {headers: {}}) : Promise<TemplateCreated> {
460
- createTemplateRequest = deserializeIfNeeded(createTemplateRequest, "CreateTemplateRequest");
461
- const localVarPath = this.basePath + '/v1/template/create';
462
- let localVarQueryParameters: any = {};
463
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
464
- const produces = ['application/json'];
465
- // give precedence to 'application/json'
466
- if (produces.indexOf('application/json') >= 0) {
467
- localVarHeaderParams['content-type'] = 'application/json';
468
- } else {
469
- localVarHeaderParams['content-type'] = produces.join(',');
470
- }
471
- let localVarFormParams: any = {};
472
- let localVarBodyParams: any = undefined;
473
-
474
- (<any>Object).assign(localVarHeaderParams, options.headers);
475
-
476
- let localVarUseFormData = false;
477
-
478
- const result = generateFormData(createTemplateRequest, CreateTemplateRequest);
479
- localVarUseFormData = result.localVarUseFormData;
480
-
481
- let data = {};
482
- if (localVarUseFormData) {
483
- const formData = toFormData(result.data);
484
- data = formData;
485
- localVarHeaderParams = {
486
- ...localVarHeaderParams,
487
- ...formData.getHeaders(),
488
- };
489
- } else {
490
- data = ObjectSerializer.serialize(
491
- createTemplateRequest,
492
- "CreateTemplateRequest"
493
- );
494
- }
495
-
496
- let localVarRequestOptions: AxiosRequestConfig = {
497
- method: 'POST',
498
- params: localVarQueryParameters,
499
- headers: localVarHeaderParams,
500
- url: localVarPath,
501
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
502
- maxContentLength: Infinity,
503
- maxBodyLength: Infinity,
504
- responseType: "json",
505
- };
506
-
507
- if (localVarRequestOptions.method !== 'GET') {
508
- localVarRequestOptions.data = data;
509
- }
510
- let authenticationPromise = Promise.resolve();
511
-
512
- if (this.authentications["X-API-KEY"].apiKey) {
513
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
514
- }
515
- if (this.authentications["Bearer"].apiKey) {
516
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
517
- }
518
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
519
-
520
- let interceptorPromise = authenticationPromise;
521
- for (const interceptor of this.interceptors) {
522
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
523
- }
524
-
525
- return interceptorPromise.then(() => {
526
- return new Promise<TemplateCreated>((resolve, reject) => {
527
- axios.request(localVarRequestOptions)
528
- .then((response) => {
529
- handleSuccessfulResponse<TemplateCreated>(
530
- resolve,
531
- reject,
532
- response,
533
- "TemplateCreated",
534
- );
535
- }, (error: AxiosError) => {
536
- if (error.response == null) {
537
- reject(error);
538
- return;
539
- }
540
-
541
- if (handleErrorCodeResponse(
542
- reject,
543
- error.response,
544
- 201,
545
- "TemplateCreated",
546
- )) {
547
- return;
548
- }
549
- if (handleErrorCodeResponse(
550
- reject,
551
- error.response,
552
- 401,
553
- "ErrorResult",
554
- )) {
555
- return;
556
- }
557
- if (handleErrorCodeResponse(
558
- reject,
559
- error.response,
560
- 403,
561
- "ErrorResult",
562
- )) {
563
- return;
564
- }
565
- if (handleErrorCodeResponse(
566
- reject,
567
- error.response,
568
- 422,
569
- "ErrorResult",
570
- )) {
571
- return;
572
- }
573
-
574
-
575
- reject(error);
576
- });
577
- });
578
- });
579
- }
580
- /**
581
- *
582
- * @summary Deletes a template.
583
- * @param templateId The template id.
584
- * @param onBehalfOf The on behalfof email address.
585
- * @param options
586
- */
587
- public async deleteTemplate (templateId: string, onBehalfOf?: string, options: optionsI = {headers: {}}) : Promise<returnTypeI> {
588
- const localVarPath = this.basePath + '/v1/template/delete';
589
- let localVarQueryParameters: any = {};
590
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
591
- const produces = ['application/json'];
592
- // give precedence to 'application/json'
593
- if (produces.indexOf('application/json') >= 0) {
594
- localVarHeaderParams['content-type'] = 'application/json';
595
- } else {
596
- localVarHeaderParams['content-type'] = produces.join(',');
597
- }
598
- let localVarFormParams: any = {};
599
- let localVarBodyParams: any = undefined;
600
-
601
- // verify required parameter 'templateId' is not null or undefined
602
- if (templateId === null || templateId === undefined) {
603
- throw new Error('Required parameter templateId was null or undefined when calling deleteTemplate.');
604
- }
605
-
606
- if (templateId !== undefined) {
607
- localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
608
- }
609
-
610
- if (onBehalfOf !== undefined) {
611
- localVarQueryParameters['onBehalfOf'] = ObjectSerializer.serialize(onBehalfOf, "string");
612
- }
613
-
614
- (<any>Object).assign(localVarHeaderParams, options.headers);
615
-
616
- let localVarUseFormData = false;
617
-
618
- let data = {};
619
- if (localVarUseFormData) {
620
- const formData = toFormData(localVarFormParams);
621
- data = formData;
622
- localVarHeaderParams = {
623
- ...localVarHeaderParams,
624
- ...formData.getHeaders(),
625
- };
626
- }
627
-
628
- let localVarRequestOptions: AxiosRequestConfig = {
629
- method: 'DELETE',
630
- params: localVarQueryParameters,
631
- headers: localVarHeaderParams,
632
- url: localVarPath,
633
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
634
- maxContentLength: Infinity,
635
- maxBodyLength: Infinity,
636
- responseType: "json",
637
- };
638
-
639
- if (localVarRequestOptions.method !== 'GET') {
640
- localVarRequestOptions.data = data;
641
- }
642
- let authenticationPromise = Promise.resolve();
643
-
644
- if (this.authentications["X-API-KEY"].apiKey) {
645
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
646
- }
647
- if (this.authentications["Bearer"].apiKey) {
648
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
649
- }
650
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
651
-
652
- let interceptorPromise = authenticationPromise;
653
- for (const interceptor of this.interceptors) {
654
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
655
- }
656
-
657
- return interceptorPromise.then(() => {
658
- return new Promise<returnTypeI>((resolve, reject) => {
659
- axios.request(localVarRequestOptions)
660
- .then((response) => {
661
- handleSuccessfulResponse(
662
- resolve,
663
- reject,
664
- response,
665
-
666
- );
667
- }, (error: AxiosError) => {
668
- if (error.response == null) {
669
- reject(error);
670
- return;
671
- }
672
-
673
- if (handleErrorCodeResponse(
674
- reject,
675
- error.response,
676
- 401,
677
- "ErrorResult",
678
- )) {
679
- return;
680
- }
681
- if (handleErrorCodeResponse(
682
- reject,
683
- error.response,
684
- 403,
685
- "ErrorResult",
686
- )) {
687
- return;
688
- }
689
-
690
-
691
- reject(error);
692
- });
693
- });
694
- });
695
- }
696
- /**
697
- *
698
- * @summary Delete the Tags in Templates.
699
- * @param templateTag Contains TemplateId and LabelNames for Adding Tags.
700
- * @param options
701
- */
702
- public async deleteTag (templateTag?: TemplateTag, options: optionsI = {headers: {}}) : Promise<returnTypeI> {
703
- templateTag = deserializeIfNeeded(templateTag, "TemplateTag");
704
- const localVarPath = this.basePath + '/v1/template/deleteTags';
705
- let localVarQueryParameters: any = {};
706
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
707
- const produces = ['application/json;odata.metadata=minimal;odata.streaming=true', 'application/json;odata.metadata=minimal;odata.streaming=false', 'application/json;odata.metadata=minimal', 'application/json;odata.metadata=full;odata.streaming=true', 'application/json;odata.metadata=full;odata.streaming=false', 'application/json;odata.metadata=full', 'application/json;odata.metadata=none;odata.streaming=true', 'application/json;odata.metadata=none;odata.streaming=false', 'application/json;odata.metadata=none', 'application/json;odata.streaming=true', 'application/json;odata.streaming=false', 'application/json', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=full;IEEE754Compatible=false', 'application/json;odata.metadata=full;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=true', 'application/json;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.streaming=false;IEEE754Compatible=true', 'application/json;IEEE754Compatible=false', 'application/json;IEEE754Compatible=true', 'application/xml', 'text/plain', 'application/octet-stream', 'text/json'];
708
- // give precedence to 'application/json'
709
- if (produces.indexOf('application/json') >= 0) {
710
- localVarHeaderParams['content-type'] = 'application/json';
711
- } else {
712
- localVarHeaderParams['content-type'] = produces.join(',');
713
- }
714
- let localVarFormParams: any = {};
715
- let localVarBodyParams: any = undefined;
716
-
717
- (<any>Object).assign(localVarHeaderParams, options.headers);
718
-
719
- let localVarUseFormData = false;
720
-
721
- const result = generateFormData(templateTag, TemplateTag);
722
- localVarUseFormData = result.localVarUseFormData;
723
-
724
- let data = {};
725
- if (localVarUseFormData) {
726
- const formData = toFormData(result.data);
727
- data = formData;
728
- localVarHeaderParams = {
729
- ...localVarHeaderParams,
730
- ...formData.getHeaders(),
731
- };
732
- } else {
733
- data = ObjectSerializer.serialize(
734
- templateTag,
735
- "TemplateTag"
736
- );
737
- }
738
-
739
- let localVarRequestOptions: AxiosRequestConfig = {
740
- method: 'DELETE',
741
- params: localVarQueryParameters,
742
- headers: localVarHeaderParams,
743
- url: localVarPath,
744
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
745
- maxContentLength: Infinity,
746
- maxBodyLength: Infinity,
747
- responseType: "json",
748
- };
749
-
750
- if (localVarRequestOptions.method !== 'GET') {
751
- localVarRequestOptions.data = data;
752
- }
753
- let authenticationPromise = Promise.resolve();
754
-
755
- if (this.authentications["X-API-KEY"].apiKey) {
756
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
757
- }
758
- if (this.authentications["Bearer"].apiKey) {
759
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
760
- }
761
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
762
-
763
- let interceptorPromise = authenticationPromise;
764
- for (const interceptor of this.interceptors) {
765
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
766
- }
767
-
768
- return interceptorPromise.then(() => {
769
- return new Promise<returnTypeI>((resolve, reject) => {
770
- axios.request(localVarRequestOptions)
771
- .then((response) => {
772
- handleSuccessfulResponse(
773
- resolve,
774
- reject,
775
- response,
776
-
777
- );
778
- }, (error: AxiosError) => {
779
- if (error.response == null) {
780
- reject(error);
781
- return;
782
- }
783
-
784
- if (handleErrorCodeResponse(
785
- reject,
786
- error.response,
787
- 401,
788
- "ErrorResult",
789
- )) {
790
- return;
791
- }
792
- if (handleErrorCodeResponse(
793
- reject,
794
- error.response,
795
- 400,
796
- "ErrorResult",
797
- )) {
798
- return;
799
- }
800
-
801
-
802
- reject(error);
803
- });
804
- });
805
- });
806
- }
807
- /**
808
- *
809
- * @summary Download the template.
810
- * @param templateId Template Id.
811
- * @param onBehalfOf The on behalfof email address.
812
- * @param options
813
- */
814
- public async download (templateId: string, onBehalfOf?: string, options: optionsI = {headers: {}}) : Promise<Buffer> {
815
- const localVarPath = this.basePath + '/v1/template/download';
816
- let localVarQueryParameters: any = {};
817
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
818
- const produces = ['application/json'];
819
- // give precedence to 'application/json'
820
- if (produces.indexOf('application/json') >= 0) {
821
- localVarHeaderParams['content-type'] = 'application/json';
822
- } else {
823
- localVarHeaderParams['content-type'] = produces.join(',');
824
- }
825
- let localVarFormParams: any = {};
826
- let localVarBodyParams: any = undefined;
827
-
828
- // verify required parameter 'templateId' is not null or undefined
829
- if (templateId === null || templateId === undefined) {
830
- throw new Error('Required parameter templateId was null or undefined when calling download.');
831
- }
832
-
833
- if (templateId !== undefined) {
834
- localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
835
- }
836
-
837
- if (onBehalfOf !== undefined) {
838
- localVarQueryParameters['onBehalfOf'] = ObjectSerializer.serialize(onBehalfOf, "string");
839
- }
840
-
841
- (<any>Object).assign(localVarHeaderParams, options.headers);
842
-
843
- let localVarUseFormData = false;
844
-
845
- let data = {};
846
- if (localVarUseFormData) {
847
- const formData = toFormData(localVarFormParams);
848
- data = formData;
849
- localVarHeaderParams = {
850
- ...localVarHeaderParams,
851
- ...formData.getHeaders(),
852
- };
853
- }
854
-
855
- let localVarRequestOptions: AxiosRequestConfig = {
856
- method: 'GET',
857
- params: localVarQueryParameters,
858
- headers: localVarHeaderParams,
859
- url: localVarPath,
860
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
861
- maxContentLength: Infinity,
862
- maxBodyLength: Infinity,
863
- responseType: "arraybuffer",
864
- };
865
-
866
- if (localVarRequestOptions.method !== 'GET') {
867
- localVarRequestOptions.data = data;
868
- }
869
- let authenticationPromise = Promise.resolve();
870
-
871
- if (this.authentications["X-API-KEY"].apiKey) {
872
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
873
- }
874
- if (this.authentications["Bearer"].apiKey) {
875
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
876
- }
877
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
878
-
879
- let interceptorPromise = authenticationPromise;
880
- for (const interceptor of this.interceptors) {
881
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
882
- }
883
-
884
- return interceptorPromise.then(() => {
885
- return new Promise<Buffer>((resolve, reject) => {
886
- axios.request(localVarRequestOptions)
887
- .then((response) => {
888
- handleSuccessfulResponse<Buffer>(
889
- resolve,
890
- reject,
891
- response,
892
- "Buffer",
893
- );
894
- }, (error: AxiosError) => {
895
- if (error.response == null) {
896
- reject(error);
897
- return;
898
- }
899
-
900
- if (handleErrorCodeResponse(
901
- reject,
902
- error.response,
903
- 200,
904
- "RequestFile",
905
- )) {
906
- return;
907
- }
908
- if (handleErrorCodeResponse(
909
- reject,
910
- error.response,
911
- 401,
912
- "ErrorResult",
913
- )) {
914
- return;
915
- }
916
- if (handleErrorCodeResponse(
917
- reject,
918
- error.response,
919
- 400,
920
- "ErrorResult",
921
- )) {
922
- return;
923
- }
924
-
925
-
926
- reject(error);
927
- });
928
- });
929
- });
930
- }
931
- /**
932
- *
933
- * @summary Edit and updates an existing template.
934
- * @param templateId The template id.
935
- * @param editTemplateRequest The edit template request body.
936
- * @param options
937
- */
938
- public async editTemplate (templateId: string, editTemplateRequest: EditTemplateRequest, options: optionsI = {headers: {}}) : Promise<returnTypeI> {
939
- editTemplateRequest = deserializeIfNeeded(editTemplateRequest, "EditTemplateRequest");
940
- const localVarPath = this.basePath + '/v1/template/edit';
941
- let localVarQueryParameters: any = {};
942
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
943
- const produces = ['application/json'];
944
- // give precedence to 'application/json'
945
- if (produces.indexOf('application/json') >= 0) {
946
- localVarHeaderParams['content-type'] = 'application/json';
947
- } else {
948
- localVarHeaderParams['content-type'] = produces.join(',');
949
- }
950
- let localVarFormParams: any = {};
951
- let localVarBodyParams: any = undefined;
952
-
953
- // verify required parameter 'templateId' is not null or undefined
954
- if (templateId === null || templateId === undefined) {
955
- throw new Error('Required parameter templateId was null or undefined when calling editTemplate.');
956
- }
957
-
958
- // verify required parameter 'editTemplateRequest' is not null or undefined
959
- if (editTemplateRequest === null || editTemplateRequest === undefined) {
960
- throw new Error('Required parameter editTemplateRequest was null or undefined when calling editTemplate.');
961
- }
962
-
963
- if (templateId !== undefined) {
964
- localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
965
- }
966
-
967
- (<any>Object).assign(localVarHeaderParams, options.headers);
968
-
969
- let localVarUseFormData = false;
970
-
971
- const result = generateFormData(editTemplateRequest, EditTemplateRequest);
972
- localVarUseFormData = result.localVarUseFormData;
973
-
974
- let data = {};
975
- if (localVarUseFormData) {
976
- const formData = toFormData(result.data);
977
- data = formData;
978
- localVarHeaderParams = {
979
- ...localVarHeaderParams,
980
- ...formData.getHeaders(),
981
- };
982
- } else {
983
- data = ObjectSerializer.serialize(
984
- editTemplateRequest,
985
- "EditTemplateRequest"
986
- );
987
- }
988
-
989
- let localVarRequestOptions: AxiosRequestConfig = {
990
- method: 'PUT',
991
- params: localVarQueryParameters,
992
- headers: localVarHeaderParams,
993
- url: localVarPath,
994
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
995
- maxContentLength: Infinity,
996
- maxBodyLength: Infinity,
997
- responseType: "json",
998
- };
999
-
1000
- if (localVarRequestOptions.method !== 'GET') {
1001
- localVarRequestOptions.data = data;
1002
- }
1003
- let authenticationPromise = Promise.resolve();
1004
-
1005
- if (this.authentications["X-API-KEY"].apiKey) {
1006
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1007
- }
1008
- if (this.authentications["Bearer"].apiKey) {
1009
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1010
- }
1011
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1012
-
1013
- let interceptorPromise = authenticationPromise;
1014
- for (const interceptor of this.interceptors) {
1015
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1016
- }
1017
-
1018
- return interceptorPromise.then(() => {
1019
- return new Promise<returnTypeI>((resolve, reject) => {
1020
- axios.request(localVarRequestOptions)
1021
- .then((response) => {
1022
- handleSuccessfulResponse(
1023
- resolve,
1024
- reject,
1025
- response,
1026
-
1027
- );
1028
- }, (error: AxiosError) => {
1029
- if (error.response == null) {
1030
- reject(error);
1031
- return;
1032
- }
1033
-
1034
- if (handleErrorCodeResponse(
1035
- reject,
1036
- error.response,
1037
- 400,
1038
- "ErrorResult",
1039
- )) {
1040
- return;
1041
- }
1042
- if (handleErrorCodeResponse(
1043
- reject,
1044
- error.response,
1045
- 422,
1046
- "ErrorResult",
1047
- )) {
1048
- return;
1049
- }
1050
- if (handleErrorCodeResponse(
1051
- reject,
1052
- error.response,
1053
- 401,
1054
- "ErrorResult",
1055
- )) {
1056
- return;
1057
- }
1058
-
1059
-
1060
- reject(error);
1061
- });
1062
- });
1063
- });
1064
- }
1065
- /**
1066
- *
1067
- * @summary Generates a edit URL to embeds template edit process into your application.
1068
- * @param templateId The template id.
1069
- * @param embeddedTemplateEditRequest The embedded edit template request body.
1070
- * @param options
1071
- */
1072
- public async getEmbeddedTemplateEditUrl (templateId: string, embeddedTemplateEditRequest?: EmbeddedTemplateEditRequest, options: optionsI = {headers: {}}) : Promise<EmbeddedTemplateEdited> {
1073
- embeddedTemplateEditRequest = deserializeIfNeeded(embeddedTemplateEditRequest, "EmbeddedTemplateEditRequest");
1074
- const localVarPath = this.basePath + '/v1/template/getEmbeddedTemplateEditUrl';
1075
- let localVarQueryParameters: any = {};
1076
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1077
- const produces = ['application/json'];
1078
- // give precedence to 'application/json'
1079
- if (produces.indexOf('application/json') >= 0) {
1080
- localVarHeaderParams['content-type'] = 'application/json';
1081
- } else {
1082
- localVarHeaderParams['content-type'] = produces.join(',');
1083
- }
1084
- let localVarFormParams: any = {};
1085
- let localVarBodyParams: any = undefined;
1086
-
1087
- // verify required parameter 'templateId' is not null or undefined
1088
- if (templateId === null || templateId === undefined) {
1089
- throw new Error('Required parameter templateId was null or undefined when calling getEmbeddedTemplateEditUrl.');
1090
- }
1091
-
1092
- if (templateId !== undefined) {
1093
- localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
1094
- }
1095
-
1096
- (<any>Object).assign(localVarHeaderParams, options.headers);
1097
-
1098
- let localVarUseFormData = false;
1099
-
1100
- const result = generateFormData(embeddedTemplateEditRequest, EmbeddedTemplateEditRequest);
1101
- localVarUseFormData = result.localVarUseFormData;
1102
-
1103
- let data = {};
1104
- if (localVarUseFormData) {
1105
- const formData = toFormData(result.data);
1106
- data = formData;
1107
- localVarHeaderParams = {
1108
- ...localVarHeaderParams,
1109
- ...formData.getHeaders(),
1110
- };
1111
- } else {
1112
- data = ObjectSerializer.serialize(
1113
- embeddedTemplateEditRequest,
1114
- "EmbeddedTemplateEditRequest"
1115
- );
1116
- }
1117
-
1118
- let localVarRequestOptions: AxiosRequestConfig = {
1119
- method: 'POST',
1120
- params: localVarQueryParameters,
1121
- headers: localVarHeaderParams,
1122
- url: localVarPath,
1123
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
1124
- maxContentLength: Infinity,
1125
- maxBodyLength: Infinity,
1126
- responseType: "json",
1127
- };
1128
-
1129
- if (localVarRequestOptions.method !== 'GET') {
1130
- localVarRequestOptions.data = data;
1131
- }
1132
- let authenticationPromise = Promise.resolve();
1133
-
1134
- if (this.authentications["X-API-KEY"].apiKey) {
1135
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1136
- }
1137
- if (this.authentications["Bearer"].apiKey) {
1138
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1139
- }
1140
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1141
-
1142
- let interceptorPromise = authenticationPromise;
1143
- for (const interceptor of this.interceptors) {
1144
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1145
- }
1146
-
1147
- return interceptorPromise.then(() => {
1148
- return new Promise<EmbeddedTemplateEdited>((resolve, reject) => {
1149
- axios.request(localVarRequestOptions)
1150
- .then((response) => {
1151
- handleSuccessfulResponse<EmbeddedTemplateEdited>(
1152
- resolve,
1153
- reject,
1154
- response,
1155
- "EmbeddedTemplateEdited",
1156
- );
1157
- }, (error: AxiosError) => {
1158
- if (error.response == null) {
1159
- reject(error);
1160
- return;
1161
- }
1162
-
1163
- if (handleErrorCodeResponse(
1164
- reject,
1165
- error.response,
1166
- 201,
1167
- "EmbeddedTemplateEdited",
1168
- )) {
1169
- return;
1170
- }
1171
- if (handleErrorCodeResponse(
1172
- reject,
1173
- error.response,
1174
- 400,
1175
- "ErrorResult",
1176
- )) {
1177
- return;
1178
- }
1179
- if (handleErrorCodeResponse(
1180
- reject,
1181
- error.response,
1182
- 401,
1183
- "ErrorResult",
1184
- )) {
1185
- return;
1186
- }
1187
-
1188
-
1189
- reject(error);
1190
- });
1191
- });
1192
- });
1193
- }
1194
- /**
1195
- *
1196
- * @summary Get summary of the template.
1197
- * @param templateId Template Id.
1198
- * @param options
1199
- */
1200
- public async getProperties (templateId: string, options: optionsI = {headers: {}}) : Promise<TemplateProperties> {
1201
- const localVarPath = this.basePath + '/v1/template/properties';
1202
- let localVarQueryParameters: any = {};
1203
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1204
- const produces = ['application/json'];
1205
- // give precedence to 'application/json'
1206
- if (produces.indexOf('application/json') >= 0) {
1207
- localVarHeaderParams['content-type'] = 'application/json';
1208
- } else {
1209
- localVarHeaderParams['content-type'] = produces.join(',');
1210
- }
1211
- let localVarFormParams: any = {};
1212
- let localVarBodyParams: any = undefined;
1213
-
1214
- // verify required parameter 'templateId' is not null or undefined
1215
- if (templateId === null || templateId === undefined) {
1216
- throw new Error('Required parameter templateId was null or undefined when calling getTemplateProperties.');
1217
- }
1218
-
1219
- if (templateId !== undefined) {
1220
- localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
1221
- }
1222
-
1223
- (<any>Object).assign(localVarHeaderParams, options.headers);
1224
-
1225
- let localVarUseFormData = false;
1226
-
1227
- let data = {};
1228
- if (localVarUseFormData) {
1229
- const formData = toFormData(localVarFormParams);
1230
- data = formData;
1231
- localVarHeaderParams = {
1232
- ...localVarHeaderParams,
1233
- ...formData.getHeaders(),
1234
- };
1235
- }
1236
-
1237
- let localVarRequestOptions: AxiosRequestConfig = {
1238
- method: 'GET',
1239
- params: localVarQueryParameters,
1240
- headers: localVarHeaderParams,
1241
- url: localVarPath,
1242
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
1243
- maxContentLength: Infinity,
1244
- maxBodyLength: Infinity,
1245
- responseType: "json",
1246
- };
1247
-
1248
- if (localVarRequestOptions.method !== 'GET') {
1249
- localVarRequestOptions.data = data;
1250
- }
1251
- let authenticationPromise = Promise.resolve();
1252
-
1253
- if (this.authentications["X-API-KEY"].apiKey) {
1254
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1255
- }
1256
- if (this.authentications["Bearer"].apiKey) {
1257
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1258
- }
1259
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1260
-
1261
- let interceptorPromise = authenticationPromise;
1262
- for (const interceptor of this.interceptors) {
1263
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1264
- }
1265
-
1266
- return interceptorPromise.then(() => {
1267
- return new Promise<TemplateProperties>((resolve, reject) => {
1268
- axios.request(localVarRequestOptions)
1269
- .then((response) => {
1270
- handleSuccessfulResponse<TemplateProperties>(
1271
- resolve,
1272
- reject,
1273
- response,
1274
- "TemplateProperties",
1275
- );
1276
- }, (error: AxiosError) => {
1277
- if (error.response == null) {
1278
- reject(error);
1279
- return;
1280
- }
1281
-
1282
- if (handleErrorCodeResponse(
1283
- reject,
1284
- error.response,
1285
- 200,
1286
- "TemplateProperties",
1287
- )) {
1288
- return;
1289
- }
1290
- if (handleErrorCodeResponse(
1291
- reject,
1292
- error.response,
1293
- 401,
1294
- "ErrorResult",
1295
- )) {
1296
- return;
1297
- }
1298
- if (handleErrorCodeResponse(
1299
- reject,
1300
- error.response,
1301
- 403,
1302
- "ErrorResult",
1303
- )) {
1304
- return;
1305
- }
1306
-
1307
-
1308
- reject(error);
1309
- });
1310
- });
1311
- });
1312
- }
1313
- /**
1314
- *
1315
- * @summary List all the templates.
1316
- * @param page
1317
- * @param templateType
1318
- * @param pageSize
1319
- * @param searchKey
1320
- * @param onBehalfOf The sender identity\&#39;s email used to filter the templates returned in the API. The API will return templates that were sent on behalf of the specified email address.
1321
- * @param createdBy The templates can be listed by the creator of the template.
1322
- * @param templateLabels Labels of the template.
1323
- * @param startDate Start date of the template
1324
- * @param endDate End date of the template
1325
- * @param brandIds BrandId(s) of the template.
1326
- * @param options
1327
- */
1328
- public async listTemplates (page: number, templateType?: 'mytemplates' | 'sharedtemplate' | 'all', pageSize?: number, searchKey?: string, onBehalfOf?: Array<string>, createdBy?: Array<string>, templateLabels?: Array<string>, startDate?: Date, endDate?: Date, brandIds?: Array<string>, options: optionsI = {headers: {}}) : Promise<TemplateRecords> {
1329
- const localVarPath = this.basePath + '/v1/template/list';
1330
- let localVarQueryParameters: any = {};
1331
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1332
- const produces = ['application/json'];
1333
- // give precedence to 'application/json'
1334
- if (produces.indexOf('application/json') >= 0) {
1335
- localVarHeaderParams['content-type'] = 'application/json';
1336
- } else {
1337
- localVarHeaderParams['content-type'] = produces.join(',');
1338
- }
1339
- let localVarFormParams: any = {};
1340
- let localVarBodyParams: any = undefined;
1341
-
1342
- // verify required parameter 'page' is not null or undefined
1343
- if (page === null || page === undefined) {
1344
- throw new Error('Required parameter page was null or undefined when calling listTemplates.');
1345
- }
1346
-
1347
- if (templateType !== undefined) {
1348
- localVarQueryParameters['TemplateType'] = ObjectSerializer.serialize(templateType, "'mytemplates' | 'sharedtemplate' | 'all'");
1349
- }
1350
-
1351
- if (pageSize !== undefined) {
1352
- localVarQueryParameters['PageSize'] = ObjectSerializer.serialize(pageSize, "number");
1353
- }
1354
-
1355
- if (page !== undefined) {
1356
- localVarQueryParameters['Page'] = ObjectSerializer.serialize(page, "number");
1357
- }
1358
-
1359
- if (searchKey !== undefined) {
1360
- localVarQueryParameters['SearchKey'] = ObjectSerializer.serialize(searchKey, "string");
1361
- }
1362
-
1363
- if (onBehalfOf !== undefined) {
1364
- localVarQueryParameters['OnBehalfOf'] = ObjectSerializer.serialize(onBehalfOf, "Array<string>");
1365
- }
1366
-
1367
- if (createdBy !== undefined) {
1368
- localVarQueryParameters['CreatedBy'] = ObjectSerializer.serialize(createdBy, "Array<string>");
1369
- }
1370
-
1371
- if (templateLabels !== undefined) {
1372
- localVarQueryParameters['TemplateLabels'] = ObjectSerializer.serialize(templateLabels, "Array<string>");
1373
- }
1374
-
1375
- if (startDate !== undefined) {
1376
- localVarQueryParameters['StartDate'] = ObjectSerializer.serialize(startDate, "Date");
1377
- }
1378
-
1379
- if (endDate !== undefined) {
1380
- localVarQueryParameters['EndDate'] = ObjectSerializer.serialize(endDate, "Date");
1381
- }
1382
-
1383
- if (brandIds !== undefined) {
1384
- localVarQueryParameters['BrandIds'] = ObjectSerializer.serialize(brandIds, "Array<string>");
1385
- }
1386
-
1387
- (<any>Object).assign(localVarHeaderParams, options.headers);
1388
-
1389
- let localVarUseFormData = false;
1390
-
1391
- let data = {};
1392
- if (localVarUseFormData) {
1393
- const formData = toFormData(localVarFormParams);
1394
- data = formData;
1395
- localVarHeaderParams = {
1396
- ...localVarHeaderParams,
1397
- ...formData.getHeaders(),
1398
- };
1399
- }
1400
-
1401
- let localVarRequestOptions: AxiosRequestConfig = {
1402
- method: 'GET',
1403
- params: localVarQueryParameters,
1404
- headers: localVarHeaderParams,
1405
- url: localVarPath,
1406
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
1407
- maxContentLength: Infinity,
1408
- maxBodyLength: Infinity,
1409
- responseType: "json",
1410
- };
1411
-
1412
- if (localVarRequestOptions.method !== 'GET') {
1413
- localVarRequestOptions.data = data;
1414
- }
1415
- let authenticationPromise = Promise.resolve();
1416
-
1417
- if (this.authentications["X-API-KEY"].apiKey) {
1418
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1419
- }
1420
- if (this.authentications["Bearer"].apiKey) {
1421
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1422
- }
1423
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1424
-
1425
- let interceptorPromise = authenticationPromise;
1426
- for (const interceptor of this.interceptors) {
1427
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1428
- }
1429
-
1430
- return interceptorPromise.then(() => {
1431
- return new Promise<TemplateRecords>((resolve, reject) => {
1432
- axios.request(localVarRequestOptions)
1433
- .then((response) => {
1434
- handleSuccessfulResponse<TemplateRecords>(
1435
- resolve,
1436
- reject,
1437
- response,
1438
- "TemplateRecords",
1439
- );
1440
- }, (error: AxiosError) => {
1441
- if (error.response == null) {
1442
- reject(error);
1443
- return;
1444
- }
1445
-
1446
- if (handleErrorCodeResponse(
1447
- reject,
1448
- error.response,
1449
- 200,
1450
- "TemplateRecords",
1451
- )) {
1452
- return;
1453
- }
1454
- if (handleErrorCodeResponse(
1455
- reject,
1456
- error.response,
1457
- 401,
1458
- "ErrorResult",
1459
- )) {
1460
- return;
1461
- }
1462
-
1463
-
1464
- reject(error);
1465
- });
1466
- });
1467
- });
1468
- }
1469
- /**
1470
- *
1471
- * @summary Send the document by merging multiple templates.
1472
- * @param mergeAndSendForSignForm The merge and send details as JSON.
1473
- * @param options
1474
- */
1475
- public async mergeAndSend (mergeAndSendForSignForm?: MergeAndSendForSignForm, options: optionsI = {headers: {}}) : Promise<DocumentCreated> {
1476
- mergeAndSendForSignForm = deserializeIfNeeded(mergeAndSendForSignForm, "MergeAndSendForSignForm");
1477
- const localVarPath = this.basePath + '/v1/template/mergeAndSend';
1478
- let localVarQueryParameters: any = {};
1479
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1480
- const produces = ['application/json'];
1481
- // give precedence to 'application/json'
1482
- if (produces.indexOf('application/json') >= 0) {
1483
- localVarHeaderParams['content-type'] = 'application/json';
1484
- } else {
1485
- localVarHeaderParams['content-type'] = produces.join(',');
1486
- }
1487
- let localVarFormParams: any = {};
1488
- let localVarBodyParams: any = undefined;
1489
-
1490
- (<any>Object).assign(localVarHeaderParams, options.headers);
1491
-
1492
- let localVarUseFormData = false;
1493
-
1494
- const result = generateFormData(mergeAndSendForSignForm, MergeAndSendForSignForm);
1495
- localVarUseFormData = result.localVarUseFormData;
1496
-
1497
- let data = {};
1498
- if (localVarUseFormData) {
1499
- const formData = toFormData(result.data);
1500
- data = formData;
1501
- localVarHeaderParams = {
1502
- ...localVarHeaderParams,
1503
- ...formData.getHeaders(),
1504
- };
1505
- } else {
1506
- data = ObjectSerializer.serialize(
1507
- mergeAndSendForSignForm,
1508
- "MergeAndSendForSignForm"
1509
- );
1510
- }
1511
-
1512
- let localVarRequestOptions: AxiosRequestConfig = {
1513
- method: 'POST',
1514
- params: localVarQueryParameters,
1515
- headers: localVarHeaderParams,
1516
- url: localVarPath,
1517
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
1518
- maxContentLength: Infinity,
1519
- maxBodyLength: Infinity,
1520
- responseType: "json",
1521
- };
1522
-
1523
- if (localVarRequestOptions.method !== 'GET') {
1524
- localVarRequestOptions.data = data;
1525
- }
1526
- let authenticationPromise = Promise.resolve();
1527
-
1528
- if (this.authentications["X-API-KEY"].apiKey) {
1529
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1530
- }
1531
- if (this.authentications["Bearer"].apiKey) {
1532
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1533
- }
1534
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1535
-
1536
- let interceptorPromise = authenticationPromise;
1537
- for (const interceptor of this.interceptors) {
1538
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1539
- }
1540
-
1541
- return interceptorPromise.then(() => {
1542
- return new Promise<DocumentCreated>((resolve, reject) => {
1543
- axios.request(localVarRequestOptions)
1544
- .then((response) => {
1545
- handleSuccessfulResponse<DocumentCreated>(
1546
- resolve,
1547
- reject,
1548
- response,
1549
- "DocumentCreated",
1550
- );
1551
- }, (error: AxiosError) => {
1552
- if (error.response == null) {
1553
- reject(error);
1554
- return;
1555
- }
1556
-
1557
- if (handleErrorCodeResponse(
1558
- reject,
1559
- error.response,
1560
- 201,
1561
- "DocumentCreated",
1562
- )) {
1563
- return;
1564
- }
1565
- if (handleErrorCodeResponse(
1566
- reject,
1567
- error.response,
1568
- 422,
1569
- "ErrorResult",
1570
- )) {
1571
- return;
1572
- }
1573
- if (handleErrorCodeResponse(
1574
- reject,
1575
- error.response,
1576
- 401,
1577
- "ErrorResult",
1578
- )) {
1579
- return;
1580
- }
1581
-
1582
-
1583
- reject(error);
1584
- });
1585
- });
1586
- });
1587
- }
1588
- /**
1589
- *
1590
- * @summary Generates a merge request URL using a template that combines document merging and sending processes into your application.
1591
- * @param embeddedMergeTemplateFormRequest Embedded merge and send template json request.
1592
- * @param options
1593
- */
1594
- public async mergeCreateEmbeddedRequestUrlTemplate (embeddedMergeTemplateFormRequest?: EmbeddedMergeTemplateFormRequest, options: optionsI = {headers: {}}) : Promise<EmbeddedSendCreated> {
1595
- embeddedMergeTemplateFormRequest = deserializeIfNeeded(embeddedMergeTemplateFormRequest, "EmbeddedMergeTemplateFormRequest");
1596
- const localVarPath = this.basePath + '/v1/template/mergeCreateEmbeddedRequestUrl';
1597
- let localVarQueryParameters: any = {};
1598
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1599
- const produces = ['application/json'];
1600
- // give precedence to 'application/json'
1601
- if (produces.indexOf('application/json') >= 0) {
1602
- localVarHeaderParams['content-type'] = 'application/json';
1603
- } else {
1604
- localVarHeaderParams['content-type'] = produces.join(',');
1605
- }
1606
- let localVarFormParams: any = {};
1607
- let localVarBodyParams: any = undefined;
1608
-
1609
- (<any>Object).assign(localVarHeaderParams, options.headers);
1610
-
1611
- let localVarUseFormData = false;
1612
-
1613
- const result = generateFormData(embeddedMergeTemplateFormRequest, EmbeddedMergeTemplateFormRequest);
1614
- localVarUseFormData = result.localVarUseFormData;
1615
-
1616
- let data = {};
1617
- if (localVarUseFormData) {
1618
- const formData = toFormData(result.data);
1619
- data = formData;
1620
- localVarHeaderParams = {
1621
- ...localVarHeaderParams,
1622
- ...formData.getHeaders(),
1623
- };
1624
- } else {
1625
- data = ObjectSerializer.serialize(
1626
- embeddedMergeTemplateFormRequest,
1627
- "EmbeddedMergeTemplateFormRequest"
1628
- );
1629
- }
1630
-
1631
- let localVarRequestOptions: AxiosRequestConfig = {
1632
- method: 'POST',
1633
- params: localVarQueryParameters,
1634
- headers: localVarHeaderParams,
1635
- url: localVarPath,
1636
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
1637
- maxContentLength: Infinity,
1638
- maxBodyLength: Infinity,
1639
- responseType: "json",
1640
- };
1641
-
1642
- if (localVarRequestOptions.method !== 'GET') {
1643
- localVarRequestOptions.data = data;
1644
- }
1645
- let authenticationPromise = Promise.resolve();
1646
-
1647
- if (this.authentications["X-API-KEY"].apiKey) {
1648
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1649
- }
1650
- if (this.authentications["Bearer"].apiKey) {
1651
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1652
- }
1653
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1654
-
1655
- let interceptorPromise = authenticationPromise;
1656
- for (const interceptor of this.interceptors) {
1657
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1658
- }
1659
-
1660
- return interceptorPromise.then(() => {
1661
- return new Promise<EmbeddedSendCreated>((resolve, reject) => {
1662
- axios.request(localVarRequestOptions)
1663
- .then((response) => {
1664
- handleSuccessfulResponse<EmbeddedSendCreated>(
1665
- resolve,
1666
- reject,
1667
- response,
1668
- "EmbeddedSendCreated",
1669
- );
1670
- }, (error: AxiosError) => {
1671
- if (error.response == null) {
1672
- reject(error);
1673
- return;
1674
- }
1675
-
1676
- if (handleErrorCodeResponse(
1677
- reject,
1678
- error.response,
1679
- 201,
1680
- "EmbeddedSendCreated",
1681
- )) {
1682
- return;
1683
- }
1684
- if (handleErrorCodeResponse(
1685
- reject,
1686
- error.response,
1687
- 422,
1688
- "ErrorResult",
1689
- )) {
1690
- return;
1691
- }
1692
- if (handleErrorCodeResponse(
1693
- reject,
1694
- error.response,
1695
- 401,
1696
- "ErrorResult",
1697
- )) {
1698
- return;
1699
- }
1700
-
1701
-
1702
- reject(error);
1703
- });
1704
- });
1705
- });
1706
- }
1707
- /**
1708
- *
1709
- * @summary Send a document for signature using a Template.
1710
- * @param templateId The template id.
1711
- * @param sendForSignFromTemplateForm The send template details as JSON.
1712
- * @param options
1713
- */
1714
- public async sendUsingTemplate (templateId: string, sendForSignFromTemplateForm?: SendForSignFromTemplateForm, options: optionsI = {headers: {}}) : Promise<DocumentCreated> {
1715
- sendForSignFromTemplateForm = deserializeIfNeeded(sendForSignFromTemplateForm, "SendForSignFromTemplateForm");
1716
- const localVarPath = this.basePath + '/v1/template/send';
1717
- let localVarQueryParameters: any = {};
1718
- let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1719
- const produces = ['application/json'];
1720
- // give precedence to 'application/json'
1721
- if (produces.indexOf('application/json') >= 0) {
1722
- localVarHeaderParams['content-type'] = 'application/json';
1723
- } else {
1724
- localVarHeaderParams['content-type'] = produces.join(',');
1725
- }
1726
- let localVarFormParams: any = {};
1727
- let localVarBodyParams: any = undefined;
1728
-
1729
- // verify required parameter 'templateId' is not null or undefined
1730
- if (templateId === null || templateId === undefined) {
1731
- throw new Error('Required parameter templateId was null or undefined when calling sendUsingTemplate.');
1732
- }
1733
-
1734
- if (templateId !== undefined) {
1735
- localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
1736
- }
1737
-
1738
- (<any>Object).assign(localVarHeaderParams, options.headers);
1739
-
1740
- let localVarUseFormData = false;
1741
-
1742
- const result = generateFormData(sendForSignFromTemplateForm, SendForSignFromTemplateForm);
1743
- localVarUseFormData = result.localVarUseFormData;
1744
-
1745
- let data = {};
1746
- if (localVarUseFormData) {
1747
- const formData = toFormData(result.data);
1748
- data = formData;
1749
- localVarHeaderParams = {
1750
- ...localVarHeaderParams,
1751
- ...formData.getHeaders(),
1752
- };
1753
- } else {
1754
- data = ObjectSerializer.serialize(
1755
- sendForSignFromTemplateForm,
1756
- "SendForSignFromTemplateForm"
1757
- );
1758
- }
1759
-
1760
- let localVarRequestOptions: AxiosRequestConfig = {
1761
- method: 'POST',
1762
- params: localVarQueryParameters,
1763
- headers: localVarHeaderParams,
1764
- url: localVarPath,
1765
- paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
1766
- maxContentLength: Infinity,
1767
- maxBodyLength: Infinity,
1768
- responseType: "json",
1769
- };
1770
-
1771
- if (localVarRequestOptions.method !== 'GET') {
1772
- localVarRequestOptions.data = data;
1773
- }
1774
- let authenticationPromise = Promise.resolve();
1775
-
1776
- if (this.authentications["X-API-KEY"].apiKey) {
1777
- authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1778
- }
1779
- if (this.authentications["Bearer"].apiKey) {
1780
- authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1781
- }
1782
- authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1783
-
1784
- let interceptorPromise = authenticationPromise;
1785
- for (const interceptor of this.interceptors) {
1786
- interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1787
- }
1788
-
1789
- return interceptorPromise.then(() => {
1790
- return new Promise<DocumentCreated>((resolve, reject) => {
1791
- axios.request(localVarRequestOptions)
1792
- .then((response) => {
1793
- handleSuccessfulResponse<DocumentCreated>(
1794
- resolve,
1795
- reject,
1796
- response,
1797
- "DocumentCreated",
1798
- );
1799
- }, (error: AxiosError) => {
1800
- if (error.response == null) {
1801
- reject(error);
1802
- return;
1803
- }
1804
-
1805
- if (handleErrorCodeResponse(
1806
- reject,
1807
- error.response,
1808
- 201,
1809
- "DocumentCreated",
1810
- )) {
1811
- return;
1812
- }
1813
- if (handleErrorCodeResponse(
1814
- reject,
1815
- error.response,
1816
- 401,
1817
- "ErrorResult",
1818
- )) {
1819
- return;
1820
- }
1821
- if (handleErrorCodeResponse(
1822
- reject,
1823
- error.response,
1824
- 422,
1825
- "ErrorResult",
1826
- )) {
1827
- return;
1828
- }
1829
-
1830
-
1831
- reject(error);
1832
- });
1833
- });
1834
- });
1835
- }
1836
- }
1837
-
1838
- function deserializeIfNeeded<T> (obj: T, classname: string): T {
1839
- if (obj !== null && obj !== undefined && obj.constructor.name !== classname) {
1840
- return ObjectSerializer.deserialize(obj, classname);
1841
- }
1842
-
1843
- return obj;
1844
- }
1845
-
1846
- type AxiosResolve<T> = (
1847
- value: (T | PromiseLike<T>),
1848
- ) => void
1849
-
1850
- type AxiosReject = (reason?: any) => void;
1851
-
1852
- function handleSuccessfulResponse<T>(
1853
- resolve: AxiosResolve<T>,
1854
- reject: AxiosReject,
1855
- response: AxiosResponse,
1856
- returnType?: string,
1857
- ) {
1858
- let body = response.data;
1859
-
1860
- if (
1861
- response.status &&
1862
- response.status >= 200 &&
1863
- response.status <= 299
1864
- ) {
1865
- if (returnType) {
1866
- body = ObjectSerializer.deserialize(body, returnType);
1867
- }
1868
-
1869
- resolve(body);
1870
- } else {
1871
- reject(new HttpError(response, body, response.status));
1872
- }
1873
- }
1874
-
1875
- function handleErrorCodeResponse(
1876
- reject: AxiosReject,
1877
- response: AxiosResponse,
1878
- code: number,
1879
- returnType: string
1880
- ): boolean {
1881
- if (response.status !== code) {
1882
- return false;
1883
- }
1884
-
1885
- let body = response.data;
1886
- if(code === 401) {
1887
- body = "Unauthorized request (401): Invalid authentication.";
1888
- }
1889
- reject(new HttpError(response, body, response.status));
1890
-
1891
- return true;
1892
- }
1893
-
1894
- function handleErrorRangeResponse(
1895
- reject: AxiosReject,
1896
- response: AxiosResponse,
1897
- code: string,
1898
- returnType: string
1899
- ): boolean {
1900
- let rangeCodeLeft = Number(code[0] + "00");
1901
- let rangeCodeRight = Number(code[0] + "99");
1902
-
1903
- if (response.status >= rangeCodeLeft && response.status <= rangeCodeRight) {
1904
- const body = ObjectSerializer.deserialize(
1905
- response.data,
1906
- returnType,
1907
- );
1908
-
1909
- reject(new HttpError(response, body, response.status));
1910
-
1911
- return true;
1912
- }
1913
-
1914
- return false;
1915
- }
1
+ /**
2
+ * BoldSign API
3
+ * No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)
4
+ *
5
+ * The version of the OpenAPI document: 1
6
+ *
7
+ *
8
+ * NOTE: This class is auto generated by OpenAPI Generator (https://openapi-generator.tech).
9
+ * https://openapi-generator.tech
10
+ * Do not edit the class manually.
11
+ */
12
+
13
+ import axios, { AxiosError, AxiosRequestConfig, AxiosResponse } from 'axios';
14
+
15
+ import {
16
+ ObjectSerializer, Authentication, VoidAuth, Interceptor,
17
+ HttpBasicAuth, HttpBearerAuth, ApiKeyAuth, OAuth, RequestFile,
18
+ CreateTemplateRequest,DocumentCreated,EditTemplateRequest,EmbeddedCreateTemplateRequest,EmbeddedMergeTemplateFormRequest,EmbeddedSendCreated,EmbeddedSendTemplateFormRequest,EmbeddedTemplateCreated,EmbeddedTemplateEditRequest,EmbeddedTemplateEdited,ErrorResult,MergeAndSendForSignForm,SendForSignFromTemplateForm,TemplateCreated,TemplateProperties,TemplateRecords,TemplateTag,
19
+ } from '../model';
20
+
21
+ import {
22
+ HttpError,
23
+ optionsI,
24
+ returnTypeT,
25
+ returnTypeI,
26
+ generateFormData,
27
+ toFormData,
28
+ queryParamsSerializer,
29
+ USER_AGENT,
30
+ } from './';
31
+
32
+ let defaultBasePath = 'https://api.boldsign.com';
33
+
34
+ // ===============================================
35
+ // This file is autogenerated - Please do not edit
36
+ // ===============================================
37
+
38
+
39
+ export class TemplateApi {
40
+ protected _basePath = defaultBasePath;
41
+ protected _defaultHeaders : any = { 'User-Agent': USER_AGENT };
42
+ protected _useQuerystring : boolean = true;
43
+
44
+ protected authentications = {
45
+ 'default': <Authentication>new VoidAuth(),
46
+ 'Bearer': new ApiKeyAuth('header', 'Authorization'),
47
+ 'X-API-KEY': new ApiKeyAuth('header', 'X-API-KEY'),
48
+ }
49
+
50
+ protected interceptors: Interceptor[] = [];
51
+
52
+ constructor(basePath?: string) {
53
+ if (basePath) {
54
+ this.basePath = basePath;
55
+ }
56
+ }
57
+
58
+ set useQuerystring(value: boolean) {
59
+ this._useQuerystring = value;
60
+ }
61
+
62
+ set basePath(basePath: string) {
63
+ this._basePath = basePath;
64
+ }
65
+
66
+ set defaultHeaders(defaultHeaders: any) {
67
+ this._defaultHeaders = { ...defaultHeaders, "User-Agent": USER_AGENT };
68
+ }
69
+
70
+ get defaultHeaders() {
71
+ return this._defaultHeaders;
72
+ }
73
+
74
+ get basePath() {
75
+ return this._basePath;
76
+ }
77
+
78
+ public setDefaultAuthentication(auth: Authentication) {
79
+ this.authentications.default = auth;
80
+ }
81
+
82
+ public setApiKey(apikey: string) {
83
+ this.authentications["X-API-KEY"].apiKey = apikey;
84
+ }
85
+
86
+ public setAccessToken(accessToken: string) {
87
+ this.authentications["Bearer"].apiKey = 'bearer ' + accessToken;
88
+ }
89
+
90
+ public addInterceptor(interceptor: Interceptor) {
91
+ this.interceptors.push(interceptor);
92
+ }
93
+
94
+ /**
95
+ *
96
+ * @summary Add the Tags in Templates.
97
+ * @param templateTag ContainsTemplateId and Label Names for AddingTags.
98
+ * @param options
99
+ */
100
+ public async addTag (templateTag?: TemplateTag, options: optionsI = {headers: {}}) : Promise<returnTypeI> {
101
+ templateTag = deserializeIfNeeded(templateTag, "TemplateTag");
102
+ const localVarPath = this.basePath + '/v1/template/addTags';
103
+ let localVarQueryParameters: any = {};
104
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
105
+ const produces = ['application/json;odata.metadata=minimal;odata.streaming=true', 'application/json;odata.metadata=minimal;odata.streaming=false', 'application/json;odata.metadata=minimal', 'application/json;odata.metadata=full;odata.streaming=true', 'application/json;odata.metadata=full;odata.streaming=false', 'application/json;odata.metadata=full', 'application/json;odata.metadata=none;odata.streaming=true', 'application/json;odata.metadata=none;odata.streaming=false', 'application/json;odata.metadata=none', 'application/json;odata.streaming=true', 'application/json;odata.streaming=false', 'application/json', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=full;IEEE754Compatible=false', 'application/json;odata.metadata=full;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=true', 'application/json;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.streaming=false;IEEE754Compatible=true', 'application/json;IEEE754Compatible=false', 'application/json;IEEE754Compatible=true', 'application/xml', 'text/plain', 'application/octet-stream', 'text/json'];
106
+ // give precedence to 'application/json'
107
+ if (produces.indexOf('application/json') >= 0) {
108
+ localVarHeaderParams['content-type'] = 'application/json';
109
+ } else {
110
+ localVarHeaderParams['content-type'] = produces.join(',');
111
+ }
112
+ let localVarFormParams: any = {};
113
+ let localVarBodyParams: any = undefined;
114
+
115
+ (<any>Object).assign(localVarHeaderParams, options.headers);
116
+
117
+ let localVarUseFormData = false;
118
+
119
+ const result = generateFormData(templateTag, TemplateTag);
120
+ localVarUseFormData = result.localVarUseFormData;
121
+
122
+ let data = {};
123
+ if (localVarUseFormData) {
124
+ const formData = toFormData(result.data);
125
+ data = formData;
126
+ localVarHeaderParams = {
127
+ ...localVarHeaderParams,
128
+ ...formData.getHeaders(),
129
+ };
130
+ } else {
131
+ data = ObjectSerializer.serialize(
132
+ templateTag,
133
+ "TemplateTag"
134
+ );
135
+ }
136
+
137
+ let localVarRequestOptions: AxiosRequestConfig = {
138
+ method: 'PATCH',
139
+ params: localVarQueryParameters,
140
+ headers: localVarHeaderParams,
141
+ url: localVarPath,
142
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
143
+ maxContentLength: Infinity,
144
+ maxBodyLength: Infinity,
145
+ responseType: "json",
146
+ };
147
+
148
+ if (localVarRequestOptions.method !== 'GET') {
149
+ localVarRequestOptions.data = data;
150
+ }
151
+ let authenticationPromise = Promise.resolve();
152
+
153
+ if (this.authentications["X-API-KEY"].apiKey) {
154
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
155
+ }
156
+ if (this.authentications["Bearer"].apiKey) {
157
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
158
+ }
159
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
160
+
161
+ let interceptorPromise = authenticationPromise;
162
+ for (const interceptor of this.interceptors) {
163
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
164
+ }
165
+
166
+ return interceptorPromise.then(() => {
167
+ return new Promise<returnTypeI>((resolve, reject) => {
168
+ axios.request(localVarRequestOptions)
169
+ .then((response) => {
170
+ handleSuccessfulResponse(
171
+ resolve,
172
+ reject,
173
+ response,
174
+
175
+ );
176
+ }, (error: AxiosError) => {
177
+ if (error.response == null) {
178
+ reject(error);
179
+ return;
180
+ }
181
+
182
+ if (handleErrorCodeResponse(
183
+ reject,
184
+ error.response,
185
+ 400,
186
+ "ErrorResult",
187
+ )) {
188
+ return;
189
+ }
190
+ if (handleErrorCodeResponse(
191
+ reject,
192
+ error.response,
193
+ 401,
194
+ "ErrorResult",
195
+ )) {
196
+ return;
197
+ }
198
+
199
+
200
+ reject(error);
201
+ });
202
+ });
203
+ });
204
+ }
205
+ /**
206
+ *
207
+ * @summary Generates a send URL using a template which embeds document sending process into your application.
208
+ * @param templateId The template id.
209
+ * @param embeddedSendTemplateFormRequest Embedded send template json request.
210
+ * @param options
211
+ */
212
+ public async createEmbeddedRequestUrlTemplate (templateId: string, embeddedSendTemplateFormRequest?: EmbeddedSendTemplateFormRequest, options: optionsI = {headers: {}}) : Promise<EmbeddedSendCreated> {
213
+ embeddedSendTemplateFormRequest = deserializeIfNeeded(embeddedSendTemplateFormRequest, "EmbeddedSendTemplateFormRequest");
214
+ const localVarPath = this.basePath + '/v1/template/createEmbeddedRequestUrl';
215
+ let localVarQueryParameters: any = {};
216
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
217
+ const produces = ['application/json'];
218
+ // give precedence to 'application/json'
219
+ if (produces.indexOf('application/json') >= 0) {
220
+ localVarHeaderParams['content-type'] = 'application/json';
221
+ } else {
222
+ localVarHeaderParams['content-type'] = produces.join(',');
223
+ }
224
+ let localVarFormParams: any = {};
225
+ let localVarBodyParams: any = undefined;
226
+
227
+ // verify required parameter 'templateId' is not null or undefined
228
+ if (templateId === null || templateId === undefined) {
229
+ throw new Error('Required parameter templateId was null or undefined when calling createEmbeddedRequestUrlTemplate.');
230
+ }
231
+
232
+ if (templateId !== undefined) {
233
+ localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
234
+ }
235
+
236
+ (<any>Object).assign(localVarHeaderParams, options.headers);
237
+
238
+ let localVarUseFormData = false;
239
+
240
+ const result = generateFormData(embeddedSendTemplateFormRequest, EmbeddedSendTemplateFormRequest);
241
+ localVarUseFormData = result.localVarUseFormData;
242
+
243
+ let data = {};
244
+ if (localVarUseFormData) {
245
+ const formData = toFormData(result.data);
246
+ data = formData;
247
+ localVarHeaderParams = {
248
+ ...localVarHeaderParams,
249
+ ...formData.getHeaders(),
250
+ };
251
+ } else {
252
+ data = ObjectSerializer.serialize(
253
+ embeddedSendTemplateFormRequest,
254
+ "EmbeddedSendTemplateFormRequest"
255
+ );
256
+ }
257
+
258
+ let localVarRequestOptions: AxiosRequestConfig = {
259
+ method: 'POST',
260
+ params: localVarQueryParameters,
261
+ headers: localVarHeaderParams,
262
+ url: localVarPath,
263
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
264
+ maxContentLength: Infinity,
265
+ maxBodyLength: Infinity,
266
+ responseType: "json",
267
+ };
268
+
269
+ if (localVarRequestOptions.method !== 'GET') {
270
+ localVarRequestOptions.data = data;
271
+ }
272
+ let authenticationPromise = Promise.resolve();
273
+
274
+ if (this.authentications["X-API-KEY"].apiKey) {
275
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
276
+ }
277
+ if (this.authentications["Bearer"].apiKey) {
278
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
279
+ }
280
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
281
+
282
+ let interceptorPromise = authenticationPromise;
283
+ for (const interceptor of this.interceptors) {
284
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
285
+ }
286
+
287
+ return interceptorPromise.then(() => {
288
+ return new Promise<EmbeddedSendCreated>((resolve, reject) => {
289
+ axios.request(localVarRequestOptions)
290
+ .then((response) => {
291
+ handleSuccessfulResponse<EmbeddedSendCreated>(
292
+ resolve,
293
+ reject,
294
+ response,
295
+ "EmbeddedSendCreated",
296
+ );
297
+ }, (error: AxiosError) => {
298
+ if (error.response == null) {
299
+ reject(error);
300
+ return;
301
+ }
302
+
303
+ if (handleErrorCodeResponse(
304
+ reject,
305
+ error.response,
306
+ 201,
307
+ "EmbeddedSendCreated",
308
+ )) {
309
+ return;
310
+ }
311
+ if (handleErrorCodeResponse(
312
+ reject,
313
+ error.response,
314
+ 422,
315
+ "ErrorResult",
316
+ )) {
317
+ return;
318
+ }
319
+ if (handleErrorCodeResponse(
320
+ reject,
321
+ error.response,
322
+ 401,
323
+ "ErrorResult",
324
+ )) {
325
+ return;
326
+ }
327
+
328
+
329
+ reject(error);
330
+ });
331
+ });
332
+ });
333
+ }
334
+ /**
335
+ *
336
+ * @summary Generates a create URL to embeds template create process into your application.
337
+ * @param embeddedCreateTemplateRequest The create embedded template request body.
338
+ * @param options
339
+ */
340
+ public async createEmbeddedTemplateUrl (embeddedCreateTemplateRequest?: EmbeddedCreateTemplateRequest, options: optionsI = {headers: {}}) : Promise<EmbeddedTemplateCreated> {
341
+ embeddedCreateTemplateRequest = deserializeIfNeeded(embeddedCreateTemplateRequest, "EmbeddedCreateTemplateRequest");
342
+ const localVarPath = this.basePath + '/v1/template/createEmbeddedTemplateUrl';
343
+ let localVarQueryParameters: any = {};
344
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
345
+ const produces = ['application/json'];
346
+ // give precedence to 'application/json'
347
+ if (produces.indexOf('application/json') >= 0) {
348
+ localVarHeaderParams['content-type'] = 'application/json';
349
+ } else {
350
+ localVarHeaderParams['content-type'] = produces.join(',');
351
+ }
352
+ let localVarFormParams: any = {};
353
+ let localVarBodyParams: any = undefined;
354
+
355
+ (<any>Object).assign(localVarHeaderParams, options.headers);
356
+
357
+ let localVarUseFormData = false;
358
+
359
+ const result = generateFormData(embeddedCreateTemplateRequest, EmbeddedCreateTemplateRequest);
360
+ localVarUseFormData = result.localVarUseFormData;
361
+
362
+ let data = {};
363
+ if (localVarUseFormData) {
364
+ const formData = toFormData(result.data);
365
+ data = formData;
366
+ localVarHeaderParams = {
367
+ ...localVarHeaderParams,
368
+ ...formData.getHeaders(),
369
+ };
370
+ } else {
371
+ data = ObjectSerializer.serialize(
372
+ embeddedCreateTemplateRequest,
373
+ "EmbeddedCreateTemplateRequest"
374
+ );
375
+ }
376
+
377
+ let localVarRequestOptions: AxiosRequestConfig = {
378
+ method: 'POST',
379
+ params: localVarQueryParameters,
380
+ headers: localVarHeaderParams,
381
+ url: localVarPath,
382
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
383
+ maxContentLength: Infinity,
384
+ maxBodyLength: Infinity,
385
+ responseType: "json",
386
+ };
387
+
388
+ if (localVarRequestOptions.method !== 'GET') {
389
+ localVarRequestOptions.data = data;
390
+ }
391
+ let authenticationPromise = Promise.resolve();
392
+
393
+ if (this.authentications["X-API-KEY"].apiKey) {
394
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
395
+ }
396
+ if (this.authentications["Bearer"].apiKey) {
397
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
398
+ }
399
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
400
+
401
+ let interceptorPromise = authenticationPromise;
402
+ for (const interceptor of this.interceptors) {
403
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
404
+ }
405
+
406
+ return interceptorPromise.then(() => {
407
+ return new Promise<EmbeddedTemplateCreated>((resolve, reject) => {
408
+ axios.request(localVarRequestOptions)
409
+ .then((response) => {
410
+ handleSuccessfulResponse<EmbeddedTemplateCreated>(
411
+ resolve,
412
+ reject,
413
+ response,
414
+ "EmbeddedTemplateCreated",
415
+ );
416
+ }, (error: AxiosError) => {
417
+ if (error.response == null) {
418
+ reject(error);
419
+ return;
420
+ }
421
+
422
+ if (handleErrorCodeResponse(
423
+ reject,
424
+ error.response,
425
+ 201,
426
+ "EmbeddedTemplateCreated",
427
+ )) {
428
+ return;
429
+ }
430
+ if (handleErrorCodeResponse(
431
+ reject,
432
+ error.response,
433
+ 401,
434
+ "ErrorResult",
435
+ )) {
436
+ return;
437
+ }
438
+ if (handleErrorCodeResponse(
439
+ reject,
440
+ error.response,
441
+ 422,
442
+ "ErrorResult",
443
+ )) {
444
+ return;
445
+ }
446
+
447
+
448
+ reject(error);
449
+ });
450
+ });
451
+ });
452
+ }
453
+ /**
454
+ *
455
+ * @summary Creates a new template.
456
+ * @param createTemplateRequest The create template request body.
457
+ * @param options
458
+ */
459
+ public async createTemplate (createTemplateRequest?: CreateTemplateRequest, options: optionsI = {headers: {}}) : Promise<TemplateCreated> {
460
+ createTemplateRequest = deserializeIfNeeded(createTemplateRequest, "CreateTemplateRequest");
461
+ const localVarPath = this.basePath + '/v1/template/create';
462
+ let localVarQueryParameters: any = {};
463
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
464
+ const produces = ['application/json'];
465
+ // give precedence to 'application/json'
466
+ if (produces.indexOf('application/json') >= 0) {
467
+ localVarHeaderParams['content-type'] = 'application/json';
468
+ } else {
469
+ localVarHeaderParams['content-type'] = produces.join(',');
470
+ }
471
+ let localVarFormParams: any = {};
472
+ let localVarBodyParams: any = undefined;
473
+
474
+ (<any>Object).assign(localVarHeaderParams, options.headers);
475
+
476
+ let localVarUseFormData = false;
477
+
478
+ const result = generateFormData(createTemplateRequest, CreateTemplateRequest);
479
+ localVarUseFormData = result.localVarUseFormData;
480
+
481
+ let data = {};
482
+ if (localVarUseFormData) {
483
+ const formData = toFormData(result.data);
484
+ data = formData;
485
+ localVarHeaderParams = {
486
+ ...localVarHeaderParams,
487
+ ...formData.getHeaders(),
488
+ };
489
+ } else {
490
+ data = ObjectSerializer.serialize(
491
+ createTemplateRequest,
492
+ "CreateTemplateRequest"
493
+ );
494
+ }
495
+
496
+ let localVarRequestOptions: AxiosRequestConfig = {
497
+ method: 'POST',
498
+ params: localVarQueryParameters,
499
+ headers: localVarHeaderParams,
500
+ url: localVarPath,
501
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
502
+ maxContentLength: Infinity,
503
+ maxBodyLength: Infinity,
504
+ responseType: "json",
505
+ };
506
+
507
+ if (localVarRequestOptions.method !== 'GET') {
508
+ localVarRequestOptions.data = data;
509
+ }
510
+ let authenticationPromise = Promise.resolve();
511
+
512
+ if (this.authentications["X-API-KEY"].apiKey) {
513
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
514
+ }
515
+ if (this.authentications["Bearer"].apiKey) {
516
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
517
+ }
518
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
519
+
520
+ let interceptorPromise = authenticationPromise;
521
+ for (const interceptor of this.interceptors) {
522
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
523
+ }
524
+
525
+ return interceptorPromise.then(() => {
526
+ return new Promise<TemplateCreated>((resolve, reject) => {
527
+ axios.request(localVarRequestOptions)
528
+ .then((response) => {
529
+ handleSuccessfulResponse<TemplateCreated>(
530
+ resolve,
531
+ reject,
532
+ response,
533
+ "TemplateCreated",
534
+ );
535
+ }, (error: AxiosError) => {
536
+ if (error.response == null) {
537
+ reject(error);
538
+ return;
539
+ }
540
+
541
+ if (handleErrorCodeResponse(
542
+ reject,
543
+ error.response,
544
+ 201,
545
+ "TemplateCreated",
546
+ )) {
547
+ return;
548
+ }
549
+ if (handleErrorCodeResponse(
550
+ reject,
551
+ error.response,
552
+ 401,
553
+ "ErrorResult",
554
+ )) {
555
+ return;
556
+ }
557
+ if (handleErrorCodeResponse(
558
+ reject,
559
+ error.response,
560
+ 403,
561
+ "ErrorResult",
562
+ )) {
563
+ return;
564
+ }
565
+ if (handleErrorCodeResponse(
566
+ reject,
567
+ error.response,
568
+ 422,
569
+ "ErrorResult",
570
+ )) {
571
+ return;
572
+ }
573
+
574
+
575
+ reject(error);
576
+ });
577
+ });
578
+ });
579
+ }
580
+ /**
581
+ *
582
+ * @summary Deletes a template.
583
+ * @param templateId The template id.
584
+ * @param onBehalfOf The on behalfof email address.
585
+ * @param options
586
+ */
587
+ public async deleteTemplate (templateId: string, onBehalfOf?: string, options: optionsI = {headers: {}}) : Promise<returnTypeI> {
588
+ const localVarPath = this.basePath + '/v1/template/delete';
589
+ let localVarQueryParameters: any = {};
590
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
591
+ const produces = ['application/json'];
592
+ // give precedence to 'application/json'
593
+ if (produces.indexOf('application/json') >= 0) {
594
+ localVarHeaderParams['content-type'] = 'application/json';
595
+ } else {
596
+ localVarHeaderParams['content-type'] = produces.join(',');
597
+ }
598
+ let localVarFormParams: any = {};
599
+ let localVarBodyParams: any = undefined;
600
+
601
+ // verify required parameter 'templateId' is not null or undefined
602
+ if (templateId === null || templateId === undefined) {
603
+ throw new Error('Required parameter templateId was null or undefined when calling deleteTemplate.');
604
+ }
605
+
606
+ if (templateId !== undefined) {
607
+ localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
608
+ }
609
+
610
+ if (onBehalfOf !== undefined) {
611
+ localVarQueryParameters['onBehalfOf'] = ObjectSerializer.serialize(onBehalfOf, "string");
612
+ }
613
+
614
+ (<any>Object).assign(localVarHeaderParams, options.headers);
615
+
616
+ let localVarUseFormData = false;
617
+
618
+ let data = {};
619
+ if (localVarUseFormData) {
620
+ const formData = toFormData(localVarFormParams);
621
+ data = formData;
622
+ localVarHeaderParams = {
623
+ ...localVarHeaderParams,
624
+ ...formData.getHeaders(),
625
+ };
626
+ }
627
+
628
+ let localVarRequestOptions: AxiosRequestConfig = {
629
+ method: 'DELETE',
630
+ params: localVarQueryParameters,
631
+ headers: localVarHeaderParams,
632
+ url: localVarPath,
633
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
634
+ maxContentLength: Infinity,
635
+ maxBodyLength: Infinity,
636
+ responseType: "json",
637
+ };
638
+
639
+ if (localVarRequestOptions.method !== 'GET') {
640
+ localVarRequestOptions.data = data;
641
+ }
642
+ let authenticationPromise = Promise.resolve();
643
+
644
+ if (this.authentications["X-API-KEY"].apiKey) {
645
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
646
+ }
647
+ if (this.authentications["Bearer"].apiKey) {
648
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
649
+ }
650
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
651
+
652
+ let interceptorPromise = authenticationPromise;
653
+ for (const interceptor of this.interceptors) {
654
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
655
+ }
656
+
657
+ return interceptorPromise.then(() => {
658
+ return new Promise<returnTypeI>((resolve, reject) => {
659
+ axios.request(localVarRequestOptions)
660
+ .then((response) => {
661
+ handleSuccessfulResponse(
662
+ resolve,
663
+ reject,
664
+ response,
665
+
666
+ );
667
+ }, (error: AxiosError) => {
668
+ if (error.response == null) {
669
+ reject(error);
670
+ return;
671
+ }
672
+
673
+ if (handleErrorCodeResponse(
674
+ reject,
675
+ error.response,
676
+ 401,
677
+ "ErrorResult",
678
+ )) {
679
+ return;
680
+ }
681
+ if (handleErrorCodeResponse(
682
+ reject,
683
+ error.response,
684
+ 403,
685
+ "ErrorResult",
686
+ )) {
687
+ return;
688
+ }
689
+
690
+
691
+ reject(error);
692
+ });
693
+ });
694
+ });
695
+ }
696
+ /**
697
+ *
698
+ * @summary Delete the Tags in Templates.
699
+ * @param templateTag Contains TemplateId and LabelNames for Adding Tags.
700
+ * @param options
701
+ */
702
+ public async deleteTag (templateTag?: TemplateTag, options: optionsI = {headers: {}}) : Promise<returnTypeI> {
703
+ templateTag = deserializeIfNeeded(templateTag, "TemplateTag");
704
+ const localVarPath = this.basePath + '/v1/template/deleteTags';
705
+ let localVarQueryParameters: any = {};
706
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
707
+ const produces = ['application/json;odata.metadata=minimal;odata.streaming=true', 'application/json;odata.metadata=minimal;odata.streaming=false', 'application/json;odata.metadata=minimal', 'application/json;odata.metadata=full;odata.streaming=true', 'application/json;odata.metadata=full;odata.streaming=false', 'application/json;odata.metadata=full', 'application/json;odata.metadata=none;odata.streaming=true', 'application/json;odata.metadata=none;odata.streaming=false', 'application/json;odata.metadata=none', 'application/json;odata.streaming=true', 'application/json;odata.streaming=false', 'application/json', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=minimal;IEEE754Compatible=false', 'application/json;odata.metadata=minimal;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=full;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=full;IEEE754Compatible=false', 'application/json;odata.metadata=full;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.metadata=none;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=true', 'application/json;odata.metadata=none;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=false', 'application/json;odata.metadata=none;IEEE754Compatible=true', 'application/json;odata.streaming=true;IEEE754Compatible=false', 'application/json;odata.streaming=true;IEEE754Compatible=true', 'application/json;odata.streaming=false;IEEE754Compatible=false', 'application/json;odata.streaming=false;IEEE754Compatible=true', 'application/json;IEEE754Compatible=false', 'application/json;IEEE754Compatible=true', 'application/xml', 'text/plain', 'application/octet-stream', 'text/json'];
708
+ // give precedence to 'application/json'
709
+ if (produces.indexOf('application/json') >= 0) {
710
+ localVarHeaderParams['content-type'] = 'application/json';
711
+ } else {
712
+ localVarHeaderParams['content-type'] = produces.join(',');
713
+ }
714
+ let localVarFormParams: any = {};
715
+ let localVarBodyParams: any = undefined;
716
+
717
+ (<any>Object).assign(localVarHeaderParams, options.headers);
718
+
719
+ let localVarUseFormData = false;
720
+
721
+ const result = generateFormData(templateTag, TemplateTag);
722
+ localVarUseFormData = result.localVarUseFormData;
723
+
724
+ let data = {};
725
+ if (localVarUseFormData) {
726
+ const formData = toFormData(result.data);
727
+ data = formData;
728
+ localVarHeaderParams = {
729
+ ...localVarHeaderParams,
730
+ ...formData.getHeaders(),
731
+ };
732
+ } else {
733
+ data = ObjectSerializer.serialize(
734
+ templateTag,
735
+ "TemplateTag"
736
+ );
737
+ }
738
+
739
+ let localVarRequestOptions: AxiosRequestConfig = {
740
+ method: 'DELETE',
741
+ params: localVarQueryParameters,
742
+ headers: localVarHeaderParams,
743
+ url: localVarPath,
744
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
745
+ maxContentLength: Infinity,
746
+ maxBodyLength: Infinity,
747
+ responseType: "json",
748
+ };
749
+
750
+ if (localVarRequestOptions.method !== 'GET') {
751
+ localVarRequestOptions.data = data;
752
+ }
753
+ let authenticationPromise = Promise.resolve();
754
+
755
+ if (this.authentications["X-API-KEY"].apiKey) {
756
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
757
+ }
758
+ if (this.authentications["Bearer"].apiKey) {
759
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
760
+ }
761
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
762
+
763
+ let interceptorPromise = authenticationPromise;
764
+ for (const interceptor of this.interceptors) {
765
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
766
+ }
767
+
768
+ return interceptorPromise.then(() => {
769
+ return new Promise<returnTypeI>((resolve, reject) => {
770
+ axios.request(localVarRequestOptions)
771
+ .then((response) => {
772
+ handleSuccessfulResponse(
773
+ resolve,
774
+ reject,
775
+ response,
776
+
777
+ );
778
+ }, (error: AxiosError) => {
779
+ if (error.response == null) {
780
+ reject(error);
781
+ return;
782
+ }
783
+
784
+ if (handleErrorCodeResponse(
785
+ reject,
786
+ error.response,
787
+ 401,
788
+ "ErrorResult",
789
+ )) {
790
+ return;
791
+ }
792
+ if (handleErrorCodeResponse(
793
+ reject,
794
+ error.response,
795
+ 400,
796
+ "ErrorResult",
797
+ )) {
798
+ return;
799
+ }
800
+
801
+
802
+ reject(error);
803
+ });
804
+ });
805
+ });
806
+ }
807
+ /**
808
+ *
809
+ * @summary Download the template.
810
+ * @param templateId Template Id.
811
+ * @param onBehalfOf The on behalfof email address.
812
+ * @param options
813
+ */
814
+ public async download (templateId: string, onBehalfOf?: string, options: optionsI = {headers: {}}) : Promise<Buffer> {
815
+ const localVarPath = this.basePath + '/v1/template/download';
816
+ let localVarQueryParameters: any = {};
817
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
818
+ const produces = ['application/json'];
819
+ // give precedence to 'application/json'
820
+ if (produces.indexOf('application/json') >= 0) {
821
+ localVarHeaderParams['content-type'] = 'application/json';
822
+ } else {
823
+ localVarHeaderParams['content-type'] = produces.join(',');
824
+ }
825
+ let localVarFormParams: any = {};
826
+ let localVarBodyParams: any = undefined;
827
+
828
+ // verify required parameter 'templateId' is not null or undefined
829
+ if (templateId === null || templateId === undefined) {
830
+ throw new Error('Required parameter templateId was null or undefined when calling download.');
831
+ }
832
+
833
+ if (templateId !== undefined) {
834
+ localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
835
+ }
836
+
837
+ if (onBehalfOf !== undefined) {
838
+ localVarQueryParameters['onBehalfOf'] = ObjectSerializer.serialize(onBehalfOf, "string");
839
+ }
840
+
841
+ (<any>Object).assign(localVarHeaderParams, options.headers);
842
+
843
+ let localVarUseFormData = false;
844
+
845
+ let data = {};
846
+ if (localVarUseFormData) {
847
+ const formData = toFormData(localVarFormParams);
848
+ data = formData;
849
+ localVarHeaderParams = {
850
+ ...localVarHeaderParams,
851
+ ...formData.getHeaders(),
852
+ };
853
+ }
854
+
855
+ let localVarRequestOptions: AxiosRequestConfig = {
856
+ method: 'GET',
857
+ params: localVarQueryParameters,
858
+ headers: localVarHeaderParams,
859
+ url: localVarPath,
860
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
861
+ maxContentLength: Infinity,
862
+ maxBodyLength: Infinity,
863
+ responseType: "arraybuffer",
864
+ };
865
+
866
+ if (localVarRequestOptions.method !== 'GET') {
867
+ localVarRequestOptions.data = data;
868
+ }
869
+ let authenticationPromise = Promise.resolve();
870
+
871
+ if (this.authentications["X-API-KEY"].apiKey) {
872
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
873
+ }
874
+ if (this.authentications["Bearer"].apiKey) {
875
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
876
+ }
877
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
878
+
879
+ let interceptorPromise = authenticationPromise;
880
+ for (const interceptor of this.interceptors) {
881
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
882
+ }
883
+
884
+ return interceptorPromise.then(() => {
885
+ return new Promise<Buffer>((resolve, reject) => {
886
+ axios.request(localVarRequestOptions)
887
+ .then((response) => {
888
+ handleSuccessfulResponse<Buffer>(
889
+ resolve,
890
+ reject,
891
+ response,
892
+ "Buffer",
893
+ );
894
+ }, (error: AxiosError) => {
895
+ if (error.response == null) {
896
+ reject(error);
897
+ return;
898
+ }
899
+
900
+ if (handleErrorCodeResponse(
901
+ reject,
902
+ error.response,
903
+ 200,
904
+ "RequestFile",
905
+ )) {
906
+ return;
907
+ }
908
+ if (handleErrorCodeResponse(
909
+ reject,
910
+ error.response,
911
+ 401,
912
+ "ErrorResult",
913
+ )) {
914
+ return;
915
+ }
916
+ if (handleErrorCodeResponse(
917
+ reject,
918
+ error.response,
919
+ 400,
920
+ "ErrorResult",
921
+ )) {
922
+ return;
923
+ }
924
+
925
+
926
+ reject(error);
927
+ });
928
+ });
929
+ });
930
+ }
931
+ /**
932
+ *
933
+ * @summary Edit and updates an existing template.
934
+ * @param templateId The template id.
935
+ * @param editTemplateRequest The edit template request body.
936
+ * @param options
937
+ */
938
+ public async editTemplate (templateId: string, editTemplateRequest: EditTemplateRequest, options: optionsI = {headers: {}}) : Promise<returnTypeI> {
939
+ editTemplateRequest = deserializeIfNeeded(editTemplateRequest, "EditTemplateRequest");
940
+ const localVarPath = this.basePath + '/v1/template/edit';
941
+ let localVarQueryParameters: any = {};
942
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
943
+ const produces = ['application/json'];
944
+ // give precedence to 'application/json'
945
+ if (produces.indexOf('application/json') >= 0) {
946
+ localVarHeaderParams['content-type'] = 'application/json';
947
+ } else {
948
+ localVarHeaderParams['content-type'] = produces.join(',');
949
+ }
950
+ let localVarFormParams: any = {};
951
+ let localVarBodyParams: any = undefined;
952
+
953
+ // verify required parameter 'templateId' is not null or undefined
954
+ if (templateId === null || templateId === undefined) {
955
+ throw new Error('Required parameter templateId was null or undefined when calling editTemplate.');
956
+ }
957
+
958
+ // verify required parameter 'editTemplateRequest' is not null or undefined
959
+ if (editTemplateRequest === null || editTemplateRequest === undefined) {
960
+ throw new Error('Required parameter editTemplateRequest was null or undefined when calling editTemplate.');
961
+ }
962
+
963
+ if (templateId !== undefined) {
964
+ localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
965
+ }
966
+
967
+ (<any>Object).assign(localVarHeaderParams, options.headers);
968
+
969
+ let localVarUseFormData = false;
970
+
971
+ const result = generateFormData(editTemplateRequest, EditTemplateRequest);
972
+ localVarUseFormData = result.localVarUseFormData;
973
+
974
+ let data = {};
975
+ if (localVarUseFormData) {
976
+ const formData = toFormData(result.data);
977
+ data = formData;
978
+ localVarHeaderParams = {
979
+ ...localVarHeaderParams,
980
+ ...formData.getHeaders(),
981
+ };
982
+ } else {
983
+ data = ObjectSerializer.serialize(
984
+ editTemplateRequest,
985
+ "EditTemplateRequest"
986
+ );
987
+ }
988
+
989
+ let localVarRequestOptions: AxiosRequestConfig = {
990
+ method: 'PUT',
991
+ params: localVarQueryParameters,
992
+ headers: localVarHeaderParams,
993
+ url: localVarPath,
994
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
995
+ maxContentLength: Infinity,
996
+ maxBodyLength: Infinity,
997
+ responseType: "json",
998
+ };
999
+
1000
+ if (localVarRequestOptions.method !== 'GET') {
1001
+ localVarRequestOptions.data = data;
1002
+ }
1003
+ let authenticationPromise = Promise.resolve();
1004
+
1005
+ if (this.authentications["X-API-KEY"].apiKey) {
1006
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1007
+ }
1008
+ if (this.authentications["Bearer"].apiKey) {
1009
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1010
+ }
1011
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1012
+
1013
+ let interceptorPromise = authenticationPromise;
1014
+ for (const interceptor of this.interceptors) {
1015
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1016
+ }
1017
+
1018
+ return interceptorPromise.then(() => {
1019
+ return new Promise<returnTypeI>((resolve, reject) => {
1020
+ axios.request(localVarRequestOptions)
1021
+ .then((response) => {
1022
+ handleSuccessfulResponse(
1023
+ resolve,
1024
+ reject,
1025
+ response,
1026
+
1027
+ );
1028
+ }, (error: AxiosError) => {
1029
+ if (error.response == null) {
1030
+ reject(error);
1031
+ return;
1032
+ }
1033
+
1034
+ if (handleErrorCodeResponse(
1035
+ reject,
1036
+ error.response,
1037
+ 400,
1038
+ "ErrorResult",
1039
+ )) {
1040
+ return;
1041
+ }
1042
+ if (handleErrorCodeResponse(
1043
+ reject,
1044
+ error.response,
1045
+ 422,
1046
+ "ErrorResult",
1047
+ )) {
1048
+ return;
1049
+ }
1050
+ if (handleErrorCodeResponse(
1051
+ reject,
1052
+ error.response,
1053
+ 401,
1054
+ "ErrorResult",
1055
+ )) {
1056
+ return;
1057
+ }
1058
+
1059
+
1060
+ reject(error);
1061
+ });
1062
+ });
1063
+ });
1064
+ }
1065
+ /**
1066
+ *
1067
+ * @summary Generates a edit URL to embeds template edit process into your application.
1068
+ * @param templateId The template id.
1069
+ * @param embeddedTemplateEditRequest The embedded edit template request body.
1070
+ * @param options
1071
+ */
1072
+ public async getEmbeddedTemplateEditUrl (templateId: string, embeddedTemplateEditRequest?: EmbeddedTemplateEditRequest, options: optionsI = {headers: {}}) : Promise<EmbeddedTemplateEdited> {
1073
+ embeddedTemplateEditRequest = deserializeIfNeeded(embeddedTemplateEditRequest, "EmbeddedTemplateEditRequest");
1074
+ const localVarPath = this.basePath + '/v1/template/getEmbeddedTemplateEditUrl';
1075
+ let localVarQueryParameters: any = {};
1076
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1077
+ const produces = ['application/json'];
1078
+ // give precedence to 'application/json'
1079
+ if (produces.indexOf('application/json') >= 0) {
1080
+ localVarHeaderParams['content-type'] = 'application/json';
1081
+ } else {
1082
+ localVarHeaderParams['content-type'] = produces.join(',');
1083
+ }
1084
+ let localVarFormParams: any = {};
1085
+ let localVarBodyParams: any = undefined;
1086
+
1087
+ // verify required parameter 'templateId' is not null or undefined
1088
+ if (templateId === null || templateId === undefined) {
1089
+ throw new Error('Required parameter templateId was null or undefined when calling getEmbeddedTemplateEditUrl.');
1090
+ }
1091
+
1092
+ if (templateId !== undefined) {
1093
+ localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
1094
+ }
1095
+
1096
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1097
+
1098
+ let localVarUseFormData = false;
1099
+
1100
+ const result = generateFormData(embeddedTemplateEditRequest, EmbeddedTemplateEditRequest);
1101
+ localVarUseFormData = result.localVarUseFormData;
1102
+
1103
+ let data = {};
1104
+ if (localVarUseFormData) {
1105
+ const formData = toFormData(result.data);
1106
+ data = formData;
1107
+ localVarHeaderParams = {
1108
+ ...localVarHeaderParams,
1109
+ ...formData.getHeaders(),
1110
+ };
1111
+ } else {
1112
+ data = ObjectSerializer.serialize(
1113
+ embeddedTemplateEditRequest,
1114
+ "EmbeddedTemplateEditRequest"
1115
+ );
1116
+ }
1117
+
1118
+ let localVarRequestOptions: AxiosRequestConfig = {
1119
+ method: 'POST',
1120
+ params: localVarQueryParameters,
1121
+ headers: localVarHeaderParams,
1122
+ url: localVarPath,
1123
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
1124
+ maxContentLength: Infinity,
1125
+ maxBodyLength: Infinity,
1126
+ responseType: "json",
1127
+ };
1128
+
1129
+ if (localVarRequestOptions.method !== 'GET') {
1130
+ localVarRequestOptions.data = data;
1131
+ }
1132
+ let authenticationPromise = Promise.resolve();
1133
+
1134
+ if (this.authentications["X-API-KEY"].apiKey) {
1135
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1136
+ }
1137
+ if (this.authentications["Bearer"].apiKey) {
1138
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1139
+ }
1140
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1141
+
1142
+ let interceptorPromise = authenticationPromise;
1143
+ for (const interceptor of this.interceptors) {
1144
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1145
+ }
1146
+
1147
+ return interceptorPromise.then(() => {
1148
+ return new Promise<EmbeddedTemplateEdited>((resolve, reject) => {
1149
+ axios.request(localVarRequestOptions)
1150
+ .then((response) => {
1151
+ handleSuccessfulResponse<EmbeddedTemplateEdited>(
1152
+ resolve,
1153
+ reject,
1154
+ response,
1155
+ "EmbeddedTemplateEdited",
1156
+ );
1157
+ }, (error: AxiosError) => {
1158
+ if (error.response == null) {
1159
+ reject(error);
1160
+ return;
1161
+ }
1162
+
1163
+ if (handleErrorCodeResponse(
1164
+ reject,
1165
+ error.response,
1166
+ 201,
1167
+ "EmbeddedTemplateEdited",
1168
+ )) {
1169
+ return;
1170
+ }
1171
+ if (handleErrorCodeResponse(
1172
+ reject,
1173
+ error.response,
1174
+ 400,
1175
+ "ErrorResult",
1176
+ )) {
1177
+ return;
1178
+ }
1179
+ if (handleErrorCodeResponse(
1180
+ reject,
1181
+ error.response,
1182
+ 401,
1183
+ "ErrorResult",
1184
+ )) {
1185
+ return;
1186
+ }
1187
+
1188
+
1189
+ reject(error);
1190
+ });
1191
+ });
1192
+ });
1193
+ }
1194
+ /**
1195
+ *
1196
+ * @summary Get summary of the template.
1197
+ * @param templateId Template Id.
1198
+ * @param options
1199
+ */
1200
+ public async getProperties (templateId: string, options: optionsI = {headers: {}}) : Promise<TemplateProperties> {
1201
+ const localVarPath = this.basePath + '/v1/template/properties';
1202
+ let localVarQueryParameters: any = {};
1203
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1204
+ const produces = ['application/json'];
1205
+ // give precedence to 'application/json'
1206
+ if (produces.indexOf('application/json') >= 0) {
1207
+ localVarHeaderParams['content-type'] = 'application/json';
1208
+ } else {
1209
+ localVarHeaderParams['content-type'] = produces.join(',');
1210
+ }
1211
+ let localVarFormParams: any = {};
1212
+ let localVarBodyParams: any = undefined;
1213
+
1214
+ // verify required parameter 'templateId' is not null or undefined
1215
+ if (templateId === null || templateId === undefined) {
1216
+ throw new Error('Required parameter templateId was null or undefined when calling getTemplateProperties.');
1217
+ }
1218
+
1219
+ if (templateId !== undefined) {
1220
+ localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
1221
+ }
1222
+
1223
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1224
+
1225
+ let localVarUseFormData = false;
1226
+
1227
+ let data = {};
1228
+ if (localVarUseFormData) {
1229
+ const formData = toFormData(localVarFormParams);
1230
+ data = formData;
1231
+ localVarHeaderParams = {
1232
+ ...localVarHeaderParams,
1233
+ ...formData.getHeaders(),
1234
+ };
1235
+ }
1236
+
1237
+ let localVarRequestOptions: AxiosRequestConfig = {
1238
+ method: 'GET',
1239
+ params: localVarQueryParameters,
1240
+ headers: localVarHeaderParams,
1241
+ url: localVarPath,
1242
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
1243
+ maxContentLength: Infinity,
1244
+ maxBodyLength: Infinity,
1245
+ responseType: "json",
1246
+ };
1247
+
1248
+ if (localVarRequestOptions.method !== 'GET') {
1249
+ localVarRequestOptions.data = data;
1250
+ }
1251
+ let authenticationPromise = Promise.resolve();
1252
+
1253
+ if (this.authentications["X-API-KEY"].apiKey) {
1254
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1255
+ }
1256
+ if (this.authentications["Bearer"].apiKey) {
1257
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1258
+ }
1259
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1260
+
1261
+ let interceptorPromise = authenticationPromise;
1262
+ for (const interceptor of this.interceptors) {
1263
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1264
+ }
1265
+
1266
+ return interceptorPromise.then(() => {
1267
+ return new Promise<TemplateProperties>((resolve, reject) => {
1268
+ axios.request(localVarRequestOptions)
1269
+ .then((response) => {
1270
+ handleSuccessfulResponse<TemplateProperties>(
1271
+ resolve,
1272
+ reject,
1273
+ response,
1274
+ "TemplateProperties",
1275
+ );
1276
+ }, (error: AxiosError) => {
1277
+ if (error.response == null) {
1278
+ reject(error);
1279
+ return;
1280
+ }
1281
+
1282
+ if (handleErrorCodeResponse(
1283
+ reject,
1284
+ error.response,
1285
+ 200,
1286
+ "TemplateProperties",
1287
+ )) {
1288
+ return;
1289
+ }
1290
+ if (handleErrorCodeResponse(
1291
+ reject,
1292
+ error.response,
1293
+ 401,
1294
+ "ErrorResult",
1295
+ )) {
1296
+ return;
1297
+ }
1298
+ if (handleErrorCodeResponse(
1299
+ reject,
1300
+ error.response,
1301
+ 403,
1302
+ "ErrorResult",
1303
+ )) {
1304
+ return;
1305
+ }
1306
+
1307
+
1308
+ reject(error);
1309
+ });
1310
+ });
1311
+ });
1312
+ }
1313
+ /**
1314
+ *
1315
+ * @summary List all the templates.
1316
+ * @param page
1317
+ * @param templateType
1318
+ * @param pageSize
1319
+ * @param searchKey
1320
+ * @param onBehalfOf The sender identity\&#39;s email used to filter the templates returned in the API. The API will return templates that were sent on behalf of the specified email address.
1321
+ * @param createdBy The templates can be listed by the creator of the template.
1322
+ * @param templateLabels Labels of the template.
1323
+ * @param startDate Start date of the template
1324
+ * @param endDate End date of the template
1325
+ * @param brandIds BrandId(s) of the template.
1326
+ * @param options
1327
+ */
1328
+ public async listTemplates (page: number, templateType?: 'mytemplates' | 'sharedtemplate' | 'all', pageSize?: number, searchKey?: string, onBehalfOf?: Array<string>, createdBy?: Array<string>, templateLabels?: Array<string>, startDate?: Date, endDate?: Date, brandIds?: Array<string>, options: optionsI = {headers: {}}) : Promise<TemplateRecords> {
1329
+ const localVarPath = this.basePath + '/v1/template/list';
1330
+ let localVarQueryParameters: any = {};
1331
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1332
+ const produces = ['application/json'];
1333
+ // give precedence to 'application/json'
1334
+ if (produces.indexOf('application/json') >= 0) {
1335
+ localVarHeaderParams['content-type'] = 'application/json';
1336
+ } else {
1337
+ localVarHeaderParams['content-type'] = produces.join(',');
1338
+ }
1339
+ let localVarFormParams: any = {};
1340
+ let localVarBodyParams: any = undefined;
1341
+
1342
+ // verify required parameter 'page' is not null or undefined
1343
+ if (page === null || page === undefined) {
1344
+ throw new Error('Required parameter page was null or undefined when calling listTemplates.');
1345
+ }
1346
+
1347
+ if (templateType !== undefined) {
1348
+ localVarQueryParameters['TemplateType'] = ObjectSerializer.serialize(templateType, "'mytemplates' | 'sharedtemplate' | 'all'");
1349
+ }
1350
+
1351
+ if (pageSize !== undefined) {
1352
+ localVarQueryParameters['PageSize'] = ObjectSerializer.serialize(pageSize, "number");
1353
+ }
1354
+
1355
+ if (page !== undefined) {
1356
+ localVarQueryParameters['Page'] = ObjectSerializer.serialize(page, "number");
1357
+ }
1358
+
1359
+ if (searchKey !== undefined) {
1360
+ localVarQueryParameters['SearchKey'] = ObjectSerializer.serialize(searchKey, "string");
1361
+ }
1362
+
1363
+ if (onBehalfOf !== undefined) {
1364
+ localVarQueryParameters['OnBehalfOf'] = ObjectSerializer.serialize(onBehalfOf, "Array<string>");
1365
+ }
1366
+
1367
+ if (createdBy !== undefined) {
1368
+ localVarQueryParameters['CreatedBy'] = ObjectSerializer.serialize(createdBy, "Array<string>");
1369
+ }
1370
+
1371
+ if (templateLabels !== undefined) {
1372
+ localVarQueryParameters['TemplateLabels'] = ObjectSerializer.serialize(templateLabels, "Array<string>");
1373
+ }
1374
+
1375
+ if (startDate !== undefined) {
1376
+ localVarQueryParameters['StartDate'] = ObjectSerializer.serialize(startDate, "Date");
1377
+ }
1378
+
1379
+ if (endDate !== undefined) {
1380
+ localVarQueryParameters['EndDate'] = ObjectSerializer.serialize(endDate, "Date");
1381
+ }
1382
+
1383
+ if (brandIds !== undefined) {
1384
+ localVarQueryParameters['BrandIds'] = ObjectSerializer.serialize(brandIds, "Array<string>");
1385
+ }
1386
+
1387
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1388
+
1389
+ let localVarUseFormData = false;
1390
+
1391
+ let data = {};
1392
+ if (localVarUseFormData) {
1393
+ const formData = toFormData(localVarFormParams);
1394
+ data = formData;
1395
+ localVarHeaderParams = {
1396
+ ...localVarHeaderParams,
1397
+ ...formData.getHeaders(),
1398
+ };
1399
+ }
1400
+
1401
+ let localVarRequestOptions: AxiosRequestConfig = {
1402
+ method: 'GET',
1403
+ params: localVarQueryParameters,
1404
+ headers: localVarHeaderParams,
1405
+ url: localVarPath,
1406
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
1407
+ maxContentLength: Infinity,
1408
+ maxBodyLength: Infinity,
1409
+ responseType: "json",
1410
+ };
1411
+
1412
+ if (localVarRequestOptions.method !== 'GET') {
1413
+ localVarRequestOptions.data = data;
1414
+ }
1415
+ let authenticationPromise = Promise.resolve();
1416
+
1417
+ if (this.authentications["X-API-KEY"].apiKey) {
1418
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1419
+ }
1420
+ if (this.authentications["Bearer"].apiKey) {
1421
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1422
+ }
1423
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1424
+
1425
+ let interceptorPromise = authenticationPromise;
1426
+ for (const interceptor of this.interceptors) {
1427
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1428
+ }
1429
+
1430
+ return interceptorPromise.then(() => {
1431
+ return new Promise<TemplateRecords>((resolve, reject) => {
1432
+ axios.request(localVarRequestOptions)
1433
+ .then((response) => {
1434
+ handleSuccessfulResponse<TemplateRecords>(
1435
+ resolve,
1436
+ reject,
1437
+ response,
1438
+ "TemplateRecords",
1439
+ );
1440
+ }, (error: AxiosError) => {
1441
+ if (error.response == null) {
1442
+ reject(error);
1443
+ return;
1444
+ }
1445
+
1446
+ if (handleErrorCodeResponse(
1447
+ reject,
1448
+ error.response,
1449
+ 200,
1450
+ "TemplateRecords",
1451
+ )) {
1452
+ return;
1453
+ }
1454
+ if (handleErrorCodeResponse(
1455
+ reject,
1456
+ error.response,
1457
+ 401,
1458
+ "ErrorResult",
1459
+ )) {
1460
+ return;
1461
+ }
1462
+
1463
+
1464
+ reject(error);
1465
+ });
1466
+ });
1467
+ });
1468
+ }
1469
+ /**
1470
+ *
1471
+ * @summary Send the document by merging multiple templates.
1472
+ * @param mergeAndSendForSignForm The merge and send details as JSON.
1473
+ * @param options
1474
+ */
1475
+ public async mergeAndSend (mergeAndSendForSignForm?: MergeAndSendForSignForm, options: optionsI = {headers: {}}) : Promise<DocumentCreated> {
1476
+ mergeAndSendForSignForm = deserializeIfNeeded(mergeAndSendForSignForm, "MergeAndSendForSignForm");
1477
+ const localVarPath = this.basePath + '/v1/template/mergeAndSend';
1478
+ let localVarQueryParameters: any = {};
1479
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1480
+ const produces = ['application/json'];
1481
+ // give precedence to 'application/json'
1482
+ if (produces.indexOf('application/json') >= 0) {
1483
+ localVarHeaderParams['content-type'] = 'application/json';
1484
+ } else {
1485
+ localVarHeaderParams['content-type'] = produces.join(',');
1486
+ }
1487
+ let localVarFormParams: any = {};
1488
+ let localVarBodyParams: any = undefined;
1489
+
1490
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1491
+
1492
+ let localVarUseFormData = false;
1493
+
1494
+ const result = generateFormData(mergeAndSendForSignForm, MergeAndSendForSignForm);
1495
+ localVarUseFormData = result.localVarUseFormData;
1496
+
1497
+ let data = {};
1498
+ if (localVarUseFormData) {
1499
+ const formData = toFormData(result.data);
1500
+ data = formData;
1501
+ localVarHeaderParams = {
1502
+ ...localVarHeaderParams,
1503
+ ...formData.getHeaders(),
1504
+ };
1505
+ } else {
1506
+ data = ObjectSerializer.serialize(
1507
+ mergeAndSendForSignForm,
1508
+ "MergeAndSendForSignForm"
1509
+ );
1510
+ }
1511
+
1512
+ let localVarRequestOptions: AxiosRequestConfig = {
1513
+ method: 'POST',
1514
+ params: localVarQueryParameters,
1515
+ headers: localVarHeaderParams,
1516
+ url: localVarPath,
1517
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
1518
+ maxContentLength: Infinity,
1519
+ maxBodyLength: Infinity,
1520
+ responseType: "json",
1521
+ };
1522
+
1523
+ if (localVarRequestOptions.method !== 'GET') {
1524
+ localVarRequestOptions.data = data;
1525
+ }
1526
+ let authenticationPromise = Promise.resolve();
1527
+
1528
+ if (this.authentications["X-API-KEY"].apiKey) {
1529
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1530
+ }
1531
+ if (this.authentications["Bearer"].apiKey) {
1532
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1533
+ }
1534
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1535
+
1536
+ let interceptorPromise = authenticationPromise;
1537
+ for (const interceptor of this.interceptors) {
1538
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1539
+ }
1540
+
1541
+ return interceptorPromise.then(() => {
1542
+ return new Promise<DocumentCreated>((resolve, reject) => {
1543
+ axios.request(localVarRequestOptions)
1544
+ .then((response) => {
1545
+ handleSuccessfulResponse<DocumentCreated>(
1546
+ resolve,
1547
+ reject,
1548
+ response,
1549
+ "DocumentCreated",
1550
+ );
1551
+ }, (error: AxiosError) => {
1552
+ if (error.response == null) {
1553
+ reject(error);
1554
+ return;
1555
+ }
1556
+
1557
+ if (handleErrorCodeResponse(
1558
+ reject,
1559
+ error.response,
1560
+ 201,
1561
+ "DocumentCreated",
1562
+ )) {
1563
+ return;
1564
+ }
1565
+ if (handleErrorCodeResponse(
1566
+ reject,
1567
+ error.response,
1568
+ 422,
1569
+ "ErrorResult",
1570
+ )) {
1571
+ return;
1572
+ }
1573
+ if (handleErrorCodeResponse(
1574
+ reject,
1575
+ error.response,
1576
+ 401,
1577
+ "ErrorResult",
1578
+ )) {
1579
+ return;
1580
+ }
1581
+
1582
+
1583
+ reject(error);
1584
+ });
1585
+ });
1586
+ });
1587
+ }
1588
+ /**
1589
+ *
1590
+ * @summary Generates a merge request URL using a template that combines document merging and sending processes into your application.
1591
+ * @param embeddedMergeTemplateFormRequest Embedded merge and send template json request.
1592
+ * @param options
1593
+ */
1594
+ public async mergeCreateEmbeddedRequestUrlTemplate (embeddedMergeTemplateFormRequest?: EmbeddedMergeTemplateFormRequest, options: optionsI = {headers: {}}) : Promise<EmbeddedSendCreated> {
1595
+ embeddedMergeTemplateFormRequest = deserializeIfNeeded(embeddedMergeTemplateFormRequest, "EmbeddedMergeTemplateFormRequest");
1596
+ const localVarPath = this.basePath + '/v1/template/mergeCreateEmbeddedRequestUrl';
1597
+ let localVarQueryParameters: any = {};
1598
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1599
+ const produces = ['application/json'];
1600
+ // give precedence to 'application/json'
1601
+ if (produces.indexOf('application/json') >= 0) {
1602
+ localVarHeaderParams['content-type'] = 'application/json';
1603
+ } else {
1604
+ localVarHeaderParams['content-type'] = produces.join(',');
1605
+ }
1606
+ let localVarFormParams: any = {};
1607
+ let localVarBodyParams: any = undefined;
1608
+
1609
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1610
+
1611
+ let localVarUseFormData = false;
1612
+
1613
+ const result = generateFormData(embeddedMergeTemplateFormRequest, EmbeddedMergeTemplateFormRequest);
1614
+ localVarUseFormData = result.localVarUseFormData;
1615
+
1616
+ let data = {};
1617
+ if (localVarUseFormData) {
1618
+ const formData = toFormData(result.data);
1619
+ data = formData;
1620
+ localVarHeaderParams = {
1621
+ ...localVarHeaderParams,
1622
+ ...formData.getHeaders(),
1623
+ };
1624
+ } else {
1625
+ data = ObjectSerializer.serialize(
1626
+ embeddedMergeTemplateFormRequest,
1627
+ "EmbeddedMergeTemplateFormRequest"
1628
+ );
1629
+ }
1630
+
1631
+ let localVarRequestOptions: AxiosRequestConfig = {
1632
+ method: 'POST',
1633
+ params: localVarQueryParameters,
1634
+ headers: localVarHeaderParams,
1635
+ url: localVarPath,
1636
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
1637
+ maxContentLength: Infinity,
1638
+ maxBodyLength: Infinity,
1639
+ responseType: "json",
1640
+ };
1641
+
1642
+ if (localVarRequestOptions.method !== 'GET') {
1643
+ localVarRequestOptions.data = data;
1644
+ }
1645
+ let authenticationPromise = Promise.resolve();
1646
+
1647
+ if (this.authentications["X-API-KEY"].apiKey) {
1648
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1649
+ }
1650
+ if (this.authentications["Bearer"].apiKey) {
1651
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1652
+ }
1653
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1654
+
1655
+ let interceptorPromise = authenticationPromise;
1656
+ for (const interceptor of this.interceptors) {
1657
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1658
+ }
1659
+
1660
+ return interceptorPromise.then(() => {
1661
+ return new Promise<EmbeddedSendCreated>((resolve, reject) => {
1662
+ axios.request(localVarRequestOptions)
1663
+ .then((response) => {
1664
+ handleSuccessfulResponse<EmbeddedSendCreated>(
1665
+ resolve,
1666
+ reject,
1667
+ response,
1668
+ "EmbeddedSendCreated",
1669
+ );
1670
+ }, (error: AxiosError) => {
1671
+ if (error.response == null) {
1672
+ reject(error);
1673
+ return;
1674
+ }
1675
+
1676
+ if (handleErrorCodeResponse(
1677
+ reject,
1678
+ error.response,
1679
+ 201,
1680
+ "EmbeddedSendCreated",
1681
+ )) {
1682
+ return;
1683
+ }
1684
+ if (handleErrorCodeResponse(
1685
+ reject,
1686
+ error.response,
1687
+ 422,
1688
+ "ErrorResult",
1689
+ )) {
1690
+ return;
1691
+ }
1692
+ if (handleErrorCodeResponse(
1693
+ reject,
1694
+ error.response,
1695
+ 401,
1696
+ "ErrorResult",
1697
+ )) {
1698
+ return;
1699
+ }
1700
+
1701
+
1702
+ reject(error);
1703
+ });
1704
+ });
1705
+ });
1706
+ }
1707
+ /**
1708
+ *
1709
+ * @summary Send a document for signature using a Template.
1710
+ * @param templateId The template id.
1711
+ * @param sendForSignFromTemplateForm The send template details as JSON.
1712
+ * @param options
1713
+ */
1714
+ public async sendUsingTemplate (templateId: string, sendForSignFromTemplateForm?: SendForSignFromTemplateForm, options: optionsI = {headers: {}}) : Promise<DocumentCreated> {
1715
+ sendForSignFromTemplateForm = deserializeIfNeeded(sendForSignFromTemplateForm, "SendForSignFromTemplateForm");
1716
+ const localVarPath = this.basePath + '/v1/template/send';
1717
+ let localVarQueryParameters: any = {};
1718
+ let localVarHeaderParams: any = (<any>Object).assign({}, this._defaultHeaders);
1719
+ const produces = ['application/json'];
1720
+ // give precedence to 'application/json'
1721
+ if (produces.indexOf('application/json') >= 0) {
1722
+ localVarHeaderParams['content-type'] = 'application/json';
1723
+ } else {
1724
+ localVarHeaderParams['content-type'] = produces.join(',');
1725
+ }
1726
+ let localVarFormParams: any = {};
1727
+ let localVarBodyParams: any = undefined;
1728
+
1729
+ // verify required parameter 'templateId' is not null or undefined
1730
+ if (templateId === null || templateId === undefined) {
1731
+ throw new Error('Required parameter templateId was null or undefined when calling sendUsingTemplate.');
1732
+ }
1733
+
1734
+ if (templateId !== undefined) {
1735
+ localVarQueryParameters['templateId'] = ObjectSerializer.serialize(templateId, "string");
1736
+ }
1737
+
1738
+ (<any>Object).assign(localVarHeaderParams, options.headers);
1739
+
1740
+ let localVarUseFormData = false;
1741
+
1742
+ const result = generateFormData(sendForSignFromTemplateForm, SendForSignFromTemplateForm);
1743
+ localVarUseFormData = result.localVarUseFormData;
1744
+
1745
+ let data = {};
1746
+ if (localVarUseFormData) {
1747
+ const formData = toFormData(result.data);
1748
+ data = formData;
1749
+ localVarHeaderParams = {
1750
+ ...localVarHeaderParams,
1751
+ ...formData.getHeaders(),
1752
+ };
1753
+ } else {
1754
+ data = ObjectSerializer.serialize(
1755
+ sendForSignFromTemplateForm,
1756
+ "SendForSignFromTemplateForm"
1757
+ );
1758
+ }
1759
+
1760
+ let localVarRequestOptions: AxiosRequestConfig = {
1761
+ method: 'POST',
1762
+ params: localVarQueryParameters,
1763
+ headers: localVarHeaderParams,
1764
+ url: localVarPath,
1765
+ paramsSerializer: this._useQuerystring ? queryParamsSerializer : undefined,
1766
+ maxContentLength: Infinity,
1767
+ maxBodyLength: Infinity,
1768
+ responseType: "json",
1769
+ };
1770
+
1771
+ if (localVarRequestOptions.method !== 'GET') {
1772
+ localVarRequestOptions.data = data;
1773
+ }
1774
+ let authenticationPromise = Promise.resolve();
1775
+
1776
+ if (this.authentications["X-API-KEY"].apiKey) {
1777
+ authenticationPromise = authenticationPromise.then(() => this.authentications["X-API-KEY"].applyToRequest(localVarRequestOptions));
1778
+ }
1779
+ if (this.authentications["Bearer"].apiKey) {
1780
+ authenticationPromise = authenticationPromise.then(() => this.authentications["Bearer"].applyToRequest(localVarRequestOptions));
1781
+ }
1782
+ authenticationPromise = authenticationPromise.then(() => this.authentications.default.applyToRequest(localVarRequestOptions));
1783
+
1784
+ let interceptorPromise = authenticationPromise;
1785
+ for (const interceptor of this.interceptors) {
1786
+ interceptorPromise = interceptorPromise.then(() => interceptor(localVarRequestOptions));
1787
+ }
1788
+
1789
+ return interceptorPromise.then(() => {
1790
+ return new Promise<DocumentCreated>((resolve, reject) => {
1791
+ axios.request(localVarRequestOptions)
1792
+ .then((response) => {
1793
+ handleSuccessfulResponse<DocumentCreated>(
1794
+ resolve,
1795
+ reject,
1796
+ response,
1797
+ "DocumentCreated",
1798
+ );
1799
+ }, (error: AxiosError) => {
1800
+ if (error.response == null) {
1801
+ reject(error);
1802
+ return;
1803
+ }
1804
+
1805
+ if (handleErrorCodeResponse(
1806
+ reject,
1807
+ error.response,
1808
+ 201,
1809
+ "DocumentCreated",
1810
+ )) {
1811
+ return;
1812
+ }
1813
+ if (handleErrorCodeResponse(
1814
+ reject,
1815
+ error.response,
1816
+ 401,
1817
+ "ErrorResult",
1818
+ )) {
1819
+ return;
1820
+ }
1821
+ if (handleErrorCodeResponse(
1822
+ reject,
1823
+ error.response,
1824
+ 422,
1825
+ "ErrorResult",
1826
+ )) {
1827
+ return;
1828
+ }
1829
+
1830
+
1831
+ reject(error);
1832
+ });
1833
+ });
1834
+ });
1835
+ }
1836
+ }
1837
+
1838
+ function deserializeIfNeeded<T> (obj: T, classname: string): T {
1839
+ if (obj !== null && obj !== undefined && obj.constructor.name !== classname) {
1840
+ return ObjectSerializer.deserialize(obj, classname);
1841
+ }
1842
+
1843
+ return obj;
1844
+ }
1845
+
1846
+ type AxiosResolve<T> = (
1847
+ value: (T | PromiseLike<T>),
1848
+ ) => void
1849
+
1850
+ type AxiosReject = (reason?: any) => void;
1851
+
1852
+ function handleSuccessfulResponse<T>(
1853
+ resolve: AxiosResolve<T>,
1854
+ reject: AxiosReject,
1855
+ response: AxiosResponse,
1856
+ returnType?: string,
1857
+ ) {
1858
+ let body = response.data;
1859
+
1860
+ if (
1861
+ response.status &&
1862
+ response.status >= 200 &&
1863
+ response.status <= 299
1864
+ ) {
1865
+ if (returnType) {
1866
+ body = ObjectSerializer.deserialize(body, returnType);
1867
+ }
1868
+
1869
+ resolve(body);
1870
+ } else {
1871
+ reject(new HttpError(response, body, response.status));
1872
+ }
1873
+ }
1874
+
1875
+ function handleErrorCodeResponse(
1876
+ reject: AxiosReject,
1877
+ response: AxiosResponse,
1878
+ code: number,
1879
+ returnType: string
1880
+ ): boolean {
1881
+ if (response.status !== code) {
1882
+ return false;
1883
+ }
1884
+
1885
+ let body = response.data;
1886
+ if(code === 401) {
1887
+ body = "Unauthorized request (401): Invalid authentication.";
1888
+ }
1889
+ reject(new HttpError(response, body, response.status));
1890
+
1891
+ return true;
1892
+ }
1893
+
1894
+ function handleErrorRangeResponse(
1895
+ reject: AxiosReject,
1896
+ response: AxiosResponse,
1897
+ code: string,
1898
+ returnType: string
1899
+ ): boolean {
1900
+ let rangeCodeLeft = Number(code[0] + "00");
1901
+ let rangeCodeRight = Number(code[0] + "99");
1902
+
1903
+ if (response.status >= rangeCodeLeft && response.status <= rangeCodeRight) {
1904
+ const body = ObjectSerializer.deserialize(
1905
+ response.data,
1906
+ returnType,
1907
+ );
1908
+
1909
+ reject(new HttpError(response, body, response.status));
1910
+
1911
+ return true;
1912
+ }
1913
+
1914
+ return false;
1915
+ }