docspring 4.1.0 → 4.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (372) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +15 -0
  3. data/.travis.yml +1 -1
  4. data/AGENTS.md +5 -4
  5. data/CHANGELOG.md +67 -0
  6. data/Gemfile.lock +11 -10
  7. data/README.md +11 -6
  8. data/docs/Client.md +273 -105
  9. data/docs/CombinedPdf.md +1 -1
  10. data/docs/CreateCombinedPdfRequest.md +1 -1
  11. data/docs/CreateSubmissionRequest.md +5 -5
  12. data/docs/CreateTemplatePreviewRequest.md +18 -0
  13. data/docs/CreateTemplateRequest.md +14 -10
  14. data/docs/ErrorDetail.md +1 -1
  15. data/docs/ErrorInfo.md +4 -4
  16. data/docs/FieldGroup.md +2 -2
  17. data/docs/FieldGroupInput.md +1 -1
  18. data/docs/GenerateSubmissionFilesRequest.md +1 -1
  19. data/docs/GeneratedFile.md +2 -2
  20. data/docs/Submission.md +18 -18
  21. data/docs/SubmissionBatch.md +3 -3
  22. data/docs/SubmissionFiles.md +4 -0
  23. data/docs/SubmissionInput.md +5 -5
  24. data/docs/SubmissionList.md +1 -1
  25. data/docs/SubmissionSummary.md +54 -0
  26. data/docs/Template.md +21 -17
  27. data/docs/TemplateActor.md +1 -1
  28. data/docs/TemplateDiff.md +2 -2
  29. data/docs/TemplateDocument.md +12 -12
  30. data/docs/TemplateDocumentSummary.md +24 -0
  31. data/docs/TemplatePreview.md +32 -0
  32. data/docs/TemplatePreviewState.md +15 -0
  33. data/docs/TemplateSummary.md +5 -49
  34. data/docs/UpdateTemplateDocumentRequest.md +5 -5
  35. data/docs/UpdateTemplateRequest.md +10 -6
  36. data/docs/ValidateSubmissionRequest.md +5 -5
  37. data/docspring.gemspec +2 -2
  38. data/lib/docspring/api/client.rb +222 -49
  39. data/lib/docspring/api_client.rb +5 -3
  40. data/lib/docspring/api_error.rb +1 -1
  41. data/lib/docspring/api_model_base.rb +1 -1
  42. data/lib/docspring/configuration.rb +1 -1
  43. data/lib/docspring/date_time_values.rb +33 -0
  44. data/lib/docspring/models/add_template_fields_request.rb +1 -1
  45. data/lib/docspring/models/ai_field_naming_language.rb +1 -1
  46. data/lib/docspring/models/authentication_check.rb +1 -1
  47. data/lib/docspring/models/barcode_symbology.rb +1 -1
  48. data/lib/docspring/models/check_character.rb +1 -1
  49. data/lib/docspring/models/combined_field_type.rb +1 -1
  50. data/lib/docspring/models/combined_pdf.rb +2 -2
  51. data/lib/docspring/models/combined_pdf_files.rb +1 -1
  52. data/lib/docspring/models/combined_pdf_list.rb +1 -1
  53. data/lib/docspring/models/combined_pdf_source.rb +1 -1
  54. data/lib/docspring/models/combined_pdf_source_input.rb +1 -1
  55. data/lib/docspring/models/combined_pdf_source_pdf.rb +1 -1
  56. data/lib/docspring/models/combined_pdf_source_type.rb +1 -1
  57. data/lib/docspring/models/combined_pdf_state.rb +1 -1
  58. data/lib/docspring/models/copy_template_request.rb +1 -1
  59. data/lib/docspring/models/create_combined_pdf_request.rb +2 -2
  60. data/lib/docspring/models/create_custom_file_from_upload_request.rb +1 -1
  61. data/lib/docspring/models/create_folder_request.rb +1 -1
  62. data/lib/docspring/models/create_signature_request_event_request.rb +1 -1
  63. data/lib/docspring/models/create_signature_request_token_request.rb +1 -1
  64. data/lib/docspring/models/create_submission_batch_request.rb +1 -1
  65. data/lib/docspring/models/create_submission_request.rb +6 -6
  66. data/lib/docspring/models/create_template_preview_request.rb +187 -0
  67. data/lib/docspring/models/create_template_request.rb +32 -12
  68. data/lib/docspring/models/create_webhook_request.rb +1 -1
  69. data/lib/docspring/models/custom_file.rb +1 -1
  70. data/lib/docspring/models/custom_file_list.rb +1 -1
  71. data/lib/docspring/models/custom_file_source_pdf.rb +1 -1
  72. data/lib/docspring/models/error_code.rb +4 -2
  73. data/lib/docspring/models/error_detail.rb +2 -2
  74. data/lib/docspring/models/error_info.rb +5 -5
  75. data/lib/docspring/models/error_response.rb +1 -1
  76. data/lib/docspring/models/expiration_interval.rb +1 -1
  77. data/lib/docspring/models/field.rb +2 -2
  78. data/lib/docspring/models/field_comparison_condition.rb +1 -1
  79. data/lib/docspring/models/field_comparison_operator.rb +1 -1
  80. data/lib/docspring/models/field_dependency.rb +1 -1
  81. data/lib/docspring/models/field_dependency_input.rb +1 -1
  82. data/lib/docspring/models/field_display_type.rb +1 -1
  83. data/lib/docspring/models/field_equals_condition.rb +1 -1
  84. data/lib/docspring/models/field_equals_operator.rb +1 -1
  85. data/lib/docspring/models/field_group.rb +3 -3
  86. data/lib/docspring/models/field_group_input.rb +2 -2
  87. data/lib/docspring/models/field_group_type.rb +1 -1
  88. data/lib/docspring/models/field_in_condition.rb +1 -1
  89. data/lib/docspring/models/field_input.rb +2 -2
  90. data/lib/docspring/models/field_override.rb +1 -1
  91. data/lib/docspring/models/field_presence_condition.rb +1 -1
  92. data/lib/docspring/models/field_presence_operator.rb +1 -1
  93. data/lib/docspring/models/field_range_condition.rb +1 -1
  94. data/lib/docspring/models/field_reimport_state.rb +1 -1
  95. data/lib/docspring/models/field_setup_logic.rb +1 -1
  96. data/lib/docspring/models/field_setup_naming.rb +1 -1
  97. data/lib/docspring/models/field_setup_source.rb +1 -1
  98. data/lib/docspring/models/field_type.rb +1 -1
  99. data/lib/docspring/models/folder.rb +1 -1
  100. data/lib/docspring/models/folder_list.rb +1 -1
  101. data/lib/docspring/models/generate_files_format.rb +5 -2
  102. data/lib/docspring/models/generate_submission_files_request.rb +2 -2
  103. data/lib/docspring/models/generated_file.rb +4 -4
  104. data/lib/docspring/models/generated_file_state.rb +1 -1
  105. data/lib/docspring/models/html_engine_options.rb +1 -1
  106. data/lib/docspring/models/html_engine_options_input.rb +1 -1
  107. data/lib/docspring/models/image_gravity.rb +1 -1
  108. data/lib/docspring/models/image_scale_type.rb +1 -1
  109. data/lib/docspring/models/model_code_language.rb +3 -2
  110. data/lib/docspring/models/move_folder_request.rb +1 -1
  111. data/lib/docspring/models/move_template_request.rb +1 -1
  112. data/lib/docspring/models/number_condition_type.rb +1 -1
  113. data/lib/docspring/models/output_format.rb +4 -2
  114. data/lib/docspring/models/page_format.rb +1 -1
  115. data/lib/docspring/models/page_image.rb +1 -1
  116. data/lib/docspring/models/page_images.rb +1 -1
  117. data/lib/docspring/models/predefined_field.rb +1 -1
  118. data/lib/docspring/models/predefined_field_input.rb +1 -1
  119. data/lib/docspring/models/publish_template_version_request.rb +1 -1
  120. data/lib/docspring/models/remove_template_fields_request.rb +1 -1
  121. data/lib/docspring/models/rename_folder_request.rb +1 -1
  122. data/lib/docspring/models/reorder_template_fields_request.rb +1 -1
  123. data/lib/docspring/models/restore_template_version_request.rb +1 -1
  124. data/lib/docspring/models/shape_type.rb +1 -1
  125. data/lib/docspring/models/signature_request.rb +1 -1
  126. data/lib/docspring/models/signature_request_auth_second_factor_type.rb +1 -1
  127. data/lib/docspring/models/signature_request_auth_type.rb +1 -1
  128. data/lib/docspring/models/signature_request_event.rb +1 -1
  129. data/lib/docspring/models/signature_request_event_type.rb +1 -1
  130. data/lib/docspring/models/signature_request_input.rb +1 -1
  131. data/lib/docspring/models/signature_request_message_type.rb +1 -1
  132. data/lib/docspring/models/signature_request_state.rb +1 -1
  133. data/lib/docspring/models/signature_request_token.rb +1 -1
  134. data/lib/docspring/models/signature_request_token_type.rb +1 -1
  135. data/lib/docspring/models/string_condition_type.rb +1 -1
  136. data/lib/docspring/models/submission.rb +145 -145
  137. data/lib/docspring/models/submission_action.rb +1 -1
  138. data/lib/docspring/models/submission_action_state.rb +1 -1
  139. data/lib/docspring/models/submission_action_type.rb +1 -1
  140. data/lib/docspring/models/submission_batch.rb +5 -5
  141. data/lib/docspring/models/submission_batch_state.rb +1 -1
  142. data/lib/docspring/models/submission_files.rb +22 -2
  143. data/lib/docspring/models/submission_input.rb +6 -6
  144. data/lib/docspring/models/submission_list.rb +2 -2
  145. data/lib/docspring/models/submission_source.rb +1 -1
  146. data/lib/docspring/models/submission_source_pdf.rb +1 -1
  147. data/lib/docspring/models/submission_state.rb +1 -1
  148. data/lib/docspring/models/submission_summary.rb +601 -0
  149. data/lib/docspring/models/submission_validation.rb +1 -1
  150. data/lib/docspring/models/template.rb +131 -91
  151. data/lib/docspring/models/template_actor.rb +2 -2
  152. data/lib/docspring/models/template_actor_type.rb +1 -1
  153. data/lib/docspring/models/template_defaults.rb +1 -1
  154. data/lib/docspring/models/template_defaults_input.rb +1 -1
  155. data/lib/docspring/models/template_diff.rb +3 -3
  156. data/lib/docspring/models/template_diff_summary.rb +1 -1
  157. data/lib/docspring/models/template_document.rb +51 -51
  158. data/lib/docspring/models/template_document_state.rb +4 -2
  159. data/lib/docspring/models/template_document_summary.rb +260 -0
  160. data/lib/docspring/models/template_field_change.rb +1 -1
  161. data/lib/docspring/models/template_field_changes.rb +1 -1
  162. data/lib/docspring/models/template_field_dependency.rb +1 -1
  163. data/lib/docspring/models/template_field_dependency_action.rb +1 -1
  164. data/lib/docspring/models/template_field_dependency_condition.rb +1 -1
  165. data/lib/docspring/models/template_field_dependency_condition_input.rb +1 -1
  166. data/lib/docspring/models/template_field_dependency_input.rb +1 -1
  167. data/lib/docspring/models/template_field_dependency_match.rb +1 -1
  168. data/lib/docspring/models/template_field_dependency_operator.rb +1 -1
  169. data/lib/docspring/models/template_field_logic_status.rb +1 -1
  170. data/lib/docspring/models/template_field_move.rb +1 -1
  171. data/lib/docspring/models/template_fields.rb +1 -1
  172. data/lib/docspring/models/template_form_mode.rb +1 -1
  173. data/lib/docspring/models/template_model_code.rb +1 -1
  174. data/lib/docspring/models/template_page_ai_error.rb +1 -1
  175. data/lib/docspring/models/template_page_ai_naming_status.rb +1 -1
  176. data/lib/docspring/models/template_page_fields_status.rb +1 -1
  177. data/lib/docspring/models/template_page_image_status.rb +1 -1
  178. data/lib/docspring/models/template_page_images.rb +1 -1
  179. data/lib/docspring/models/template_page_processing_status.rb +1 -1
  180. data/lib/docspring/models/template_preview.rb +356 -0
  181. data/lib/docspring/models/template_preview_state.rb +42 -0
  182. data/lib/docspring/models/template_source_pdf.rb +1 -1
  183. data/lib/docspring/models/template_summary.rb +34 -574
  184. data/lib/docspring/models/template_summary_list.rb +1 -1
  185. data/lib/docspring/models/template_type.rb +3 -2
  186. data/lib/docspring/models/template_version.rb +1 -1
  187. data/lib/docspring/models/template_version_type.rb +1 -1
  188. data/lib/docspring/models/text_alignment.rb +1 -1
  189. data/lib/docspring/models/text_overflow.rb +1 -1
  190. data/lib/docspring/models/text_vertical_alignment.rb +1 -1
  191. data/lib/docspring/models/typeface.rb +1 -1
  192. data/lib/docspring/models/update_signature_request_request.rb +1 -1
  193. data/lib/docspring/models/update_template_document_request.rb +7 -7
  194. data/lib/docspring/models/update_template_fields_request.rb +1 -1
  195. data/lib/docspring/models/update_template_request.rb +31 -11
  196. data/lib/docspring/models/update_webhook_request.rb +1 -1
  197. data/lib/docspring/models/upload_method.rb +1 -1
  198. data/lib/docspring/models/upload_presign.rb +1 -1
  199. data/lib/docspring/models/url_source_pdf.rb +1 -1
  200. data/lib/docspring/models/validate_submission_request.rb +6 -6
  201. data/lib/docspring/models/webhook.rb +1 -1
  202. data/lib/docspring/models/webhook_event_type.rb +1 -1
  203. data/lib/docspring/models/webhook_list.rb +1 -1
  204. data/lib/docspring/models/webhook_mode.rb +1 -1
  205. data/lib/docspring/request_schemas.json +144 -10
  206. data/lib/docspring/version.rb +2 -2
  207. data/lib/docspring/webhook_signature.rb +45 -0
  208. data/lib/docspring.rb +7 -1
  209. data/spec/api/client_spec.rb +61 -25
  210. data/spec/models/add_template_fields_request_spec.rb +1 -1
  211. data/spec/models/ai_field_naming_language_spec.rb +1 -1
  212. data/spec/models/authentication_check_spec.rb +1 -1
  213. data/spec/models/barcode_symbology_spec.rb +1 -1
  214. data/spec/models/check_character_spec.rb +1 -1
  215. data/spec/models/combined_field_type_spec.rb +1 -1
  216. data/spec/models/combined_pdf_files_spec.rb +1 -1
  217. data/spec/models/combined_pdf_list_spec.rb +1 -1
  218. data/spec/models/combined_pdf_source_input_spec.rb +1 -1
  219. data/spec/models/combined_pdf_source_pdf_spec.rb +1 -1
  220. data/spec/models/combined_pdf_source_spec.rb +1 -1
  221. data/spec/models/combined_pdf_source_type_spec.rb +1 -1
  222. data/spec/models/combined_pdf_spec.rb +1 -1
  223. data/spec/models/combined_pdf_state_spec.rb +1 -1
  224. data/spec/models/copy_template_request_spec.rb +1 -1
  225. data/spec/models/create_combined_pdf_request_spec.rb +1 -1
  226. data/spec/models/create_custom_file_from_upload_request_spec.rb +1 -1
  227. data/spec/models/create_folder_request_spec.rb +1 -1
  228. data/spec/models/create_signature_request_event_request_spec.rb +1 -1
  229. data/spec/models/create_signature_request_token_request_spec.rb +1 -1
  230. data/spec/models/create_submission_batch_request_spec.rb +1 -1
  231. data/spec/models/create_submission_request_spec.rb +1 -1
  232. data/spec/models/create_template_preview_request_spec.rb +36 -0
  233. data/spec/models/create_template_request_spec.rb +13 -1
  234. data/spec/models/create_webhook_request_spec.rb +1 -1
  235. data/spec/models/custom_file_list_spec.rb +1 -1
  236. data/spec/models/custom_file_source_pdf_spec.rb +1 -1
  237. data/spec/models/custom_file_spec.rb +1 -1
  238. data/spec/models/error_code_spec.rb +1 -1
  239. data/spec/models/error_detail_spec.rb +1 -1
  240. data/spec/models/error_info_spec.rb +1 -1
  241. data/spec/models/error_response_spec.rb +1 -1
  242. data/spec/models/expiration_interval_spec.rb +1 -1
  243. data/spec/models/field_comparison_condition_spec.rb +1 -1
  244. data/spec/models/field_comparison_operator_spec.rb +1 -1
  245. data/spec/models/field_dependency_input_spec.rb +1 -1
  246. data/spec/models/field_dependency_spec.rb +1 -1
  247. data/spec/models/field_display_type_spec.rb +1 -1
  248. data/spec/models/field_equals_condition_spec.rb +1 -1
  249. data/spec/models/field_equals_operator_spec.rb +1 -1
  250. data/spec/models/field_group_input_spec.rb +1 -1
  251. data/spec/models/field_group_spec.rb +1 -1
  252. data/spec/models/field_group_type_spec.rb +1 -1
  253. data/spec/models/field_in_condition_spec.rb +1 -1
  254. data/spec/models/field_input_spec.rb +1 -1
  255. data/spec/models/field_override_spec.rb +1 -1
  256. data/spec/models/field_presence_condition_spec.rb +1 -1
  257. data/spec/models/field_presence_operator_spec.rb +1 -1
  258. data/spec/models/field_range_condition_spec.rb +1 -1
  259. data/spec/models/field_reimport_state_spec.rb +1 -1
  260. data/spec/models/field_setup_logic_spec.rb +1 -1
  261. data/spec/models/field_setup_naming_spec.rb +1 -1
  262. data/spec/models/field_setup_source_spec.rb +1 -1
  263. data/spec/models/field_spec.rb +1 -1
  264. data/spec/models/field_type_spec.rb +1 -1
  265. data/spec/models/folder_list_spec.rb +1 -1
  266. data/spec/models/folder_spec.rb +1 -1
  267. data/spec/models/generate_files_format_spec.rb +1 -1
  268. data/spec/models/generate_submission_files_request_spec.rb +1 -1
  269. data/spec/models/generated_file_spec.rb +1 -1
  270. data/spec/models/generated_file_state_spec.rb +1 -1
  271. data/spec/models/html_engine_options_input_spec.rb +1 -1
  272. data/spec/models/html_engine_options_spec.rb +1 -1
  273. data/spec/models/image_gravity_spec.rb +1 -1
  274. data/spec/models/image_scale_type_spec.rb +1 -1
  275. data/spec/models/model_code_language_spec.rb +1 -1
  276. data/spec/models/move_folder_request_spec.rb +1 -1
  277. data/spec/models/move_template_request_spec.rb +1 -1
  278. data/spec/models/number_condition_type_spec.rb +1 -1
  279. data/spec/models/output_format_spec.rb +1 -1
  280. data/spec/models/page_format_spec.rb +1 -1
  281. data/spec/models/page_image_spec.rb +1 -1
  282. data/spec/models/page_images_spec.rb +1 -1
  283. data/spec/models/predefined_field_input_spec.rb +1 -1
  284. data/spec/models/predefined_field_spec.rb +1 -1
  285. data/spec/models/publish_template_version_request_spec.rb +1 -1
  286. data/spec/models/remove_template_fields_request_spec.rb +1 -1
  287. data/spec/models/rename_folder_request_spec.rb +1 -1
  288. data/spec/models/reorder_template_fields_request_spec.rb +1 -1
  289. data/spec/models/restore_template_version_request_spec.rb +1 -1
  290. data/spec/models/shape_type_spec.rb +1 -1
  291. data/spec/models/signature_request_auth_second_factor_type_spec.rb +1 -1
  292. data/spec/models/signature_request_auth_type_spec.rb +1 -1
  293. data/spec/models/signature_request_event_spec.rb +1 -1
  294. data/spec/models/signature_request_event_type_spec.rb +1 -1
  295. data/spec/models/signature_request_input_spec.rb +1 -1
  296. data/spec/models/signature_request_message_type_spec.rb +1 -1
  297. data/spec/models/signature_request_spec.rb +1 -1
  298. data/spec/models/signature_request_state_spec.rb +1 -1
  299. data/spec/models/signature_request_token_spec.rb +1 -1
  300. data/spec/models/signature_request_token_type_spec.rb +1 -1
  301. data/spec/models/string_condition_type_spec.rb +1 -1
  302. data/spec/models/submission_action_spec.rb +1 -1
  303. data/spec/models/submission_action_state_spec.rb +1 -1
  304. data/spec/models/submission_action_type_spec.rb +1 -1
  305. data/spec/models/submission_batch_spec.rb +1 -1
  306. data/spec/models/submission_batch_state_spec.rb +1 -1
  307. data/spec/models/submission_files_spec.rb +13 -1
  308. data/spec/models/submission_input_spec.rb +1 -1
  309. data/spec/models/submission_list_spec.rb +1 -1
  310. data/spec/models/submission_source_pdf_spec.rb +1 -1
  311. data/spec/models/submission_source_spec.rb +1 -1
  312. data/spec/models/submission_spec.rb +13 -13
  313. data/spec/models/submission_state_spec.rb +1 -1
  314. data/spec/models/submission_summary_spec.rb +144 -0
  315. data/spec/models/submission_validation_spec.rb +1 -1
  316. data/spec/models/template_actor_spec.rb +1 -1
  317. data/spec/models/template_actor_type_spec.rb +1 -1
  318. data/spec/models/template_defaults_input_spec.rb +1 -1
  319. data/spec/models/template_defaults_spec.rb +1 -1
  320. data/spec/models/template_diff_spec.rb +1 -1
  321. data/spec/models/template_diff_summary_spec.rb +1 -1
  322. data/spec/models/template_document_spec.rb +6 -6
  323. data/spec/models/template_document_state_spec.rb +1 -1
  324. data/spec/models/template_document_summary_spec.rb +54 -0
  325. data/spec/models/template_field_change_spec.rb +1 -1
  326. data/spec/models/template_field_changes_spec.rb +1 -1
  327. data/spec/models/template_field_dependency_action_spec.rb +1 -1
  328. data/spec/models/template_field_dependency_condition_input_spec.rb +1 -1
  329. data/spec/models/template_field_dependency_condition_spec.rb +1 -1
  330. data/spec/models/template_field_dependency_input_spec.rb +1 -1
  331. data/spec/models/template_field_dependency_match_spec.rb +1 -1
  332. data/spec/models/template_field_dependency_operator_spec.rb +1 -1
  333. data/spec/models/template_field_dependency_spec.rb +1 -1
  334. data/spec/models/template_field_logic_status_spec.rb +1 -1
  335. data/spec/models/template_field_move_spec.rb +1 -1
  336. data/spec/models/template_fields_spec.rb +1 -1
  337. data/spec/models/template_form_mode_spec.rb +1 -1
  338. data/spec/models/template_model_code_spec.rb +1 -1
  339. data/spec/models/template_page_ai_error_spec.rb +1 -1
  340. data/spec/models/template_page_ai_naming_status_spec.rb +1 -1
  341. data/spec/models/template_page_fields_status_spec.rb +1 -1
  342. data/spec/models/template_page_image_status_spec.rb +1 -1
  343. data/spec/models/template_page_images_spec.rb +1 -1
  344. data/spec/models/template_page_processing_status_spec.rb +1 -1
  345. data/spec/models/template_preview_spec.rb +78 -0
  346. data/spec/models/template_preview_state_spec.rb +30 -0
  347. data/spec/models/template_source_pdf_spec.rb +1 -1
  348. data/spec/models/template_spec.rb +35 -23
  349. data/spec/models/template_summary_list_spec.rb +1 -1
  350. data/spec/models/template_summary_spec.rb +6 -138
  351. data/spec/models/template_type_spec.rb +1 -1
  352. data/spec/models/template_version_spec.rb +1 -1
  353. data/spec/models/template_version_type_spec.rb +1 -1
  354. data/spec/models/text_alignment_spec.rb +1 -1
  355. data/spec/models/text_overflow_spec.rb +1 -1
  356. data/spec/models/text_vertical_alignment_spec.rb +1 -1
  357. data/spec/models/typeface_spec.rb +1 -1
  358. data/spec/models/update_signature_request_request_spec.rb +1 -1
  359. data/spec/models/update_template_document_request_spec.rb +1 -1
  360. data/spec/models/update_template_fields_request_spec.rb +1 -1
  361. data/spec/models/update_template_request_spec.rb +13 -1
  362. data/spec/models/update_webhook_request_spec.rb +1 -1
  363. data/spec/models/upload_method_spec.rb +1 -1
  364. data/spec/models/upload_presign_spec.rb +1 -1
  365. data/spec/models/url_source_pdf_spec.rb +1 -1
  366. data/spec/models/validate_submission_request_spec.rb +1 -1
  367. data/spec/models/webhook_event_type_spec.rb +1 -1
  368. data/spec/models/webhook_list_spec.rb +1 -1
  369. data/spec/models/webhook_mode_spec.rb +1 -1
  370. data/spec/models/webhook_spec.rb +1 -1
  371. data/spec/spec_helper.rb +1 -1
  372. metadata +25 -2
@@ -1,7 +1,7 @@
1
1
  =begin
2
2
  #DocSpring API
3
3
 
4
- #Use DocSpring's API to programmatically fill out PDF forms, convert HTML to PDFs, merge PDFs, or request legally binding e-signatures.
4
+ #Use DocSpring's API to fill PDF forms, generate PDFs and Word documents from HTML or Word templates, merge PDFs, and request legally binding e-signatures.
5
5
 
6
6
  The version of the OpenAPI document: v2
7
7
 
@@ -215,6 +215,7 @@ end
215
215
  # @param body [CreateCombinedPdfRequest] The PDFs to merge, and the combined PDF's settings.
216
216
  # @param [Hash] opts the optional parameters
217
217
  # @option opts [Boolean] :wait Wait until the PDF has been generated before responding. Default true on sync.api hosts.
218
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another combined PDF. Send a new key with each new combined PDF, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
218
219
  # @return [CombinedPdf]
219
220
  def create_combined_pdf(body, opts = {})
220
221
  data, _status_code, _headers = create_combined_pdf_with_http_info(body, opts)
@@ -226,6 +227,7 @@ end
226
227
  # @param body [CreateCombinedPdfRequest] The PDFs to merge, and the combined PDF's settings.
227
228
  # @param [Hash] opts the optional parameters
228
229
  # @option opts [Boolean] :wait Wait until the PDF has been generated before responding. Default true on sync.api hosts.
230
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another combined PDF. Send a new key with each new combined PDF, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
229
231
  # @return [Array<(CombinedPdf, Integer, Hash)>] CombinedPdf data, response status code and response headers
230
232
  def create_combined_pdf_with_http_info(body, opts = {})
231
233
  if @api_client.config.debugging
@@ -251,6 +253,7 @@ end
251
253
  if !content_type.nil?
252
254
  header_params['Content-Type'] = content_type
253
255
  end
256
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
254
257
 
255
258
  # form parameters
256
259
  form_params = opts[:form_params] || {}
@@ -418,7 +421,7 @@ end
418
421
  end
419
422
 
420
423
  # Record a signature request event
421
- # Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (`send_request`). The audit trail shows it as reported by your account.
424
+ # Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (`send_request`). The audit trail shows it as reported by your account. A finished (completed, declined or expired) signature request's audit trail takes no more events, and a test API token can't record one for a live signature request.
422
425
  # @param signature_request_id [String] The signature request's ID.
423
426
  # @param body [CreateSignatureRequestEventRequest] The event to record.
424
427
  # @param [Hash] opts the optional parameters
@@ -429,7 +432,7 @@ end
429
432
  end
430
433
 
431
434
  # Record a signature request event
432
- # Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (`send_request`). The audit trail shows it as reported by your account.
435
+ # Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (`send_request`). The audit trail shows it as reported by your account. A finished (completed, declined or expired) signature request's audit trail takes no more events, and a test API token can't record one for a live signature request.
433
436
  # @param signature_request_id [String] The signature request's ID.
434
437
  # @param body [CreateSignatureRequestEventRequest] The event to record.
435
438
  # @param [Hash] opts the optional parameters
@@ -568,6 +571,7 @@ end
568
571
  # @param [Hash] opts the optional parameters
569
572
  # @option opts [String] :version The template version to use: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published).
570
573
  # @option opts [Boolean] :wait Wait until the files have been generated before responding. Default true on sync.api hosts.
574
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another submission. Send a new key with each new submission, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
571
575
  # @return [Submission]
572
576
  def create_submission(template_id, body, opts = {})
573
577
  data, _status_code, _headers = create_submission_with_http_info(template_id, body, opts)
@@ -581,6 +585,7 @@ end
581
585
  # @param [Hash] opts the optional parameters
582
586
  # @option opts [String] :version The template version to use: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published).
583
587
  # @option opts [Boolean] :wait Wait until the files have been generated before responding. Default true on sync.api hosts.
588
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another submission. Send a new key with each new submission, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
584
589
  # @return [Array<(Submission, Integer, Hash)>] Submission data, response status code and response headers
585
590
  def create_submission_with_http_info(template_id, body, opts = {})
586
591
  if @api_client.config.debugging
@@ -611,6 +616,7 @@ end
611
616
  if !content_type.nil?
612
617
  header_params['Content-Type'] = content_type
613
618
  end
619
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
614
620
 
615
621
  # form parameters
616
622
  form_params = opts[:form_params] || {}
@@ -645,7 +651,8 @@ end
645
651
  # Creates up to 50 submissions in one request, from one template or several. The PDFs are only generated when every submission is valid. On sync.api hosts the request waits until every PDF has been generated (unless you pass `wait=false`), otherwise poll GET /submissions/batches/{submission_batch_id} until `processed_at` is set. When any submission is invalid, nothing is generated and the request returns a 422. Submissions whose data doesn't match their template's fields are still saved with their errors (an `invalid_data` error, with each one's `submission_id` in its details), so you can find them in DocSpring. The other submissions aren't saved.
646
652
  # @param body [CreateSubmissionBatchRequest] The submissions to create, and the settings they share.
647
653
  # @param [Hash] opts the optional parameters
648
- # @option opts [Boolean] :wait Wait until every PDF in the batch has been generated before responding. Default true on sync.api hosts.
654
+ # @option opts [Boolean] :wait Wait until every file in the batch has been generated before responding. Default true on sync.api hosts.
655
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another batch. Send a new key with each new batch, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
649
656
  # @return [SubmissionBatch]
650
657
  def create_submission_batch(body, opts = {})
651
658
  data, _status_code, _headers = create_submission_batch_with_http_info(body, opts)
@@ -656,7 +663,8 @@ end
656
663
  # Creates up to 50 submissions in one request, from one template or several. The PDFs are only generated when every submission is valid. On sync.api hosts the request waits until every PDF has been generated (unless you pass `wait=false`), otherwise poll GET /submissions/batches/{submission_batch_id} until `processed_at` is set. When any submission is invalid, nothing is generated and the request returns a 422. Submissions whose data doesn't match their template's fields are still saved with their errors (an `invalid_data` error, with each one's `submission_id` in its details), so you can find them in DocSpring. The other submissions aren't saved.
657
664
  # @param body [CreateSubmissionBatchRequest] The submissions to create, and the settings they share.
658
665
  # @param [Hash] opts the optional parameters
659
- # @option opts [Boolean] :wait Wait until every PDF in the batch has been generated before responding. Default true on sync.api hosts.
666
+ # @option opts [Boolean] :wait Wait until every file in the batch has been generated before responding. Default true on sync.api hosts.
667
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another batch. Send a new key with each new batch, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
660
668
  # @return [Array<(SubmissionBatch, Integer, Hash)>] SubmissionBatch data, response status code and response headers
661
669
  def create_submission_batch_with_http_info(body, opts = {})
662
670
  if @api_client.config.debugging
@@ -682,6 +690,7 @@ end
682
690
  if !content_type.nil?
683
691
  header_params['Content-Type'] = content_type
684
692
  end
693
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
685
694
 
686
695
  # form parameters
687
696
  form_params = opts[:form_params] || {}
@@ -713,10 +722,10 @@ end
713
722
  end
714
723
 
715
724
  # Create a template
716
- # Creates an HTML template, or a PDF template from a PDF you uploaded with the presigned upload (GET /uploads/presign): pass its `fields.key` as `cache_id`. To send the PDF with the request instead, use POST /templates/upload. A PDF template is ready to generate PDFs once DocSpring has processed its PDF (`ready` is true). On sync.api hosts the request waits for that unless you pass `wait=false`.
725
+ # Creates an HTML template, or a PDF or Word template from a file you uploaded with the presigned upload (GET /uploads/presign): pass its `fields.key` as `cache_id`. You can send a link to the file (`document_url`) or the file in base64 (`document_base64`) instead, or send the file with the request with POST /templates/upload. A Word template is made from a Word document (.docx) or an OpenDocument text file (.odt), which DocSpring converts to a Word document. It needs its `output_format`: what each submission makes, a Word document (`docx`), an OpenDocument file (`odt`) or a PDF. A PDF template is ready to generate PDFs once DocSpring has processed its PDF, a template created from a `document_url` once its document has been downloaded, and one created from an .odt once it has been converted (`ready` is true). On sync.api hosts the request waits for that unless you pass `wait=false`.
717
726
  # @param body [CreateTemplateRequest] The template to create.
718
727
  # @param [Hash] opts the optional parameters
719
- # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
728
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, a `document_url`'s PDF or Word document downloaded, and an OpenDocument file converted, before responding. Default true on sync.api hosts.
720
729
  # @return [Template]
721
730
  def create_template(body, opts = {})
722
731
  data, _status_code, _headers = create_template_with_http_info(body, opts)
@@ -724,10 +733,10 @@ end
724
733
  end
725
734
 
726
735
  # Create a template
727
- # Creates an HTML template, or a PDF template from a PDF you uploaded with the presigned upload (GET /uploads/presign): pass its `fields.key` as `cache_id`. To send the PDF with the request instead, use POST /templates/upload. A PDF template is ready to generate PDFs once DocSpring has processed its PDF (`ready` is true). On sync.api hosts the request waits for that unless you pass `wait=false`.
736
+ # Creates an HTML template, or a PDF or Word template from a file you uploaded with the presigned upload (GET /uploads/presign): pass its `fields.key` as `cache_id`. You can send a link to the file (`document_url`) or the file in base64 (`document_base64`) instead, or send the file with the request with POST /templates/upload. A Word template is made from a Word document (.docx) or an OpenDocument text file (.odt), which DocSpring converts to a Word document. It needs its `output_format`: what each submission makes, a Word document (`docx`), an OpenDocument file (`odt`) or a PDF. A PDF template is ready to generate PDFs once DocSpring has processed its PDF, a template created from a `document_url` once its document has been downloaded, and one created from an .odt once it has been converted (`ready` is true). On sync.api hosts the request waits for that unless you pass `wait=false`.
728
737
  # @param body [CreateTemplateRequest] The template to create.
729
738
  # @param [Hash] opts the optional parameters
730
- # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
739
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, a `document_url`'s PDF or Word document downloaded, and an OpenDocument file converted, before responding. Default true on sync.api hosts.
731
740
  # @return [Array<(Template, Integer, Hash)>] Template data, response status code and response headers
732
741
  def create_template_with_http_info(body, opts = {})
733
742
  if @api_client.config.debugging
@@ -783,6 +792,83 @@ end
783
792
  return data, status_code, headers
784
793
  end
785
794
 
795
+ # Preview a template with data
796
+ # Makes PNG images of a template's pages filled in with the data you send (not a PDF), so you can check how an HTML, PDF or Word template prints with your data before you publish a version or send live data. A Word template's pages are its PDF's, whatever its `output_format`. It renders the template's draft, or the published `version` you ask for. A preview makes no submission and uses no credits, and its pages are watermarked like a test submission's PDF. It's `pending` while it renders: get it with GET /templates/{template_id}/previews/{preview_id} until it's `processed`, with an image of each page, or `error`.
797
+ # @param template_id [String] The template's ID.
798
+ # @param body [CreateTemplatePreviewRequest] The data to render the template with.
799
+ # @param [Hash] opts the optional parameters
800
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
801
+ # @return [TemplatePreview]
802
+ def create_template_preview(template_id, body, opts = {})
803
+ data, _status_code, _headers = create_template_preview_with_http_info(template_id, body, opts)
804
+ data
805
+ end
806
+
807
+ # Preview a template with data
808
+ # Makes PNG images of a template's pages filled in with the data you send (not a PDF), so you can check how an HTML, PDF or Word template prints with your data before you publish a version or send live data. A Word template's pages are its PDF's, whatever its `output_format`. It renders the template's draft, or the published `version` you ask for. A preview makes no submission and uses no credits, and its pages are watermarked like a test submission's PDF. It's `pending` while it renders: get it with GET /templates/{template_id}/previews/{preview_id} until it's `processed`, with an image of each page, or `error`.
809
+ # @param template_id [String] The template's ID.
810
+ # @param body [CreateTemplatePreviewRequest] The data to render the template with.
811
+ # @param [Hash] opts the optional parameters
812
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
813
+ # @return [Array<(TemplatePreview, Integer, Hash)>] TemplatePreview data, response status code and response headers
814
+ def create_template_preview_with_http_info(template_id, body, opts = {})
815
+ if @api_client.config.debugging
816
+ @api_client.config.logger.debug 'Calling API: Client.create_template_preview ...'
817
+ end
818
+ # verify the required parameter 'template_id' is set
819
+ if @api_client.config.client_side_validation && template_id.nil?
820
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.create_template_preview"
821
+ end
822
+ # verify the required parameter 'body' is set
823
+ if @api_client.config.client_side_validation && body.nil?
824
+ fail ArgumentError, "Missing the required parameter 'body' when calling Client.create_template_preview"
825
+ end
826
+ # resource path
827
+ local_var_path = '/templates/{template_id}/previews'.sub('{template_id}', CGI.escape(template_id.to_s))
828
+
829
+ # query parameters
830
+ query_params = opts[:query_params] || {}
831
+ query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
832
+
833
+ # header parameters
834
+ header_params = opts[:header_params] || {}
835
+ # HTTP header 'Accept' (if needed)
836
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
837
+ # HTTP header 'Content-Type'
838
+ content_type = @api_client.select_header_content_type(['application/json'])
839
+ if !content_type.nil?
840
+ header_params['Content-Type'] = content_type
841
+ end
842
+
843
+ # form parameters
844
+ form_params = opts[:form_params] || {}
845
+
846
+ # http body (model)
847
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
848
+
849
+ # return_type
850
+ return_type = opts[:debug_return_type] || 'TemplatePreview'
851
+
852
+ # auth_names
853
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
854
+
855
+ new_options = opts.merge(
856
+ :operation => :"Client.create_template_preview",
857
+ :header_params => header_params,
858
+ :query_params => query_params,
859
+ :form_params => form_params,
860
+ :body => post_body,
861
+ :auth_names => auth_names,
862
+ :return_type => return_type
863
+ )
864
+
865
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
866
+ if @api_client.config.debugging
867
+ @api_client.config.logger.debug "API called: Client#create_template_preview\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
868
+ end
869
+ return data, status_code, headers
870
+ end
871
+
786
872
  # Create a webhook
787
873
  # Creates a webhook that sends a POST request to your endpoint whenever a subscribed event happens. Scope it to API tokens, templates or folders to receive only their events.
788
874
  # @param body [CreateWebhookRequest] The webhook to create.
@@ -1233,7 +1319,7 @@ end
1233
1319
  end
1234
1320
 
1235
1321
  # Generate more files
1236
- # Adds formats to a processed submission's files, in the background: `png`, a PNG image of each page of the PDF (up to 100 pages). To make them with the submission, add them to `output_formats` when you create it. Each new file is listed in `files` while it's made: on sync.api hosts the request waits for them (unless you pass `wait=false`), otherwise poll GET /submissions/{submission_id} until none of their `state` is `pending`. A file that couldn't be made has the state `error` and an `error_message`, and the submission stays processed. Asking for a format the submission already has (or is making) changes nothing.
1322
+ # Adds formats to a processed submission's files, in the background, without using credits again: `pdf`, the PDF of a Word template's submission that made only its Word document (converted from that document), `docx`, the Word document of a Word template's submission that made only its PDF (made again from its data and the template version it used), `odt`, a Word template's submission's OpenDocument file (converted from its Word document, or from one made again when it didn't keep one), and `png`, a PNG image of each page of the PDF (up to 100 pages), which makes the PDF first when the submission doesn't have one. To make them with the submission, add them to `output_formats` when you create it. Each new file is listed in `files` while it's made: on sync.api hosts the request waits for them (unless you pass `wait=false`), otherwise poll GET /submissions/{submission_id} until none of their `state` is `pending`. A file that couldn't be made has the state `error` and an `error_message`, and the submission stays processed. Asking for a format the submission already has (or is making) changes nothing.
1237
1323
  # @param submission_id [String] The submission's ID.
1238
1324
  # @param body [GenerateSubmissionFilesRequest] The formats to make.
1239
1325
  # @param [Hash] opts the optional parameters
@@ -1245,7 +1331,7 @@ end
1245
1331
  end
1246
1332
 
1247
1333
  # Generate more files
1248
- # Adds formats to a processed submission's files, in the background: `png`, a PNG image of each page of the PDF (up to 100 pages). To make them with the submission, add them to `output_formats` when you create it. Each new file is listed in `files` while it's made: on sync.api hosts the request waits for them (unless you pass `wait=false`), otherwise poll GET /submissions/{submission_id} until none of their `state` is `pending`. A file that couldn't be made has the state `error` and an `error_message`, and the submission stays processed. Asking for a format the submission already has (or is making) changes nothing.
1334
+ # Adds formats to a processed submission's files, in the background, without using credits again: `pdf`, the PDF of a Word template's submission that made only its Word document (converted from that document), `docx`, the Word document of a Word template's submission that made only its PDF (made again from its data and the template version it used), `odt`, a Word template's submission's OpenDocument file (converted from its Word document, or from one made again when it didn't keep one), and `png`, a PNG image of each page of the PDF (up to 100 pages), which makes the PDF first when the submission doesn't have one. To make them with the submission, add them to `output_formats` when you create it. Each new file is listed in `files` while it's made: on sync.api hosts the request waits for them (unless you pass `wait=false`), otherwise poll GET /submissions/{submission_id} until none of their `state` is `pending`. A file that couldn't be made has the state `error` and an `error_message`, and the submission stays processed. Asking for a format the submission already has (or is making) changes nothing.
1249
1335
  # @param submission_id [String] The submission's ID.
1250
1336
  # @param body [GenerateSubmissionFilesRequest] The formats to make.
1251
1337
  # @param [Hash] opts the optional parameters
@@ -1943,11 +2029,12 @@ end
1943
2029
  end
1944
2030
 
1945
2031
  # Generate typed code for a template's submission data
1946
- # Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir or Go, so your app catches mistakes before it calls the API. `root_type_name` is the type of the whole `data` object. Java returns every class in `code`, each under a `// ClassName.java` comment. A template with no named fields returns 422.
2032
+ # Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir, Go or Rust, so your app catches mistakes before it calls the API. `root_type_name` is the type of the whole `data` object, and `just_types=true` leaves out the code that converts JSON to and from the types. Java returns every class in `code`, each under a `// ClassName.java` comment. A template with no named fields returns 422.
1947
2033
  # @param template_id [String] The template's ID.
1948
2034
  # @param lang [ModelCodeLanguage] The language to generate the code in.
1949
2035
  # @param [Hash] opts the optional parameters
1950
2036
  # @option opts [String] :version The template version: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published), the version a submission uses by default.
2037
+ # @option opts [Boolean] :just_types Return only the types (interfaces, classes or structs), without the code that converts JSON to and from them. Default false. JavaScript has no types, PHP has no types-only code, and Rust's code is only types (serde converts the JSON), so theirs is the same either way.
1951
2038
  # @return [TemplateModelCode]
1952
2039
  def get_template_model_code(template_id, lang, opts = {})
1953
2040
  data, _status_code, _headers = get_template_model_code_with_http_info(template_id, lang, opts)
@@ -1955,11 +2042,12 @@ end
1955
2042
  end
1956
2043
 
1957
2044
  # Generate typed code for a template's submission data
1958
- # Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir or Go, so your app catches mistakes before it calls the API. `root_type_name` is the type of the whole `data` object. Java returns every class in `code`, each under a `// ClassName.java` comment. A template with no named fields returns 422.
2045
+ # Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir, Go or Rust, so your app catches mistakes before it calls the API. `root_type_name` is the type of the whole `data` object, and `just_types=true` leaves out the code that converts JSON to and from the types. Java returns every class in `code`, each under a `// ClassName.java` comment. A template with no named fields returns 422.
1959
2046
  # @param template_id [String] The template's ID.
1960
2047
  # @param lang [ModelCodeLanguage] The language to generate the code in.
1961
2048
  # @param [Hash] opts the optional parameters
1962
2049
  # @option opts [String] :version The template version: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published), the version a submission uses by default.
2050
+ # @option opts [Boolean] :just_types Return only the types (interfaces, classes or structs), without the code that converts JSON to and from them. Default false. JavaScript has no types, PHP has no types-only code, and Rust's code is only types (serde converts the JSON), so theirs is the same either way.
1963
2051
  # @return [Array<(TemplateModelCode, Integer, Hash)>] TemplateModelCode data, response status code and response headers
1964
2052
  def get_template_model_code_with_http_info(template_id, lang, opts = {})
1965
2053
  if @api_client.config.debugging
@@ -1980,6 +2068,7 @@ end
1980
2068
  query_params = opts[:query_params] || {}
1981
2069
  query_params[:'lang'] = lang
1982
2070
  query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
2071
+ query_params[:'just_types'] = opts[:'just_types'] if !opts[:'just_types'].nil?
1983
2072
 
1984
2073
  # header parameters
1985
2074
  header_params = opts[:header_params] || {}
@@ -2081,6 +2170,75 @@ end
2081
2170
  return data, status_code, headers
2082
2171
  end
2083
2172
 
2173
+ # Get a template preview
2174
+ # Returns a preview made with POST /templates/{template_id}/previews. Once it's `processed`, `pages` has a PNG image of each page with a temporary link to download it: a preview has no PDF. Previews are deleted an hour after they're created.
2175
+ # @param template_id [String] The template's ID.
2176
+ # @param preview_id [String] The preview's ID.
2177
+ # @param [Hash] opts the optional parameters
2178
+ # @return [TemplatePreview]
2179
+ def get_template_preview(template_id, preview_id, opts = {})
2180
+ data, _status_code, _headers = get_template_preview_with_http_info(template_id, preview_id, opts)
2181
+ data
2182
+ end
2183
+
2184
+ # Get a template preview
2185
+ # Returns a preview made with POST /templates/{template_id}/previews. Once it's `processed`, `pages` has a PNG image of each page with a temporary link to download it: a preview has no PDF. Previews are deleted an hour after they're created.
2186
+ # @param template_id [String] The template's ID.
2187
+ # @param preview_id [String] The preview's ID.
2188
+ # @param [Hash] opts the optional parameters
2189
+ # @return [Array<(TemplatePreview, Integer, Hash)>] TemplatePreview data, response status code and response headers
2190
+ def get_template_preview_with_http_info(template_id, preview_id, opts = {})
2191
+ if @api_client.config.debugging
2192
+ @api_client.config.logger.debug 'Calling API: Client.get_template_preview ...'
2193
+ end
2194
+ # verify the required parameter 'template_id' is set
2195
+ if @api_client.config.client_side_validation && template_id.nil?
2196
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.get_template_preview"
2197
+ end
2198
+ # verify the required parameter 'preview_id' is set
2199
+ if @api_client.config.client_side_validation && preview_id.nil?
2200
+ fail ArgumentError, "Missing the required parameter 'preview_id' when calling Client.get_template_preview"
2201
+ end
2202
+ # resource path
2203
+ local_var_path = '/templates/{template_id}/previews/{preview_id}'.sub('{template_id}', CGI.escape(template_id.to_s)).sub('{preview_id}', CGI.escape(preview_id.to_s))
2204
+
2205
+ # query parameters
2206
+ query_params = opts[:query_params] || {}
2207
+
2208
+ # header parameters
2209
+ header_params = opts[:header_params] || {}
2210
+ # HTTP header 'Accept' (if needed)
2211
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
2212
+
2213
+ # form parameters
2214
+ form_params = opts[:form_params] || {}
2215
+
2216
+ # http body (model)
2217
+ post_body = opts[:debug_body]
2218
+
2219
+ # return_type
2220
+ return_type = opts[:debug_return_type] || 'TemplatePreview'
2221
+
2222
+ # auth_names
2223
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
2224
+
2225
+ new_options = opts.merge(
2226
+ :operation => :"Client.get_template_preview",
2227
+ :header_params => header_params,
2228
+ :query_params => query_params,
2229
+ :form_params => form_params,
2230
+ :body => post_body,
2231
+ :auth_names => auth_names,
2232
+ :return_type => return_type
2233
+ )
2234
+
2235
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2236
+ if @api_client.config.debugging
2237
+ @api_client.config.logger.debug "API called: Client#get_template_preview\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2238
+ end
2239
+ return data, status_code, headers
2240
+ end
2241
+
2084
2242
  # Get the JSON Schema of a template's submission data
2085
2243
  # Returns the JSON Schema that a submission's `data` must match. Use it to check data before you create submissions, or to build a form for the template's fields.
2086
2244
  # @param template_id [String] The template's ID.
@@ -2403,7 +2561,7 @@ end
2403
2561
  end
2404
2562
 
2405
2563
  # List submissions
2406
- # Returns the submissions in your account, newest first, one page at a time. Lists leave out each submission's `data` unless you pass `include_data=true`.
2564
+ # Returns the submissions in your account, newest first, one page at a time. Each one is a summary: its `data` is null unless you pass `include_data=true`, and its `files` are empty unless you pass `include_files=true`. Get a submission by its ID for its signature requests, uploads and page images.
2407
2565
  # @param [Hash] opts the optional parameters
2408
2566
  # @option opts [String] :template_id Only list this template's submissions.
2409
2567
  # @option opts [Boolean] :test Only list test submissions (true) or live submissions (false).
@@ -2412,6 +2570,8 @@ end
2412
2570
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
2413
2571
  # @option opts [Integer] :limit How many items to return (1-100, default 50). (default to 50)
2414
2572
  # @option opts [String] :cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
2573
+ # @option opts [SubmissionState] :state Only list submissions in this state (one state per request). The ones that failed are `invalid_data`, `error`, `syntax_error`, `image_download_failed` and `image_processing_failed`, and one still `pending` an hour after it was created is stuck.
2574
+ # @option opts [Boolean] :include_files Include each submission's generated files and their download links (`files`, empty without it), without the page images' links.
2415
2575
  # @return [SubmissionList]
2416
2576
  def list_submissions(opts = {})
2417
2577
  data, _status_code, _headers = list_submissions_with_http_info(opts)
@@ -2419,7 +2579,7 @@ end
2419
2579
  end
2420
2580
 
2421
2581
  # List submissions
2422
- # Returns the submissions in your account, newest first, one page at a time. Lists leave out each submission's `data` unless you pass `include_data=true`.
2582
+ # Returns the submissions in your account, newest first, one page at a time. Each one is a summary: its `data` is null unless you pass `include_data=true`, and its `files` are empty unless you pass `include_files=true`. Get a submission by its ID for its signature requests, uploads and page images.
2423
2583
  # @param [Hash] opts the optional parameters
2424
2584
  # @option opts [String] :template_id Only list this template's submissions.
2425
2585
  # @option opts [Boolean] :test Only list test submissions (true) or live submissions (false).
@@ -2428,6 +2588,8 @@ end
2428
2588
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
2429
2589
  # @option opts [Integer] :limit How many items to return (1-100, default 50). (default to 50)
2430
2590
  # @option opts [String] :cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
2591
+ # @option opts [SubmissionState] :state Only list submissions in this state (one state per request). The ones that failed are `invalid_data`, `error`, `syntax_error`, `image_download_failed` and `image_processing_failed`, and one still `pending` an hour after it was created is stuck.
2592
+ # @option opts [Boolean] :include_files Include each submission's generated files and their download links (`files`, empty without it), without the page images' links.
2431
2593
  # @return [Array<(SubmissionList, Integer, Hash)>] SubmissionList data, response status code and response headers
2432
2594
  def list_submissions_with_http_info(opts = {})
2433
2595
  if @api_client.config.debugging
@@ -2445,6 +2607,8 @@ end
2445
2607
  query_params[:'include_data'] = opts[:'include_data'] if !opts[:'include_data'].nil?
2446
2608
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
2447
2609
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
2610
+ query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
2611
+ query_params[:'include_files'] = opts[:'include_files'] if !opts[:'include_files'].nil?
2448
2612
 
2449
2613
  # header parameters
2450
2614
  header_params = opts[:header_params] || {}
@@ -2556,6 +2720,8 @@ end
2556
2720
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
2557
2721
  # @option opts [Integer] :limit How many items to return (1-100, default 50). (default to 50)
2558
2722
  # @option opts [String] :cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
2723
+ # @option opts [SubmissionState] :state Only list submissions in this state (one state per request). The ones that failed are `invalid_data`, `error`, `syntax_error`, `image_download_failed` and `image_processing_failed`, and one still `pending` an hour after it was created is stuck.
2724
+ # @option opts [Boolean] :include_files Include each submission's generated files and their download links (`files`, empty without it), without the page images' links.
2559
2725
  # @return [SubmissionList]
2560
2726
  def list_template_submissions(template_id, opts = {})
2561
2727
  data, _status_code, _headers = list_template_submissions_with_http_info(template_id, opts)
@@ -2572,6 +2738,8 @@ end
2572
2738
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
2573
2739
  # @option opts [Integer] :limit How many items to return (1-100, default 50). (default to 50)
2574
2740
  # @option opts [String] :cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
2741
+ # @option opts [SubmissionState] :state Only list submissions in this state (one state per request). The ones that failed are `invalid_data`, `error`, `syntax_error`, `image_download_failed` and `image_processing_failed`, and one still `pending` an hour after it was created is stuck.
2742
+ # @option opts [Boolean] :include_files Include each submission's generated files and their download links (`files`, empty without it), without the page images' links.
2575
2743
  # @return [Array<(SubmissionList, Integer, Hash)>] SubmissionList data, response status code and response headers
2576
2744
  def list_template_submissions_with_http_info(template_id, opts = {})
2577
2745
  if @api_client.config.debugging
@@ -2592,6 +2760,8 @@ end
2592
2760
  query_params[:'include_data'] = opts[:'include_data'] if !opts[:'include_data'].nil?
2593
2761
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
2594
2762
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
2763
+ query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
2764
+ query_params[:'include_files'] = opts[:'include_files'] if !opts[:'include_files'].nil?
2595
2765
 
2596
2766
  # header parameters
2597
2767
  header_params = opts[:header_params] || {}
@@ -2628,7 +2798,7 @@ end
2628
2798
  end
2629
2799
 
2630
2800
  # List templates
2631
- # Returns the templates in your account (their drafts), newest first, one page at a time. Get a template by its ID for its HTML, defaults and published versions.
2801
+ # Returns the templates in your account (their drafts), newest first, one page at a time. Each one is a summary: get a template by its ID for its settings, its PDF in full, its HTML, defaults and published versions.
2632
2802
  # @param [Hash] opts the optional parameters
2633
2803
  # @option opts [String] :query Only list templates whose name contains this text (ignoring case).
2634
2804
  # @option opts [String] :parent_folder_id Only list the templates in this folder (not in its subfolders).
@@ -2641,7 +2811,7 @@ end
2641
2811
  end
2642
2812
 
2643
2813
  # List templates
2644
- # Returns the templates in your account (their drafts), newest first, one page at a time. Get a template by its ID for its HTML, defaults and published versions.
2814
+ # Returns the templates in your account (their drafts), newest first, one page at a time. Each one is a summary: get a template by its ID for its settings, its PDF in full, its HTML, defaults and published versions.
2645
2815
  # @param [Hash] opts the optional parameters
2646
2816
  # @option opts [String] :query Only list templates whose name contains this text (ignoring case).
2647
2817
  # @option opts [String] :parent_folder_id Only list the templates in this folder (not in its subfolders).
@@ -2923,7 +3093,7 @@ end
2923
3093
  end
2924
3094
 
2925
3095
  # Publish a template version
2926
- # Publishes the template's draft as a new version that doesn't change. `version_type` says which part of the latest version number goes up. While the template's PDF is downloading or being processed, or DocSpring is setting up its fields, it returns a 409 that says so.
3096
+ # Publishes the template's draft as a new version. Its content (the PDF or HTML, fields, name and description) never changes, while settings such as `webhook_url` and `public_submissions` keep following the draft. `version_type` says which part of the latest version number goes up. While the template's PDF is downloading or being processed, or DocSpring is setting up its fields, it returns a 409 that says so.
2927
3097
  # @param template_id [String] The template's ID.
2928
3098
  # @param body [PublishTemplateVersionRequest] The version to publish.
2929
3099
  # @param [Hash] opts the optional parameters
@@ -2934,7 +3104,7 @@ end
2934
3104
  end
2935
3105
 
2936
3106
  # Publish a template version
2937
- # Publishes the template's draft as a new version that doesn't change. `version_type` says which part of the latest version number goes up. While the template's PDF is downloading or being processed, or DocSpring is setting up its fields, it returns a 409 that says so.
3107
+ # Publishes the template's draft as a new version. Its content (the PDF or HTML, fields, name and description) never changes, while settings such as `webhook_url` and `public_submissions` keep following the draft. `version_type` says which part of the latest version number goes up. While the template's PDF is downloading or being processed, or DocSpring is setting up its fields, it returns a 409 that says so.
2938
3108
  # @param template_id [String] The template's ID.
2939
3109
  # @param body [PublishTemplateVersionRequest] The version to publish.
2940
3110
  # @param [Hash] opts the optional parameters
@@ -3219,7 +3389,7 @@ end
3219
3389
  end
3220
3390
 
3221
3391
  # Restore a template version
3222
- # Replaces the template's draft with a copy of one of its published versions.
3392
+ # Replaces the template's draft with a copy of one of its published versions. The draft keeps its settings that apply to every version, such as `webhook_url`.
3223
3393
  # @param template_id [String] The template's ID.
3224
3394
  # @param body [RestoreTemplateVersionRequest] The version to restore.
3225
3395
  # @param [Hash] opts the optional parameters
@@ -3230,7 +3400,7 @@ end
3230
3400
  end
3231
3401
 
3232
3402
  # Restore a template version
3233
- # Replaces the template's draft with a copy of one of its published versions.
3403
+ # Replaces the template's draft with a copy of one of its published versions. The draft keeps its settings that apply to every version, such as `webhook_url`.
3234
3404
  # @param template_id [String] The template's ID.
3235
3405
  # @param body [RestoreTemplateVersionRequest] The version to restore.
3236
3406
  # @param [Hash] opts the optional parameters
@@ -3424,7 +3594,7 @@ end
3424
3594
  end
3425
3595
 
3426
3596
  # Update a template
3427
- # Changes a template's draft. Properties left out keep their values. `defaults` and `html_engine_options` replace the whole object, and `field_groups` changes only the groups it lists. Setting `parent_folder_id` moves the template and all of its published versions.
3597
+ # Changes a template's draft. Properties left out keep their values. `defaults` and `html_engine_options` replace the whole object, and `field_groups` changes only the groups it lists. Settings such as `webhook_url`, `public_submissions` and `expire_after` apply to every published version too, and setting `parent_folder_id` moves the template and all of its published versions.
3428
3598
  # @param template_id [String] The template's ID.
3429
3599
  # @param body [UpdateTemplateRequest] The settings to change. Properties left out keep their values.
3430
3600
  # @param [Hash] opts the optional parameters
@@ -3435,7 +3605,7 @@ end
3435
3605
  end
3436
3606
 
3437
3607
  # Update a template
3438
- # Changes a template's draft. Properties left out keep their values. `defaults` and `html_engine_options` replace the whole object, and `field_groups` changes only the groups it lists. Setting `parent_folder_id` moves the template and all of its published versions.
3608
+ # Changes a template's draft. Properties left out keep their values. `defaults` and `html_engine_options` replace the whole object, and `field_groups` changes only the groups it lists. Settings such as `webhook_url`, `public_submissions` and `expire_after` apply to every published version too, and setting `parent_folder_id` moves the template and all of its published versions.
3439
3609
  # @param template_id [String] The template's ID.
3440
3610
  # @param body [UpdateTemplateRequest] The settings to change. Properties left out keep their values.
3441
3611
  # @param [Hash] opts the optional parameters
@@ -3497,24 +3667,24 @@ end
3497
3667
  return data, status_code, headers
3498
3668
  end
3499
3669
 
3500
- # Replace a template's PDF
3501
- # Replaces a PDF template's PDF with one you uploaded with the presigned upload (GET /uploads/presign) (`cache_id`), a link to download it from (`document_url`), or the file in base64 (`document_base64`). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields. To send the PDF as `multipart/form-data` instead, use PUT /templates/{template_id}/document/upload.
3670
+ # Replace a template's document
3671
+ # Replaces a PDF template's PDF, or a Word template's Word document (from a .docx or an .odt), with one you uploaded with the presigned upload (GET /uploads/presign) (`cache_id`), a link to download it from (`document_url`), or the file in base64 (`document_base64`). A PDF template's fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields, and a Word template gets a field for each new tag. To send the file as `multipart/form-data` instead, use PUT /templates/{template_id}/document/upload.
3502
3672
  # @param template_id [String] The template's ID.
3503
- # @param body [UpdateTemplateDocumentRequest] The new PDF, as one of `cache_id`, `document_url` and `document_base64`.
3673
+ # @param body [UpdateTemplateDocumentRequest] The new PDF, or a Word template's new Word document, as one of `cache_id`, `document_url` and `document_base64`.
3504
3674
  # @param [Hash] opts the optional parameters
3505
- # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3675
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, a `document_url`'s PDF or Word document downloaded, and an OpenDocument file converted, before responding. Default true on sync.api hosts.
3506
3676
  # @return [Template]
3507
3677
  def update_template_document(template_id, body, opts = {})
3508
3678
  data, _status_code, _headers = update_template_document_with_http_info(template_id, body, opts)
3509
3679
  data
3510
3680
  end
3511
3681
 
3512
- # Replace a template's PDF
3513
- # Replaces a PDF template's PDF with one you uploaded with the presigned upload (GET /uploads/presign) (`cache_id`), a link to download it from (`document_url`), or the file in base64 (`document_base64`). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields. To send the PDF as `multipart/form-data` instead, use PUT /templates/{template_id}/document/upload.
3682
+ # Replace a template's document
3683
+ # Replaces a PDF template's PDF, or a Word template's Word document (from a .docx or an .odt), with one you uploaded with the presigned upload (GET /uploads/presign) (`cache_id`), a link to download it from (`document_url`), or the file in base64 (`document_base64`). A PDF template's fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields, and a Word template gets a field for each new tag. To send the file as `multipart/form-data` instead, use PUT /templates/{template_id}/document/upload.
3514
3684
  # @param template_id [String] The template's ID.
3515
- # @param body [UpdateTemplateDocumentRequest] The new PDF, as one of `cache_id`, `document_url` and `document_base64`.
3685
+ # @param body [UpdateTemplateDocumentRequest] The new PDF, or a Word template's new Word document, as one of `cache_id`, `document_url` and `document_base64`.
3516
3686
  # @param [Hash] opts the optional parameters
3517
- # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3687
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, a `document_url`'s PDF or Word document downloaded, and an OpenDocument file converted, before responding. Default true on sync.api hosts.
3518
3688
  # @return [Array<(Template, Integer, Hash)>] Template data, response status code and response headers
3519
3689
  def update_template_document_with_http_info(template_id, body, opts = {})
3520
3690
  if @api_client.config.debugging
@@ -3722,11 +3892,11 @@ end
3722
3892
  return data, status_code, headers
3723
3893
  end
3724
3894
 
3725
- # Create a PDF template from an uploaded PDF
3726
- # Creates a PDF template from a PDF sent with the request (`multipart/form-data`). For large files, upload the PDF with the presigned upload (GET /uploads/presign) and create the template with POST /templates.
3727
- # @param document [File] The PDF.
3895
+ # Create a template from an uploaded PDF or Word document
3896
+ # Creates a PDF template from a PDF, or a Word template from a Word document (.docx) or an OpenDocument text file (.odt), sent with the request (`multipart/form-data`). A Word template needs its `output_format`. For large files, upload the file with the presigned upload (GET /uploads/presign) and create the template with POST /templates.
3897
+ # @param document [File] A PDF (for a PDF template) or a Word document (.docx or .odt, for a Word template). DocSpring converts an OpenDocument text file (.odt) to a Word document after responding: the template's `document.state` is `converting` until then (sync.api hosts wait for it).
3728
3898
  # @param [Hash] opts the optional parameters
3729
- # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3899
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, a `document_url`'s PDF or Word document downloaded, and an OpenDocument file converted, before responding. Default true on sync.api hosts.
3730
3900
  # @option opts [String] :name The template's name.
3731
3901
  # @option opts [String] :description The template's description.
3732
3902
  # @option opts [String] :parent_folder_id The folder to put the template in. Left out, it's created at the root.
@@ -3735,17 +3905,18 @@ end
3735
3905
  # @option opts [FieldSetupSource] :field_source With `detect_fields`, where the fields come from. `auto` (the default) imports the form fields of a fillable PDF and detects the fields of a PDF without them; `pdf_detection` detects the fields from the page layout, even on a fillable PDF; `pdf_form_fields` only imports the PDF's form fields.
3736
3906
  # @option opts [FieldSetupNaming] :field_naming With `detect_fields`, how the fields are named. `ai` (the default) names them and sets their types and settings with AI; `preserve` keeps the names of the PDF's form fields, and AI only names the fields it detected. `preserve` needs `field_source` `auto` or `pdf_form_fields`.
3737
3907
  # @option opts [FieldSetupLogic] :field_logic With `detect_fields`, whether AI reads the whole form once the fields are named and sets up conditional logic and required fields (`ai`) or not (`none`). Default: your account's template settings.
3908
+ # @option opts [OutputFormat] :output_format What each submission of a Word template makes unless its request sets `output_formats`: `docx` (a Word document), `odt` (an OpenDocument file, converted from the Word document) or `pdf`. Required when `document` is a Word document.
3738
3909
  # @return [Template]
3739
3910
  def upload_template(document, opts = {})
3740
3911
  data, _status_code, _headers = upload_template_with_http_info(document, opts)
3741
3912
  data
3742
3913
  end
3743
3914
 
3744
- # Create a PDF template from an uploaded PDF
3745
- # Creates a PDF template from a PDF sent with the request (`multipart/form-data`). For large files, upload the PDF with the presigned upload (GET /uploads/presign) and create the template with POST /templates.
3746
- # @param document [File] The PDF.
3915
+ # Create a template from an uploaded PDF or Word document
3916
+ # Creates a PDF template from a PDF, or a Word template from a Word document (.docx) or an OpenDocument text file (.odt), sent with the request (`multipart/form-data`). A Word template needs its `output_format`. For large files, upload the file with the presigned upload (GET /uploads/presign) and create the template with POST /templates.
3917
+ # @param document [File] A PDF (for a PDF template) or a Word document (.docx or .odt, for a Word template). DocSpring converts an OpenDocument text file (.odt) to a Word document after responding: the template's `document.state` is `converting` until then (sync.api hosts wait for it).
3747
3918
  # @param [Hash] opts the optional parameters
3748
- # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3919
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, a `document_url`'s PDF or Word document downloaded, and an OpenDocument file converted, before responding. Default true on sync.api hosts.
3749
3920
  # @option opts [String] :name The template's name.
3750
3921
  # @option opts [String] :description The template's description.
3751
3922
  # @option opts [String] :parent_folder_id The folder to put the template in. Left out, it's created at the root.
@@ -3754,6 +3925,7 @@ end
3754
3925
  # @option opts [FieldSetupSource] :field_source With `detect_fields`, where the fields come from. `auto` (the default) imports the form fields of a fillable PDF and detects the fields of a PDF without them; `pdf_detection` detects the fields from the page layout, even on a fillable PDF; `pdf_form_fields` only imports the PDF's form fields.
3755
3926
  # @option opts [FieldSetupNaming] :field_naming With `detect_fields`, how the fields are named. `ai` (the default) names them and sets their types and settings with AI; `preserve` keeps the names of the PDF's form fields, and AI only names the fields it detected. `preserve` needs `field_source` `auto` or `pdf_form_fields`.
3756
3927
  # @option opts [FieldSetupLogic] :field_logic With `detect_fields`, whether AI reads the whole form once the fields are named and sets up conditional logic and required fields (`ai`) or not (`none`). Default: your account's template settings.
3928
+ # @option opts [OutputFormat] :output_format What each submission of a Word template makes unless its request sets `output_formats`: `docx` (a Word document), `odt` (an OpenDocument file, converted from the Word document) or `pdf`. Required when `document` is a Word document.
3757
3929
  # @return [Array<(Template, Integer, Hash)>] Template data, response status code and response headers
3758
3930
  def upload_template_with_http_info(document, opts = {})
3759
3931
  if @api_client.config.debugging
@@ -3791,6 +3963,7 @@ end
3791
3963
  form_params['field_source'] = opts[:'field_source'] if !opts[:'field_source'].nil?
3792
3964
  form_params['field_naming'] = opts[:'field_naming'] if !opts[:'field_naming'].nil?
3793
3965
  form_params['field_logic'] = opts[:'field_logic'] if !opts[:'field_logic'].nil?
3966
+ form_params['output_format'] = opts[:'output_format'] if !opts[:'output_format'].nil?
3794
3967
 
3795
3968
  # http body (model)
3796
3969
  post_body = opts[:debug_body]
@@ -3818,26 +3991,26 @@ end
3818
3991
  return data, status_code, headers
3819
3992
  end
3820
3993
 
3821
- # Replace a template's PDF with an uploaded PDF
3822
- # Replaces a PDF template's PDF with one sent with the request (`multipart/form-data`). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields.
3994
+ # Replace a template's document with an uploaded file
3995
+ # Replaces a PDF template's PDF, or a Word template's Word document, with one sent with the request (`multipart/form-data`). A PDF template's fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields, and a Word template gets a field for each new tag.
3823
3996
  # @param template_id [String] The template's ID.
3824
- # @param document [File] The new PDF.
3997
+ # @param document [File] The new PDF, or the new Word document (.docx or .odt) of a Word template.
3825
3998
  # @param [Hash] opts the optional parameters
3826
- # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3827
- # @option opts [Boolean] :reimport_fields Replace all of the template's fields with the fillable fields in the new PDF, once DocSpring has processed it (`document.field_reimport_state`). As on a first upload, the default typeface, font size, bold and color are taken from the PDF's fields; the template's other settings are kept. If the PDF has no fillable fields, the template keeps its fields. A locked template can't re-import its fields.
3999
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, a `document_url`'s PDF or Word document downloaded, and an OpenDocument file converted, before responding. Default true on sync.api hosts.
4000
+ # @option opts [Boolean] :reimport_fields Replace all of the template's fields with the fillable fields in the new PDF, once DocSpring has processed it (`document.field_reimport_state`). As on a first upload, the default typeface, font size, bold and color are taken from the PDF's fields; the template's other settings are kept. If the PDF has no fillable fields, the template keeps its fields. A locked template can't re-import its fields. Only for PDF templates: a Word template adds a field for each new tag.
3828
4001
  # @return [Template]
3829
4002
  def upload_template_document(template_id, document, opts = {})
3830
4003
  data, _status_code, _headers = upload_template_document_with_http_info(template_id, document, opts)
3831
4004
  data
3832
4005
  end
3833
4006
 
3834
- # Replace a template's PDF with an uploaded PDF
3835
- # Replaces a PDF template's PDF with one sent with the request (`multipart/form-data`). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields.
4007
+ # Replace a template's document with an uploaded file
4008
+ # Replaces a PDF template's PDF, or a Word template's Word document, with one sent with the request (`multipart/form-data`). A PDF template's fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields, and a Word template gets a field for each new tag.
3836
4009
  # @param template_id [String] The template's ID.
3837
- # @param document [File] The new PDF.
4010
+ # @param document [File] The new PDF, or the new Word document (.docx or .odt) of a Word template.
3838
4011
  # @param [Hash] opts the optional parameters
3839
- # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3840
- # @option opts [Boolean] :reimport_fields Replace all of the template's fields with the fillable fields in the new PDF, once DocSpring has processed it (`document.field_reimport_state`). As on a first upload, the default typeface, font size, bold and color are taken from the PDF's fields; the template's other settings are kept. If the PDF has no fillable fields, the template keeps its fields. A locked template can't re-import its fields.
4012
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, a `document_url`'s PDF or Word document downloaded, and an OpenDocument file converted, before responding. Default true on sync.api hosts.
4013
+ # @option opts [Boolean] :reimport_fields Replace all of the template's fields with the fillable fields in the new PDF, once DocSpring has processed it (`document.field_reimport_state`). As on a first upload, the default typeface, font size, bold and color are taken from the PDF's fields; the template's other settings are kept. If the PDF has no fillable fields, the template keeps its fields. A locked template can't re-import its fields. Only for PDF templates: a Word template adds a field for each new tag.
3841
4014
  # @return [Array<(Template, Integer, Hash)>] Template data, response status code and response headers
3842
4015
  def upload_template_document_with_http_info(template_id, document, opts = {})
3843
4016
  if @api_client.config.debugging