docspring 4.1.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 (69) hide show
  1. checksums.yaml +4 -4
  2. data/.openapi-generator/FILES +15 -0
  3. data/.travis.yml +1 -1
  4. data/AGENTS.md +3 -2
  5. data/CHANGELOG.md +40 -0
  6. data/Gemfile.lock +9 -9
  7. data/README.md +5 -1
  8. data/docs/Client.md +176 -10
  9. data/docs/CombinedPdf.md +1 -1
  10. data/docs/CreateCombinedPdfRequest.md +1 -1
  11. data/docs/CreateSubmissionRequest.md +2 -2
  12. data/docs/CreateTemplatePreviewRequest.md +18 -0
  13. data/docs/CreateTemplateRequest.md +3 -1
  14. data/docs/ErrorDetail.md +1 -1
  15. data/docs/ErrorInfo.md +4 -4
  16. data/docs/Submission.md +15 -15
  17. data/docs/SubmissionInput.md +2 -2
  18. data/docs/SubmissionList.md +1 -1
  19. data/docs/SubmissionSummary.md +54 -0
  20. data/docs/Template.md +12 -10
  21. data/docs/TemplateActor.md +1 -1
  22. data/docs/TemplateDocument.md +5 -5
  23. data/docs/TemplateDocumentSummary.md +24 -0
  24. data/docs/TemplatePreview.md +32 -0
  25. data/docs/TemplatePreviewState.md +15 -0
  26. data/docs/TemplateSummary.md +2 -48
  27. data/docs/UpdateTemplateRequest.md +4 -2
  28. data/docs/ValidateSubmissionRequest.md +2 -2
  29. data/lib/docspring/api/client.rb +178 -8
  30. data/lib/docspring/api_client.rb +4 -2
  31. data/lib/docspring/date_time_values.rb +33 -0
  32. data/lib/docspring/models/combined_pdf.rb +1 -1
  33. data/lib/docspring/models/create_combined_pdf_request.rb +1 -1
  34. data/lib/docspring/models/create_submission_request.rb +2 -2
  35. data/lib/docspring/models/create_template_preview_request.rb +187 -0
  36. data/lib/docspring/models/create_template_request.rb +12 -2
  37. data/lib/docspring/models/error_code.rb +3 -1
  38. data/lib/docspring/models/error_detail.rb +1 -1
  39. data/lib/docspring/models/error_info.rb +4 -4
  40. data/lib/docspring/models/submission.rb +140 -140
  41. data/lib/docspring/models/submission_input.rb +2 -2
  42. data/lib/docspring/models/submission_list.rb +1 -1
  43. data/lib/docspring/models/submission_summary.rb +601 -0
  44. data/lib/docspring/models/template.rb +96 -83
  45. data/lib/docspring/models/template_actor.rb +1 -1
  46. data/lib/docspring/models/template_document.rb +42 -42
  47. data/lib/docspring/models/template_document_summary.rb +260 -0
  48. data/lib/docspring/models/template_preview.rb +356 -0
  49. data/lib/docspring/models/template_preview_state.rb +42 -0
  50. data/lib/docspring/models/template_summary.rb +5 -572
  51. data/lib/docspring/models/update_template_request.rb +16 -6
  52. data/lib/docspring/models/validate_submission_request.rb +2 -2
  53. data/lib/docspring/request_schemas.json +105 -8
  54. data/lib/docspring/version.rb +1 -1
  55. data/lib/docspring/webhook_signature.rb +45 -0
  56. data/lib/docspring.rb +6 -0
  57. data/spec/api/client_spec.rb +39 -4
  58. data/spec/models/create_template_preview_request_spec.rb +36 -0
  59. data/spec/models/create_template_request_spec.rb +6 -0
  60. data/spec/models/submission_spec.rb +12 -12
  61. data/spec/models/submission_summary_spec.rb +144 -0
  62. data/spec/models/template_document_spec.rb +5 -5
  63. data/spec/models/template_document_summary_spec.rb +54 -0
  64. data/spec/models/template_preview_spec.rb +78 -0
  65. data/spec/models/template_preview_state_spec.rb +30 -0
  66. data/spec/models/template_spec.rb +28 -22
  67. data/spec/models/template_summary_spec.rb +0 -138
  68. data/spec/models/update_template_request_spec.rb +6 -0
  69. metadata +23 -1
@@ -215,6 +215,7 @@ end
215
215
  # @param body [CreateCombinedPdfRequest] The PDFs to merge, and the combined PDF's settings.
216
216
  # @param [Hash] opts the optional parameters
217
217
  # @option opts [Boolean] :wait Wait until the PDF has been generated before responding. Default true on sync.api hosts.
218
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another combined PDF. Send a new key with each new combined PDF, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
218
219
  # @return [CombinedPdf]
219
220
  def create_combined_pdf(body, opts = {})
220
221
  data, _status_code, _headers = create_combined_pdf_with_http_info(body, opts)
@@ -226,6 +227,7 @@ end
226
227
  # @param body [CreateCombinedPdfRequest] The PDFs to merge, and the combined PDF's settings.
227
228
  # @param [Hash] opts the optional parameters
228
229
  # @option opts [Boolean] :wait Wait until the PDF has been generated before responding. Default true on sync.api hosts.
230
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another combined PDF. Send a new key with each new combined PDF, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
229
231
  # @return [Array<(CombinedPdf, Integer, Hash)>] CombinedPdf data, response status code and response headers
230
232
  def create_combined_pdf_with_http_info(body, opts = {})
231
233
  if @api_client.config.debugging
@@ -251,6 +253,7 @@ end
251
253
  if !content_type.nil?
252
254
  header_params['Content-Type'] = content_type
253
255
  end
256
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
254
257
 
255
258
  # form parameters
256
259
  form_params = opts[:form_params] || {}
@@ -418,7 +421,7 @@ end
418
421
  end
419
422
 
420
423
  # Record a signature request event
421
- # Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (`send_request`). The audit trail shows it as reported by your account.
424
+ # Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (`send_request`). The audit trail shows it as reported by your account. A finished (completed, declined or expired) signature request's audit trail takes no more events, and a test API token can't record one for a live signature request.
422
425
  # @param signature_request_id [String] The signature request's ID.
423
426
  # @param body [CreateSignatureRequestEventRequest] The event to record.
424
427
  # @param [Hash] opts the optional parameters
@@ -429,7 +432,7 @@ end
429
432
  end
430
433
 
431
434
  # Record a signature request event
432
- # Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (`send_request`). The audit trail shows it as reported by your account.
435
+ # Records something that happened outside DocSpring in the signature request's audit trail: you sent the request to the person (`send_request`). The audit trail shows it as reported by your account. A finished (completed, declined or expired) signature request's audit trail takes no more events, and a test API token can't record one for a live signature request.
433
436
  # @param signature_request_id [String] The signature request's ID.
434
437
  # @param body [CreateSignatureRequestEventRequest] The event to record.
435
438
  # @param [Hash] opts the optional parameters
@@ -568,6 +571,7 @@ end
568
571
  # @param [Hash] opts the optional parameters
569
572
  # @option opts [String] :version The template version to use: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published).
570
573
  # @option opts [Boolean] :wait Wait until the files have been generated before responding. Default true on sync.api hosts.
574
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another submission. Send a new key with each new submission, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
571
575
  # @return [Submission]
572
576
  def create_submission(template_id, body, opts = {})
573
577
  data, _status_code, _headers = create_submission_with_http_info(template_id, body, opts)
@@ -581,6 +585,7 @@ end
581
585
  # @param [Hash] opts the optional parameters
582
586
  # @option opts [String] :version The template version to use: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published).
583
587
  # @option opts [Boolean] :wait Wait until the files have been generated before responding. Default true on sync.api hosts.
588
+ # @option opts [String] :idempotency_key A key of your own, such as a UUID, that makes it safe to send this request again: for 24 hours, DocSpring answers a request with the same key from the same API token with the first request's response (and an `Idempotent-Replayed: true` header) instead of creating another submission. Send a new key with each new submission, and the same key each time you send the same request again, such as after a timeout, a network error or a 5xx. The same key with a different request is a 422 `idempotency_key_reused`. A 409 `idempotency_key_in_use` means the first request is still being processed: send the request again in a few seconds.
584
589
  # @return [Array<(Submission, Integer, Hash)>] Submission data, response status code and response headers
585
590
  def create_submission_with_http_info(template_id, body, opts = {})
586
591
  if @api_client.config.debugging
@@ -611,6 +616,7 @@ end
611
616
  if !content_type.nil?
612
617
  header_params['Content-Type'] = content_type
613
618
  end
619
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
614
620
 
615
621
  # form parameters
616
622
  form_params = opts[:form_params] || {}
@@ -646,6 +652,7 @@ end
646
652
  # @param body [CreateSubmissionBatchRequest] The submissions to create, and the settings they share.
647
653
  # @param [Hash] opts the optional parameters
648
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.
649
656
  # @return [SubmissionBatch]
650
657
  def create_submission_batch(body, opts = {})
651
658
  data, _status_code, _headers = create_submission_batch_with_http_info(body, opts)
@@ -657,6 +664,7 @@ end
657
664
  # @param body [CreateSubmissionBatchRequest] The submissions to create, and the settings they share.
658
665
  # @param [Hash] opts the optional parameters
659
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.
660
668
  # @return [Array<(SubmissionBatch, Integer, Hash)>] SubmissionBatch data, response status code and response headers
661
669
  def create_submission_batch_with_http_info(body, opts = {})
662
670
  if @api_client.config.debugging
@@ -682,6 +690,7 @@ end
682
690
  if !content_type.nil?
683
691
  header_params['Content-Type'] = content_type
684
692
  end
693
+ header_params[:'Idempotency-Key'] = opts[:'idempotency_key'] if !opts[:'idempotency_key'].nil?
685
694
 
686
695
  # form parameters
687
696
  form_params = opts[:form_params] || {}
@@ -783,6 +792,83 @@ end
783
792
  return data, status_code, headers
784
793
  end
785
794
 
795
+ # Preview a template with data
796
+ # Makes PNG images of a template's pages filled in with the data you send (not a PDF), so you can check how an HTML 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
+
786
872
  # Create a webhook
787
873
  # Creates a webhook that sends a POST request to your endpoint whenever a subscribed event happens. Scope it to API tokens, templates or folders to receive only their events.
788
874
  # @param body [CreateWebhookRequest] The webhook to create.
@@ -1943,11 +2029,12 @@ end
1943
2029
  end
1944
2030
 
1945
2031
  # Generate typed code for a template's submission data
1946
- # Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir or Go, so your app catches mistakes before it calls the API. `root_type_name` is the type of the whole `data` object. Java returns every class in `code`, each under a `// ClassName.java` comment. A template with no named fields returns 422.
2032
+ # Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir 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.
1947
2033
  # @param template_id [String] The template's ID.
1948
2034
  # @param lang [ModelCodeLanguage] The language to generate the code in.
1949
2035
  # @param [Hash] opts the optional parameters
1950
2036
  # @option opts [String] :version The template version: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published), the version a submission uses by default.
2037
+ # @option opts [Boolean] :just_types Return only the types (interfaces, classes or structs), without the code that converts JSON to and from them. Default false. JavaScript has no types and PHP no types-only code, so theirs is the same either way.
1951
2038
  # @return [TemplateModelCode]
1952
2039
  def get_template_model_code(template_id, lang, opts = {})
1953
2040
  data, _status_code, _headers = get_template_model_code_with_http_info(template_id, lang, opts)
@@ -1955,11 +2042,12 @@ end
1955
2042
  end
1956
2043
 
1957
2044
  # Generate typed code for a template's submission data
1958
- # Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir or Go, so your app catches mistakes before it calls the API. `root_type_name` is the type of the whole `data` object. Java returns every class in `code`, each under a `// ClassName.java` comment. A template with no named fields returns 422.
2045
+ # Generates types for a template's submission data in TypeScript, JavaScript, Ruby, Python, PHP, Java, C#, Elixir 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.
1959
2046
  # @param template_id [String] The template's ID.
1960
2047
  # @param lang [ModelCodeLanguage] The language to generate the code in.
1961
2048
  # @param [Hash] opts the optional parameters
1962
2049
  # @option opts [String] :version The template version: a published version (`1.2.0`, or `1` for the latest 1.x.x), `latest` or `draft`. Default `latest` (the draft when no version has been published), the version a submission uses by default.
2050
+ # @option opts [Boolean] :just_types Return only the types (interfaces, classes or structs), without the code that converts JSON to and from them. Default false. JavaScript has no types and PHP no types-only code, so theirs is the same either way.
1963
2051
  # @return [Array<(TemplateModelCode, Integer, Hash)>] TemplateModelCode data, response status code and response headers
1964
2052
  def get_template_model_code_with_http_info(template_id, lang, opts = {})
1965
2053
  if @api_client.config.debugging
@@ -1980,6 +2068,7 @@ end
1980
2068
  query_params = opts[:query_params] || {}
1981
2069
  query_params[:'lang'] = lang
1982
2070
  query_params[:'version'] = opts[:'version'] if !opts[:'version'].nil?
2071
+ query_params[:'just_types'] = opts[:'just_types'] if !opts[:'just_types'].nil?
1983
2072
 
1984
2073
  # header parameters
1985
2074
  header_params = opts[:header_params] || {}
@@ -2081,6 +2170,75 @@ end
2081
2170
  return data, status_code, headers
2082
2171
  end
2083
2172
 
2173
+ # Get a template preview
2174
+ # Returns a preview made with POST /templates/{template_id}/previews. Once it's `processed`, `pages` has a PNG image of each page with a temporary link to download it: a preview has no PDF. Previews are deleted an hour after they're created.
2175
+ # @param template_id [String] The template's ID.
2176
+ # @param preview_id [String] The preview's ID.
2177
+ # @param [Hash] opts the optional parameters
2178
+ # @return [TemplatePreview]
2179
+ def get_template_preview(template_id, preview_id, opts = {})
2180
+ data, _status_code, _headers = get_template_preview_with_http_info(template_id, preview_id, opts)
2181
+ data
2182
+ end
2183
+
2184
+ # Get a template preview
2185
+ # Returns a preview made with POST /templates/{template_id}/previews. Once it's `processed`, `pages` has a PNG image of each page with a temporary link to download it: a preview has no PDF. Previews are deleted an hour after they're created.
2186
+ # @param template_id [String] The template's ID.
2187
+ # @param preview_id [String] The preview's ID.
2188
+ # @param [Hash] opts the optional parameters
2189
+ # @return [Array<(TemplatePreview, Integer, Hash)>] TemplatePreview data, response status code and response headers
2190
+ def get_template_preview_with_http_info(template_id, preview_id, opts = {})
2191
+ if @api_client.config.debugging
2192
+ @api_client.config.logger.debug 'Calling API: Client.get_template_preview ...'
2193
+ end
2194
+ # verify the required parameter 'template_id' is set
2195
+ if @api_client.config.client_side_validation && template_id.nil?
2196
+ fail ArgumentError, "Missing the required parameter 'template_id' when calling Client.get_template_preview"
2197
+ end
2198
+ # verify the required parameter 'preview_id' is set
2199
+ if @api_client.config.client_side_validation && preview_id.nil?
2200
+ fail ArgumentError, "Missing the required parameter 'preview_id' when calling Client.get_template_preview"
2201
+ end
2202
+ # resource path
2203
+ local_var_path = '/templates/{template_id}/previews/{preview_id}'.sub('{template_id}', CGI.escape(template_id.to_s)).sub('{preview_id}', CGI.escape(preview_id.to_s))
2204
+
2205
+ # query parameters
2206
+ query_params = opts[:query_params] || {}
2207
+
2208
+ # header parameters
2209
+ header_params = opts[:header_params] || {}
2210
+ # HTTP header 'Accept' (if needed)
2211
+ header_params['Accept'] = @api_client.select_header_accept(['application/json']) unless header_params['Accept']
2212
+
2213
+ # form parameters
2214
+ form_params = opts[:form_params] || {}
2215
+
2216
+ # http body (model)
2217
+ post_body = opts[:debug_body]
2218
+
2219
+ # return_type
2220
+ return_type = opts[:debug_return_type] || 'TemplatePreview'
2221
+
2222
+ # auth_names
2223
+ auth_names = opts[:debug_auth_names] || ['api_token_basic']
2224
+
2225
+ new_options = opts.merge(
2226
+ :operation => :"Client.get_template_preview",
2227
+ :header_params => header_params,
2228
+ :query_params => query_params,
2229
+ :form_params => form_params,
2230
+ :body => post_body,
2231
+ :auth_names => auth_names,
2232
+ :return_type => return_type
2233
+ )
2234
+
2235
+ data, status_code, headers = @api_client.call_api(:GET, local_var_path, new_options)
2236
+ if @api_client.config.debugging
2237
+ @api_client.config.logger.debug "API called: Client#get_template_preview\nData: #{data.inspect}\nStatus code: #{status_code}\nHeaders: #{headers}"
2238
+ end
2239
+ return data, status_code, headers
2240
+ end
2241
+
2084
2242
  # Get the JSON Schema of a template's submission data
2085
2243
  # Returns the JSON Schema that a submission's `data` must match. Use it to check data before you create submissions, or to build a form for the template's fields.
2086
2244
  # @param template_id [String] The template's ID.
@@ -2403,7 +2561,7 @@ end
2403
2561
  end
2404
2562
 
2405
2563
  # List submissions
2406
- # Returns the submissions in your account, newest first, one page at a time. Lists leave out each submission's `data` unless you pass `include_data=true`.
2564
+ # Returns the submissions in your account, newest first, one page at a time. Each one is a summary: its `data` is null unless you pass `include_data=true`, and its `files` are empty unless you pass `include_files=true`. Get a submission by its ID for its signature requests, uploads and page images.
2407
2565
  # @param [Hash] opts the optional parameters
2408
2566
  # @option opts [String] :template_id Only list this template's submissions.
2409
2567
  # @option opts [Boolean] :test Only list test submissions (true) or live submissions (false).
@@ -2412,6 +2570,8 @@ end
2412
2570
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
2413
2571
  # @option opts [Integer] :limit How many items to return (1-100, default 50). (default to 50)
2414
2572
  # @option opts [String] :cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
2573
+ # @option opts [SubmissionState] :state Only list submissions in this state (one state per request). The ones that failed are `invalid_data`, `error`, `syntax_error`, `image_download_failed` and `image_processing_failed`, and one still `pending` an hour after it was created is stuck.
2574
+ # @option opts [Boolean] :include_files Include each submission's generated files and their download links (`files`, empty without it), without the page images' links.
2415
2575
  # @return [SubmissionList]
2416
2576
  def list_submissions(opts = {})
2417
2577
  data, _status_code, _headers = list_submissions_with_http_info(opts)
@@ -2419,7 +2579,7 @@ end
2419
2579
  end
2420
2580
 
2421
2581
  # List submissions
2422
- # Returns the submissions in your account, newest first, one page at a time. Lists leave out each submission's `data` unless you pass `include_data=true`.
2582
+ # Returns the submissions in your account, newest first, one page at a time. Each one is a summary: its `data` is null unless you pass `include_data=true`, and its `files` are empty unless you pass `include_files=true`. Get a submission by its ID for its signature requests, uploads and page images.
2423
2583
  # @param [Hash] opts the optional parameters
2424
2584
  # @option opts [String] :template_id Only list this template's submissions.
2425
2585
  # @option opts [Boolean] :test Only list test submissions (true) or live submissions (false).
@@ -2428,6 +2588,8 @@ end
2428
2588
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
2429
2589
  # @option opts [Integer] :limit How many items to return (1-100, default 50). (default to 50)
2430
2590
  # @option opts [String] :cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
2591
+ # @option opts [SubmissionState] :state Only list submissions in this state (one state per request). The ones that failed are `invalid_data`, `error`, `syntax_error`, `image_download_failed` and `image_processing_failed`, and one still `pending` an hour after it was created is stuck.
2592
+ # @option opts [Boolean] :include_files Include each submission's generated files and their download links (`files`, empty without it), without the page images' links.
2431
2593
  # @return [Array<(SubmissionList, Integer, Hash)>] SubmissionList data, response status code and response headers
2432
2594
  def list_submissions_with_http_info(opts = {})
2433
2595
  if @api_client.config.debugging
@@ -2445,6 +2607,8 @@ end
2445
2607
  query_params[:'include_data'] = opts[:'include_data'] if !opts[:'include_data'].nil?
2446
2608
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
2447
2609
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
2610
+ query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
2611
+ query_params[:'include_files'] = opts[:'include_files'] if !opts[:'include_files'].nil?
2448
2612
 
2449
2613
  # header parameters
2450
2614
  header_params = opts[:header_params] || {}
@@ -2556,6 +2720,8 @@ end
2556
2720
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
2557
2721
  # @option opts [Integer] :limit How many items to return (1-100, default 50). (default to 50)
2558
2722
  # @option opts [String] :cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
2723
+ # @option opts [SubmissionState] :state Only list submissions in this state (one state per request). The ones that failed are `invalid_data`, `error`, `syntax_error`, `image_download_failed` and `image_processing_failed`, and one still `pending` an hour after it was created is stuck.
2724
+ # @option opts [Boolean] :include_files Include each submission's generated files and their download links (`files`, empty without it), without the page images' links.
2559
2725
  # @return [SubmissionList]
2560
2726
  def list_template_submissions(template_id, opts = {})
2561
2727
  data, _status_code, _headers = list_template_submissions_with_http_info(template_id, opts)
@@ -2572,6 +2738,8 @@ end
2572
2738
  # @option opts [Boolean] :include_data Include each submission's `data` (null without it).
2573
2739
  # @option opts [Integer] :limit How many items to return (1-100, default 50). (default to 50)
2574
2740
  # @option opts [String] :cursor The previous page's `next_cursor`, to get the next page. It's the ID of that page's last item, so get the next page before you delete or change the items on this one.
2741
+ # @option opts [SubmissionState] :state Only list submissions in this state (one state per request). The ones that failed are `invalid_data`, `error`, `syntax_error`, `image_download_failed` and `image_processing_failed`, and one still `pending` an hour after it was created is stuck.
2742
+ # @option opts [Boolean] :include_files Include each submission's generated files and their download links (`files`, empty without it), without the page images' links.
2575
2743
  # @return [Array<(SubmissionList, Integer, Hash)>] SubmissionList data, response status code and response headers
2576
2744
  def list_template_submissions_with_http_info(template_id, opts = {})
2577
2745
  if @api_client.config.debugging
@@ -2592,6 +2760,8 @@ end
2592
2760
  query_params[:'include_data'] = opts[:'include_data'] if !opts[:'include_data'].nil?
2593
2761
  query_params[:'limit'] = opts[:'limit'] if !opts[:'limit'].nil?
2594
2762
  query_params[:'cursor'] = opts[:'cursor'] if !opts[:'cursor'].nil?
2763
+ query_params[:'state'] = opts[:'state'] if !opts[:'state'].nil?
2764
+ query_params[:'include_files'] = opts[:'include_files'] if !opts[:'include_files'].nil?
2595
2765
 
2596
2766
  # header parameters
2597
2767
  header_params = opts[:header_params] || {}
@@ -2628,7 +2798,7 @@ end
2628
2798
  end
2629
2799
 
2630
2800
  # List templates
2631
- # Returns the templates in your account (their drafts), newest first, one page at a time. Get a template by its ID for its HTML, defaults and published versions.
2801
+ # Returns the templates in your account (their drafts), newest first, one page at a time. Each one is a summary: get a template by its ID for its settings, its PDF in full, its HTML, defaults and published versions.
2632
2802
  # @param [Hash] opts the optional parameters
2633
2803
  # @option opts [String] :query Only list templates whose name contains this text (ignoring case).
2634
2804
  # @option opts [String] :parent_folder_id Only list the templates in this folder (not in its subfolders).
@@ -2641,7 +2811,7 @@ end
2641
2811
  end
2642
2812
 
2643
2813
  # List templates
2644
- # Returns the templates in your account (their drafts), newest first, one page at a time. Get a template by its ID for its HTML, defaults and published versions.
2814
+ # Returns the templates in your account (their drafts), newest first, one page at a time. Each one is a summary: get a template by its ID for its settings, its PDF in full, its HTML, defaults and published versions.
2645
2815
  # @param [Hash] opts the optional parameters
2646
2816
  # @option opts [String] :query Only list templates whose name contains this text (ignoring case).
2647
2817
  # @option opts [String] :parent_folder_id Only list the templates in this folder (not in its subfolders).
@@ -16,6 +16,7 @@ require 'logger'
16
16
  require 'tempfile'
17
17
  require 'time'
18
18
  require 'typhoeus'
19
+ require 'docspring/date_time_values'
19
20
  require 'docspring/ethon_multipart_put_fix'
20
21
 
21
22
 
@@ -33,7 +34,7 @@ module DocSpring
33
34
  # @option config [Configuration] Configuration for initializing the object, default to Configuration.default
34
35
  def initialize(config = Configuration.default)
35
36
  @config = config
36
- @user_agent = "docspring-ruby-4.1.0"
37
+ @user_agent = "docspring-ruby-4.2.0"
37
38
  @default_headers = {
38
39
  'Content-Type' => 'application/json',
39
40
  'User-Agent' => @user_agent
@@ -49,6 +50,7 @@ module DocSpring
49
50
  # @return [Array<(Object, Integer, Hash)>] an array of 3 elements:
50
51
  # the data deserialized from response body (may be a Tempfile or nil), response status code and response headers.
51
52
  def call_api(http_method, path, opts = {})
53
+ opts = opts.merge(query_params: DateTimeValues.serialize(opts[:query_params], query: true)) if opts[:query_params]
52
54
  if @config.client_side_validation
53
55
  form_params = opts[:form_params] || {}
54
56
  RequestValidator.validate!(opts[:operation], query: opts[:query_params] || {}, body: form_params.empty? ? opts[:body] : form_params)
@@ -365,7 +367,7 @@ end
365
367
  else
366
368
  local_body = object_to_hash(model)
367
369
  end
368
- local_body.to_json
370
+ DateTimeValues.serialize(local_body).to_json
369
371
  end
370
372
 
371
373
  # Convert object(non-array) to hash.
@@ -0,0 +1,33 @@
1
+ # frozen_string_literal: true
2
+
3
+ require 'date'
4
+ require 'time'
5
+
6
+ module DocSpring
7
+ # Dates and times in a request (a query parameter like created_after, or a model's date-time attribute), sent as the
8
+ # API reads them: RFC 3339 strings. Without this, a Time was sent as Time#to_s ("2026-10-20 09:00:00 UTC"), which
9
+ # the API rejects.
10
+ module DateTimeValues
11
+ # The value with each Time, DateTime and Date in it (inside hashes and arrays too) as a string. A Time or DateTime
12
+ # is RFC 3339, with its UTC offset, and its fraction of a second when it has one. A Date in the query is midnight
13
+ # UTC on that day, since the API's date filters (created_after) take a date-time. In a body it stays a date
14
+ # ("2026-10-28"), as JSON sent it before: a template's date fields take that, and reject a date-time.
15
+ # Anything else is left as it is.
16
+ def self.serialize(value, query: false)
17
+ case value
18
+ when Hash then value.transform_values { |item| serialize(item, query: query) }
19
+ when Array then value.map { |item| serialize(item, query: query) }
20
+ else
21
+ # is_a?, not case/when: ActiveSupport::TimeWithZone says it's a Time only through is_a?
22
+ if value.is_a?(Time) || value.is_a?(DateTime)
23
+ time = value.is_a?(DateTime) ? value.to_time : value
24
+ time.subsec == 0 ? time.iso8601 : time.iso8601(6)
25
+ elsif value.is_a?(Date)
26
+ query ? Time.utc(value.year, value.month, value.day).iso8601 : value.iso8601
27
+ else
28
+ value
29
+ end
30
+ end
31
+ end
32
+ end
33
+ end
@@ -25,7 +25,7 @@ module DocSpring
25
25
  # The PDFs to merge, in order.
26
26
  attr_accessor :source_pdfs
27
27
 
28
- # Your own data about the combined PDF, such as an ID from your app.
28
+ # Your own data about the combined PDF, such as an ID from your app. Its `pdf_filename` key names the PDF's file (`files.pdf.filename`, and its download): a `.pdf` ending is removed, each run of characters other than letters, digits, `-`, `_` and `.` becomes one `_`, and the first 128 characters are kept, then `.pdf` is added. Without it, the file is named after the combined PDF's ID (`com_1234567890abcdef01.pdf`).
29
29
  attr_accessor :metadata
30
30
 
31
31
  # Whether the PDF needs a password to open (`password`).
@@ -19,7 +19,7 @@ module DocSpring
19
19
  # The PDFs to merge, in order.
20
20
  attr_accessor :source_pdfs
21
21
 
22
- # Your own data about the combined PDF, such as an ID from your app.
22
+ # Your own data about the combined PDF, such as an ID from your app. Its `pdf_filename` key names the PDF's file (`files.pdf.filename`, and its download): a `.pdf` ending is removed, each run of characters other than letters, digits, `-`, `_` and `.` becomes one `_`, and the first 128 characters are kept, then `.pdf` is added. Without it, the file is named after the combined PDF's ID (`com_1234567890abcdef01.pdf`).
23
23
  attr_accessor :metadata
24
24
 
25
25
  # A password that the PDF needs to be opened with. It's never returned; `has_password` says if it's set.
@@ -25,7 +25,7 @@ module DocSpring
25
25
  # The values of the template's fields, by field name. Required for a PDF template, unless `signature_requests` collects the values.
26
26
  attr_accessor :data
27
27
 
28
- # Your own data about the submission, such as an ID from your app. It isn't printed on the PDF.
28
+ # Your own data about the submission, such as an ID from your app. It isn't printed on the PDF. Two keys also change the PDF: `pdf_filename` names its file (`files.pdf.filename`, and its download), and `pdf_title` is its title in the PDF's document properties (and an HTML template's `<title>`, unless its HTML has one). Without `pdf_title`, the title is the template's name. In `pdf_filename`, a `.pdf` ending is removed, each run of characters other than letters, digits, `-`, `_` and `.` becomes one `_`, and the first 128 characters are kept, then `.pdf` is added. Without it, the file is named after the submission's ID (`sub_1234567890abcdef01.pdf`).
29
29
  attr_accessor :metadata
30
30
 
31
31
  # A password that the PDF needs to be opened with. It's never returned; `has_password` says if it's set.
@@ -43,7 +43,7 @@ module DocSpring
43
43
  # For an HTML template, HTML to use instead of the template's.
44
44
  attr_accessor :html
45
45
 
46
- # For an HTML template, CSS to use instead of the template's.
46
+ # For an HTML template, SCSS (plain CSS works too) added after the template's styles, on the page and in its header and footer. It doesn't replace them: its rules come later, so they win over the template's rules of the same specificity.
47
47
  attr_accessor :css
48
48
 
49
49
  # The people who sign the PDF, and fill in their fields first. The PDF is generated once every signature request is completed. PDF templates only. Without `role`s, the first signature request is `Signer 1`, the second `Signer 2`, and so on. To leave a signer out, give every signature request its `role` and leave that one's out. Only the signers sign: a value for a signature or initials field in `data` makes the submission `invalid_data`.