hostinger-mail-api 1.0.3__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 (59) hide show
  1. hostinger_mail_api/__init__.py +76 -0
  2. hostinger_mail_api/api/__init__.py +10 -0
  3. hostinger_mail_api/api/account_api.py +284 -0
  4. hostinger_mail_api/api/folders_api.py +1271 -0
  5. hostinger_mail_api/api/messages_api.py +4237 -0
  6. hostinger_mail_api/api/quota_api.py +304 -0
  7. hostinger_mail_api/api/send_api.py +336 -0
  8. hostinger_mail_api/api/webhooks_api.py +2154 -0
  9. hostinger_mail_api/api_client.py +795 -0
  10. hostinger_mail_api/api_response.py +21 -0
  11. hostinger_mail_api/configuration.py +579 -0
  12. hostinger_mail_api/exceptions.py +214 -0
  13. hostinger_mail_api/models/__init__.py +54 -0
  14. hostinger_mail_api/models/error.py +89 -0
  15. hostinger_mail_api/models/pagination.py +91 -0
  16. hostinger_mail_api/models/v1_folder_messages_collection.py +99 -0
  17. hostinger_mail_api/models/v1_folder_messages_delete_bulk_request.py +86 -0
  18. hostinger_mail_api/models/v1_folder_messages_flags_bulk_request.py +90 -0
  19. hostinger_mail_api/models/v1_folder_messages_flags_request.py +88 -0
  20. hostinger_mail_api/models/v1_folder_messages_message.py +165 -0
  21. hostinger_mail_api/models/v1_folder_messages_message_address.py +87 -0
  22. hostinger_mail_api/models/v1_folder_messages_message_attachment.py +105 -0
  23. hostinger_mail_api/models/v1_folder_messages_message_text.py +87 -0
  24. hostinger_mail_api/models/v1_folder_messages_message_text_resource.py +89 -0
  25. hostinger_mail_api/models/v1_folder_messages_move_bulk_request.py +88 -0
  26. hostinger_mail_api/models/v1_folder_messages_move_request.py +86 -0
  27. hostinger_mail_api/models/v1_folder_messages_resource.py +89 -0
  28. hostinger_mail_api/models/v1_folder_messages_search_request.py +111 -0
  29. hostinger_mail_api/models/v1_folder_messages_update_flags_result.py +89 -0
  30. hostinger_mail_api/models/v1_folder_messages_update_flags_result_data.py +95 -0
  31. hostinger_mail_api/models/v1_folder_messages_update_flags_result_data_failed_inner.py +87 -0
  32. hostinger_mail_api/models/v1_folders_collection.py +99 -0
  33. hostinger_mail_api/models/v1_folders_create_request.py +86 -0
  34. hostinger_mail_api/models/v1_folders_folder.py +100 -0
  35. hostinger_mail_api/models/v1_folders_resource.py +89 -0
  36. hostinger_mail_api/models/v1_folders_update_request.py +86 -0
  37. hostinger_mail_api/models/v1_me_mailbox.py +95 -0
  38. hostinger_mail_api/models/v1_me_resource.py +89 -0
  39. hostinger_mail_api/models/v1_me_resource_data.py +103 -0
  40. hostinger_mail_api/models/v1_quota_quota.py +101 -0
  41. hostinger_mail_api/models/v1_quota_quota_resource.py +91 -0
  42. hostinger_mail_api/models/v1_quota_resource.py +89 -0
  43. hostinger_mail_api/models/v1_send_attachment.py +93 -0
  44. hostinger_mail_api/models/v1_send_request.py +92 -0
  45. hostinger_mail_api/models/v1_webhooks_collection.py +99 -0
  46. hostinger_mail_api/models/v1_webhooks_create_request.py +117 -0
  47. hostinger_mail_api/models/v1_webhooks_resource.py +89 -0
  48. hostinger_mail_api/models/v1_webhooks_resource_with_secret.py +89 -0
  49. hostinger_mail_api/models/v1_webhooks_test_result.py +89 -0
  50. hostinger_mail_api/models/v1_webhooks_test_result_data.py +94 -0
  51. hostinger_mail_api/models/v1_webhooks_update_request.py +120 -0
  52. hostinger_mail_api/models/v1_webhooks_webhook.py +132 -0
  53. hostinger_mail_api/models/v1_webhooks_webhook_with_secret.py +134 -0
  54. hostinger_mail_api/py.typed +0 -0
  55. hostinger_mail_api/rest.py +256 -0
  56. hostinger_mail_api-1.0.3.dist-info/METADATA +180 -0
  57. hostinger_mail_api-1.0.3.dist-info/RECORD +59 -0
  58. hostinger_mail_api-1.0.3.dist-info/WHEEL +5 -0
  59. hostinger_mail_api-1.0.3.dist-info/top_level.txt +1 -0
@@ -0,0 +1,2154 @@
1
+ # coding: utf-8
2
+
3
+ """
4
+ Hostinger Email API Python SDK
5
+
6
+ API Version: 1.0.0
7
+
8
+ NOTE: This file is auto-generated, DO NOT EDIT THIS FILE MANUALLY!
9
+ If you want to contribute or request a new feature, please create an issue or pull request on https://github.com/hostinger/api
10
+ """ # noqa: E501
11
+
12
+ import warnings
13
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
14
+ from typing import Any, Dict, List, Optional, Tuple, Union
15
+ from typing_extensions import Annotated
16
+
17
+ from pydantic import Field, StrictStr, field_validator
18
+ from typing import Optional
19
+ from typing_extensions import Annotated
20
+ from hostinger_mail_api.models.v1_webhooks_collection import V1WebhooksCollection
21
+ from hostinger_mail_api.models.v1_webhooks_create_request import V1WebhooksCreateRequest
22
+ from hostinger_mail_api.models.v1_webhooks_resource import V1WebhooksResource
23
+ from hostinger_mail_api.models.v1_webhooks_resource_with_secret import V1WebhooksResourceWithSecret
24
+ from hostinger_mail_api.models.v1_webhooks_test_result import V1WebhooksTestResult
25
+ from hostinger_mail_api.models.v1_webhooks_update_request import V1WebhooksUpdateRequest
26
+
27
+ from hostinger_mail_api.api_client import ApiClient, RequestSerialized
28
+ from hostinger_mail_api.api_response import ApiResponse
29
+ from hostinger_mail_api.rest import RESTResponseType
30
+
31
+
32
+ class WebhooksApi:
33
+
34
+ def __init__(self, api_client=None) -> None:
35
+ if api_client is None:
36
+ api_client = ApiClient.get_default()
37
+ self.api_client = api_client
38
+
39
+
40
+ @validate_call
41
+ def create_webhook(
42
+ self,
43
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
44
+ v1_webhooks_create_request: V1WebhooksCreateRequest,
45
+ _request_timeout: Union[
46
+ None,
47
+ Annotated[StrictFloat, Field(gt=0)],
48
+ Tuple[
49
+ Annotated[StrictFloat, Field(gt=0)],
50
+ Annotated[StrictFloat, Field(gt=0)]
51
+ ]
52
+ ] = None,
53
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
54
+ _content_type: Optional[StrictStr] = None,
55
+ _headers: Optional[Dict[StrictStr, Any]] = None,
56
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
57
+ ) -> V1WebhooksResourceWithSecret:
58
+ """Create webhook
59
+
60
+ Create a webhook. The response includes the one-time `secret` — store it securely as it is never returned again.
61
+
62
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
63
+ :type mailbox_resource_id: str
64
+ :param v1_webhooks_create_request: (required)
65
+ :type v1_webhooks_create_request: V1WebhooksCreateRequest
66
+ :param _request_timeout: timeout setting for this request. If one
67
+ number provided, it will be total request
68
+ timeout. It can also be a pair (tuple) of
69
+ (connection, read) timeouts.
70
+ :type _request_timeout: int, tuple(int, int), optional
71
+ :param _request_auth: set to override the auth_settings for an a single
72
+ request; this effectively ignores the
73
+ authentication in the spec for a single request.
74
+ :type _request_auth: dict, optional
75
+ :param _content_type: force content-type for the request.
76
+ :type _content_type: str, Optional
77
+ :param _headers: set to override the headers for a single
78
+ request; this effectively ignores the headers
79
+ in the spec for a single request.
80
+ :type _headers: dict, optional
81
+ :param _host_index: set to override the host_index for a single
82
+ request; this effectively ignores the host_index
83
+ in the spec for a single request.
84
+ :type _host_index: int, optional
85
+ :return: Returns the result object.
86
+ """ # noqa: E501
87
+
88
+ _param = self._create_webhook_serialize(
89
+ mailbox_resource_id=mailbox_resource_id,
90
+ v1_webhooks_create_request=v1_webhooks_create_request,
91
+ _request_auth=_request_auth,
92
+ _content_type=_content_type,
93
+ _headers=_headers,
94
+ _host_index=_host_index
95
+ )
96
+
97
+ _response_types_map: Dict[str, Optional[str]] = {
98
+ '201': "V1WebhooksResourceWithSecret",
99
+ '401': "Error",
100
+ '403': "Error",
101
+ '422': "Error",
102
+ '500': "Error",
103
+ '502': "Error",
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_with_http_info(
118
+ self,
119
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
120
+ v1_webhooks_create_request: V1WebhooksCreateRequest,
121
+ _request_timeout: Union[
122
+ None,
123
+ Annotated[StrictFloat, Field(gt=0)],
124
+ Tuple[
125
+ Annotated[StrictFloat, Field(gt=0)],
126
+ Annotated[StrictFloat, Field(gt=0)]
127
+ ]
128
+ ] = None,
129
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
130
+ _content_type: Optional[StrictStr] = None,
131
+ _headers: Optional[Dict[StrictStr, Any]] = None,
132
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
133
+ ) -> ApiResponse[V1WebhooksResourceWithSecret]:
134
+ """Create webhook
135
+
136
+ Create a webhook. The response includes the one-time `secret` — store it securely as it is never returned again.
137
+
138
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
139
+ :type mailbox_resource_id: str
140
+ :param v1_webhooks_create_request: (required)
141
+ :type v1_webhooks_create_request: V1WebhooksCreateRequest
142
+ :param _request_timeout: timeout setting for this request. If one
143
+ number provided, it will be total request
144
+ timeout. It can also be a pair (tuple) of
145
+ (connection, read) timeouts.
146
+ :type _request_timeout: int, tuple(int, int), optional
147
+ :param _request_auth: set to override the auth_settings for an a single
148
+ request; this effectively ignores the
149
+ authentication in the spec for a single request.
150
+ :type _request_auth: dict, optional
151
+ :param _content_type: force content-type for the request.
152
+ :type _content_type: str, Optional
153
+ :param _headers: set to override the headers for a single
154
+ request; this effectively ignores the headers
155
+ in the spec for a single request.
156
+ :type _headers: dict, optional
157
+ :param _host_index: set to override the host_index for a single
158
+ request; this effectively ignores the host_index
159
+ in the spec for a single request.
160
+ :type _host_index: int, optional
161
+ :return: Returns the result object.
162
+ """ # noqa: E501
163
+
164
+ _param = self._create_webhook_serialize(
165
+ mailbox_resource_id=mailbox_resource_id,
166
+ v1_webhooks_create_request=v1_webhooks_create_request,
167
+ _request_auth=_request_auth,
168
+ _content_type=_content_type,
169
+ _headers=_headers,
170
+ _host_index=_host_index
171
+ )
172
+
173
+ _response_types_map: Dict[str, Optional[str]] = {
174
+ '201': "V1WebhooksResourceWithSecret",
175
+ '401': "Error",
176
+ '403': "Error",
177
+ '422': "Error",
178
+ '500': "Error",
179
+ '502': "Error",
180
+ }
181
+ response_data = self.api_client.call_api(
182
+ *_param,
183
+ _request_timeout=_request_timeout
184
+ )
185
+ response_data.read()
186
+ return self.api_client.response_deserialize(
187
+ response_data=response_data,
188
+ response_types_map=_response_types_map,
189
+ )
190
+
191
+
192
+ @validate_call
193
+ def create_webhook_without_preload_content(
194
+ self,
195
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
196
+ v1_webhooks_create_request: V1WebhooksCreateRequest,
197
+ _request_timeout: Union[
198
+ None,
199
+ Annotated[StrictFloat, Field(gt=0)],
200
+ Tuple[
201
+ Annotated[StrictFloat, Field(gt=0)],
202
+ Annotated[StrictFloat, Field(gt=0)]
203
+ ]
204
+ ] = None,
205
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
206
+ _content_type: Optional[StrictStr] = None,
207
+ _headers: Optional[Dict[StrictStr, Any]] = None,
208
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
209
+ ) -> RESTResponseType:
210
+ """Create webhook
211
+
212
+ Create a webhook. The response includes the one-time `secret` — store it securely as it is never returned again.
213
+
214
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
215
+ :type mailbox_resource_id: str
216
+ :param v1_webhooks_create_request: (required)
217
+ :type v1_webhooks_create_request: V1WebhooksCreateRequest
218
+ :param _request_timeout: timeout setting for this request. If one
219
+ number provided, it will be total request
220
+ timeout. It can also be a pair (tuple) of
221
+ (connection, read) timeouts.
222
+ :type _request_timeout: int, tuple(int, int), optional
223
+ :param _request_auth: set to override the auth_settings for an a single
224
+ request; this effectively ignores the
225
+ authentication in the spec for a single request.
226
+ :type _request_auth: dict, optional
227
+ :param _content_type: force content-type for the request.
228
+ :type _content_type: str, Optional
229
+ :param _headers: set to override the headers for a single
230
+ request; this effectively ignores the headers
231
+ in the spec for a single request.
232
+ :type _headers: dict, optional
233
+ :param _host_index: set to override the host_index for a single
234
+ request; this effectively ignores the host_index
235
+ in the spec for a single request.
236
+ :type _host_index: int, optional
237
+ :return: Returns the result object.
238
+ """ # noqa: E501
239
+
240
+ _param = self._create_webhook_serialize(
241
+ mailbox_resource_id=mailbox_resource_id,
242
+ v1_webhooks_create_request=v1_webhooks_create_request,
243
+ _request_auth=_request_auth,
244
+ _content_type=_content_type,
245
+ _headers=_headers,
246
+ _host_index=_host_index
247
+ )
248
+
249
+ _response_types_map: Dict[str, Optional[str]] = {
250
+ '201': "V1WebhooksResourceWithSecret",
251
+ '401': "Error",
252
+ '403': "Error",
253
+ '422': "Error",
254
+ '500': "Error",
255
+ '502': "Error",
256
+ }
257
+ response_data = self.api_client.call_api(
258
+ *_param,
259
+ _request_timeout=_request_timeout
260
+ )
261
+ return response_data.response
262
+
263
+
264
+ def _create_webhook_serialize(
265
+ self,
266
+ mailbox_resource_id,
267
+ v1_webhooks_create_request,
268
+ _request_auth,
269
+ _content_type,
270
+ _headers,
271
+ _host_index,
272
+ ) -> RequestSerialized:
273
+
274
+ _host = None
275
+
276
+ _collection_formats: Dict[str, str] = {
277
+ }
278
+
279
+ _path_params: Dict[str, str] = {}
280
+ _query_params: List[Tuple[str, str]] = []
281
+ _header_params: Dict[str, Optional[str]] = _headers or {}
282
+ _form_params: List[Tuple[str, str]] = []
283
+ _files: Dict[
284
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
285
+ ] = {}
286
+ _body_params: Optional[bytes] = None
287
+
288
+ # process the path parameters
289
+ if mailbox_resource_id is not None:
290
+ _path_params['mailboxResourceId'] = mailbox_resource_id
291
+ # process the query parameters
292
+ # process the header parameters
293
+ # process the form parameters
294
+ # process the body parameter
295
+ if v1_webhooks_create_request is not None:
296
+ _body_params = v1_webhooks_create_request
297
+
298
+
299
+ # set the HTTP header `Accept`
300
+ if 'Accept' not in _header_params:
301
+ _header_params['Accept'] = self.api_client.select_header_accept(
302
+ [
303
+ 'application/json'
304
+ ]
305
+ )
306
+
307
+ # set the HTTP header `Content-Type`
308
+ if _content_type:
309
+ _header_params['Content-Type'] = _content_type
310
+ else:
311
+ _default_content_type = (
312
+ self.api_client.select_header_content_type(
313
+ [
314
+ 'application/json'
315
+ ]
316
+ )
317
+ )
318
+ if _default_content_type is not None:
319
+ _header_params['Content-Type'] = _default_content_type
320
+
321
+ # authentication setting
322
+ _auth_settings: List[str] = [
323
+ 'BearerAuth'
324
+ ]
325
+
326
+ return self.api_client.param_serialize(
327
+ method='POST',
328
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/webhooks',
329
+ path_params=_path_params,
330
+ query_params=_query_params,
331
+ header_params=_header_params,
332
+ body=_body_params,
333
+ post_params=_form_params,
334
+ files=_files,
335
+ auth_settings=_auth_settings,
336
+ collection_formats=_collection_formats,
337
+ _host=_host,
338
+ _request_auth=_request_auth
339
+ )
340
+
341
+
342
+
343
+
344
+ @validate_call
345
+ def delete_webhook(
346
+ self,
347
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
348
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
349
+ _request_timeout: Union[
350
+ None,
351
+ Annotated[StrictFloat, Field(gt=0)],
352
+ Tuple[
353
+ Annotated[StrictFloat, Field(gt=0)],
354
+ Annotated[StrictFloat, Field(gt=0)]
355
+ ]
356
+ ] = None,
357
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
358
+ _content_type: Optional[StrictStr] = None,
359
+ _headers: Optional[Dict[StrictStr, Any]] = None,
360
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
361
+ ) -> None:
362
+ """Delete webhook
363
+
364
+ Delete a webhook.
365
+
366
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
367
+ :type mailbox_resource_id: str
368
+ :param webhook: Webhook identifier (UUID v7). (required)
369
+ :type webhook: str
370
+ :param _request_timeout: timeout setting for this request. If one
371
+ number provided, it will be total request
372
+ timeout. It can also be a pair (tuple) of
373
+ (connection, read) timeouts.
374
+ :type _request_timeout: int, tuple(int, int), optional
375
+ :param _request_auth: set to override the auth_settings for an a single
376
+ request; this effectively ignores the
377
+ authentication in the spec for a single request.
378
+ :type _request_auth: dict, optional
379
+ :param _content_type: force content-type for the request.
380
+ :type _content_type: str, Optional
381
+ :param _headers: set to override the headers for a single
382
+ request; this effectively ignores the headers
383
+ in the spec for a single request.
384
+ :type _headers: dict, optional
385
+ :param _host_index: set to override the host_index for a single
386
+ request; this effectively ignores the host_index
387
+ in the spec for a single request.
388
+ :type _host_index: int, optional
389
+ :return: Returns the result object.
390
+ """ # noqa: E501
391
+
392
+ _param = self._delete_webhook_serialize(
393
+ mailbox_resource_id=mailbox_resource_id,
394
+ webhook=webhook,
395
+ _request_auth=_request_auth,
396
+ _content_type=_content_type,
397
+ _headers=_headers,
398
+ _host_index=_host_index
399
+ )
400
+
401
+ _response_types_map: Dict[str, Optional[str]] = {
402
+ '204': None,
403
+ '401': "Error",
404
+ '403': "Error",
405
+ '404': "Error",
406
+ '500': "Error",
407
+ '502': "Error",
408
+ }
409
+ response_data = self.api_client.call_api(
410
+ *_param,
411
+ _request_timeout=_request_timeout
412
+ )
413
+ response_data.read()
414
+ return self.api_client.response_deserialize(
415
+ response_data=response_data,
416
+ response_types_map=_response_types_map,
417
+ ).data
418
+
419
+
420
+ @validate_call
421
+ def delete_webhook_with_http_info(
422
+ self,
423
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
424
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
425
+ _request_timeout: Union[
426
+ None,
427
+ Annotated[StrictFloat, Field(gt=0)],
428
+ Tuple[
429
+ Annotated[StrictFloat, Field(gt=0)],
430
+ Annotated[StrictFloat, Field(gt=0)]
431
+ ]
432
+ ] = None,
433
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
434
+ _content_type: Optional[StrictStr] = None,
435
+ _headers: Optional[Dict[StrictStr, Any]] = None,
436
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
437
+ ) -> ApiResponse[None]:
438
+ """Delete webhook
439
+
440
+ Delete a webhook.
441
+
442
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
443
+ :type mailbox_resource_id: str
444
+ :param webhook: Webhook identifier (UUID v7). (required)
445
+ :type webhook: str
446
+ :param _request_timeout: timeout setting for this request. If one
447
+ number provided, it will be total request
448
+ timeout. It can also be a pair (tuple) of
449
+ (connection, read) timeouts.
450
+ :type _request_timeout: int, tuple(int, int), optional
451
+ :param _request_auth: set to override the auth_settings for an a single
452
+ request; this effectively ignores the
453
+ authentication in the spec for a single request.
454
+ :type _request_auth: dict, optional
455
+ :param _content_type: force content-type for the request.
456
+ :type _content_type: str, Optional
457
+ :param _headers: set to override the headers for a single
458
+ request; this effectively ignores the headers
459
+ in the spec for a single request.
460
+ :type _headers: dict, optional
461
+ :param _host_index: set to override the host_index for a single
462
+ request; this effectively ignores the host_index
463
+ in the spec for a single request.
464
+ :type _host_index: int, optional
465
+ :return: Returns the result object.
466
+ """ # noqa: E501
467
+
468
+ _param = self._delete_webhook_serialize(
469
+ mailbox_resource_id=mailbox_resource_id,
470
+ webhook=webhook,
471
+ _request_auth=_request_auth,
472
+ _content_type=_content_type,
473
+ _headers=_headers,
474
+ _host_index=_host_index
475
+ )
476
+
477
+ _response_types_map: Dict[str, Optional[str]] = {
478
+ '204': None,
479
+ '401': "Error",
480
+ '403': "Error",
481
+ '404': "Error",
482
+ '500': "Error",
483
+ '502': "Error",
484
+ }
485
+ response_data = self.api_client.call_api(
486
+ *_param,
487
+ _request_timeout=_request_timeout
488
+ )
489
+ response_data.read()
490
+ return self.api_client.response_deserialize(
491
+ response_data=response_data,
492
+ response_types_map=_response_types_map,
493
+ )
494
+
495
+
496
+ @validate_call
497
+ def delete_webhook_without_preload_content(
498
+ self,
499
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
500
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
501
+ _request_timeout: Union[
502
+ None,
503
+ Annotated[StrictFloat, Field(gt=0)],
504
+ Tuple[
505
+ Annotated[StrictFloat, Field(gt=0)],
506
+ Annotated[StrictFloat, Field(gt=0)]
507
+ ]
508
+ ] = None,
509
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
510
+ _content_type: Optional[StrictStr] = None,
511
+ _headers: Optional[Dict[StrictStr, Any]] = None,
512
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
513
+ ) -> RESTResponseType:
514
+ """Delete webhook
515
+
516
+ Delete a webhook.
517
+
518
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
519
+ :type mailbox_resource_id: str
520
+ :param webhook: Webhook identifier (UUID v7). (required)
521
+ :type webhook: str
522
+ :param _request_timeout: timeout setting for this request. If one
523
+ number provided, it will be total request
524
+ timeout. It can also be a pair (tuple) of
525
+ (connection, read) timeouts.
526
+ :type _request_timeout: int, tuple(int, int), optional
527
+ :param _request_auth: set to override the auth_settings for an a single
528
+ request; this effectively ignores the
529
+ authentication in the spec for a single request.
530
+ :type _request_auth: dict, optional
531
+ :param _content_type: force content-type for the request.
532
+ :type _content_type: str, Optional
533
+ :param _headers: set to override the headers for a single
534
+ request; this effectively ignores the headers
535
+ in the spec for a single request.
536
+ :type _headers: dict, optional
537
+ :param _host_index: set to override the host_index for a single
538
+ request; this effectively ignores the host_index
539
+ in the spec for a single request.
540
+ :type _host_index: int, optional
541
+ :return: Returns the result object.
542
+ """ # noqa: E501
543
+
544
+ _param = self._delete_webhook_serialize(
545
+ mailbox_resource_id=mailbox_resource_id,
546
+ webhook=webhook,
547
+ _request_auth=_request_auth,
548
+ _content_type=_content_type,
549
+ _headers=_headers,
550
+ _host_index=_host_index
551
+ )
552
+
553
+ _response_types_map: Dict[str, Optional[str]] = {
554
+ '204': None,
555
+ '401': "Error",
556
+ '403': "Error",
557
+ '404': "Error",
558
+ '500': "Error",
559
+ '502': "Error",
560
+ }
561
+ response_data = self.api_client.call_api(
562
+ *_param,
563
+ _request_timeout=_request_timeout
564
+ )
565
+ return response_data.response
566
+
567
+
568
+ def _delete_webhook_serialize(
569
+ self,
570
+ mailbox_resource_id,
571
+ webhook,
572
+ _request_auth,
573
+ _content_type,
574
+ _headers,
575
+ _host_index,
576
+ ) -> RequestSerialized:
577
+
578
+ _host = None
579
+
580
+ _collection_formats: Dict[str, str] = {
581
+ }
582
+
583
+ _path_params: Dict[str, str] = {}
584
+ _query_params: List[Tuple[str, str]] = []
585
+ _header_params: Dict[str, Optional[str]] = _headers or {}
586
+ _form_params: List[Tuple[str, str]] = []
587
+ _files: Dict[
588
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
589
+ ] = {}
590
+ _body_params: Optional[bytes] = None
591
+
592
+ # process the path parameters
593
+ if mailbox_resource_id is not None:
594
+ _path_params['mailboxResourceId'] = mailbox_resource_id
595
+ if webhook is not None:
596
+ _path_params['webhook'] = webhook
597
+ # process the query parameters
598
+ # process the header parameters
599
+ # process the form parameters
600
+ # process the body parameter
601
+
602
+
603
+ # set the HTTP header `Accept`
604
+ if 'Accept' not in _header_params:
605
+ _header_params['Accept'] = self.api_client.select_header_accept(
606
+ [
607
+ 'application/json'
608
+ ]
609
+ )
610
+
611
+
612
+ # authentication setting
613
+ _auth_settings: List[str] = [
614
+ 'BearerAuth'
615
+ ]
616
+
617
+ return self.api_client.param_serialize(
618
+ method='DELETE',
619
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/webhooks/{webhook}',
620
+ path_params=_path_params,
621
+ query_params=_query_params,
622
+ header_params=_header_params,
623
+ body=_body_params,
624
+ post_params=_form_params,
625
+ files=_files,
626
+ auth_settings=_auth_settings,
627
+ collection_formats=_collection_formats,
628
+ _host=_host,
629
+ _request_auth=_request_auth
630
+ )
631
+
632
+
633
+
634
+
635
+ @validate_call
636
+ def get_webhook(
637
+ self,
638
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
639
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
640
+ _request_timeout: Union[
641
+ None,
642
+ Annotated[StrictFloat, Field(gt=0)],
643
+ Tuple[
644
+ Annotated[StrictFloat, Field(gt=0)],
645
+ Annotated[StrictFloat, Field(gt=0)]
646
+ ]
647
+ ] = None,
648
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
649
+ _content_type: Optional[StrictStr] = None,
650
+ _headers: Optional[Dict[StrictStr, Any]] = None,
651
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
652
+ ) -> V1WebhooksResource:
653
+ """Get webhook
654
+
655
+ Retrieve a single webhook by id.
656
+
657
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
658
+ :type mailbox_resource_id: str
659
+ :param webhook: Webhook identifier (UUID v7). (required)
660
+ :type webhook: str
661
+ :param _request_timeout: timeout setting for this request. If one
662
+ number provided, it will be total request
663
+ timeout. It can also be a pair (tuple) of
664
+ (connection, read) timeouts.
665
+ :type _request_timeout: int, tuple(int, int), optional
666
+ :param _request_auth: set to override the auth_settings for an a single
667
+ request; this effectively ignores the
668
+ authentication in the spec for a single request.
669
+ :type _request_auth: dict, optional
670
+ :param _content_type: force content-type for the request.
671
+ :type _content_type: str, Optional
672
+ :param _headers: set to override the headers for a single
673
+ request; this effectively ignores the headers
674
+ in the spec for a single request.
675
+ :type _headers: dict, optional
676
+ :param _host_index: set to override the host_index for a single
677
+ request; this effectively ignores the host_index
678
+ in the spec for a single request.
679
+ :type _host_index: int, optional
680
+ :return: Returns the result object.
681
+ """ # noqa: E501
682
+
683
+ _param = self._get_webhook_serialize(
684
+ mailbox_resource_id=mailbox_resource_id,
685
+ webhook=webhook,
686
+ _request_auth=_request_auth,
687
+ _content_type=_content_type,
688
+ _headers=_headers,
689
+ _host_index=_host_index
690
+ )
691
+
692
+ _response_types_map: Dict[str, Optional[str]] = {
693
+ '200': "V1WebhooksResource",
694
+ '401': "Error",
695
+ '403': "Error",
696
+ '404': "Error",
697
+ '500': "Error",
698
+ '502': "Error",
699
+ }
700
+ response_data = self.api_client.call_api(
701
+ *_param,
702
+ _request_timeout=_request_timeout
703
+ )
704
+ response_data.read()
705
+ return self.api_client.response_deserialize(
706
+ response_data=response_data,
707
+ response_types_map=_response_types_map,
708
+ ).data
709
+
710
+
711
+ @validate_call
712
+ def get_webhook_with_http_info(
713
+ self,
714
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
715
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
716
+ _request_timeout: Union[
717
+ None,
718
+ Annotated[StrictFloat, Field(gt=0)],
719
+ Tuple[
720
+ Annotated[StrictFloat, Field(gt=0)],
721
+ Annotated[StrictFloat, Field(gt=0)]
722
+ ]
723
+ ] = None,
724
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
725
+ _content_type: Optional[StrictStr] = None,
726
+ _headers: Optional[Dict[StrictStr, Any]] = None,
727
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
728
+ ) -> ApiResponse[V1WebhooksResource]:
729
+ """Get webhook
730
+
731
+ Retrieve a single webhook by id.
732
+
733
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
734
+ :type mailbox_resource_id: str
735
+ :param webhook: Webhook identifier (UUID v7). (required)
736
+ :type webhook: str
737
+ :param _request_timeout: timeout setting for this request. If one
738
+ number provided, it will be total request
739
+ timeout. It can also be a pair (tuple) of
740
+ (connection, read) timeouts.
741
+ :type _request_timeout: int, tuple(int, int), optional
742
+ :param _request_auth: set to override the auth_settings for an a single
743
+ request; this effectively ignores the
744
+ authentication in the spec for a single request.
745
+ :type _request_auth: dict, optional
746
+ :param _content_type: force content-type for the request.
747
+ :type _content_type: str, Optional
748
+ :param _headers: set to override the headers for a single
749
+ request; this effectively ignores the headers
750
+ in the spec for a single request.
751
+ :type _headers: dict, optional
752
+ :param _host_index: set to override the host_index for a single
753
+ request; this effectively ignores the host_index
754
+ in the spec for a single request.
755
+ :type _host_index: int, optional
756
+ :return: Returns the result object.
757
+ """ # noqa: E501
758
+
759
+ _param = self._get_webhook_serialize(
760
+ mailbox_resource_id=mailbox_resource_id,
761
+ webhook=webhook,
762
+ _request_auth=_request_auth,
763
+ _content_type=_content_type,
764
+ _headers=_headers,
765
+ _host_index=_host_index
766
+ )
767
+
768
+ _response_types_map: Dict[str, Optional[str]] = {
769
+ '200': "V1WebhooksResource",
770
+ '401': "Error",
771
+ '403': "Error",
772
+ '404': "Error",
773
+ '500': "Error",
774
+ '502': "Error",
775
+ }
776
+ response_data = self.api_client.call_api(
777
+ *_param,
778
+ _request_timeout=_request_timeout
779
+ )
780
+ response_data.read()
781
+ return self.api_client.response_deserialize(
782
+ response_data=response_data,
783
+ response_types_map=_response_types_map,
784
+ )
785
+
786
+
787
+ @validate_call
788
+ def get_webhook_without_preload_content(
789
+ self,
790
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
791
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
792
+ _request_timeout: Union[
793
+ None,
794
+ Annotated[StrictFloat, Field(gt=0)],
795
+ Tuple[
796
+ Annotated[StrictFloat, Field(gt=0)],
797
+ Annotated[StrictFloat, Field(gt=0)]
798
+ ]
799
+ ] = None,
800
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
801
+ _content_type: Optional[StrictStr] = None,
802
+ _headers: Optional[Dict[StrictStr, Any]] = None,
803
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
804
+ ) -> RESTResponseType:
805
+ """Get webhook
806
+
807
+ Retrieve a single webhook by id.
808
+
809
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
810
+ :type mailbox_resource_id: str
811
+ :param webhook: Webhook identifier (UUID v7). (required)
812
+ :type webhook: str
813
+ :param _request_timeout: timeout setting for this request. If one
814
+ number provided, it will be total request
815
+ timeout. It can also be a pair (tuple) of
816
+ (connection, read) timeouts.
817
+ :type _request_timeout: int, tuple(int, int), optional
818
+ :param _request_auth: set to override the auth_settings for an a single
819
+ request; this effectively ignores the
820
+ authentication in the spec for a single request.
821
+ :type _request_auth: dict, optional
822
+ :param _content_type: force content-type for the request.
823
+ :type _content_type: str, Optional
824
+ :param _headers: set to override the headers for a single
825
+ request; this effectively ignores the headers
826
+ in the spec for a single request.
827
+ :type _headers: dict, optional
828
+ :param _host_index: set to override the host_index for a single
829
+ request; this effectively ignores the host_index
830
+ in the spec for a single request.
831
+ :type _host_index: int, optional
832
+ :return: Returns the result object.
833
+ """ # noqa: E501
834
+
835
+ _param = self._get_webhook_serialize(
836
+ mailbox_resource_id=mailbox_resource_id,
837
+ webhook=webhook,
838
+ _request_auth=_request_auth,
839
+ _content_type=_content_type,
840
+ _headers=_headers,
841
+ _host_index=_host_index
842
+ )
843
+
844
+ _response_types_map: Dict[str, Optional[str]] = {
845
+ '200': "V1WebhooksResource",
846
+ '401': "Error",
847
+ '403': "Error",
848
+ '404': "Error",
849
+ '500': "Error",
850
+ '502': "Error",
851
+ }
852
+ response_data = self.api_client.call_api(
853
+ *_param,
854
+ _request_timeout=_request_timeout
855
+ )
856
+ return response_data.response
857
+
858
+
859
+ def _get_webhook_serialize(
860
+ self,
861
+ mailbox_resource_id,
862
+ webhook,
863
+ _request_auth,
864
+ _content_type,
865
+ _headers,
866
+ _host_index,
867
+ ) -> RequestSerialized:
868
+
869
+ _host = None
870
+
871
+ _collection_formats: Dict[str, str] = {
872
+ }
873
+
874
+ _path_params: Dict[str, str] = {}
875
+ _query_params: List[Tuple[str, str]] = []
876
+ _header_params: Dict[str, Optional[str]] = _headers or {}
877
+ _form_params: List[Tuple[str, str]] = []
878
+ _files: Dict[
879
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
880
+ ] = {}
881
+ _body_params: Optional[bytes] = None
882
+
883
+ # process the path parameters
884
+ if mailbox_resource_id is not None:
885
+ _path_params['mailboxResourceId'] = mailbox_resource_id
886
+ if webhook is not None:
887
+ _path_params['webhook'] = webhook
888
+ # process the query parameters
889
+ # process the header parameters
890
+ # process the form parameters
891
+ # process the body parameter
892
+
893
+
894
+ # set the HTTP header `Accept`
895
+ if 'Accept' not in _header_params:
896
+ _header_params['Accept'] = self.api_client.select_header_accept(
897
+ [
898
+ 'application/json'
899
+ ]
900
+ )
901
+
902
+
903
+ # authentication setting
904
+ _auth_settings: List[str] = [
905
+ 'BearerAuth'
906
+ ]
907
+
908
+ return self.api_client.param_serialize(
909
+ method='GET',
910
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/webhooks/{webhook}',
911
+ path_params=_path_params,
912
+ query_params=_query_params,
913
+ header_params=_header_params,
914
+ body=_body_params,
915
+ post_params=_form_params,
916
+ files=_files,
917
+ auth_settings=_auth_settings,
918
+ collection_formats=_collection_formats,
919
+ _host=_host,
920
+ _request_auth=_request_auth
921
+ )
922
+
923
+
924
+
925
+
926
+ @validate_call
927
+ def list_webhooks(
928
+ self,
929
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
930
+ status: Optional[StrictStr] = None,
931
+ page: Optional[Annotated[int, Field(strict=True, ge=1)]] = None,
932
+ per_page: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = None,
933
+ _request_timeout: Union[
934
+ None,
935
+ Annotated[StrictFloat, Field(gt=0)],
936
+ Tuple[
937
+ Annotated[StrictFloat, Field(gt=0)],
938
+ Annotated[StrictFloat, Field(gt=0)]
939
+ ]
940
+ ] = None,
941
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
942
+ _content_type: Optional[StrictStr] = None,
943
+ _headers: Optional[Dict[StrictStr, Any]] = None,
944
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
945
+ ) -> V1WebhooksCollection:
946
+ """List webhooks
947
+
948
+ List webhooks for a mailbox.
949
+
950
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
951
+ :type mailbox_resource_id: str
952
+ :param status:
953
+ :type status: str
954
+ :param page:
955
+ :type page: int
956
+ :param per_page:
957
+ :type per_page: int
958
+ :param _request_timeout: timeout setting for this request. If one
959
+ number provided, it will be total request
960
+ timeout. It can also be a pair (tuple) of
961
+ (connection, read) timeouts.
962
+ :type _request_timeout: int, tuple(int, int), optional
963
+ :param _request_auth: set to override the auth_settings for an a single
964
+ request; this effectively ignores the
965
+ authentication in the spec for a single request.
966
+ :type _request_auth: dict, optional
967
+ :param _content_type: force content-type for the request.
968
+ :type _content_type: str, Optional
969
+ :param _headers: set to override the headers for a single
970
+ request; this effectively ignores the headers
971
+ in the spec for a single request.
972
+ :type _headers: dict, optional
973
+ :param _host_index: set to override the host_index for a single
974
+ request; this effectively ignores the host_index
975
+ in the spec for a single request.
976
+ :type _host_index: int, optional
977
+ :return: Returns the result object.
978
+ """ # noqa: E501
979
+
980
+ _param = self._list_webhooks_serialize(
981
+ mailbox_resource_id=mailbox_resource_id,
982
+ status=status,
983
+ page=page,
984
+ per_page=per_page,
985
+ _request_auth=_request_auth,
986
+ _content_type=_content_type,
987
+ _headers=_headers,
988
+ _host_index=_host_index
989
+ )
990
+
991
+ _response_types_map: Dict[str, Optional[str]] = {
992
+ '200': "V1WebhooksCollection",
993
+ '401': "Error",
994
+ '403': "Error",
995
+ '422': "Error",
996
+ '500': "Error",
997
+ '502': "Error",
998
+ }
999
+ response_data = self.api_client.call_api(
1000
+ *_param,
1001
+ _request_timeout=_request_timeout
1002
+ )
1003
+ response_data.read()
1004
+ return self.api_client.response_deserialize(
1005
+ response_data=response_data,
1006
+ response_types_map=_response_types_map,
1007
+ ).data
1008
+
1009
+
1010
+ @validate_call
1011
+ def list_webhooks_with_http_info(
1012
+ self,
1013
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
1014
+ status: Optional[StrictStr] = None,
1015
+ page: Optional[Annotated[int, Field(strict=True, ge=1)]] = None,
1016
+ per_page: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = None,
1017
+ _request_timeout: Union[
1018
+ None,
1019
+ Annotated[StrictFloat, Field(gt=0)],
1020
+ Tuple[
1021
+ Annotated[StrictFloat, Field(gt=0)],
1022
+ Annotated[StrictFloat, Field(gt=0)]
1023
+ ]
1024
+ ] = None,
1025
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1026
+ _content_type: Optional[StrictStr] = None,
1027
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1028
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1029
+ ) -> ApiResponse[V1WebhooksCollection]:
1030
+ """List webhooks
1031
+
1032
+ List webhooks for a mailbox.
1033
+
1034
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
1035
+ :type mailbox_resource_id: str
1036
+ :param status:
1037
+ :type status: str
1038
+ :param page:
1039
+ :type page: int
1040
+ :param per_page:
1041
+ :type per_page: int
1042
+ :param _request_timeout: timeout setting for this request. If one
1043
+ number provided, it will be total request
1044
+ timeout. It can also be a pair (tuple) of
1045
+ (connection, read) timeouts.
1046
+ :type _request_timeout: int, tuple(int, int), optional
1047
+ :param _request_auth: set to override the auth_settings for an a single
1048
+ request; this effectively ignores the
1049
+ authentication in the spec for a single request.
1050
+ :type _request_auth: dict, optional
1051
+ :param _content_type: force content-type for the request.
1052
+ :type _content_type: str, Optional
1053
+ :param _headers: set to override the headers for a single
1054
+ request; this effectively ignores the headers
1055
+ in the spec for a single request.
1056
+ :type _headers: dict, optional
1057
+ :param _host_index: set to override the host_index for a single
1058
+ request; this effectively ignores the host_index
1059
+ in the spec for a single request.
1060
+ :type _host_index: int, optional
1061
+ :return: Returns the result object.
1062
+ """ # noqa: E501
1063
+
1064
+ _param = self._list_webhooks_serialize(
1065
+ mailbox_resource_id=mailbox_resource_id,
1066
+ status=status,
1067
+ page=page,
1068
+ per_page=per_page,
1069
+ _request_auth=_request_auth,
1070
+ _content_type=_content_type,
1071
+ _headers=_headers,
1072
+ _host_index=_host_index
1073
+ )
1074
+
1075
+ _response_types_map: Dict[str, Optional[str]] = {
1076
+ '200': "V1WebhooksCollection",
1077
+ '401': "Error",
1078
+ '403': "Error",
1079
+ '422': "Error",
1080
+ '500': "Error",
1081
+ '502': "Error",
1082
+ }
1083
+ response_data = self.api_client.call_api(
1084
+ *_param,
1085
+ _request_timeout=_request_timeout
1086
+ )
1087
+ response_data.read()
1088
+ return self.api_client.response_deserialize(
1089
+ response_data=response_data,
1090
+ response_types_map=_response_types_map,
1091
+ )
1092
+
1093
+
1094
+ @validate_call
1095
+ def list_webhooks_without_preload_content(
1096
+ self,
1097
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
1098
+ status: Optional[StrictStr] = None,
1099
+ page: Optional[Annotated[int, Field(strict=True, ge=1)]] = None,
1100
+ per_page: Optional[Annotated[int, Field(le=1000, strict=True, ge=1)]] = None,
1101
+ _request_timeout: Union[
1102
+ None,
1103
+ Annotated[StrictFloat, Field(gt=0)],
1104
+ Tuple[
1105
+ Annotated[StrictFloat, Field(gt=0)],
1106
+ Annotated[StrictFloat, Field(gt=0)]
1107
+ ]
1108
+ ] = None,
1109
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1110
+ _content_type: Optional[StrictStr] = None,
1111
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1112
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1113
+ ) -> RESTResponseType:
1114
+ """List webhooks
1115
+
1116
+ List webhooks for a mailbox.
1117
+
1118
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
1119
+ :type mailbox_resource_id: str
1120
+ :param status:
1121
+ :type status: str
1122
+ :param page:
1123
+ :type page: int
1124
+ :param per_page:
1125
+ :type per_page: int
1126
+ :param _request_timeout: timeout setting for this request. If one
1127
+ number provided, it will be total request
1128
+ timeout. It can also be a pair (tuple) of
1129
+ (connection, read) timeouts.
1130
+ :type _request_timeout: int, tuple(int, int), optional
1131
+ :param _request_auth: set to override the auth_settings for an a single
1132
+ request; this effectively ignores the
1133
+ authentication in the spec for a single request.
1134
+ :type _request_auth: dict, optional
1135
+ :param _content_type: force content-type for the request.
1136
+ :type _content_type: str, Optional
1137
+ :param _headers: set to override the headers for a single
1138
+ request; this effectively ignores the headers
1139
+ in the spec for a single request.
1140
+ :type _headers: dict, optional
1141
+ :param _host_index: set to override the host_index for a single
1142
+ request; this effectively ignores the host_index
1143
+ in the spec for a single request.
1144
+ :type _host_index: int, optional
1145
+ :return: Returns the result object.
1146
+ """ # noqa: E501
1147
+
1148
+ _param = self._list_webhooks_serialize(
1149
+ mailbox_resource_id=mailbox_resource_id,
1150
+ status=status,
1151
+ page=page,
1152
+ per_page=per_page,
1153
+ _request_auth=_request_auth,
1154
+ _content_type=_content_type,
1155
+ _headers=_headers,
1156
+ _host_index=_host_index
1157
+ )
1158
+
1159
+ _response_types_map: Dict[str, Optional[str]] = {
1160
+ '200': "V1WebhooksCollection",
1161
+ '401': "Error",
1162
+ '403': "Error",
1163
+ '422': "Error",
1164
+ '500': "Error",
1165
+ '502': "Error",
1166
+ }
1167
+ response_data = self.api_client.call_api(
1168
+ *_param,
1169
+ _request_timeout=_request_timeout
1170
+ )
1171
+ return response_data.response
1172
+
1173
+
1174
+ def _list_webhooks_serialize(
1175
+ self,
1176
+ mailbox_resource_id,
1177
+ status,
1178
+ page,
1179
+ per_page,
1180
+ _request_auth,
1181
+ _content_type,
1182
+ _headers,
1183
+ _host_index,
1184
+ ) -> RequestSerialized:
1185
+
1186
+ _host = None
1187
+
1188
+ _collection_formats: Dict[str, str] = {
1189
+ }
1190
+
1191
+ _path_params: Dict[str, str] = {}
1192
+ _query_params: List[Tuple[str, str]] = []
1193
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1194
+ _form_params: List[Tuple[str, str]] = []
1195
+ _files: Dict[
1196
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1197
+ ] = {}
1198
+ _body_params: Optional[bytes] = None
1199
+
1200
+ # process the path parameters
1201
+ if mailbox_resource_id is not None:
1202
+ _path_params['mailboxResourceId'] = mailbox_resource_id
1203
+ # process the query parameters
1204
+ if status is not None:
1205
+
1206
+ _query_params.append(('status', status))
1207
+
1208
+ if page is not None:
1209
+
1210
+ _query_params.append(('page', page))
1211
+
1212
+ if per_page is not None:
1213
+
1214
+ _query_params.append(('perPage', per_page))
1215
+
1216
+ # process the header parameters
1217
+ # process the form parameters
1218
+ # process the body parameter
1219
+
1220
+
1221
+ # set the HTTP header `Accept`
1222
+ if 'Accept' not in _header_params:
1223
+ _header_params['Accept'] = self.api_client.select_header_accept(
1224
+ [
1225
+ 'application/json'
1226
+ ]
1227
+ )
1228
+
1229
+
1230
+ # authentication setting
1231
+ _auth_settings: List[str] = [
1232
+ 'BearerAuth'
1233
+ ]
1234
+
1235
+ return self.api_client.param_serialize(
1236
+ method='GET',
1237
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/webhooks',
1238
+ path_params=_path_params,
1239
+ query_params=_query_params,
1240
+ header_params=_header_params,
1241
+ body=_body_params,
1242
+ post_params=_form_params,
1243
+ files=_files,
1244
+ auth_settings=_auth_settings,
1245
+ collection_formats=_collection_formats,
1246
+ _host=_host,
1247
+ _request_auth=_request_auth
1248
+ )
1249
+
1250
+
1251
+
1252
+
1253
+ @validate_call
1254
+ def regenerate_webhook_secret(
1255
+ self,
1256
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
1257
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
1258
+ _request_timeout: Union[
1259
+ None,
1260
+ Annotated[StrictFloat, Field(gt=0)],
1261
+ Tuple[
1262
+ Annotated[StrictFloat, Field(gt=0)],
1263
+ Annotated[StrictFloat, Field(gt=0)]
1264
+ ]
1265
+ ] = None,
1266
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1267
+ _content_type: Optional[StrictStr] = None,
1268
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1269
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1270
+ ) -> V1WebhooksResourceWithSecret:
1271
+ """Regenerate webhook secret
1272
+
1273
+ Regenerate the webhook secret. The previous secret is immediately invalidated. The new secret is returned once.
1274
+
1275
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
1276
+ :type mailbox_resource_id: str
1277
+ :param webhook: Webhook identifier (UUID v7). (required)
1278
+ :type webhook: str
1279
+ :param _request_timeout: timeout setting for this request. If one
1280
+ number provided, it will be total request
1281
+ timeout. It can also be a pair (tuple) of
1282
+ (connection, read) timeouts.
1283
+ :type _request_timeout: int, tuple(int, int), optional
1284
+ :param _request_auth: set to override the auth_settings for an a single
1285
+ request; this effectively ignores the
1286
+ authentication in the spec for a single request.
1287
+ :type _request_auth: dict, optional
1288
+ :param _content_type: force content-type for the request.
1289
+ :type _content_type: str, Optional
1290
+ :param _headers: set to override the headers for a single
1291
+ request; this effectively ignores the headers
1292
+ in the spec for a single request.
1293
+ :type _headers: dict, optional
1294
+ :param _host_index: set to override the host_index for a single
1295
+ request; this effectively ignores the host_index
1296
+ in the spec for a single request.
1297
+ :type _host_index: int, optional
1298
+ :return: Returns the result object.
1299
+ """ # noqa: E501
1300
+
1301
+ _param = self._regenerate_webhook_secret_serialize(
1302
+ mailbox_resource_id=mailbox_resource_id,
1303
+ webhook=webhook,
1304
+ _request_auth=_request_auth,
1305
+ _content_type=_content_type,
1306
+ _headers=_headers,
1307
+ _host_index=_host_index
1308
+ )
1309
+
1310
+ _response_types_map: Dict[str, Optional[str]] = {
1311
+ '200': "V1WebhooksResourceWithSecret",
1312
+ '401': "Error",
1313
+ '403': "Error",
1314
+ '404': "Error",
1315
+ '500': "Error",
1316
+ '502': "Error",
1317
+ }
1318
+ response_data = self.api_client.call_api(
1319
+ *_param,
1320
+ _request_timeout=_request_timeout
1321
+ )
1322
+ response_data.read()
1323
+ return self.api_client.response_deserialize(
1324
+ response_data=response_data,
1325
+ response_types_map=_response_types_map,
1326
+ ).data
1327
+
1328
+
1329
+ @validate_call
1330
+ def regenerate_webhook_secret_with_http_info(
1331
+ self,
1332
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
1333
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
1334
+ _request_timeout: Union[
1335
+ None,
1336
+ Annotated[StrictFloat, Field(gt=0)],
1337
+ Tuple[
1338
+ Annotated[StrictFloat, Field(gt=0)],
1339
+ Annotated[StrictFloat, Field(gt=0)]
1340
+ ]
1341
+ ] = None,
1342
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1343
+ _content_type: Optional[StrictStr] = None,
1344
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1345
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1346
+ ) -> ApiResponse[V1WebhooksResourceWithSecret]:
1347
+ """Regenerate webhook secret
1348
+
1349
+ Regenerate the webhook secret. The previous secret is immediately invalidated. The new secret is returned once.
1350
+
1351
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
1352
+ :type mailbox_resource_id: str
1353
+ :param webhook: Webhook identifier (UUID v7). (required)
1354
+ :type webhook: str
1355
+ :param _request_timeout: timeout setting for this request. If one
1356
+ number provided, it will be total request
1357
+ timeout. It can also be a pair (tuple) of
1358
+ (connection, read) timeouts.
1359
+ :type _request_timeout: int, tuple(int, int), optional
1360
+ :param _request_auth: set to override the auth_settings for an a single
1361
+ request; this effectively ignores the
1362
+ authentication in the spec for a single request.
1363
+ :type _request_auth: dict, optional
1364
+ :param _content_type: force content-type for the request.
1365
+ :type _content_type: str, Optional
1366
+ :param _headers: set to override the headers for a single
1367
+ request; this effectively ignores the headers
1368
+ in the spec for a single request.
1369
+ :type _headers: dict, optional
1370
+ :param _host_index: set to override the host_index for a single
1371
+ request; this effectively ignores the host_index
1372
+ in the spec for a single request.
1373
+ :type _host_index: int, optional
1374
+ :return: Returns the result object.
1375
+ """ # noqa: E501
1376
+
1377
+ _param = self._regenerate_webhook_secret_serialize(
1378
+ mailbox_resource_id=mailbox_resource_id,
1379
+ webhook=webhook,
1380
+ _request_auth=_request_auth,
1381
+ _content_type=_content_type,
1382
+ _headers=_headers,
1383
+ _host_index=_host_index
1384
+ )
1385
+
1386
+ _response_types_map: Dict[str, Optional[str]] = {
1387
+ '200': "V1WebhooksResourceWithSecret",
1388
+ '401': "Error",
1389
+ '403': "Error",
1390
+ '404': "Error",
1391
+ '500': "Error",
1392
+ '502': "Error",
1393
+ }
1394
+ response_data = self.api_client.call_api(
1395
+ *_param,
1396
+ _request_timeout=_request_timeout
1397
+ )
1398
+ response_data.read()
1399
+ return self.api_client.response_deserialize(
1400
+ response_data=response_data,
1401
+ response_types_map=_response_types_map,
1402
+ )
1403
+
1404
+
1405
+ @validate_call
1406
+ def regenerate_webhook_secret_without_preload_content(
1407
+ self,
1408
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
1409
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
1410
+ _request_timeout: Union[
1411
+ None,
1412
+ Annotated[StrictFloat, Field(gt=0)],
1413
+ Tuple[
1414
+ Annotated[StrictFloat, Field(gt=0)],
1415
+ Annotated[StrictFloat, Field(gt=0)]
1416
+ ]
1417
+ ] = None,
1418
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1419
+ _content_type: Optional[StrictStr] = None,
1420
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1421
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1422
+ ) -> RESTResponseType:
1423
+ """Regenerate webhook secret
1424
+
1425
+ Regenerate the webhook secret. The previous secret is immediately invalidated. The new secret is returned once.
1426
+
1427
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
1428
+ :type mailbox_resource_id: str
1429
+ :param webhook: Webhook identifier (UUID v7). (required)
1430
+ :type webhook: str
1431
+ :param _request_timeout: timeout setting for this request. If one
1432
+ number provided, it will be total request
1433
+ timeout. It can also be a pair (tuple) of
1434
+ (connection, read) timeouts.
1435
+ :type _request_timeout: int, tuple(int, int), optional
1436
+ :param _request_auth: set to override the auth_settings for an a single
1437
+ request; this effectively ignores the
1438
+ authentication in the spec for a single request.
1439
+ :type _request_auth: dict, optional
1440
+ :param _content_type: force content-type for the request.
1441
+ :type _content_type: str, Optional
1442
+ :param _headers: set to override the headers for a single
1443
+ request; this effectively ignores the headers
1444
+ in the spec for a single request.
1445
+ :type _headers: dict, optional
1446
+ :param _host_index: set to override the host_index for a single
1447
+ request; this effectively ignores the host_index
1448
+ in the spec for a single request.
1449
+ :type _host_index: int, optional
1450
+ :return: Returns the result object.
1451
+ """ # noqa: E501
1452
+
1453
+ _param = self._regenerate_webhook_secret_serialize(
1454
+ mailbox_resource_id=mailbox_resource_id,
1455
+ webhook=webhook,
1456
+ _request_auth=_request_auth,
1457
+ _content_type=_content_type,
1458
+ _headers=_headers,
1459
+ _host_index=_host_index
1460
+ )
1461
+
1462
+ _response_types_map: Dict[str, Optional[str]] = {
1463
+ '200': "V1WebhooksResourceWithSecret",
1464
+ '401': "Error",
1465
+ '403': "Error",
1466
+ '404': "Error",
1467
+ '500': "Error",
1468
+ '502': "Error",
1469
+ }
1470
+ response_data = self.api_client.call_api(
1471
+ *_param,
1472
+ _request_timeout=_request_timeout
1473
+ )
1474
+ return response_data.response
1475
+
1476
+
1477
+ def _regenerate_webhook_secret_serialize(
1478
+ self,
1479
+ mailbox_resource_id,
1480
+ webhook,
1481
+ _request_auth,
1482
+ _content_type,
1483
+ _headers,
1484
+ _host_index,
1485
+ ) -> RequestSerialized:
1486
+
1487
+ _host = None
1488
+
1489
+ _collection_formats: Dict[str, str] = {
1490
+ }
1491
+
1492
+ _path_params: Dict[str, str] = {}
1493
+ _query_params: List[Tuple[str, str]] = []
1494
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1495
+ _form_params: List[Tuple[str, str]] = []
1496
+ _files: Dict[
1497
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1498
+ ] = {}
1499
+ _body_params: Optional[bytes] = None
1500
+
1501
+ # process the path parameters
1502
+ if mailbox_resource_id is not None:
1503
+ _path_params['mailboxResourceId'] = mailbox_resource_id
1504
+ if webhook is not None:
1505
+ _path_params['webhook'] = webhook
1506
+ # process the query parameters
1507
+ # process the header parameters
1508
+ # process the form parameters
1509
+ # process the body parameter
1510
+
1511
+
1512
+ # set the HTTP header `Accept`
1513
+ if 'Accept' not in _header_params:
1514
+ _header_params['Accept'] = self.api_client.select_header_accept(
1515
+ [
1516
+ 'application/json'
1517
+ ]
1518
+ )
1519
+
1520
+
1521
+ # authentication setting
1522
+ _auth_settings: List[str] = [
1523
+ 'BearerAuth'
1524
+ ]
1525
+
1526
+ return self.api_client.param_serialize(
1527
+ method='POST',
1528
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/webhooks/{webhook}/regenerate-secret',
1529
+ path_params=_path_params,
1530
+ query_params=_query_params,
1531
+ header_params=_header_params,
1532
+ body=_body_params,
1533
+ post_params=_form_params,
1534
+ files=_files,
1535
+ auth_settings=_auth_settings,
1536
+ collection_formats=_collection_formats,
1537
+ _host=_host,
1538
+ _request_auth=_request_auth
1539
+ )
1540
+
1541
+
1542
+
1543
+
1544
+ @validate_call
1545
+ def test_webhook(
1546
+ self,
1547
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
1548
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
1549
+ _request_timeout: Union[
1550
+ None,
1551
+ Annotated[StrictFloat, Field(gt=0)],
1552
+ Tuple[
1553
+ Annotated[StrictFloat, Field(gt=0)],
1554
+ Annotated[StrictFloat, Field(gt=0)]
1555
+ ]
1556
+ ] = None,
1557
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1558
+ _content_type: Optional[StrictStr] = None,
1559
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1560
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1561
+ ) -> V1WebhooksTestResult:
1562
+ """Test webhook
1563
+
1564
+ Send a test delivery to the webhook URL and return the upstream response.
1565
+
1566
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
1567
+ :type mailbox_resource_id: str
1568
+ :param webhook: Webhook identifier (UUID v7). (required)
1569
+ :type webhook: str
1570
+ :param _request_timeout: timeout setting for this request. If one
1571
+ number provided, it will be total request
1572
+ timeout. It can also be a pair (tuple) of
1573
+ (connection, read) timeouts.
1574
+ :type _request_timeout: int, tuple(int, int), optional
1575
+ :param _request_auth: set to override the auth_settings for an a single
1576
+ request; this effectively ignores the
1577
+ authentication in the spec for a single request.
1578
+ :type _request_auth: dict, optional
1579
+ :param _content_type: force content-type for the request.
1580
+ :type _content_type: str, Optional
1581
+ :param _headers: set to override the headers for a single
1582
+ request; this effectively ignores the headers
1583
+ in the spec for a single request.
1584
+ :type _headers: dict, optional
1585
+ :param _host_index: set to override the host_index for a single
1586
+ request; this effectively ignores the host_index
1587
+ in the spec for a single request.
1588
+ :type _host_index: int, optional
1589
+ :return: Returns the result object.
1590
+ """ # noqa: E501
1591
+
1592
+ _param = self._test_webhook_serialize(
1593
+ mailbox_resource_id=mailbox_resource_id,
1594
+ webhook=webhook,
1595
+ _request_auth=_request_auth,
1596
+ _content_type=_content_type,
1597
+ _headers=_headers,
1598
+ _host_index=_host_index
1599
+ )
1600
+
1601
+ _response_types_map: Dict[str, Optional[str]] = {
1602
+ '200': "V1WebhooksTestResult",
1603
+ '401': "Error",
1604
+ '403': "Error",
1605
+ '404': "Error",
1606
+ '500': "Error",
1607
+ '502': "Error",
1608
+ }
1609
+ response_data = self.api_client.call_api(
1610
+ *_param,
1611
+ _request_timeout=_request_timeout
1612
+ )
1613
+ response_data.read()
1614
+ return self.api_client.response_deserialize(
1615
+ response_data=response_data,
1616
+ response_types_map=_response_types_map,
1617
+ ).data
1618
+
1619
+
1620
+ @validate_call
1621
+ def test_webhook_with_http_info(
1622
+ self,
1623
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
1624
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
1625
+ _request_timeout: Union[
1626
+ None,
1627
+ Annotated[StrictFloat, Field(gt=0)],
1628
+ Tuple[
1629
+ Annotated[StrictFloat, Field(gt=0)],
1630
+ Annotated[StrictFloat, Field(gt=0)]
1631
+ ]
1632
+ ] = None,
1633
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1634
+ _content_type: Optional[StrictStr] = None,
1635
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1636
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1637
+ ) -> ApiResponse[V1WebhooksTestResult]:
1638
+ """Test webhook
1639
+
1640
+ Send a test delivery to the webhook URL and return the upstream response.
1641
+
1642
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
1643
+ :type mailbox_resource_id: str
1644
+ :param webhook: Webhook identifier (UUID v7). (required)
1645
+ :type webhook: str
1646
+ :param _request_timeout: timeout setting for this request. If one
1647
+ number provided, it will be total request
1648
+ timeout. It can also be a pair (tuple) of
1649
+ (connection, read) timeouts.
1650
+ :type _request_timeout: int, tuple(int, int), optional
1651
+ :param _request_auth: set to override the auth_settings for an a single
1652
+ request; this effectively ignores the
1653
+ authentication in the spec for a single request.
1654
+ :type _request_auth: dict, optional
1655
+ :param _content_type: force content-type for the request.
1656
+ :type _content_type: str, Optional
1657
+ :param _headers: set to override the headers for a single
1658
+ request; this effectively ignores the headers
1659
+ in the spec for a single request.
1660
+ :type _headers: dict, optional
1661
+ :param _host_index: set to override the host_index for a single
1662
+ request; this effectively ignores the host_index
1663
+ in the spec for a single request.
1664
+ :type _host_index: int, optional
1665
+ :return: Returns the result object.
1666
+ """ # noqa: E501
1667
+
1668
+ _param = self._test_webhook_serialize(
1669
+ mailbox_resource_id=mailbox_resource_id,
1670
+ webhook=webhook,
1671
+ _request_auth=_request_auth,
1672
+ _content_type=_content_type,
1673
+ _headers=_headers,
1674
+ _host_index=_host_index
1675
+ )
1676
+
1677
+ _response_types_map: Dict[str, Optional[str]] = {
1678
+ '200': "V1WebhooksTestResult",
1679
+ '401': "Error",
1680
+ '403': "Error",
1681
+ '404': "Error",
1682
+ '500': "Error",
1683
+ '502': "Error",
1684
+ }
1685
+ response_data = self.api_client.call_api(
1686
+ *_param,
1687
+ _request_timeout=_request_timeout
1688
+ )
1689
+ response_data.read()
1690
+ return self.api_client.response_deserialize(
1691
+ response_data=response_data,
1692
+ response_types_map=_response_types_map,
1693
+ )
1694
+
1695
+
1696
+ @validate_call
1697
+ def test_webhook_without_preload_content(
1698
+ self,
1699
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
1700
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
1701
+ _request_timeout: Union[
1702
+ None,
1703
+ Annotated[StrictFloat, Field(gt=0)],
1704
+ Tuple[
1705
+ Annotated[StrictFloat, Field(gt=0)],
1706
+ Annotated[StrictFloat, Field(gt=0)]
1707
+ ]
1708
+ ] = None,
1709
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1710
+ _content_type: Optional[StrictStr] = None,
1711
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1712
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1713
+ ) -> RESTResponseType:
1714
+ """Test webhook
1715
+
1716
+ Send a test delivery to the webhook URL and return the upstream response.
1717
+
1718
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
1719
+ :type mailbox_resource_id: str
1720
+ :param webhook: Webhook identifier (UUID v7). (required)
1721
+ :type webhook: str
1722
+ :param _request_timeout: timeout setting for this request. If one
1723
+ number provided, it will be total request
1724
+ timeout. It can also be a pair (tuple) of
1725
+ (connection, read) timeouts.
1726
+ :type _request_timeout: int, tuple(int, int), optional
1727
+ :param _request_auth: set to override the auth_settings for an a single
1728
+ request; this effectively ignores the
1729
+ authentication in the spec for a single request.
1730
+ :type _request_auth: dict, optional
1731
+ :param _content_type: force content-type for the request.
1732
+ :type _content_type: str, Optional
1733
+ :param _headers: set to override the headers for a single
1734
+ request; this effectively ignores the headers
1735
+ in the spec for a single request.
1736
+ :type _headers: dict, optional
1737
+ :param _host_index: set to override the host_index for a single
1738
+ request; this effectively ignores the host_index
1739
+ in the spec for a single request.
1740
+ :type _host_index: int, optional
1741
+ :return: Returns the result object.
1742
+ """ # noqa: E501
1743
+
1744
+ _param = self._test_webhook_serialize(
1745
+ mailbox_resource_id=mailbox_resource_id,
1746
+ webhook=webhook,
1747
+ _request_auth=_request_auth,
1748
+ _content_type=_content_type,
1749
+ _headers=_headers,
1750
+ _host_index=_host_index
1751
+ )
1752
+
1753
+ _response_types_map: Dict[str, Optional[str]] = {
1754
+ '200': "V1WebhooksTestResult",
1755
+ '401': "Error",
1756
+ '403': "Error",
1757
+ '404': "Error",
1758
+ '500': "Error",
1759
+ '502': "Error",
1760
+ }
1761
+ response_data = self.api_client.call_api(
1762
+ *_param,
1763
+ _request_timeout=_request_timeout
1764
+ )
1765
+ return response_data.response
1766
+
1767
+
1768
+ def _test_webhook_serialize(
1769
+ self,
1770
+ mailbox_resource_id,
1771
+ webhook,
1772
+ _request_auth,
1773
+ _content_type,
1774
+ _headers,
1775
+ _host_index,
1776
+ ) -> RequestSerialized:
1777
+
1778
+ _host = None
1779
+
1780
+ _collection_formats: Dict[str, str] = {
1781
+ }
1782
+
1783
+ _path_params: Dict[str, str] = {}
1784
+ _query_params: List[Tuple[str, str]] = []
1785
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1786
+ _form_params: List[Tuple[str, str]] = []
1787
+ _files: Dict[
1788
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1789
+ ] = {}
1790
+ _body_params: Optional[bytes] = None
1791
+
1792
+ # process the path parameters
1793
+ if mailbox_resource_id is not None:
1794
+ _path_params['mailboxResourceId'] = mailbox_resource_id
1795
+ if webhook is not None:
1796
+ _path_params['webhook'] = webhook
1797
+ # process the query parameters
1798
+ # process the header parameters
1799
+ # process the form parameters
1800
+ # process the body parameter
1801
+
1802
+
1803
+ # set the HTTP header `Accept`
1804
+ if 'Accept' not in _header_params:
1805
+ _header_params['Accept'] = self.api_client.select_header_accept(
1806
+ [
1807
+ 'application/json'
1808
+ ]
1809
+ )
1810
+
1811
+
1812
+ # authentication setting
1813
+ _auth_settings: List[str] = [
1814
+ 'BearerAuth'
1815
+ ]
1816
+
1817
+ return self.api_client.param_serialize(
1818
+ method='POST',
1819
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/webhooks/{webhook}/test',
1820
+ path_params=_path_params,
1821
+ query_params=_query_params,
1822
+ header_params=_header_params,
1823
+ body=_body_params,
1824
+ post_params=_form_params,
1825
+ files=_files,
1826
+ auth_settings=_auth_settings,
1827
+ collection_formats=_collection_formats,
1828
+ _host=_host,
1829
+ _request_auth=_request_auth
1830
+ )
1831
+
1832
+
1833
+
1834
+
1835
+ @validate_call
1836
+ def update_webhook(
1837
+ self,
1838
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
1839
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
1840
+ v1_webhooks_update_request: V1WebhooksUpdateRequest,
1841
+ _request_timeout: Union[
1842
+ None,
1843
+ Annotated[StrictFloat, Field(gt=0)],
1844
+ Tuple[
1845
+ Annotated[StrictFloat, Field(gt=0)],
1846
+ Annotated[StrictFloat, Field(gt=0)]
1847
+ ]
1848
+ ] = None,
1849
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1850
+ _content_type: Optional[StrictStr] = None,
1851
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1852
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1853
+ ) -> V1WebhooksResource:
1854
+ """Update webhook
1855
+
1856
+ Partially update a webhook.
1857
+
1858
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
1859
+ :type mailbox_resource_id: str
1860
+ :param webhook: Webhook identifier (UUID v7). (required)
1861
+ :type webhook: str
1862
+ :param v1_webhooks_update_request: (required)
1863
+ :type v1_webhooks_update_request: V1WebhooksUpdateRequest
1864
+ :param _request_timeout: timeout setting for this request. If one
1865
+ number provided, it will be total request
1866
+ timeout. It can also be a pair (tuple) of
1867
+ (connection, read) timeouts.
1868
+ :type _request_timeout: int, tuple(int, int), optional
1869
+ :param _request_auth: set to override the auth_settings for an a single
1870
+ request; this effectively ignores the
1871
+ authentication in the spec for a single request.
1872
+ :type _request_auth: dict, optional
1873
+ :param _content_type: force content-type for the request.
1874
+ :type _content_type: str, Optional
1875
+ :param _headers: set to override the headers for a single
1876
+ request; this effectively ignores the headers
1877
+ in the spec for a single request.
1878
+ :type _headers: dict, optional
1879
+ :param _host_index: set to override the host_index for a single
1880
+ request; this effectively ignores the host_index
1881
+ in the spec for a single request.
1882
+ :type _host_index: int, optional
1883
+ :return: Returns the result object.
1884
+ """ # noqa: E501
1885
+
1886
+ _param = self._update_webhook_serialize(
1887
+ mailbox_resource_id=mailbox_resource_id,
1888
+ webhook=webhook,
1889
+ v1_webhooks_update_request=v1_webhooks_update_request,
1890
+ _request_auth=_request_auth,
1891
+ _content_type=_content_type,
1892
+ _headers=_headers,
1893
+ _host_index=_host_index
1894
+ )
1895
+
1896
+ _response_types_map: Dict[str, Optional[str]] = {
1897
+ '200': "V1WebhooksResource",
1898
+ '401': "Error",
1899
+ '403': "Error",
1900
+ '404': "Error",
1901
+ '422': "Error",
1902
+ '500': "Error",
1903
+ '502': "Error",
1904
+ }
1905
+ response_data = self.api_client.call_api(
1906
+ *_param,
1907
+ _request_timeout=_request_timeout
1908
+ )
1909
+ response_data.read()
1910
+ return self.api_client.response_deserialize(
1911
+ response_data=response_data,
1912
+ response_types_map=_response_types_map,
1913
+ ).data
1914
+
1915
+
1916
+ @validate_call
1917
+ def update_webhook_with_http_info(
1918
+ self,
1919
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
1920
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
1921
+ v1_webhooks_update_request: V1WebhooksUpdateRequest,
1922
+ _request_timeout: Union[
1923
+ None,
1924
+ Annotated[StrictFloat, Field(gt=0)],
1925
+ Tuple[
1926
+ Annotated[StrictFloat, Field(gt=0)],
1927
+ Annotated[StrictFloat, Field(gt=0)]
1928
+ ]
1929
+ ] = None,
1930
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1931
+ _content_type: Optional[StrictStr] = None,
1932
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1933
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1934
+ ) -> ApiResponse[V1WebhooksResource]:
1935
+ """Update webhook
1936
+
1937
+ Partially update a webhook.
1938
+
1939
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
1940
+ :type mailbox_resource_id: str
1941
+ :param webhook: Webhook identifier (UUID v7). (required)
1942
+ :type webhook: str
1943
+ :param v1_webhooks_update_request: (required)
1944
+ :type v1_webhooks_update_request: V1WebhooksUpdateRequest
1945
+ :param _request_timeout: timeout setting for this request. If one
1946
+ number provided, it will be total request
1947
+ timeout. It can also be a pair (tuple) of
1948
+ (connection, read) timeouts.
1949
+ :type _request_timeout: int, tuple(int, int), optional
1950
+ :param _request_auth: set to override the auth_settings for an a single
1951
+ request; this effectively ignores the
1952
+ authentication in the spec for a single request.
1953
+ :type _request_auth: dict, optional
1954
+ :param _content_type: force content-type for the request.
1955
+ :type _content_type: str, Optional
1956
+ :param _headers: set to override the headers for a single
1957
+ request; this effectively ignores the headers
1958
+ in the spec for a single request.
1959
+ :type _headers: dict, optional
1960
+ :param _host_index: set to override the host_index for a single
1961
+ request; this effectively ignores the host_index
1962
+ in the spec for a single request.
1963
+ :type _host_index: int, optional
1964
+ :return: Returns the result object.
1965
+ """ # noqa: E501
1966
+
1967
+ _param = self._update_webhook_serialize(
1968
+ mailbox_resource_id=mailbox_resource_id,
1969
+ webhook=webhook,
1970
+ v1_webhooks_update_request=v1_webhooks_update_request,
1971
+ _request_auth=_request_auth,
1972
+ _content_type=_content_type,
1973
+ _headers=_headers,
1974
+ _host_index=_host_index
1975
+ )
1976
+
1977
+ _response_types_map: Dict[str, Optional[str]] = {
1978
+ '200': "V1WebhooksResource",
1979
+ '401': "Error",
1980
+ '403': "Error",
1981
+ '404': "Error",
1982
+ '422': "Error",
1983
+ '500': "Error",
1984
+ '502': "Error",
1985
+ }
1986
+ response_data = self.api_client.call_api(
1987
+ *_param,
1988
+ _request_timeout=_request_timeout
1989
+ )
1990
+ response_data.read()
1991
+ return self.api_client.response_deserialize(
1992
+ response_data=response_data,
1993
+ response_types_map=_response_types_map,
1994
+ )
1995
+
1996
+
1997
+ @validate_call
1998
+ def update_webhook_without_preload_content(
1999
+ self,
2000
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox.")],
2001
+ webhook: Annotated[StrictStr, Field(description="Webhook identifier (UUID v7).")],
2002
+ v1_webhooks_update_request: V1WebhooksUpdateRequest,
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
+ ) -> RESTResponseType:
2016
+ """Update webhook
2017
+
2018
+ Partially update a webhook.
2019
+
2020
+ :param mailbox_resource_id: Resource ID of the managed mailbox. (required)
2021
+ :type mailbox_resource_id: str
2022
+ :param webhook: Webhook identifier (UUID v7). (required)
2023
+ :type webhook: str
2024
+ :param v1_webhooks_update_request: (required)
2025
+ :type v1_webhooks_update_request: V1WebhooksUpdateRequest
2026
+ :param _request_timeout: timeout setting for this request. If one
2027
+ number provided, it will be total request
2028
+ timeout. It can also be a pair (tuple) of
2029
+ (connection, read) timeouts.
2030
+ :type _request_timeout: int, tuple(int, int), optional
2031
+ :param _request_auth: set to override the auth_settings for an a single
2032
+ request; this effectively ignores the
2033
+ authentication in the spec for a single request.
2034
+ :type _request_auth: dict, optional
2035
+ :param _content_type: force content-type for the request.
2036
+ :type _content_type: str, Optional
2037
+ :param _headers: set to override the headers for a single
2038
+ request; this effectively ignores the headers
2039
+ in the spec for a single request.
2040
+ :type _headers: dict, optional
2041
+ :param _host_index: set to override the host_index for a single
2042
+ request; this effectively ignores the host_index
2043
+ in the spec for a single request.
2044
+ :type _host_index: int, optional
2045
+ :return: Returns the result object.
2046
+ """ # noqa: E501
2047
+
2048
+ _param = self._update_webhook_serialize(
2049
+ mailbox_resource_id=mailbox_resource_id,
2050
+ webhook=webhook,
2051
+ v1_webhooks_update_request=v1_webhooks_update_request,
2052
+ _request_auth=_request_auth,
2053
+ _content_type=_content_type,
2054
+ _headers=_headers,
2055
+ _host_index=_host_index
2056
+ )
2057
+
2058
+ _response_types_map: Dict[str, Optional[str]] = {
2059
+ '200': "V1WebhooksResource",
2060
+ '401': "Error",
2061
+ '403': "Error",
2062
+ '404': "Error",
2063
+ '422': "Error",
2064
+ '500': "Error",
2065
+ '502': "Error",
2066
+ }
2067
+ response_data = self.api_client.call_api(
2068
+ *_param,
2069
+ _request_timeout=_request_timeout
2070
+ )
2071
+ return response_data.response
2072
+
2073
+
2074
+ def _update_webhook_serialize(
2075
+ self,
2076
+ mailbox_resource_id,
2077
+ webhook,
2078
+ v1_webhooks_update_request,
2079
+ _request_auth,
2080
+ _content_type,
2081
+ _headers,
2082
+ _host_index,
2083
+ ) -> RequestSerialized:
2084
+
2085
+ _host = None
2086
+
2087
+ _collection_formats: Dict[str, str] = {
2088
+ }
2089
+
2090
+ _path_params: Dict[str, str] = {}
2091
+ _query_params: List[Tuple[str, str]] = []
2092
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2093
+ _form_params: List[Tuple[str, str]] = []
2094
+ _files: Dict[
2095
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2096
+ ] = {}
2097
+ _body_params: Optional[bytes] = None
2098
+
2099
+ # process the path parameters
2100
+ if mailbox_resource_id is not None:
2101
+ _path_params['mailboxResourceId'] = mailbox_resource_id
2102
+ if webhook is not None:
2103
+ _path_params['webhook'] = webhook
2104
+ # process the query parameters
2105
+ # process the header parameters
2106
+ # process the form parameters
2107
+ # process the body parameter
2108
+ if v1_webhooks_update_request is not None:
2109
+ _body_params = v1_webhooks_update_request
2110
+
2111
+
2112
+ # set the HTTP header `Accept`
2113
+ if 'Accept' not in _header_params:
2114
+ _header_params['Accept'] = self.api_client.select_header_accept(
2115
+ [
2116
+ 'application/json'
2117
+ ]
2118
+ )
2119
+
2120
+ # set the HTTP header `Content-Type`
2121
+ if _content_type:
2122
+ _header_params['Content-Type'] = _content_type
2123
+ else:
2124
+ _default_content_type = (
2125
+ self.api_client.select_header_content_type(
2126
+ [
2127
+ 'application/json'
2128
+ ]
2129
+ )
2130
+ )
2131
+ if _default_content_type is not None:
2132
+ _header_params['Content-Type'] = _default_content_type
2133
+
2134
+ # authentication setting
2135
+ _auth_settings: List[str] = [
2136
+ 'BearerAuth'
2137
+ ]
2138
+
2139
+ return self.api_client.param_serialize(
2140
+ method='PATCH',
2141
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/webhooks/{webhook}',
2142
+ path_params=_path_params,
2143
+ query_params=_query_params,
2144
+ header_params=_header_params,
2145
+ body=_body_params,
2146
+ post_params=_form_params,
2147
+ files=_files,
2148
+ auth_settings=_auth_settings,
2149
+ collection_formats=_collection_formats,
2150
+ _host=_host,
2151
+ _request_auth=_request_auth
2152
+ )
2153
+
2154
+