docspring 4.0.0 → 4.2.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 (167) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +99 -0
  3. data/.travis.yml +1 -1
  4. data/AGENTS.md +3 -2
  5. data/CHANGELOG.md +64 -0
  6. data/Gemfile.lock +9 -9
  7. data/README.md +14 -1
  8. data/docs/AddTemplateFieldsRequest.md +18 -0
  9. data/docs/Client.md +917 -80
  10. data/docs/CombinedPdf.md +1 -1
  11. data/docs/CreateCombinedPdfRequest.md +1 -1
  12. data/docs/CreateSubmissionBatchRequest.md +2 -0
  13. data/docs/CreateSubmissionRequest.md +4 -2
  14. data/docs/CreateTemplatePreviewRequest.md +18 -0
  15. data/docs/CreateTemplateRequest.md +13 -3
  16. data/docs/ErrorDetail.md +1 -1
  17. data/docs/ErrorInfo.md +4 -4
  18. data/docs/Field.md +198 -0
  19. data/docs/FieldDependency.md +22 -0
  20. data/docs/FieldDependencyInput.md +22 -0
  21. data/docs/FieldGroup.md +32 -0
  22. data/docs/FieldGroupInput.md +30 -0
  23. data/docs/FieldGroupType.md +15 -0
  24. data/docs/FieldInput.md +196 -0
  25. data/docs/FieldType.md +15 -0
  26. data/docs/GenerateFilesFormat.md +15 -0
  27. data/docs/GenerateSubmissionFilesRequest.md +18 -0
  28. data/docs/OutputFormat.md +15 -0
  29. data/docs/PageImage.md +34 -0
  30. data/docs/PageImages.md +24 -0
  31. data/docs/PredefinedField.md +30 -0
  32. data/docs/PredefinedFieldInput.md +30 -0
  33. data/docs/RemoveTemplateFieldsRequest.md +18 -0
  34. data/docs/ReorderTemplateFieldsRequest.md +18 -0
  35. data/docs/Submission.md +16 -14
  36. data/docs/SubmissionFiles.md +3 -1
  37. data/docs/SubmissionInput.md +4 -2
  38. data/docs/SubmissionList.md +1 -1
  39. data/docs/SubmissionSummary.md +54 -0
  40. data/docs/SubmissionValidation.md +24 -0
  41. data/docs/Template.md +18 -10
  42. data/docs/TemplateActor.md +1 -1
  43. data/docs/TemplateDiff.md +30 -0
  44. data/docs/TemplateDiffSummary.md +28 -0
  45. data/docs/TemplateDocument.md +6 -6
  46. data/docs/TemplateDocumentSummary.md +24 -0
  47. data/docs/TemplateFieldChange.md +24 -0
  48. data/docs/TemplateFieldChanges.md +24 -0
  49. data/docs/TemplateFieldDependency.md +1 -1
  50. data/docs/TemplateFieldDependencyInput.md +1 -1
  51. data/docs/TemplateFieldMove.md +22 -0
  52. data/docs/TemplateFields.md +22 -0
  53. data/docs/TemplatePageImages.md +24 -0
  54. data/docs/TemplatePreview.md +32 -0
  55. data/docs/TemplatePreviewState.md +15 -0
  56. data/docs/TemplateSummary.md +2 -48
  57. data/docs/UpdateTemplateDocumentRequest.md +6 -2
  58. data/docs/UpdateTemplateFieldsRequest.md +18 -0
  59. data/docs/UpdateTemplateRequest.md +10 -2
  60. data/docs/ValidateSubmissionRequest.md +38 -0
  61. data/lib/docspring/api/client.rb +869 -51
  62. data/lib/docspring/api_client.rb +4 -2
  63. data/lib/docspring/date_time_values.rb +33 -0
  64. data/lib/docspring/models/add_template_fields_request.rb +187 -0
  65. data/lib/docspring/models/combined_pdf.rb +1 -1
  66. data/lib/docspring/models/create_combined_pdf_request.rb +1 -1
  67. data/lib/docspring/models/create_submission_batch_request.rb +23 -1
  68. data/lib/docspring/models/create_submission_request.rb +25 -3
  69. data/lib/docspring/models/create_template_preview_request.rb +187 -0
  70. data/lib/docspring/models/create_template_request.rb +59 -4
  71. data/lib/docspring/models/error_code.rb +3 -1
  72. data/lib/docspring/models/error_detail.rb +1 -1
  73. data/lib/docspring/models/error_info.rb +4 -4
  74. data/lib/docspring/models/field.rb +2217 -0
  75. data/lib/docspring/models/field_dependency.rb +246 -0
  76. data/lib/docspring/models/field_dependency_input.rb +246 -0
  77. data/lib/docspring/models/field_group.rb +368 -0
  78. data/lib/docspring/models/field_group_input.rb +247 -0
  79. data/lib/docspring/models/field_group_type.rb +41 -0
  80. data/lib/docspring/models/field_input.rb +1109 -0
  81. data/lib/docspring/models/field_type.rb +54 -0
  82. data/lib/docspring/models/generate_files_format.rb +40 -0
  83. data/lib/docspring/models/generate_submission_files_request.rb +187 -0
  84. data/lib/docspring/models/output_format.rb +41 -0
  85. data/lib/docspring/models/page_image.rb +359 -0
  86. data/lib/docspring/models/page_images.rb +248 -0
  87. data/lib/docspring/models/predefined_field.rb +287 -0
  88. data/lib/docspring/models/predefined_field_input.rb +287 -0
  89. data/lib/docspring/models/remove_template_fields_request.rb +187 -0
  90. data/lib/docspring/models/reorder_template_fields_request.rb +187 -0
  91. data/lib/docspring/models/submission.rb +146 -117
  92. data/lib/docspring/models/submission_files.rb +13 -4
  93. data/lib/docspring/models/submission_input.rb +25 -3
  94. data/lib/docspring/models/submission_list.rb +1 -1
  95. data/lib/docspring/models/submission_summary.rb +601 -0
  96. data/lib/docspring/models/submission_validation.rb +234 -0
  97. data/lib/docspring/models/template.rb +169 -83
  98. data/lib/docspring/models/template_actor.rb +1 -1
  99. data/lib/docspring/models/template_diff.rb +321 -0
  100. data/lib/docspring/models/template_diff_summary.rb +320 -0
  101. data/lib/docspring/models/template_document.rb +44 -44
  102. data/lib/docspring/models/template_document_state.rb +3 -1
  103. data/lib/docspring/models/template_document_summary.rb +260 -0
  104. data/lib/docspring/models/template_field_change.rb +266 -0
  105. data/lib/docspring/models/template_field_changes.rb +274 -0
  106. data/lib/docspring/models/template_field_dependency.rb +1 -1
  107. data/lib/docspring/models/template_field_dependency_input.rb +1 -1
  108. data/lib/docspring/models/template_field_move.rb +239 -0
  109. data/lib/docspring/models/template_fields.rb +227 -0
  110. data/lib/docspring/models/template_page_images.rb +254 -0
  111. data/lib/docspring/models/template_preview.rb +356 -0
  112. data/lib/docspring/models/template_preview_state.rb +42 -0
  113. data/lib/docspring/models/template_summary.rb +5 -572
  114. data/lib/docspring/models/update_template_document_request.rb +23 -20
  115. data/lib/docspring/models/update_template_fields_request.rb +187 -0
  116. data/lib/docspring/models/update_template_request.rb +53 -6
  117. data/lib/docspring/models/validate_submission_request.rb +288 -0
  118. data/lib/docspring/request_schemas.json +3465 -1588
  119. data/lib/docspring/version.rb +1 -1
  120. data/lib/docspring/webhook_signature.rb +45 -0
  121. data/lib/docspring.rb +34 -0
  122. data/spec/api/client_spec.rb +167 -13
  123. data/spec/models/add_template_fields_request_spec.rb +36 -0
  124. data/spec/models/create_submission_batch_request_spec.rb +6 -0
  125. data/spec/models/create_submission_request_spec.rb +6 -0
  126. data/spec/models/create_template_preview_request_spec.rb +36 -0
  127. data/spec/models/create_template_request_spec.rb +30 -0
  128. data/spec/models/field_dependency_input_spec.rb +48 -0
  129. data/spec/models/field_dependency_spec.rb +48 -0
  130. data/spec/models/field_group_input_spec.rb +72 -0
  131. data/spec/models/field_group_spec.rb +78 -0
  132. data/spec/models/field_group_type_spec.rb +30 -0
  133. data/spec/models/field_input_spec.rb +570 -0
  134. data/spec/models/field_spec.rb +576 -0
  135. data/spec/models/field_type_spec.rb +30 -0
  136. data/spec/models/generate_files_format_spec.rb +30 -0
  137. data/spec/models/generate_submission_files_request_spec.rb +36 -0
  138. data/spec/models/output_format_spec.rb +30 -0
  139. data/spec/models/page_image_spec.rb +84 -0
  140. data/spec/models/page_images_spec.rb +54 -0
  141. data/spec/models/predefined_field_input_spec.rb +72 -0
  142. data/spec/models/predefined_field_spec.rb +72 -0
  143. data/spec/models/remove_template_fields_request_spec.rb +36 -0
  144. data/spec/models/reorder_template_fields_request_spec.rb +36 -0
  145. data/spec/models/submission_files_spec.rb +6 -0
  146. data/spec/models/submission_input_spec.rb +6 -0
  147. data/spec/models/submission_spec.rb +17 -11
  148. data/spec/models/submission_summary_spec.rb +144 -0
  149. data/spec/models/submission_validation_spec.rb +54 -0
  150. data/spec/models/template_diff_spec.rb +72 -0
  151. data/spec/models/template_diff_summary_spec.rb +66 -0
  152. data/spec/models/template_document_spec.rb +5 -5
  153. data/spec/models/template_document_summary_spec.rb +54 -0
  154. data/spec/models/template_field_change_spec.rb +54 -0
  155. data/spec/models/template_field_changes_spec.rb +54 -0
  156. data/spec/models/template_field_move_spec.rb +48 -0
  157. data/spec/models/template_fields_spec.rb +48 -0
  158. data/spec/models/template_page_images_spec.rb +54 -0
  159. data/spec/models/template_preview_spec.rb +78 -0
  160. data/spec/models/template_preview_state_spec.rb +30 -0
  161. data/spec/models/template_spec.rb +34 -10
  162. data/spec/models/template_summary_spec.rb +0 -138
  163. data/spec/models/update_template_document_request_spec.rb +12 -0
  164. data/spec/models/update_template_fields_request_spec.rb +36 -0
  165. data/spec/models/update_template_request_spec.rb +24 -0
  166. data/spec/models/validate_submission_request_spec.rb +96 -0
  167. metadata +135 -1
@@ -66,6 +66,80 @@ module DocSpring
66
66
  end
67
67
  end
68
68
 
69
+ # Add fields to a template
70
+ # Adds fields to a template's draft and returns all of its fields. Publish a version for submissions of published versions to have them.
71
+ # @param template_id [String] The template's ID.
72
+ # @param body [AddTemplateFieldsRequest] The fields to add to the template's draft.
73
+ # @param [Hash] opts the optional parameters
74
+ # @return [TemplateFields]
75
+ def add_template_fields(template_id, body, opts = {})
76
+ data, _status_code, _headers = add_template_fields_with_http_info(template_id, body, opts)
77
+ data
78
+ end
79
+
80
+ # Add fields to a template
81
+ # Adds fields to a template's draft and returns all of its fields. Publish a version for submissions of published versions to have them.
82
+ # @param template_id [String] The template's ID.
83
+ # @param body [AddTemplateFieldsRequest] The fields to add to the template's draft.
84
+ # @param [Hash] opts the optional parameters
85
+ # @return [Array<(TemplateFields, Integer, Hash)>] TemplateFields data, response status code and response headers
86
+ def add_template_fields_with_http_info(template_id, body, opts = {})
87
+ if @api_client.config.debugging
88
+ @api_client.config.logger.debug 'Calling API: Client.add_template_fields ...'
89
+ end
90
+ # verify the required parameter 'template_id' is set
91
+ if @api_client.config.client_side_validation && template_id.nil?
92
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.add_template_fields"
93
+ end
94
+ # verify the required parameter 'body' is set
95
+ if @api_client.config.client_side_validation && body.nil?
96
+ fail ArgumentError, "Missing the required parameter 'body' when calling Client.add_template_fields"
97
+ end
98
+ # resource path
99
+ local_var_path = '/templates/{template_id}/fields'.sub('{template_id}', CGI.escape(template_id.to_s))
100
+
101
+ # query parameters
102
+ query_params = opts[:query_params] || {}
103
+
104
+ # header parameters
105
+ header_params = opts[:header_params] || {}
106
+ # HTTP header 'Accept' (if needed)
107
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
108
+ # HTTP header 'Content-Type'
109
+ content_type = @api_client.select_header_content_type(['application/json'])
110
+ if !content_type.nil?
111
+ header_params['Content-Type'] = content_type
112
+ end
113
+
114
+ # form parameters
115
+ form_params = opts[:form_params] || {}
116
+
117
+ # http body (model)
118
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
119
+
120
+ # return_type
121
+ return_type = opts[:debug_return_type] || 'TemplateFields'
122
+
123
+ # auth_names
124
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
125
+
126
+ new_options = opts.merge(
127
+ :operation => :"Client.add_template_fields",
128
+ :header_params => header_params,
129
+ :query_params => query_params,
130
+ :form_params => form_params,
131
+ :body => post_body,
132
+ :auth_names => auth_names,
133
+ :return_type => return_type
134
+ )
135
+
136
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
137
+ if @api_client.config.debugging
138
+ @api_client.config.logger.debug "API called: Client#add_template_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
139
+ end
140
+ return data, status_code, headers
141
+ end
142
+
69
143
  # Copy a template
70
144
  # Copies a template (its draft, or a published version) into a new template.
71
145
  # @param template_id [String] The template's ID.
@@ -141,6 +215,7 @@ end
141
215
  # @param body [CreateCombinedPdfRequest] The PDFs to merge, and the combined PDF's settings.
142
216
  # @param [Hash] opts the optional parameters
143
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.
144
219
  # @return [CombinedPdf]
145
220
  def create_combined_pdf(body, opts = {})
146
221
  data, _status_code, _headers = create_combined_pdf_with_http_info(body, opts)
@@ -152,6 +227,7 @@ end
152
227
  # @param body [CreateCombinedPdfRequest] The PDFs to merge, and the combined PDF's settings.
153
228
  # @param [Hash] opts the optional parameters
154
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.
155
231
  # @return [Array<(CombinedPdf, Integer, Hash)>] CombinedPdf data, response status code and response headers
156
232
  def create_combined_pdf_with_http_info(body, opts = {})
157
233
  if @api_client.config.debugging
@@ -177,6 +253,7 @@ end
177
253
  if !content_type.nil?
178
254
  header_params['Content-Type'] = content_type
179
255
  end
256
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
180
257
 
181
258
  # form parameters
182
259
  form_params = opts[:form_params] || {}
@@ -344,7 +421,7 @@ end
344
421
  end
345
422
 
346
423
  # Record a signature request event
347
- # 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.
348
425
  # @param signature_request_id [String] The signature request's ID.
349
426
  # @param body [CreateSignatureRequestEventRequest] The event to record.
350
427
  # @param [Hash] opts the optional parameters
@@ -355,7 +432,7 @@ end
355
432
  end
356
433
 
357
434
  # Record a signature request event
358
- # 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.
359
436
  # @param signature_request_id [String] The signature request's ID.
360
437
  # @param body [CreateSignatureRequestEventRequest] The event to record.
361
438
  # @param [Hash] opts the optional parameters
@@ -493,7 +570,8 @@ end
493
570
  # @param body [CreateSubmissionRequest] The submission's data and settings.
494
571
  # @param [Hash] opts the optional parameters
495
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).
496
- # @option opts [Boolean] :wait Wait until the PDF has been generated before responding. Default true on sync.api hosts.
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.
497
575
  # @return [Submission]
498
576
  def create_submission(template_id, body, opts = {})
499
577
  data, _status_code, _headers = create_submission_with_http_info(template_id, body, opts)
@@ -506,7 +584,8 @@ end
506
584
  # @param body [CreateSubmissionRequest] The submission's data and settings.
507
585
  # @param [Hash] opts the optional parameters
508
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).
509
- # @option opts [Boolean] :wait Wait until the PDF has been generated before responding. Default true on sync.api hosts.
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.
510
589
  # @return [Array<(Submission, Integer, Hash)>] Submission data, response status code and response headers
511
590
  def create_submission_with_http_info(template_id, body, opts = {})
512
591
  if @api_client.config.debugging
@@ -537,6 +616,7 @@ end
537
616
  if !content_type.nil?
538
617
  header_params['Content-Type'] = content_type
539
618
  end
619
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
540
620
 
541
621
  # form parameters
542
622
  form_params = opts[:form_params] || {}
@@ -572,6 +652,7 @@ end
572
652
  # @param body [CreateSubmissionBatchRequest] The submissions to create, and the settings they share.
573
653
  # @param [Hash] opts the optional parameters
574
654
  # @option opts [Boolean] :wait Wait until every PDF 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.
575
656
  # @return [SubmissionBatch]
576
657
  def create_submission_batch(body, opts = {})
577
658
  data, _status_code, _headers = create_submission_batch_with_http_info(body, opts)
@@ -583,6 +664,7 @@ end
583
664
  # @param body [CreateSubmissionBatchRequest] The submissions to create, and the settings they share.
584
665
  # @param [Hash] opts the optional parameters
585
666
  # @option opts [Boolean] :wait Wait until every PDF 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.
586
668
  # @return [Array<(SubmissionBatch, Integer, Hash)>] SubmissionBatch data, response status code and response headers
587
669
  def create_submission_batch_with_http_info(body, opts = {})
588
670
  if @api_client.config.debugging
@@ -608,6 +690,7 @@ end
608
690
  if !content_type.nil?
609
691
  header_params['Content-Type'] = content_type
610
692
  end
693
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
611
694
 
612
695
  # form parameters
613
696
  form_params = opts[:form_params] || {}
@@ -642,7 +725,7 @@ end
642
725
  # 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`.
643
726
  # @param body [CreateTemplateRequest] The template to create.
644
727
  # @param [Hash] opts the optional parameters
645
- # @option opts [Boolean] :wait Wait until the PDF has been processed before responding. Default true on sync.api hosts.
728
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
646
729
  # @return [Template]
647
730
  def create_template(body, opts = {})
648
731
  data, _status_code, _headers = create_template_with_http_info(body, opts)
@@ -653,7 +736,7 @@ end
653
736
  # 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`.
654
737
  # @param body [CreateTemplateRequest] The template to create.
655
738
  # @param [Hash] opts the optional parameters
656
- # @option opts [Boolean] :wait Wait until the PDF has been processed before responding. Default true on sync.api hosts.
739
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
657
740
  # @return [Array<(Template, Integer, Hash)>] Template data, response status code and response headers
658
741
  def create_template_with_http_info(body, opts = {})
659
742
  if @api_client.config.debugging
@@ -709,6 +792,83 @@ end
709
792
  return data, status_code, headers
710
793
  end
711
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 or PDF template prints with your data before you publish a version or send live data. 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 or PDF template prints with your data before you publish a version or send live data. 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
+
712
872
  # Create a webhook
713
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.
714
874
  # @param body [CreateWebhookRequest] The webhook to create.
@@ -1158,6 +1318,83 @@ end
1158
1318
  return data, status_code, headers
1159
1319
  end
1160
1320
 
1321
+ # Generate more files
1322
+ # 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.
1323
+ # @param submission_id [String] The submission's ID.
1324
+ # @param body [GenerateSubmissionFilesRequest] The formats to make.
1325
+ # @param [Hash] opts the optional parameters
1326
+ # @option opts [Boolean] :wait Wait until the files have been generated before responding. Default true on sync.api hosts.
1327
+ # @return [Submission]
1328
+ def generate_submission_files(submission_id, body, opts = {})
1329
+ data, _status_code, _headers = generate_submission_files_with_http_info(submission_id, body, opts)
1330
+ data
1331
+ end
1332
+
1333
+ # Generate more files
1334
+ # 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.
1335
+ # @param submission_id [String] The submission's ID.
1336
+ # @param body [GenerateSubmissionFilesRequest] The formats to make.
1337
+ # @param [Hash] opts the optional parameters
1338
+ # @option opts [Boolean] :wait Wait until the files have been generated before responding. Default true on sync.api hosts.
1339
+ # @return [Array<(Submission, Integer, Hash)>] Submission data, response status code and response headers
1340
+ def generate_submission_files_with_http_info(submission_id, body, opts = {})
1341
+ if @api_client.config.debugging
1342
+ @api_client.config.logger.debug 'Calling API: Client.generate_submission_files ...'
1343
+ end
1344
+ # verify the required parameter 'submission_id' is set
1345
+ if @api_client.config.client_side_validation && submission_id.nil?
1346
+ fail ArgumentError, "Missing the required parameter 'submission_id' when calling Client.generate_submission_files"
1347
+ end
1348
+ # verify the required parameter 'body' is set
1349
+ if @api_client.config.client_side_validation && body.nil?
1350
+ fail ArgumentError, "Missing the required parameter 'body' when calling Client.generate_submission_files"
1351
+ end
1352
+ # resource path
1353
+ local_var_path = '/submissions/{submission_id}/generate_files'.sub('{submission_id}', CGI.escape(submission_id.to_s))
1354
+
1355
+ # query parameters
1356
+ query_params = opts[:query_params] || {}
1357
+ query_params[:'wait'] = opts[:'wait'] if !opts[:'wait'].nil?
1358
+
1359
+ # header parameters
1360
+ header_params = opts[:header_params] || {}
1361
+ # HTTP header 'Accept' (if needed)
1362
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1363
+ # HTTP header 'Content-Type'
1364
+ content_type = @api_client.select_header_content_type(['application/json'])
1365
+ if !content_type.nil?
1366
+ header_params['Content-Type'] = content_type
1367
+ end
1368
+
1369
+ # form parameters
1370
+ form_params = opts[:form_params] || {}
1371
+
1372
+ # http body (model)
1373
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
1374
+
1375
+ # return_type
1376
+ return_type = opts[:debug_return_type] || 'Submission'
1377
+
1378
+ # auth_names
1379
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
1380
+
1381
+ new_options = opts.merge(
1382
+ :operation => :"Client.generate_submission_files",
1383
+ :header_params => header_params,
1384
+ :query_params => query_params,
1385
+ :form_params => form_params,
1386
+ :body => post_body,
1387
+ :auth_names => auth_names,
1388
+ :return_type => return_type
1389
+ )
1390
+
1391
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1392
+ if @api_client.config.debugging
1393
+ @api_client.config.logger.debug "API called: Client#generate_submission_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1394
+ end
1395
+ return data, status_code, headers
1396
+ end
1397
+
1161
1398
  # Generate a preview PDF
1162
1399
  # Generates a preview of a submission's PDF in the background, such as for a submission still waiting for its signature requests. It's in `files.preview` once `preview_generated_at` changes.
1163
1400
  # @param submission_id [String] The submission's ID.
@@ -1725,12 +1962,79 @@ end
1725
1962
  return data, status_code, headers
1726
1963
  end
1727
1964
 
1965
+ # Compare a version of a template with the one before it
1966
+ # Returns what changed in the template's draft since its latest published version (or in a published version since the one before it): fields added, removed, changed and moved, the settings that changed, and whether the document was replaced. Check it before you publish a version.
1967
+ # @param template_id [String] The template's ID.
1968
+ # @param [Hash] opts the optional parameters
1969
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1970
+ # @return [TemplateDiff]
1971
+ def get_template_diff(template_id, opts = {})
1972
+ data, _status_code, _headers = get_template_diff_with_http_info(template_id, opts)
1973
+ data
1974
+ end
1975
+
1976
+ # Compare a version of a template with the one before it
1977
+ # Returns what changed in the template's draft since its latest published version (or in a published version since the one before it): fields added, removed, changed and moved, the settings that changed, and whether the document was replaced. Check it before you publish a version.
1978
+ # @param template_id [String] The template's ID.
1979
+ # @param [Hash] opts the optional parameters
1980
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1981
+ # @return [Array<(TemplateDiff, Integer, Hash)>] TemplateDiff data, response status code and response headers
1982
+ def get_template_diff_with_http_info(template_id, opts = {})
1983
+ if @api_client.config.debugging
1984
+ @api_client.config.logger.debug 'Calling API: Client.get_template_diff ...'
1985
+ end
1986
+ # verify the required parameter 'template_id' is set
1987
+ if @api_client.config.client_side_validation && template_id.nil?
1988
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.get_template_diff"
1989
+ end
1990
+ # resource path
1991
+ local_var_path = '/templates/{template_id}/diff'.sub('{template_id}', CGI.escape(template_id.to_s))
1992
+
1993
+ # query parameters
1994
+ query_params = opts[:query_params] || {}
1995
+ query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
1996
+
1997
+ # header parameters
1998
+ header_params = opts[:header_params] || {}
1999
+ # HTTP header 'Accept' (if needed)
2000
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
2001
+
2002
+ # form parameters
2003
+ form_params = opts[:form_params] || {}
2004
+
2005
+ # http body (model)
2006
+ post_body = opts[:debug_body]
2007
+
2008
+ # return_type
2009
+ return_type = opts[:debug_return_type] || 'TemplateDiff'
2010
+
2011
+ # auth_names
2012
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
2013
+
2014
+ new_options = opts.merge(
2015
+ :operation => :"Client.get_template_diff",
2016
+ :header_params => header_params,
2017
+ :query_params => query_params,
2018
+ :form_params => form_params,
2019
+ :body => post_body,
2020
+ :auth_names => auth_names,
2021
+ :return_type => return_type
2022
+ )
2023
+
2024
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2025
+ if @api_client.config.debugging
2026
+ @api_client.config.logger.debug "API called: Client#get_template_diff\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2027
+ end
2028
+ return data, status_code, headers
2029
+ end
2030
+
1728
2031
  # Generate typed code for a template's submission data
1729
- # 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 or Go, 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.
1730
2033
  # @param template_id [String] The template's ID.
1731
2034
  # @param lang [ModelCodeLanguage] The language to generate the code in.
1732
2035
  # @param [Hash] opts the optional parameters
1733
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 and PHP no types-only code, so theirs is the same either way.
1734
2038
  # @return [TemplateModelCode]
1735
2039
  def get_template_model_code(template_id, lang, opts = {})
1736
2040
  data, _status_code, _headers = get_template_model_code_with_http_info(template_id, lang, opts)
@@ -1738,11 +2042,12 @@ end
1738
2042
  end
1739
2043
 
1740
2044
  # Generate typed code for a template's submission data
1741
- # 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 or Go, 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.
1742
2046
  # @param template_id [String] The template's ID.
1743
2047
  # @param lang [ModelCodeLanguage] The language to generate the code in.
1744
2048
  # @param [Hash] opts the optional parameters
1745
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 and PHP no types-only code, so theirs is the same either way.
1746
2051
  # @return [Array<(TemplateModelCode, Integer, Hash)>] TemplateModelCode data, response status code and response headers
1747
2052
  def get_template_model_code_with_http_info(template_id, lang, opts = {})
1748
2053
  if @api_client.config.debugging
@@ -1763,6 +2068,7 @@ end
1763
2068
  query_params = opts[:query_params] || {}
1764
2069
  query_params[:'lang'] = lang
1765
2070
  query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
2071
+ query_params[:'just_types'] = opts[:'just_types'] if !opts[:'just_types'].nil?
1766
2072
 
1767
2073
  # header parameters
1768
2074
  header_params = opts[:header_params] || {}
@@ -1798,33 +2104,33 @@ end
1798
2104
  return data, status_code, headers
1799
2105
  end
1800
2106
 
1801
- # Get the JSON Schema of a template's submission data
1802
- # 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.
2107
+ # Get images of a template's pages
2108
+ # Returns a JPEG image of each page of a PDF template's PDF, with temporary links to download them: the draft's PDF, or a published version's. Use them to see the pages that fields are placed on.
1803
2109
  # @param template_id [String] The template's ID.
1804
2110
  # @param [Hash] opts the optional parameters
1805
- # @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.
1806
- # @return [Hash<String, Object>]
1807
- def get_template_schema(template_id, opts = {})
1808
- data, _status_code, _headers = get_template_schema_with_http_info(template_id, opts)
2111
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
2112
+ # @return [TemplatePageImages]
2113
+ def get_template_page_images(template_id, opts = {})
2114
+ data, _status_code, _headers = get_template_page_images_with_http_info(template_id, opts)
1809
2115
  data
1810
2116
  end
1811
2117
 
1812
- # Get the JSON Schema of a template's submission data
1813
- # 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.
2118
+ # Get images of a template's pages
2119
+ # Returns a JPEG image of each page of a PDF template's PDF, with temporary links to download them: the draft's PDF, or a published version's. Use them to see the pages that fields are placed on.
1814
2120
  # @param template_id [String] The template's ID.
1815
2121
  # @param [Hash] opts the optional parameters
1816
- # @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.
1817
- # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
1818
- def get_template_schema_with_http_info(template_id, opts = {})
2122
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
2123
+ # @return [Array<(TemplatePageImages, Integer, Hash)>] TemplatePageImages data, response status code and response headers
2124
+ def get_template_page_images_with_http_info(template_id, opts = {})
1819
2125
  if @api_client.config.debugging
1820
- @api_client.config.logger.debug 'Calling API: Client.get_template_schema ...'
2126
+ @api_client.config.logger.debug 'Calling API: Client.get_template_page_images ...'
1821
2127
  end
1822
2128
  # verify the required parameter 'template_id' is set
1823
2129
  if @api_client.config.client_side_validation && template_id.nil?
1824
- fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.get_template_schema"
2130
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.get_template_page_images"
1825
2131
  end
1826
2132
  # resource path
1827
- local_var_path = '/templates/{template_id}/schema'.sub('{template_id}', CGI.escape(template_id.to_s))
2133
+ local_var_path = '/templates/{template_id}/page_images'.sub('{template_id}', CGI.escape(template_id.to_s))
1828
2134
 
1829
2135
  # query parameters
1830
2136
  query_params = opts[:query_params] || {}
@@ -1842,13 +2148,13 @@ end
1842
2148
  post_body = opts[:debug_body]
1843
2149
 
1844
2150
  # return_type
1845
- return_type = opts[:debug_return_type] || 'Hash<String, Object>'
2151
+ return_type = opts[:debug_return_type] || 'TemplatePageImages'
1846
2152
 
1847
2153
  # auth_names
1848
2154
  auth_names = opts[:debug_auth_names] || ['api_token_basic']
1849
2155
 
1850
2156
  new_options = opts.merge(
1851
- :operation => :"Client.get_template_schema",
2157
+ :operation => :"Client.get_template_page_images",
1852
2158
  :header_params => header_params,
1853
2159
  :query_params => query_params,
1854
2160
  :form_params => form_params,
@@ -1859,23 +2165,158 @@ end
1859
2165
 
1860
2166
  data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1861
2167
  if @api_client.config.debugging
1862
- @api_client.config.logger.debug "API called: Client#get_template_schema\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2168
+ @api_client.config.logger.debug "API called: Client#get_template_page_images\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1863
2169
  end
1864
2170
  return data, status_code, headers
1865
2171
  end
1866
2172
 
1867
- # Get a webhook
1868
- # Returns a webhook.
1869
- # @param webhook_id [String] The webhook's ID.
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.
1870
2177
  # @param [Hash] opts the optional parameters
1871
- # @return [Webhook]
1872
- def get_webhook(webhook_id, opts = {})
1873
- data, _status_code, _headers = get_webhook_with_http_info(webhook_id, opts)
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)
1874
2181
  data
1875
2182
  end
1876
2183
 
1877
- # Get a webhook
1878
- # Returns a webhook.
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
+
2242
+ # Get the JSON Schema of a template's submission data
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.
2244
+ # @param template_id [String] The template's ID.
2245
+ # @param [Hash] opts the optional parameters
2246
+ # @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.
2247
+ # @return [Hash<String, Object>]
2248
+ def get_template_schema(template_id, opts = {})
2249
+ data, _status_code, _headers = get_template_schema_with_http_info(template_id, opts)
2250
+ data
2251
+ end
2252
+
2253
+ # Get the JSON Schema of a template's submission data
2254
+ # 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.
2255
+ # @param template_id [String] The template's ID.
2256
+ # @param [Hash] opts the optional parameters
2257
+ # @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.
2258
+ # @return [Array<(Hash<String, Object>, Integer, Hash)>] Hash<String, Object> data, response status code and response headers
2259
+ def get_template_schema_with_http_info(template_id, opts = {})
2260
+ if @api_client.config.debugging
2261
+ @api_client.config.logger.debug 'Calling API: Client.get_template_schema ...'
2262
+ end
2263
+ # verify the required parameter 'template_id' is set
2264
+ if @api_client.config.client_side_validation && template_id.nil?
2265
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.get_template_schema"
2266
+ end
2267
+ # resource path
2268
+ local_var_path = '/templates/{template_id}/schema'.sub('{template_id}', CGI.escape(template_id.to_s))
2269
+
2270
+ # query parameters
2271
+ query_params = opts[:query_params] || {}
2272
+ query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
2273
+
2274
+ # header parameters
2275
+ header_params = opts[:header_params] || {}
2276
+ # HTTP header 'Accept' (if needed)
2277
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
2278
+
2279
+ # form parameters
2280
+ form_params = opts[:form_params] || {}
2281
+
2282
+ # http body (model)
2283
+ post_body = opts[:debug_body]
2284
+
2285
+ # return_type
2286
+ return_type = opts[:debug_return_type] || 'Hash<String, Object>'
2287
+
2288
+ # auth_names
2289
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
2290
+
2291
+ new_options = opts.merge(
2292
+ :operation => :"Client.get_template_schema",
2293
+ :header_params => header_params,
2294
+ :query_params => query_params,
2295
+ :form_params => form_params,
2296
+ :body => post_body,
2297
+ :auth_names => auth_names,
2298
+ :return_type => return_type
2299
+ )
2300
+
2301
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2302
+ if @api_client.config.debugging
2303
+ @api_client.config.logger.debug "API called: Client#get_template_schema\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2304
+ end
2305
+ return data, status_code, headers
2306
+ end
2307
+
2308
+ # Get a webhook
2309
+ # Returns a webhook.
2310
+ # @param webhook_id [String] The webhook's ID.
2311
+ # @param [Hash] opts the optional parameters
2312
+ # @return [Webhook]
2313
+ def get_webhook(webhook_id, opts = {})
2314
+ data, _status_code, _headers = get_webhook_with_http_info(webhook_id, opts)
2315
+ data
2316
+ end
2317
+
2318
+ # Get a webhook
2319
+ # Returns a webhook.
1879
2320
  # @param webhook_id [String] The webhook's ID.
1880
2321
  # @param [Hash] opts the optional parameters
1881
2322
  # @return [Array<(Webhook, Integer, Hash)>] Webhook data, response status code and response headers
@@ -2120,7 +2561,7 @@ end
2120
2561
  end
2121
2562
 
2122
2563
  # List submissions
2123
- # 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.
2124
2565
  # @param [Hash] opts the optional parameters
2125
2566
  # @option opts [String] :template_id Only list this template's submissions.
2126
2567
  # @option opts [Boolean] :test Only list test submissions (true) or live submissions (false).
@@ -2129,6 +2570,8 @@ end
2129
2570
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
2130
2571
  # @option opts [Integer] :limit How many items to return (1-100, default 50). (default to 50)
2131
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.
2132
2575
  # @return [SubmissionList]
2133
2576
  def list_submissions(opts = {})
2134
2577
  data, _status_code, _headers = list_submissions_with_http_info(opts)
@@ -2136,7 +2579,7 @@ end
2136
2579
  end
2137
2580
 
2138
2581
  # List submissions
2139
- # 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.
2140
2583
  # @param [Hash] opts the optional parameters
2141
2584
  # @option opts [String] :template_id Only list this template's submissions.
2142
2585
  # @option opts [Boolean] :test Only list test submissions (true) or live submissions (false).
@@ -2145,6 +2588,8 @@ end
2145
2588
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
2146
2589
  # @option opts [Integer] :limit How many items to return (1-100, default 50). (default to 50)
2147
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.
2148
2593
  # @return [Array<(SubmissionList, Integer, Hash)>] SubmissionList data, response status code and response headers
2149
2594
  def list_submissions_with_http_info(opts = {})
2150
2595
  if @api_client.config.debugging
@@ -2162,6 +2607,8 @@ end
2162
2607
  query_params[:'include_data'] = opts[:'include_data'] if !opts[:'include_data'].nil?
2163
2608
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
2164
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?
2165
2612
 
2166
2613
  # header parameters
2167
2614
  header_params = opts[:header_params] || {}
@@ -2197,6 +2644,72 @@ end
2197
2644
  return data, status_code, headers
2198
2645
  end
2199
2646
 
2647
+ # List a template's fields
2648
+ # Returns a template's fields with all of their settings, page by page: the draft's fields, or a published version's. A PDF template's fields are placed on its pages: GET /templates/{template_id}/page_images has images of the pages.
2649
+ # @param template_id [String] The template's ID.
2650
+ # @param [Hash] opts the optional parameters
2651
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
2652
+ # @return [TemplateFields]
2653
+ def list_template_fields(template_id, opts = {})
2654
+ data, _status_code, _headers = list_template_fields_with_http_info(template_id, opts)
2655
+ data
2656
+ end
2657
+
2658
+ # List a template's fields
2659
+ # Returns a template's fields with all of their settings, page by page: the draft's fields, or a published version's. A PDF template's fields are placed on its pages: GET /templates/{template_id}/page_images has images of the pages.
2660
+ # @param template_id [String] The template's ID.
2661
+ # @param [Hash] opts the optional parameters
2662
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
2663
+ # @return [Array<(TemplateFields, Integer, Hash)>] TemplateFields data, response status code and response headers
2664
+ def list_template_fields_with_http_info(template_id, opts = {})
2665
+ if @api_client.config.debugging
2666
+ @api_client.config.logger.debug 'Calling API: Client.list_template_fields ...'
2667
+ end
2668
+ # verify the required parameter 'template_id' is set
2669
+ if @api_client.config.client_side_validation && template_id.nil?
2670
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.list_template_fields"
2671
+ end
2672
+ # resource path
2673
+ local_var_path = '/templates/{template_id}/fields'.sub('{template_id}', CGI.escape(template_id.to_s))
2674
+
2675
+ # query parameters
2676
+ query_params = opts[:query_params] || {}
2677
+ query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
2678
+
2679
+ # header parameters
2680
+ header_params = opts[:header_params] || {}
2681
+ # HTTP header 'Accept' (if needed)
2682
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
2683
+
2684
+ # form parameters
2685
+ form_params = opts[:form_params] || {}
2686
+
2687
+ # http body (model)
2688
+ post_body = opts[:debug_body]
2689
+
2690
+ # return_type
2691
+ return_type = opts[:debug_return_type] || 'TemplateFields'
2692
+
2693
+ # auth_names
2694
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
2695
+
2696
+ new_options = opts.merge(
2697
+ :operation => :"Client.list_template_fields",
2698
+ :header_params => header_params,
2699
+ :query_params => query_params,
2700
+ :form_params => form_params,
2701
+ :body => post_body,
2702
+ :auth_names => auth_names,
2703
+ :return_type => return_type
2704
+ )
2705
+
2706
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2707
+ if @api_client.config.debugging
2708
+ @api_client.config.logger.debug "API called: Client#list_template_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2709
+ end
2710
+ return data, status_code, headers
2711
+ end
2712
+
2200
2713
  # List a template's submissions
2201
2714
  # Returns a template's submissions (from every version of the template), newest first.
2202
2715
  # @param template_id [String] The template's ID.
@@ -2207,6 +2720,8 @@ end
2207
2720
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
2208
2721
  # @option opts [Integer] :limit How many items to return (1-100, default 50). (default to 50)
2209
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.
2210
2725
  # @return [SubmissionList]
2211
2726
  def list_template_submissions(template_id, opts = {})
2212
2727
  data, _status_code, _headers = list_template_submissions_with_http_info(template_id, opts)
@@ -2223,6 +2738,8 @@ end
2223
2738
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
2224
2739
  # @option opts [Integer] :limit How many items to return (1-100, default 50). (default to 50)
2225
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.
2226
2743
  # @return [Array<(SubmissionList, Integer, Hash)>] SubmissionList data, response status code and response headers
2227
2744
  def list_template_submissions_with_http_info(template_id, opts = {})
2228
2745
  if @api_client.config.debugging
@@ -2243,6 +2760,8 @@ end
2243
2760
  query_params[:'include_data'] = opts[:'include_data'] if !opts[:'include_data'].nil?
2244
2761
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
2245
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?
2246
2765
 
2247
2766
  # header parameters
2248
2767
  header_params = opts[:header_params] || {}
@@ -2279,7 +2798,7 @@ end
2279
2798
  end
2280
2799
 
2281
2800
  # List templates
2282
- # 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.
2283
2802
  # @param [Hash] opts the optional parameters
2284
2803
  # @option opts [String] :query Only list templates whose name contains this text (ignoring case).
2285
2804
  # @option opts [String] :parent_folder_id Only list the templates in this folder (not in its subfolders).
@@ -2292,7 +2811,7 @@ end
2292
2811
  end
2293
2812
 
2294
2813
  # List templates
2295
- # 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.
2296
2815
  # @param [Hash] opts the optional parameters
2297
2816
  # @option opts [String] :query Only list templates whose name contains this text (ignoring case).
2298
2817
  # @option opts [String] :parent_folder_id Only list the templates in this folder (not in its subfolders).
@@ -2574,7 +3093,7 @@ end
2574
3093
  end
2575
3094
 
2576
3095
  # Publish a template version
2577
- # 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.
3096
+ # 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.
2578
3097
  # @param template_id [String] The template's ID.
2579
3098
  # @param body [PublishTemplateVersionRequest] The version to publish.
2580
3099
  # @param [Hash] opts the optional parameters
@@ -2585,7 +3104,7 @@ end
2585
3104
  end
2586
3105
 
2587
3106
  # Publish a template version
2588
- # 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.
3107
+ # 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.
2589
3108
  # @param template_id [String] The template's ID.
2590
3109
  # @param body [PublishTemplateVersionRequest] The version to publish.
2591
3110
  # @param [Hash] opts the optional parameters
@@ -2647,6 +3166,80 @@ end
2647
3166
  return data, status_code, headers
2648
3167
  end
2649
3168
 
3169
+ # Remove fields from a template
3170
+ # Removes fields from a template's draft and returns the fields that are left. Conditional logic that used only the removed fields is removed too.
3171
+ # @param template_id [String] The template's ID.
3172
+ # @param body [RemoveTemplateFieldsRequest] The fields to remove from the template's draft.
3173
+ # @param [Hash] opts the optional parameters
3174
+ # @return [TemplateFields]
3175
+ def remove_template_fields(template_id, body, opts = {})
3176
+ data, _status_code, _headers = remove_template_fields_with_http_info(template_id, body, opts)
3177
+ data
3178
+ end
3179
+
3180
+ # Remove fields from a template
3181
+ # Removes fields from a template's draft and returns the fields that are left. Conditional logic that used only the removed fields is removed too.
3182
+ # @param template_id [String] The template's ID.
3183
+ # @param body [RemoveTemplateFieldsRequest] The fields to remove from the template's draft.
3184
+ # @param [Hash] opts the optional parameters
3185
+ # @return [Array<(TemplateFields, Integer, Hash)>] TemplateFields data, response status code and response headers
3186
+ def remove_template_fields_with_http_info(template_id, body, opts = {})
3187
+ if @api_client.config.debugging
3188
+ @api_client.config.logger.debug 'Calling API: Client.remove_template_fields ...'
3189
+ end
3190
+ # verify the required parameter 'template_id' is set
3191
+ if @api_client.config.client_side_validation && template_id.nil?
3192
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.remove_template_fields"
3193
+ end
3194
+ # verify the required parameter 'body' is set
3195
+ if @api_client.config.client_side_validation && body.nil?
3196
+ fail ArgumentError, "Missing the required parameter 'body' when calling Client.remove_template_fields"
3197
+ end
3198
+ # resource path
3199
+ local_var_path = '/templates/{template_id}/fields/remove'.sub('{template_id}', CGI.escape(template_id.to_s))
3200
+
3201
+ # query parameters
3202
+ query_params = opts[:query_params] || {}
3203
+
3204
+ # header parameters
3205
+ header_params = opts[:header_params] || {}
3206
+ # HTTP header 'Accept' (if needed)
3207
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3208
+ # HTTP header 'Content-Type'
3209
+ content_type = @api_client.select_header_content_type(['application/json'])
3210
+ if !content_type.nil?
3211
+ header_params['Content-Type'] = content_type
3212
+ end
3213
+
3214
+ # form parameters
3215
+ form_params = opts[:form_params] || {}
3216
+
3217
+ # http body (model)
3218
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
3219
+
3220
+ # return_type
3221
+ return_type = opts[:debug_return_type] || 'TemplateFields'
3222
+
3223
+ # auth_names
3224
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
3225
+
3226
+ new_options = opts.merge(
3227
+ :operation => :"Client.remove_template_fields",
3228
+ :header_params => header_params,
3229
+ :query_params => query_params,
3230
+ :form_params => form_params,
3231
+ :body => post_body,
3232
+ :auth_names => auth_names,
3233
+ :return_type => return_type
3234
+ )
3235
+
3236
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
3237
+ if @api_client.config.debugging
3238
+ @api_client.config.logger.debug "API called: Client#remove_template_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3239
+ end
3240
+ return data, status_code, headers
3241
+ end
3242
+
2650
3243
  # Rename a folder
2651
3244
  # Renames a folder. The name must be unique within its parent folder.
2652
3245
  # @param folder_id [String] The folder's ID.
@@ -2721,6 +3314,80 @@ end
2721
3314
  return data, status_code, headers
2722
3315
  end
2723
3316
 
3317
+ # Reorder a template's fields
3318
+ # Changes the order of the fields in a template's draft and returns them in their new order. Send every field's ID: each field stays on its page, and a page's fields are printed in this order, so a later field prints over an earlier one where they overlap. Their values are in this order in the template's data schema and forms.
3319
+ # @param template_id [String] The template's ID.
3320
+ # @param body [ReorderTemplateFieldsRequest] The new order of the fields in the template's draft.
3321
+ # @param [Hash] opts the optional parameters
3322
+ # @return [TemplateFields]
3323
+ def reorder_template_fields(template_id, body, opts = {})
3324
+ data, _status_code, _headers = reorder_template_fields_with_http_info(template_id, body, opts)
3325
+ data
3326
+ end
3327
+
3328
+ # Reorder a template's fields
3329
+ # Changes the order of the fields in a template's draft and returns them in their new order. Send every field's ID: each field stays on its page, and a page's fields are printed in this order, so a later field prints over an earlier one where they overlap. Their values are in this order in the template's data schema and forms.
3330
+ # @param template_id [String] The template's ID.
3331
+ # @param body [ReorderTemplateFieldsRequest] The new order of the fields in the template's draft.
3332
+ # @param [Hash] opts the optional parameters
3333
+ # @return [Array<(TemplateFields, Integer, Hash)>] TemplateFields data, response status code and response headers
3334
+ def reorder_template_fields_with_http_info(template_id, body, opts = {})
3335
+ if @api_client.config.debugging
3336
+ @api_client.config.logger.debug 'Calling API: Client.reorder_template_fields ...'
3337
+ end
3338
+ # verify the required parameter 'template_id' is set
3339
+ if @api_client.config.client_side_validation && template_id.nil?
3340
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.reorder_template_fields"
3341
+ end
3342
+ # verify the required parameter 'body' is set
3343
+ if @api_client.config.client_side_validation && body.nil?
3344
+ fail ArgumentError, "Missing the required parameter 'body' when calling Client.reorder_template_fields"
3345
+ end
3346
+ # resource path
3347
+ local_var_path = '/templates/{template_id}/fields/reorder'.sub('{template_id}', CGI.escape(template_id.to_s))
3348
+
3349
+ # query parameters
3350
+ query_params = opts[:query_params] || {}
3351
+
3352
+ # header parameters
3353
+ header_params = opts[:header_params] || {}
3354
+ # HTTP header 'Accept' (if needed)
3355
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3356
+ # HTTP header 'Content-Type'
3357
+ content_type = @api_client.select_header_content_type(['application/json'])
3358
+ if !content_type.nil?
3359
+ header_params['Content-Type'] = content_type
3360
+ end
3361
+
3362
+ # form parameters
3363
+ form_params = opts[:form_params] || {}
3364
+
3365
+ # http body (model)
3366
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
3367
+
3368
+ # return_type
3369
+ return_type = opts[:debug_return_type] || 'TemplateFields'
3370
+
3371
+ # auth_names
3372
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
3373
+
3374
+ new_options = opts.merge(
3375
+ :operation => :"Client.reorder_template_fields",
3376
+ :header_params => header_params,
3377
+ :query_params => query_params,
3378
+ :form_params => form_params,
3379
+ :body => post_body,
3380
+ :auth_names => auth_names,
3381
+ :return_type => return_type
3382
+ )
3383
+
3384
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
3385
+ if @api_client.config.debugging
3386
+ @api_client.config.logger.debug "API called: Client#reorder_template_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3387
+ end
3388
+ return data, status_code, headers
3389
+ end
3390
+
2724
3391
  # Restore a template version
2725
3392
  # Replaces the template's draft with a copy of one of its published versions.
2726
3393
  # @param template_id [String] The template's ID.
@@ -2927,7 +3594,7 @@ end
2927
3594
  end
2928
3595
 
2929
3596
  # Update a template
2930
- # Changes a template's draft. Properties left out keep their values. `defaults` and `html_engine_options` replace the whole object. 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. Setting `parent_folder_id` moves the template and all of its published versions.
2931
3598
  # @param template_id [String] The template's ID.
2932
3599
  # @param body [UpdateTemplateRequest] The settings to change. Properties left out keep their values.
2933
3600
  # @param [Hash] opts the optional parameters
@@ -2938,7 +3605,7 @@ end
2938
3605
  end
2939
3606
 
2940
3607
  # Update a template
2941
- # Changes a template's draft. Properties left out keep their values. `defaults` and `html_engine_options` replace the whole object. 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. Setting `parent_folder_id` moves the template and all of its published versions.
2942
3609
  # @param template_id [String] The template's ID.
2943
3610
  # @param body [UpdateTemplateRequest] The settings to change. Properties left out keep their values.
2944
3611
  # @param [Hash] opts the optional parameters
@@ -3001,11 +3668,11 @@ end
3001
3668
  end
3002
3669
 
3003
3670
  # Replace a template's PDF
3004
- # Replaces a PDF template's PDF with one you uploaded with the presigned upload (GET /uploads/presign). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields. To send the PDF with the request instead, use PUT /templates/{template_id}/document/upload.
3671
+ # 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.
3005
3672
  # @param template_id [String] The template's ID.
3006
- # @param body [UpdateTemplateDocumentRequest] The new PDF.
3673
+ # @param body [UpdateTemplateDocumentRequest] The new PDF, as one of `cache_id`, `document_url` and `document_base64`.
3007
3674
  # @param [Hash] opts the optional parameters
3008
- # @option opts [Boolean] :wait Wait until the PDF has been processed before responding. Default true on sync.api hosts.
3675
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3009
3676
  # @return [Template]
3010
3677
  def update_template_document(template_id, body, opts = {})
3011
3678
  data, _status_code, _headers = update_template_document_with_http_info(template_id, body, opts)
@@ -3013,11 +3680,11 @@ end
3013
3680
  end
3014
3681
 
3015
3682
  # Replace a template's PDF
3016
- # Replaces a PDF template's PDF with one you uploaded with the presigned upload (GET /uploads/presign). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields. To send the PDF with the request instead, use PUT /templates/{template_id}/document/upload.
3683
+ # 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.
3017
3684
  # @param template_id [String] The template's ID.
3018
- # @param body [UpdateTemplateDocumentRequest] The new PDF.
3685
+ # @param body [UpdateTemplateDocumentRequest] The new PDF, as one of `cache_id`, `document_url` and `document_base64`.
3019
3686
  # @param [Hash] opts the optional parameters
3020
- # @option opts [Boolean] :wait Wait until the PDF has been processed before responding. Default true on sync.api hosts.
3687
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3021
3688
  # @return [Array<(Template, Integer, Hash)>] Template data, response status code and response headers
3022
3689
  def update_template_document_with_http_info(template_id, body, opts = {})
3023
3690
  if @api_client.config.debugging
@@ -3077,6 +3744,80 @@ end
3077
3744
  return data, status_code, headers
3078
3745
  end
3079
3746
 
3747
+ # Update a template's fields
3748
+ # Changes fields of a template's draft and returns all of its fields. Settings left out keep their values. A shared setting (`type`, `required`, `default`, ...) changes for every field with the same name.
3749
+ # @param template_id [String] The template's ID.
3750
+ # @param body [UpdateTemplateFieldsRequest] The fields to change in the template's draft.
3751
+ # @param [Hash] opts the optional parameters
3752
+ # @return [TemplateFields]
3753
+ def update_template_fields(template_id, body, opts = {})
3754
+ data, _status_code, _headers = update_template_fields_with_http_info(template_id, body, opts)
3755
+ data
3756
+ end
3757
+
3758
+ # Update a template's fields
3759
+ # Changes fields of a template's draft and returns all of its fields. Settings left out keep their values. A shared setting (`type`, `required`, `default`, ...) changes for every field with the same name.
3760
+ # @param template_id [String] The template's ID.
3761
+ # @param body [UpdateTemplateFieldsRequest] The fields to change in the template's draft.
3762
+ # @param [Hash] opts the optional parameters
3763
+ # @return [Array<(TemplateFields, Integer, Hash)>] TemplateFields data, response status code and response headers
3764
+ def update_template_fields_with_http_info(template_id, body, opts = {})
3765
+ if @api_client.config.debugging
3766
+ @api_client.config.logger.debug 'Calling API: Client.update_template_fields ...'
3767
+ end
3768
+ # verify the required parameter 'template_id' is set
3769
+ if @api_client.config.client_side_validation && template_id.nil?
3770
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.update_template_fields"
3771
+ end
3772
+ # verify the required parameter 'body' is set
3773
+ if @api_client.config.client_side_validation && body.nil?
3774
+ fail ArgumentError, "Missing the required parameter 'body' when calling Client.update_template_fields"
3775
+ end
3776
+ # resource path
3777
+ local_var_path = '/templates/{template_id}/fields'.sub('{template_id}', CGI.escape(template_id.to_s))
3778
+
3779
+ # query parameters
3780
+ query_params = opts[:query_params] || {}
3781
+
3782
+ # header parameters
3783
+ header_params = opts[:header_params] || {}
3784
+ # HTTP header 'Accept' (if needed)
3785
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3786
+ # HTTP header 'Content-Type'
3787
+ content_type = @api_client.select_header_content_type(['application/json'])
3788
+ if !content_type.nil?
3789
+ header_params['Content-Type'] = content_type
3790
+ end
3791
+
3792
+ # form parameters
3793
+ form_params = opts[:form_params] || {}
3794
+
3795
+ # http body (model)
3796
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
3797
+
3798
+ # return_type
3799
+ return_type = opts[:debug_return_type] || 'TemplateFields'
3800
+
3801
+ # auth_names
3802
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
3803
+
3804
+ new_options = opts.merge(
3805
+ :operation => :"Client.update_template_fields",
3806
+ :header_params => header_params,
3807
+ :query_params => query_params,
3808
+ :form_params => form_params,
3809
+ :body => post_body,
3810
+ :auth_names => auth_names,
3811
+ :return_type => return_type
3812
+ )
3813
+
3814
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
3815
+ if @api_client.config.debugging
3816
+ @api_client.config.logger.debug "API called: Client#update_template_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3817
+ end
3818
+ return data, status_code, headers
3819
+ end
3820
+
3080
3821
  # Update a webhook
3081
3822
  # Updates a webhook. Only the properties you send change.
3082
3823
  # @param webhook_id [String] The webhook's ID.
@@ -3155,7 +3896,7 @@ end
3155
3896
  # 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.
3156
3897
  # @param document [File] The PDF.
3157
3898
  # @param [Hash] opts the optional parameters
3158
- # @option opts [Boolean] :wait Wait until the PDF has been processed before responding. Default true on sync.api hosts.
3899
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3159
3900
  # @option opts [String] :name The template's name.
3160
3901
  # @option opts [String] :description The template's description.
3161
3902
  # @option opts [String] :parent_folder_id The folder to put the template in. Left out, it's created at the root.
@@ -3174,7 +3915,7 @@ end
3174
3915
  # 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.
3175
3916
  # @param document [File] The PDF.
3176
3917
  # @param [Hash] opts the optional parameters
3177
- # @option opts [Boolean] :wait Wait until the PDF has been processed before responding. Default true on sync.api hosts.
3918
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3178
3919
  # @option opts [String] :name The template's name.
3179
3920
  # @option opts [String] :description The template's description.
3180
3921
  # @option opts [String] :parent_folder_id The folder to put the template in. Left out, it's created at the root.
@@ -3252,7 +3993,7 @@ end
3252
3993
  # @param template_id [String] The template's ID.
3253
3994
  # @param document [File] The new PDF.
3254
3995
  # @param [Hash] opts the optional parameters
3255
- # @option opts [Boolean] :wait Wait until the PDF has been processed before responding. Default true on sync.api hosts.
3996
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3256
3997
  # @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.
3257
3998
  # @return [Template]
3258
3999
  def upload_template_document(template_id, document, opts = {})
@@ -3265,7 +4006,7 @@ end
3265
4006
  # @param template_id [String] The template's ID.
3266
4007
  # @param document [File] The new PDF.
3267
4008
  # @param [Hash] opts the optional parameters
3268
- # @option opts [Boolean] :wait Wait until the PDF has been processed before responding. Default true on sync.api hosts.
4009
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3269
4010
  # @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.
3270
4011
  # @return [Array<(Template, Integer, Hash)>] Template data, response status code and response headers
3271
4012
  def upload_template_document_with_http_info(template_id, document, opts = {})
@@ -3327,5 +4068,82 @@ end
3327
4068
  end
3328
4069
  return data, status_code, headers
3329
4070
  end
4071
+
4072
+ # Check a submission without creating it
4073
+ # Checks a submission as creating it would (its data against the template's fields, its settings and signature requests) without saving it, generating anything or using credits. It doesn't check your account's credits. The response says whether the submission is valid, and if not, has the error that creating it would return.
4074
+ # @param template_id [String] The template's ID.
4075
+ # @param body [ValidateSubmissionRequest] The submission's data and settings.
4076
+ # @param [Hash] opts the optional parameters
4077
+ # @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).
4078
+ # @return [SubmissionValidation]
4079
+ def validate_submission(template_id, body, opts = {})
4080
+ data, _status_code, _headers = validate_submission_with_http_info(template_id, body, opts)
4081
+ data
4082
+ end
4083
+
4084
+ # Check a submission without creating it
4085
+ # Checks a submission as creating it would (its data against the template's fields, its settings and signature requests) without saving it, generating anything or using credits. It doesn't check your account's credits. The response says whether the submission is valid, and if not, has the error that creating it would return.
4086
+ # @param template_id [String] The template's ID.
4087
+ # @param body [ValidateSubmissionRequest] The submission's data and settings.
4088
+ # @param [Hash] opts the optional parameters
4089
+ # @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).
4090
+ # @return [Array<(SubmissionValidation, Integer, Hash)>] SubmissionValidation data, response status code and response headers
4091
+ def validate_submission_with_http_info(template_id, body, opts = {})
4092
+ if @api_client.config.debugging
4093
+ @api_client.config.logger.debug 'Calling API: Client.validate_submission ...'
4094
+ end
4095
+ # verify the required parameter 'template_id' is set
4096
+ if @api_client.config.client_side_validation && template_id.nil?
4097
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.validate_submission"
4098
+ end
4099
+ # verify the required parameter 'body' is set
4100
+ if @api_client.config.client_side_validation && body.nil?
4101
+ fail ArgumentError, "Missing the required parameter 'body' when calling Client.validate_submission"
4102
+ end
4103
+ # resource path
4104
+ local_var_path = '/templates/{template_id}/submissions/validate'.sub('{template_id}', CGI.escape(template_id.to_s))
4105
+
4106
+ # query parameters
4107
+ query_params = opts[:query_params] || {}
4108
+ query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
4109
+
4110
+ # header parameters
4111
+ header_params = opts[:header_params] || {}
4112
+ # HTTP header 'Accept' (if needed)
4113
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
4114
+ # HTTP header 'Content-Type'
4115
+ content_type = @api_client.select_header_content_type(['application/json'])
4116
+ if !content_type.nil?
4117
+ header_params['Content-Type'] = content_type
4118
+ end
4119
+
4120
+ # form parameters
4121
+ form_params = opts[:form_params] || {}
4122
+
4123
+ # http body (model)
4124
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
4125
+
4126
+ # return_type
4127
+ return_type = opts[:debug_return_type] || 'SubmissionValidation'
4128
+
4129
+ # auth_names
4130
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
4131
+
4132
+ new_options = opts.merge(
4133
+ :operation => :"Client.validate_submission",
4134
+ :header_params => header_params,
4135
+ :query_params => query_params,
4136
+ :form_params => form_params,
4137
+ :body => post_body,
4138
+ :auth_names => auth_names,
4139
+ :return_type => return_type
4140
+ )
4141
+
4142
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
4143
+ if @api_client.config.debugging
4144
+ @api_client.config.logger.debug "API called: Client#validate_submission\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
4145
+ end
4146
+ return data, status_code, headers
4147
+ end
3330
4148
  end
3331
4149
  end