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,1452 @@
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, StrictInt, StrictStr
21
+ from typing import List, Optional
22
+ from typing_extensions import Annotated
23
+ from signedly.models.create_template_fields_request_inner import CreateTemplateFieldsRequestInner
24
+ from signedly.models.send_document200_response import SendDocument200Response
25
+ from signedly.models.template_field import TemplateField
26
+ from signedly.models.template_page import TemplatePage
27
+
28
+ from signedly.api_client import ApiClient, RequestSerialized
29
+ from signedly.api_response import ApiResponse
30
+ from signedly.rest import RESTResponseType
31
+
32
+
33
+ class TemplatesApi:
34
+ """NOTE: This class is auto generated by OpenAPI Generator
35
+ Ref: https://openapi-generator.tech
36
+
37
+ Do not edit the class manually.
38
+ """
39
+
40
+ def __init__(self, api_client=None) -> None:
41
+ if api_client is None:
42
+ api_client = ApiClient.get_default()
43
+ self.api_client = api_client
44
+
45
+
46
+ @validate_call
47
+ def create_template_fields(
48
+ self,
49
+ data: List[CreateTemplateFieldsRequestInner],
50
+ _request_timeout: Union[
51
+ None,
52
+ Annotated[StrictFloat, Field(gt=0)],
53
+ Tuple[
54
+ Annotated[StrictFloat, Field(gt=0)],
55
+ Annotated[StrictFloat, Field(gt=0)]
56
+ ]
57
+ ] = None,
58
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
59
+ _content_type: Optional[StrictStr] = None,
60
+ _headers: Optional[Dict[StrictStr, Any]] = None,
61
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
62
+ ) -> List[TemplateField]:
63
+ """Add fields to a template
64
+
65
+ Places fields on a template. They have no signatory yet: on a document made from the template, they go to its first signatory. A field must sit wholly on its page (1 point of tolerance).
66
+
67
+ :param data: (required)
68
+ :type data: List[CreateTemplateFieldsRequestInner]
69
+ :param _request_timeout: timeout setting for this request. If one
70
+ number provided, it will be total request
71
+ timeout. It can also be a pair (tuple) of
72
+ (connection, read) timeouts.
73
+ :type _request_timeout: int, tuple(int, int), optional
74
+ :param _request_auth: set to override the auth_settings for an a single
75
+ request; this effectively ignores the
76
+ authentication in the spec for a single request.
77
+ :type _request_auth: dict, optional
78
+ :param _content_type: force content-type for the request.
79
+ :type _content_type: str, Optional
80
+ :param _headers: set to override the headers for a single
81
+ request; this effectively ignores the headers
82
+ in the spec for a single request.
83
+ :type _headers: dict, optional
84
+ :param _host_index: set to override the host_index for a single
85
+ request; this effectively ignores the host_index
86
+ in the spec for a single request.
87
+ :type _host_index: int, optional
88
+ :return: Returns the result object.
89
+ """ # noqa: E501
90
+
91
+ _param = self._create_template_fields_serialize(
92
+ data=data,
93
+ _request_auth=_request_auth,
94
+ _content_type=_content_type,
95
+ _headers=_headers,
96
+ _host_index=_host_index
97
+ )
98
+
99
+ _response_types_map: Dict[str, Optional[str]] = {
100
+ '201': "List[TemplateField]",
101
+ '400': "Dict[str, object]",
102
+ '404': "Dict[str, object]",
103
+ }
104
+ response_data = self.api_client.call_api(
105
+ *_param,
106
+ _request_timeout=_request_timeout
107
+ )
108
+ response_data.read()
109
+ return self.api_client.response_deserialize(
110
+ response_data=response_data,
111
+ response_types_map=_response_types_map,
112
+ ).data
113
+
114
+
115
+ @validate_call
116
+ def create_template_fields_with_http_info(
117
+ self,
118
+ data: List[CreateTemplateFieldsRequestInner],
119
+ _request_timeout: Union[
120
+ None,
121
+ Annotated[StrictFloat, Field(gt=0)],
122
+ Tuple[
123
+ Annotated[StrictFloat, Field(gt=0)],
124
+ Annotated[StrictFloat, Field(gt=0)]
125
+ ]
126
+ ] = None,
127
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
128
+ _content_type: Optional[StrictStr] = None,
129
+ _headers: Optional[Dict[StrictStr, Any]] = None,
130
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
131
+ ) -> ApiResponse[List[TemplateField]]:
132
+ """Add fields to a template
133
+
134
+ Places fields on a template. They have no signatory yet: on a document made from the template, they go to its first signatory. A field must sit wholly on its page (1 point of tolerance).
135
+
136
+ :param data: (required)
137
+ :type data: List[CreateTemplateFieldsRequestInner]
138
+ :param _request_timeout: timeout setting for this request. If one
139
+ number provided, it will be total request
140
+ timeout. It can also be a pair (tuple) of
141
+ (connection, read) timeouts.
142
+ :type _request_timeout: int, tuple(int, int), optional
143
+ :param _request_auth: set to override the auth_settings for an a single
144
+ request; this effectively ignores the
145
+ authentication in the spec for a single request.
146
+ :type _request_auth: dict, optional
147
+ :param _content_type: force content-type for the request.
148
+ :type _content_type: str, Optional
149
+ :param _headers: set to override the headers for a single
150
+ request; this effectively ignores the headers
151
+ in the spec for a single request.
152
+ :type _headers: dict, optional
153
+ :param _host_index: set to override the host_index for a single
154
+ request; this effectively ignores the host_index
155
+ in the spec for a single request.
156
+ :type _host_index: int, optional
157
+ :return: Returns the result object.
158
+ """ # noqa: E501
159
+
160
+ _param = self._create_template_fields_serialize(
161
+ data=data,
162
+ _request_auth=_request_auth,
163
+ _content_type=_content_type,
164
+ _headers=_headers,
165
+ _host_index=_host_index
166
+ )
167
+
168
+ _response_types_map: Dict[str, Optional[str]] = {
169
+ '201': "List[TemplateField]",
170
+ '400': "Dict[str, object]",
171
+ '404': "Dict[str, object]",
172
+ }
173
+ response_data = self.api_client.call_api(
174
+ *_param,
175
+ _request_timeout=_request_timeout
176
+ )
177
+ response_data.read()
178
+ return self.api_client.response_deserialize(
179
+ response_data=response_data,
180
+ response_types_map=_response_types_map,
181
+ )
182
+
183
+
184
+ @validate_call
185
+ def create_template_fields_without_preload_content(
186
+ self,
187
+ data: List[CreateTemplateFieldsRequestInner],
188
+ _request_timeout: Union[
189
+ None,
190
+ Annotated[StrictFloat, Field(gt=0)],
191
+ Tuple[
192
+ Annotated[StrictFloat, Field(gt=0)],
193
+ Annotated[StrictFloat, Field(gt=0)]
194
+ ]
195
+ ] = None,
196
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
197
+ _content_type: Optional[StrictStr] = None,
198
+ _headers: Optional[Dict[StrictStr, Any]] = None,
199
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
200
+ ) -> RESTResponseType:
201
+ """Add fields to a template
202
+
203
+ Places fields on a template. They have no signatory yet: on a document made from the template, they go to its first signatory. A field must sit wholly on its page (1 point of tolerance).
204
+
205
+ :param data: (required)
206
+ :type data: List[CreateTemplateFieldsRequestInner]
207
+ :param _request_timeout: timeout setting for this request. If one
208
+ number provided, it will be total request
209
+ timeout. It can also be a pair (tuple) of
210
+ (connection, read) timeouts.
211
+ :type _request_timeout: int, tuple(int, int), optional
212
+ :param _request_auth: set to override the auth_settings for an a single
213
+ request; this effectively ignores the
214
+ authentication in the spec for a single request.
215
+ :type _request_auth: dict, optional
216
+ :param _content_type: force content-type for the request.
217
+ :type _content_type: str, Optional
218
+ :param _headers: set to override the headers for a single
219
+ request; this effectively ignores the headers
220
+ in the spec for a single request.
221
+ :type _headers: dict, optional
222
+ :param _host_index: set to override the host_index for a single
223
+ request; this effectively ignores the host_index
224
+ in the spec for a single request.
225
+ :type _host_index: int, optional
226
+ :return: Returns the result object.
227
+ """ # noqa: E501
228
+
229
+ _param = self._create_template_fields_serialize(
230
+ data=data,
231
+ _request_auth=_request_auth,
232
+ _content_type=_content_type,
233
+ _headers=_headers,
234
+ _host_index=_host_index
235
+ )
236
+
237
+ _response_types_map: Dict[str, Optional[str]] = {
238
+ '201': "List[TemplateField]",
239
+ '400': "Dict[str, object]",
240
+ '404': "Dict[str, object]",
241
+ }
242
+ response_data = self.api_client.call_api(
243
+ *_param,
244
+ _request_timeout=_request_timeout
245
+ )
246
+ return response_data.response
247
+
248
+
249
+ def _create_template_fields_serialize(
250
+ self,
251
+ data,
252
+ _request_auth,
253
+ _content_type,
254
+ _headers,
255
+ _host_index,
256
+ ) -> RequestSerialized:
257
+
258
+ _host = None
259
+
260
+ _collection_formats: Dict[str, str] = {
261
+ 'data': '',
262
+ }
263
+
264
+ _path_params: Dict[str, str] = {}
265
+ _query_params: List[Tuple[str, str]] = []
266
+ _header_params: Dict[str, Optional[str]] = _headers or {}
267
+ _form_params: List[Tuple[str, str]] = []
268
+ _files: Dict[
269
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
270
+ ] = {}
271
+ _body_params: Optional[bytes] = None
272
+
273
+ # process the path parameters
274
+ # process the query parameters
275
+ # process the header parameters
276
+ # process the form parameters
277
+ # process the body parameter
278
+ if data is not None:
279
+ _body_params = data
280
+
281
+
282
+ # set the HTTP header `Accept`
283
+ if 'Accept' not in _header_params:
284
+ _header_params['Accept'] = self.api_client.select_header_accept(
285
+ [
286
+ 'application/json'
287
+ ]
288
+ )
289
+
290
+ # set the HTTP header `Content-Type`
291
+ if _content_type:
292
+ _header_params['Content-Type'] = _content_type
293
+ else:
294
+ _default_content_type = (
295
+ self.api_client.select_header_content_type(
296
+ [
297
+ 'application/json'
298
+ ]
299
+ )
300
+ )
301
+ if _default_content_type is not None:
302
+ _header_params['Content-Type'] = _default_content_type
303
+
304
+ # authentication setting
305
+ _auth_settings: List[str] = [
306
+ 'Bearer'
307
+ ]
308
+
309
+ return self.api_client.param_serialize(
310
+ method='POST',
311
+ resource_path='/ap1/templates/fields/',
312
+ path_params=_path_params,
313
+ query_params=_query_params,
314
+ header_params=_header_params,
315
+ body=_body_params,
316
+ post_params=_form_params,
317
+ files=_files,
318
+ auth_settings=_auth_settings,
319
+ collection_formats=_collection_formats,
320
+ _host=_host,
321
+ _request_auth=_request_auth
322
+ )
323
+
324
+
325
+
326
+
327
+ @validate_call
328
+ def delete_document(
329
+ self,
330
+ id: Annotated[StrictStr, Field(description="The document's or template's ID.")],
331
+ _request_timeout: Union[
332
+ None,
333
+ Annotated[StrictFloat, Field(gt=0)],
334
+ Tuple[
335
+ Annotated[StrictFloat, Field(gt=0)],
336
+ Annotated[StrictFloat, Field(gt=0)]
337
+ ]
338
+ ] = None,
339
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
340
+ _content_type: Optional[StrictStr] = None,
341
+ _headers: Optional[Dict[StrictStr, Any]] = None,
342
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
343
+ ) -> SendDocument200Response:
344
+ """Delete a template or an unsent document
345
+
346
+ 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.
347
+
348
+ :param id: The document's or template's ID. (required)
349
+ :type id: str
350
+ :param _request_timeout: timeout setting for this request. If one
351
+ number provided, it will be total request
352
+ timeout. It can also be a pair (tuple) of
353
+ (connection, read) timeouts.
354
+ :type _request_timeout: int, tuple(int, int), optional
355
+ :param _request_auth: set to override the auth_settings for an a single
356
+ request; this effectively ignores the
357
+ authentication in the spec for a single request.
358
+ :type _request_auth: dict, optional
359
+ :param _content_type: force content-type for the request.
360
+ :type _content_type: str, Optional
361
+ :param _headers: set to override the headers for a single
362
+ request; this effectively ignores the headers
363
+ in the spec for a single request.
364
+ :type _headers: dict, optional
365
+ :param _host_index: set to override the host_index for a single
366
+ request; this effectively ignores the host_index
367
+ in the spec for a single request.
368
+ :type _host_index: int, optional
369
+ :return: Returns the result object.
370
+ """ # noqa: E501
371
+
372
+ _param = self._delete_document_serialize(
373
+ id=id,
374
+ _request_auth=_request_auth,
375
+ _content_type=_content_type,
376
+ _headers=_headers,
377
+ _host_index=_host_index
378
+ )
379
+
380
+ _response_types_map: Dict[str, Optional[str]] = {
381
+ '204': "SendDocument200Response",
382
+ '400': "Dict[str, object]",
383
+ '403': "Dict[str, object]",
384
+ '404': "Dict[str, object]",
385
+ }
386
+ response_data = self.api_client.call_api(
387
+ *_param,
388
+ _request_timeout=_request_timeout
389
+ )
390
+ response_data.read()
391
+ return self.api_client.response_deserialize(
392
+ response_data=response_data,
393
+ response_types_map=_response_types_map,
394
+ ).data
395
+
396
+
397
+ @validate_call
398
+ def delete_document_with_http_info(
399
+ self,
400
+ id: Annotated[StrictStr, Field(description="The document's or template's ID.")],
401
+ _request_timeout: Union[
402
+ None,
403
+ Annotated[StrictFloat, Field(gt=0)],
404
+ Tuple[
405
+ Annotated[StrictFloat, Field(gt=0)],
406
+ Annotated[StrictFloat, Field(gt=0)]
407
+ ]
408
+ ] = None,
409
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
410
+ _content_type: Optional[StrictStr] = None,
411
+ _headers: Optional[Dict[StrictStr, Any]] = None,
412
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
413
+ ) -> ApiResponse[SendDocument200Response]:
414
+ """Delete a template or an unsent document
415
+
416
+ 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.
417
+
418
+ :param id: The document's or template's ID. (required)
419
+ :type id: str
420
+ :param _request_timeout: timeout setting for this request. If one
421
+ number provided, it will be total request
422
+ timeout. It can also be a pair (tuple) of
423
+ (connection, read) timeouts.
424
+ :type _request_timeout: int, tuple(int, int), optional
425
+ :param _request_auth: set to override the auth_settings for an a single
426
+ request; this effectively ignores the
427
+ authentication in the spec for a single request.
428
+ :type _request_auth: dict, optional
429
+ :param _content_type: force content-type for the request.
430
+ :type _content_type: str, Optional
431
+ :param _headers: set to override the headers for a single
432
+ request; this effectively ignores the headers
433
+ in the spec for a single request.
434
+ :type _headers: dict, optional
435
+ :param _host_index: set to override the host_index for a single
436
+ request; this effectively ignores the host_index
437
+ in the spec for a single request.
438
+ :type _host_index: int, optional
439
+ :return: Returns the result object.
440
+ """ # noqa: E501
441
+
442
+ _param = self._delete_document_serialize(
443
+ id=id,
444
+ _request_auth=_request_auth,
445
+ _content_type=_content_type,
446
+ _headers=_headers,
447
+ _host_index=_host_index
448
+ )
449
+
450
+ _response_types_map: Dict[str, Optional[str]] = {
451
+ '204': "SendDocument200Response",
452
+ '400': "Dict[str, object]",
453
+ '403': "Dict[str, object]",
454
+ '404': "Dict[str, object]",
455
+ }
456
+ response_data = self.api_client.call_api(
457
+ *_param,
458
+ _request_timeout=_request_timeout
459
+ )
460
+ response_data.read()
461
+ return self.api_client.response_deserialize(
462
+ response_data=response_data,
463
+ response_types_map=_response_types_map,
464
+ )
465
+
466
+
467
+ @validate_call
468
+ def delete_document_without_preload_content(
469
+ self,
470
+ id: Annotated[StrictStr, Field(description="The document's or template's ID.")],
471
+ _request_timeout: Union[
472
+ None,
473
+ Annotated[StrictFloat, Field(gt=0)],
474
+ Tuple[
475
+ Annotated[StrictFloat, Field(gt=0)],
476
+ Annotated[StrictFloat, Field(gt=0)]
477
+ ]
478
+ ] = None,
479
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
480
+ _content_type: Optional[StrictStr] = None,
481
+ _headers: Optional[Dict[StrictStr, Any]] = None,
482
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
483
+ ) -> RESTResponseType:
484
+ """Delete a template or an unsent document
485
+
486
+ 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.
487
+
488
+ :param id: The document's or template's ID. (required)
489
+ :type id: str
490
+ :param _request_timeout: timeout setting for this request. If one
491
+ number provided, it will be total request
492
+ timeout. It can also be a pair (tuple) of
493
+ (connection, read) timeouts.
494
+ :type _request_timeout: int, tuple(int, int), optional
495
+ :param _request_auth: set to override the auth_settings for an a single
496
+ request; this effectively ignores the
497
+ authentication in the spec for a single request.
498
+ :type _request_auth: dict, optional
499
+ :param _content_type: force content-type for the request.
500
+ :type _content_type: str, Optional
501
+ :param _headers: set to override the headers for a single
502
+ request; this effectively ignores the headers
503
+ in the spec for a single request.
504
+ :type _headers: dict, optional
505
+ :param _host_index: set to override the host_index for a single
506
+ request; this effectively ignores the host_index
507
+ in the spec for a single request.
508
+ :type _host_index: int, optional
509
+ :return: Returns the result object.
510
+ """ # noqa: E501
511
+
512
+ _param = self._delete_document_serialize(
513
+ id=id,
514
+ _request_auth=_request_auth,
515
+ _content_type=_content_type,
516
+ _headers=_headers,
517
+ _host_index=_host_index
518
+ )
519
+
520
+ _response_types_map: Dict[str, Optional[str]] = {
521
+ '204': "SendDocument200Response",
522
+ '400': "Dict[str, object]",
523
+ '403': "Dict[str, object]",
524
+ '404': "Dict[str, object]",
525
+ }
526
+ response_data = self.api_client.call_api(
527
+ *_param,
528
+ _request_timeout=_request_timeout
529
+ )
530
+ return response_data.response
531
+
532
+
533
+ def _delete_document_serialize(
534
+ self,
535
+ id,
536
+ _request_auth,
537
+ _content_type,
538
+ _headers,
539
+ _host_index,
540
+ ) -> RequestSerialized:
541
+
542
+ _host = None
543
+
544
+ _collection_formats: Dict[str, str] = {
545
+ }
546
+
547
+ _path_params: Dict[str, str] = {}
548
+ _query_params: List[Tuple[str, str]] = []
549
+ _header_params: Dict[str, Optional[str]] = _headers or {}
550
+ _form_params: List[Tuple[str, str]] = []
551
+ _files: Dict[
552
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
553
+ ] = {}
554
+ _body_params: Optional[bytes] = None
555
+
556
+ # process the path parameters
557
+ if id is not None:
558
+ _path_params['id'] = id
559
+ # process the query parameters
560
+ # process the header parameters
561
+ # process the form parameters
562
+ # process the body parameter
563
+
564
+
565
+ # set the HTTP header `Accept`
566
+ if 'Accept' not in _header_params:
567
+ _header_params['Accept'] = self.api_client.select_header_accept(
568
+ [
569
+ 'application/json'
570
+ ]
571
+ )
572
+
573
+
574
+ # authentication setting
575
+ _auth_settings: List[str] = [
576
+ 'Bearer'
577
+ ]
578
+
579
+ return self.api_client.param_serialize(
580
+ method='DELETE',
581
+ resource_path='/ap1/documents-status/{id}/',
582
+ path_params=_path_params,
583
+ query_params=_query_params,
584
+ header_params=_header_params,
585
+ body=_body_params,
586
+ post_params=_form_params,
587
+ files=_files,
588
+ auth_settings=_auth_settings,
589
+ collection_formats=_collection_formats,
590
+ _host=_host,
591
+ _request_auth=_request_auth
592
+ )
593
+
594
+
595
+
596
+
597
+ @validate_call
598
+ def list_template_fields(
599
+ self,
600
+ document_id: Annotated[StrictStr, Field(description="The template's ID.")],
601
+ _request_timeout: Union[
602
+ None,
603
+ Annotated[StrictFloat, Field(gt=0)],
604
+ Tuple[
605
+ Annotated[StrictFloat, Field(gt=0)],
606
+ Annotated[StrictFloat, Field(gt=0)]
607
+ ]
608
+ ] = None,
609
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
610
+ _content_type: Optional[StrictStr] = None,
611
+ _headers: Optional[Dict[StrictStr, Any]] = None,
612
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
613
+ ) -> List[TemplateField]:
614
+ """List a template's fields
615
+
616
+ The fields of a template (or of any of your documents).
617
+
618
+ :param document_id: The template's ID. (required)
619
+ :type document_id: str
620
+ :param _request_timeout: timeout setting for this request. If one
621
+ number provided, it will be total request
622
+ timeout. It can also be a pair (tuple) of
623
+ (connection, read) timeouts.
624
+ :type _request_timeout: int, tuple(int, int), optional
625
+ :param _request_auth: set to override the auth_settings for an a single
626
+ request; this effectively ignores the
627
+ authentication in the spec for a single request.
628
+ :type _request_auth: dict, optional
629
+ :param _content_type: force content-type for the request.
630
+ :type _content_type: str, Optional
631
+ :param _headers: set to override the headers for a single
632
+ request; this effectively ignores the headers
633
+ in the spec for a single request.
634
+ :type _headers: dict, optional
635
+ :param _host_index: set to override the host_index for a single
636
+ request; this effectively ignores the host_index
637
+ in the spec for a single request.
638
+ :type _host_index: int, optional
639
+ :return: Returns the result object.
640
+ """ # noqa: E501
641
+
642
+ _param = self._list_template_fields_serialize(
643
+ document_id=document_id,
644
+ _request_auth=_request_auth,
645
+ _content_type=_content_type,
646
+ _headers=_headers,
647
+ _host_index=_host_index
648
+ )
649
+
650
+ _response_types_map: Dict[str, Optional[str]] = {
651
+ '200': "List[TemplateField]",
652
+ '404': "Dict[str, object]",
653
+ }
654
+ response_data = self.api_client.call_api(
655
+ *_param,
656
+ _request_timeout=_request_timeout
657
+ )
658
+ response_data.read()
659
+ return self.api_client.response_deserialize(
660
+ response_data=response_data,
661
+ response_types_map=_response_types_map,
662
+ ).data
663
+
664
+
665
+ @validate_call
666
+ def list_template_fields_with_http_info(
667
+ self,
668
+ document_id: Annotated[StrictStr, Field(description="The template's ID.")],
669
+ _request_timeout: Union[
670
+ None,
671
+ Annotated[StrictFloat, Field(gt=0)],
672
+ Tuple[
673
+ Annotated[StrictFloat, Field(gt=0)],
674
+ Annotated[StrictFloat, Field(gt=0)]
675
+ ]
676
+ ] = None,
677
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
678
+ _content_type: Optional[StrictStr] = None,
679
+ _headers: Optional[Dict[StrictStr, Any]] = None,
680
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
681
+ ) -> ApiResponse[List[TemplateField]]:
682
+ """List a template's fields
683
+
684
+ The fields of a template (or of any of your documents).
685
+
686
+ :param document_id: The template's ID. (required)
687
+ :type document_id: str
688
+ :param _request_timeout: timeout setting for this request. If one
689
+ number provided, it will be total request
690
+ timeout. It can also be a pair (tuple) of
691
+ (connection, read) timeouts.
692
+ :type _request_timeout: int, tuple(int, int), optional
693
+ :param _request_auth: set to override the auth_settings for an a single
694
+ request; this effectively ignores the
695
+ authentication in the spec for a single request.
696
+ :type _request_auth: dict, optional
697
+ :param _content_type: force content-type for the request.
698
+ :type _content_type: str, Optional
699
+ :param _headers: set to override the headers for a single
700
+ request; this effectively ignores the headers
701
+ in the spec for a single request.
702
+ :type _headers: dict, optional
703
+ :param _host_index: set to override the host_index for a single
704
+ request; this effectively ignores the host_index
705
+ in the spec for a single request.
706
+ :type _host_index: int, optional
707
+ :return: Returns the result object.
708
+ """ # noqa: E501
709
+
710
+ _param = self._list_template_fields_serialize(
711
+ document_id=document_id,
712
+ _request_auth=_request_auth,
713
+ _content_type=_content_type,
714
+ _headers=_headers,
715
+ _host_index=_host_index
716
+ )
717
+
718
+ _response_types_map: Dict[str, Optional[str]] = {
719
+ '200': "List[TemplateField]",
720
+ '404': "Dict[str, object]",
721
+ }
722
+ response_data = self.api_client.call_api(
723
+ *_param,
724
+ _request_timeout=_request_timeout
725
+ )
726
+ response_data.read()
727
+ return self.api_client.response_deserialize(
728
+ response_data=response_data,
729
+ response_types_map=_response_types_map,
730
+ )
731
+
732
+
733
+ @validate_call
734
+ def list_template_fields_without_preload_content(
735
+ self,
736
+ document_id: Annotated[StrictStr, Field(description="The template's ID.")],
737
+ _request_timeout: Union[
738
+ None,
739
+ Annotated[StrictFloat, Field(gt=0)],
740
+ Tuple[
741
+ Annotated[StrictFloat, Field(gt=0)],
742
+ Annotated[StrictFloat, Field(gt=0)]
743
+ ]
744
+ ] = None,
745
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
746
+ _content_type: Optional[StrictStr] = None,
747
+ _headers: Optional[Dict[StrictStr, Any]] = None,
748
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
749
+ ) -> RESTResponseType:
750
+ """List a template's fields
751
+
752
+ The fields of a template (or of any of your documents).
753
+
754
+ :param document_id: The template's ID. (required)
755
+ :type document_id: str
756
+ :param _request_timeout: timeout setting for this request. If one
757
+ number provided, it will be total request
758
+ timeout. It can also be a pair (tuple) of
759
+ (connection, read) timeouts.
760
+ :type _request_timeout: int, tuple(int, int), optional
761
+ :param _request_auth: set to override the auth_settings for an a single
762
+ request; this effectively ignores the
763
+ authentication in the spec for a single request.
764
+ :type _request_auth: dict, optional
765
+ :param _content_type: force content-type for the request.
766
+ :type _content_type: str, Optional
767
+ :param _headers: set to override the headers for a single
768
+ request; this effectively ignores the headers
769
+ in the spec for a single request.
770
+ :type _headers: dict, optional
771
+ :param _host_index: set to override the host_index for a single
772
+ request; this effectively ignores the host_index
773
+ in the spec for a single request.
774
+ :type _host_index: int, optional
775
+ :return: Returns the result object.
776
+ """ # noqa: E501
777
+
778
+ _param = self._list_template_fields_serialize(
779
+ document_id=document_id,
780
+ _request_auth=_request_auth,
781
+ _content_type=_content_type,
782
+ _headers=_headers,
783
+ _host_index=_host_index
784
+ )
785
+
786
+ _response_types_map: Dict[str, Optional[str]] = {
787
+ '200': "List[TemplateField]",
788
+ '404': "Dict[str, object]",
789
+ }
790
+ response_data = self.api_client.call_api(
791
+ *_param,
792
+ _request_timeout=_request_timeout
793
+ )
794
+ return response_data.response
795
+
796
+
797
+ def _list_template_fields_serialize(
798
+ self,
799
+ document_id,
800
+ _request_auth,
801
+ _content_type,
802
+ _headers,
803
+ _host_index,
804
+ ) -> RequestSerialized:
805
+
806
+ _host = None
807
+
808
+ _collection_formats: Dict[str, str] = {
809
+ }
810
+
811
+ _path_params: Dict[str, str] = {}
812
+ _query_params: List[Tuple[str, str]] = []
813
+ _header_params: Dict[str, Optional[str]] = _headers or {}
814
+ _form_params: List[Tuple[str, str]] = []
815
+ _files: Dict[
816
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
817
+ ] = {}
818
+ _body_params: Optional[bytes] = None
819
+
820
+ # process the path parameters
821
+ # process the query parameters
822
+ if document_id is not None:
823
+
824
+ _query_params.append(('document_id', document_id))
825
+
826
+ # process the header parameters
827
+ # process the form parameters
828
+ # process the body parameter
829
+
830
+
831
+ # set the HTTP header `Accept`
832
+ if 'Accept' not in _header_params:
833
+ _header_params['Accept'] = self.api_client.select_header_accept(
834
+ [
835
+ 'application/json'
836
+ ]
837
+ )
838
+
839
+
840
+ # authentication setting
841
+ _auth_settings: List[str] = [
842
+ 'Bearer'
843
+ ]
844
+
845
+ return self.api_client.param_serialize(
846
+ method='GET',
847
+ resource_path='/ap1/templates/fields/',
848
+ path_params=_path_params,
849
+ query_params=_query_params,
850
+ header_params=_header_params,
851
+ body=_body_params,
852
+ post_params=_form_params,
853
+ files=_files,
854
+ auth_settings=_auth_settings,
855
+ collection_formats=_collection_formats,
856
+ _host=_host,
857
+ _request_auth=_request_auth
858
+ )
859
+
860
+
861
+
862
+
863
+ @validate_call
864
+ def list_templates(
865
+ self,
866
+ name: Annotated[Optional[StrictStr], Field(description="Only templates whose title contains this (any case).")] = None,
867
+ limit: Annotated[Optional[StrictInt], Field(description="How many results to return (default 10).")] = None,
868
+ offset: Annotated[Optional[StrictInt], Field(description="How many results to skip.")] = None,
869
+ _request_timeout: Union[
870
+ None,
871
+ Annotated[StrictFloat, Field(gt=0)],
872
+ Tuple[
873
+ Annotated[StrictFloat, Field(gt=0)],
874
+ Annotated[StrictFloat, Field(gt=0)]
875
+ ]
876
+ ] = None,
877
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
878
+ _content_type: Optional[StrictStr] = None,
879
+ _headers: Optional[Dict[StrictStr, Any]] = None,
880
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
881
+ ) -> TemplatePage:
882
+ """List your organisation's templates
883
+
884
+ The templates of your organisation's admin account, newest first, with their pages and fields. Bulk-send templates aren't listed. Paged: see `limit` and `offset`.
885
+
886
+ :param name: Only templates whose title contains this (any case).
887
+ :type name: str
888
+ :param limit: How many results to return (default 10).
889
+ :type limit: int
890
+ :param offset: How many results to skip.
891
+ :type offset: int
892
+ :param _request_timeout: timeout setting for this request. If one
893
+ number provided, it will be total request
894
+ timeout. It can also be a pair (tuple) of
895
+ (connection, read) timeouts.
896
+ :type _request_timeout: int, tuple(int, int), optional
897
+ :param _request_auth: set to override the auth_settings for an a single
898
+ request; this effectively ignores the
899
+ authentication in the spec for a single request.
900
+ :type _request_auth: dict, optional
901
+ :param _content_type: force content-type for the request.
902
+ :type _content_type: str, Optional
903
+ :param _headers: set to override the headers for a single
904
+ request; this effectively ignores the headers
905
+ in the spec for a single request.
906
+ :type _headers: dict, optional
907
+ :param _host_index: set to override the host_index for a single
908
+ request; this effectively ignores the host_index
909
+ in the spec for a single request.
910
+ :type _host_index: int, optional
911
+ :return: Returns the result object.
912
+ """ # noqa: E501
913
+
914
+ _param = self._list_templates_serialize(
915
+ name=name,
916
+ limit=limit,
917
+ offset=offset,
918
+ _request_auth=_request_auth,
919
+ _content_type=_content_type,
920
+ _headers=_headers,
921
+ _host_index=_host_index
922
+ )
923
+
924
+ _response_types_map: Dict[str, Optional[str]] = {
925
+ '200': "TemplatePage",
926
+ }
927
+ response_data = self.api_client.call_api(
928
+ *_param,
929
+ _request_timeout=_request_timeout
930
+ )
931
+ response_data.read()
932
+ return self.api_client.response_deserialize(
933
+ response_data=response_data,
934
+ response_types_map=_response_types_map,
935
+ ).data
936
+
937
+
938
+ @validate_call
939
+ def list_templates_with_http_info(
940
+ self,
941
+ name: Annotated[Optional[StrictStr], Field(description="Only templates whose title contains this (any case).")] = None,
942
+ limit: Annotated[Optional[StrictInt], Field(description="How many results to return (default 10).")] = None,
943
+ offset: Annotated[Optional[StrictInt], Field(description="How many results to skip.")] = None,
944
+ _request_timeout: Union[
945
+ None,
946
+ Annotated[StrictFloat, Field(gt=0)],
947
+ Tuple[
948
+ Annotated[StrictFloat, Field(gt=0)],
949
+ Annotated[StrictFloat, Field(gt=0)]
950
+ ]
951
+ ] = None,
952
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
953
+ _content_type: Optional[StrictStr] = None,
954
+ _headers: Optional[Dict[StrictStr, Any]] = None,
955
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
956
+ ) -> ApiResponse[TemplatePage]:
957
+ """List your organisation's templates
958
+
959
+ The templates of your organisation's admin account, newest first, with their pages and fields. Bulk-send templates aren't listed. Paged: see `limit` and `offset`.
960
+
961
+ :param name: Only templates whose title contains this (any case).
962
+ :type name: str
963
+ :param limit: How many results to return (default 10).
964
+ :type limit: int
965
+ :param offset: How many results to skip.
966
+ :type offset: int
967
+ :param _request_timeout: timeout setting for this request. If one
968
+ number provided, it will be total request
969
+ timeout. It can also be a pair (tuple) of
970
+ (connection, read) timeouts.
971
+ :type _request_timeout: int, tuple(int, int), optional
972
+ :param _request_auth: set to override the auth_settings for an a single
973
+ request; this effectively ignores the
974
+ authentication in the spec for a single request.
975
+ :type _request_auth: dict, optional
976
+ :param _content_type: force content-type for the request.
977
+ :type _content_type: str, Optional
978
+ :param _headers: set to override the headers for a single
979
+ request; this effectively ignores the headers
980
+ in the spec for a single request.
981
+ :type _headers: dict, optional
982
+ :param _host_index: set to override the host_index for a single
983
+ request; this effectively ignores the host_index
984
+ in the spec for a single request.
985
+ :type _host_index: int, optional
986
+ :return: Returns the result object.
987
+ """ # noqa: E501
988
+
989
+ _param = self._list_templates_serialize(
990
+ name=name,
991
+ limit=limit,
992
+ offset=offset,
993
+ _request_auth=_request_auth,
994
+ _content_type=_content_type,
995
+ _headers=_headers,
996
+ _host_index=_host_index
997
+ )
998
+
999
+ _response_types_map: Dict[str, Optional[str]] = {
1000
+ '200': "TemplatePage",
1001
+ }
1002
+ response_data = self.api_client.call_api(
1003
+ *_param,
1004
+ _request_timeout=_request_timeout
1005
+ )
1006
+ response_data.read()
1007
+ return self.api_client.response_deserialize(
1008
+ response_data=response_data,
1009
+ response_types_map=_response_types_map,
1010
+ )
1011
+
1012
+
1013
+ @validate_call
1014
+ def list_templates_without_preload_content(
1015
+ self,
1016
+ name: Annotated[Optional[StrictStr], Field(description="Only templates whose title contains this (any case).")] = None,
1017
+ limit: Annotated[Optional[StrictInt], Field(description="How many results to return (default 10).")] = None,
1018
+ offset: Annotated[Optional[StrictInt], Field(description="How many results to skip.")] = None,
1019
+ _request_timeout: Union[
1020
+ None,
1021
+ Annotated[StrictFloat, Field(gt=0)],
1022
+ Tuple[
1023
+ Annotated[StrictFloat, Field(gt=0)],
1024
+ Annotated[StrictFloat, Field(gt=0)]
1025
+ ]
1026
+ ] = None,
1027
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1028
+ _content_type: Optional[StrictStr] = None,
1029
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1030
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1031
+ ) -> RESTResponseType:
1032
+ """List your organisation's templates
1033
+
1034
+ The templates of your organisation's admin account, newest first, with their pages and fields. Bulk-send templates aren't listed. Paged: see `limit` and `offset`.
1035
+
1036
+ :param name: Only templates whose title contains this (any case).
1037
+ :type name: str
1038
+ :param limit: How many results to return (default 10).
1039
+ :type limit: int
1040
+ :param offset: How many results to skip.
1041
+ :type offset: int
1042
+ :param _request_timeout: timeout setting for this request. If one
1043
+ number provided, it will be total request
1044
+ timeout. It can also be a pair (tuple) of
1045
+ (connection, read) timeouts.
1046
+ :type _request_timeout: int, tuple(int, int), optional
1047
+ :param _request_auth: set to override the auth_settings for an a single
1048
+ request; this effectively ignores the
1049
+ authentication in the spec for a single request.
1050
+ :type _request_auth: dict, optional
1051
+ :param _content_type: force content-type for the request.
1052
+ :type _content_type: str, Optional
1053
+ :param _headers: set to override the headers for a single
1054
+ request; this effectively ignores the headers
1055
+ in the spec for a single request.
1056
+ :type _headers: dict, optional
1057
+ :param _host_index: set to override the host_index for a single
1058
+ request; this effectively ignores the host_index
1059
+ in the spec for a single request.
1060
+ :type _host_index: int, optional
1061
+ :return: Returns the result object.
1062
+ """ # noqa: E501
1063
+
1064
+ _param = self._list_templates_serialize(
1065
+ name=name,
1066
+ limit=limit,
1067
+ offset=offset,
1068
+ _request_auth=_request_auth,
1069
+ _content_type=_content_type,
1070
+ _headers=_headers,
1071
+ _host_index=_host_index
1072
+ )
1073
+
1074
+ _response_types_map: Dict[str, Optional[str]] = {
1075
+ '200': "TemplatePage",
1076
+ }
1077
+ response_data = self.api_client.call_api(
1078
+ *_param,
1079
+ _request_timeout=_request_timeout
1080
+ )
1081
+ return response_data.response
1082
+
1083
+
1084
+ def _list_templates_serialize(
1085
+ self,
1086
+ name,
1087
+ limit,
1088
+ offset,
1089
+ _request_auth,
1090
+ _content_type,
1091
+ _headers,
1092
+ _host_index,
1093
+ ) -> RequestSerialized:
1094
+
1095
+ _host = None
1096
+
1097
+ _collection_formats: Dict[str, str] = {
1098
+ }
1099
+
1100
+ _path_params: Dict[str, str] = {}
1101
+ _query_params: List[Tuple[str, str]] = []
1102
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1103
+ _form_params: List[Tuple[str, str]] = []
1104
+ _files: Dict[
1105
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1106
+ ] = {}
1107
+ _body_params: Optional[bytes] = None
1108
+
1109
+ # process the path parameters
1110
+ # process the query parameters
1111
+ if name is not None:
1112
+
1113
+ _query_params.append(('name', name))
1114
+
1115
+ if limit is not None:
1116
+
1117
+ _query_params.append(('limit', limit))
1118
+
1119
+ if offset is not None:
1120
+
1121
+ _query_params.append(('offset', offset))
1122
+
1123
+ # process the header parameters
1124
+ # process the form parameters
1125
+ # process the body parameter
1126
+
1127
+
1128
+ # set the HTTP header `Accept`
1129
+ if 'Accept' not in _header_params:
1130
+ _header_params['Accept'] = self.api_client.select_header_accept(
1131
+ [
1132
+ 'application/json'
1133
+ ]
1134
+ )
1135
+
1136
+
1137
+ # authentication setting
1138
+ _auth_settings: List[str] = [
1139
+ 'Bearer'
1140
+ ]
1141
+
1142
+ return self.api_client.param_serialize(
1143
+ method='GET',
1144
+ resource_path='/ap1/templates/',
1145
+ path_params=_path_params,
1146
+ query_params=_query_params,
1147
+ header_params=_header_params,
1148
+ body=_body_params,
1149
+ post_params=_form_params,
1150
+ files=_files,
1151
+ auth_settings=_auth_settings,
1152
+ collection_formats=_collection_formats,
1153
+ _host=_host,
1154
+ _request_auth=_request_auth
1155
+ )
1156
+
1157
+
1158
+
1159
+
1160
+ @validate_call
1161
+ def update_template_field(
1162
+ self,
1163
+ id: Annotated[StrictStr, Field(description="The field's ID.")],
1164
+ data: CreateTemplateFieldsRequestInner,
1165
+ _request_timeout: Union[
1166
+ None,
1167
+ Annotated[StrictFloat, Field(gt=0)],
1168
+ Tuple[
1169
+ Annotated[StrictFloat, Field(gt=0)],
1170
+ Annotated[StrictFloat, Field(gt=0)]
1171
+ ]
1172
+ ] = None,
1173
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1174
+ _content_type: Optional[StrictStr] = None,
1175
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1176
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1177
+ ) -> TemplateField:
1178
+ """Change a template's field
1179
+
1180
+ Changes a template's field; send all of its values, as when adding it. Its page can't change: delete the field and add it again.
1181
+
1182
+ :param id: The field's ID. (required)
1183
+ :type id: str
1184
+ :param data: (required)
1185
+ :type data: CreateTemplateFieldsRequestInner
1186
+ :param _request_timeout: timeout setting for this request. If one
1187
+ number provided, it will be total request
1188
+ timeout. It can also be a pair (tuple) of
1189
+ (connection, read) timeouts.
1190
+ :type _request_timeout: int, tuple(int, int), optional
1191
+ :param _request_auth: set to override the auth_settings for an a single
1192
+ request; this effectively ignores the
1193
+ authentication in the spec for a single request.
1194
+ :type _request_auth: dict, optional
1195
+ :param _content_type: force content-type for the request.
1196
+ :type _content_type: str, Optional
1197
+ :param _headers: set to override the headers for a single
1198
+ request; this effectively ignores the headers
1199
+ in the spec for a single request.
1200
+ :type _headers: dict, optional
1201
+ :param _host_index: set to override the host_index for a single
1202
+ request; this effectively ignores the host_index
1203
+ in the spec for a single request.
1204
+ :type _host_index: int, optional
1205
+ :return: Returns the result object.
1206
+ """ # noqa: E501
1207
+
1208
+ _param = self._update_template_field_serialize(
1209
+ id=id,
1210
+ data=data,
1211
+ _request_auth=_request_auth,
1212
+ _content_type=_content_type,
1213
+ _headers=_headers,
1214
+ _host_index=_host_index
1215
+ )
1216
+
1217
+ _response_types_map: Dict[str, Optional[str]] = {
1218
+ '200': "TemplateField",
1219
+ '400': "Dict[str, object]",
1220
+ '404': "Dict[str, object]",
1221
+ }
1222
+ response_data = self.api_client.call_api(
1223
+ *_param,
1224
+ _request_timeout=_request_timeout
1225
+ )
1226
+ response_data.read()
1227
+ return self.api_client.response_deserialize(
1228
+ response_data=response_data,
1229
+ response_types_map=_response_types_map,
1230
+ ).data
1231
+
1232
+
1233
+ @validate_call
1234
+ def update_template_field_with_http_info(
1235
+ self,
1236
+ id: Annotated[StrictStr, Field(description="The field's ID.")],
1237
+ data: CreateTemplateFieldsRequestInner,
1238
+ _request_timeout: Union[
1239
+ None,
1240
+ Annotated[StrictFloat, Field(gt=0)],
1241
+ Tuple[
1242
+ Annotated[StrictFloat, Field(gt=0)],
1243
+ Annotated[StrictFloat, Field(gt=0)]
1244
+ ]
1245
+ ] = None,
1246
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1247
+ _content_type: Optional[StrictStr] = None,
1248
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1249
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1250
+ ) -> ApiResponse[TemplateField]:
1251
+ """Change a template's field
1252
+
1253
+ Changes a template's field; send all of its values, as when adding it. Its page can't change: delete the field and add it again.
1254
+
1255
+ :param id: The field's ID. (required)
1256
+ :type id: str
1257
+ :param data: (required)
1258
+ :type data: CreateTemplateFieldsRequestInner
1259
+ :param _request_timeout: timeout setting for this request. If one
1260
+ number provided, it will be total request
1261
+ timeout. It can also be a pair (tuple) of
1262
+ (connection, read) timeouts.
1263
+ :type _request_timeout: int, tuple(int, int), optional
1264
+ :param _request_auth: set to override the auth_settings for an a single
1265
+ request; this effectively ignores the
1266
+ authentication in the spec for a single request.
1267
+ :type _request_auth: dict, optional
1268
+ :param _content_type: force content-type for the request.
1269
+ :type _content_type: str, Optional
1270
+ :param _headers: set to override the headers for a single
1271
+ request; this effectively ignores the headers
1272
+ in the spec for a single request.
1273
+ :type _headers: dict, optional
1274
+ :param _host_index: set to override the host_index for a single
1275
+ request; this effectively ignores the host_index
1276
+ in the spec for a single request.
1277
+ :type _host_index: int, optional
1278
+ :return: Returns the result object.
1279
+ """ # noqa: E501
1280
+
1281
+ _param = self._update_template_field_serialize(
1282
+ id=id,
1283
+ data=data,
1284
+ _request_auth=_request_auth,
1285
+ _content_type=_content_type,
1286
+ _headers=_headers,
1287
+ _host_index=_host_index
1288
+ )
1289
+
1290
+ _response_types_map: Dict[str, Optional[str]] = {
1291
+ '200': "TemplateField",
1292
+ '400': "Dict[str, object]",
1293
+ '404': "Dict[str, object]",
1294
+ }
1295
+ response_data = self.api_client.call_api(
1296
+ *_param,
1297
+ _request_timeout=_request_timeout
1298
+ )
1299
+ response_data.read()
1300
+ return self.api_client.response_deserialize(
1301
+ response_data=response_data,
1302
+ response_types_map=_response_types_map,
1303
+ )
1304
+
1305
+
1306
+ @validate_call
1307
+ def update_template_field_without_preload_content(
1308
+ self,
1309
+ id: Annotated[StrictStr, Field(description="The field's ID.")],
1310
+ data: CreateTemplateFieldsRequestInner,
1311
+ _request_timeout: Union[
1312
+ None,
1313
+ Annotated[StrictFloat, Field(gt=0)],
1314
+ Tuple[
1315
+ Annotated[StrictFloat, Field(gt=0)],
1316
+ Annotated[StrictFloat, Field(gt=0)]
1317
+ ]
1318
+ ] = None,
1319
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1320
+ _content_type: Optional[StrictStr] = None,
1321
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1322
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1323
+ ) -> RESTResponseType:
1324
+ """Change a template's field
1325
+
1326
+ Changes a template's field; send all of its values, as when adding it. Its page can't change: delete the field and add it again.
1327
+
1328
+ :param id: The field's ID. (required)
1329
+ :type id: str
1330
+ :param data: (required)
1331
+ :type data: CreateTemplateFieldsRequestInner
1332
+ :param _request_timeout: timeout setting for this request. If one
1333
+ number provided, it will be total request
1334
+ timeout. It can also be a pair (tuple) of
1335
+ (connection, read) timeouts.
1336
+ :type _request_timeout: int, tuple(int, int), optional
1337
+ :param _request_auth: set to override the auth_settings for an a single
1338
+ request; this effectively ignores the
1339
+ authentication in the spec for a single request.
1340
+ :type _request_auth: dict, optional
1341
+ :param _content_type: force content-type for the request.
1342
+ :type _content_type: str, Optional
1343
+ :param _headers: set to override the headers for a single
1344
+ request; this effectively ignores the headers
1345
+ in the spec for a single request.
1346
+ :type _headers: dict, optional
1347
+ :param _host_index: set to override the host_index for a single
1348
+ request; this effectively ignores the host_index
1349
+ in the spec for a single request.
1350
+ :type _host_index: int, optional
1351
+ :return: Returns the result object.
1352
+ """ # noqa: E501
1353
+
1354
+ _param = self._update_template_field_serialize(
1355
+ id=id,
1356
+ data=data,
1357
+ _request_auth=_request_auth,
1358
+ _content_type=_content_type,
1359
+ _headers=_headers,
1360
+ _host_index=_host_index
1361
+ )
1362
+
1363
+ _response_types_map: Dict[str, Optional[str]] = {
1364
+ '200': "TemplateField",
1365
+ '400': "Dict[str, object]",
1366
+ '404': "Dict[str, object]",
1367
+ }
1368
+ response_data = self.api_client.call_api(
1369
+ *_param,
1370
+ _request_timeout=_request_timeout
1371
+ )
1372
+ return response_data.response
1373
+
1374
+
1375
+ def _update_template_field_serialize(
1376
+ self,
1377
+ id,
1378
+ data,
1379
+ _request_auth,
1380
+ _content_type,
1381
+ _headers,
1382
+ _host_index,
1383
+ ) -> RequestSerialized:
1384
+
1385
+ _host = None
1386
+
1387
+ _collection_formats: Dict[str, str] = {
1388
+ }
1389
+
1390
+ _path_params: Dict[str, str] = {}
1391
+ _query_params: List[Tuple[str, str]] = []
1392
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1393
+ _form_params: List[Tuple[str, str]] = []
1394
+ _files: Dict[
1395
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1396
+ ] = {}
1397
+ _body_params: Optional[bytes] = None
1398
+
1399
+ # process the path parameters
1400
+ if id is not None:
1401
+ _path_params['id'] = id
1402
+ # process the query parameters
1403
+ # process the header parameters
1404
+ # process the form parameters
1405
+ # process the body parameter
1406
+ if data is not None:
1407
+ _body_params = data
1408
+
1409
+
1410
+ # set the HTTP header `Accept`
1411
+ if 'Accept' not in _header_params:
1412
+ _header_params['Accept'] = self.api_client.select_header_accept(
1413
+ [
1414
+ 'application/json'
1415
+ ]
1416
+ )
1417
+
1418
+ # set the HTTP header `Content-Type`
1419
+ if _content_type:
1420
+ _header_params['Content-Type'] = _content_type
1421
+ else:
1422
+ _default_content_type = (
1423
+ self.api_client.select_header_content_type(
1424
+ [
1425
+ 'application/json'
1426
+ ]
1427
+ )
1428
+ )
1429
+ if _default_content_type is not None:
1430
+ _header_params['Content-Type'] = _default_content_type
1431
+
1432
+ # authentication setting
1433
+ _auth_settings: List[str] = [
1434
+ 'Bearer'
1435
+ ]
1436
+
1437
+ return self.api_client.param_serialize(
1438
+ method='PUT',
1439
+ resource_path='/ap1/templates/fields/{id}/',
1440
+ path_params=_path_params,
1441
+ query_params=_query_params,
1442
+ header_params=_header_params,
1443
+ body=_body_params,
1444
+ post_params=_form_params,
1445
+ files=_files,
1446
+ auth_settings=_auth_settings,
1447
+ collection_formats=_collection_formats,
1448
+ _host=_host,
1449
+ _request_auth=_request_auth
1450
+ )
1451
+
1452
+