signedly 0.1.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 (74) hide show
  1. signedly/__init__.py +92 -0
  2. signedly/api/__init__.py +14 -0
  3. signedly/api/api_request_logs_api.py +686 -0
  4. signedly/api/authentication_api.py +603 -0
  5. signedly/api/bulk_sending_api.py +858 -0
  6. signedly/api/documents_api.py +2465 -0
  7. signedly/api/downloads_api.py +840 -0
  8. signedly/api/fields_api.py +2308 -0
  9. signedly/api/sending_api.py +890 -0
  10. signedly/api/signatories_api.py +1165 -0
  11. signedly/api/templates_api.py +1452 -0
  12. signedly/api/webhooks_api.py +2582 -0
  13. signedly/api_client.py +798 -0
  14. signedly/api_response.py +21 -0
  15. signedly/configuration.py +596 -0
  16. signedly/exceptions.py +200 -0
  17. signedly/helpers.py +89 -0
  18. signedly/models/__init__.py +66 -0
  19. signedly/models/create_bulk_send202_response.py +105 -0
  20. signedly/models/create_bulk_send_request.py +101 -0
  21. signedly/models/create_document_fields_request_inner.py +156 -0
  22. signedly/models/create_document_from_template200_response.py +101 -0
  23. signedly/models/create_document_from_template_request.py +115 -0
  24. signedly/models/create_document_from_template_request_recipients_inner.py +92 -0
  25. signedly/models/create_signatories_request.py +100 -0
  26. signedly/models/create_signatories_request_signatories_inner.py +92 -0
  27. signedly/models/create_signatory_request.py +94 -0
  28. signedly/models/create_template_fields_request_inner.py +156 -0
  29. signedly/models/create_webhook_endpoint_request.py +103 -0
  30. signedly/models/delete_field_request.py +88 -0
  31. signedly/models/document.py +159 -0
  32. signedly/models/document_page.py +113 -0
  33. signedly/models/document_status_page.py +113 -0
  34. signedly/models/document_status_row.py +90 -0
  35. signedly/models/fill_and_send_document_request.py +116 -0
  36. signedly/models/fill_and_send_document_request_elements_inner.py +96 -0
  37. signedly/models/get_access_token_request.py +90 -0
  38. signedly/models/get_audit_trail_link200_response.py +88 -0
  39. signedly/models/get_download_status200_response.py +90 -0
  40. signedly/models/list_bulk_send_columns200_response_inner.py +92 -0
  41. signedly/models/model_field.py +202 -0
  42. signedly/models/page.py +102 -0
  43. signedly/models/refresh_access_token200_response.py +99 -0
  44. signedly/models/refresh_access_token_request.py +88 -0
  45. signedly/models/request_count_page.py +113 -0
  46. signedly/models/request_hit.py +93 -0
  47. signedly/models/request_log.py +108 -0
  48. signedly/models/request_log_page.py +113 -0
  49. signedly/models/send_document200_response.py +88 -0
  50. signedly/models/send_document_by_link200_response.py +90 -0
  51. signedly/models/send_document_by_link_request.py +91 -0
  52. signedly/models/send_document_request.py +102 -0
  53. signedly/models/signatory.py +119 -0
  54. signedly/models/template.py +124 -0
  55. signedly/models/template_field.py +202 -0
  56. signedly/models/template_page.py +113 -0
  57. signedly/models/update_document_field_by_body_request.py +158 -0
  58. signedly/models/update_document_field_by_body_request_items_inner.py +92 -0
  59. signedly/models/update_webhook_endpoint_request.py +105 -0
  60. signedly/models/upload.py +110 -0
  61. signedly/models/upload_document_for_one_signer200_response.py +90 -0
  62. signedly/models/upload_document_for_one_signer_request.py +96 -0
  63. signedly/models/upload_document_request.py +101 -0
  64. signedly/models/webhook_delivery.py +140 -0
  65. signedly/models/webhook_delivery_page.py +113 -0
  66. signedly/models/webhook_endpoint.py +116 -0
  67. signedly/models/webhook_endpoint_with_secret.py +120 -0
  68. signedly/py.typed +0 -0
  69. signedly/rest.py +258 -0
  70. signedly-0.1.0.dist-info/LICENSE +21 -0
  71. signedly-0.1.0.dist-info/METADATA +18 -0
  72. signedly-0.1.0.dist-info/RECORD +74 -0
  73. signedly-0.1.0.dist-info/WHEEL +5 -0
  74. signedly-0.1.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,2465 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Signedly API
5
+
6
+ The Signedly REST API lets your system upload documents, add signatories and fields, send them for signing and download the signed result. Every path starts with `/ap1/`, and every request and response body is JSON unless an endpoint says otherwise (the uploads are `multipart/form-data`). ## Authentication 1. In the Signedly web app, open **Account & Settings → API** and generate a **client ID** and **client secret** for your organisation. 2. `POST /ap1/token/` with them. You get an `access_token` (valid **2 hours**) and a `refresh_token` (valid **7 days**). While both are still valid, calling `/ap1/token/` again returns the same pair. 3. Send the access token on every other call: `Authorization: Bearer <access_token>`. 4. When the access token expires, `POST /ap1/refreshtoken/` with the refresh token for a new access token. When the refresh token has expired too, call `/ap1/token/` again. `/ap1/token/` and `/ap1/refreshtoken/` allow 60 calls a minute per IP address; more answer 429. A missing, unknown or expired access token answers 403 (`\"Client not found\"` or `\"Access token expired\"`). The API acts for your **organisation's admin account**: documents you upload belong to it and appear in its Signedly web app, and you can reach only that account's documents, templates, signatories and fields. Another organisation's IDs answer 404, as if they didn't exist. ## Plans What the API allows depends on the Signedly plan of your **organisation's admin account** (Account & Settings → Account & Plan). The same rules apply to live and test keys. | What | Free | Personal Pro | Business Pro | Teams | |---|---|---|---|---| | Generate live and test keys (Account & Settings → API) | – | ✓ | ✓ | ✓ | | Every endpoint, `/ap1/token/` and `/ap1/refreshtoken/` included | – | ✓ | ✓ | ✓ | | `require_email_otp` on `POST /ap1/signatories/` and `POST /ap1/signatories/bulk/` | – | ✓ | ✓ | ✓ | | Bulk send: `GET /ap1/bulk-sends/columns/` and `POST /ap1/bulk-sends/` | – | – | – | ✓ | The API is part of the paid plans. On Free (or with no plan) every call answers 403 `\"... Your plan doesn't include API access.\"`, with live or test keys, also with a token or keys made earlier; they work again once the plan is paid. On a paid plan, a feature it doesn't include answers 400 with `\"Your plan doesn't include ...\"` and changes nothing, and `GET /ap1/bulk-sends/{id}/` still reports bulk sends already made. Live documents also need an API contract with Signedly. Without one, or with an unpaid API invoice, `POST /ap1/upload/` (except templates), `/ap1/upload_app/`, `/ap1/documents/fromtemplate/` and `/ap1/bulk-sends/` answer 402 with live keys. Test keys work without a contract (see Sandbox). ## Sending a document for signing 1. `POST /ap1/upload/` a PDF or DOCX (`type` 2). The document is prepared in the background: find it in `GET /ap1/documents/?name=<name>` (its `upload.id` is the upload's `id`), and wait until `GET /ap1/documents/{id}/pages/` lists its pages. 2. `POST /ap1/signatories/` (one) or `POST /ap1/signatories/bulk/` (several) to add the people who sign. 3. `POST /ap1/documents/fields/` to place the fields each signatory fills in. 4. Send it: - `POST /ap1/document/send/` emails every signatory a signing link (with ordered signing, only the first; each next one is emailed in turn), or - `POST /ap1/document/send_url/` sends no email and returns the first signatory's signing link, for you to show or send yourself. 5. Poll `GET /ap1/documents-status-list/` (or `GET /ap1/documents/`) until the status is 6 (Completed), then `GET /ap1/document/download-link/` for the signed PDF and `GET /ap1/document/download-audit-link/` for its audit trail. **From a template:** upload with `type` 4 and a `template_name` (or make the template in the web app), place its fields with `POST /ap1/templates/fields/`, then for each signing make a document with `POST /ap1/documents/fromtemplate/`, add its signatory, and send it. **One signer, one call:** `POST /ap1/upload_app/` uploads a PDF or DOCX for one signer and returns their signing link in `redirect_url`; the signer places their own signature. After signing they go to the `redirect_url` you sent, and the signed PDF and its audit trail are emailed to `final_email` (otherwise to your organisation's admin). ## Quick start with curl Each step uses an ID from the step before. `$API` is this server, e.g. `https://l0ads.signedly.com`. ```bash # 1. Token curl -X POST $API/ap1/token/ -H 'Content-Type: application/json' \\ -d '{\"client_id\": \"<client id>\", \"client_secret\": \"<client secret>\"}' TOKEN=<access_token from the answer> # 2. Upload a PDF (answers with the upload's id) curl -X POST $API/ap1/upload/ -H \"Authorization: Bearer $TOKEN\" \\ -F file=@nda.pdf -F name=nda-ann-lee -F type=2 # 3. Find the document, then wait until it has pages curl \"$API/ap1/documents/?name=nda-ann-lee\" -H \"Authorization: Bearer $TOKEN\" DOC=<results[0].id> curl $API/ap1/documents/$DOC/pages/ -H \"Authorization: Bearer $TOKEN\" PAGE=<[0].id> # 4. Add the signatory curl -X POST $API/ap1/signatories/ -H \"Authorization: Bearer $TOKEN\" \\ -H 'Content-Type: application/json' \\ -d '{\"document_id\": \"'$DOC'\", \"name\": \"Ann Lee\", \"email\": \"ann@example.com\"}' SIGNER=<id from the answer> # 5. Place her signature: 150 × 40 points, 72 points from the left, 640 from the top curl -X POST $API/ap1/documents/fields/ -H \"Authorization: Bearer $TOKEN\" \\ -H 'Content-Type: application/json' \\ -d '[{\"document_id\": \"'$DOC'\", \"signatory_id\": \"'$SIGNER'\", \"kind\": 2, \"label\": \"Signature\", \"placeholder\": \"Sign here\", \"page\": \"'$PAGE'\", \"page_number\": 0, \"x\": 72, \"y\": 640, \"width\": 150, \"height\": 40}]' # 6. Send it (Ann gets the signing email) curl -X POST $API/ap1/document/send/ -H \"Authorization: Bearer $TOKEN\" \\ -H 'Content-Type: application/json' \\ -d '{\"document_id\": \"'$DOC'\", \"subject\": \"Please sign the NDA\", \"message\": \"Hi Ann, please sign by Friday.\", \"expiry_date\": \"2026-12-31\"}' # 7. Poll until status is 6 (Completed), then get the signed PDF curl \"$API/ap1/documents-status-list/?document_ids=$DOC\" -H \"Authorization: Bearer $TOKEN\" curl \"$API/ap1/document/download-link/?id=$DOC\" -H \"Authorization: Bearer $TOKEN\" ``` ## Postman Import the whole API into Postman with **Import → Link** and `<this server>/swaggerap1/postman.json`. Set `client_id` and `client_secret` in the collection's **Variables**, run **Get an access token** (it saves the token for every other request), and set `document_id` when a request needs one. ## Webhooks Instead of polling, add an endpoint with `POST /ap1/webhooks/` (or in **Account & Settings → API**) and Signedly posts your organisation's document events to it: `document.sent`, `document.viewed`, `document.signed`, `document.approved`, `document.completed`, `document.rejected` and `document.expired` (all of them, or the `events` you choose). Each is a JSON `POST`: ```json {\"id\": \"5b7f…\", \"type\": \"document.signed\", \"created_at\": \"2026-10-27T09:12:00+00:00\", \"test\": false, \"data\": {\"document\": {\"id\": \"6f0c…\", \"name\": \"nda.pdf\", \"status\": 5}, \"recipient\": {\"id\": \"0b6e…\", \"email\": \"ann@example.com\", \"name\": \"Ann Lee\", \"role\": \"signer\"}}} ``` `recipient` is null for events no recipient caused (sent, completed, expired); `test` is true for documents made with your test keys. Fetch anything else, such as download links, with your access token: events never carry links. **Check every event is from Signedly.** The `Signedly-Signature` header is `t=<unix seconds>,v1=<signature>`, where the signature is the hex HMAC-SHA256 of `<t>.<raw body>` with the endpoint's secret. Refuse an event whose signature doesn't match or whose `t` is more than 5 minutes off: ```python import hashlib, hmac, time def is_from_signedly(secret, header, raw_body): parts = dict(item.split(\"=\", 1) for item in header.split(\",\")) signed = f\"{parts['t']}.{raw_body.decode()}\".encode() expected = hmac.new(secret.encode(), signed, hashlib.sha256).hexdigest() fresh = abs(time.time() - int(parts[\"t\"])) <= 300 return fresh and hmac.compare_digest(parts[\"v1\"], expected) ``` **Answer 2xx within 10 seconds**, then do the work. Anything else is retried after 1 and 5 minutes, then 30 minutes and 2, 5 and 10 hours (7 tries in about 18 hours). `Signedly-Event-Id` is the same on every try of an event: use it to ignore repeats. After 20 events in a row fail for good, Signedly switches the endpoint off and emails your organisation's admin; switch it on again with `PUT /ap1/webhooks/{id}/` and `\"is_active\": true`. Each endpoint's deliveries and their last answers are at `GET /ap1/webhooks/{id}/deliveries/`, and any can be sent again. ## Sandbox Build and test against the API without paying for documents: in **Account & Settings → API**, generate your **test keys**, and get a token with them at `/ap1/token/` as usual. Everything works the same, except that what you upload or make from a template with a test token is a **test document** (`is_test` on its upload): - every page of its PDF and of its audit trail says **TEST – NOT LEGALLY BINDING**; - its emails are real, with `[TEST]` at the start of the subject; - it isn't billed or counted toward your plan; - your organisation can make 50 a calendar month (templates don't count); the next upload answers 429. ## Fields Positions and sizes are in **PDF points** (1/72 inch), measured from the **top-left corner** of the page as it is displayed (rotation applied). `page_number` counts pages from 0. A field must sit wholly on its page (1 point of tolerance); otherwise it is refused with 400. A field's page and signatory can't be changed later: delete the field and add it again. ## Status values **Document `status`:** 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Signatories, fields and sends are only accepted while a document is 1–3 (not yet sent). **Signatory `status`:** 1 Waiting · 2 Invited · 3 Signed · 4 Viewed · 5 Rejected. ## Lists `GET /ap1/documents/`, `/ap1/documents-status-list/`, `/ap1/templates/`, `/ap1/logs/` and `/ap1/logs/hits/` are paged: pass `limit` (default 10) and `offset`, and read `count`, `next`, `previous` and `results` from the response. ## Errors | Status | Meaning | |---|---| | 400 | The request was refused, also when your plan doesn't include it (see Plans); the body says why (`{\"error\": \"...\"}`, or the name of each bad field with its messages). Nothing was changed. | | 403 | The access token is missing, unknown or expired; the client ID and secret or the refresh token were refused; the organisation's plan has no API access (Free, see Plans); or an `expiry_date` isn't in the future (`\"Invalid Date Entered\"`). | | 402 | No API contract, or an unpaid API invoice: live documents are refused (test keys keep working). | | 404 | The document, template, signatory or field doesn't exist or isn't yours. | | 429 | Too many token requests (wait a minute), or this month's 50 test documents are used. | | 5xx | Our side failed; retry later. | A send that times out may still have worked: check the document's status before sending again (a second send of a sent document answers 400). Download, view and audit links are valid for about 7 days; ask for a new one whenever you need it.
7
+
8
+ The version of the OpenAPI document: v1
9
+ Contact: info@signedly.com
10
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
11
+
12
+ Do not edit the class manually.
13
+ """ # noqa: E501
14
+
15
+ import warnings
16
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
17
+ from typing import Any, Dict, List, Optional, Tuple, Union
18
+ from typing_extensions import Annotated
19
+
20
+ from pydantic import Field, StrictBytes, StrictInt, StrictStr, field_validator
21
+ from typing import List, Optional, Tuple, Union
22
+ from typing_extensions import Annotated
23
+ from signedly.models.create_document_from_template200_response import CreateDocumentFromTemplate200Response
24
+ from signedly.models.create_document_from_template_request import CreateDocumentFromTemplateRequest
25
+ from signedly.models.document_page import DocumentPage
26
+ from signedly.models.document_status_page import DocumentStatusPage
27
+ from signedly.models.get_download_status200_response import GetDownloadStatus200Response
28
+ from signedly.models.page import Page
29
+ from signedly.models.send_document200_response import SendDocument200Response
30
+ from signedly.models.upload import Upload
31
+ from signedly.models.upload_document_for_one_signer200_response import UploadDocumentForOneSigner200Response
32
+
33
+ from signedly.api_client import ApiClient, RequestSerialized
34
+ from signedly.api_response import ApiResponse
35
+ from signedly.rest import RESTResponseType
36
+
37
+
38
+ class DocumentsApi:
39
+ """NOTE: This class is auto generated by OpenAPI Generator
40
+ Ref: https://openapi-generator.tech
41
+
42
+ Do not edit the class manually.
43
+ """
44
+
45
+ def __init__(self, api_client=None) -> None:
46
+ if api_client is None:
47
+ api_client = ApiClient.get_default()
48
+ self.api_client = api_client
49
+
50
+
51
+ @validate_call
52
+ def create_document_from_template(
53
+ self,
54
+ data: CreateDocumentFromTemplateRequest,
55
+ _request_timeout: Union[
56
+ None,
57
+ Annotated[StrictFloat, Field(gt=0)],
58
+ Tuple[
59
+ Annotated[StrictFloat, Field(gt=0)],
60
+ Annotated[StrictFloat, Field(gt=0)]
61
+ ]
62
+ ] = None,
63
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
64
+ _content_type: Optional[StrictStr] = None,
65
+ _headers: Optional[Dict[StrictStr, Any]] = None,
66
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
67
+ ) -> CreateDocumentFromTemplate200Response:
68
+ """Make a document from a template
69
+
70
+ Copies one of your templates into a new document, with its pages and fields, one recipient per template role and the template's signing order. Fill the open roles here with `recipients`, or later with POST /ap1/signatories/ (each takes the next open role); a document with an unfilled role can't be sent. To prefill a field, add a key with the field's label and the value, e.g. `\"Company\": \"Acme Ltd\"`.
71
+
72
+ :param data: (required)
73
+ :type data: CreateDocumentFromTemplateRequest
74
+ :param _request_timeout: timeout setting for this request. If one
75
+ number provided, it will be total request
76
+ timeout. It can also be a pair (tuple) of
77
+ (connection, read) timeouts.
78
+ :type _request_timeout: int, tuple(int, int), optional
79
+ :param _request_auth: set to override the auth_settings for an a single
80
+ request; this effectively ignores the
81
+ authentication in the spec for a single request.
82
+ :type _request_auth: dict, optional
83
+ :param _content_type: force content-type for the request.
84
+ :type _content_type: str, Optional
85
+ :param _headers: set to override the headers for a single
86
+ request; this effectively ignores the headers
87
+ in the spec for a single request.
88
+ :type _headers: dict, optional
89
+ :param _host_index: set to override the host_index for a single
90
+ request; this effectively ignores the host_index
91
+ in the spec for a single request.
92
+ :type _host_index: int, optional
93
+ :return: Returns the result object.
94
+ """ # noqa: E501
95
+
96
+ _param = self._create_document_from_template_serialize(
97
+ data=data,
98
+ _request_auth=_request_auth,
99
+ _content_type=_content_type,
100
+ _headers=_headers,
101
+ _host_index=_host_index
102
+ )
103
+
104
+ _response_types_map: Dict[str, Optional[str]] = {
105
+ '200': "CreateDocumentFromTemplate200Response",
106
+ '400': "Dict[str, object]",
107
+ '404': "Dict[str, object]",
108
+ }
109
+ response_data = self.api_client.call_api(
110
+ *_param,
111
+ _request_timeout=_request_timeout
112
+ )
113
+ response_data.read()
114
+ return self.api_client.response_deserialize(
115
+ response_data=response_data,
116
+ response_types_map=_response_types_map,
117
+ ).data
118
+
119
+
120
+ @validate_call
121
+ def create_document_from_template_with_http_info(
122
+ self,
123
+ data: CreateDocumentFromTemplateRequest,
124
+ _request_timeout: Union[
125
+ None,
126
+ Annotated[StrictFloat, Field(gt=0)],
127
+ Tuple[
128
+ Annotated[StrictFloat, Field(gt=0)],
129
+ Annotated[StrictFloat, Field(gt=0)]
130
+ ]
131
+ ] = None,
132
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
133
+ _content_type: Optional[StrictStr] = None,
134
+ _headers: Optional[Dict[StrictStr, Any]] = None,
135
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
136
+ ) -> ApiResponse[CreateDocumentFromTemplate200Response]:
137
+ """Make a document from a template
138
+
139
+ Copies one of your templates into a new document, with its pages and fields, one recipient per template role and the template's signing order. Fill the open roles here with `recipients`, or later with POST /ap1/signatories/ (each takes the next open role); a document with an unfilled role can't be sent. To prefill a field, add a key with the field's label and the value, e.g. `\"Company\": \"Acme Ltd\"`.
140
+
141
+ :param data: (required)
142
+ :type data: CreateDocumentFromTemplateRequest
143
+ :param _request_timeout: timeout setting for this request. If one
144
+ number provided, it will be total request
145
+ timeout. It can also be a pair (tuple) of
146
+ (connection, read) timeouts.
147
+ :type _request_timeout: int, tuple(int, int), optional
148
+ :param _request_auth: set to override the auth_settings for an a single
149
+ request; this effectively ignores the
150
+ authentication in the spec for a single request.
151
+ :type _request_auth: dict, optional
152
+ :param _content_type: force content-type for the request.
153
+ :type _content_type: str, Optional
154
+ :param _headers: set to override the headers for a single
155
+ request; this effectively ignores the headers
156
+ in the spec for a single request.
157
+ :type _headers: dict, optional
158
+ :param _host_index: set to override the host_index for a single
159
+ request; this effectively ignores the host_index
160
+ in the spec for a single request.
161
+ :type _host_index: int, optional
162
+ :return: Returns the result object.
163
+ """ # noqa: E501
164
+
165
+ _param = self._create_document_from_template_serialize(
166
+ data=data,
167
+ _request_auth=_request_auth,
168
+ _content_type=_content_type,
169
+ _headers=_headers,
170
+ _host_index=_host_index
171
+ )
172
+
173
+ _response_types_map: Dict[str, Optional[str]] = {
174
+ '200': "CreateDocumentFromTemplate200Response",
175
+ '400': "Dict[str, object]",
176
+ '404': "Dict[str, object]",
177
+ }
178
+ response_data = self.api_client.call_api(
179
+ *_param,
180
+ _request_timeout=_request_timeout
181
+ )
182
+ response_data.read()
183
+ return self.api_client.response_deserialize(
184
+ response_data=response_data,
185
+ response_types_map=_response_types_map,
186
+ )
187
+
188
+
189
+ @validate_call
190
+ def create_document_from_template_without_preload_content(
191
+ self,
192
+ data: CreateDocumentFromTemplateRequest,
193
+ _request_timeout: Union[
194
+ None,
195
+ Annotated[StrictFloat, Field(gt=0)],
196
+ Tuple[
197
+ Annotated[StrictFloat, Field(gt=0)],
198
+ Annotated[StrictFloat, Field(gt=0)]
199
+ ]
200
+ ] = None,
201
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
202
+ _content_type: Optional[StrictStr] = None,
203
+ _headers: Optional[Dict[StrictStr, Any]] = None,
204
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
205
+ ) -> RESTResponseType:
206
+ """Make a document from a template
207
+
208
+ Copies one of your templates into a new document, with its pages and fields, one recipient per template role and the template's signing order. Fill the open roles here with `recipients`, or later with POST /ap1/signatories/ (each takes the next open role); a document with an unfilled role can't be sent. To prefill a field, add a key with the field's label and the value, e.g. `\"Company\": \"Acme Ltd\"`.
209
+
210
+ :param data: (required)
211
+ :type data: CreateDocumentFromTemplateRequest
212
+ :param _request_timeout: timeout setting for this request. If one
213
+ number provided, it will be total request
214
+ timeout. It can also be a pair (tuple) of
215
+ (connection, read) timeouts.
216
+ :type _request_timeout: int, tuple(int, int), optional
217
+ :param _request_auth: set to override the auth_settings for an a single
218
+ request; this effectively ignores the
219
+ authentication in the spec for a single request.
220
+ :type _request_auth: dict, optional
221
+ :param _content_type: force content-type for the request.
222
+ :type _content_type: str, Optional
223
+ :param _headers: set to override the headers for a single
224
+ request; this effectively ignores the headers
225
+ in the spec for a single request.
226
+ :type _headers: dict, optional
227
+ :param _host_index: set to override the host_index for a single
228
+ request; this effectively ignores the host_index
229
+ in the spec for a single request.
230
+ :type _host_index: int, optional
231
+ :return: Returns the result object.
232
+ """ # noqa: E501
233
+
234
+ _param = self._create_document_from_template_serialize(
235
+ data=data,
236
+ _request_auth=_request_auth,
237
+ _content_type=_content_type,
238
+ _headers=_headers,
239
+ _host_index=_host_index
240
+ )
241
+
242
+ _response_types_map: Dict[str, Optional[str]] = {
243
+ '200': "CreateDocumentFromTemplate200Response",
244
+ '400': "Dict[str, object]",
245
+ '404': "Dict[str, object]",
246
+ }
247
+ response_data = self.api_client.call_api(
248
+ *_param,
249
+ _request_timeout=_request_timeout
250
+ )
251
+ return response_data.response
252
+
253
+
254
+ def _create_document_from_template_serialize(
255
+ self,
256
+ data,
257
+ _request_auth,
258
+ _content_type,
259
+ _headers,
260
+ _host_index,
261
+ ) -> RequestSerialized:
262
+
263
+ _host = None
264
+
265
+ _collection_formats: Dict[str, str] = {
266
+ }
267
+
268
+ _path_params: Dict[str, str] = {}
269
+ _query_params: List[Tuple[str, str]] = []
270
+ _header_params: Dict[str, Optional[str]] = _headers or {}
271
+ _form_params: List[Tuple[str, str]] = []
272
+ _files: Dict[
273
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
274
+ ] = {}
275
+ _body_params: Optional[bytes] = None
276
+
277
+ # process the path parameters
278
+ # process the query parameters
279
+ # process the header parameters
280
+ # process the form parameters
281
+ # process the body parameter
282
+ if data is not None:
283
+ _body_params = data
284
+
285
+
286
+ # set the HTTP header `Accept`
287
+ if 'Accept' not in _header_params:
288
+ _header_params['Accept'] = self.api_client.select_header_accept(
289
+ [
290
+ 'application/json'
291
+ ]
292
+ )
293
+
294
+ # set the HTTP header `Content-Type`
295
+ if _content_type:
296
+ _header_params['Content-Type'] = _content_type
297
+ else:
298
+ _default_content_type = (
299
+ self.api_client.select_header_content_type(
300
+ [
301
+ 'application/json'
302
+ ]
303
+ )
304
+ )
305
+ if _default_content_type is not None:
306
+ _header_params['Content-Type'] = _default_content_type
307
+
308
+ # authentication setting
309
+ _auth_settings: List[str] = [
310
+ 'Bearer'
311
+ ]
312
+
313
+ return self.api_client.param_serialize(
314
+ method='POST',
315
+ resource_path='/ap1/documents/fromtemplate/',
316
+ path_params=_path_params,
317
+ query_params=_query_params,
318
+ header_params=_header_params,
319
+ body=_body_params,
320
+ post_params=_form_params,
321
+ files=_files,
322
+ auth_settings=_auth_settings,
323
+ collection_formats=_collection_formats,
324
+ _host=_host,
325
+ _request_auth=_request_auth
326
+ )
327
+
328
+
329
+
330
+
331
+ @validate_call
332
+ def delete_document(
333
+ self,
334
+ id: Annotated[StrictStr, Field(description="The document's or template's ID.")],
335
+ _request_timeout: Union[
336
+ None,
337
+ Annotated[StrictFloat, Field(gt=0)],
338
+ Tuple[
339
+ Annotated[StrictFloat, Field(gt=0)],
340
+ Annotated[StrictFloat, Field(gt=0)]
341
+ ]
342
+ ] = None,
343
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
344
+ _content_type: Optional[StrictStr] = None,
345
+ _headers: Optional[Dict[StrictStr, Any]] = None,
346
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
347
+ ) -> SendDocument200Response:
348
+ """Delete a template or an unsent document
349
+
350
+ Deletes a template, or a document that was never sent, with its files. A document that has been sent is a signed record and can't be deleted.
351
+
352
+ :param id: The document's or template's ID. (required)
353
+ :type id: str
354
+ :param _request_timeout: timeout setting for this request. If one
355
+ number provided, it will be total request
356
+ timeout. It can also be a pair (tuple) of
357
+ (connection, read) timeouts.
358
+ :type _request_timeout: int, tuple(int, int), optional
359
+ :param _request_auth: set to override the auth_settings for an a single
360
+ request; this effectively ignores the
361
+ authentication in the spec for a single request.
362
+ :type _request_auth: dict, optional
363
+ :param _content_type: force content-type for the request.
364
+ :type _content_type: str, Optional
365
+ :param _headers: set to override the headers for a single
366
+ request; this effectively ignores the headers
367
+ in the spec for a single request.
368
+ :type _headers: dict, optional
369
+ :param _host_index: set to override the host_index for a single
370
+ request; this effectively ignores the host_index
371
+ in the spec for a single request.
372
+ :type _host_index: int, optional
373
+ :return: Returns the result object.
374
+ """ # noqa: E501
375
+
376
+ _param = self._delete_document_serialize(
377
+ id=id,
378
+ _request_auth=_request_auth,
379
+ _content_type=_content_type,
380
+ _headers=_headers,
381
+ _host_index=_host_index
382
+ )
383
+
384
+ _response_types_map: Dict[str, Optional[str]] = {
385
+ '204': "SendDocument200Response",
386
+ '400': "Dict[str, object]",
387
+ '403': "Dict[str, object]",
388
+ '404': "Dict[str, object]",
389
+ }
390
+ response_data = self.api_client.call_api(
391
+ *_param,
392
+ _request_timeout=_request_timeout
393
+ )
394
+ response_data.read()
395
+ return self.api_client.response_deserialize(
396
+ response_data=response_data,
397
+ response_types_map=_response_types_map,
398
+ ).data
399
+
400
+
401
+ @validate_call
402
+ def delete_document_with_http_info(
403
+ self,
404
+ id: Annotated[StrictStr, Field(description="The document's or template's ID.")],
405
+ _request_timeout: Union[
406
+ None,
407
+ Annotated[StrictFloat, Field(gt=0)],
408
+ Tuple[
409
+ Annotated[StrictFloat, Field(gt=0)],
410
+ Annotated[StrictFloat, Field(gt=0)]
411
+ ]
412
+ ] = None,
413
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
414
+ _content_type: Optional[StrictStr] = None,
415
+ _headers: Optional[Dict[StrictStr, Any]] = None,
416
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
417
+ ) -> ApiResponse[SendDocument200Response]:
418
+ """Delete a template or an unsent document
419
+
420
+ Deletes a template, or a document that was never sent, with its files. A document that has been sent is a signed record and can't be deleted.
421
+
422
+ :param id: The document's or template's ID. (required)
423
+ :type id: str
424
+ :param _request_timeout: timeout setting for this request. If one
425
+ number provided, it will be total request
426
+ timeout. It can also be a pair (tuple) of
427
+ (connection, read) timeouts.
428
+ :type _request_timeout: int, tuple(int, int), optional
429
+ :param _request_auth: set to override the auth_settings for an a single
430
+ request; this effectively ignores the
431
+ authentication in the spec for a single request.
432
+ :type _request_auth: dict, optional
433
+ :param _content_type: force content-type for the request.
434
+ :type _content_type: str, Optional
435
+ :param _headers: set to override the headers for a single
436
+ request; this effectively ignores the headers
437
+ in the spec for a single request.
438
+ :type _headers: dict, optional
439
+ :param _host_index: set to override the host_index for a single
440
+ request; this effectively ignores the host_index
441
+ in the spec for a single request.
442
+ :type _host_index: int, optional
443
+ :return: Returns the result object.
444
+ """ # noqa: E501
445
+
446
+ _param = self._delete_document_serialize(
447
+ id=id,
448
+ _request_auth=_request_auth,
449
+ _content_type=_content_type,
450
+ _headers=_headers,
451
+ _host_index=_host_index
452
+ )
453
+
454
+ _response_types_map: Dict[str, Optional[str]] = {
455
+ '204': "SendDocument200Response",
456
+ '400': "Dict[str, object]",
457
+ '403': "Dict[str, object]",
458
+ '404': "Dict[str, object]",
459
+ }
460
+ response_data = self.api_client.call_api(
461
+ *_param,
462
+ _request_timeout=_request_timeout
463
+ )
464
+ response_data.read()
465
+ return self.api_client.response_deserialize(
466
+ response_data=response_data,
467
+ response_types_map=_response_types_map,
468
+ )
469
+
470
+
471
+ @validate_call
472
+ def delete_document_without_preload_content(
473
+ self,
474
+ id: Annotated[StrictStr, Field(description="The document's or template's ID.")],
475
+ _request_timeout: Union[
476
+ None,
477
+ Annotated[StrictFloat, Field(gt=0)],
478
+ Tuple[
479
+ Annotated[StrictFloat, Field(gt=0)],
480
+ Annotated[StrictFloat, Field(gt=0)]
481
+ ]
482
+ ] = None,
483
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
484
+ _content_type: Optional[StrictStr] = None,
485
+ _headers: Optional[Dict[StrictStr, Any]] = None,
486
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
487
+ ) -> RESTResponseType:
488
+ """Delete a template or an unsent document
489
+
490
+ Deletes a template, or a document that was never sent, with its files. A document that has been sent is a signed record and can't be deleted.
491
+
492
+ :param id: The document's or template's ID. (required)
493
+ :type id: str
494
+ :param _request_timeout: timeout setting for this request. If one
495
+ number provided, it will be total request
496
+ timeout. It can also be a pair (tuple) of
497
+ (connection, read) timeouts.
498
+ :type _request_timeout: int, tuple(int, int), optional
499
+ :param _request_auth: set to override the auth_settings for an a single
500
+ request; this effectively ignores the
501
+ authentication in the spec for a single request.
502
+ :type _request_auth: dict, optional
503
+ :param _content_type: force content-type for the request.
504
+ :type _content_type: str, Optional
505
+ :param _headers: set to override the headers for a single
506
+ request; this effectively ignores the headers
507
+ in the spec for a single request.
508
+ :type _headers: dict, optional
509
+ :param _host_index: set to override the host_index for a single
510
+ request; this effectively ignores the host_index
511
+ in the spec for a single request.
512
+ :type _host_index: int, optional
513
+ :return: Returns the result object.
514
+ """ # noqa: E501
515
+
516
+ _param = self._delete_document_serialize(
517
+ id=id,
518
+ _request_auth=_request_auth,
519
+ _content_type=_content_type,
520
+ _headers=_headers,
521
+ _host_index=_host_index
522
+ )
523
+
524
+ _response_types_map: Dict[str, Optional[str]] = {
525
+ '204': "SendDocument200Response",
526
+ '400': "Dict[str, object]",
527
+ '403': "Dict[str, object]",
528
+ '404': "Dict[str, object]",
529
+ }
530
+ response_data = self.api_client.call_api(
531
+ *_param,
532
+ _request_timeout=_request_timeout
533
+ )
534
+ return response_data.response
535
+
536
+
537
+ def _delete_document_serialize(
538
+ self,
539
+ id,
540
+ _request_auth,
541
+ _content_type,
542
+ _headers,
543
+ _host_index,
544
+ ) -> RequestSerialized:
545
+
546
+ _host = None
547
+
548
+ _collection_formats: Dict[str, str] = {
549
+ }
550
+
551
+ _path_params: Dict[str, str] = {}
552
+ _query_params: List[Tuple[str, str]] = []
553
+ _header_params: Dict[str, Optional[str]] = _headers or {}
554
+ _form_params: List[Tuple[str, str]] = []
555
+ _files: Dict[
556
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
557
+ ] = {}
558
+ _body_params: Optional[bytes] = None
559
+
560
+ # process the path parameters
561
+ if id is not None:
562
+ _path_params['id'] = id
563
+ # process the query parameters
564
+ # process the header parameters
565
+ # process the form parameters
566
+ # process the body parameter
567
+
568
+
569
+ # set the HTTP header `Accept`
570
+ if 'Accept' not in _header_params:
571
+ _header_params['Accept'] = self.api_client.select_header_accept(
572
+ [
573
+ 'application/json'
574
+ ]
575
+ )
576
+
577
+
578
+ # authentication setting
579
+ _auth_settings: List[str] = [
580
+ 'Bearer'
581
+ ]
582
+
583
+ return self.api_client.param_serialize(
584
+ method='DELETE',
585
+ resource_path='/ap1/documents-status/{id}/',
586
+ path_params=_path_params,
587
+ query_params=_query_params,
588
+ header_params=_header_params,
589
+ body=_body_params,
590
+ post_params=_form_params,
591
+ files=_files,
592
+ auth_settings=_auth_settings,
593
+ collection_formats=_collection_formats,
594
+ _host=_host,
595
+ _request_auth=_request_auth
596
+ )
597
+
598
+
599
+
600
+
601
+ @validate_call
602
+ def get_download_status(
603
+ self,
604
+ id: Annotated[StrictStr, Field(description="The document's ID.")],
605
+ _request_timeout: Union[
606
+ None,
607
+ Annotated[StrictFloat, Field(gt=0)],
608
+ Tuple[
609
+ Annotated[StrictFloat, Field(gt=0)],
610
+ Annotated[StrictFloat, Field(gt=0)]
611
+ ]
612
+ ] = None,
613
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
614
+ _content_type: Optional[StrictStr] = None,
615
+ _headers: Optional[Dict[StrictStr, Any]] = None,
616
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
617
+ ) -> GetDownloadStatus200Response:
618
+ """Check whether the signed PDF is ready
619
+
620
+ Says whether the document's signed PDF can be downloaded yet (`download_status`). For the document's signing status, use `GET /ap1/documents-status-list/?document_ids=<id>`.
621
+
622
+ :param id: The document's ID. (required)
623
+ :type id: str
624
+ :param _request_timeout: timeout setting for this request. If one
625
+ number provided, it will be total request
626
+ timeout. It can also be a pair (tuple) of
627
+ (connection, read) timeouts.
628
+ :type _request_timeout: int, tuple(int, int), optional
629
+ :param _request_auth: set to override the auth_settings for an a single
630
+ request; this effectively ignores the
631
+ authentication in the spec for a single request.
632
+ :type _request_auth: dict, optional
633
+ :param _content_type: force content-type for the request.
634
+ :type _content_type: str, Optional
635
+ :param _headers: set to override the headers for a single
636
+ request; this effectively ignores the headers
637
+ in the spec for a single request.
638
+ :type _headers: dict, optional
639
+ :param _host_index: set to override the host_index for a single
640
+ request; this effectively ignores the host_index
641
+ in the spec for a single request.
642
+ :type _host_index: int, optional
643
+ :return: Returns the result object.
644
+ """ # noqa: E501
645
+
646
+ _param = self._get_download_status_serialize(
647
+ id=id,
648
+ _request_auth=_request_auth,
649
+ _content_type=_content_type,
650
+ _headers=_headers,
651
+ _host_index=_host_index
652
+ )
653
+
654
+ _response_types_map: Dict[str, Optional[str]] = {
655
+ '200': "GetDownloadStatus200Response",
656
+ '403': "Dict[str, object]",
657
+ '404': "Dict[str, object]",
658
+ }
659
+ response_data = self.api_client.call_api(
660
+ *_param,
661
+ _request_timeout=_request_timeout
662
+ )
663
+ response_data.read()
664
+ return self.api_client.response_deserialize(
665
+ response_data=response_data,
666
+ response_types_map=_response_types_map,
667
+ ).data
668
+
669
+
670
+ @validate_call
671
+ def get_download_status_with_http_info(
672
+ self,
673
+ id: Annotated[StrictStr, Field(description="The document's ID.")],
674
+ _request_timeout: Union[
675
+ None,
676
+ Annotated[StrictFloat, Field(gt=0)],
677
+ Tuple[
678
+ Annotated[StrictFloat, Field(gt=0)],
679
+ Annotated[StrictFloat, Field(gt=0)]
680
+ ]
681
+ ] = None,
682
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
683
+ _content_type: Optional[StrictStr] = None,
684
+ _headers: Optional[Dict[StrictStr, Any]] = None,
685
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
686
+ ) -> ApiResponse[GetDownloadStatus200Response]:
687
+ """Check whether the signed PDF is ready
688
+
689
+ Says whether the document's signed PDF can be downloaded yet (`download_status`). For the document's signing status, use `GET /ap1/documents-status-list/?document_ids=<id>`.
690
+
691
+ :param id: The document's ID. (required)
692
+ :type id: str
693
+ :param _request_timeout: timeout setting for this request. If one
694
+ number provided, it will be total request
695
+ timeout. It can also be a pair (tuple) of
696
+ (connection, read) timeouts.
697
+ :type _request_timeout: int, tuple(int, int), optional
698
+ :param _request_auth: set to override the auth_settings for an a single
699
+ request; this effectively ignores the
700
+ authentication in the spec for a single request.
701
+ :type _request_auth: dict, optional
702
+ :param _content_type: force content-type for the request.
703
+ :type _content_type: str, Optional
704
+ :param _headers: set to override the headers for a single
705
+ request; this effectively ignores the headers
706
+ in the spec for a single request.
707
+ :type _headers: dict, optional
708
+ :param _host_index: set to override the host_index for a single
709
+ request; this effectively ignores the host_index
710
+ in the spec for a single request.
711
+ :type _host_index: int, optional
712
+ :return: Returns the result object.
713
+ """ # noqa: E501
714
+
715
+ _param = self._get_download_status_serialize(
716
+ id=id,
717
+ _request_auth=_request_auth,
718
+ _content_type=_content_type,
719
+ _headers=_headers,
720
+ _host_index=_host_index
721
+ )
722
+
723
+ _response_types_map: Dict[str, Optional[str]] = {
724
+ '200': "GetDownloadStatus200Response",
725
+ '403': "Dict[str, object]",
726
+ '404': "Dict[str, object]",
727
+ }
728
+ response_data = self.api_client.call_api(
729
+ *_param,
730
+ _request_timeout=_request_timeout
731
+ )
732
+ response_data.read()
733
+ return self.api_client.response_deserialize(
734
+ response_data=response_data,
735
+ response_types_map=_response_types_map,
736
+ )
737
+
738
+
739
+ @validate_call
740
+ def get_download_status_without_preload_content(
741
+ self,
742
+ id: Annotated[StrictStr, Field(description="The document's ID.")],
743
+ _request_timeout: Union[
744
+ None,
745
+ Annotated[StrictFloat, Field(gt=0)],
746
+ Tuple[
747
+ Annotated[StrictFloat, Field(gt=0)],
748
+ Annotated[StrictFloat, Field(gt=0)]
749
+ ]
750
+ ] = None,
751
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
752
+ _content_type: Optional[StrictStr] = None,
753
+ _headers: Optional[Dict[StrictStr, Any]] = None,
754
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
755
+ ) -> RESTResponseType:
756
+ """Check whether the signed PDF is ready
757
+
758
+ Says whether the document's signed PDF can be downloaded yet (`download_status`). For the document's signing status, use `GET /ap1/documents-status-list/?document_ids=<id>`.
759
+
760
+ :param id: The document's ID. (required)
761
+ :type id: str
762
+ :param _request_timeout: timeout setting for this request. If one
763
+ number provided, it will be total request
764
+ timeout. It can also be a pair (tuple) of
765
+ (connection, read) timeouts.
766
+ :type _request_timeout: int, tuple(int, int), optional
767
+ :param _request_auth: set to override the auth_settings for an a single
768
+ request; this effectively ignores the
769
+ authentication in the spec for a single request.
770
+ :type _request_auth: dict, optional
771
+ :param _content_type: force content-type for the request.
772
+ :type _content_type: str, Optional
773
+ :param _headers: set to override the headers for a single
774
+ request; this effectively ignores the headers
775
+ in the spec for a single request.
776
+ :type _headers: dict, optional
777
+ :param _host_index: set to override the host_index for a single
778
+ request; this effectively ignores the host_index
779
+ in the spec for a single request.
780
+ :type _host_index: int, optional
781
+ :return: Returns the result object.
782
+ """ # noqa: E501
783
+
784
+ _param = self._get_download_status_serialize(
785
+ id=id,
786
+ _request_auth=_request_auth,
787
+ _content_type=_content_type,
788
+ _headers=_headers,
789
+ _host_index=_host_index
790
+ )
791
+
792
+ _response_types_map: Dict[str, Optional[str]] = {
793
+ '200': "GetDownloadStatus200Response",
794
+ '403': "Dict[str, object]",
795
+ '404': "Dict[str, object]",
796
+ }
797
+ response_data = self.api_client.call_api(
798
+ *_param,
799
+ _request_timeout=_request_timeout
800
+ )
801
+ return response_data.response
802
+
803
+
804
+ def _get_download_status_serialize(
805
+ self,
806
+ id,
807
+ _request_auth,
808
+ _content_type,
809
+ _headers,
810
+ _host_index,
811
+ ) -> RequestSerialized:
812
+
813
+ _host = None
814
+
815
+ _collection_formats: Dict[str, str] = {
816
+ }
817
+
818
+ _path_params: Dict[str, str] = {}
819
+ _query_params: List[Tuple[str, str]] = []
820
+ _header_params: Dict[str, Optional[str]] = _headers or {}
821
+ _form_params: List[Tuple[str, str]] = []
822
+ _files: Dict[
823
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
824
+ ] = {}
825
+ _body_params: Optional[bytes] = None
826
+
827
+ # process the path parameters
828
+ if id is not None:
829
+ _path_params['id'] = id
830
+ # process the query parameters
831
+ # process the header parameters
832
+ # process the form parameters
833
+ # process the body parameter
834
+
835
+
836
+ # set the HTTP header `Accept`
837
+ if 'Accept' not in _header_params:
838
+ _header_params['Accept'] = self.api_client.select_header_accept(
839
+ [
840
+ 'application/json'
841
+ ]
842
+ )
843
+
844
+
845
+ # authentication setting
846
+ _auth_settings: List[str] = [
847
+ 'Bearer'
848
+ ]
849
+
850
+ return self.api_client.param_serialize(
851
+ method='GET',
852
+ resource_path='/ap1/documents-status/{id}/',
853
+ path_params=_path_params,
854
+ query_params=_query_params,
855
+ header_params=_header_params,
856
+ body=_body_params,
857
+ post_params=_form_params,
858
+ files=_files,
859
+ auth_settings=_auth_settings,
860
+ collection_formats=_collection_formats,
861
+ _host=_host,
862
+ _request_auth=_request_auth
863
+ )
864
+
865
+
866
+
867
+
868
+ @validate_call
869
+ def list_document_pages(
870
+ self,
871
+ id: Annotated[StrictStr, Field(description="The document's or template's ID.")],
872
+ _request_timeout: Union[
873
+ None,
874
+ Annotated[StrictFloat, Field(gt=0)],
875
+ Tuple[
876
+ Annotated[StrictFloat, Field(gt=0)],
877
+ Annotated[StrictFloat, Field(gt=0)]
878
+ ]
879
+ ] = None,
880
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
881
+ _content_type: Optional[StrictStr] = None,
882
+ _headers: Optional[Dict[StrictStr, Any]] = None,
883
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
884
+ ) -> List[Page]:
885
+ """List a document's pages and their fields
886
+
887
+ The document's (or template's) pages, in order, each with its fields. Use a page's `id` and `page_number` when placing a field on it. A new upload has no pages until it has been processed.
888
+
889
+ :param id: The document's or template's ID. (required)
890
+ :type id: str
891
+ :param _request_timeout: timeout setting for this request. If one
892
+ number provided, it will be total request
893
+ timeout. It can also be a pair (tuple) of
894
+ (connection, read) timeouts.
895
+ :type _request_timeout: int, tuple(int, int), optional
896
+ :param _request_auth: set to override the auth_settings for an a single
897
+ request; this effectively ignores the
898
+ authentication in the spec for a single request.
899
+ :type _request_auth: dict, optional
900
+ :param _content_type: force content-type for the request.
901
+ :type _content_type: str, Optional
902
+ :param _headers: set to override the headers for a single
903
+ request; this effectively ignores the headers
904
+ in the spec for a single request.
905
+ :type _headers: dict, optional
906
+ :param _host_index: set to override the host_index for a single
907
+ request; this effectively ignores the host_index
908
+ in the spec for a single request.
909
+ :type _host_index: int, optional
910
+ :return: Returns the result object.
911
+ """ # noqa: E501
912
+
913
+ _param = self._list_document_pages_serialize(
914
+ id=id,
915
+ _request_auth=_request_auth,
916
+ _content_type=_content_type,
917
+ _headers=_headers,
918
+ _host_index=_host_index
919
+ )
920
+
921
+ _response_types_map: Dict[str, Optional[str]] = {
922
+ '200': "List[Page]",
923
+ '404': "Dict[str, object]",
924
+ }
925
+ response_data = self.api_client.call_api(
926
+ *_param,
927
+ _request_timeout=_request_timeout
928
+ )
929
+ response_data.read()
930
+ return self.api_client.response_deserialize(
931
+ response_data=response_data,
932
+ response_types_map=_response_types_map,
933
+ ).data
934
+
935
+
936
+ @validate_call
937
+ def list_document_pages_with_http_info(
938
+ self,
939
+ id: Annotated[StrictStr, Field(description="The document's or template's ID.")],
940
+ _request_timeout: Union[
941
+ None,
942
+ Annotated[StrictFloat, Field(gt=0)],
943
+ Tuple[
944
+ Annotated[StrictFloat, Field(gt=0)],
945
+ Annotated[StrictFloat, Field(gt=0)]
946
+ ]
947
+ ] = None,
948
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
949
+ _content_type: Optional[StrictStr] = None,
950
+ _headers: Optional[Dict[StrictStr, Any]] = None,
951
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
952
+ ) -> ApiResponse[List[Page]]:
953
+ """List a document's pages and their fields
954
+
955
+ The document's (or template's) pages, in order, each with its fields. Use a page's `id` and `page_number` when placing a field on it. A new upload has no pages until it has been processed.
956
+
957
+ :param id: The document's or template's ID. (required)
958
+ :type id: str
959
+ :param _request_timeout: timeout setting for this request. If one
960
+ number provided, it will be total request
961
+ timeout. It can also be a pair (tuple) of
962
+ (connection, read) timeouts.
963
+ :type _request_timeout: int, tuple(int, int), optional
964
+ :param _request_auth: set to override the auth_settings for an a single
965
+ request; this effectively ignores the
966
+ authentication in the spec for a single request.
967
+ :type _request_auth: dict, optional
968
+ :param _content_type: force content-type for the request.
969
+ :type _content_type: str, Optional
970
+ :param _headers: set to override the headers for a single
971
+ request; this effectively ignores the headers
972
+ in the spec for a single request.
973
+ :type _headers: dict, optional
974
+ :param _host_index: set to override the host_index for a single
975
+ request; this effectively ignores the host_index
976
+ in the spec for a single request.
977
+ :type _host_index: int, optional
978
+ :return: Returns the result object.
979
+ """ # noqa: E501
980
+
981
+ _param = self._list_document_pages_serialize(
982
+ id=id,
983
+ _request_auth=_request_auth,
984
+ _content_type=_content_type,
985
+ _headers=_headers,
986
+ _host_index=_host_index
987
+ )
988
+
989
+ _response_types_map: Dict[str, Optional[str]] = {
990
+ '200': "List[Page]",
991
+ '404': "Dict[str, object]",
992
+ }
993
+ response_data = self.api_client.call_api(
994
+ *_param,
995
+ _request_timeout=_request_timeout
996
+ )
997
+ response_data.read()
998
+ return self.api_client.response_deserialize(
999
+ response_data=response_data,
1000
+ response_types_map=_response_types_map,
1001
+ )
1002
+
1003
+
1004
+ @validate_call
1005
+ def list_document_pages_without_preload_content(
1006
+ self,
1007
+ id: Annotated[StrictStr, Field(description="The document's or template's ID.")],
1008
+ _request_timeout: Union[
1009
+ None,
1010
+ Annotated[StrictFloat, Field(gt=0)],
1011
+ Tuple[
1012
+ Annotated[StrictFloat, Field(gt=0)],
1013
+ Annotated[StrictFloat, Field(gt=0)]
1014
+ ]
1015
+ ] = None,
1016
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1017
+ _content_type: Optional[StrictStr] = None,
1018
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1019
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1020
+ ) -> RESTResponseType:
1021
+ """List a document's pages and their fields
1022
+
1023
+ The document's (or template's) pages, in order, each with its fields. Use a page's `id` and `page_number` when placing a field on it. A new upload has no pages until it has been processed.
1024
+
1025
+ :param id: The document's or template's ID. (required)
1026
+ :type id: str
1027
+ :param _request_timeout: timeout setting for this request. If one
1028
+ number provided, it will be total request
1029
+ timeout. It can also be a pair (tuple) of
1030
+ (connection, read) timeouts.
1031
+ :type _request_timeout: int, tuple(int, int), optional
1032
+ :param _request_auth: set to override the auth_settings for an a single
1033
+ request; this effectively ignores the
1034
+ authentication in the spec for a single request.
1035
+ :type _request_auth: dict, optional
1036
+ :param _content_type: force content-type for the request.
1037
+ :type _content_type: str, Optional
1038
+ :param _headers: set to override the headers for a single
1039
+ request; this effectively ignores the headers
1040
+ in the spec for a single request.
1041
+ :type _headers: dict, optional
1042
+ :param _host_index: set to override the host_index for a single
1043
+ request; this effectively ignores the host_index
1044
+ in the spec for a single request.
1045
+ :type _host_index: int, optional
1046
+ :return: Returns the result object.
1047
+ """ # noqa: E501
1048
+
1049
+ _param = self._list_document_pages_serialize(
1050
+ id=id,
1051
+ _request_auth=_request_auth,
1052
+ _content_type=_content_type,
1053
+ _headers=_headers,
1054
+ _host_index=_host_index
1055
+ )
1056
+
1057
+ _response_types_map: Dict[str, Optional[str]] = {
1058
+ '200': "List[Page]",
1059
+ '404': "Dict[str, object]",
1060
+ }
1061
+ response_data = self.api_client.call_api(
1062
+ *_param,
1063
+ _request_timeout=_request_timeout
1064
+ )
1065
+ return response_data.response
1066
+
1067
+
1068
+ def _list_document_pages_serialize(
1069
+ self,
1070
+ id,
1071
+ _request_auth,
1072
+ _content_type,
1073
+ _headers,
1074
+ _host_index,
1075
+ ) -> RequestSerialized:
1076
+
1077
+ _host = None
1078
+
1079
+ _collection_formats: Dict[str, str] = {
1080
+ }
1081
+
1082
+ _path_params: Dict[str, str] = {}
1083
+ _query_params: List[Tuple[str, str]] = []
1084
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1085
+ _form_params: List[Tuple[str, str]] = []
1086
+ _files: Dict[
1087
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1088
+ ] = {}
1089
+ _body_params: Optional[bytes] = None
1090
+
1091
+ # process the path parameters
1092
+ if id is not None:
1093
+ _path_params['id'] = id
1094
+ # process the query parameters
1095
+ # process the header parameters
1096
+ # process the form parameters
1097
+ # process the body parameter
1098
+
1099
+
1100
+ # set the HTTP header `Accept`
1101
+ if 'Accept' not in _header_params:
1102
+ _header_params['Accept'] = self.api_client.select_header_accept(
1103
+ [
1104
+ 'application/json'
1105
+ ]
1106
+ )
1107
+
1108
+
1109
+ # authentication setting
1110
+ _auth_settings: List[str] = [
1111
+ 'Bearer'
1112
+ ]
1113
+
1114
+ return self.api_client.param_serialize(
1115
+ method='GET',
1116
+ resource_path='/ap1/documents/{id}/pages/',
1117
+ path_params=_path_params,
1118
+ query_params=_query_params,
1119
+ header_params=_header_params,
1120
+ body=_body_params,
1121
+ post_params=_form_params,
1122
+ files=_files,
1123
+ auth_settings=_auth_settings,
1124
+ collection_formats=_collection_formats,
1125
+ _host=_host,
1126
+ _request_auth=_request_auth
1127
+ )
1128
+
1129
+
1130
+
1131
+
1132
+ @validate_call
1133
+ def list_document_statuses(
1134
+ self,
1135
+ name: Annotated[Optional[StrictStr], Field(description="Only documents whose name contains this (any case).")] = None,
1136
+ status: Annotated[Optional[List[StrictInt]], Field(description="Only documents with these statuses: 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Repeat it (`status=4&status=6`) or separate values with commas (`status=4,6`).")] = None,
1137
+ document_ids: Annotated[Optional[List[StrictStr]], Field(description="Only these documents. Repeat it or separate IDs with commas.")] = None,
1138
+ limit: Annotated[Optional[StrictInt], Field(description="How many results to return (default 10).")] = None,
1139
+ offset: Annotated[Optional[StrictInt], Field(description="How many results to skip.")] = None,
1140
+ _request_timeout: Union[
1141
+ None,
1142
+ Annotated[StrictFloat, Field(gt=0)],
1143
+ Tuple[
1144
+ Annotated[StrictFloat, Field(gt=0)],
1145
+ Annotated[StrictFloat, Field(gt=0)]
1146
+ ]
1147
+ ] = None,
1148
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1149
+ _content_type: Optional[StrictStr] = None,
1150
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1151
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1152
+ ) -> DocumentStatusPage:
1153
+ """List the status of your organisation's documents
1154
+
1155
+ The ID and status of every document of your organisation's admin account, including those made in the web app, newest change first. Templates and unsent bulk-send copies aren't listed. A light way to poll for completed documents. Paged: see `limit` and `offset`.
1156
+
1157
+ :param name: Only documents whose name contains this (any case).
1158
+ :type name: str
1159
+ :param status: Only documents with these statuses: 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Repeat it (`status=4&status=6`) or separate values with commas (`status=4,6`).
1160
+ :type status: List[int]
1161
+ :param document_ids: Only these documents. Repeat it or separate IDs with commas.
1162
+ :type document_ids: List[str]
1163
+ :param limit: How many results to return (default 10).
1164
+ :type limit: int
1165
+ :param offset: How many results to skip.
1166
+ :type offset: int
1167
+ :param _request_timeout: timeout setting for this request. If one
1168
+ number provided, it will be total request
1169
+ timeout. It can also be a pair (tuple) of
1170
+ (connection, read) timeouts.
1171
+ :type _request_timeout: int, tuple(int, int), optional
1172
+ :param _request_auth: set to override the auth_settings for an a single
1173
+ request; this effectively ignores the
1174
+ authentication in the spec for a single request.
1175
+ :type _request_auth: dict, optional
1176
+ :param _content_type: force content-type for the request.
1177
+ :type _content_type: str, Optional
1178
+ :param _headers: set to override the headers for a single
1179
+ request; this effectively ignores the headers
1180
+ in the spec for a single request.
1181
+ :type _headers: dict, optional
1182
+ :param _host_index: set to override the host_index for a single
1183
+ request; this effectively ignores the host_index
1184
+ in the spec for a single request.
1185
+ :type _host_index: int, optional
1186
+ :return: Returns the result object.
1187
+ """ # noqa: E501
1188
+
1189
+ _param = self._list_document_statuses_serialize(
1190
+ name=name,
1191
+ status=status,
1192
+ document_ids=document_ids,
1193
+ limit=limit,
1194
+ offset=offset,
1195
+ _request_auth=_request_auth,
1196
+ _content_type=_content_type,
1197
+ _headers=_headers,
1198
+ _host_index=_host_index
1199
+ )
1200
+
1201
+ _response_types_map: Dict[str, Optional[str]] = {
1202
+ '200': "DocumentStatusPage",
1203
+ '400': "Dict[str, object]",
1204
+ }
1205
+ response_data = self.api_client.call_api(
1206
+ *_param,
1207
+ _request_timeout=_request_timeout
1208
+ )
1209
+ response_data.read()
1210
+ return self.api_client.response_deserialize(
1211
+ response_data=response_data,
1212
+ response_types_map=_response_types_map,
1213
+ ).data
1214
+
1215
+
1216
+ @validate_call
1217
+ def list_document_statuses_with_http_info(
1218
+ self,
1219
+ name: Annotated[Optional[StrictStr], Field(description="Only documents whose name contains this (any case).")] = None,
1220
+ status: Annotated[Optional[List[StrictInt]], Field(description="Only documents with these statuses: 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Repeat it (`status=4&status=6`) or separate values with commas (`status=4,6`).")] = None,
1221
+ document_ids: Annotated[Optional[List[StrictStr]], Field(description="Only these documents. Repeat it or separate IDs with commas.")] = None,
1222
+ limit: Annotated[Optional[StrictInt], Field(description="How many results to return (default 10).")] = None,
1223
+ offset: Annotated[Optional[StrictInt], Field(description="How many results to skip.")] = None,
1224
+ _request_timeout: Union[
1225
+ None,
1226
+ Annotated[StrictFloat, Field(gt=0)],
1227
+ Tuple[
1228
+ Annotated[StrictFloat, Field(gt=0)],
1229
+ Annotated[StrictFloat, Field(gt=0)]
1230
+ ]
1231
+ ] = None,
1232
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1233
+ _content_type: Optional[StrictStr] = None,
1234
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1235
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1236
+ ) -> ApiResponse[DocumentStatusPage]:
1237
+ """List the status of your organisation's documents
1238
+
1239
+ The ID and status of every document of your organisation's admin account, including those made in the web app, newest change first. Templates and unsent bulk-send copies aren't listed. A light way to poll for completed documents. Paged: see `limit` and `offset`.
1240
+
1241
+ :param name: Only documents whose name contains this (any case).
1242
+ :type name: str
1243
+ :param status: Only documents with these statuses: 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Repeat it (`status=4&status=6`) or separate values with commas (`status=4,6`).
1244
+ :type status: List[int]
1245
+ :param document_ids: Only these documents. Repeat it or separate IDs with commas.
1246
+ :type document_ids: List[str]
1247
+ :param limit: How many results to return (default 10).
1248
+ :type limit: int
1249
+ :param offset: How many results to skip.
1250
+ :type offset: int
1251
+ :param _request_timeout: timeout setting for this request. If one
1252
+ number provided, it will be total request
1253
+ timeout. It can also be a pair (tuple) of
1254
+ (connection, read) timeouts.
1255
+ :type _request_timeout: int, tuple(int, int), optional
1256
+ :param _request_auth: set to override the auth_settings for an a single
1257
+ request; this effectively ignores the
1258
+ authentication in the spec for a single request.
1259
+ :type _request_auth: dict, optional
1260
+ :param _content_type: force content-type for the request.
1261
+ :type _content_type: str, Optional
1262
+ :param _headers: set to override the headers for a single
1263
+ request; this effectively ignores the headers
1264
+ in the spec for a single request.
1265
+ :type _headers: dict, optional
1266
+ :param _host_index: set to override the host_index for a single
1267
+ request; this effectively ignores the host_index
1268
+ in the spec for a single request.
1269
+ :type _host_index: int, optional
1270
+ :return: Returns the result object.
1271
+ """ # noqa: E501
1272
+
1273
+ _param = self._list_document_statuses_serialize(
1274
+ name=name,
1275
+ status=status,
1276
+ document_ids=document_ids,
1277
+ limit=limit,
1278
+ offset=offset,
1279
+ _request_auth=_request_auth,
1280
+ _content_type=_content_type,
1281
+ _headers=_headers,
1282
+ _host_index=_host_index
1283
+ )
1284
+
1285
+ _response_types_map: Dict[str, Optional[str]] = {
1286
+ '200': "DocumentStatusPage",
1287
+ '400': "Dict[str, object]",
1288
+ }
1289
+ response_data = self.api_client.call_api(
1290
+ *_param,
1291
+ _request_timeout=_request_timeout
1292
+ )
1293
+ response_data.read()
1294
+ return self.api_client.response_deserialize(
1295
+ response_data=response_data,
1296
+ response_types_map=_response_types_map,
1297
+ )
1298
+
1299
+
1300
+ @validate_call
1301
+ def list_document_statuses_without_preload_content(
1302
+ self,
1303
+ name: Annotated[Optional[StrictStr], Field(description="Only documents whose name contains this (any case).")] = None,
1304
+ status: Annotated[Optional[List[StrictInt]], Field(description="Only documents with these statuses: 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Repeat it (`status=4&status=6`) or separate values with commas (`status=4,6`).")] = None,
1305
+ document_ids: Annotated[Optional[List[StrictStr]], Field(description="Only these documents. Repeat it or separate IDs with commas.")] = None,
1306
+ limit: Annotated[Optional[StrictInt], Field(description="How many results to return (default 10).")] = None,
1307
+ offset: Annotated[Optional[StrictInt], Field(description="How many results to skip.")] = None,
1308
+ _request_timeout: Union[
1309
+ None,
1310
+ Annotated[StrictFloat, Field(gt=0)],
1311
+ Tuple[
1312
+ Annotated[StrictFloat, Field(gt=0)],
1313
+ Annotated[StrictFloat, Field(gt=0)]
1314
+ ]
1315
+ ] = None,
1316
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1317
+ _content_type: Optional[StrictStr] = None,
1318
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1319
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1320
+ ) -> RESTResponseType:
1321
+ """List the status of your organisation's documents
1322
+
1323
+ The ID and status of every document of your organisation's admin account, including those made in the web app, newest change first. Templates and unsent bulk-send copies aren't listed. A light way to poll for completed documents. Paged: see `limit` and `offset`.
1324
+
1325
+ :param name: Only documents whose name contains this (any case).
1326
+ :type name: str
1327
+ :param status: Only documents with these statuses: 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Repeat it (`status=4&status=6`) or separate values with commas (`status=4,6`).
1328
+ :type status: List[int]
1329
+ :param document_ids: Only these documents. Repeat it or separate IDs with commas.
1330
+ :type document_ids: List[str]
1331
+ :param limit: How many results to return (default 10).
1332
+ :type limit: int
1333
+ :param offset: How many results to skip.
1334
+ :type offset: int
1335
+ :param _request_timeout: timeout setting for this request. If one
1336
+ number provided, it will be total request
1337
+ timeout. It can also be a pair (tuple) of
1338
+ (connection, read) timeouts.
1339
+ :type _request_timeout: int, tuple(int, int), optional
1340
+ :param _request_auth: set to override the auth_settings for an a single
1341
+ request; this effectively ignores the
1342
+ authentication in the spec for a single request.
1343
+ :type _request_auth: dict, optional
1344
+ :param _content_type: force content-type for the request.
1345
+ :type _content_type: str, Optional
1346
+ :param _headers: set to override the headers for a single
1347
+ request; this effectively ignores the headers
1348
+ in the spec for a single request.
1349
+ :type _headers: dict, optional
1350
+ :param _host_index: set to override the host_index for a single
1351
+ request; this effectively ignores the host_index
1352
+ in the spec for a single request.
1353
+ :type _host_index: int, optional
1354
+ :return: Returns the result object.
1355
+ """ # noqa: E501
1356
+
1357
+ _param = self._list_document_statuses_serialize(
1358
+ name=name,
1359
+ status=status,
1360
+ document_ids=document_ids,
1361
+ limit=limit,
1362
+ offset=offset,
1363
+ _request_auth=_request_auth,
1364
+ _content_type=_content_type,
1365
+ _headers=_headers,
1366
+ _host_index=_host_index
1367
+ )
1368
+
1369
+ _response_types_map: Dict[str, Optional[str]] = {
1370
+ '200': "DocumentStatusPage",
1371
+ '400': "Dict[str, object]",
1372
+ }
1373
+ response_data = self.api_client.call_api(
1374
+ *_param,
1375
+ _request_timeout=_request_timeout
1376
+ )
1377
+ return response_data.response
1378
+
1379
+
1380
+ def _list_document_statuses_serialize(
1381
+ self,
1382
+ name,
1383
+ status,
1384
+ document_ids,
1385
+ limit,
1386
+ offset,
1387
+ _request_auth,
1388
+ _content_type,
1389
+ _headers,
1390
+ _host_index,
1391
+ ) -> RequestSerialized:
1392
+
1393
+ _host = None
1394
+
1395
+ _collection_formats: Dict[str, str] = {
1396
+ 'status': 'multi',
1397
+ 'document_ids': 'multi',
1398
+ }
1399
+
1400
+ _path_params: Dict[str, str] = {}
1401
+ _query_params: List[Tuple[str, str]] = []
1402
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1403
+ _form_params: List[Tuple[str, str]] = []
1404
+ _files: Dict[
1405
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1406
+ ] = {}
1407
+ _body_params: Optional[bytes] = None
1408
+
1409
+ # process the path parameters
1410
+ # process the query parameters
1411
+ if name is not None:
1412
+
1413
+ _query_params.append(('name', name))
1414
+
1415
+ if status is not None:
1416
+
1417
+ _query_params.append(('status', status))
1418
+
1419
+ if document_ids is not None:
1420
+
1421
+ _query_params.append(('document_ids', document_ids))
1422
+
1423
+ if limit is not None:
1424
+
1425
+ _query_params.append(('limit', limit))
1426
+
1427
+ if offset is not None:
1428
+
1429
+ _query_params.append(('offset', offset))
1430
+
1431
+ # process the header parameters
1432
+ # process the form parameters
1433
+ # process the body parameter
1434
+
1435
+
1436
+ # set the HTTP header `Accept`
1437
+ if 'Accept' not in _header_params:
1438
+ _header_params['Accept'] = self.api_client.select_header_accept(
1439
+ [
1440
+ 'application/json'
1441
+ ]
1442
+ )
1443
+
1444
+
1445
+ # authentication setting
1446
+ _auth_settings: List[str] = [
1447
+ 'Bearer'
1448
+ ]
1449
+
1450
+ return self.api_client.param_serialize(
1451
+ method='GET',
1452
+ resource_path='/ap1/documents-status-list/',
1453
+ path_params=_path_params,
1454
+ query_params=_query_params,
1455
+ header_params=_header_params,
1456
+ body=_body_params,
1457
+ post_params=_form_params,
1458
+ files=_files,
1459
+ auth_settings=_auth_settings,
1460
+ collection_formats=_collection_formats,
1461
+ _host=_host,
1462
+ _request_auth=_request_auth
1463
+ )
1464
+
1465
+
1466
+
1467
+
1468
+ @validate_call
1469
+ def list_documents(
1470
+ self,
1471
+ name: Annotated[Optional[StrictStr], Field(description="Only documents whose name contains this (any case).")] = None,
1472
+ status: Annotated[Optional[List[StrictInt]], Field(description="Only documents with these statuses: 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Repeat it (`status=4&status=6`) or separate values with commas (`status=4,6`).")] = None,
1473
+ document_ids: Annotated[Optional[List[StrictStr]], Field(description="Only these documents. Repeat it or separate IDs with commas.")] = None,
1474
+ limit: Annotated[Optional[StrictInt], Field(description="How many results to return (default 10).")] = None,
1475
+ offset: Annotated[Optional[StrictInt], Field(description="How many results to skip.")] = None,
1476
+ _request_timeout: Union[
1477
+ None,
1478
+ Annotated[StrictFloat, Field(gt=0)],
1479
+ Tuple[
1480
+ Annotated[StrictFloat, Field(gt=0)],
1481
+ Annotated[StrictFloat, Field(gt=0)]
1482
+ ]
1483
+ ] = None,
1484
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1485
+ _content_type: Optional[StrictStr] = None,
1486
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1487
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1488
+ ) -> DocumentPage:
1489
+ """List the documents this API client created
1490
+
1491
+ The documents this API client uploaded or made from a template, newest change first, with their signatories, pages and fields. Templates and unsent bulk-send copies aren't listed. Paged: see `limit` and `offset`.
1492
+
1493
+ :param name: Only documents whose name contains this (any case).
1494
+ :type name: str
1495
+ :param status: Only documents with these statuses: 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Repeat it (`status=4&status=6`) or separate values with commas (`status=4,6`).
1496
+ :type status: List[int]
1497
+ :param document_ids: Only these documents. Repeat it or separate IDs with commas.
1498
+ :type document_ids: List[str]
1499
+ :param limit: How many results to return (default 10).
1500
+ :type limit: int
1501
+ :param offset: How many results to skip.
1502
+ :type offset: int
1503
+ :param _request_timeout: timeout setting for this request. If one
1504
+ number provided, it will be total request
1505
+ timeout. It can also be a pair (tuple) of
1506
+ (connection, read) timeouts.
1507
+ :type _request_timeout: int, tuple(int, int), optional
1508
+ :param _request_auth: set to override the auth_settings for an a single
1509
+ request; this effectively ignores the
1510
+ authentication in the spec for a single request.
1511
+ :type _request_auth: dict, optional
1512
+ :param _content_type: force content-type for the request.
1513
+ :type _content_type: str, Optional
1514
+ :param _headers: set to override the headers for a single
1515
+ request; this effectively ignores the headers
1516
+ in the spec for a single request.
1517
+ :type _headers: dict, optional
1518
+ :param _host_index: set to override the host_index for a single
1519
+ request; this effectively ignores the host_index
1520
+ in the spec for a single request.
1521
+ :type _host_index: int, optional
1522
+ :return: Returns the result object.
1523
+ """ # noqa: E501
1524
+
1525
+ _param = self._list_documents_serialize(
1526
+ name=name,
1527
+ status=status,
1528
+ document_ids=document_ids,
1529
+ limit=limit,
1530
+ offset=offset,
1531
+ _request_auth=_request_auth,
1532
+ _content_type=_content_type,
1533
+ _headers=_headers,
1534
+ _host_index=_host_index
1535
+ )
1536
+
1537
+ _response_types_map: Dict[str, Optional[str]] = {
1538
+ '200': "DocumentPage",
1539
+ '400': "Dict[str, object]",
1540
+ }
1541
+ response_data = self.api_client.call_api(
1542
+ *_param,
1543
+ _request_timeout=_request_timeout
1544
+ )
1545
+ response_data.read()
1546
+ return self.api_client.response_deserialize(
1547
+ response_data=response_data,
1548
+ response_types_map=_response_types_map,
1549
+ ).data
1550
+
1551
+
1552
+ @validate_call
1553
+ def list_documents_with_http_info(
1554
+ self,
1555
+ name: Annotated[Optional[StrictStr], Field(description="Only documents whose name contains this (any case).")] = None,
1556
+ status: Annotated[Optional[List[StrictInt]], Field(description="Only documents with these statuses: 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Repeat it (`status=4&status=6`) or separate values with commas (`status=4,6`).")] = None,
1557
+ document_ids: Annotated[Optional[List[StrictStr]], Field(description="Only these documents. Repeat it or separate IDs with commas.")] = None,
1558
+ limit: Annotated[Optional[StrictInt], Field(description="How many results to return (default 10).")] = None,
1559
+ offset: Annotated[Optional[StrictInt], Field(description="How many results to skip.")] = None,
1560
+ _request_timeout: Union[
1561
+ None,
1562
+ Annotated[StrictFloat, Field(gt=0)],
1563
+ Tuple[
1564
+ Annotated[StrictFloat, Field(gt=0)],
1565
+ Annotated[StrictFloat, Field(gt=0)]
1566
+ ]
1567
+ ] = None,
1568
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1569
+ _content_type: Optional[StrictStr] = None,
1570
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1571
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1572
+ ) -> ApiResponse[DocumentPage]:
1573
+ """List the documents this API client created
1574
+
1575
+ The documents this API client uploaded or made from a template, newest change first, with their signatories, pages and fields. Templates and unsent bulk-send copies aren't listed. Paged: see `limit` and `offset`.
1576
+
1577
+ :param name: Only documents whose name contains this (any case).
1578
+ :type name: str
1579
+ :param status: Only documents with these statuses: 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Repeat it (`status=4&status=6`) or separate values with commas (`status=4,6`).
1580
+ :type status: List[int]
1581
+ :param document_ids: Only these documents. Repeat it or separate IDs with commas.
1582
+ :type document_ids: List[str]
1583
+ :param limit: How many results to return (default 10).
1584
+ :type limit: int
1585
+ :param offset: How many results to skip.
1586
+ :type offset: int
1587
+ :param _request_timeout: timeout setting for this request. If one
1588
+ number provided, it will be total request
1589
+ timeout. It can also be a pair (tuple) of
1590
+ (connection, read) timeouts.
1591
+ :type _request_timeout: int, tuple(int, int), optional
1592
+ :param _request_auth: set to override the auth_settings for an a single
1593
+ request; this effectively ignores the
1594
+ authentication in the spec for a single request.
1595
+ :type _request_auth: dict, optional
1596
+ :param _content_type: force content-type for the request.
1597
+ :type _content_type: str, Optional
1598
+ :param _headers: set to override the headers for a single
1599
+ request; this effectively ignores the headers
1600
+ in the spec for a single request.
1601
+ :type _headers: dict, optional
1602
+ :param _host_index: set to override the host_index for a single
1603
+ request; this effectively ignores the host_index
1604
+ in the spec for a single request.
1605
+ :type _host_index: int, optional
1606
+ :return: Returns the result object.
1607
+ """ # noqa: E501
1608
+
1609
+ _param = self._list_documents_serialize(
1610
+ name=name,
1611
+ status=status,
1612
+ document_ids=document_ids,
1613
+ limit=limit,
1614
+ offset=offset,
1615
+ _request_auth=_request_auth,
1616
+ _content_type=_content_type,
1617
+ _headers=_headers,
1618
+ _host_index=_host_index
1619
+ )
1620
+
1621
+ _response_types_map: Dict[str, Optional[str]] = {
1622
+ '200': "DocumentPage",
1623
+ '400': "Dict[str, object]",
1624
+ }
1625
+ response_data = self.api_client.call_api(
1626
+ *_param,
1627
+ _request_timeout=_request_timeout
1628
+ )
1629
+ response_data.read()
1630
+ return self.api_client.response_deserialize(
1631
+ response_data=response_data,
1632
+ response_types_map=_response_types_map,
1633
+ )
1634
+
1635
+
1636
+ @validate_call
1637
+ def list_documents_without_preload_content(
1638
+ self,
1639
+ name: Annotated[Optional[StrictStr], Field(description="Only documents whose name contains this (any case).")] = None,
1640
+ status: Annotated[Optional[List[StrictInt]], Field(description="Only documents with these statuses: 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Repeat it (`status=4&status=6`) or separate values with commas (`status=4,6`).")] = None,
1641
+ document_ids: Annotated[Optional[List[StrictStr]], Field(description="Only these documents. Repeat it or separate IDs with commas.")] = None,
1642
+ limit: Annotated[Optional[StrictInt], Field(description="How many results to return (default 10).")] = None,
1643
+ offset: Annotated[Optional[StrictInt], Field(description="How many results to skip.")] = None,
1644
+ _request_timeout: Union[
1645
+ None,
1646
+ Annotated[StrictFloat, Field(gt=0)],
1647
+ Tuple[
1648
+ Annotated[StrictFloat, Field(gt=0)],
1649
+ Annotated[StrictFloat, Field(gt=0)]
1650
+ ]
1651
+ ] = None,
1652
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1653
+ _content_type: Optional[StrictStr] = None,
1654
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1655
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1656
+ ) -> RESTResponseType:
1657
+ """List the documents this API client created
1658
+
1659
+ The documents this API client uploaded or made from a template, newest change first, with their signatories, pages and fields. Templates and unsent bulk-send copies aren't listed. Paged: see `limit` and `offset`.
1660
+
1661
+ :param name: Only documents whose name contains this (any case).
1662
+ :type name: str
1663
+ :param status: Only documents with these statuses: 1 Draft · 2 Signees Added · 3 Prepared · 4 Sent · 5 In Progress · 6 Completed · 7 Rejected · 8 Archived · 9 Expired. Repeat it (`status=4&status=6`) or separate values with commas (`status=4,6`).
1664
+ :type status: List[int]
1665
+ :param document_ids: Only these documents. Repeat it or separate IDs with commas.
1666
+ :type document_ids: List[str]
1667
+ :param limit: How many results to return (default 10).
1668
+ :type limit: int
1669
+ :param offset: How many results to skip.
1670
+ :type offset: int
1671
+ :param _request_timeout: timeout setting for this request. If one
1672
+ number provided, it will be total request
1673
+ timeout. It can also be a pair (tuple) of
1674
+ (connection, read) timeouts.
1675
+ :type _request_timeout: int, tuple(int, int), optional
1676
+ :param _request_auth: set to override the auth_settings for an a single
1677
+ request; this effectively ignores the
1678
+ authentication in the spec for a single request.
1679
+ :type _request_auth: dict, optional
1680
+ :param _content_type: force content-type for the request.
1681
+ :type _content_type: str, Optional
1682
+ :param _headers: set to override the headers for a single
1683
+ request; this effectively ignores the headers
1684
+ in the spec for a single request.
1685
+ :type _headers: dict, optional
1686
+ :param _host_index: set to override the host_index for a single
1687
+ request; this effectively ignores the host_index
1688
+ in the spec for a single request.
1689
+ :type _host_index: int, optional
1690
+ :return: Returns the result object.
1691
+ """ # noqa: E501
1692
+
1693
+ _param = self._list_documents_serialize(
1694
+ name=name,
1695
+ status=status,
1696
+ document_ids=document_ids,
1697
+ limit=limit,
1698
+ offset=offset,
1699
+ _request_auth=_request_auth,
1700
+ _content_type=_content_type,
1701
+ _headers=_headers,
1702
+ _host_index=_host_index
1703
+ )
1704
+
1705
+ _response_types_map: Dict[str, Optional[str]] = {
1706
+ '200': "DocumentPage",
1707
+ '400': "Dict[str, object]",
1708
+ }
1709
+ response_data = self.api_client.call_api(
1710
+ *_param,
1711
+ _request_timeout=_request_timeout
1712
+ )
1713
+ return response_data.response
1714
+
1715
+
1716
+ def _list_documents_serialize(
1717
+ self,
1718
+ name,
1719
+ status,
1720
+ document_ids,
1721
+ limit,
1722
+ offset,
1723
+ _request_auth,
1724
+ _content_type,
1725
+ _headers,
1726
+ _host_index,
1727
+ ) -> RequestSerialized:
1728
+
1729
+ _host = None
1730
+
1731
+ _collection_formats: Dict[str, str] = {
1732
+ 'status': 'multi',
1733
+ 'document_ids': 'multi',
1734
+ }
1735
+
1736
+ _path_params: Dict[str, str] = {}
1737
+ _query_params: List[Tuple[str, str]] = []
1738
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1739
+ _form_params: List[Tuple[str, str]] = []
1740
+ _files: Dict[
1741
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1742
+ ] = {}
1743
+ _body_params: Optional[bytes] = None
1744
+
1745
+ # process the path parameters
1746
+ # process the query parameters
1747
+ if name is not None:
1748
+
1749
+ _query_params.append(('name', name))
1750
+
1751
+ if status is not None:
1752
+
1753
+ _query_params.append(('status', status))
1754
+
1755
+ if document_ids is not None:
1756
+
1757
+ _query_params.append(('document_ids', document_ids))
1758
+
1759
+ if limit is not None:
1760
+
1761
+ _query_params.append(('limit', limit))
1762
+
1763
+ if offset is not None:
1764
+
1765
+ _query_params.append(('offset', offset))
1766
+
1767
+ # process the header parameters
1768
+ # process the form parameters
1769
+ # process the body parameter
1770
+
1771
+
1772
+ # set the HTTP header `Accept`
1773
+ if 'Accept' not in _header_params:
1774
+ _header_params['Accept'] = self.api_client.select_header_accept(
1775
+ [
1776
+ 'application/json'
1777
+ ]
1778
+ )
1779
+
1780
+
1781
+ # authentication setting
1782
+ _auth_settings: List[str] = [
1783
+ 'Bearer'
1784
+ ]
1785
+
1786
+ return self.api_client.param_serialize(
1787
+ method='GET',
1788
+ resource_path='/ap1/documents/',
1789
+ path_params=_path_params,
1790
+ query_params=_query_params,
1791
+ header_params=_header_params,
1792
+ body=_body_params,
1793
+ post_params=_form_params,
1794
+ files=_files,
1795
+ auth_settings=_auth_settings,
1796
+ collection_formats=_collection_formats,
1797
+ _host=_host,
1798
+ _request_auth=_request_auth
1799
+ )
1800
+
1801
+
1802
+
1803
+
1804
+ @validate_call
1805
+ def upload_document(
1806
+ self,
1807
+ file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="A PDF or DOCX file. A PDF that can't be read (damaged, or not really a PDF) is refused with 400 and the reason; save or export it as a new PDF and upload that. At most 2 MB.")],
1808
+ name: Annotated[StrictStr, Field(description="The document's name. It must differ from every other upload of this API client.")],
1809
+ type: Annotated[StrictInt, Field(description="2 Document · 4 Template")],
1810
+ template_name: Annotated[Optional[StrictStr], Field(description="The template's title. Required with `type` 4; it must differ from this API client's other templates.")] = None,
1811
+ _request_timeout: Union[
1812
+ None,
1813
+ Annotated[StrictFloat, Field(gt=0)],
1814
+ Tuple[
1815
+ Annotated[StrictFloat, Field(gt=0)],
1816
+ Annotated[StrictFloat, Field(gt=0)]
1817
+ ]
1818
+ ] = None,
1819
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1820
+ _content_type: Optional[StrictStr] = None,
1821
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1822
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1823
+ ) -> Upload:
1824
+ """Upload a document or template
1825
+
1826
+ Uploads a PDF or DOCX file of up to 2 MB as a document (`type` 2) or a template (`type` 4). The answer is the upload; the document itself is made in the background. Find it in `GET /ap1/documents/?name=<name>` (its `upload.id` is this upload's `id`), or a template in `GET /ap1/templates/`, and wait until `GET /ap1/documents/{id}/pages/` lists its pages before placing fields.
1827
+
1828
+ :param file: A PDF or DOCX file. A PDF that can't be read (damaged, or not really a PDF) is refused with 400 and the reason; save or export it as a new PDF and upload that. At most 2 MB. (required)
1829
+ :type file: bytearray
1830
+ :param name: The document's name. It must differ from every other upload of this API client. (required)
1831
+ :type name: str
1832
+ :param type: 2 Document · 4 Template (required)
1833
+ :type type: int
1834
+ :param template_name: The template's title. Required with `type` 4; it must differ from this API client's other templates.
1835
+ :type template_name: str
1836
+ :param _request_timeout: timeout setting for this request. If one
1837
+ number provided, it will be total request
1838
+ timeout. It can also be a pair (tuple) of
1839
+ (connection, read) timeouts.
1840
+ :type _request_timeout: int, tuple(int, int), optional
1841
+ :param _request_auth: set to override the auth_settings for an a single
1842
+ request; this effectively ignores the
1843
+ authentication in the spec for a single request.
1844
+ :type _request_auth: dict, optional
1845
+ :param _content_type: force content-type for the request.
1846
+ :type _content_type: str, Optional
1847
+ :param _headers: set to override the headers for a single
1848
+ request; this effectively ignores the headers
1849
+ in the spec for a single request.
1850
+ :type _headers: dict, optional
1851
+ :param _host_index: set to override the host_index for a single
1852
+ request; this effectively ignores the host_index
1853
+ in the spec for a single request.
1854
+ :type _host_index: int, optional
1855
+ :return: Returns the result object.
1856
+ """ # noqa: E501
1857
+
1858
+ _param = self._upload_document_serialize(
1859
+ file=file,
1860
+ name=name,
1861
+ type=type,
1862
+ template_name=template_name,
1863
+ _request_auth=_request_auth,
1864
+ _content_type=_content_type,
1865
+ _headers=_headers,
1866
+ _host_index=_host_index
1867
+ )
1868
+
1869
+ _response_types_map: Dict[str, Optional[str]] = {
1870
+ '200': "Upload",
1871
+ '400': "Dict[str, object]",
1872
+ }
1873
+ response_data = self.api_client.call_api(
1874
+ *_param,
1875
+ _request_timeout=_request_timeout
1876
+ )
1877
+ response_data.read()
1878
+ return self.api_client.response_deserialize(
1879
+ response_data=response_data,
1880
+ response_types_map=_response_types_map,
1881
+ ).data
1882
+
1883
+
1884
+ @validate_call
1885
+ def upload_document_with_http_info(
1886
+ self,
1887
+ file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="A PDF or DOCX file. A PDF that can't be read (damaged, or not really a PDF) is refused with 400 and the reason; save or export it as a new PDF and upload that. At most 2 MB.")],
1888
+ name: Annotated[StrictStr, Field(description="The document's name. It must differ from every other upload of this API client.")],
1889
+ type: Annotated[StrictInt, Field(description="2 Document · 4 Template")],
1890
+ template_name: Annotated[Optional[StrictStr], Field(description="The template's title. Required with `type` 4; it must differ from this API client's other templates.")] = None,
1891
+ _request_timeout: Union[
1892
+ None,
1893
+ Annotated[StrictFloat, Field(gt=0)],
1894
+ Tuple[
1895
+ Annotated[StrictFloat, Field(gt=0)],
1896
+ Annotated[StrictFloat, Field(gt=0)]
1897
+ ]
1898
+ ] = None,
1899
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1900
+ _content_type: Optional[StrictStr] = None,
1901
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1902
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1903
+ ) -> ApiResponse[Upload]:
1904
+ """Upload a document or template
1905
+
1906
+ Uploads a PDF or DOCX file of up to 2 MB as a document (`type` 2) or a template (`type` 4). The answer is the upload; the document itself is made in the background. Find it in `GET /ap1/documents/?name=<name>` (its `upload.id` is this upload's `id`), or a template in `GET /ap1/templates/`, and wait until `GET /ap1/documents/{id}/pages/` lists its pages before placing fields.
1907
+
1908
+ :param file: A PDF or DOCX file. A PDF that can't be read (damaged, or not really a PDF) is refused with 400 and the reason; save or export it as a new PDF and upload that. At most 2 MB. (required)
1909
+ :type file: bytearray
1910
+ :param name: The document's name. It must differ from every other upload of this API client. (required)
1911
+ :type name: str
1912
+ :param type: 2 Document · 4 Template (required)
1913
+ :type type: int
1914
+ :param template_name: The template's title. Required with `type` 4; it must differ from this API client's other templates.
1915
+ :type template_name: str
1916
+ :param _request_timeout: timeout setting for this request. If one
1917
+ number provided, it will be total request
1918
+ timeout. It can also be a pair (tuple) of
1919
+ (connection, read) timeouts.
1920
+ :type _request_timeout: int, tuple(int, int), optional
1921
+ :param _request_auth: set to override the auth_settings for an a single
1922
+ request; this effectively ignores the
1923
+ authentication in the spec for a single request.
1924
+ :type _request_auth: dict, optional
1925
+ :param _content_type: force content-type for the request.
1926
+ :type _content_type: str, Optional
1927
+ :param _headers: set to override the headers for a single
1928
+ request; this effectively ignores the headers
1929
+ in the spec for a single request.
1930
+ :type _headers: dict, optional
1931
+ :param _host_index: set to override the host_index for a single
1932
+ request; this effectively ignores the host_index
1933
+ in the spec for a single request.
1934
+ :type _host_index: int, optional
1935
+ :return: Returns the result object.
1936
+ """ # noqa: E501
1937
+
1938
+ _param = self._upload_document_serialize(
1939
+ file=file,
1940
+ name=name,
1941
+ type=type,
1942
+ template_name=template_name,
1943
+ _request_auth=_request_auth,
1944
+ _content_type=_content_type,
1945
+ _headers=_headers,
1946
+ _host_index=_host_index
1947
+ )
1948
+
1949
+ _response_types_map: Dict[str, Optional[str]] = {
1950
+ '200': "Upload",
1951
+ '400': "Dict[str, object]",
1952
+ }
1953
+ response_data = self.api_client.call_api(
1954
+ *_param,
1955
+ _request_timeout=_request_timeout
1956
+ )
1957
+ response_data.read()
1958
+ return self.api_client.response_deserialize(
1959
+ response_data=response_data,
1960
+ response_types_map=_response_types_map,
1961
+ )
1962
+
1963
+
1964
+ @validate_call
1965
+ def upload_document_without_preload_content(
1966
+ self,
1967
+ file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="A PDF or DOCX file. A PDF that can't be read (damaged, or not really a PDF) is refused with 400 and the reason; save or export it as a new PDF and upload that. At most 2 MB.")],
1968
+ name: Annotated[StrictStr, Field(description="The document's name. It must differ from every other upload of this API client.")],
1969
+ type: Annotated[StrictInt, Field(description="2 Document · 4 Template")],
1970
+ template_name: Annotated[Optional[StrictStr], Field(description="The template's title. Required with `type` 4; it must differ from this API client's other templates.")] = None,
1971
+ _request_timeout: Union[
1972
+ None,
1973
+ Annotated[StrictFloat, Field(gt=0)],
1974
+ Tuple[
1975
+ Annotated[StrictFloat, Field(gt=0)],
1976
+ Annotated[StrictFloat, Field(gt=0)]
1977
+ ]
1978
+ ] = None,
1979
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1980
+ _content_type: Optional[StrictStr] = None,
1981
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1982
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1983
+ ) -> RESTResponseType:
1984
+ """Upload a document or template
1985
+
1986
+ Uploads a PDF or DOCX file of up to 2 MB as a document (`type` 2) or a template (`type` 4). The answer is the upload; the document itself is made in the background. Find it in `GET /ap1/documents/?name=<name>` (its `upload.id` is this upload's `id`), or a template in `GET /ap1/templates/`, and wait until `GET /ap1/documents/{id}/pages/` lists its pages before placing fields.
1987
+
1988
+ :param file: A PDF or DOCX file. A PDF that can't be read (damaged, or not really a PDF) is refused with 400 and the reason; save or export it as a new PDF and upload that. At most 2 MB. (required)
1989
+ :type file: bytearray
1990
+ :param name: The document's name. It must differ from every other upload of this API client. (required)
1991
+ :type name: str
1992
+ :param type: 2 Document · 4 Template (required)
1993
+ :type type: int
1994
+ :param template_name: The template's title. Required with `type` 4; it must differ from this API client's other templates.
1995
+ :type template_name: str
1996
+ :param _request_timeout: timeout setting for this request. If one
1997
+ number provided, it will be total request
1998
+ timeout. It can also be a pair (tuple) of
1999
+ (connection, read) timeouts.
2000
+ :type _request_timeout: int, tuple(int, int), optional
2001
+ :param _request_auth: set to override the auth_settings for an a single
2002
+ request; this effectively ignores the
2003
+ authentication in the spec for a single request.
2004
+ :type _request_auth: dict, optional
2005
+ :param _content_type: force content-type for the request.
2006
+ :type _content_type: str, Optional
2007
+ :param _headers: set to override the headers for a single
2008
+ request; this effectively ignores the headers
2009
+ in the spec for a single request.
2010
+ :type _headers: dict, optional
2011
+ :param _host_index: set to override the host_index for a single
2012
+ request; this effectively ignores the host_index
2013
+ in the spec for a single request.
2014
+ :type _host_index: int, optional
2015
+ :return: Returns the result object.
2016
+ """ # noqa: E501
2017
+
2018
+ _param = self._upload_document_serialize(
2019
+ file=file,
2020
+ name=name,
2021
+ type=type,
2022
+ template_name=template_name,
2023
+ _request_auth=_request_auth,
2024
+ _content_type=_content_type,
2025
+ _headers=_headers,
2026
+ _host_index=_host_index
2027
+ )
2028
+
2029
+ _response_types_map: Dict[str, Optional[str]] = {
2030
+ '200': "Upload",
2031
+ '400': "Dict[str, object]",
2032
+ }
2033
+ response_data = self.api_client.call_api(
2034
+ *_param,
2035
+ _request_timeout=_request_timeout
2036
+ )
2037
+ return response_data.response
2038
+
2039
+
2040
+ def _upload_document_serialize(
2041
+ self,
2042
+ file,
2043
+ name,
2044
+ type,
2045
+ template_name,
2046
+ _request_auth,
2047
+ _content_type,
2048
+ _headers,
2049
+ _host_index,
2050
+ ) -> RequestSerialized:
2051
+
2052
+ _host = None
2053
+
2054
+ _collection_formats: Dict[str, str] = {
2055
+ }
2056
+
2057
+ _path_params: Dict[str, str] = {}
2058
+ _query_params: List[Tuple[str, str]] = []
2059
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2060
+ _form_params: List[Tuple[str, str]] = []
2061
+ _files: Dict[
2062
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2063
+ ] = {}
2064
+ _body_params: Optional[bytes] = None
2065
+
2066
+ # process the path parameters
2067
+ # process the query parameters
2068
+ # process the header parameters
2069
+ # process the form parameters
2070
+ if file is not None:
2071
+ _files['file'] = file
2072
+ if name is not None:
2073
+ _form_params.append(('name', name))
2074
+ if type is not None:
2075
+ _form_params.append(('type', type))
2076
+ if template_name is not None:
2077
+ _form_params.append(('template_name', template_name))
2078
+ # process the body parameter
2079
+
2080
+
2081
+ # set the HTTP header `Accept`
2082
+ if 'Accept' not in _header_params:
2083
+ _header_params['Accept'] = self.api_client.select_header_accept(
2084
+ [
2085
+ 'application/json'
2086
+ ]
2087
+ )
2088
+
2089
+ # set the HTTP header `Content-Type`
2090
+ if _content_type:
2091
+ _header_params['Content-Type'] = _content_type
2092
+ else:
2093
+ _default_content_type = (
2094
+ self.api_client.select_header_content_type(
2095
+ [
2096
+ 'application/x-www-form-urlencoded',
2097
+ 'multipart/form-data'
2098
+ ]
2099
+ )
2100
+ )
2101
+ if _default_content_type is not None:
2102
+ _header_params['Content-Type'] = _default_content_type
2103
+
2104
+ # authentication setting
2105
+ _auth_settings: List[str] = [
2106
+ 'Bearer'
2107
+ ]
2108
+
2109
+ return self.api_client.param_serialize(
2110
+ method='POST',
2111
+ resource_path='/ap1/upload/',
2112
+ path_params=_path_params,
2113
+ query_params=_query_params,
2114
+ header_params=_header_params,
2115
+ body=_body_params,
2116
+ post_params=_form_params,
2117
+ files=_files,
2118
+ auth_settings=_auth_settings,
2119
+ collection_formats=_collection_formats,
2120
+ _host=_host,
2121
+ _request_auth=_request_auth
2122
+ )
2123
+
2124
+
2125
+
2126
+
2127
+ @validate_call
2128
+ def upload_document_for_one_signer(
2129
+ self,
2130
+ file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="A PDF or DOCX file. A PDF that can't be read (damaged, or not really a PDF) is refused with 400 and the reason; save or export it as a new PDF and upload that.")],
2131
+ signee_name: Annotated[StrictStr, Field(description="The signer's name.")],
2132
+ signee_email: Annotated[StrictStr, Field(description="The signer's email address.")],
2133
+ redirect_url: Annotated[StrictStr, Field(description="Where the signer is sent after signing.")],
2134
+ final_email: Annotated[Optional[StrictStr], Field(description="Who gets the signed PDF and audit trail by email. Without it, your organisation's admin does.")] = None,
2135
+ _request_timeout: Union[
2136
+ None,
2137
+ Annotated[StrictFloat, Field(gt=0)],
2138
+ Tuple[
2139
+ Annotated[StrictFloat, Field(gt=0)],
2140
+ Annotated[StrictFloat, Field(gt=0)]
2141
+ ]
2142
+ ] = None,
2143
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2144
+ _content_type: Optional[StrictStr] = None,
2145
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2146
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2147
+ ) -> UploadDocumentForOneSigner200Response:
2148
+ """Upload a document for one signer and get their signing link
2149
+
2150
+ Uploads a PDF or DOCX for one signer and returns their signing link in `redirect_url`; give it to the signer. They place their own signature on the signing page and are then sent to the `redirect_url` you gave. The signed PDF and its audit trail are emailed to `final_email`, or to your organisation's admin without one.
2151
+
2152
+ :param file: A PDF or DOCX file. A PDF that can't be read (damaged, or not really a PDF) is refused with 400 and the reason; save or export it as a new PDF and upload that. (required)
2153
+ :type file: bytearray
2154
+ :param signee_name: The signer's name. (required)
2155
+ :type signee_name: str
2156
+ :param signee_email: The signer's email address. (required)
2157
+ :type signee_email: str
2158
+ :param redirect_url: Where the signer is sent after signing. (required)
2159
+ :type redirect_url: str
2160
+ :param final_email: Who gets the signed PDF and audit trail by email. Without it, your organisation's admin does.
2161
+ :type final_email: str
2162
+ :param _request_timeout: timeout setting for this request. If one
2163
+ number provided, it will be total request
2164
+ timeout. It can also be a pair (tuple) of
2165
+ (connection, read) timeouts.
2166
+ :type _request_timeout: int, tuple(int, int), optional
2167
+ :param _request_auth: set to override the auth_settings for an a single
2168
+ request; this effectively ignores the
2169
+ authentication in the spec for a single request.
2170
+ :type _request_auth: dict, optional
2171
+ :param _content_type: force content-type for the request.
2172
+ :type _content_type: str, Optional
2173
+ :param _headers: set to override the headers for a single
2174
+ request; this effectively ignores the headers
2175
+ in the spec for a single request.
2176
+ :type _headers: dict, optional
2177
+ :param _host_index: set to override the host_index for a single
2178
+ request; this effectively ignores the host_index
2179
+ in the spec for a single request.
2180
+ :type _host_index: int, optional
2181
+ :return: Returns the result object.
2182
+ """ # noqa: E501
2183
+
2184
+ _param = self._upload_document_for_one_signer_serialize(
2185
+ file=file,
2186
+ signee_name=signee_name,
2187
+ signee_email=signee_email,
2188
+ redirect_url=redirect_url,
2189
+ final_email=final_email,
2190
+ _request_auth=_request_auth,
2191
+ _content_type=_content_type,
2192
+ _headers=_headers,
2193
+ _host_index=_host_index
2194
+ )
2195
+
2196
+ _response_types_map: Dict[str, Optional[str]] = {
2197
+ '200': "UploadDocumentForOneSigner200Response",
2198
+ '400': "Dict[str, object]",
2199
+ '502': "Dict[str, object]",
2200
+ }
2201
+ response_data = self.api_client.call_api(
2202
+ *_param,
2203
+ _request_timeout=_request_timeout
2204
+ )
2205
+ response_data.read()
2206
+ return self.api_client.response_deserialize(
2207
+ response_data=response_data,
2208
+ response_types_map=_response_types_map,
2209
+ ).data
2210
+
2211
+
2212
+ @validate_call
2213
+ def upload_document_for_one_signer_with_http_info(
2214
+ self,
2215
+ file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="A PDF or DOCX file. A PDF that can't be read (damaged, or not really a PDF) is refused with 400 and the reason; save or export it as a new PDF and upload that.")],
2216
+ signee_name: Annotated[StrictStr, Field(description="The signer's name.")],
2217
+ signee_email: Annotated[StrictStr, Field(description="The signer's email address.")],
2218
+ redirect_url: Annotated[StrictStr, Field(description="Where the signer is sent after signing.")],
2219
+ final_email: Annotated[Optional[StrictStr], Field(description="Who gets the signed PDF and audit trail by email. Without it, your organisation's admin does.")] = None,
2220
+ _request_timeout: Union[
2221
+ None,
2222
+ Annotated[StrictFloat, Field(gt=0)],
2223
+ Tuple[
2224
+ Annotated[StrictFloat, Field(gt=0)],
2225
+ Annotated[StrictFloat, Field(gt=0)]
2226
+ ]
2227
+ ] = None,
2228
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2229
+ _content_type: Optional[StrictStr] = None,
2230
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2231
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2232
+ ) -> ApiResponse[UploadDocumentForOneSigner200Response]:
2233
+ """Upload a document for one signer and get their signing link
2234
+
2235
+ Uploads a PDF or DOCX for one signer and returns their signing link in `redirect_url`; give it to the signer. They place their own signature on the signing page and are then sent to the `redirect_url` you gave. The signed PDF and its audit trail are emailed to `final_email`, or to your organisation's admin without one.
2236
+
2237
+ :param file: A PDF or DOCX file. A PDF that can't be read (damaged, or not really a PDF) is refused with 400 and the reason; save or export it as a new PDF and upload that. (required)
2238
+ :type file: bytearray
2239
+ :param signee_name: The signer's name. (required)
2240
+ :type signee_name: str
2241
+ :param signee_email: The signer's email address. (required)
2242
+ :type signee_email: str
2243
+ :param redirect_url: Where the signer is sent after signing. (required)
2244
+ :type redirect_url: str
2245
+ :param final_email: Who gets the signed PDF and audit trail by email. Without it, your organisation's admin does.
2246
+ :type final_email: str
2247
+ :param _request_timeout: timeout setting for this request. If one
2248
+ number provided, it will be total request
2249
+ timeout. It can also be a pair (tuple) of
2250
+ (connection, read) timeouts.
2251
+ :type _request_timeout: int, tuple(int, int), optional
2252
+ :param _request_auth: set to override the auth_settings for an a single
2253
+ request; this effectively ignores the
2254
+ authentication in the spec for a single request.
2255
+ :type _request_auth: dict, optional
2256
+ :param _content_type: force content-type for the request.
2257
+ :type _content_type: str, Optional
2258
+ :param _headers: set to override the headers for a single
2259
+ request; this effectively ignores the headers
2260
+ in the spec for a single request.
2261
+ :type _headers: dict, optional
2262
+ :param _host_index: set to override the host_index for a single
2263
+ request; this effectively ignores the host_index
2264
+ in the spec for a single request.
2265
+ :type _host_index: int, optional
2266
+ :return: Returns the result object.
2267
+ """ # noqa: E501
2268
+
2269
+ _param = self._upload_document_for_one_signer_serialize(
2270
+ file=file,
2271
+ signee_name=signee_name,
2272
+ signee_email=signee_email,
2273
+ redirect_url=redirect_url,
2274
+ final_email=final_email,
2275
+ _request_auth=_request_auth,
2276
+ _content_type=_content_type,
2277
+ _headers=_headers,
2278
+ _host_index=_host_index
2279
+ )
2280
+
2281
+ _response_types_map: Dict[str, Optional[str]] = {
2282
+ '200': "UploadDocumentForOneSigner200Response",
2283
+ '400': "Dict[str, object]",
2284
+ '502': "Dict[str, object]",
2285
+ }
2286
+ response_data = self.api_client.call_api(
2287
+ *_param,
2288
+ _request_timeout=_request_timeout
2289
+ )
2290
+ response_data.read()
2291
+ return self.api_client.response_deserialize(
2292
+ response_data=response_data,
2293
+ response_types_map=_response_types_map,
2294
+ )
2295
+
2296
+
2297
+ @validate_call
2298
+ def upload_document_for_one_signer_without_preload_content(
2299
+ self,
2300
+ file: Annotated[Union[StrictBytes, StrictStr, Tuple[StrictStr, StrictBytes]], Field(description="A PDF or DOCX file. A PDF that can't be read (damaged, or not really a PDF) is refused with 400 and the reason; save or export it as a new PDF and upload that.")],
2301
+ signee_name: Annotated[StrictStr, Field(description="The signer's name.")],
2302
+ signee_email: Annotated[StrictStr, Field(description="The signer's email address.")],
2303
+ redirect_url: Annotated[StrictStr, Field(description="Where the signer is sent after signing.")],
2304
+ final_email: Annotated[Optional[StrictStr], Field(description="Who gets the signed PDF and audit trail by email. Without it, your organisation's admin does.")] = None,
2305
+ _request_timeout: Union[
2306
+ None,
2307
+ Annotated[StrictFloat, Field(gt=0)],
2308
+ Tuple[
2309
+ Annotated[StrictFloat, Field(gt=0)],
2310
+ Annotated[StrictFloat, Field(gt=0)]
2311
+ ]
2312
+ ] = None,
2313
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2314
+ _content_type: Optional[StrictStr] = None,
2315
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2316
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2317
+ ) -> RESTResponseType:
2318
+ """Upload a document for one signer and get their signing link
2319
+
2320
+ Uploads a PDF or DOCX for one signer and returns their signing link in `redirect_url`; give it to the signer. They place their own signature on the signing page and are then sent to the `redirect_url` you gave. The signed PDF and its audit trail are emailed to `final_email`, or to your organisation's admin without one.
2321
+
2322
+ :param file: A PDF or DOCX file. A PDF that can't be read (damaged, or not really a PDF) is refused with 400 and the reason; save or export it as a new PDF and upload that. (required)
2323
+ :type file: bytearray
2324
+ :param signee_name: The signer's name. (required)
2325
+ :type signee_name: str
2326
+ :param signee_email: The signer's email address. (required)
2327
+ :type signee_email: str
2328
+ :param redirect_url: Where the signer is sent after signing. (required)
2329
+ :type redirect_url: str
2330
+ :param final_email: Who gets the signed PDF and audit trail by email. Without it, your organisation's admin does.
2331
+ :type final_email: str
2332
+ :param _request_timeout: timeout setting for this request. If one
2333
+ number provided, it will be total request
2334
+ timeout. It can also be a pair (tuple) of
2335
+ (connection, read) timeouts.
2336
+ :type _request_timeout: int, tuple(int, int), optional
2337
+ :param _request_auth: set to override the auth_settings for an a single
2338
+ request; this effectively ignores the
2339
+ authentication in the spec for a single request.
2340
+ :type _request_auth: dict, optional
2341
+ :param _content_type: force content-type for the request.
2342
+ :type _content_type: str, Optional
2343
+ :param _headers: set to override the headers for a single
2344
+ request; this effectively ignores the headers
2345
+ in the spec for a single request.
2346
+ :type _headers: dict, optional
2347
+ :param _host_index: set to override the host_index for a single
2348
+ request; this effectively ignores the host_index
2349
+ in the spec for a single request.
2350
+ :type _host_index: int, optional
2351
+ :return: Returns the result object.
2352
+ """ # noqa: E501
2353
+
2354
+ _param = self._upload_document_for_one_signer_serialize(
2355
+ file=file,
2356
+ signee_name=signee_name,
2357
+ signee_email=signee_email,
2358
+ redirect_url=redirect_url,
2359
+ final_email=final_email,
2360
+ _request_auth=_request_auth,
2361
+ _content_type=_content_type,
2362
+ _headers=_headers,
2363
+ _host_index=_host_index
2364
+ )
2365
+
2366
+ _response_types_map: Dict[str, Optional[str]] = {
2367
+ '200': "UploadDocumentForOneSigner200Response",
2368
+ '400': "Dict[str, object]",
2369
+ '502': "Dict[str, object]",
2370
+ }
2371
+ response_data = self.api_client.call_api(
2372
+ *_param,
2373
+ _request_timeout=_request_timeout
2374
+ )
2375
+ return response_data.response
2376
+
2377
+
2378
+ def _upload_document_for_one_signer_serialize(
2379
+ self,
2380
+ file,
2381
+ signee_name,
2382
+ signee_email,
2383
+ redirect_url,
2384
+ final_email,
2385
+ _request_auth,
2386
+ _content_type,
2387
+ _headers,
2388
+ _host_index,
2389
+ ) -> RequestSerialized:
2390
+
2391
+ _host = None
2392
+
2393
+ _collection_formats: Dict[str, str] = {
2394
+ }
2395
+
2396
+ _path_params: Dict[str, str] = {}
2397
+ _query_params: List[Tuple[str, str]] = []
2398
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2399
+ _form_params: List[Tuple[str, str]] = []
2400
+ _files: Dict[
2401
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2402
+ ] = {}
2403
+ _body_params: Optional[bytes] = None
2404
+
2405
+ # process the path parameters
2406
+ # process the query parameters
2407
+ # process the header parameters
2408
+ # process the form parameters
2409
+ if file is not None:
2410
+ _files['file'] = file
2411
+ if signee_name is not None:
2412
+ _form_params.append(('signee_name', signee_name))
2413
+ if signee_email is not None:
2414
+ _form_params.append(('signee_email', signee_email))
2415
+ if redirect_url is not None:
2416
+ _form_params.append(('redirect_url', redirect_url))
2417
+ if final_email is not None:
2418
+ _form_params.append(('final_email', final_email))
2419
+ # process the body parameter
2420
+
2421
+
2422
+ # set the HTTP header `Accept`
2423
+ if 'Accept' not in _header_params:
2424
+ _header_params['Accept'] = self.api_client.select_header_accept(
2425
+ [
2426
+ 'application/json'
2427
+ ]
2428
+ )
2429
+
2430
+ # set the HTTP header `Content-Type`
2431
+ if _content_type:
2432
+ _header_params['Content-Type'] = _content_type
2433
+ else:
2434
+ _default_content_type = (
2435
+ self.api_client.select_header_content_type(
2436
+ [
2437
+ 'application/x-www-form-urlencoded',
2438
+ 'multipart/form-data'
2439
+ ]
2440
+ )
2441
+ )
2442
+ if _default_content_type is not None:
2443
+ _header_params['Content-Type'] = _default_content_type
2444
+
2445
+ # authentication setting
2446
+ _auth_settings: List[str] = [
2447
+ 'Bearer'
2448
+ ]
2449
+
2450
+ return self.api_client.param_serialize(
2451
+ method='POST',
2452
+ resource_path='/ap1/upload_app/',
2453
+ path_params=_path_params,
2454
+ query_params=_query_params,
2455
+ header_params=_header_params,
2456
+ body=_body_params,
2457
+ post_params=_form_params,
2458
+ files=_files,
2459
+ auth_settings=_auth_settings,
2460
+ collection_formats=_collection_formats,
2461
+ _host=_host,
2462
+ _request_auth=_request_auth
2463
+ )
2464
+
2465
+