restpki-ng-python-client 0.9.0__py3-none-any.whl

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 (181) hide show
  1. restpki_ng_python_client/__init__.py +200 -0
  2. restpki_ng_python_client/api/__init__.py +17 -0
  3. restpki_ng_python_client/api/authentication_api.py +2041 -0
  4. restpki_ng_python_client/api/cades_signature_api.py +2376 -0
  5. restpki_ng_python_client/api/document_keys_api.py +1199 -0
  6. restpki_ng_python_client/api/documents_api.py +868 -0
  7. restpki_ng_python_client/api/pades_signature_api.py +1797 -0
  8. restpki_ng_python_client/api/pades_visual_positioning_presets_api.py +869 -0
  9. restpki_ng_python_client/api/pdf_api.py +334 -0
  10. restpki_ng_python_client/api/signature_api.py +624 -0
  11. restpki_ng_python_client/api/signature_inspection_api.py +337 -0
  12. restpki_ng_python_client/api/signature_sessions_api.py +891 -0
  13. restpki_ng_python_client/api/timestamp_api.py +654 -0
  14. restpki_ng_python_client/api/upload_api.py +1124 -0
  15. restpki_ng_python_client/api/xml_signature_api.py +1781 -0
  16. restpki_ng_python_client/api_client.py +741 -0
  17. restpki_ng_python_client/api_response.py +21 -0
  18. restpki_ng_python_client/configuration.py +426 -0
  19. restpki_ng_python_client/exceptions.py +166 -0
  20. restpki_ng_python_client/file_utils.py +122 -0
  21. restpki_ng_python_client/models/__init__.py +165 -0
  22. restpki_ng_python_client/models/allocate_document_key_batch_request.py +96 -0
  23. restpki_ng_python_client/models/allocate_document_key_request.py +93 -0
  24. restpki_ng_python_client/models/attribute_certificate_model.py +141 -0
  25. restpki_ng_python_client/models/audit_package_options.py +90 -0
  26. restpki_ng_python_client/models/authentication_failures.py +45 -0
  27. restpki_ng_python_client/models/authentication_get_response.py +92 -0
  28. restpki_ng_python_client/models/authentication_post_request.py +116 -0
  29. restpki_ng_python_client/models/authentication_post_response.py +98 -0
  30. restpki_ng_python_client/models/authentications_post_request.py +95 -0
  31. restpki_ng_python_client/models/authentications_post_response.py +114 -0
  32. restpki_ng_python_client/models/authentications_post_signed_bytes_request.py +99 -0
  33. restpki_ng_python_client/models/authentications_post_signed_bytes_response.py +98 -0
  34. restpki_ng_python_client/models/auto_positioning_horizontal_directions.py +45 -0
  35. restpki_ng_python_client/models/auto_positioning_vertical_directions.py +45 -0
  36. restpki_ng_python_client/models/blockchains.py +45 -0
  37. restpki_ng_python_client/models/cades_signature_model.py +123 -0
  38. restpki_ng_python_client/models/cades_signature_post_request_v1.py +137 -0
  39. restpki_ng_python_client/models/cades_signature_post_request_v2.py +152 -0
  40. restpki_ng_python_client/models/cades_signature_post_request_v3.py +149 -0
  41. restpki_ng_python_client/models/cades_signature_post_response.py +120 -0
  42. restpki_ng_python_client/models/cades_signature_post_signed_bytes_request.py +92 -0
  43. restpki_ng_python_client/models/cades_signature_post_signed_bytes_response.py +106 -0
  44. restpki_ng_python_client/models/cades_signer_model.py +159 -0
  45. restpki_ng_python_client/models/cades_timestamp_model.py +140 -0
  46. restpki_ng_python_client/models/certificate_model.py +197 -0
  47. restpki_ng_python_client/models/certificate_reference_model.py +99 -0
  48. restpki_ng_python_client/models/certificate_requirement.py +95 -0
  49. restpki_ng_python_client/models/certificate_requirement_types.py +45 -0
  50. restpki_ng_python_client/models/certificate_summary.py +142 -0
  51. restpki_ng_python_client/models/certified_attribute_model.py +94 -0
  52. restpki_ng_python_client/models/certified_attribute_types.py +44 -0
  53. restpki_ng_python_client/models/cms_content_types.py +50 -0
  54. restpki_ng_python_client/models/cms_signature_options.py +109 -0
  55. restpki_ng_python_client/models/color_model.py +98 -0
  56. restpki_ng_python_client/models/commitment_type_model.py +99 -0
  57. restpki_ng_python_client/models/complete_authentication_request.py +93 -0
  58. restpki_ng_python_client/models/complete_authentication_response.py +103 -0
  59. restpki_ng_python_client/models/complete_signature_request.py +95 -0
  60. restpki_ng_python_client/models/complete_signature_request_v2.py +91 -0
  61. restpki_ng_python_client/models/create_signature_session_request.py +161 -0
  62. restpki_ng_python_client/models/create_signature_session_response.py +95 -0
  63. restpki_ng_python_client/models/digest_algorithm_and_value_model.py +103 -0
  64. restpki_ng_python_client/models/digest_algorithms.py +49 -0
  65. restpki_ng_python_client/models/document_file_model.py +137 -0
  66. restpki_ng_python_client/models/document_key_model.py +100 -0
  67. restpki_ng_python_client/models/document_key_query_response.py +110 -0
  68. restpki_ng_python_client/models/document_key_summary.py +100 -0
  69. restpki_ng_python_client/models/document_model.py +150 -0
  70. restpki_ng_python_client/models/document_query_response.py +93 -0
  71. restpki_ng_python_client/models/document_status.py +47 -0
  72. restpki_ng_python_client/models/document_summary.py +128 -0
  73. restpki_ng_python_client/models/error_model_v2.py +120 -0
  74. restpki_ng_python_client/models/file_model.py +114 -0
  75. restpki_ng_python_client/models/file_reference_model.py +137 -0
  76. restpki_ng_python_client/models/full_xml_signature_post_request.py +136 -0
  77. restpki_ng_python_client/models/general_name_choices.py +52 -0
  78. restpki_ng_python_client/models/general_name_model.py +108 -0
  79. restpki_ng_python_client/models/holder_types.py +45 -0
  80. restpki_ng_python_client/models/inspect_signature_failures.py +44 -0
  81. restpki_ng_python_client/models/inspect_signature_request.py +127 -0
  82. restpki_ng_python_client/models/inspect_signature_response.py +131 -0
  83. restpki_ng_python_client/models/multipart_upload_begin_response.py +95 -0
  84. restpki_ng_python_client/models/multipart_upload_end_request.py +95 -0
  85. restpki_ng_python_client/models/name_model.py +205 -0
  86. restpki_ng_python_client/models/namespace_model.py +99 -0
  87. restpki_ng_python_client/models/open_cades_signature_request_model.py +147 -0
  88. restpki_ng_python_client/models/open_signature_request_model.py +145 -0
  89. restpki_ng_python_client/models/open_xml_signature_request_model.py +151 -0
  90. restpki_ng_python_client/models/other_name_model.py +107 -0
  91. restpki_ng_python_client/models/pades_certification_level.py +47 -0
  92. restpki_ng_python_client/models/pades_horizontal_align.py +46 -0
  93. restpki_ng_python_client/models/pades_measurement_units.py +45 -0
  94. restpki_ng_python_client/models/pades_page_optimization_model.py +98 -0
  95. restpki_ng_python_client/models/pades_signature_model.py +113 -0
  96. restpki_ng_python_client/models/pades_signature_post_request_v1.py +167 -0
  97. restpki_ng_python_client/models/pades_signature_post_request_v2.py +171 -0
  98. restpki_ng_python_client/models/pades_signature_post_response.py +120 -0
  99. restpki_ng_python_client/models/pades_signature_post_signed_bytes_request.py +92 -0
  100. restpki_ng_python_client/models/pades_signature_post_signed_bytes_response.py +106 -0
  101. restpki_ng_python_client/models/pades_signer_model.py +168 -0
  102. restpki_ng_python_client/models/pades_size_model.py +89 -0
  103. restpki_ng_python_client/models/pades_text_horizontal_align.py +45 -0
  104. restpki_ng_python_client/models/pades_vertical_align.py +46 -0
  105. restpki_ng_python_client/models/pades_visual_auto_positioning_model.py +106 -0
  106. restpki_ng_python_client/models/pades_visual_image_model.py +105 -0
  107. restpki_ng_python_client/models/pades_visual_positioning_model.py +109 -0
  108. restpki_ng_python_client/models/pades_visual_rectangle_model.py +127 -0
  109. restpki_ng_python_client/models/pades_visual_representation_model.py +103 -0
  110. restpki_ng_python_client/models/pades_visual_text_model.py +111 -0
  111. restpki_ng_python_client/models/page_orientations.py +46 -0
  112. restpki_ng_python_client/models/paper_sizes.py +56 -0
  113. restpki_ng_python_client/models/pdf_add_marks_request.py +117 -0
  114. restpki_ng_python_client/models/pdf_add_marks_response.py +91 -0
  115. restpki_ng_python_client/models/pdf_container_definition.py +208 -0
  116. restpki_ng_python_client/models/pdf_helper.py +43 -0
  117. restpki_ng_python_client/models/pdf_mark_element_model.py +230 -0
  118. restpki_ng_python_client/models/pdf_mark_element_type.py +46 -0
  119. restpki_ng_python_client/models/pdf_mark_image_model.py +98 -0
  120. restpki_ng_python_client/models/pdf_mark_model.py +168 -0
  121. restpki_ng_python_client/models/pdf_mark_page_options.py +47 -0
  122. restpki_ng_python_client/models/pdf_signature_options.py +101 -0
  123. restpki_ng_python_client/models/pdf_text_section_model.py +125 -0
  124. restpki_ng_python_client/models/pdf_text_style.py +46 -0
  125. restpki_ng_python_client/models/pki_brazil_certificate_model.py +159 -0
  126. restpki_ng_python_client/models/pki_brazil_certificate_types.py +54 -0
  127. restpki_ng_python_client/models/pki_italy_certificate_model.py +103 -0
  128. restpki_ng_python_client/models/pki_italy_certificate_types.py +46 -0
  129. restpki_ng_python_client/models/prepare_authentication_request.py +100 -0
  130. restpki_ng_python_client/models/prepare_authentication_response.py +99 -0
  131. restpki_ng_python_client/models/prepare_signature_failures.py +46 -0
  132. restpki_ng_python_client/models/prepare_signature_request.py +133 -0
  133. restpki_ng_python_client/models/prepare_signature_response.py +116 -0
  134. restpki_ng_python_client/models/resource_content_or_reference.py +107 -0
  135. restpki_ng_python_client/models/role_attribute_model.py +114 -0
  136. restpki_ng_python_client/models/session_completion_status.py +89 -0
  137. restpki_ng_python_client/models/signature_algorithm_and_value_model.py +106 -0
  138. restpki_ng_python_client/models/signature_algorithm_identifier.py +88 -0
  139. restpki_ng_python_client/models/signature_algorithms.py +48 -0
  140. restpki_ng_python_client/models/signature_b_stamp_model.py +135 -0
  141. restpki_ng_python_client/models/signature_policy_identifier_model.py +105 -0
  142. restpki_ng_python_client/models/signature_result_model.py +105 -0
  143. restpki_ng_python_client/models/signature_session_document_data.py +128 -0
  144. restpki_ng_python_client/models/signature_session_document_summary.py +138 -0
  145. restpki_ng_python_client/models/signature_session_model.py +126 -0
  146. restpki_ng_python_client/models/signature_session_status.py +49 -0
  147. restpki_ng_python_client/models/signature_types.py +46 -0
  148. restpki_ng_python_client/models/signer_b_stamp_model.py +132 -0
  149. restpki_ng_python_client/models/signer_model.py +187 -0
  150. restpki_ng_python_client/models/signer_summary.py +94 -0
  151. restpki_ng_python_client/models/timestamp_issue_response.py +99 -0
  152. restpki_ng_python_client/models/validation_item_model.py +111 -0
  153. restpki_ng_python_client/models/validation_item_types.py +91 -0
  154. restpki_ng_python_client/models/validation_results_model.py +131 -0
  155. restpki_ng_python_client/models/webhook_event_model.py +94 -0
  156. restpki_ng_python_client/models/webhook_event_types.py +44 -0
  157. restpki_ng_python_client/models/xml_attribute_model.py +107 -0
  158. restpki_ng_python_client/models/xml_element_location_model.py +111 -0
  159. restpki_ng_python_client/models/xml_element_model.py +115 -0
  160. restpki_ng_python_client/models/xml_element_signature_post_request.py +145 -0
  161. restpki_ng_python_client/models/xml_id_attribute_model.py +96 -0
  162. restpki_ng_python_client/models/xml_id_resolution_table_model.py +123 -0
  163. restpki_ng_python_client/models/xml_insertion_options.py +47 -0
  164. restpki_ng_python_client/models/xml_node_name_model.py +96 -0
  165. restpki_ng_python_client/models/xml_signature_model.py +154 -0
  166. restpki_ng_python_client/models/xml_signature_options.py +102 -0
  167. restpki_ng_python_client/models/xml_signature_post_response.py +120 -0
  168. restpki_ng_python_client/models/xml_signature_post_signed_bytes_request.py +92 -0
  169. restpki_ng_python_client/models/xml_signature_post_signed_bytes_response.py +106 -0
  170. restpki_ng_python_client/models/xml_signature_response_model.py +113 -0
  171. restpki_ng_python_client/models/xml_signature_types.py +47 -0
  172. restpki_ng_python_client/models/xml_signed_entity_types.py +46 -0
  173. restpki_ng_python_client/py.typed +0 -0
  174. restpki_ng_python_client/rest.py +231 -0
  175. restpki_ng_python_client/restpki_ng_client.py +458 -0
  176. restpki_ng_python_client/standard_signature_policies.py +24 -0
  177. restpki_ng_python_client/utils.py +80 -0
  178. restpki_ng_python_client-0.9.0.dist-info/METADATA +16 -0
  179. restpki_ng_python_client-0.9.0.dist-info/RECORD +181 -0
  180. restpki_ng_python_client-0.9.0.dist-info/WHEEL +5 -0
  181. restpki_ng_python_client-0.9.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,891 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Rest PKI Core API
5
+
6
+ <b><i>Para Português, <a href=\"https://docs.lacunasoftware.com/pt-br/articles/rest-pki/core/integration/get-started\">clique aqui</a></i></b> <p> <a href=\"https://docs.lacunasoftware.com/en-us/articles/rest-pki/core/\">Rest PKI Core</a> is an upcoming version of <a href=\"https://docs.lacunasoftware.com/en-us/articles/rest-pki/\">Rest PKI</a> that will have extended compatibility with environments and databases. </p> <p> In addition to Windows Server (which is already supported by Rest PKI), Rest PKI Core will also run on <b>Linux</b> (Debian- and RedHat-based distributions) and on <b>Docker</b>. As for database servers, in addition to SQL Server, <b>PostgreSQL</b> will also be supported. </p> <p> <b>Before getting started, see the integration overview on the <a href=\"https://docs.lacunasoftware.com/en-us/articles/rest-pki/core/integration/\">Integration Guide</a></b> </p> <p> For questions regarding the usage of this API, please reach us at <a href=\"https://lacuna.help/\">lacuna.help</a> </p> <h2>Parameters</h2> <p> You will need the following parameters: </p> <ul> <li><b>Endpoint</b>: address of the Rest PKI Core instance that will be used</li> <li><b>API Key</b>: authorization key for using the API</li> </ul> <p> The <span class=\"model\">endpoint</span> must be prefixed to all relative URLs mentioned here. As for the <span class=\"model\">API Key</span>, see how to use it below. </p> <h2>Authentication</h2> <p> The API key must be sent on the <span class=\"model\">X-Api-Key</span> header on each request: </p> <!-- unfortunately, class \"example microlight\" doesn't seem to work here --> <pre style=\"font-size: 12px; padding: 10px; border-radius: 4px; background: #41444e; font-weight: 600; color: #fff;\"> X-Api-Key: yourapp|xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx </pre> <h2>HTTP Codes</h2> <p> The APIs will return the following HTTP codes: </p> <table> <thead> <tr> <th>Code</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td><strong class=\"model-title\">200 (OK)</strong></td> <td>Request processed successfully. The response is different for each API, please refer to the operation's documentation</td> </tr> <tr> <td><strong class=\"model-title\">400 (Bad Request)</strong></td> <td>Syntax error. For instance, when a required field was not provided</td> </tr> <tr> <td><strong class=\"model-title\">401 (Unauthorized)</strong></td> <td>API key not provided or invalid</td> </tr> <tr> <td><strong class=\"model-title\">403 (Forbidden)</strong></td> <td>API key is valid, but the application has insufficient permissions to complete the requested operation</td> </tr> <tr> <td><strong class=\"model-title\">422 (Unprocessable Entity)</strong></td> <td>API error. The response body is an <a href=\"#model-ErrorModelV2\" class=\"model\">ErrorModelV2</a> </tr> <tr> <td><strong class=\"model-title\">500 (Internal Server Error)</strong></td> <td>An unexpected error occurred. The <span class=\"model\">exceptionCode</span> contained on the response body may be of help for our support team during diagnostic.</td> </tr> </tbody> </table> <h3>Error Codes</h3> <p> Some of the error codes returned in the <span class=\"model\">code</span> field of an <a href=\"#model-ErrorModelV2\" class=\"model\">ErrorModelV2</a> (body of responses with HTTP status code 422) are provided below*: </p> <table> <thead> <tr> <th>Code</th> <th>Description</th> </tr> </thead> <tbody> <tr> <td class=\"model\">DocumentNotFound</td> <td>A referenced document was not found (check the document ID)</td> </tr> <tr> <td class=\"model\">SecurityContextNotFound</td> <td>A referenced security context was not found (check the security context ID)</td> </tr> <tr> <td class=\"model\">SignatureSessionNotFound</td> <td>A referenced signature session was not found (check the signature session ID)</td> </tr> <tr> <td class=\"model\">BadSignatureSessionOperation</td> <td>The operation is invalid for the current signature session or document status. For instance, trying to await the session's completion if it is still <span class=\"model\">Pending</span> results in this error</td> </tr> <tr> <td class=\"model\">BackgroundProcessing</td> <td>The operation cannot be completed at this time because the resource is being processed in background</td> </tr> <tr> <td class=\"model\">SignatureSessionTokenRequired</td> <td>The signature session token was not passed on the <span class=\"model\">X-Signature-Session-Token</span> request header</td> </tr> <tr> <td class=\"model\">BadSignatureSessionToken</td> <td>An invalid signature session token was passed on the <span class=\"model\">X-Signature-Session-Token</span> request header. Check your application for possible corruption of the session token, which may contain characters <span class=\"code\">-</span> (hyphen) and <span class=\"code\">_</span> (underscore)</td> </tr> <tr> <td class=\"model\">ExpiredSignatureSessionToken</td> <td>An expired signature session token was passed on the <span class=\"model\">X-Signature-Session-Token</span> request header. Signature session tokens are normally valid for 4 hours.</td> </tr> </tbody> </table> <p style=\"font-size: 0.9em\"> *The codes shown above are the most common error codes. Nonetheless, this list is not comprehensive. New codes may be added anytime without previous warning. </p> <h2>Culture / Internationalization (i18n)</h2> <p>The <span class=\"model\">Accept-Language</span> request header is observed by this API. The following cultures are supported:</p> <ul> <li><span class=\"code\">en-US</span> (or simply <span class=\"code\">en</span>)</li> <li><span class=\"code\">pt-BR</span> (or simply <span class=\"code\">pt</span>)</li> </ul> <p><i>Notice: error messages are not affected by this header and therefore should not be displayed to users, being better suited for logging.</i></p>
7
+
8
+ The version of the OpenAPI document: 2.1.2
9
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
10
+
11
+ Do not edit the class manually.
12
+ """ # noqa: E501
13
+
14
+
15
+ import io
16
+ import warnings
17
+
18
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
19
+ from typing import Dict, List, Optional, Tuple, Union, Any
20
+
21
+ try:
22
+ from typing import Annotated
23
+ except ImportError:
24
+ from typing_extensions import Annotated
25
+
26
+ from pydantic import StrictStr
27
+
28
+ from typing import Optional
29
+
30
+ from restpki_ng_python_client.models.create_signature_session_request import CreateSignatureSessionRequest
31
+ from restpki_ng_python_client.models.create_signature_session_response import CreateSignatureSessionResponse
32
+ from restpki_ng_python_client.models.session_completion_status import SessionCompletionStatus
33
+ from restpki_ng_python_client.models.signature_session_model import SignatureSessionModel
34
+
35
+ from restpki_ng_python_client.api_client import ApiClient
36
+ from restpki_ng_python_client.api_response import ApiResponse
37
+ from restpki_ng_python_client.rest import RESTResponseType
38
+
39
+
40
+ class SignatureSessionsApi:
41
+ """NOTE: This class is auto generated by OpenAPI Generator
42
+ Ref: https://openapi-generator.tech
43
+
44
+ Do not edit the class manually.
45
+ """
46
+
47
+ def __init__(self, api_client=None) -> None:
48
+ if api_client is None:
49
+ api_client = ApiClient.get_default()
50
+ self.api_client = api_client
51
+
52
+
53
+ @validate_call
54
+ def api_signature_sessions_id_get(
55
+ self,
56
+ id: StrictStr,
57
+ _request_timeout: Union[
58
+ None,
59
+ Annotated[StrictFloat, Field(gt=0)],
60
+ Tuple[
61
+ Annotated[StrictFloat, Field(gt=0)],
62
+ Annotated[StrictFloat, Field(gt=0)]
63
+ ]
64
+ ] = None,
65
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
66
+ _content_type: Optional[StrictStr] = None,
67
+ _headers: Optional[Dict[StrictStr, Any]] = None,
68
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
69
+ ) -> SignatureSessionModel:
70
+ """Retrieves a signature session's details
71
+
72
+ ## Overview When a user is redirected back to your application at the end of a signature session, a query parameter is appended to the `returnUrl` containing the ID of the signature session, i.e. `?signatureSessionId=...`. Your app must get this parameter and use it to call this API, which will return information about the session, mainly its status and documents. ## Statuses When a user is redirected back to your app, the session will have one of two possible statuses: `Completed` or `UserCancelled`. You should always check the status, since it is perfecly normal for a user to land back on your app by cancelling the session instead of going through the procedure. ## Statuses (when background processing is enabled) If you enabled background processing of the session by passing `EnableBackgroundProcessing = true` when creating the session, then two additional statuses are possible: `Processing` and `ProcessingError`. While a session is still `Processing`, some documents will be in status `Processing` and cannot be downloaded. Only when the session transitions to the `Complete` status are all documents ready to be downloaded. The status `ProcessingError` is a rare condition that occurrs only in corner cases such as the user's certificate being revoked during the time between the start of the session and the completion of the background processing. It is perfectly appropriate for your app to `throw` if this status is returned. ## Downloading signed files The signed files are not returned on the body of the response. Instead, a `location` is given for each file which must be invoked to get the actual files' contents (see [DocumentFileModel](#model-DocumentFileModel)).
73
+
74
+ :param id: (required)
75
+ :type id: str
76
+ :param _request_timeout: timeout setting for this request. If one
77
+ number provided, it will be total request
78
+ timeout. It can also be a pair (tuple) of
79
+ (connection, read) timeouts.
80
+ :type _request_timeout: int, tuple(int, int), optional
81
+ :param _request_auth: set to override the auth_settings for an a single
82
+ request; this effectively ignores the
83
+ authentication in the spec for a single request.
84
+ :type _request_auth: dict, optional
85
+ :param _content_type: force content-type for the request.
86
+ :type _content_type: str, Optional
87
+ :param _headers: set to override the headers for a single
88
+ request; this effectively ignores the headers
89
+ in the spec for a single request.
90
+ :type _headers: dict, optional
91
+ :param _host_index: set to override the host_index for a single
92
+ request; this effectively ignores the host_index
93
+ in the spec for a single request.
94
+ :type _host_index: int, optional
95
+ :return: Returns the result object.
96
+ """ # noqa: E501
97
+
98
+ _param = self._api_signature_sessions_id_get_serialize(
99
+ id=id,
100
+ _request_auth=_request_auth,
101
+ _content_type=_content_type,
102
+ _headers=_headers,
103
+ _host_index=_host_index
104
+ )
105
+
106
+ _response_types_map: Dict[str, Optional[str]] = {
107
+ '200': "SignatureSessionModel",
108
+ '400': None,
109
+ '401': None,
110
+ '403': None,
111
+ '422': None
112
+
113
+ }
114
+ response_data = self.api_client.call_api(
115
+ *_param,
116
+ _request_timeout=_request_timeout
117
+ )
118
+ response_data.read()
119
+ return self.api_client.response_deserialize(
120
+ response_data=response_data,
121
+ response_types_map=_response_types_map,
122
+ ).data
123
+
124
+
125
+ @validate_call
126
+ def api_signature_sessions_id_get_with_http_info(
127
+ self,
128
+ id: StrictStr,
129
+ _request_timeout: Union[
130
+ None,
131
+ Annotated[StrictFloat, Field(gt=0)],
132
+ Tuple[
133
+ Annotated[StrictFloat, Field(gt=0)],
134
+ Annotated[StrictFloat, Field(gt=0)]
135
+ ]
136
+ ] = None,
137
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
138
+ _content_type: Optional[StrictStr] = None,
139
+ _headers: Optional[Dict[StrictStr, Any]] = None,
140
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
141
+ ) -> ApiResponse[SignatureSessionModel]:
142
+ """Retrieves a signature session's details
143
+
144
+ ## Overview When a user is redirected back to your application at the end of a signature session, a query parameter is appended to the `returnUrl` containing the ID of the signature session, i.e. `?signatureSessionId=...`. Your app must get this parameter and use it to call this API, which will return information about the session, mainly its status and documents. ## Statuses When a user is redirected back to your app, the session will have one of two possible statuses: `Completed` or `UserCancelled`. You should always check the status, since it is perfecly normal for a user to land back on your app by cancelling the session instead of going through the procedure. ## Statuses (when background processing is enabled) If you enabled background processing of the session by passing `EnableBackgroundProcessing = true` when creating the session, then two additional statuses are possible: `Processing` and `ProcessingError`. While a session is still `Processing`, some documents will be in status `Processing` and cannot be downloaded. Only when the session transitions to the `Complete` status are all documents ready to be downloaded. The status `ProcessingError` is a rare condition that occurrs only in corner cases such as the user's certificate being revoked during the time between the start of the session and the completion of the background processing. It is perfectly appropriate for your app to `throw` if this status is returned. ## Downloading signed files The signed files are not returned on the body of the response. Instead, a `location` is given for each file which must be invoked to get the actual files' contents (see [DocumentFileModel](#model-DocumentFileModel)).
145
+
146
+ :param id: (required)
147
+ :type id: str
148
+ :param _request_timeout: timeout setting for this request. If one
149
+ number provided, it will be total request
150
+ timeout. It can also be a pair (tuple) of
151
+ (connection, read) timeouts.
152
+ :type _request_timeout: int, tuple(int, int), optional
153
+ :param _request_auth: set to override the auth_settings for an a single
154
+ request; this effectively ignores the
155
+ authentication in the spec for a single request.
156
+ :type _request_auth: dict, optional
157
+ :param _content_type: force content-type for the request.
158
+ :type _content_type: str, Optional
159
+ :param _headers: set to override the headers for a single
160
+ request; this effectively ignores the headers
161
+ in the spec for a single request.
162
+ :type _headers: dict, optional
163
+ :param _host_index: set to override the host_index for a single
164
+ request; this effectively ignores the host_index
165
+ in the spec for a single request.
166
+ :type _host_index: int, optional
167
+ :return: Returns the result object.
168
+ """ # noqa: E501
169
+
170
+ _param = self._api_signature_sessions_id_get_serialize(
171
+ id=id,
172
+ _request_auth=_request_auth,
173
+ _content_type=_content_type,
174
+ _headers=_headers,
175
+ _host_index=_host_index
176
+ )
177
+
178
+ _response_types_map: Dict[str, Optional[str]] = {
179
+ '200': "SignatureSessionModel",
180
+ '400': None,
181
+ '401': None,
182
+ '403': None,
183
+ '422': None
184
+
185
+ }
186
+ response_data = self.api_client.call_api(
187
+ *_param,
188
+ _request_timeout=_request_timeout
189
+ )
190
+ response_data.read()
191
+ return self.api_client.response_deserialize(
192
+ response_data=response_data,
193
+ response_types_map=_response_types_map,
194
+ )
195
+
196
+
197
+ @validate_call
198
+ def api_signature_sessions_id_get_without_preload_content(
199
+ self,
200
+ id: StrictStr,
201
+ _request_timeout: Union[
202
+ None,
203
+ Annotated[StrictFloat, Field(gt=0)],
204
+ Tuple[
205
+ Annotated[StrictFloat, Field(gt=0)],
206
+ Annotated[StrictFloat, Field(gt=0)]
207
+ ]
208
+ ] = None,
209
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
210
+ _content_type: Optional[StrictStr] = None,
211
+ _headers: Optional[Dict[StrictStr, Any]] = None,
212
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
213
+ ) -> RESTResponseType:
214
+ """Retrieves a signature session's details
215
+
216
+ ## Overview When a user is redirected back to your application at the end of a signature session, a query parameter is appended to the `returnUrl` containing the ID of the signature session, i.e. `?signatureSessionId=...`. Your app must get this parameter and use it to call this API, which will return information about the session, mainly its status and documents. ## Statuses When a user is redirected back to your app, the session will have one of two possible statuses: `Completed` or `UserCancelled`. You should always check the status, since it is perfecly normal for a user to land back on your app by cancelling the session instead of going through the procedure. ## Statuses (when background processing is enabled) If you enabled background processing of the session by passing `EnableBackgroundProcessing = true` when creating the session, then two additional statuses are possible: `Processing` and `ProcessingError`. While a session is still `Processing`, some documents will be in status `Processing` and cannot be downloaded. Only when the session transitions to the `Complete` status are all documents ready to be downloaded. The status `ProcessingError` is a rare condition that occurrs only in corner cases such as the user's certificate being revoked during the time between the start of the session and the completion of the background processing. It is perfectly appropriate for your app to `throw` if this status is returned. ## Downloading signed files The signed files are not returned on the body of the response. Instead, a `location` is given for each file which must be invoked to get the actual files' contents (see [DocumentFileModel](#model-DocumentFileModel)).
217
+
218
+ :param id: (required)
219
+ :type id: str
220
+ :param _request_timeout: timeout setting for this request. If one
221
+ number provided, it will be total request
222
+ timeout. It can also be a pair (tuple) of
223
+ (connection, read) timeouts.
224
+ :type _request_timeout: int, tuple(int, int), optional
225
+ :param _request_auth: set to override the auth_settings for an a single
226
+ request; this effectively ignores the
227
+ authentication in the spec for a single request.
228
+ :type _request_auth: dict, optional
229
+ :param _content_type: force content-type for the request.
230
+ :type _content_type: str, Optional
231
+ :param _headers: set to override the headers for a single
232
+ request; this effectively ignores the headers
233
+ in the spec for a single request.
234
+ :type _headers: dict, optional
235
+ :param _host_index: set to override the host_index for a single
236
+ request; this effectively ignores the host_index
237
+ in the spec for a single request.
238
+ :type _host_index: int, optional
239
+ :return: Returns the result object.
240
+ """ # noqa: E501
241
+
242
+ _param = self._api_signature_sessions_id_get_serialize(
243
+ id=id,
244
+ _request_auth=_request_auth,
245
+ _content_type=_content_type,
246
+ _headers=_headers,
247
+ _host_index=_host_index
248
+ )
249
+
250
+ _response_types_map: Dict[str, Optional[str]] = {
251
+ '200': "SignatureSessionModel",
252
+ '400': None,
253
+ '401': None,
254
+ '403': None,
255
+ '422': None
256
+
257
+ }
258
+ response_data = self.api_client.call_api(
259
+ *_param,
260
+ _request_timeout=_request_timeout
261
+ )
262
+ return response_data.response
263
+
264
+
265
+ def _api_signature_sessions_id_get_serialize(
266
+ self,
267
+ id,
268
+ _request_auth,
269
+ _content_type,
270
+ _headers,
271
+ _host_index,
272
+ ) -> Tuple:
273
+
274
+ _host = None
275
+
276
+ _collection_formats: Dict[str, str] = {
277
+
278
+ }
279
+
280
+ _path_params: Dict[str, str] = {}
281
+ _query_params: List[Tuple[str, str]] = []
282
+ _header_params: Dict[str, Optional[str]] = _headers or {}
283
+ _form_params: List[Tuple[str, str]] = []
284
+ _files: Dict[str, str] = {}
285
+ _body_params: Optional[bytes] = None
286
+
287
+ # process the path parameters
288
+ if id is not None:
289
+ _path_params['id'] = id
290
+ # process the query parameters
291
+ # process the header parameters
292
+ # process the form parameters
293
+ # process the body parameter
294
+
295
+
296
+ # set the HTTP header `Accept`
297
+ _header_params['Accept'] = self.api_client.select_header_accept(
298
+ [
299
+ 'text/plain',
300
+ 'application/json',
301
+ 'text/json'
302
+ ]
303
+ )
304
+
305
+
306
+ # authentication setting
307
+ _auth_settings: List[str] = [
308
+ ]
309
+
310
+ return self.api_client.param_serialize(
311
+ method='GET',
312
+ resource_path='/api/signature-sessions/{id}',
313
+ path_params=_path_params,
314
+ query_params=_query_params,
315
+ header_params=_header_params,
316
+ body=_body_params,
317
+ post_params=_form_params,
318
+ files=_files,
319
+ auth_settings=_auth_settings,
320
+ collection_formats=_collection_formats,
321
+ _host=_host,
322
+ _request_auth=_request_auth
323
+ )
324
+
325
+
326
+
327
+
328
+ @validate_call
329
+ def api_signature_sessions_id_when_completed_get(
330
+ self,
331
+ id: StrictStr,
332
+ _request_timeout: Union[
333
+ None,
334
+ Annotated[StrictFloat, Field(gt=0)],
335
+ Tuple[
336
+ Annotated[StrictFloat, Field(gt=0)],
337
+ Annotated[StrictFloat, Field(gt=0)]
338
+ ]
339
+ ] = None,
340
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
341
+ _content_type: Optional[StrictStr] = None,
342
+ _headers: Optional[Dict[StrictStr, Any]] = None,
343
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
344
+ ) -> SessionCompletionStatus:
345
+ """Waits for the completion of a signature session
346
+
347
+ This API can be used when background processing is enabled on a signature session to wait for its processing. The API will hang for a short period (normally 15 seconds) waiting for the session to be completed. If it is completed during that time, the API returns immediately with `Completed = true`. If, however, that period elapsed and the session is still not completed, the API returns with `Completed = false` and with the current `Progress` (0 to 100). A client app that intends to wait for the session completion indefinitely must therefore implement a loop to call this API until `Completed = true` is returned. This might seem like polling (and actually is), but is different because it is a sort of \"smart polling\" since the API returns immediately once the session is completed, instead of the app having to wait for the next polling interval.
348
+
349
+ :param id: (required)
350
+ :type id: str
351
+ :param _request_timeout: timeout setting for this request. If one
352
+ number provided, it will be total request
353
+ timeout. It can also be a pair (tuple) of
354
+ (connection, read) timeouts.
355
+ :type _request_timeout: int, tuple(int, int), optional
356
+ :param _request_auth: set to override the auth_settings for an a single
357
+ request; this effectively ignores the
358
+ authentication in the spec for a single request.
359
+ :type _request_auth: dict, optional
360
+ :param _content_type: force content-type for the request.
361
+ :type _content_type: str, Optional
362
+ :param _headers: set to override the headers for a single
363
+ request; this effectively ignores the headers
364
+ in the spec for a single request.
365
+ :type _headers: dict, optional
366
+ :param _host_index: set to override the host_index for a single
367
+ request; this effectively ignores the host_index
368
+ in the spec for a single request.
369
+ :type _host_index: int, optional
370
+ :return: Returns the result object.
371
+ """ # noqa: E501
372
+
373
+ _param = self._api_signature_sessions_id_when_completed_get_serialize(
374
+ id=id,
375
+ _request_auth=_request_auth,
376
+ _content_type=_content_type,
377
+ _headers=_headers,
378
+ _host_index=_host_index
379
+ )
380
+
381
+ _response_types_map: Dict[str, Optional[str]] = {
382
+ '200': "SessionCompletionStatus",
383
+ '400': None,
384
+ '401': None,
385
+ '403': None,
386
+ '422': None
387
+
388
+ }
389
+ response_data = self.api_client.call_api(
390
+ *_param,
391
+ _request_timeout=_request_timeout
392
+ )
393
+ response_data.read()
394
+ return self.api_client.response_deserialize(
395
+ response_data=response_data,
396
+ response_types_map=_response_types_map,
397
+ ).data
398
+
399
+
400
+ @validate_call
401
+ def api_signature_sessions_id_when_completed_get_with_http_info(
402
+ self,
403
+ id: StrictStr,
404
+ _request_timeout: Union[
405
+ None,
406
+ Annotated[StrictFloat, Field(gt=0)],
407
+ Tuple[
408
+ Annotated[StrictFloat, Field(gt=0)],
409
+ Annotated[StrictFloat, Field(gt=0)]
410
+ ]
411
+ ] = None,
412
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
413
+ _content_type: Optional[StrictStr] = None,
414
+ _headers: Optional[Dict[StrictStr, Any]] = None,
415
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
416
+ ) -> ApiResponse[SessionCompletionStatus]:
417
+ """Waits for the completion of a signature session
418
+
419
+ This API can be used when background processing is enabled on a signature session to wait for its processing. The API will hang for a short period (normally 15 seconds) waiting for the session to be completed. If it is completed during that time, the API returns immediately with `Completed = true`. If, however, that period elapsed and the session is still not completed, the API returns with `Completed = false` and with the current `Progress` (0 to 100). A client app that intends to wait for the session completion indefinitely must therefore implement a loop to call this API until `Completed = true` is returned. This might seem like polling (and actually is), but is different because it is a sort of \"smart polling\" since the API returns immediately once the session is completed, instead of the app having to wait for the next polling interval.
420
+
421
+ :param id: (required)
422
+ :type id: str
423
+ :param _request_timeout: timeout setting for this request. If one
424
+ number provided, it will be total request
425
+ timeout. It can also be a pair (tuple) of
426
+ (connection, read) timeouts.
427
+ :type _request_timeout: int, tuple(int, int), optional
428
+ :param _request_auth: set to override the auth_settings for an a single
429
+ request; this effectively ignores the
430
+ authentication in the spec for a single request.
431
+ :type _request_auth: dict, optional
432
+ :param _content_type: force content-type for the request.
433
+ :type _content_type: str, Optional
434
+ :param _headers: set to override the headers for a single
435
+ request; this effectively ignores the headers
436
+ in the spec for a single request.
437
+ :type _headers: dict, optional
438
+ :param _host_index: set to override the host_index for a single
439
+ request; this effectively ignores the host_index
440
+ in the spec for a single request.
441
+ :type _host_index: int, optional
442
+ :return: Returns the result object.
443
+ """ # noqa: E501
444
+
445
+ _param = self._api_signature_sessions_id_when_completed_get_serialize(
446
+ id=id,
447
+ _request_auth=_request_auth,
448
+ _content_type=_content_type,
449
+ _headers=_headers,
450
+ _host_index=_host_index
451
+ )
452
+
453
+ _response_types_map: Dict[str, Optional[str]] = {
454
+ '200': "SessionCompletionStatus",
455
+ '400': None,
456
+ '401': None,
457
+ '403': None,
458
+ '422': None
459
+
460
+ }
461
+ response_data = self.api_client.call_api(
462
+ *_param,
463
+ _request_timeout=_request_timeout
464
+ )
465
+ response_data.read()
466
+ return self.api_client.response_deserialize(
467
+ response_data=response_data,
468
+ response_types_map=_response_types_map,
469
+ )
470
+
471
+
472
+ @validate_call
473
+ def api_signature_sessions_id_when_completed_get_without_preload_content(
474
+ self,
475
+ id: StrictStr,
476
+ _request_timeout: Union[
477
+ None,
478
+ Annotated[StrictFloat, Field(gt=0)],
479
+ Tuple[
480
+ Annotated[StrictFloat, Field(gt=0)],
481
+ Annotated[StrictFloat, Field(gt=0)]
482
+ ]
483
+ ] = None,
484
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
485
+ _content_type: Optional[StrictStr] = None,
486
+ _headers: Optional[Dict[StrictStr, Any]] = None,
487
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
488
+ ) -> RESTResponseType:
489
+ """Waits for the completion of a signature session
490
+
491
+ This API can be used when background processing is enabled on a signature session to wait for its processing. The API will hang for a short period (normally 15 seconds) waiting for the session to be completed. If it is completed during that time, the API returns immediately with `Completed = true`. If, however, that period elapsed and the session is still not completed, the API returns with `Completed = false` and with the current `Progress` (0 to 100). A client app that intends to wait for the session completion indefinitely must therefore implement a loop to call this API until `Completed = true` is returned. This might seem like polling (and actually is), but is different because it is a sort of \"smart polling\" since the API returns immediately once the session is completed, instead of the app having to wait for the next polling interval.
492
+
493
+ :param id: (required)
494
+ :type id: str
495
+ :param _request_timeout: timeout setting for this request. If one
496
+ number provided, it will be total request
497
+ timeout. It can also be a pair (tuple) of
498
+ (connection, read) timeouts.
499
+ :type _request_timeout: int, tuple(int, int), optional
500
+ :param _request_auth: set to override the auth_settings for an a single
501
+ request; this effectively ignores the
502
+ authentication in the spec for a single request.
503
+ :type _request_auth: dict, optional
504
+ :param _content_type: force content-type for the request.
505
+ :type _content_type: str, Optional
506
+ :param _headers: set to override the headers for a single
507
+ request; this effectively ignores the headers
508
+ in the spec for a single request.
509
+ :type _headers: dict, optional
510
+ :param _host_index: set to override the host_index for a single
511
+ request; this effectively ignores the host_index
512
+ in the spec for a single request.
513
+ :type _host_index: int, optional
514
+ :return: Returns the result object.
515
+ """ # noqa: E501
516
+
517
+ _param = self._api_signature_sessions_id_when_completed_get_serialize(
518
+ id=id,
519
+ _request_auth=_request_auth,
520
+ _content_type=_content_type,
521
+ _headers=_headers,
522
+ _host_index=_host_index
523
+ )
524
+
525
+ _response_types_map: Dict[str, Optional[str]] = {
526
+ '200': "SessionCompletionStatus",
527
+ '400': None,
528
+ '401': None,
529
+ '403': None,
530
+ '422': None
531
+
532
+ }
533
+ response_data = self.api_client.call_api(
534
+ *_param,
535
+ _request_timeout=_request_timeout
536
+ )
537
+ return response_data.response
538
+
539
+
540
+ def _api_signature_sessions_id_when_completed_get_serialize(
541
+ self,
542
+ id,
543
+ _request_auth,
544
+ _content_type,
545
+ _headers,
546
+ _host_index,
547
+ ) -> Tuple:
548
+
549
+ _host = None
550
+
551
+ _collection_formats: Dict[str, str] = {
552
+
553
+ }
554
+
555
+ _path_params: Dict[str, str] = {}
556
+ _query_params: List[Tuple[str, str]] = []
557
+ _header_params: Dict[str, Optional[str]] = _headers or {}
558
+ _form_params: List[Tuple[str, str]] = []
559
+ _files: Dict[str, str] = {}
560
+ _body_params: Optional[bytes] = None
561
+
562
+ # process the path parameters
563
+ if id is not None:
564
+ _path_params['id'] = id
565
+ # process the query parameters
566
+ # process the header parameters
567
+ # process the form parameters
568
+ # process the body parameter
569
+
570
+
571
+ # set the HTTP header `Accept`
572
+ _header_params['Accept'] = self.api_client.select_header_accept(
573
+ [
574
+ 'text/plain',
575
+ 'application/json',
576
+ 'text/json'
577
+ ]
578
+ )
579
+
580
+
581
+ # authentication setting
582
+ _auth_settings: List[str] = [
583
+ ]
584
+
585
+ return self.api_client.param_serialize(
586
+ method='GET',
587
+ resource_path='/api/signature-sessions/{id}/when-completed',
588
+ path_params=_path_params,
589
+ query_params=_query_params,
590
+ header_params=_header_params,
591
+ body=_body_params,
592
+ post_params=_form_params,
593
+ files=_files,
594
+ auth_settings=_auth_settings,
595
+ collection_formats=_collection_formats,
596
+ _host=_host,
597
+ _request_auth=_request_auth
598
+ )
599
+
600
+
601
+
602
+
603
+ @validate_call
604
+ def api_signature_sessions_post(
605
+ self,
606
+ create_signature_session_request: Optional[CreateSignatureSessionRequest] = None,
607
+ _request_timeout: Union[
608
+ None,
609
+ Annotated[StrictFloat, Field(gt=0)],
610
+ Tuple[
611
+ Annotated[StrictFloat, Field(gt=0)],
612
+ Annotated[StrictFloat, Field(gt=0)]
613
+ ]
614
+ ] = None,
615
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
616
+ _content_type: Optional[StrictStr] = None,
617
+ _headers: Optional[Dict[StrictStr, Any]] = None,
618
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
619
+ ) -> CreateSignatureSessionResponse:
620
+ """Creates a signature session
621
+
622
+ ## Overview This API creates a **signature session**, which enables your users to perform digital signatures without requiring you to implement a signature web page on your app. To create a signature session, your app specifies a `returnUrl` and receives back a `redirectUrl`. Your app then redirects the user to the `redirectUrl`, where he will digitally sign documents. Once the process is complete, the user will be redirected back to your app on the *returnUrl* you specified when starting the session. A query parameter will be added to the `returnUrl` containing the signature session ID (`?signatureSessionId=...`). Then, your app parses the signature session ID on the query string and uses it to call APIs to fetch the documents signed by the user. The session can either have predefined documents that the user must sign (passed on the `Documents` collection) or allow the user to upload his own documents (in this case, omit the `Documents` collection). ## Showing the signature page on a new tab The default behavior is for your app to provide a `returnUrl`, and then redirect the user to the `returnUrl` returned by this API with a HTTP redirection response (e.g. *303 See Other*) or with a `location.href = ...` call on Javascript. By the end of the procedure, the user is redirected back to your app, all in a single browser tab. Alternatively, you may want to display the signature page on a new tab. In this case, omit the `returnUrl` parameter when creating the session. Furthermore, you must open the tab with an HTML anchor tag with `target=\"_blank\"`, or with the `window.open()` function on Javascript. The tab will then be closed by the end of the process. ## Background processing By default, users are kept waiting while documents are processed before being redirected back to your application. If you want to provide your users with a faster experience, turn on background processing by passing `EnableBackgroundProcessing = true`. In this case, users do not wait for documents to be processed. However, your application must be ready to handle the case of a signature session whose documents are not yet available for download. ## Webhooks You may configure your Rest PKI Core subscription to inform your app of any documents that are signed on signature sessions created by it. This way, you don't need to rely on users landing back on your page to detect that documents have been signed. Please refer to the *Webhooks* section for more information. ## Disabling downloads If you don't receive webhook notifications of documents signed, you might feel like the signature session process is not working reliably because some users simply download the signed documents and don't bother to stick around while they are redirected back to your app, denying it the chance to detect that documents have been signed. If you feel this is a problem for your case, you can disable the downloading of signed documents by passing `DisableDownloads = true`. Then, users will only be able to download documents through your app, and thus will be far less inclined to quit the process prematurely. ## File name validation If you want to validate the file names that are acceptable for users to upload, you can configure the *acceptable file name pattern* on your subscription's configuration to a regular expression conforming to your rules. You can also configure a *file name validation endpoint*, an API implemented by your app that is called for each file selected by the user with the file's name and MIME type and returns whether the file should be acceptable or not (and, if not, a reason to be displayed to the user).
623
+
624
+ :param create_signature_session_request:
625
+ :type create_signature_session_request: CreateSignatureSessionRequest
626
+ :param _request_timeout: timeout setting for this request. If one
627
+ number provided, it will be total request
628
+ timeout. It can also be a pair (tuple) of
629
+ (connection, read) timeouts.
630
+ :type _request_timeout: int, tuple(int, int), optional
631
+ :param _request_auth: set to override the auth_settings for an a single
632
+ request; this effectively ignores the
633
+ authentication in the spec for a single request.
634
+ :type _request_auth: dict, optional
635
+ :param _content_type: force content-type for the request.
636
+ :type _content_type: str, Optional
637
+ :param _headers: set to override the headers for a single
638
+ request; this effectively ignores the headers
639
+ in the spec for a single request.
640
+ :type _headers: dict, optional
641
+ :param _host_index: set to override the host_index for a single
642
+ request; this effectively ignores the host_index
643
+ in the spec for a single request.
644
+ :type _host_index: int, optional
645
+ :return: Returns the result object.
646
+ """ # noqa: E501
647
+
648
+ _param = self._api_signature_sessions_post_serialize(
649
+ create_signature_session_request=create_signature_session_request,
650
+ _request_auth=_request_auth,
651
+ _content_type=_content_type,
652
+ _headers=_headers,
653
+ _host_index=_host_index
654
+ )
655
+
656
+ _response_types_map: Dict[str, Optional[str]] = {
657
+ '200': "CreateSignatureSessionResponse",
658
+ '400': None,
659
+ '401': None,
660
+ '403': None,
661
+ '422': None
662
+
663
+ }
664
+ response_data = self.api_client.call_api(
665
+ *_param,
666
+ _request_timeout=_request_timeout
667
+ )
668
+ response_data.read()
669
+ return self.api_client.response_deserialize(
670
+ response_data=response_data,
671
+ response_types_map=_response_types_map,
672
+ ).data
673
+
674
+
675
+ @validate_call
676
+ def api_signature_sessions_post_with_http_info(
677
+ self,
678
+ create_signature_session_request: Optional[CreateSignatureSessionRequest] = None,
679
+ _request_timeout: Union[
680
+ None,
681
+ Annotated[StrictFloat, Field(gt=0)],
682
+ Tuple[
683
+ Annotated[StrictFloat, Field(gt=0)],
684
+ Annotated[StrictFloat, Field(gt=0)]
685
+ ]
686
+ ] = None,
687
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
688
+ _content_type: Optional[StrictStr] = None,
689
+ _headers: Optional[Dict[StrictStr, Any]] = None,
690
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
691
+ ) -> ApiResponse[CreateSignatureSessionResponse]:
692
+ """Creates a signature session
693
+
694
+ ## Overview This API creates a **signature session**, which enables your users to perform digital signatures without requiring you to implement a signature web page on your app. To create a signature session, your app specifies a `returnUrl` and receives back a `redirectUrl`. Your app then redirects the user to the `redirectUrl`, where he will digitally sign documents. Once the process is complete, the user will be redirected back to your app on the *returnUrl* you specified when starting the session. A query parameter will be added to the `returnUrl` containing the signature session ID (`?signatureSessionId=...`). Then, your app parses the signature session ID on the query string and uses it to call APIs to fetch the documents signed by the user. The session can either have predefined documents that the user must sign (passed on the `Documents` collection) or allow the user to upload his own documents (in this case, omit the `Documents` collection). ## Showing the signature page on a new tab The default behavior is for your app to provide a `returnUrl`, and then redirect the user to the `returnUrl` returned by this API with a HTTP redirection response (e.g. *303 See Other*) or with a `location.href = ...` call on Javascript. By the end of the procedure, the user is redirected back to your app, all in a single browser tab. Alternatively, you may want to display the signature page on a new tab. In this case, omit the `returnUrl` parameter when creating the session. Furthermore, you must open the tab with an HTML anchor tag with `target=\"_blank\"`, or with the `window.open()` function on Javascript. The tab will then be closed by the end of the process. ## Background processing By default, users are kept waiting while documents are processed before being redirected back to your application. If you want to provide your users with a faster experience, turn on background processing by passing `EnableBackgroundProcessing = true`. In this case, users do not wait for documents to be processed. However, your application must be ready to handle the case of a signature session whose documents are not yet available for download. ## Webhooks You may configure your Rest PKI Core subscription to inform your app of any documents that are signed on signature sessions created by it. This way, you don't need to rely on users landing back on your page to detect that documents have been signed. Please refer to the *Webhooks* section for more information. ## Disabling downloads If you don't receive webhook notifications of documents signed, you might feel like the signature session process is not working reliably because some users simply download the signed documents and don't bother to stick around while they are redirected back to your app, denying it the chance to detect that documents have been signed. If you feel this is a problem for your case, you can disable the downloading of signed documents by passing `DisableDownloads = true`. Then, users will only be able to download documents through your app, and thus will be far less inclined to quit the process prematurely. ## File name validation If you want to validate the file names that are acceptable for users to upload, you can configure the *acceptable file name pattern* on your subscription's configuration to a regular expression conforming to your rules. You can also configure a *file name validation endpoint*, an API implemented by your app that is called for each file selected by the user with the file's name and MIME type and returns whether the file should be acceptable or not (and, if not, a reason to be displayed to the user).
695
+
696
+ :param create_signature_session_request:
697
+ :type create_signature_session_request: CreateSignatureSessionRequest
698
+ :param _request_timeout: timeout setting for this request. If one
699
+ number provided, it will be total request
700
+ timeout. It can also be a pair (tuple) of
701
+ (connection, read) timeouts.
702
+ :type _request_timeout: int, tuple(int, int), optional
703
+ :param _request_auth: set to override the auth_settings for an a single
704
+ request; this effectively ignores the
705
+ authentication in the spec for a single request.
706
+ :type _request_auth: dict, optional
707
+ :param _content_type: force content-type for the request.
708
+ :type _content_type: str, Optional
709
+ :param _headers: set to override the headers for a single
710
+ request; this effectively ignores the headers
711
+ in the spec for a single request.
712
+ :type _headers: dict, optional
713
+ :param _host_index: set to override the host_index for a single
714
+ request; this effectively ignores the host_index
715
+ in the spec for a single request.
716
+ :type _host_index: int, optional
717
+ :return: Returns the result object.
718
+ """ # noqa: E501
719
+
720
+ _param = self._api_signature_sessions_post_serialize(
721
+ create_signature_session_request=create_signature_session_request,
722
+ _request_auth=_request_auth,
723
+ _content_type=_content_type,
724
+ _headers=_headers,
725
+ _host_index=_host_index
726
+ )
727
+
728
+ _response_types_map: Dict[str, Optional[str]] = {
729
+ '200': "CreateSignatureSessionResponse",
730
+ '400': None,
731
+ '401': None,
732
+ '403': None,
733
+ '422': None
734
+
735
+ }
736
+ response_data = self.api_client.call_api(
737
+ *_param,
738
+ _request_timeout=_request_timeout
739
+ )
740
+ response_data.read()
741
+ return self.api_client.response_deserialize(
742
+ response_data=response_data,
743
+ response_types_map=_response_types_map,
744
+ )
745
+
746
+
747
+ @validate_call
748
+ def api_signature_sessions_post_without_preload_content(
749
+ self,
750
+ create_signature_session_request: Optional[CreateSignatureSessionRequest] = None,
751
+ _request_timeout: Union[
752
+ None,
753
+ Annotated[StrictFloat, Field(gt=0)],
754
+ Tuple[
755
+ Annotated[StrictFloat, Field(gt=0)],
756
+ Annotated[StrictFloat, Field(gt=0)]
757
+ ]
758
+ ] = None,
759
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
760
+ _content_type: Optional[StrictStr] = None,
761
+ _headers: Optional[Dict[StrictStr, Any]] = None,
762
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
763
+ ) -> RESTResponseType:
764
+ """Creates a signature session
765
+
766
+ ## Overview This API creates a **signature session**, which enables your users to perform digital signatures without requiring you to implement a signature web page on your app. To create a signature session, your app specifies a `returnUrl` and receives back a `redirectUrl`. Your app then redirects the user to the `redirectUrl`, where he will digitally sign documents. Once the process is complete, the user will be redirected back to your app on the *returnUrl* you specified when starting the session. A query parameter will be added to the `returnUrl` containing the signature session ID (`?signatureSessionId=...`). Then, your app parses the signature session ID on the query string and uses it to call APIs to fetch the documents signed by the user. The session can either have predefined documents that the user must sign (passed on the `Documents` collection) or allow the user to upload his own documents (in this case, omit the `Documents` collection). ## Showing the signature page on a new tab The default behavior is for your app to provide a `returnUrl`, and then redirect the user to the `returnUrl` returned by this API with a HTTP redirection response (e.g. *303 See Other*) or with a `location.href = ...` call on Javascript. By the end of the procedure, the user is redirected back to your app, all in a single browser tab. Alternatively, you may want to display the signature page on a new tab. In this case, omit the `returnUrl` parameter when creating the session. Furthermore, you must open the tab with an HTML anchor tag with `target=\"_blank\"`, or with the `window.open()` function on Javascript. The tab will then be closed by the end of the process. ## Background processing By default, users are kept waiting while documents are processed before being redirected back to your application. If you want to provide your users with a faster experience, turn on background processing by passing `EnableBackgroundProcessing = true`. In this case, users do not wait for documents to be processed. However, your application must be ready to handle the case of a signature session whose documents are not yet available for download. ## Webhooks You may configure your Rest PKI Core subscription to inform your app of any documents that are signed on signature sessions created by it. This way, you don't need to rely on users landing back on your page to detect that documents have been signed. Please refer to the *Webhooks* section for more information. ## Disabling downloads If you don't receive webhook notifications of documents signed, you might feel like the signature session process is not working reliably because some users simply download the signed documents and don't bother to stick around while they are redirected back to your app, denying it the chance to detect that documents have been signed. If you feel this is a problem for your case, you can disable the downloading of signed documents by passing `DisableDownloads = true`. Then, users will only be able to download documents through your app, and thus will be far less inclined to quit the process prematurely. ## File name validation If you want to validate the file names that are acceptable for users to upload, you can configure the *acceptable file name pattern* on your subscription's configuration to a regular expression conforming to your rules. You can also configure a *file name validation endpoint*, an API implemented by your app that is called for each file selected by the user with the file's name and MIME type and returns whether the file should be acceptable or not (and, if not, a reason to be displayed to the user).
767
+
768
+ :param create_signature_session_request:
769
+ :type create_signature_session_request: CreateSignatureSessionRequest
770
+ :param _request_timeout: timeout setting for this request. If one
771
+ number provided, it will be total request
772
+ timeout. It can also be a pair (tuple) of
773
+ (connection, read) timeouts.
774
+ :type _request_timeout: int, tuple(int, int), optional
775
+ :param _request_auth: set to override the auth_settings for an a single
776
+ request; this effectively ignores the
777
+ authentication in the spec for a single request.
778
+ :type _request_auth: dict, optional
779
+ :param _content_type: force content-type for the request.
780
+ :type _content_type: str, Optional
781
+ :param _headers: set to override the headers for a single
782
+ request; this effectively ignores the headers
783
+ in the spec for a single request.
784
+ :type _headers: dict, optional
785
+ :param _host_index: set to override the host_index for a single
786
+ request; this effectively ignores the host_index
787
+ in the spec for a single request.
788
+ :type _host_index: int, optional
789
+ :return: Returns the result object.
790
+ """ # noqa: E501
791
+
792
+ _param = self._api_signature_sessions_post_serialize(
793
+ create_signature_session_request=create_signature_session_request,
794
+ _request_auth=_request_auth,
795
+ _content_type=_content_type,
796
+ _headers=_headers,
797
+ _host_index=_host_index
798
+ )
799
+
800
+ _response_types_map: Dict[str, Optional[str]] = {
801
+ '200': "CreateSignatureSessionResponse",
802
+ '400': None,
803
+ '401': None,
804
+ '403': None,
805
+ '422': None
806
+
807
+ }
808
+ response_data = self.api_client.call_api(
809
+ *_param,
810
+ _request_timeout=_request_timeout
811
+ )
812
+ return response_data.response
813
+
814
+
815
+ def _api_signature_sessions_post_serialize(
816
+ self,
817
+ create_signature_session_request,
818
+ _request_auth,
819
+ _content_type,
820
+ _headers,
821
+ _host_index,
822
+ ) -> Tuple:
823
+
824
+ _host = None
825
+
826
+ _collection_formats: Dict[str, str] = {
827
+
828
+ }
829
+
830
+ _path_params: Dict[str, str] = {}
831
+ _query_params: List[Tuple[str, str]] = []
832
+ _header_params: Dict[str, Optional[str]] = _headers or {}
833
+ _form_params: List[Tuple[str, str]] = []
834
+ _files: Dict[str, str] = {}
835
+ _body_params: Optional[bytes] = None
836
+
837
+ # process the path parameters
838
+ # process the query parameters
839
+ # process the header parameters
840
+ # process the form parameters
841
+ # process the body parameter
842
+ if create_signature_session_request is not None:
843
+ _body_params = create_signature_session_request
844
+
845
+
846
+ # set the HTTP header `Accept`
847
+ _header_params['Accept'] = self.api_client.select_header_accept(
848
+ [
849
+ 'text/plain',
850
+ 'application/json',
851
+ 'text/json'
852
+ ]
853
+ )
854
+
855
+ # set the HTTP header `Content-Type`
856
+ if _content_type:
857
+ _header_params['Content-Type'] = _content_type
858
+ else:
859
+ _default_content_type = (
860
+ self.api_client.select_header_content_type(
861
+ [
862
+ 'application/json-patch+json',
863
+ 'application/json',
864
+ 'text/json',
865
+ 'application/*+json'
866
+ ]
867
+ )
868
+ )
869
+ if _default_content_type is not None:
870
+ _header_params['Content-Type'] = _default_content_type
871
+
872
+ # authentication setting
873
+ _auth_settings: List[str] = [
874
+ ]
875
+
876
+ return self.api_client.param_serialize(
877
+ method='POST',
878
+ resource_path='/api/signature-sessions',
879
+ path_params=_path_params,
880
+ query_params=_query_params,
881
+ header_params=_header_params,
882
+ body=_body_params,
883
+ post_params=_form_params,
884
+ files=_files,
885
+ auth_settings=_auth_settings,
886
+ collection_formats=_collection_formats,
887
+ _host=_host,
888
+ _request_auth=_request_auth
889
+ )
890
+
891
+