docspring 4.0.0 → 4.1.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 (132) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +84 -0
  3. data/.travis.yml +1 -1
  4. data/CHANGELOG.md +24 -0
  5. data/Gemfile.lock +2 -2
  6. data/README.md +10 -1
  7. data/docs/AddTemplateFieldsRequest.md +18 -0
  8. data/docs/Client.md +704 -33
  9. data/docs/CreateSubmissionBatchRequest.md +2 -0
  10. data/docs/CreateSubmissionRequest.md +2 -0
  11. data/docs/CreateTemplateRequest.md +10 -2
  12. data/docs/Field.md +198 -0
  13. data/docs/FieldDependency.md +22 -0
  14. data/docs/FieldDependencyInput.md +22 -0
  15. data/docs/FieldGroup.md +32 -0
  16. data/docs/FieldGroupInput.md +30 -0
  17. data/docs/FieldGroupType.md +15 -0
  18. data/docs/FieldInput.md +196 -0
  19. data/docs/FieldType.md +15 -0
  20. data/docs/GenerateFilesFormat.md +15 -0
  21. data/docs/GenerateSubmissionFilesRequest.md +18 -0
  22. data/docs/OutputFormat.md +15 -0
  23. data/docs/PageImage.md +34 -0
  24. data/docs/PageImages.md +24 -0
  25. data/docs/PredefinedField.md +30 -0
  26. data/docs/PredefinedFieldInput.md +30 -0
  27. data/docs/RemoveTemplateFieldsRequest.md +18 -0
  28. data/docs/ReorderTemplateFieldsRequest.md +18 -0
  29. data/docs/Submission.md +3 -1
  30. data/docs/SubmissionFiles.md +3 -1
  31. data/docs/SubmissionInput.md +2 -0
  32. data/docs/SubmissionValidation.md +24 -0
  33. data/docs/Template.md +6 -0
  34. data/docs/TemplateDiff.md +30 -0
  35. data/docs/TemplateDiffSummary.md +28 -0
  36. data/docs/TemplateDocument.md +3 -3
  37. data/docs/TemplateFieldChange.md +24 -0
  38. data/docs/TemplateFieldChanges.md +24 -0
  39. data/docs/TemplateFieldDependency.md +1 -1
  40. data/docs/TemplateFieldDependencyInput.md +1 -1
  41. data/docs/TemplateFieldMove.md +22 -0
  42. data/docs/TemplateFields.md +22 -0
  43. data/docs/TemplatePageImages.md +24 -0
  44. data/docs/UpdateTemplateDocumentRequest.md +6 -2
  45. data/docs/UpdateTemplateFieldsRequest.md +18 -0
  46. data/docs/UpdateTemplateRequest.md +6 -0
  47. data/docs/ValidateSubmissionRequest.md +38 -0
  48. data/lib/docspring/api/client.rb +666 -18
  49. data/lib/docspring/api_client.rb +1 -1
  50. data/lib/docspring/models/add_template_fields_request.rb +187 -0
  51. data/lib/docspring/models/create_submission_batch_request.rb +23 -1
  52. data/lib/docspring/models/create_submission_request.rb +23 -1
  53. data/lib/docspring/models/create_template_request.rb +48 -3
  54. data/lib/docspring/models/field.rb +2217 -0
  55. data/lib/docspring/models/field_dependency.rb +246 -0
  56. data/lib/docspring/models/field_dependency_input.rb +246 -0
  57. data/lib/docspring/models/field_group.rb +368 -0
  58. data/lib/docspring/models/field_group_input.rb +247 -0
  59. data/lib/docspring/models/field_group_type.rb +41 -0
  60. data/lib/docspring/models/field_input.rb +1109 -0
  61. data/lib/docspring/models/field_type.rb +54 -0
  62. data/lib/docspring/models/generate_files_format.rb +40 -0
  63. data/lib/docspring/models/generate_submission_files_request.rb +187 -0
  64. data/lib/docspring/models/output_format.rb +41 -0
  65. data/lib/docspring/models/page_image.rb +359 -0
  66. data/lib/docspring/models/page_images.rb +248 -0
  67. data/lib/docspring/models/predefined_field.rb +287 -0
  68. data/lib/docspring/models/predefined_field_input.rb +287 -0
  69. data/lib/docspring/models/remove_template_fields_request.rb +187 -0
  70. data/lib/docspring/models/reorder_template_fields_request.rb +187 -0
  71. data/lib/docspring/models/submission.rb +31 -2
  72. data/lib/docspring/models/submission_files.rb +13 -4
  73. data/lib/docspring/models/submission_input.rb +23 -1
  74. data/lib/docspring/models/submission_validation.rb +234 -0
  75. data/lib/docspring/models/template.rb +74 -1
  76. data/lib/docspring/models/template_diff.rb +321 -0
  77. data/lib/docspring/models/template_diff_summary.rb +320 -0
  78. data/lib/docspring/models/template_document.rb +3 -3
  79. data/lib/docspring/models/template_document_state.rb +3 -1
  80. data/lib/docspring/models/template_field_change.rb +266 -0
  81. data/lib/docspring/models/template_field_changes.rb +274 -0
  82. data/lib/docspring/models/template_field_dependency.rb +1 -1
  83. data/lib/docspring/models/template_field_dependency_input.rb +1 -1
  84. data/lib/docspring/models/template_field_move.rb +239 -0
  85. data/lib/docspring/models/template_fields.rb +227 -0
  86. data/lib/docspring/models/template_page_images.rb +254 -0
  87. data/lib/docspring/models/update_template_document_request.rb +23 -20
  88. data/lib/docspring/models/update_template_fields_request.rb +187 -0
  89. data/lib/docspring/models/update_template_request.rb +38 -1
  90. data/lib/docspring/models/validate_submission_request.rb +288 -0
  91. data/lib/docspring/request_schemas.json +3364 -1584
  92. data/lib/docspring/version.rb +1 -1
  93. data/lib/docspring.rb +28 -0
  94. data/spec/api/client_spec.rb +128 -9
  95. data/spec/models/add_template_fields_request_spec.rb +36 -0
  96. data/spec/models/create_submission_batch_request_spec.rb +6 -0
  97. data/spec/models/create_submission_request_spec.rb +6 -0
  98. data/spec/models/create_template_request_spec.rb +24 -0
  99. data/spec/models/field_dependency_input_spec.rb +48 -0
  100. data/spec/models/field_dependency_spec.rb +48 -0
  101. data/spec/models/field_group_input_spec.rb +72 -0
  102. data/spec/models/field_group_spec.rb +78 -0
  103. data/spec/models/field_group_type_spec.rb +30 -0
  104. data/spec/models/field_input_spec.rb +570 -0
  105. data/spec/models/field_spec.rb +576 -0
  106. data/spec/models/field_type_spec.rb +30 -0
  107. data/spec/models/generate_files_format_spec.rb +30 -0
  108. data/spec/models/generate_submission_files_request_spec.rb +36 -0
  109. data/spec/models/output_format_spec.rb +30 -0
  110. data/spec/models/page_image_spec.rb +84 -0
  111. data/spec/models/page_images_spec.rb +54 -0
  112. data/spec/models/predefined_field_input_spec.rb +72 -0
  113. data/spec/models/predefined_field_spec.rb +72 -0
  114. data/spec/models/remove_template_fields_request_spec.rb +36 -0
  115. data/spec/models/reorder_template_fields_request_spec.rb +36 -0
  116. data/spec/models/submission_files_spec.rb +6 -0
  117. data/spec/models/submission_input_spec.rb +6 -0
  118. data/spec/models/submission_spec.rb +6 -0
  119. data/spec/models/submission_validation_spec.rb +54 -0
  120. data/spec/models/template_diff_spec.rb +72 -0
  121. data/spec/models/template_diff_summary_spec.rb +66 -0
  122. data/spec/models/template_field_change_spec.rb +54 -0
  123. data/spec/models/template_field_changes_spec.rb +54 -0
  124. data/spec/models/template_field_move_spec.rb +48 -0
  125. data/spec/models/template_fields_spec.rb +48 -0
  126. data/spec/models/template_page_images_spec.rb +54 -0
  127. data/spec/models/template_spec.rb +18 -0
  128. data/spec/models/update_template_document_request_spec.rb +12 -0
  129. data/spec/models/update_template_fields_request_spec.rb +36 -0
  130. data/spec/models/update_template_request_spec.rb +18 -0
  131. data/spec/models/validate_submission_request_spec.rb +96 -0
  132. metadata +113 -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.
@@ -493,7 +567,7 @@ end
493
567
  # @param body [CreateSubmissionRequest] The submission's data and settings.
494
568
  # @param [Hash] opts the optional parameters
495
569
  # @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.
570
+ # @option opts [Boolean] :wait Wait until the files have been generated before responding. Default true on sync.api hosts.
497
571
  # @return [Submission]
498
572
  def create_submission(template_id, body, opts = {})
499
573
  data, _status_code, _headers = create_submission_with_http_info(template_id, body, opts)
@@ -506,7 +580,7 @@ end
506
580
  # @param body [CreateSubmissionRequest] The submission's data and settings.
507
581
  # @param [Hash] opts the optional parameters
508
582
  # @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.
583
+ # @option opts [Boolean] :wait Wait until the files have been generated before responding. Default true on sync.api hosts.
510
584
  # @return [Array<(Submission, Integer, Hash)>] Submission data, response status code and response headers
511
585
  def create_submission_with_http_info(template_id, body, opts = {})
512
586
  if @api_client.config.debugging
@@ -642,7 +716,7 @@ end
642
716
  # Creates an HTML template, or a PDF template from a PDF you uploaded with the presigned upload (GET /uploads/presign): pass its `fields.key` as `cache_id`. To send the PDF with the request instead, use POST /templates/upload. A PDF template is ready to generate PDFs once DocSpring has processed its PDF (`ready` is true). On sync.api hosts the request waits for that unless you pass `wait=false`.
643
717
  # @param body [CreateTemplateRequest] The template to create.
644
718
  # @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.
719
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
646
720
  # @return [Template]
647
721
  def create_template(body, opts = {})
648
722
  data, _status_code, _headers = create_template_with_http_info(body, opts)
@@ -653,7 +727,7 @@ end
653
727
  # Creates an HTML template, or a PDF template from a PDF you uploaded with the presigned upload (GET /uploads/presign): pass its `fields.key` as `cache_id`. To send the PDF with the request instead, use POST /templates/upload. A PDF template is ready to generate PDFs once DocSpring has processed its PDF (`ready` is true). On sync.api hosts the request waits for that unless you pass `wait=false`.
654
728
  # @param body [CreateTemplateRequest] The template to create.
655
729
  # @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.
730
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
657
731
  # @return [Array<(Template, Integer, Hash)>] Template data, response status code and response headers
658
732
  def create_template_with_http_info(body, opts = {})
659
733
  if @api_client.config.debugging
@@ -1158,6 +1232,83 @@ end
1158
1232
  return data, status_code, headers
1159
1233
  end
1160
1234
 
1235
+ # Generate more files
1236
+ # Adds formats to a processed submission's files, in the background: `png`, a PNG image of each page of the PDF (up to 100 pages). To make them with the submission, add them to `output_formats` when you create it. Each new file is listed in `files` while it's made: on sync.api hosts the request waits for them (unless you pass `wait=false`), otherwise poll GET /submissions/{submission_id} until none of their `state` is `pending`. A file that couldn't be made has the state `error` and an `error_message`, and the submission stays processed. Asking for a format the submission already has (or is making) changes nothing.
1237
+ # @param submission_id [String] The submission's ID.
1238
+ # @param body [GenerateSubmissionFilesRequest] The formats to make.
1239
+ # @param [Hash] opts the optional parameters
1240
+ # @option opts [Boolean] :wait Wait until the files have been generated before responding. Default true on sync.api hosts.
1241
+ # @return [Submission]
1242
+ def generate_submission_files(submission_id, body, opts = {})
1243
+ data, _status_code, _headers = generate_submission_files_with_http_info(submission_id, body, opts)
1244
+ data
1245
+ end
1246
+
1247
+ # Generate more files
1248
+ # Adds formats to a processed submission's files, in the background: `png`, a PNG image of each page of the PDF (up to 100 pages). To make them with the submission, add them to `output_formats` when you create it. Each new file is listed in `files` while it's made: on sync.api hosts the request waits for them (unless you pass `wait=false`), otherwise poll GET /submissions/{submission_id} until none of their `state` is `pending`. A file that couldn't be made has the state `error` and an `error_message`, and the submission stays processed. Asking for a format the submission already has (or is making) changes nothing.
1249
+ # @param submission_id [String] The submission's ID.
1250
+ # @param body [GenerateSubmissionFilesRequest] The formats to make.
1251
+ # @param [Hash] opts the optional parameters
1252
+ # @option opts [Boolean] :wait Wait until the files have been generated before responding. Default true on sync.api hosts.
1253
+ # @return [Array<(Submission, Integer, Hash)>] Submission data, response status code and response headers
1254
+ def generate_submission_files_with_http_info(submission_id, body, opts = {})
1255
+ if @api_client.config.debugging
1256
+ @api_client.config.logger.debug 'Calling API: Client.generate_submission_files ...'
1257
+ end
1258
+ # verify the required parameter 'submission_id' is set
1259
+ if @api_client.config.client_side_validation && submission_id.nil?
1260
+ fail ArgumentError, "Missing the required parameter 'submission_id' when calling Client.generate_submission_files"
1261
+ end
1262
+ # verify the required parameter 'body' is set
1263
+ if @api_client.config.client_side_validation && body.nil?
1264
+ fail ArgumentError, "Missing the required parameter 'body' when calling Client.generate_submission_files"
1265
+ end
1266
+ # resource path
1267
+ local_var_path = '/submissions/{submission_id}/generate_files'.sub('{submission_id}', CGI.escape(submission_id.to_s))
1268
+
1269
+ # query parameters
1270
+ query_params = opts[:query_params] || {}
1271
+ query_params[:'wait'] = opts[:'wait'] if !opts[:'wait'].nil?
1272
+
1273
+ # header parameters
1274
+ header_params = opts[:header_params] || {}
1275
+ # HTTP header 'Accept' (if needed)
1276
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1277
+ # HTTP header 'Content-Type'
1278
+ content_type = @api_client.select_header_content_type(['application/json'])
1279
+ if !content_type.nil?
1280
+ header_params['Content-Type'] = content_type
1281
+ end
1282
+
1283
+ # form parameters
1284
+ form_params = opts[:form_params] || {}
1285
+
1286
+ # http body (model)
1287
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
1288
+
1289
+ # return_type
1290
+ return_type = opts[:debug_return_type] || 'Submission'
1291
+
1292
+ # auth_names
1293
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
1294
+
1295
+ new_options = opts.merge(
1296
+ :operation => :"Client.generate_submission_files",
1297
+ :header_params => header_params,
1298
+ :query_params => query_params,
1299
+ :form_params => form_params,
1300
+ :body => post_body,
1301
+ :auth_names => auth_names,
1302
+ :return_type => return_type
1303
+ )
1304
+
1305
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
1306
+ if @api_client.config.debugging
1307
+ @api_client.config.logger.debug "API called: Client#generate_submission_files\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1308
+ end
1309
+ return data, status_code, headers
1310
+ end
1311
+
1161
1312
  # Generate a preview PDF
1162
1313
  # 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
1314
  # @param submission_id [String] The submission's ID.
@@ -1725,6 +1876,72 @@ end
1725
1876
  return data, status_code, headers
1726
1877
  end
1727
1878
 
1879
+ # Compare a version of a template with the one before it
1880
+ # 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.
1881
+ # @param template_id [String] The template's ID.
1882
+ # @param [Hash] opts the optional parameters
1883
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1884
+ # @return [TemplateDiff]
1885
+ def get_template_diff(template_id, opts = {})
1886
+ data, _status_code, _headers = get_template_diff_with_http_info(template_id, opts)
1887
+ data
1888
+ end
1889
+
1890
+ # Compare a version of a template with the one before it
1891
+ # 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.
1892
+ # @param template_id [String] The template's ID.
1893
+ # @param [Hash] opts the optional parameters
1894
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
1895
+ # @return [Array<(TemplateDiff, Integer, Hash)>] TemplateDiff data, response status code and response headers
1896
+ def get_template_diff_with_http_info(template_id, opts = {})
1897
+ if @api_client.config.debugging
1898
+ @api_client.config.logger.debug 'Calling API: Client.get_template_diff ...'
1899
+ end
1900
+ # verify the required parameter 'template_id' is set
1901
+ if @api_client.config.client_side_validation && template_id.nil?
1902
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.get_template_diff"
1903
+ end
1904
+ # resource path
1905
+ local_var_path = '/templates/{template_id}/diff'.sub('{template_id}', CGI.escape(template_id.to_s))
1906
+
1907
+ # query parameters
1908
+ query_params = opts[:query_params] || {}
1909
+ query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
1910
+
1911
+ # header parameters
1912
+ header_params = opts[:header_params] || {}
1913
+ # HTTP header 'Accept' (if needed)
1914
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
1915
+
1916
+ # form parameters
1917
+ form_params = opts[:form_params] || {}
1918
+
1919
+ # http body (model)
1920
+ post_body = opts[:debug_body]
1921
+
1922
+ # return_type
1923
+ return_type = opts[:debug_return_type] || 'TemplateDiff'
1924
+
1925
+ # auth_names
1926
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
1927
+
1928
+ new_options = opts.merge(
1929
+ :operation => :"Client.get_template_diff",
1930
+ :header_params => header_params,
1931
+ :query_params => query_params,
1932
+ :form_params => form_params,
1933
+ :body => post_body,
1934
+ :auth_names => auth_names,
1935
+ :return_type => return_type
1936
+ )
1937
+
1938
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
1939
+ if @api_client.config.debugging
1940
+ @api_client.config.logger.debug "API called: Client#get_template_diff\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
1941
+ end
1942
+ return data, status_code, headers
1943
+ end
1944
+
1728
1945
  # Generate typed code for a template's submission data
1729
1946
  # Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir or Go, so your app catches mistakes before it calls the API. `root_type_name` is the type of the whole `data` object. Java returns every class in `code`, each under a `// ClassName.java` comment. A template with no named fields returns 422.
1730
1947
  # @param template_id [String] The template's ID.
@@ -1798,6 +2015,72 @@ end
1798
2015
  return data, status_code, headers
1799
2016
  end
1800
2017
 
2018
+ # Get images of a template's pages
2019
+ # 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.
2020
+ # @param template_id [String] The template's ID.
2021
+ # @param [Hash] opts the optional parameters
2022
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
2023
+ # @return [TemplatePageImages]
2024
+ def get_template_page_images(template_id, opts = {})
2025
+ data, _status_code, _headers = get_template_page_images_with_http_info(template_id, opts)
2026
+ data
2027
+ end
2028
+
2029
+ # Get images of a template's pages
2030
+ # 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.
2031
+ # @param template_id [String] The template's ID.
2032
+ # @param [Hash] opts the optional parameters
2033
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
2034
+ # @return [Array<(TemplatePageImages, Integer, Hash)>] TemplatePageImages data, response status code and response headers
2035
+ def get_template_page_images_with_http_info(template_id, opts = {})
2036
+ if @api_client.config.debugging
2037
+ @api_client.config.logger.debug 'Calling API: Client.get_template_page_images ...'
2038
+ end
2039
+ # verify the required parameter 'template_id' is set
2040
+ if @api_client.config.client_side_validation && template_id.nil?
2041
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.get_template_page_images"
2042
+ end
2043
+ # resource path
2044
+ local_var_path = '/templates/{template_id}/page_images'.sub('{template_id}', CGI.escape(template_id.to_s))
2045
+
2046
+ # query parameters
2047
+ query_params = opts[:query_params] || {}
2048
+ query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
2049
+
2050
+ # header parameters
2051
+ header_params = opts[:header_params] || {}
2052
+ # HTTP header 'Accept' (if needed)
2053
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
2054
+
2055
+ # form parameters
2056
+ form_params = opts[:form_params] || {}
2057
+
2058
+ # http body (model)
2059
+ post_body = opts[:debug_body]
2060
+
2061
+ # return_type
2062
+ return_type = opts[:debug_return_type] || 'TemplatePageImages'
2063
+
2064
+ # auth_names
2065
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
2066
+
2067
+ new_options = opts.merge(
2068
+ :operation => :"Client.get_template_page_images",
2069
+ :header_params => header_params,
2070
+ :query_params => query_params,
2071
+ :form_params => form_params,
2072
+ :body => post_body,
2073
+ :auth_names => auth_names,
2074
+ :return_type => return_type
2075
+ )
2076
+
2077
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2078
+ if @api_client.config.debugging
2079
+ @api_client.config.logger.debug "API called: Client#get_template_page_images\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2080
+ end
2081
+ return data, status_code, headers
2082
+ end
2083
+
1801
2084
  # Get the JSON Schema of a template's submission data
1802
2085
  # 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.
1803
2086
  # @param template_id [String] The template's ID.
@@ -2197,6 +2480,72 @@ end
2197
2480
  return data, status_code, headers
2198
2481
  end
2199
2482
 
2483
+ # List a template's fields
2484
+ # 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.
2485
+ # @param template_id [String] The template's ID.
2486
+ # @param [Hash] opts the optional parameters
2487
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
2488
+ # @return [TemplateFields]
2489
+ def list_template_fields(template_id, opts = {})
2490
+ data, _status_code, _headers = list_template_fields_with_http_info(template_id, opts)
2491
+ data
2492
+ end
2493
+
2494
+ # List a template's fields
2495
+ # 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.
2496
+ # @param template_id [String] The template's ID.
2497
+ # @param [Hash] opts the optional parameters
2498
+ # @option opts [String] :version A published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `draft`.
2499
+ # @return [Array<(TemplateFields, Integer, Hash)>] TemplateFields data, response status code and response headers
2500
+ def list_template_fields_with_http_info(template_id, opts = {})
2501
+ if @api_client.config.debugging
2502
+ @api_client.config.logger.debug 'Calling API: Client.list_template_fields ...'
2503
+ end
2504
+ # verify the required parameter 'template_id' is set
2505
+ if @api_client.config.client_side_validation && template_id.nil?
2506
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.list_template_fields"
2507
+ end
2508
+ # resource path
2509
+ local_var_path = '/templates/{template_id}/fields'.sub('{template_id}', CGI.escape(template_id.to_s))
2510
+
2511
+ # query parameters
2512
+ query_params = opts[:query_params] || {}
2513
+ query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
2514
+
2515
+ # header parameters
2516
+ header_params = opts[:header_params] || {}
2517
+ # HTTP header 'Accept' (if needed)
2518
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
2519
+
2520
+ # form parameters
2521
+ form_params = opts[:form_params] || {}
2522
+
2523
+ # http body (model)
2524
+ post_body = opts[:debug_body]
2525
+
2526
+ # return_type
2527
+ return_type = opts[:debug_return_type] || 'TemplateFields'
2528
+
2529
+ # auth_names
2530
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
2531
+
2532
+ new_options = opts.merge(
2533
+ :operation => :"Client.list_template_fields",
2534
+ :header_params => header_params,
2535
+ :query_params => query_params,
2536
+ :form_params => form_params,
2537
+ :body => post_body,
2538
+ :auth_names => auth_names,
2539
+ :return_type => return_type
2540
+ )
2541
+
2542
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2543
+ if @api_client.config.debugging
2544
+ @api_client.config.logger.debug "API called: Client#list_template_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2545
+ end
2546
+ return data, status_code, headers
2547
+ end
2548
+
2200
2549
  # List a template's submissions
2201
2550
  # Returns a template's submissions (from every version of the template), newest first.
2202
2551
  # @param template_id [String] The template's ID.
@@ -2574,7 +2923,7 @@ end
2574
2923
  end
2575
2924
 
2576
2925
  # 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.
2926
+ # Publishes the template's draft as a new version that doesn't change. `version_type` says which part of the latest version number goes up. While the template's PDF is downloading or being processed, or DocSpring is setting up its fields, it returns a 409 that says so.
2578
2927
  # @param template_id [String] The template's ID.
2579
2928
  # @param body [PublishTemplateVersionRequest] The version to publish.
2580
2929
  # @param [Hash] opts the optional parameters
@@ -2585,7 +2934,7 @@ end
2585
2934
  end
2586
2935
 
2587
2936
  # 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.
2937
+ # Publishes the template's draft as a new version that doesn't change. `version_type` says which part of the latest version number goes up. While the template's PDF is downloading or being processed, or DocSpring is setting up its fields, it returns a 409 that says so.
2589
2938
  # @param template_id [String] The template's ID.
2590
2939
  # @param body [PublishTemplateVersionRequest] The version to publish.
2591
2940
  # @param [Hash] opts the optional parameters
@@ -2647,6 +2996,80 @@ end
2647
2996
  return data, status_code, headers
2648
2997
  end
2649
2998
 
2999
+ # Remove fields from a template
3000
+ # 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.
3001
+ # @param template_id [String] The template's ID.
3002
+ # @param body [RemoveTemplateFieldsRequest] The fields to remove from the template's draft.
3003
+ # @param [Hash] opts the optional parameters
3004
+ # @return [TemplateFields]
3005
+ def remove_template_fields(template_id, body, opts = {})
3006
+ data, _status_code, _headers = remove_template_fields_with_http_info(template_id, body, opts)
3007
+ data
3008
+ end
3009
+
3010
+ # Remove fields from a template
3011
+ # 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.
3012
+ # @param template_id [String] The template's ID.
3013
+ # @param body [RemoveTemplateFieldsRequest] The fields to remove from the template's draft.
3014
+ # @param [Hash] opts the optional parameters
3015
+ # @return [Array<(TemplateFields, Integer, Hash)>] TemplateFields data, response status code and response headers
3016
+ def remove_template_fields_with_http_info(template_id, body, opts = {})
3017
+ if @api_client.config.debugging
3018
+ @api_client.config.logger.debug 'Calling API: Client.remove_template_fields ...'
3019
+ end
3020
+ # verify the required parameter 'template_id' is set
3021
+ if @api_client.config.client_side_validation && template_id.nil?
3022
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.remove_template_fields"
3023
+ end
3024
+ # verify the required parameter 'body' is set
3025
+ if @api_client.config.client_side_validation && body.nil?
3026
+ fail ArgumentError, "Missing the required parameter 'body' when calling Client.remove_template_fields"
3027
+ end
3028
+ # resource path
3029
+ local_var_path = '/templates/{template_id}/fields/remove'.sub('{template_id}', CGI.escape(template_id.to_s))
3030
+
3031
+ # query parameters
3032
+ query_params = opts[:query_params] || {}
3033
+
3034
+ # header parameters
3035
+ header_params = opts[:header_params] || {}
3036
+ # HTTP header 'Accept' (if needed)
3037
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3038
+ # HTTP header 'Content-Type'
3039
+ content_type = @api_client.select_header_content_type(['application/json'])
3040
+ if !content_type.nil?
3041
+ header_params['Content-Type'] = content_type
3042
+ end
3043
+
3044
+ # form parameters
3045
+ form_params = opts[:form_params] || {}
3046
+
3047
+ # http body (model)
3048
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
3049
+
3050
+ # return_type
3051
+ return_type = opts[:debug_return_type] || 'TemplateFields'
3052
+
3053
+ # auth_names
3054
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
3055
+
3056
+ new_options = opts.merge(
3057
+ :operation => :"Client.remove_template_fields",
3058
+ :header_params => header_params,
3059
+ :query_params => query_params,
3060
+ :form_params => form_params,
3061
+ :body => post_body,
3062
+ :auth_names => auth_names,
3063
+ :return_type => return_type
3064
+ )
3065
+
3066
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
3067
+ if @api_client.config.debugging
3068
+ @api_client.config.logger.debug "API called: Client#remove_template_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3069
+ end
3070
+ return data, status_code, headers
3071
+ end
3072
+
2650
3073
  # Rename a folder
2651
3074
  # Renames a folder. The name must be unique within its parent folder.
2652
3075
  # @param folder_id [String] The folder's ID.
@@ -2721,6 +3144,80 @@ end
2721
3144
  return data, status_code, headers
2722
3145
  end
2723
3146
 
3147
+ # Reorder a template's fields
3148
+ # 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.
3149
+ # @param template_id [String] The template's ID.
3150
+ # @param body [ReorderTemplateFieldsRequest] The new order of the fields in the template's draft.
3151
+ # @param [Hash] opts the optional parameters
3152
+ # @return [TemplateFields]
3153
+ def reorder_template_fields(template_id, body, opts = {})
3154
+ data, _status_code, _headers = reorder_template_fields_with_http_info(template_id, body, opts)
3155
+ data
3156
+ end
3157
+
3158
+ # Reorder a template's fields
3159
+ # 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.
3160
+ # @param template_id [String] The template's ID.
3161
+ # @param body [ReorderTemplateFieldsRequest] The new order of the fields in the template's draft.
3162
+ # @param [Hash] opts the optional parameters
3163
+ # @return [Array<(TemplateFields, Integer, Hash)>] TemplateFields data, response status code and response headers
3164
+ def reorder_template_fields_with_http_info(template_id, body, opts = {})
3165
+ if @api_client.config.debugging
3166
+ @api_client.config.logger.debug 'Calling API: Client.reorder_template_fields ...'
3167
+ end
3168
+ # verify the required parameter 'template_id' is set
3169
+ if @api_client.config.client_side_validation && template_id.nil?
3170
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.reorder_template_fields"
3171
+ end
3172
+ # verify the required parameter 'body' is set
3173
+ if @api_client.config.client_side_validation && body.nil?
3174
+ fail ArgumentError, "Missing the required parameter 'body' when calling Client.reorder_template_fields"
3175
+ end
3176
+ # resource path
3177
+ local_var_path = '/templates/{template_id}/fields/reorder'.sub('{template_id}', CGI.escape(template_id.to_s))
3178
+
3179
+ # query parameters
3180
+ query_params = opts[:query_params] || {}
3181
+
3182
+ # header parameters
3183
+ header_params = opts[:header_params] || {}
3184
+ # HTTP header 'Accept' (if needed)
3185
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3186
+ # HTTP header 'Content-Type'
3187
+ content_type = @api_client.select_header_content_type(['application/json'])
3188
+ if !content_type.nil?
3189
+ header_params['Content-Type'] = content_type
3190
+ end
3191
+
3192
+ # form parameters
3193
+ form_params = opts[:form_params] || {}
3194
+
3195
+ # http body (model)
3196
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
3197
+
3198
+ # return_type
3199
+ return_type = opts[:debug_return_type] || 'TemplateFields'
3200
+
3201
+ # auth_names
3202
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
3203
+
3204
+ new_options = opts.merge(
3205
+ :operation => :"Client.reorder_template_fields",
3206
+ :header_params => header_params,
3207
+ :query_params => query_params,
3208
+ :form_params => form_params,
3209
+ :body => post_body,
3210
+ :auth_names => auth_names,
3211
+ :return_type => return_type
3212
+ )
3213
+
3214
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
3215
+ if @api_client.config.debugging
3216
+ @api_client.config.logger.debug "API called: Client#reorder_template_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3217
+ end
3218
+ return data, status_code, headers
3219
+ end
3220
+
2724
3221
  # Restore a template version
2725
3222
  # Replaces the template's draft with a copy of one of its published versions.
2726
3223
  # @param template_id [String] The template's ID.
@@ -2927,7 +3424,7 @@ end
2927
3424
  end
2928
3425
 
2929
3426
  # 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.
3427
+ # Changes a template's draft. Properties left out keep their values. `defaults` and `html_engine_options` replace the whole object, and `field_groups` changes only the groups it lists. Setting `parent_folder_id` moves the template and all of its published versions.
2931
3428
  # @param template_id [String] The template's ID.
2932
3429
  # @param body [UpdateTemplateRequest] The settings to change. Properties left out keep their values.
2933
3430
  # @param [Hash] opts the optional parameters
@@ -2938,7 +3435,7 @@ end
2938
3435
  end
2939
3436
 
2940
3437
  # 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.
3438
+ # Changes a template's draft. Properties left out keep their values. `defaults` and `html_engine_options` replace the whole object, and `field_groups` changes only the groups it lists. Setting `parent_folder_id` moves the template and all of its published versions.
2942
3439
  # @param template_id [String] The template's ID.
2943
3440
  # @param body [UpdateTemplateRequest] The settings to change. Properties left out keep their values.
2944
3441
  # @param [Hash] opts the optional parameters
@@ -3001,11 +3498,11 @@ end
3001
3498
  end
3002
3499
 
3003
3500
  # 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.
3501
+ # Replaces a PDF template's PDF with one you uploaded with the presigned upload (GET /uploads/presign) (`cache_id`), a link to download it from (`document_url`), or the file in base64 (`document_base64`). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields. To send the PDF as `multipart/form-data` instead, use PUT /templates/{template_id}/document/upload.
3005
3502
  # @param template_id [String] The template's ID.
3006
- # @param body [UpdateTemplateDocumentRequest] The new PDF.
3503
+ # @param body [UpdateTemplateDocumentRequest] The new PDF, as one of `cache_id`, `document_url` and `document_base64`.
3007
3504
  # @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.
3505
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3009
3506
  # @return [Template]
3010
3507
  def update_template_document(template_id, body, opts = {})
3011
3508
  data, _status_code, _headers = update_template_document_with_http_info(template_id, body, opts)
@@ -3013,11 +3510,11 @@ end
3013
3510
  end
3014
3511
 
3015
3512
  # 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.
3513
+ # Replaces a PDF template's PDF with one you uploaded with the presigned upload (GET /uploads/presign) (`cache_id`), a link to download it from (`document_url`), or the file in base64 (`document_base64`). The fields stay where they are, unless `reimport_fields` replaces them with the new PDF's fillable fields. To send the PDF as `multipart/form-data` instead, use PUT /templates/{template_id}/document/upload.
3017
3514
  # @param template_id [String] The template's ID.
3018
- # @param body [UpdateTemplateDocumentRequest] The new PDF.
3515
+ # @param body [UpdateTemplateDocumentRequest] The new PDF, as one of `cache_id`, `document_url` and `document_base64`.
3019
3516
  # @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.
3517
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3021
3518
  # @return [Array<(Template, Integer, Hash)>] Template data, response status code and response headers
3022
3519
  def update_template_document_with_http_info(template_id, body, opts = {})
3023
3520
  if @api_client.config.debugging
@@ -3077,6 +3574,80 @@ end
3077
3574
  return data, status_code, headers
3078
3575
  end
3079
3576
 
3577
+ # Update a template's fields
3578
+ # 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.
3579
+ # @param template_id [String] The template's ID.
3580
+ # @param body [UpdateTemplateFieldsRequest] The fields to change in the template's draft.
3581
+ # @param [Hash] opts the optional parameters
3582
+ # @return [TemplateFields]
3583
+ def update_template_fields(template_id, body, opts = {})
3584
+ data, _status_code, _headers = update_template_fields_with_http_info(template_id, body, opts)
3585
+ data
3586
+ end
3587
+
3588
+ # Update a template's fields
3589
+ # 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.
3590
+ # @param template_id [String] The template's ID.
3591
+ # @param body [UpdateTemplateFieldsRequest] The fields to change in the template's draft.
3592
+ # @param [Hash] opts the optional parameters
3593
+ # @return [Array<(TemplateFields, Integer, Hash)>] TemplateFields data, response status code and response headers
3594
+ def update_template_fields_with_http_info(template_id, body, opts = {})
3595
+ if @api_client.config.debugging
3596
+ @api_client.config.logger.debug 'Calling API: Client.update_template_fields ...'
3597
+ end
3598
+ # verify the required parameter 'template_id' is set
3599
+ if @api_client.config.client_side_validation && template_id.nil?
3600
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.update_template_fields"
3601
+ end
3602
+ # verify the required parameter 'body' is set
3603
+ if @api_client.config.client_side_validation && body.nil?
3604
+ fail ArgumentError, "Missing the required parameter 'body' when calling Client.update_template_fields"
3605
+ end
3606
+ # resource path
3607
+ local_var_path = '/templates/{template_id}/fields'.sub('{template_id}', CGI.escape(template_id.to_s))
3608
+
3609
+ # query parameters
3610
+ query_params = opts[:query_params] || {}
3611
+
3612
+ # header parameters
3613
+ header_params = opts[:header_params] || {}
3614
+ # HTTP header 'Accept' (if needed)
3615
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3616
+ # HTTP header 'Content-Type'
3617
+ content_type = @api_client.select_header_content_type(['application/json'])
3618
+ if !content_type.nil?
3619
+ header_params['Content-Type'] = content_type
3620
+ end
3621
+
3622
+ # form parameters
3623
+ form_params = opts[:form_params] || {}
3624
+
3625
+ # http body (model)
3626
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
3627
+
3628
+ # return_type
3629
+ return_type = opts[:debug_return_type] || 'TemplateFields'
3630
+
3631
+ # auth_names
3632
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
3633
+
3634
+ new_options = opts.merge(
3635
+ :operation => :"Client.update_template_fields",
3636
+ :header_params => header_params,
3637
+ :query_params => query_params,
3638
+ :form_params => form_params,
3639
+ :body => post_body,
3640
+ :auth_names => auth_names,
3641
+ :return_type => return_type
3642
+ )
3643
+
3644
+ data, status_code, headers = @api_client.call_api(:PUT, local_var_path, new_options)
3645
+ if @api_client.config.debugging
3646
+ @api_client.config.logger.debug "API called: Client#update_template_fields\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3647
+ end
3648
+ return data, status_code, headers
3649
+ end
3650
+
3080
3651
  # Update a webhook
3081
3652
  # Updates a webhook. Only the properties you send change.
3082
3653
  # @param webhook_id [String] The webhook's ID.
@@ -3155,7 +3726,7 @@ end
3155
3726
  # Creates a PDF template from a PDF sent with the request (`multipart/form-data`). For large files, upload the PDF with the presigned upload (GET /uploads/presign) and create the template with POST /templates.
3156
3727
  # @param document [File] The PDF.
3157
3728
  # @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.
3729
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3159
3730
  # @option opts [String] :name The template's name.
3160
3731
  # @option opts [String] :description The template's description.
3161
3732
  # @option opts [String] :parent_folder_id The folder to put the template in. Left out, it's created at the root.
@@ -3174,7 +3745,7 @@ end
3174
3745
  # Creates a PDF template from a PDF sent with the request (`multipart/form-data`). For large files, upload the PDF with the presigned upload (GET /uploads/presign) and create the template with POST /templates.
3175
3746
  # @param document [File] The PDF.
3176
3747
  # @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.
3748
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3178
3749
  # @option opts [String] :name The template's name.
3179
3750
  # @option opts [String] :description The template's description.
3180
3751
  # @option opts [String] :parent_folder_id The folder to put the template in. Left out, it's created at the root.
@@ -3252,7 +3823,7 @@ end
3252
3823
  # @param template_id [String] The template's ID.
3253
3824
  # @param document [File] The new PDF.
3254
3825
  # @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.
3826
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3256
3827
  # @option opts [Boolean] :reimport_fields Replace all of the template's fields with the fillable fields in the new PDF, once DocSpring has processed it (`document.field_reimport_state`). As on a first upload, the default typeface, font size, bold and color are taken from the PDF's fields; the template's other settings are kept. If the PDF has no fillable fields, the template keeps its fields. A locked template can't re-import its fields.
3257
3828
  # @return [Template]
3258
3829
  def upload_template_document(template_id, document, opts = {})
@@ -3265,7 +3836,7 @@ end
3265
3836
  # @param template_id [String] The template's ID.
3266
3837
  # @param document [File] The new PDF.
3267
3838
  # @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.
3839
+ # @option opts [Boolean] :wait Wait until the PDF has been processed, and a `document_url` downloaded, before responding. Default true on sync.api hosts.
3269
3840
  # @option opts [Boolean] :reimport_fields Replace all of the template's fields with the fillable fields in the new PDF, once DocSpring has processed it (`document.field_reimport_state`). As on a first upload, the default typeface, font size, bold and color are taken from the PDF's fields; the template's other settings are kept. If the PDF has no fillable fields, the template keeps its fields. A locked template can't re-import its fields.
3270
3841
  # @return [Array<(Template, Integer, Hash)>] Template data, response status code and response headers
3271
3842
  def upload_template_document_with_http_info(template_id, document, opts = {})
@@ -3327,5 +3898,82 @@ end
3327
3898
  end
3328
3899
  return data, status_code, headers
3329
3900
  end
3901
+
3902
+ # Check a submission without creating it
3903
+ # 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.
3904
+ # @param template_id [String] The template's ID.
3905
+ # @param body [ValidateSubmissionRequest] The submission's data and settings.
3906
+ # @param [Hash] opts the optional parameters
3907
+ # @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).
3908
+ # @return [SubmissionValidation]
3909
+ def validate_submission(template_id, body, opts = {})
3910
+ data, _status_code, _headers = validate_submission_with_http_info(template_id, body, opts)
3911
+ data
3912
+ end
3913
+
3914
+ # Check a submission without creating it
3915
+ # 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.
3916
+ # @param template_id [String] The template's ID.
3917
+ # @param body [ValidateSubmissionRequest] The submission's data and settings.
3918
+ # @param [Hash] opts the optional parameters
3919
+ # @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).
3920
+ # @return [Array<(SubmissionValidation, Integer, Hash)>] SubmissionValidation data, response status code and response headers
3921
+ def validate_submission_with_http_info(template_id, body, opts = {})
3922
+ if @api_client.config.debugging
3923
+ @api_client.config.logger.debug 'Calling API: Client.validate_submission ...'
3924
+ end
3925
+ # verify the required parameter 'template_id' is set
3926
+ if @api_client.config.client_side_validation && template_id.nil?
3927
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.validate_submission"
3928
+ end
3929
+ # verify the required parameter 'body' is set
3930
+ if @api_client.config.client_side_validation && body.nil?
3931
+ fail ArgumentError, "Missing the required parameter 'body' when calling Client.validate_submission"
3932
+ end
3933
+ # resource path
3934
+ local_var_path = '/templates/{template_id}/submissions/validate'.sub('{template_id}', CGI.escape(template_id.to_s))
3935
+
3936
+ # query parameters
3937
+ query_params = opts[:query_params] || {}
3938
+ query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
3939
+
3940
+ # header parameters
3941
+ header_params = opts[:header_params] || {}
3942
+ # HTTP header 'Accept' (if needed)
3943
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
3944
+ # HTTP header 'Content-Type'
3945
+ content_type = @api_client.select_header_content_type(['application/json'])
3946
+ if !content_type.nil?
3947
+ header_params['Content-Type'] = content_type
3948
+ end
3949
+
3950
+ # form parameters
3951
+ form_params = opts[:form_params] || {}
3952
+
3953
+ # http body (model)
3954
+ post_body = opts[:debug_body] || @api_client.object_to_http_body(body)
3955
+
3956
+ # return_type
3957
+ return_type = opts[:debug_return_type] || 'SubmissionValidation'
3958
+
3959
+ # auth_names
3960
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
3961
+
3962
+ new_options = opts.merge(
3963
+ :operation => :"Client.validate_submission",
3964
+ :header_params => header_params,
3965
+ :query_params => query_params,
3966
+ :form_params => form_params,
3967
+ :body => post_body,
3968
+ :auth_names => auth_names,
3969
+ :return_type => return_type
3970
+ )
3971
+
3972
+ data, status_code, headers = @api_client.call_api(:POST, local_var_path, new_options)
3973
+ if @api_client.config.debugging
3974
+ @api_client.config.logger.debug "API called: Client#validate_submission\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
3975
+ end
3976
+ return data, status_code, headers
3977
+ end
3330
3978
  end
3331
3979
  end