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,2582 @@
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 Any, Dict, List, Optional
22
+ from typing_extensions import Annotated
23
+ from signedly.models.create_webhook_endpoint_request import CreateWebhookEndpointRequest
24
+ from signedly.models.update_webhook_endpoint_request import UpdateWebhookEndpointRequest
25
+ from signedly.models.webhook_delivery import WebhookDelivery
26
+ from signedly.models.webhook_delivery_page import WebhookDeliveryPage
27
+ from signedly.models.webhook_endpoint import WebhookEndpoint
28
+ from signedly.models.webhook_endpoint_with_secret import WebhookEndpointWithSecret
29
+
30
+ from signedly.api_client import ApiClient, RequestSerialized
31
+ from signedly.api_response import ApiResponse
32
+ from signedly.rest import RESTResponseType
33
+
34
+
35
+ class WebhooksApi:
36
+ """NOTE: This class is auto generated by OpenAPI Generator
37
+ Ref: https://openapi-generator.tech
38
+
39
+ Do not edit the class manually.
40
+ """
41
+
42
+ def __init__(self, api_client=None) -> None:
43
+ if api_client is None:
44
+ api_client = ApiClient.get_default()
45
+ self.api_client = api_client
46
+
47
+
48
+ @validate_call
49
+ def create_webhook_endpoint(
50
+ self,
51
+ data: CreateWebhookEndpointRequest,
52
+ _request_timeout: Union[
53
+ None,
54
+ Annotated[StrictFloat, Field(gt=0)],
55
+ Tuple[
56
+ Annotated[StrictFloat, Field(gt=0)],
57
+ Annotated[StrictFloat, Field(gt=0)]
58
+ ]
59
+ ] = None,
60
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
61
+ _content_type: Optional[StrictStr] = None,
62
+ _headers: Optional[Dict[StrictStr, Any]] = None,
63
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
64
+ ) -> WebhookEndpointWithSecret:
65
+ """Add a webhook endpoint
66
+
67
+ Signedly posts each document event your organisation's documents have to this URL (see Webhooks in the introduction). The answer includes the endpoint's `secret`, shown only now: keep it to check each event's `Signedly-Signature`. Up to 10 endpoints per API client.
68
+
69
+ :param data: (required)
70
+ :type data: CreateWebhookEndpointRequest
71
+ :param _request_timeout: timeout setting for this request. If one
72
+ number provided, it will be total request
73
+ timeout. It can also be a pair (tuple) of
74
+ (connection, read) timeouts.
75
+ :type _request_timeout: int, tuple(int, int), optional
76
+ :param _request_auth: set to override the auth_settings for an a single
77
+ request; this effectively ignores the
78
+ authentication in the spec for a single request.
79
+ :type _request_auth: dict, optional
80
+ :param _content_type: force content-type for the request.
81
+ :type _content_type: str, Optional
82
+ :param _headers: set to override the headers for a single
83
+ request; this effectively ignores the headers
84
+ in the spec for a single request.
85
+ :type _headers: dict, optional
86
+ :param _host_index: set to override the host_index for a single
87
+ request; this effectively ignores the host_index
88
+ in the spec for a single request.
89
+ :type _host_index: int, optional
90
+ :return: Returns the result object.
91
+ """ # noqa: E501
92
+
93
+ _param = self._create_webhook_endpoint_serialize(
94
+ data=data,
95
+ _request_auth=_request_auth,
96
+ _content_type=_content_type,
97
+ _headers=_headers,
98
+ _host_index=_host_index
99
+ )
100
+
101
+ _response_types_map: Dict[str, Optional[str]] = {
102
+ '201': "WebhookEndpointWithSecret",
103
+ '400': "Dict[str, object]",
104
+ }
105
+ response_data = self.api_client.call_api(
106
+ *_param,
107
+ _request_timeout=_request_timeout
108
+ )
109
+ response_data.read()
110
+ return self.api_client.response_deserialize(
111
+ response_data=response_data,
112
+ response_types_map=_response_types_map,
113
+ ).data
114
+
115
+
116
+ @validate_call
117
+ def create_webhook_endpoint_with_http_info(
118
+ self,
119
+ data: CreateWebhookEndpointRequest,
120
+ _request_timeout: Union[
121
+ None,
122
+ Annotated[StrictFloat, Field(gt=0)],
123
+ Tuple[
124
+ Annotated[StrictFloat, Field(gt=0)],
125
+ Annotated[StrictFloat, Field(gt=0)]
126
+ ]
127
+ ] = None,
128
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
129
+ _content_type: Optional[StrictStr] = None,
130
+ _headers: Optional[Dict[StrictStr, Any]] = None,
131
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
132
+ ) -> ApiResponse[WebhookEndpointWithSecret]:
133
+ """Add a webhook endpoint
134
+
135
+ Signedly posts each document event your organisation's documents have to this URL (see Webhooks in the introduction). The answer includes the endpoint's `secret`, shown only now: keep it to check each event's `Signedly-Signature`. Up to 10 endpoints per API client.
136
+
137
+ :param data: (required)
138
+ :type data: CreateWebhookEndpointRequest
139
+ :param _request_timeout: timeout setting for this request. If one
140
+ number provided, it will be total request
141
+ timeout. It can also be a pair (tuple) of
142
+ (connection, read) timeouts.
143
+ :type _request_timeout: int, tuple(int, int), optional
144
+ :param _request_auth: set to override the auth_settings for an a single
145
+ request; this effectively ignores the
146
+ authentication in the spec for a single request.
147
+ :type _request_auth: dict, optional
148
+ :param _content_type: force content-type for the request.
149
+ :type _content_type: str, Optional
150
+ :param _headers: set to override the headers for a single
151
+ request; this effectively ignores the headers
152
+ in the spec for a single request.
153
+ :type _headers: dict, optional
154
+ :param _host_index: set to override the host_index for a single
155
+ request; this effectively ignores the host_index
156
+ in the spec for a single request.
157
+ :type _host_index: int, optional
158
+ :return: Returns the result object.
159
+ """ # noqa: E501
160
+
161
+ _param = self._create_webhook_endpoint_serialize(
162
+ data=data,
163
+ _request_auth=_request_auth,
164
+ _content_type=_content_type,
165
+ _headers=_headers,
166
+ _host_index=_host_index
167
+ )
168
+
169
+ _response_types_map: Dict[str, Optional[str]] = {
170
+ '201': "WebhookEndpointWithSecret",
171
+ '400': "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_webhook_endpoint_without_preload_content(
186
+ self,
187
+ data: CreateWebhookEndpointRequest,
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 a webhook endpoint
202
+
203
+ Signedly posts each document event your organisation's documents have to this URL (see Webhooks in the introduction). The answer includes the endpoint's `secret`, shown only now: keep it to check each event's `Signedly-Signature`. Up to 10 endpoints per API client.
204
+
205
+ :param data: (required)
206
+ :type data: CreateWebhookEndpointRequest
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_webhook_endpoint_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': "WebhookEndpointWithSecret",
239
+ '400': "Dict[str, object]",
240
+ }
241
+ response_data = self.api_client.call_api(
242
+ *_param,
243
+ _request_timeout=_request_timeout
244
+ )
245
+ return response_data.response
246
+
247
+
248
+ def _create_webhook_endpoint_serialize(
249
+ self,
250
+ data,
251
+ _request_auth,
252
+ _content_type,
253
+ _headers,
254
+ _host_index,
255
+ ) -> RequestSerialized:
256
+
257
+ _host = None
258
+
259
+ _collection_formats: Dict[str, str] = {
260
+ }
261
+
262
+ _path_params: Dict[str, str] = {}
263
+ _query_params: List[Tuple[str, str]] = []
264
+ _header_params: Dict[str, Optional[str]] = _headers or {}
265
+ _form_params: List[Tuple[str, str]] = []
266
+ _files: Dict[
267
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
268
+ ] = {}
269
+ _body_params: Optional[bytes] = None
270
+
271
+ # process the path parameters
272
+ # process the query parameters
273
+ # process the header parameters
274
+ # process the form parameters
275
+ # process the body parameter
276
+ if data is not None:
277
+ _body_params = data
278
+
279
+
280
+ # set the HTTP header `Accept`
281
+ if 'Accept' not in _header_params:
282
+ _header_params['Accept'] = self.api_client.select_header_accept(
283
+ [
284
+ 'application/json'
285
+ ]
286
+ )
287
+
288
+ # set the HTTP header `Content-Type`
289
+ if _content_type:
290
+ _header_params['Content-Type'] = _content_type
291
+ else:
292
+ _default_content_type = (
293
+ self.api_client.select_header_content_type(
294
+ [
295
+ 'application/json'
296
+ ]
297
+ )
298
+ )
299
+ if _default_content_type is not None:
300
+ _header_params['Content-Type'] = _default_content_type
301
+
302
+ # authentication setting
303
+ _auth_settings: List[str] = [
304
+ 'Bearer'
305
+ ]
306
+
307
+ return self.api_client.param_serialize(
308
+ method='POST',
309
+ resource_path='/ap1/webhooks/',
310
+ path_params=_path_params,
311
+ query_params=_query_params,
312
+ header_params=_header_params,
313
+ body=_body_params,
314
+ post_params=_form_params,
315
+ files=_files,
316
+ auth_settings=_auth_settings,
317
+ collection_formats=_collection_formats,
318
+ _host=_host,
319
+ _request_auth=_request_auth
320
+ )
321
+
322
+
323
+
324
+
325
+ @validate_call
326
+ def delete_webhook_endpoint(
327
+ self,
328
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
329
+ _request_timeout: Union[
330
+ None,
331
+ Annotated[StrictFloat, Field(gt=0)],
332
+ Tuple[
333
+ Annotated[StrictFloat, Field(gt=0)],
334
+ Annotated[StrictFloat, Field(gt=0)]
335
+ ]
336
+ ] = None,
337
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
338
+ _content_type: Optional[StrictStr] = None,
339
+ _headers: Optional[Dict[StrictStr, Any]] = None,
340
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
341
+ ) -> None:
342
+ """Delete a webhook endpoint
343
+
344
+ Deletes the endpoint and its delivery history.
345
+
346
+ :param id: The endpoint's ID. (required)
347
+ :type id: str
348
+ :param _request_timeout: timeout setting for this request. If one
349
+ number provided, it will be total request
350
+ timeout. It can also be a pair (tuple) of
351
+ (connection, read) timeouts.
352
+ :type _request_timeout: int, tuple(int, int), optional
353
+ :param _request_auth: set to override the auth_settings for an a single
354
+ request; this effectively ignores the
355
+ authentication in the spec for a single request.
356
+ :type _request_auth: dict, optional
357
+ :param _content_type: force content-type for the request.
358
+ :type _content_type: str, Optional
359
+ :param _headers: set to override the headers for a single
360
+ request; this effectively ignores the headers
361
+ in the spec for a single request.
362
+ :type _headers: dict, optional
363
+ :param _host_index: set to override the host_index for a single
364
+ request; this effectively ignores the host_index
365
+ in the spec for a single request.
366
+ :type _host_index: int, optional
367
+ :return: Returns the result object.
368
+ """ # noqa: E501
369
+
370
+ _param = self._delete_webhook_endpoint_serialize(
371
+ id=id,
372
+ _request_auth=_request_auth,
373
+ _content_type=_content_type,
374
+ _headers=_headers,
375
+ _host_index=_host_index
376
+ )
377
+
378
+ _response_types_map: Dict[str, Optional[str]] = {
379
+ '204': None,
380
+ '404': "Dict[str, object]",
381
+ }
382
+ response_data = self.api_client.call_api(
383
+ *_param,
384
+ _request_timeout=_request_timeout
385
+ )
386
+ response_data.read()
387
+ return self.api_client.response_deserialize(
388
+ response_data=response_data,
389
+ response_types_map=_response_types_map,
390
+ ).data
391
+
392
+
393
+ @validate_call
394
+ def delete_webhook_endpoint_with_http_info(
395
+ self,
396
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
397
+ _request_timeout: Union[
398
+ None,
399
+ Annotated[StrictFloat, Field(gt=0)],
400
+ Tuple[
401
+ Annotated[StrictFloat, Field(gt=0)],
402
+ Annotated[StrictFloat, Field(gt=0)]
403
+ ]
404
+ ] = None,
405
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
406
+ _content_type: Optional[StrictStr] = None,
407
+ _headers: Optional[Dict[StrictStr, Any]] = None,
408
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
409
+ ) -> ApiResponse[None]:
410
+ """Delete a webhook endpoint
411
+
412
+ Deletes the endpoint and its delivery history.
413
+
414
+ :param id: The endpoint's ID. (required)
415
+ :type id: str
416
+ :param _request_timeout: timeout setting for this request. If one
417
+ number provided, it will be total request
418
+ timeout. It can also be a pair (tuple) of
419
+ (connection, read) timeouts.
420
+ :type _request_timeout: int, tuple(int, int), optional
421
+ :param _request_auth: set to override the auth_settings for an a single
422
+ request; this effectively ignores the
423
+ authentication in the spec for a single request.
424
+ :type _request_auth: dict, optional
425
+ :param _content_type: force content-type for the request.
426
+ :type _content_type: str, Optional
427
+ :param _headers: set to override the headers for a single
428
+ request; this effectively ignores the headers
429
+ in the spec for a single request.
430
+ :type _headers: dict, optional
431
+ :param _host_index: set to override the host_index for a single
432
+ request; this effectively ignores the host_index
433
+ in the spec for a single request.
434
+ :type _host_index: int, optional
435
+ :return: Returns the result object.
436
+ """ # noqa: E501
437
+
438
+ _param = self._delete_webhook_endpoint_serialize(
439
+ id=id,
440
+ _request_auth=_request_auth,
441
+ _content_type=_content_type,
442
+ _headers=_headers,
443
+ _host_index=_host_index
444
+ )
445
+
446
+ _response_types_map: Dict[str, Optional[str]] = {
447
+ '204': None,
448
+ '404': "Dict[str, object]",
449
+ }
450
+ response_data = self.api_client.call_api(
451
+ *_param,
452
+ _request_timeout=_request_timeout
453
+ )
454
+ response_data.read()
455
+ return self.api_client.response_deserialize(
456
+ response_data=response_data,
457
+ response_types_map=_response_types_map,
458
+ )
459
+
460
+
461
+ @validate_call
462
+ def delete_webhook_endpoint_without_preload_content(
463
+ self,
464
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
465
+ _request_timeout: Union[
466
+ None,
467
+ Annotated[StrictFloat, Field(gt=0)],
468
+ Tuple[
469
+ Annotated[StrictFloat, Field(gt=0)],
470
+ Annotated[StrictFloat, Field(gt=0)]
471
+ ]
472
+ ] = None,
473
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
474
+ _content_type: Optional[StrictStr] = None,
475
+ _headers: Optional[Dict[StrictStr, Any]] = None,
476
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
477
+ ) -> RESTResponseType:
478
+ """Delete a webhook endpoint
479
+
480
+ Deletes the endpoint and its delivery history.
481
+
482
+ :param id: The endpoint's ID. (required)
483
+ :type id: str
484
+ :param _request_timeout: timeout setting for this request. If one
485
+ number provided, it will be total request
486
+ timeout. It can also be a pair (tuple) of
487
+ (connection, read) timeouts.
488
+ :type _request_timeout: int, tuple(int, int), optional
489
+ :param _request_auth: set to override the auth_settings for an a single
490
+ request; this effectively ignores the
491
+ authentication in the spec for a single request.
492
+ :type _request_auth: dict, optional
493
+ :param _content_type: force content-type for the request.
494
+ :type _content_type: str, Optional
495
+ :param _headers: set to override the headers for a single
496
+ request; this effectively ignores the headers
497
+ in the spec for a single request.
498
+ :type _headers: dict, optional
499
+ :param _host_index: set to override the host_index for a single
500
+ request; this effectively ignores the host_index
501
+ in the spec for a single request.
502
+ :type _host_index: int, optional
503
+ :return: Returns the result object.
504
+ """ # noqa: E501
505
+
506
+ _param = self._delete_webhook_endpoint_serialize(
507
+ id=id,
508
+ _request_auth=_request_auth,
509
+ _content_type=_content_type,
510
+ _headers=_headers,
511
+ _host_index=_host_index
512
+ )
513
+
514
+ _response_types_map: Dict[str, Optional[str]] = {
515
+ '204': None,
516
+ '404': "Dict[str, object]",
517
+ }
518
+ response_data = self.api_client.call_api(
519
+ *_param,
520
+ _request_timeout=_request_timeout
521
+ )
522
+ return response_data.response
523
+
524
+
525
+ def _delete_webhook_endpoint_serialize(
526
+ self,
527
+ id,
528
+ _request_auth,
529
+ _content_type,
530
+ _headers,
531
+ _host_index,
532
+ ) -> RequestSerialized:
533
+
534
+ _host = None
535
+
536
+ _collection_formats: Dict[str, str] = {
537
+ }
538
+
539
+ _path_params: Dict[str, str] = {}
540
+ _query_params: List[Tuple[str, str]] = []
541
+ _header_params: Dict[str, Optional[str]] = _headers or {}
542
+ _form_params: List[Tuple[str, str]] = []
543
+ _files: Dict[
544
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
545
+ ] = {}
546
+ _body_params: Optional[bytes] = None
547
+
548
+ # process the path parameters
549
+ if id is not None:
550
+ _path_params['id'] = id
551
+ # process the query parameters
552
+ # process the header parameters
553
+ # process the form parameters
554
+ # process the body parameter
555
+
556
+
557
+ # set the HTTP header `Accept`
558
+ if 'Accept' not in _header_params:
559
+ _header_params['Accept'] = self.api_client.select_header_accept(
560
+ [
561
+ 'application/json'
562
+ ]
563
+ )
564
+
565
+
566
+ # authentication setting
567
+ _auth_settings: List[str] = [
568
+ 'Bearer'
569
+ ]
570
+
571
+ return self.api_client.param_serialize(
572
+ method='DELETE',
573
+ resource_path='/ap1/webhooks/{id}/',
574
+ path_params=_path_params,
575
+ query_params=_query_params,
576
+ header_params=_header_params,
577
+ body=_body_params,
578
+ post_params=_form_params,
579
+ files=_files,
580
+ auth_settings=_auth_settings,
581
+ collection_formats=_collection_formats,
582
+ _host=_host,
583
+ _request_auth=_request_auth
584
+ )
585
+
586
+
587
+
588
+
589
+ @validate_call
590
+ def get_webhook_endpoint(
591
+ self,
592
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
593
+ _request_timeout: Union[
594
+ None,
595
+ Annotated[StrictFloat, Field(gt=0)],
596
+ Tuple[
597
+ Annotated[StrictFloat, Field(gt=0)],
598
+ Annotated[StrictFloat, Field(gt=0)]
599
+ ]
600
+ ] = None,
601
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
602
+ _content_type: Optional[StrictStr] = None,
603
+ _headers: Optional[Dict[StrictStr, Any]] = None,
604
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
605
+ ) -> WebhookEndpoint:
606
+ """Get a webhook endpoint
607
+
608
+ One of this API client's endpoints, without its secret.
609
+
610
+ :param id: The endpoint's ID. (required)
611
+ :type id: str
612
+ :param _request_timeout: timeout setting for this request. If one
613
+ number provided, it will be total request
614
+ timeout. It can also be a pair (tuple) of
615
+ (connection, read) timeouts.
616
+ :type _request_timeout: int, tuple(int, int), optional
617
+ :param _request_auth: set to override the auth_settings for an a single
618
+ request; this effectively ignores the
619
+ authentication in the spec for a single request.
620
+ :type _request_auth: dict, optional
621
+ :param _content_type: force content-type for the request.
622
+ :type _content_type: str, Optional
623
+ :param _headers: set to override the headers for a single
624
+ request; this effectively ignores the headers
625
+ in the spec for a single request.
626
+ :type _headers: dict, optional
627
+ :param _host_index: set to override the host_index for a single
628
+ request; this effectively ignores the host_index
629
+ in the spec for a single request.
630
+ :type _host_index: int, optional
631
+ :return: Returns the result object.
632
+ """ # noqa: E501
633
+
634
+ _param = self._get_webhook_endpoint_serialize(
635
+ id=id,
636
+ _request_auth=_request_auth,
637
+ _content_type=_content_type,
638
+ _headers=_headers,
639
+ _host_index=_host_index
640
+ )
641
+
642
+ _response_types_map: Dict[str, Optional[str]] = {
643
+ '200': "WebhookEndpoint",
644
+ '404': "Dict[str, object]",
645
+ }
646
+ response_data = self.api_client.call_api(
647
+ *_param,
648
+ _request_timeout=_request_timeout
649
+ )
650
+ response_data.read()
651
+ return self.api_client.response_deserialize(
652
+ response_data=response_data,
653
+ response_types_map=_response_types_map,
654
+ ).data
655
+
656
+
657
+ @validate_call
658
+ def get_webhook_endpoint_with_http_info(
659
+ self,
660
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
661
+ _request_timeout: Union[
662
+ None,
663
+ Annotated[StrictFloat, Field(gt=0)],
664
+ Tuple[
665
+ Annotated[StrictFloat, Field(gt=0)],
666
+ Annotated[StrictFloat, Field(gt=0)]
667
+ ]
668
+ ] = None,
669
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
670
+ _content_type: Optional[StrictStr] = None,
671
+ _headers: Optional[Dict[StrictStr, Any]] = None,
672
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
673
+ ) -> ApiResponse[WebhookEndpoint]:
674
+ """Get a webhook endpoint
675
+
676
+ One of this API client's endpoints, without its secret.
677
+
678
+ :param id: The endpoint's ID. (required)
679
+ :type id: str
680
+ :param _request_timeout: timeout setting for this request. If one
681
+ number provided, it will be total request
682
+ timeout. It can also be a pair (tuple) of
683
+ (connection, read) timeouts.
684
+ :type _request_timeout: int, tuple(int, int), optional
685
+ :param _request_auth: set to override the auth_settings for an a single
686
+ request; this effectively ignores the
687
+ authentication in the spec for a single request.
688
+ :type _request_auth: dict, optional
689
+ :param _content_type: force content-type for the request.
690
+ :type _content_type: str, Optional
691
+ :param _headers: set to override the headers for a single
692
+ request; this effectively ignores the headers
693
+ in the spec for a single request.
694
+ :type _headers: dict, optional
695
+ :param _host_index: set to override the host_index for a single
696
+ request; this effectively ignores the host_index
697
+ in the spec for a single request.
698
+ :type _host_index: int, optional
699
+ :return: Returns the result object.
700
+ """ # noqa: E501
701
+
702
+ _param = self._get_webhook_endpoint_serialize(
703
+ id=id,
704
+ _request_auth=_request_auth,
705
+ _content_type=_content_type,
706
+ _headers=_headers,
707
+ _host_index=_host_index
708
+ )
709
+
710
+ _response_types_map: Dict[str, Optional[str]] = {
711
+ '200': "WebhookEndpoint",
712
+ '404': "Dict[str, object]",
713
+ }
714
+ response_data = self.api_client.call_api(
715
+ *_param,
716
+ _request_timeout=_request_timeout
717
+ )
718
+ response_data.read()
719
+ return self.api_client.response_deserialize(
720
+ response_data=response_data,
721
+ response_types_map=_response_types_map,
722
+ )
723
+
724
+
725
+ @validate_call
726
+ def get_webhook_endpoint_without_preload_content(
727
+ self,
728
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
729
+ _request_timeout: Union[
730
+ None,
731
+ Annotated[StrictFloat, Field(gt=0)],
732
+ Tuple[
733
+ Annotated[StrictFloat, Field(gt=0)],
734
+ Annotated[StrictFloat, Field(gt=0)]
735
+ ]
736
+ ] = None,
737
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
738
+ _content_type: Optional[StrictStr] = None,
739
+ _headers: Optional[Dict[StrictStr, Any]] = None,
740
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
741
+ ) -> RESTResponseType:
742
+ """Get a webhook endpoint
743
+
744
+ One of this API client's endpoints, without its secret.
745
+
746
+ :param id: The endpoint's ID. (required)
747
+ :type id: str
748
+ :param _request_timeout: timeout setting for this request. If one
749
+ number provided, it will be total request
750
+ timeout. It can also be a pair (tuple) of
751
+ (connection, read) timeouts.
752
+ :type _request_timeout: int, tuple(int, int), optional
753
+ :param _request_auth: set to override the auth_settings for an a single
754
+ request; this effectively ignores the
755
+ authentication in the spec for a single request.
756
+ :type _request_auth: dict, optional
757
+ :param _content_type: force content-type for the request.
758
+ :type _content_type: str, Optional
759
+ :param _headers: set to override the headers for a single
760
+ request; this effectively ignores the headers
761
+ in the spec for a single request.
762
+ :type _headers: dict, optional
763
+ :param _host_index: set to override the host_index for a single
764
+ request; this effectively ignores the host_index
765
+ in the spec for a single request.
766
+ :type _host_index: int, optional
767
+ :return: Returns the result object.
768
+ """ # noqa: E501
769
+
770
+ _param = self._get_webhook_endpoint_serialize(
771
+ id=id,
772
+ _request_auth=_request_auth,
773
+ _content_type=_content_type,
774
+ _headers=_headers,
775
+ _host_index=_host_index
776
+ )
777
+
778
+ _response_types_map: Dict[str, Optional[str]] = {
779
+ '200': "WebhookEndpoint",
780
+ '404': "Dict[str, object]",
781
+ }
782
+ response_data = self.api_client.call_api(
783
+ *_param,
784
+ _request_timeout=_request_timeout
785
+ )
786
+ return response_data.response
787
+
788
+
789
+ def _get_webhook_endpoint_serialize(
790
+ self,
791
+ id,
792
+ _request_auth,
793
+ _content_type,
794
+ _headers,
795
+ _host_index,
796
+ ) -> RequestSerialized:
797
+
798
+ _host = None
799
+
800
+ _collection_formats: Dict[str, str] = {
801
+ }
802
+
803
+ _path_params: Dict[str, str] = {}
804
+ _query_params: List[Tuple[str, str]] = []
805
+ _header_params: Dict[str, Optional[str]] = _headers or {}
806
+ _form_params: List[Tuple[str, str]] = []
807
+ _files: Dict[
808
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
809
+ ] = {}
810
+ _body_params: Optional[bytes] = None
811
+
812
+ # process the path parameters
813
+ if id is not None:
814
+ _path_params['id'] = id
815
+ # process the query parameters
816
+ # process the header parameters
817
+ # process the form parameters
818
+ # process the body parameter
819
+
820
+
821
+ # set the HTTP header `Accept`
822
+ if 'Accept' not in _header_params:
823
+ _header_params['Accept'] = self.api_client.select_header_accept(
824
+ [
825
+ 'application/json'
826
+ ]
827
+ )
828
+
829
+
830
+ # authentication setting
831
+ _auth_settings: List[str] = [
832
+ 'Bearer'
833
+ ]
834
+
835
+ return self.api_client.param_serialize(
836
+ method='GET',
837
+ resource_path='/ap1/webhooks/{id}/',
838
+ path_params=_path_params,
839
+ query_params=_query_params,
840
+ header_params=_header_params,
841
+ body=_body_params,
842
+ post_params=_form_params,
843
+ files=_files,
844
+ auth_settings=_auth_settings,
845
+ collection_formats=_collection_formats,
846
+ _host=_host,
847
+ _request_auth=_request_auth
848
+ )
849
+
850
+
851
+
852
+
853
+ @validate_call
854
+ def list_webhook_deliveries(
855
+ self,
856
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
857
+ status: Annotated[Optional[StrictStr], Field(description="Only `pending`, `succeeded` or `failed` deliveries.")] = None,
858
+ limit: Annotated[Optional[StrictInt], Field(description="How many results to return (default 10).")] = None,
859
+ offset: Annotated[Optional[StrictInt], Field(description="How many results to skip.")] = None,
860
+ _request_timeout: Union[
861
+ None,
862
+ Annotated[StrictFloat, Field(gt=0)],
863
+ Tuple[
864
+ Annotated[StrictFloat, Field(gt=0)],
865
+ Annotated[StrictFloat, Field(gt=0)]
866
+ ]
867
+ ] = None,
868
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
869
+ _content_type: Optional[StrictStr] = None,
870
+ _headers: Optional[Dict[StrictStr, Any]] = None,
871
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
872
+ ) -> WebhookDeliveryPage:
873
+ """List an endpoint's deliveries
874
+
875
+ The events sent (or being sent) to the endpoint, newest first, with how the last try went. Paged: see `limit` and `offset`.
876
+
877
+ :param id: The endpoint's ID. (required)
878
+ :type id: str
879
+ :param status: Only `pending`, `succeeded` or `failed` deliveries.
880
+ :type status: str
881
+ :param limit: How many results to return (default 10).
882
+ :type limit: int
883
+ :param offset: How many results to skip.
884
+ :type offset: int
885
+ :param _request_timeout: timeout setting for this request. If one
886
+ number provided, it will be total request
887
+ timeout. It can also be a pair (tuple) of
888
+ (connection, read) timeouts.
889
+ :type _request_timeout: int, tuple(int, int), optional
890
+ :param _request_auth: set to override the auth_settings for an a single
891
+ request; this effectively ignores the
892
+ authentication in the spec for a single request.
893
+ :type _request_auth: dict, optional
894
+ :param _content_type: force content-type for the request.
895
+ :type _content_type: str, Optional
896
+ :param _headers: set to override the headers for a single
897
+ request; this effectively ignores the headers
898
+ in the spec for a single request.
899
+ :type _headers: dict, optional
900
+ :param _host_index: set to override the host_index for a single
901
+ request; this effectively ignores the host_index
902
+ in the spec for a single request.
903
+ :type _host_index: int, optional
904
+ :return: Returns the result object.
905
+ """ # noqa: E501
906
+
907
+ _param = self._list_webhook_deliveries_serialize(
908
+ id=id,
909
+ status=status,
910
+ limit=limit,
911
+ offset=offset,
912
+ _request_auth=_request_auth,
913
+ _content_type=_content_type,
914
+ _headers=_headers,
915
+ _host_index=_host_index
916
+ )
917
+
918
+ _response_types_map: Dict[str, Optional[str]] = {
919
+ '200': "WebhookDeliveryPage",
920
+ '404': "Dict[str, object]",
921
+ }
922
+ response_data = self.api_client.call_api(
923
+ *_param,
924
+ _request_timeout=_request_timeout
925
+ )
926
+ response_data.read()
927
+ return self.api_client.response_deserialize(
928
+ response_data=response_data,
929
+ response_types_map=_response_types_map,
930
+ ).data
931
+
932
+
933
+ @validate_call
934
+ def list_webhook_deliveries_with_http_info(
935
+ self,
936
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
937
+ status: Annotated[Optional[StrictStr], Field(description="Only `pending`, `succeeded` or `failed` deliveries.")] = None,
938
+ limit: Annotated[Optional[StrictInt], Field(description="How many results to return (default 10).")] = None,
939
+ offset: Annotated[Optional[StrictInt], Field(description="How many results to skip.")] = None,
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[WebhookDeliveryPage]:
953
+ """List an endpoint's deliveries
954
+
955
+ The events sent (or being sent) to the endpoint, newest first, with how the last try went. Paged: see `limit` and `offset`.
956
+
957
+ :param id: The endpoint's ID. (required)
958
+ :type id: str
959
+ :param status: Only `pending`, `succeeded` or `failed` deliveries.
960
+ :type status: str
961
+ :param limit: How many results to return (default 10).
962
+ :type limit: int
963
+ :param offset: How many results to skip.
964
+ :type offset: int
965
+ :param _request_timeout: timeout setting for this request. If one
966
+ number provided, it will be total request
967
+ timeout. It can also be a pair (tuple) of
968
+ (connection, read) timeouts.
969
+ :type _request_timeout: int, tuple(int, int), optional
970
+ :param _request_auth: set to override the auth_settings for an a single
971
+ request; this effectively ignores the
972
+ authentication in the spec for a single request.
973
+ :type _request_auth: dict, optional
974
+ :param _content_type: force content-type for the request.
975
+ :type _content_type: str, Optional
976
+ :param _headers: set to override the headers for a single
977
+ request; this effectively ignores the headers
978
+ in the spec for a single request.
979
+ :type _headers: dict, optional
980
+ :param _host_index: set to override the host_index for a single
981
+ request; this effectively ignores the host_index
982
+ in the spec for a single request.
983
+ :type _host_index: int, optional
984
+ :return: Returns the result object.
985
+ """ # noqa: E501
986
+
987
+ _param = self._list_webhook_deliveries_serialize(
988
+ id=id,
989
+ status=status,
990
+ limit=limit,
991
+ offset=offset,
992
+ _request_auth=_request_auth,
993
+ _content_type=_content_type,
994
+ _headers=_headers,
995
+ _host_index=_host_index
996
+ )
997
+
998
+ _response_types_map: Dict[str, Optional[str]] = {
999
+ '200': "WebhookDeliveryPage",
1000
+ '404': "Dict[str, object]",
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_webhook_deliveries_without_preload_content(
1015
+ self,
1016
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
1017
+ status: Annotated[Optional[StrictStr], Field(description="Only `pending`, `succeeded` or `failed` deliveries.")] = None,
1018
+ limit: Annotated[Optional[StrictInt], Field(description="How many results to return (default 10).")] = None,
1019
+ offset: Annotated[Optional[StrictInt], Field(description="How many results to skip.")] = None,
1020
+ _request_timeout: Union[
1021
+ None,
1022
+ Annotated[StrictFloat, Field(gt=0)],
1023
+ Tuple[
1024
+ Annotated[StrictFloat, Field(gt=0)],
1025
+ Annotated[StrictFloat, Field(gt=0)]
1026
+ ]
1027
+ ] = None,
1028
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1029
+ _content_type: Optional[StrictStr] = None,
1030
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1031
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1032
+ ) -> RESTResponseType:
1033
+ """List an endpoint's deliveries
1034
+
1035
+ The events sent (or being sent) to the endpoint, newest first, with how the last try went. Paged: see `limit` and `offset`.
1036
+
1037
+ :param id: The endpoint's ID. (required)
1038
+ :type id: str
1039
+ :param status: Only `pending`, `succeeded` or `failed` deliveries.
1040
+ :type status: str
1041
+ :param limit: How many results to return (default 10).
1042
+ :type limit: int
1043
+ :param offset: How many results to skip.
1044
+ :type offset: int
1045
+ :param _request_timeout: timeout setting for this request. If one
1046
+ number provided, it will be total request
1047
+ timeout. It can also be a pair (tuple) of
1048
+ (connection, read) timeouts.
1049
+ :type _request_timeout: int, tuple(int, int), optional
1050
+ :param _request_auth: set to override the auth_settings for an a single
1051
+ request; this effectively ignores the
1052
+ authentication in the spec for a single request.
1053
+ :type _request_auth: dict, optional
1054
+ :param _content_type: force content-type for the request.
1055
+ :type _content_type: str, Optional
1056
+ :param _headers: set to override the headers for a single
1057
+ request; this effectively ignores the headers
1058
+ in the spec for a single request.
1059
+ :type _headers: dict, optional
1060
+ :param _host_index: set to override the host_index for a single
1061
+ request; this effectively ignores the host_index
1062
+ in the spec for a single request.
1063
+ :type _host_index: int, optional
1064
+ :return: Returns the result object.
1065
+ """ # noqa: E501
1066
+
1067
+ _param = self._list_webhook_deliveries_serialize(
1068
+ id=id,
1069
+ status=status,
1070
+ limit=limit,
1071
+ offset=offset,
1072
+ _request_auth=_request_auth,
1073
+ _content_type=_content_type,
1074
+ _headers=_headers,
1075
+ _host_index=_host_index
1076
+ )
1077
+
1078
+ _response_types_map: Dict[str, Optional[str]] = {
1079
+ '200': "WebhookDeliveryPage",
1080
+ '404': "Dict[str, object]",
1081
+ }
1082
+ response_data = self.api_client.call_api(
1083
+ *_param,
1084
+ _request_timeout=_request_timeout
1085
+ )
1086
+ return response_data.response
1087
+
1088
+
1089
+ def _list_webhook_deliveries_serialize(
1090
+ self,
1091
+ id,
1092
+ status,
1093
+ limit,
1094
+ offset,
1095
+ _request_auth,
1096
+ _content_type,
1097
+ _headers,
1098
+ _host_index,
1099
+ ) -> RequestSerialized:
1100
+
1101
+ _host = None
1102
+
1103
+ _collection_formats: Dict[str, str] = {
1104
+ }
1105
+
1106
+ _path_params: Dict[str, str] = {}
1107
+ _query_params: List[Tuple[str, str]] = []
1108
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1109
+ _form_params: List[Tuple[str, str]] = []
1110
+ _files: Dict[
1111
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1112
+ ] = {}
1113
+ _body_params: Optional[bytes] = None
1114
+
1115
+ # process the path parameters
1116
+ if id is not None:
1117
+ _path_params['id'] = id
1118
+ # process the query parameters
1119
+ if status is not None:
1120
+
1121
+ _query_params.append(('status', status))
1122
+
1123
+ if limit is not None:
1124
+
1125
+ _query_params.append(('limit', limit))
1126
+
1127
+ if offset is not None:
1128
+
1129
+ _query_params.append(('offset', offset))
1130
+
1131
+ # process the header parameters
1132
+ # process the form parameters
1133
+ # process the body parameter
1134
+
1135
+
1136
+ # set the HTTP header `Accept`
1137
+ if 'Accept' not in _header_params:
1138
+ _header_params['Accept'] = self.api_client.select_header_accept(
1139
+ [
1140
+ 'application/json'
1141
+ ]
1142
+ )
1143
+
1144
+
1145
+ # authentication setting
1146
+ _auth_settings: List[str] = [
1147
+ 'Bearer'
1148
+ ]
1149
+
1150
+ return self.api_client.param_serialize(
1151
+ method='GET',
1152
+ resource_path='/ap1/webhooks/{id}/deliveries/',
1153
+ path_params=_path_params,
1154
+ query_params=_query_params,
1155
+ header_params=_header_params,
1156
+ body=_body_params,
1157
+ post_params=_form_params,
1158
+ files=_files,
1159
+ auth_settings=_auth_settings,
1160
+ collection_formats=_collection_formats,
1161
+ _host=_host,
1162
+ _request_auth=_request_auth
1163
+ )
1164
+
1165
+
1166
+
1167
+
1168
+ @validate_call
1169
+ def list_webhook_endpoints(
1170
+ self,
1171
+ _request_timeout: Union[
1172
+ None,
1173
+ Annotated[StrictFloat, Field(gt=0)],
1174
+ Tuple[
1175
+ Annotated[StrictFloat, Field(gt=0)],
1176
+ Annotated[StrictFloat, Field(gt=0)]
1177
+ ]
1178
+ ] = None,
1179
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1180
+ _content_type: Optional[StrictStr] = None,
1181
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1182
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1183
+ ) -> List[WebhookEndpoint]:
1184
+ """List your webhook endpoints
1185
+
1186
+ This API client's webhook endpoints, oldest first. Their secrets aren't shown: rotate one to see a new secret.
1187
+
1188
+ :param _request_timeout: timeout setting for this request. If one
1189
+ number provided, it will be total request
1190
+ timeout. It can also be a pair (tuple) of
1191
+ (connection, read) timeouts.
1192
+ :type _request_timeout: int, tuple(int, int), optional
1193
+ :param _request_auth: set to override the auth_settings for an a single
1194
+ request; this effectively ignores the
1195
+ authentication in the spec for a single request.
1196
+ :type _request_auth: dict, optional
1197
+ :param _content_type: force content-type for the request.
1198
+ :type _content_type: str, Optional
1199
+ :param _headers: set to override the headers for a single
1200
+ request; this effectively ignores the headers
1201
+ in the spec for a single request.
1202
+ :type _headers: dict, optional
1203
+ :param _host_index: set to override the host_index for a single
1204
+ request; this effectively ignores the host_index
1205
+ in the spec for a single request.
1206
+ :type _host_index: int, optional
1207
+ :return: Returns the result object.
1208
+ """ # noqa: E501
1209
+
1210
+ _param = self._list_webhook_endpoints_serialize(
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': "List[WebhookEndpoint]",
1219
+ }
1220
+ response_data = self.api_client.call_api(
1221
+ *_param,
1222
+ _request_timeout=_request_timeout
1223
+ )
1224
+ response_data.read()
1225
+ return self.api_client.response_deserialize(
1226
+ response_data=response_data,
1227
+ response_types_map=_response_types_map,
1228
+ ).data
1229
+
1230
+
1231
+ @validate_call
1232
+ def list_webhook_endpoints_with_http_info(
1233
+ self,
1234
+ _request_timeout: Union[
1235
+ None,
1236
+ Annotated[StrictFloat, Field(gt=0)],
1237
+ Tuple[
1238
+ Annotated[StrictFloat, Field(gt=0)],
1239
+ Annotated[StrictFloat, Field(gt=0)]
1240
+ ]
1241
+ ] = None,
1242
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1243
+ _content_type: Optional[StrictStr] = None,
1244
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1245
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1246
+ ) -> ApiResponse[List[WebhookEndpoint]]:
1247
+ """List your webhook endpoints
1248
+
1249
+ This API client's webhook endpoints, oldest first. Their secrets aren't shown: rotate one to see a new secret.
1250
+
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_webhook_endpoints_serialize(
1274
+ _request_auth=_request_auth,
1275
+ _content_type=_content_type,
1276
+ _headers=_headers,
1277
+ _host_index=_host_index
1278
+ )
1279
+
1280
+ _response_types_map: Dict[str, Optional[str]] = {
1281
+ '200': "List[WebhookEndpoint]",
1282
+ }
1283
+ response_data = self.api_client.call_api(
1284
+ *_param,
1285
+ _request_timeout=_request_timeout
1286
+ )
1287
+ response_data.read()
1288
+ return self.api_client.response_deserialize(
1289
+ response_data=response_data,
1290
+ response_types_map=_response_types_map,
1291
+ )
1292
+
1293
+
1294
+ @validate_call
1295
+ def list_webhook_endpoints_without_preload_content(
1296
+ self,
1297
+ _request_timeout: Union[
1298
+ None,
1299
+ Annotated[StrictFloat, Field(gt=0)],
1300
+ Tuple[
1301
+ Annotated[StrictFloat, Field(gt=0)],
1302
+ Annotated[StrictFloat, Field(gt=0)]
1303
+ ]
1304
+ ] = None,
1305
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1306
+ _content_type: Optional[StrictStr] = None,
1307
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1308
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1309
+ ) -> RESTResponseType:
1310
+ """List your webhook endpoints
1311
+
1312
+ This API client's webhook endpoints, oldest first. Their secrets aren't shown: rotate one to see a new secret.
1313
+
1314
+ :param _request_timeout: timeout setting for this request. If one
1315
+ number provided, it will be total request
1316
+ timeout. It can also be a pair (tuple) of
1317
+ (connection, read) timeouts.
1318
+ :type _request_timeout: int, tuple(int, int), optional
1319
+ :param _request_auth: set to override the auth_settings for an a single
1320
+ request; this effectively ignores the
1321
+ authentication in the spec for a single request.
1322
+ :type _request_auth: dict, optional
1323
+ :param _content_type: force content-type for the request.
1324
+ :type _content_type: str, Optional
1325
+ :param _headers: set to override the headers for a single
1326
+ request; this effectively ignores the headers
1327
+ in the spec for a single request.
1328
+ :type _headers: dict, optional
1329
+ :param _host_index: set to override the host_index for a single
1330
+ request; this effectively ignores the host_index
1331
+ in the spec for a single request.
1332
+ :type _host_index: int, optional
1333
+ :return: Returns the result object.
1334
+ """ # noqa: E501
1335
+
1336
+ _param = self._list_webhook_endpoints_serialize(
1337
+ _request_auth=_request_auth,
1338
+ _content_type=_content_type,
1339
+ _headers=_headers,
1340
+ _host_index=_host_index
1341
+ )
1342
+
1343
+ _response_types_map: Dict[str, Optional[str]] = {
1344
+ '200': "List[WebhookEndpoint]",
1345
+ }
1346
+ response_data = self.api_client.call_api(
1347
+ *_param,
1348
+ _request_timeout=_request_timeout
1349
+ )
1350
+ return response_data.response
1351
+
1352
+
1353
+ def _list_webhook_endpoints_serialize(
1354
+ self,
1355
+ _request_auth,
1356
+ _content_type,
1357
+ _headers,
1358
+ _host_index,
1359
+ ) -> RequestSerialized:
1360
+
1361
+ _host = None
1362
+
1363
+ _collection_formats: Dict[str, str] = {
1364
+ }
1365
+
1366
+ _path_params: Dict[str, str] = {}
1367
+ _query_params: List[Tuple[str, str]] = []
1368
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1369
+ _form_params: List[Tuple[str, str]] = []
1370
+ _files: Dict[
1371
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1372
+ ] = {}
1373
+ _body_params: Optional[bytes] = None
1374
+
1375
+ # process the path parameters
1376
+ # process the query parameters
1377
+ # process the header parameters
1378
+ # process the form parameters
1379
+ # process the body parameter
1380
+
1381
+
1382
+ # set the HTTP header `Accept`
1383
+ if 'Accept' not in _header_params:
1384
+ _header_params['Accept'] = self.api_client.select_header_accept(
1385
+ [
1386
+ 'application/json'
1387
+ ]
1388
+ )
1389
+
1390
+
1391
+ # authentication setting
1392
+ _auth_settings: List[str] = [
1393
+ 'Bearer'
1394
+ ]
1395
+
1396
+ return self.api_client.param_serialize(
1397
+ method='GET',
1398
+ resource_path='/ap1/webhooks/',
1399
+ path_params=_path_params,
1400
+ query_params=_query_params,
1401
+ header_params=_header_params,
1402
+ body=_body_params,
1403
+ post_params=_form_params,
1404
+ files=_files,
1405
+ auth_settings=_auth_settings,
1406
+ collection_formats=_collection_formats,
1407
+ _host=_host,
1408
+ _request_auth=_request_auth
1409
+ )
1410
+
1411
+
1412
+
1413
+
1414
+ @validate_call
1415
+ def redeliver_webhook(
1416
+ self,
1417
+ id: Annotated[StrictStr, Field(description="The delivery's ID.")],
1418
+ data: Dict[str, Any],
1419
+ _request_timeout: Union[
1420
+ None,
1421
+ Annotated[StrictFloat, Field(gt=0)],
1422
+ Tuple[
1423
+ Annotated[StrictFloat, Field(gt=0)],
1424
+ Annotated[StrictFloat, Field(gt=0)]
1425
+ ]
1426
+ ] = None,
1427
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1428
+ _content_type: Optional[StrictStr] = None,
1429
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1430
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1431
+ ) -> WebhookDelivery:
1432
+ """Send a delivery again
1433
+
1434
+ Sends the same event (same `id`) again now, with fresh retries: for one that failed, or one your system lost.
1435
+
1436
+ :param id: The delivery's ID. (required)
1437
+ :type id: str
1438
+ :param data: (required)
1439
+ :type data: object
1440
+ :param _request_timeout: timeout setting for this request. If one
1441
+ number provided, it will be total request
1442
+ timeout. It can also be a pair (tuple) of
1443
+ (connection, read) timeouts.
1444
+ :type _request_timeout: int, tuple(int, int), optional
1445
+ :param _request_auth: set to override the auth_settings for an a single
1446
+ request; this effectively ignores the
1447
+ authentication in the spec for a single request.
1448
+ :type _request_auth: dict, optional
1449
+ :param _content_type: force content-type for the request.
1450
+ :type _content_type: str, Optional
1451
+ :param _headers: set to override the headers for a single
1452
+ request; this effectively ignores the headers
1453
+ in the spec for a single request.
1454
+ :type _headers: dict, optional
1455
+ :param _host_index: set to override the host_index for a single
1456
+ request; this effectively ignores the host_index
1457
+ in the spec for a single request.
1458
+ :type _host_index: int, optional
1459
+ :return: Returns the result object.
1460
+ """ # noqa: E501
1461
+
1462
+ _param = self._redeliver_webhook_serialize(
1463
+ id=id,
1464
+ data=data,
1465
+ _request_auth=_request_auth,
1466
+ _content_type=_content_type,
1467
+ _headers=_headers,
1468
+ _host_index=_host_index
1469
+ )
1470
+
1471
+ _response_types_map: Dict[str, Optional[str]] = {
1472
+ '202': "WebhookDelivery",
1473
+ '404': "Dict[str, object]",
1474
+ }
1475
+ response_data = self.api_client.call_api(
1476
+ *_param,
1477
+ _request_timeout=_request_timeout
1478
+ )
1479
+ response_data.read()
1480
+ return self.api_client.response_deserialize(
1481
+ response_data=response_data,
1482
+ response_types_map=_response_types_map,
1483
+ ).data
1484
+
1485
+
1486
+ @validate_call
1487
+ def redeliver_webhook_with_http_info(
1488
+ self,
1489
+ id: Annotated[StrictStr, Field(description="The delivery's ID.")],
1490
+ data: Dict[str, Any],
1491
+ _request_timeout: Union[
1492
+ None,
1493
+ Annotated[StrictFloat, Field(gt=0)],
1494
+ Tuple[
1495
+ Annotated[StrictFloat, Field(gt=0)],
1496
+ Annotated[StrictFloat, Field(gt=0)]
1497
+ ]
1498
+ ] = None,
1499
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1500
+ _content_type: Optional[StrictStr] = None,
1501
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1502
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1503
+ ) -> ApiResponse[WebhookDelivery]:
1504
+ """Send a delivery again
1505
+
1506
+ Sends the same event (same `id`) again now, with fresh retries: for one that failed, or one your system lost.
1507
+
1508
+ :param id: The delivery's ID. (required)
1509
+ :type id: str
1510
+ :param data: (required)
1511
+ :type data: object
1512
+ :param _request_timeout: timeout setting for this request. If one
1513
+ number provided, it will be total request
1514
+ timeout. It can also be a pair (tuple) of
1515
+ (connection, read) timeouts.
1516
+ :type _request_timeout: int, tuple(int, int), optional
1517
+ :param _request_auth: set to override the auth_settings for an a single
1518
+ request; this effectively ignores the
1519
+ authentication in the spec for a single request.
1520
+ :type _request_auth: dict, optional
1521
+ :param _content_type: force content-type for the request.
1522
+ :type _content_type: str, Optional
1523
+ :param _headers: set to override the headers for a single
1524
+ request; this effectively ignores the headers
1525
+ in the spec for a single request.
1526
+ :type _headers: dict, optional
1527
+ :param _host_index: set to override the host_index for a single
1528
+ request; this effectively ignores the host_index
1529
+ in the spec for a single request.
1530
+ :type _host_index: int, optional
1531
+ :return: Returns the result object.
1532
+ """ # noqa: E501
1533
+
1534
+ _param = self._redeliver_webhook_serialize(
1535
+ id=id,
1536
+ data=data,
1537
+ _request_auth=_request_auth,
1538
+ _content_type=_content_type,
1539
+ _headers=_headers,
1540
+ _host_index=_host_index
1541
+ )
1542
+
1543
+ _response_types_map: Dict[str, Optional[str]] = {
1544
+ '202': "WebhookDelivery",
1545
+ '404': "Dict[str, object]",
1546
+ }
1547
+ response_data = self.api_client.call_api(
1548
+ *_param,
1549
+ _request_timeout=_request_timeout
1550
+ )
1551
+ response_data.read()
1552
+ return self.api_client.response_deserialize(
1553
+ response_data=response_data,
1554
+ response_types_map=_response_types_map,
1555
+ )
1556
+
1557
+
1558
+ @validate_call
1559
+ def redeliver_webhook_without_preload_content(
1560
+ self,
1561
+ id: Annotated[StrictStr, Field(description="The delivery's ID.")],
1562
+ data: Dict[str, Any],
1563
+ _request_timeout: Union[
1564
+ None,
1565
+ Annotated[StrictFloat, Field(gt=0)],
1566
+ Tuple[
1567
+ Annotated[StrictFloat, Field(gt=0)],
1568
+ Annotated[StrictFloat, Field(gt=0)]
1569
+ ]
1570
+ ] = None,
1571
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1572
+ _content_type: Optional[StrictStr] = None,
1573
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1574
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1575
+ ) -> RESTResponseType:
1576
+ """Send a delivery again
1577
+
1578
+ Sends the same event (same `id`) again now, with fresh retries: for one that failed, or one your system lost.
1579
+
1580
+ :param id: The delivery's ID. (required)
1581
+ :type id: str
1582
+ :param data: (required)
1583
+ :type data: object
1584
+ :param _request_timeout: timeout setting for this request. If one
1585
+ number provided, it will be total request
1586
+ timeout. It can also be a pair (tuple) of
1587
+ (connection, read) timeouts.
1588
+ :type _request_timeout: int, tuple(int, int), optional
1589
+ :param _request_auth: set to override the auth_settings for an a single
1590
+ request; this effectively ignores the
1591
+ authentication in the spec for a single request.
1592
+ :type _request_auth: dict, optional
1593
+ :param _content_type: force content-type for the request.
1594
+ :type _content_type: str, Optional
1595
+ :param _headers: set to override the headers for a single
1596
+ request; this effectively ignores the headers
1597
+ in the spec for a single request.
1598
+ :type _headers: dict, optional
1599
+ :param _host_index: set to override the host_index for a single
1600
+ request; this effectively ignores the host_index
1601
+ in the spec for a single request.
1602
+ :type _host_index: int, optional
1603
+ :return: Returns the result object.
1604
+ """ # noqa: E501
1605
+
1606
+ _param = self._redeliver_webhook_serialize(
1607
+ id=id,
1608
+ data=data,
1609
+ _request_auth=_request_auth,
1610
+ _content_type=_content_type,
1611
+ _headers=_headers,
1612
+ _host_index=_host_index
1613
+ )
1614
+
1615
+ _response_types_map: Dict[str, Optional[str]] = {
1616
+ '202': "WebhookDelivery",
1617
+ '404': "Dict[str, object]",
1618
+ }
1619
+ response_data = self.api_client.call_api(
1620
+ *_param,
1621
+ _request_timeout=_request_timeout
1622
+ )
1623
+ return response_data.response
1624
+
1625
+
1626
+ def _redeliver_webhook_serialize(
1627
+ self,
1628
+ id,
1629
+ data,
1630
+ _request_auth,
1631
+ _content_type,
1632
+ _headers,
1633
+ _host_index,
1634
+ ) -> RequestSerialized:
1635
+
1636
+ _host = None
1637
+
1638
+ _collection_formats: Dict[str, str] = {
1639
+ }
1640
+
1641
+ _path_params: Dict[str, str] = {}
1642
+ _query_params: List[Tuple[str, str]] = []
1643
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1644
+ _form_params: List[Tuple[str, str]] = []
1645
+ _files: Dict[
1646
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1647
+ ] = {}
1648
+ _body_params: Optional[bytes] = None
1649
+
1650
+ # process the path parameters
1651
+ if id is not None:
1652
+ _path_params['id'] = id
1653
+ # process the query parameters
1654
+ # process the header parameters
1655
+ # process the form parameters
1656
+ # process the body parameter
1657
+ if data is not None:
1658
+ _body_params = data
1659
+
1660
+
1661
+ # set the HTTP header `Accept`
1662
+ if 'Accept' not in _header_params:
1663
+ _header_params['Accept'] = self.api_client.select_header_accept(
1664
+ [
1665
+ 'application/json'
1666
+ ]
1667
+ )
1668
+
1669
+ # set the HTTP header `Content-Type`
1670
+ if _content_type:
1671
+ _header_params['Content-Type'] = _content_type
1672
+ else:
1673
+ _default_content_type = (
1674
+ self.api_client.select_header_content_type(
1675
+ [
1676
+ 'application/json'
1677
+ ]
1678
+ )
1679
+ )
1680
+ if _default_content_type is not None:
1681
+ _header_params['Content-Type'] = _default_content_type
1682
+
1683
+ # authentication setting
1684
+ _auth_settings: List[str] = [
1685
+ 'Bearer'
1686
+ ]
1687
+
1688
+ return self.api_client.param_serialize(
1689
+ method='POST',
1690
+ resource_path='/ap1/webhooks/deliveries/{id}/redeliver/',
1691
+ path_params=_path_params,
1692
+ query_params=_query_params,
1693
+ header_params=_header_params,
1694
+ body=_body_params,
1695
+ post_params=_form_params,
1696
+ files=_files,
1697
+ auth_settings=_auth_settings,
1698
+ collection_formats=_collection_formats,
1699
+ _host=_host,
1700
+ _request_auth=_request_auth
1701
+ )
1702
+
1703
+
1704
+
1705
+
1706
+ @validate_call
1707
+ def rotate_webhook_secret(
1708
+ self,
1709
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
1710
+ data: Dict[str, Any],
1711
+ _request_timeout: Union[
1712
+ None,
1713
+ Annotated[StrictFloat, Field(gt=0)],
1714
+ Tuple[
1715
+ Annotated[StrictFloat, Field(gt=0)],
1716
+ Annotated[StrictFloat, Field(gt=0)]
1717
+ ]
1718
+ ] = None,
1719
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1720
+ _content_type: Optional[StrictStr] = None,
1721
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1722
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1723
+ ) -> WebhookEndpointWithSecret:
1724
+ """Replace a webhook endpoint's secret
1725
+
1726
+ Makes a new secret and answers with it; events from now on are signed with it, and the old one stops working at once.
1727
+
1728
+ :param id: The endpoint's ID. (required)
1729
+ :type id: str
1730
+ :param data: (required)
1731
+ :type data: object
1732
+ :param _request_timeout: timeout setting for this request. If one
1733
+ number provided, it will be total request
1734
+ timeout. It can also be a pair (tuple) of
1735
+ (connection, read) timeouts.
1736
+ :type _request_timeout: int, tuple(int, int), optional
1737
+ :param _request_auth: set to override the auth_settings for an a single
1738
+ request; this effectively ignores the
1739
+ authentication in the spec for a single request.
1740
+ :type _request_auth: dict, optional
1741
+ :param _content_type: force content-type for the request.
1742
+ :type _content_type: str, Optional
1743
+ :param _headers: set to override the headers for a single
1744
+ request; this effectively ignores the headers
1745
+ in the spec for a single request.
1746
+ :type _headers: dict, optional
1747
+ :param _host_index: set to override the host_index for a single
1748
+ request; this effectively ignores the host_index
1749
+ in the spec for a single request.
1750
+ :type _host_index: int, optional
1751
+ :return: Returns the result object.
1752
+ """ # noqa: E501
1753
+
1754
+ _param = self._rotate_webhook_secret_serialize(
1755
+ id=id,
1756
+ data=data,
1757
+ _request_auth=_request_auth,
1758
+ _content_type=_content_type,
1759
+ _headers=_headers,
1760
+ _host_index=_host_index
1761
+ )
1762
+
1763
+ _response_types_map: Dict[str, Optional[str]] = {
1764
+ '200': "WebhookEndpointWithSecret",
1765
+ '404': "Dict[str, object]",
1766
+ }
1767
+ response_data = self.api_client.call_api(
1768
+ *_param,
1769
+ _request_timeout=_request_timeout
1770
+ )
1771
+ response_data.read()
1772
+ return self.api_client.response_deserialize(
1773
+ response_data=response_data,
1774
+ response_types_map=_response_types_map,
1775
+ ).data
1776
+
1777
+
1778
+ @validate_call
1779
+ def rotate_webhook_secret_with_http_info(
1780
+ self,
1781
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
1782
+ data: Dict[str, Any],
1783
+ _request_timeout: Union[
1784
+ None,
1785
+ Annotated[StrictFloat, Field(gt=0)],
1786
+ Tuple[
1787
+ Annotated[StrictFloat, Field(gt=0)],
1788
+ Annotated[StrictFloat, Field(gt=0)]
1789
+ ]
1790
+ ] = None,
1791
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1792
+ _content_type: Optional[StrictStr] = None,
1793
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1794
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1795
+ ) -> ApiResponse[WebhookEndpointWithSecret]:
1796
+ """Replace a webhook endpoint's secret
1797
+
1798
+ Makes a new secret and answers with it; events from now on are signed with it, and the old one stops working at once.
1799
+
1800
+ :param id: The endpoint's ID. (required)
1801
+ :type id: str
1802
+ :param data: (required)
1803
+ :type data: object
1804
+ :param _request_timeout: timeout setting for this request. If one
1805
+ number provided, it will be total request
1806
+ timeout. It can also be a pair (tuple) of
1807
+ (connection, read) timeouts.
1808
+ :type _request_timeout: int, tuple(int, int), optional
1809
+ :param _request_auth: set to override the auth_settings for an a single
1810
+ request; this effectively ignores the
1811
+ authentication in the spec for a single request.
1812
+ :type _request_auth: dict, optional
1813
+ :param _content_type: force content-type for the request.
1814
+ :type _content_type: str, Optional
1815
+ :param _headers: set to override the headers for a single
1816
+ request; this effectively ignores the headers
1817
+ in the spec for a single request.
1818
+ :type _headers: dict, optional
1819
+ :param _host_index: set to override the host_index for a single
1820
+ request; this effectively ignores the host_index
1821
+ in the spec for a single request.
1822
+ :type _host_index: int, optional
1823
+ :return: Returns the result object.
1824
+ """ # noqa: E501
1825
+
1826
+ _param = self._rotate_webhook_secret_serialize(
1827
+ id=id,
1828
+ data=data,
1829
+ _request_auth=_request_auth,
1830
+ _content_type=_content_type,
1831
+ _headers=_headers,
1832
+ _host_index=_host_index
1833
+ )
1834
+
1835
+ _response_types_map: Dict[str, Optional[str]] = {
1836
+ '200': "WebhookEndpointWithSecret",
1837
+ '404': "Dict[str, object]",
1838
+ }
1839
+ response_data = self.api_client.call_api(
1840
+ *_param,
1841
+ _request_timeout=_request_timeout
1842
+ )
1843
+ response_data.read()
1844
+ return self.api_client.response_deserialize(
1845
+ response_data=response_data,
1846
+ response_types_map=_response_types_map,
1847
+ )
1848
+
1849
+
1850
+ @validate_call
1851
+ def rotate_webhook_secret_without_preload_content(
1852
+ self,
1853
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
1854
+ data: Dict[str, Any],
1855
+ _request_timeout: Union[
1856
+ None,
1857
+ Annotated[StrictFloat, Field(gt=0)],
1858
+ Tuple[
1859
+ Annotated[StrictFloat, Field(gt=0)],
1860
+ Annotated[StrictFloat, Field(gt=0)]
1861
+ ]
1862
+ ] = None,
1863
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1864
+ _content_type: Optional[StrictStr] = None,
1865
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1866
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1867
+ ) -> RESTResponseType:
1868
+ """Replace a webhook endpoint's secret
1869
+
1870
+ Makes a new secret and answers with it; events from now on are signed with it, and the old one stops working at once.
1871
+
1872
+ :param id: The endpoint's ID. (required)
1873
+ :type id: str
1874
+ :param data: (required)
1875
+ :type data: object
1876
+ :param _request_timeout: timeout setting for this request. If one
1877
+ number provided, it will be total request
1878
+ timeout. It can also be a pair (tuple) of
1879
+ (connection, read) timeouts.
1880
+ :type _request_timeout: int, tuple(int, int), optional
1881
+ :param _request_auth: set to override the auth_settings for an a single
1882
+ request; this effectively ignores the
1883
+ authentication in the spec for a single request.
1884
+ :type _request_auth: dict, optional
1885
+ :param _content_type: force content-type for the request.
1886
+ :type _content_type: str, Optional
1887
+ :param _headers: set to override the headers for a single
1888
+ request; this effectively ignores the headers
1889
+ in the spec for a single request.
1890
+ :type _headers: dict, optional
1891
+ :param _host_index: set to override the host_index for a single
1892
+ request; this effectively ignores the host_index
1893
+ in the spec for a single request.
1894
+ :type _host_index: int, optional
1895
+ :return: Returns the result object.
1896
+ """ # noqa: E501
1897
+
1898
+ _param = self._rotate_webhook_secret_serialize(
1899
+ id=id,
1900
+ data=data,
1901
+ _request_auth=_request_auth,
1902
+ _content_type=_content_type,
1903
+ _headers=_headers,
1904
+ _host_index=_host_index
1905
+ )
1906
+
1907
+ _response_types_map: Dict[str, Optional[str]] = {
1908
+ '200': "WebhookEndpointWithSecret",
1909
+ '404': "Dict[str, object]",
1910
+ }
1911
+ response_data = self.api_client.call_api(
1912
+ *_param,
1913
+ _request_timeout=_request_timeout
1914
+ )
1915
+ return response_data.response
1916
+
1917
+
1918
+ def _rotate_webhook_secret_serialize(
1919
+ self,
1920
+ id,
1921
+ data,
1922
+ _request_auth,
1923
+ _content_type,
1924
+ _headers,
1925
+ _host_index,
1926
+ ) -> RequestSerialized:
1927
+
1928
+ _host = None
1929
+
1930
+ _collection_formats: Dict[str, str] = {
1931
+ }
1932
+
1933
+ _path_params: Dict[str, str] = {}
1934
+ _query_params: List[Tuple[str, str]] = []
1935
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1936
+ _form_params: List[Tuple[str, str]] = []
1937
+ _files: Dict[
1938
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1939
+ ] = {}
1940
+ _body_params: Optional[bytes] = None
1941
+
1942
+ # process the path parameters
1943
+ if id is not None:
1944
+ _path_params['id'] = id
1945
+ # process the query parameters
1946
+ # process the header parameters
1947
+ # process the form parameters
1948
+ # process the body parameter
1949
+ if data is not None:
1950
+ _body_params = data
1951
+
1952
+
1953
+ # set the HTTP header `Accept`
1954
+ if 'Accept' not in _header_params:
1955
+ _header_params['Accept'] = self.api_client.select_header_accept(
1956
+ [
1957
+ 'application/json'
1958
+ ]
1959
+ )
1960
+
1961
+ # set the HTTP header `Content-Type`
1962
+ if _content_type:
1963
+ _header_params['Content-Type'] = _content_type
1964
+ else:
1965
+ _default_content_type = (
1966
+ self.api_client.select_header_content_type(
1967
+ [
1968
+ 'application/json'
1969
+ ]
1970
+ )
1971
+ )
1972
+ if _default_content_type is not None:
1973
+ _header_params['Content-Type'] = _default_content_type
1974
+
1975
+ # authentication setting
1976
+ _auth_settings: List[str] = [
1977
+ 'Bearer'
1978
+ ]
1979
+
1980
+ return self.api_client.param_serialize(
1981
+ method='POST',
1982
+ resource_path='/ap1/webhooks/{id}/rotate-secret/',
1983
+ path_params=_path_params,
1984
+ query_params=_query_params,
1985
+ header_params=_header_params,
1986
+ body=_body_params,
1987
+ post_params=_form_params,
1988
+ files=_files,
1989
+ auth_settings=_auth_settings,
1990
+ collection_formats=_collection_formats,
1991
+ _host=_host,
1992
+ _request_auth=_request_auth
1993
+ )
1994
+
1995
+
1996
+
1997
+
1998
+ @validate_call
1999
+ def send_test_webhook(
2000
+ self,
2001
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
2002
+ data: Dict[str, Any],
2003
+ _request_timeout: Union[
2004
+ None,
2005
+ Annotated[StrictFloat, Field(gt=0)],
2006
+ Tuple[
2007
+ Annotated[StrictFloat, Field(gt=0)],
2008
+ Annotated[StrictFloat, Field(gt=0)]
2009
+ ]
2010
+ ] = None,
2011
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2012
+ _content_type: Optional[StrictStr] = None,
2013
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2014
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2015
+ ) -> WebhookDelivery:
2016
+ """Send a test event
2017
+
2018
+ Posts a `webhook.test` event (no document) to the endpoint, signed like any other, to check that you receive and verify events. Its outcome shows in the endpoint's deliveries.
2019
+
2020
+ :param id: The endpoint's ID. (required)
2021
+ :type id: str
2022
+ :param data: (required)
2023
+ :type data: object
2024
+ :param _request_timeout: timeout setting for this request. If one
2025
+ number provided, it will be total request
2026
+ timeout. It can also be a pair (tuple) of
2027
+ (connection, read) timeouts.
2028
+ :type _request_timeout: int, tuple(int, int), optional
2029
+ :param _request_auth: set to override the auth_settings for an a single
2030
+ request; this effectively ignores the
2031
+ authentication in the spec for a single request.
2032
+ :type _request_auth: dict, optional
2033
+ :param _content_type: force content-type for the request.
2034
+ :type _content_type: str, Optional
2035
+ :param _headers: set to override the headers for a single
2036
+ request; this effectively ignores the headers
2037
+ in the spec for a single request.
2038
+ :type _headers: dict, optional
2039
+ :param _host_index: set to override the host_index for a single
2040
+ request; this effectively ignores the host_index
2041
+ in the spec for a single request.
2042
+ :type _host_index: int, optional
2043
+ :return: Returns the result object.
2044
+ """ # noqa: E501
2045
+
2046
+ _param = self._send_test_webhook_serialize(
2047
+ id=id,
2048
+ data=data,
2049
+ _request_auth=_request_auth,
2050
+ _content_type=_content_type,
2051
+ _headers=_headers,
2052
+ _host_index=_host_index
2053
+ )
2054
+
2055
+ _response_types_map: Dict[str, Optional[str]] = {
2056
+ '202': "WebhookDelivery",
2057
+ '404': "Dict[str, object]",
2058
+ }
2059
+ response_data = self.api_client.call_api(
2060
+ *_param,
2061
+ _request_timeout=_request_timeout
2062
+ )
2063
+ response_data.read()
2064
+ return self.api_client.response_deserialize(
2065
+ response_data=response_data,
2066
+ response_types_map=_response_types_map,
2067
+ ).data
2068
+
2069
+
2070
+ @validate_call
2071
+ def send_test_webhook_with_http_info(
2072
+ self,
2073
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
2074
+ data: Dict[str, Any],
2075
+ _request_timeout: Union[
2076
+ None,
2077
+ Annotated[StrictFloat, Field(gt=0)],
2078
+ Tuple[
2079
+ Annotated[StrictFloat, Field(gt=0)],
2080
+ Annotated[StrictFloat, Field(gt=0)]
2081
+ ]
2082
+ ] = None,
2083
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2084
+ _content_type: Optional[StrictStr] = None,
2085
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2086
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2087
+ ) -> ApiResponse[WebhookDelivery]:
2088
+ """Send a test event
2089
+
2090
+ Posts a `webhook.test` event (no document) to the endpoint, signed like any other, to check that you receive and verify events. Its outcome shows in the endpoint's deliveries.
2091
+
2092
+ :param id: The endpoint's ID. (required)
2093
+ :type id: str
2094
+ :param data: (required)
2095
+ :type data: object
2096
+ :param _request_timeout: timeout setting for this request. If one
2097
+ number provided, it will be total request
2098
+ timeout. It can also be a pair (tuple) of
2099
+ (connection, read) timeouts.
2100
+ :type _request_timeout: int, tuple(int, int), optional
2101
+ :param _request_auth: set to override the auth_settings for an a single
2102
+ request; this effectively ignores the
2103
+ authentication in the spec for a single request.
2104
+ :type _request_auth: dict, optional
2105
+ :param _content_type: force content-type for the request.
2106
+ :type _content_type: str, Optional
2107
+ :param _headers: set to override the headers for a single
2108
+ request; this effectively ignores the headers
2109
+ in the spec for a single request.
2110
+ :type _headers: dict, optional
2111
+ :param _host_index: set to override the host_index for a single
2112
+ request; this effectively ignores the host_index
2113
+ in the spec for a single request.
2114
+ :type _host_index: int, optional
2115
+ :return: Returns the result object.
2116
+ """ # noqa: E501
2117
+
2118
+ _param = self._send_test_webhook_serialize(
2119
+ id=id,
2120
+ data=data,
2121
+ _request_auth=_request_auth,
2122
+ _content_type=_content_type,
2123
+ _headers=_headers,
2124
+ _host_index=_host_index
2125
+ )
2126
+
2127
+ _response_types_map: Dict[str, Optional[str]] = {
2128
+ '202': "WebhookDelivery",
2129
+ '404': "Dict[str, object]",
2130
+ }
2131
+ response_data = self.api_client.call_api(
2132
+ *_param,
2133
+ _request_timeout=_request_timeout
2134
+ )
2135
+ response_data.read()
2136
+ return self.api_client.response_deserialize(
2137
+ response_data=response_data,
2138
+ response_types_map=_response_types_map,
2139
+ )
2140
+
2141
+
2142
+ @validate_call
2143
+ def send_test_webhook_without_preload_content(
2144
+ self,
2145
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
2146
+ data: Dict[str, Any],
2147
+ _request_timeout: Union[
2148
+ None,
2149
+ Annotated[StrictFloat, Field(gt=0)],
2150
+ Tuple[
2151
+ Annotated[StrictFloat, Field(gt=0)],
2152
+ Annotated[StrictFloat, Field(gt=0)]
2153
+ ]
2154
+ ] = None,
2155
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2156
+ _content_type: Optional[StrictStr] = None,
2157
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2158
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2159
+ ) -> RESTResponseType:
2160
+ """Send a test event
2161
+
2162
+ Posts a `webhook.test` event (no document) to the endpoint, signed like any other, to check that you receive and verify events. Its outcome shows in the endpoint's deliveries.
2163
+
2164
+ :param id: The endpoint's ID. (required)
2165
+ :type id: str
2166
+ :param data: (required)
2167
+ :type data: object
2168
+ :param _request_timeout: timeout setting for this request. If one
2169
+ number provided, it will be total request
2170
+ timeout. It can also be a pair (tuple) of
2171
+ (connection, read) timeouts.
2172
+ :type _request_timeout: int, tuple(int, int), optional
2173
+ :param _request_auth: set to override the auth_settings for an a single
2174
+ request; this effectively ignores the
2175
+ authentication in the spec for a single request.
2176
+ :type _request_auth: dict, optional
2177
+ :param _content_type: force content-type for the request.
2178
+ :type _content_type: str, Optional
2179
+ :param _headers: set to override the headers for a single
2180
+ request; this effectively ignores the headers
2181
+ in the spec for a single request.
2182
+ :type _headers: dict, optional
2183
+ :param _host_index: set to override the host_index for a single
2184
+ request; this effectively ignores the host_index
2185
+ in the spec for a single request.
2186
+ :type _host_index: int, optional
2187
+ :return: Returns the result object.
2188
+ """ # noqa: E501
2189
+
2190
+ _param = self._send_test_webhook_serialize(
2191
+ id=id,
2192
+ data=data,
2193
+ _request_auth=_request_auth,
2194
+ _content_type=_content_type,
2195
+ _headers=_headers,
2196
+ _host_index=_host_index
2197
+ )
2198
+
2199
+ _response_types_map: Dict[str, Optional[str]] = {
2200
+ '202': "WebhookDelivery",
2201
+ '404': "Dict[str, object]",
2202
+ }
2203
+ response_data = self.api_client.call_api(
2204
+ *_param,
2205
+ _request_timeout=_request_timeout
2206
+ )
2207
+ return response_data.response
2208
+
2209
+
2210
+ def _send_test_webhook_serialize(
2211
+ self,
2212
+ id,
2213
+ data,
2214
+ _request_auth,
2215
+ _content_type,
2216
+ _headers,
2217
+ _host_index,
2218
+ ) -> RequestSerialized:
2219
+
2220
+ _host = None
2221
+
2222
+ _collection_formats: Dict[str, str] = {
2223
+ }
2224
+
2225
+ _path_params: Dict[str, str] = {}
2226
+ _query_params: List[Tuple[str, str]] = []
2227
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2228
+ _form_params: List[Tuple[str, str]] = []
2229
+ _files: Dict[
2230
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2231
+ ] = {}
2232
+ _body_params: Optional[bytes] = None
2233
+
2234
+ # process the path parameters
2235
+ if id is not None:
2236
+ _path_params['id'] = id
2237
+ # process the query parameters
2238
+ # process the header parameters
2239
+ # process the form parameters
2240
+ # process the body parameter
2241
+ if data is not None:
2242
+ _body_params = data
2243
+
2244
+
2245
+ # set the HTTP header `Accept`
2246
+ if 'Accept' not in _header_params:
2247
+ _header_params['Accept'] = self.api_client.select_header_accept(
2248
+ [
2249
+ 'application/json'
2250
+ ]
2251
+ )
2252
+
2253
+ # set the HTTP header `Content-Type`
2254
+ if _content_type:
2255
+ _header_params['Content-Type'] = _content_type
2256
+ else:
2257
+ _default_content_type = (
2258
+ self.api_client.select_header_content_type(
2259
+ [
2260
+ 'application/json'
2261
+ ]
2262
+ )
2263
+ )
2264
+ if _default_content_type is not None:
2265
+ _header_params['Content-Type'] = _default_content_type
2266
+
2267
+ # authentication setting
2268
+ _auth_settings: List[str] = [
2269
+ 'Bearer'
2270
+ ]
2271
+
2272
+ return self.api_client.param_serialize(
2273
+ method='POST',
2274
+ resource_path='/ap1/webhooks/{id}/test/',
2275
+ path_params=_path_params,
2276
+ query_params=_query_params,
2277
+ header_params=_header_params,
2278
+ body=_body_params,
2279
+ post_params=_form_params,
2280
+ files=_files,
2281
+ auth_settings=_auth_settings,
2282
+ collection_formats=_collection_formats,
2283
+ _host=_host,
2284
+ _request_auth=_request_auth
2285
+ )
2286
+
2287
+
2288
+
2289
+
2290
+ @validate_call
2291
+ def update_webhook_endpoint(
2292
+ self,
2293
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
2294
+ data: UpdateWebhookEndpointRequest,
2295
+ _request_timeout: Union[
2296
+ None,
2297
+ Annotated[StrictFloat, Field(gt=0)],
2298
+ Tuple[
2299
+ Annotated[StrictFloat, Field(gt=0)],
2300
+ Annotated[StrictFloat, Field(gt=0)]
2301
+ ]
2302
+ ] = None,
2303
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2304
+ _content_type: Optional[StrictStr] = None,
2305
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2306
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2307
+ ) -> WebhookEndpoint:
2308
+ """Change or switch a webhook endpoint on or off
2309
+
2310
+ Changes what you send: `url`, `events`, `description`, `is_active`. `is_active: true` switches an endpoint on again after Signedly switched it off (20 events in a row failed), and resets its failure count.
2311
+
2312
+ :param id: The endpoint's ID. (required)
2313
+ :type id: str
2314
+ :param data: (required)
2315
+ :type data: UpdateWebhookEndpointRequest
2316
+ :param _request_timeout: timeout setting for this request. If one
2317
+ number provided, it will be total request
2318
+ timeout. It can also be a pair (tuple) of
2319
+ (connection, read) timeouts.
2320
+ :type _request_timeout: int, tuple(int, int), optional
2321
+ :param _request_auth: set to override the auth_settings for an a single
2322
+ request; this effectively ignores the
2323
+ authentication in the spec for a single request.
2324
+ :type _request_auth: dict, optional
2325
+ :param _content_type: force content-type for the request.
2326
+ :type _content_type: str, Optional
2327
+ :param _headers: set to override the headers for a single
2328
+ request; this effectively ignores the headers
2329
+ in the spec for a single request.
2330
+ :type _headers: dict, optional
2331
+ :param _host_index: set to override the host_index for a single
2332
+ request; this effectively ignores the host_index
2333
+ in the spec for a single request.
2334
+ :type _host_index: int, optional
2335
+ :return: Returns the result object.
2336
+ """ # noqa: E501
2337
+
2338
+ _param = self._update_webhook_endpoint_serialize(
2339
+ id=id,
2340
+ data=data,
2341
+ _request_auth=_request_auth,
2342
+ _content_type=_content_type,
2343
+ _headers=_headers,
2344
+ _host_index=_host_index
2345
+ )
2346
+
2347
+ _response_types_map: Dict[str, Optional[str]] = {
2348
+ '200': "WebhookEndpoint",
2349
+ '400': "Dict[str, object]",
2350
+ '404': "Dict[str, object]",
2351
+ }
2352
+ response_data = self.api_client.call_api(
2353
+ *_param,
2354
+ _request_timeout=_request_timeout
2355
+ )
2356
+ response_data.read()
2357
+ return self.api_client.response_deserialize(
2358
+ response_data=response_data,
2359
+ response_types_map=_response_types_map,
2360
+ ).data
2361
+
2362
+
2363
+ @validate_call
2364
+ def update_webhook_endpoint_with_http_info(
2365
+ self,
2366
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
2367
+ data: UpdateWebhookEndpointRequest,
2368
+ _request_timeout: Union[
2369
+ None,
2370
+ Annotated[StrictFloat, Field(gt=0)],
2371
+ Tuple[
2372
+ Annotated[StrictFloat, Field(gt=0)],
2373
+ Annotated[StrictFloat, Field(gt=0)]
2374
+ ]
2375
+ ] = None,
2376
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2377
+ _content_type: Optional[StrictStr] = None,
2378
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2379
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2380
+ ) -> ApiResponse[WebhookEndpoint]:
2381
+ """Change or switch a webhook endpoint on or off
2382
+
2383
+ Changes what you send: `url`, `events`, `description`, `is_active`. `is_active: true` switches an endpoint on again after Signedly switched it off (20 events in a row failed), and resets its failure count.
2384
+
2385
+ :param id: The endpoint's ID. (required)
2386
+ :type id: str
2387
+ :param data: (required)
2388
+ :type data: UpdateWebhookEndpointRequest
2389
+ :param _request_timeout: timeout setting for this request. If one
2390
+ number provided, it will be total request
2391
+ timeout. It can also be a pair (tuple) of
2392
+ (connection, read) timeouts.
2393
+ :type _request_timeout: int, tuple(int, int), optional
2394
+ :param _request_auth: set to override the auth_settings for an a single
2395
+ request; this effectively ignores the
2396
+ authentication in the spec for a single request.
2397
+ :type _request_auth: dict, optional
2398
+ :param _content_type: force content-type for the request.
2399
+ :type _content_type: str, Optional
2400
+ :param _headers: set to override the headers for a single
2401
+ request; this effectively ignores the headers
2402
+ in the spec for a single request.
2403
+ :type _headers: dict, optional
2404
+ :param _host_index: set to override the host_index for a single
2405
+ request; this effectively ignores the host_index
2406
+ in the spec for a single request.
2407
+ :type _host_index: int, optional
2408
+ :return: Returns the result object.
2409
+ """ # noqa: E501
2410
+
2411
+ _param = self._update_webhook_endpoint_serialize(
2412
+ id=id,
2413
+ data=data,
2414
+ _request_auth=_request_auth,
2415
+ _content_type=_content_type,
2416
+ _headers=_headers,
2417
+ _host_index=_host_index
2418
+ )
2419
+
2420
+ _response_types_map: Dict[str, Optional[str]] = {
2421
+ '200': "WebhookEndpoint",
2422
+ '400': "Dict[str, object]",
2423
+ '404': "Dict[str, object]",
2424
+ }
2425
+ response_data = self.api_client.call_api(
2426
+ *_param,
2427
+ _request_timeout=_request_timeout
2428
+ )
2429
+ response_data.read()
2430
+ return self.api_client.response_deserialize(
2431
+ response_data=response_data,
2432
+ response_types_map=_response_types_map,
2433
+ )
2434
+
2435
+
2436
+ @validate_call
2437
+ def update_webhook_endpoint_without_preload_content(
2438
+ self,
2439
+ id: Annotated[StrictStr, Field(description="The endpoint's ID.")],
2440
+ data: UpdateWebhookEndpointRequest,
2441
+ _request_timeout: Union[
2442
+ None,
2443
+ Annotated[StrictFloat, Field(gt=0)],
2444
+ Tuple[
2445
+ Annotated[StrictFloat, Field(gt=0)],
2446
+ Annotated[StrictFloat, Field(gt=0)]
2447
+ ]
2448
+ ] = None,
2449
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2450
+ _content_type: Optional[StrictStr] = None,
2451
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2452
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2453
+ ) -> RESTResponseType:
2454
+ """Change or switch a webhook endpoint on or off
2455
+
2456
+ Changes what you send: `url`, `events`, `description`, `is_active`. `is_active: true` switches an endpoint on again after Signedly switched it off (20 events in a row failed), and resets its failure count.
2457
+
2458
+ :param id: The endpoint's ID. (required)
2459
+ :type id: str
2460
+ :param data: (required)
2461
+ :type data: UpdateWebhookEndpointRequest
2462
+ :param _request_timeout: timeout setting for this request. If one
2463
+ number provided, it will be total request
2464
+ timeout. It can also be a pair (tuple) of
2465
+ (connection, read) timeouts.
2466
+ :type _request_timeout: int, tuple(int, int), optional
2467
+ :param _request_auth: set to override the auth_settings for an a single
2468
+ request; this effectively ignores the
2469
+ authentication in the spec for a single request.
2470
+ :type _request_auth: dict, optional
2471
+ :param _content_type: force content-type for the request.
2472
+ :type _content_type: str, Optional
2473
+ :param _headers: set to override the headers for a single
2474
+ request; this effectively ignores the headers
2475
+ in the spec for a single request.
2476
+ :type _headers: dict, optional
2477
+ :param _host_index: set to override the host_index for a single
2478
+ request; this effectively ignores the host_index
2479
+ in the spec for a single request.
2480
+ :type _host_index: int, optional
2481
+ :return: Returns the result object.
2482
+ """ # noqa: E501
2483
+
2484
+ _param = self._update_webhook_endpoint_serialize(
2485
+ id=id,
2486
+ data=data,
2487
+ _request_auth=_request_auth,
2488
+ _content_type=_content_type,
2489
+ _headers=_headers,
2490
+ _host_index=_host_index
2491
+ )
2492
+
2493
+ _response_types_map: Dict[str, Optional[str]] = {
2494
+ '200': "WebhookEndpoint",
2495
+ '400': "Dict[str, object]",
2496
+ '404': "Dict[str, object]",
2497
+ }
2498
+ response_data = self.api_client.call_api(
2499
+ *_param,
2500
+ _request_timeout=_request_timeout
2501
+ )
2502
+ return response_data.response
2503
+
2504
+
2505
+ def _update_webhook_endpoint_serialize(
2506
+ self,
2507
+ id,
2508
+ data,
2509
+ _request_auth,
2510
+ _content_type,
2511
+ _headers,
2512
+ _host_index,
2513
+ ) -> RequestSerialized:
2514
+
2515
+ _host = None
2516
+
2517
+ _collection_formats: Dict[str, str] = {
2518
+ }
2519
+
2520
+ _path_params: Dict[str, str] = {}
2521
+ _query_params: List[Tuple[str, str]] = []
2522
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2523
+ _form_params: List[Tuple[str, str]] = []
2524
+ _files: Dict[
2525
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2526
+ ] = {}
2527
+ _body_params: Optional[bytes] = None
2528
+
2529
+ # process the path parameters
2530
+ if id is not None:
2531
+ _path_params['id'] = id
2532
+ # process the query parameters
2533
+ # process the header parameters
2534
+ # process the form parameters
2535
+ # process the body parameter
2536
+ if data is not None:
2537
+ _body_params = data
2538
+
2539
+
2540
+ # set the HTTP header `Accept`
2541
+ if 'Accept' not in _header_params:
2542
+ _header_params['Accept'] = self.api_client.select_header_accept(
2543
+ [
2544
+ 'application/json'
2545
+ ]
2546
+ )
2547
+
2548
+ # set the HTTP header `Content-Type`
2549
+ if _content_type:
2550
+ _header_params['Content-Type'] = _content_type
2551
+ else:
2552
+ _default_content_type = (
2553
+ self.api_client.select_header_content_type(
2554
+ [
2555
+ 'application/json'
2556
+ ]
2557
+ )
2558
+ )
2559
+ if _default_content_type is not None:
2560
+ _header_params['Content-Type'] = _default_content_type
2561
+
2562
+ # authentication setting
2563
+ _auth_settings: List[str] = [
2564
+ 'Bearer'
2565
+ ]
2566
+
2567
+ return self.api_client.param_serialize(
2568
+ method='PUT',
2569
+ resource_path='/ap1/webhooks/{id}/',
2570
+ path_params=_path_params,
2571
+ query_params=_query_params,
2572
+ header_params=_header_params,
2573
+ body=_body_params,
2574
+ post_params=_form_params,
2575
+ files=_files,
2576
+ auth_settings=_auth_settings,
2577
+ collection_formats=_collection_formats,
2578
+ _host=_host,
2579
+ _request_auth=_request_auth
2580
+ )
2581
+
2582
+