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,4237 @@
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, StrictBytes, StrictStr
18
+ from typing import Optional, Tuple, Union
19
+ from typing_extensions import Annotated
20
+ from hostinger_mail_api.models.v1_folder_messages_collection import V1FolderMessagesCollection
21
+ from hostinger_mail_api.models.v1_folder_messages_delete_bulk_request import V1FolderMessagesDeleteBulkRequest
22
+ from hostinger_mail_api.models.v1_folder_messages_flags_bulk_request import V1FolderMessagesFlagsBulkRequest
23
+ from hostinger_mail_api.models.v1_folder_messages_flags_request import V1FolderMessagesFlagsRequest
24
+ from hostinger_mail_api.models.v1_folder_messages_message_text_resource import V1FolderMessagesMessageTextResource
25
+ from hostinger_mail_api.models.v1_folder_messages_move_bulk_request import V1FolderMessagesMoveBulkRequest
26
+ from hostinger_mail_api.models.v1_folder_messages_move_request import V1FolderMessagesMoveRequest
27
+ from hostinger_mail_api.models.v1_folder_messages_resource import V1FolderMessagesResource
28
+ from hostinger_mail_api.models.v1_folder_messages_search_request import V1FolderMessagesSearchRequest
29
+ from hostinger_mail_api.models.v1_folder_messages_update_flags_result import V1FolderMessagesUpdateFlagsResult
30
+
31
+ from hostinger_mail_api.api_client import ApiClient, RequestSerialized
32
+ from hostinger_mail_api.api_response import ApiResponse
33
+ from hostinger_mail_api.rest import RESTResponseType
34
+
35
+
36
+ class MessagesApi:
37
+
38
+ def __init__(self, api_client=None) -> None:
39
+ if api_client is None:
40
+ api_client = ApiClient.get_default()
41
+ self.api_client = api_client
42
+
43
+
44
+ @validate_call
45
+ def delete_all_messages(
46
+ self,
47
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
48
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
49
+ _request_timeout: Union[
50
+ None,
51
+ Annotated[StrictFloat, Field(gt=0)],
52
+ Tuple[
53
+ Annotated[StrictFloat, Field(gt=0)],
54
+ Annotated[StrictFloat, Field(gt=0)]
55
+ ]
56
+ ] = None,
57
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
58
+ _content_type: Optional[StrictStr] = None,
59
+ _headers: Optional[Dict[StrictStr, Any]] = None,
60
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
61
+ ) -> None:
62
+ """Delete all messages
63
+
64
+ Permanently delete every message in a folder (empty the folder).
65
+
66
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
67
+ :type mailbox_resource_id: str
68
+ :param folder: Folder path (URL-encoded). (required)
69
+ :type folder: str
70
+ :param _request_timeout: timeout setting for this request. If one
71
+ number provided, it will be total request
72
+ timeout. It can also be a pair (tuple) of
73
+ (connection, read) timeouts.
74
+ :type _request_timeout: int, tuple(int, int), optional
75
+ :param _request_auth: set to override the auth_settings for an a single
76
+ request; this effectively ignores the
77
+ authentication in the spec for a single request.
78
+ :type _request_auth: dict, optional
79
+ :param _content_type: force content-type for the request.
80
+ :type _content_type: str, Optional
81
+ :param _headers: set to override the headers for a single
82
+ request; this effectively ignores the headers
83
+ in the spec for a single request.
84
+ :type _headers: dict, optional
85
+ :param _host_index: set to override the host_index for a single
86
+ request; this effectively ignores the host_index
87
+ in the spec for a single request.
88
+ :type _host_index: int, optional
89
+ :return: Returns the result object.
90
+ """ # noqa: E501
91
+
92
+ _param = self._delete_all_messages_serialize(
93
+ mailbox_resource_id=mailbox_resource_id,
94
+ folder=folder,
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
+ '204': None,
103
+ '401': "Error",
104
+ '403': "Error",
105
+ '404': "Error",
106
+ '422': "Error",
107
+ '500': "Error",
108
+ '502': "Error",
109
+ }
110
+ response_data = self.api_client.call_api(
111
+ *_param,
112
+ _request_timeout=_request_timeout
113
+ )
114
+ response_data.read()
115
+ return self.api_client.response_deserialize(
116
+ response_data=response_data,
117
+ response_types_map=_response_types_map,
118
+ ).data
119
+
120
+
121
+ @validate_call
122
+ def delete_all_messages_with_http_info(
123
+ self,
124
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
125
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
126
+ _request_timeout: Union[
127
+ None,
128
+ Annotated[StrictFloat, Field(gt=0)],
129
+ Tuple[
130
+ Annotated[StrictFloat, Field(gt=0)],
131
+ Annotated[StrictFloat, Field(gt=0)]
132
+ ]
133
+ ] = None,
134
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
135
+ _content_type: Optional[StrictStr] = None,
136
+ _headers: Optional[Dict[StrictStr, Any]] = None,
137
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
138
+ ) -> ApiResponse[None]:
139
+ """Delete all messages
140
+
141
+ Permanently delete every message in a folder (empty the folder).
142
+
143
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
144
+ :type mailbox_resource_id: str
145
+ :param folder: Folder path (URL-encoded). (required)
146
+ :type folder: str
147
+ :param _request_timeout: timeout setting for this request. If one
148
+ number provided, it will be total request
149
+ timeout. It can also be a pair (tuple) of
150
+ (connection, read) timeouts.
151
+ :type _request_timeout: int, tuple(int, int), optional
152
+ :param _request_auth: set to override the auth_settings for an a single
153
+ request; this effectively ignores the
154
+ authentication in the spec for a single request.
155
+ :type _request_auth: dict, optional
156
+ :param _content_type: force content-type for the request.
157
+ :type _content_type: str, Optional
158
+ :param _headers: set to override the headers for a single
159
+ request; this effectively ignores the headers
160
+ in the spec for a single request.
161
+ :type _headers: dict, optional
162
+ :param _host_index: set to override the host_index for a single
163
+ request; this effectively ignores the host_index
164
+ in the spec for a single request.
165
+ :type _host_index: int, optional
166
+ :return: Returns the result object.
167
+ """ # noqa: E501
168
+
169
+ _param = self._delete_all_messages_serialize(
170
+ mailbox_resource_id=mailbox_resource_id,
171
+ folder=folder,
172
+ _request_auth=_request_auth,
173
+ _content_type=_content_type,
174
+ _headers=_headers,
175
+ _host_index=_host_index
176
+ )
177
+
178
+ _response_types_map: Dict[str, Optional[str]] = {
179
+ '204': None,
180
+ '401': "Error",
181
+ '403': "Error",
182
+ '404': "Error",
183
+ '422': "Error",
184
+ '500': "Error",
185
+ '502': "Error",
186
+ }
187
+ response_data = self.api_client.call_api(
188
+ *_param,
189
+ _request_timeout=_request_timeout
190
+ )
191
+ response_data.read()
192
+ return self.api_client.response_deserialize(
193
+ response_data=response_data,
194
+ response_types_map=_response_types_map,
195
+ )
196
+
197
+
198
+ @validate_call
199
+ def delete_all_messages_without_preload_content(
200
+ self,
201
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
202
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
203
+ _request_timeout: Union[
204
+ None,
205
+ Annotated[StrictFloat, Field(gt=0)],
206
+ Tuple[
207
+ Annotated[StrictFloat, Field(gt=0)],
208
+ Annotated[StrictFloat, Field(gt=0)]
209
+ ]
210
+ ] = None,
211
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
212
+ _content_type: Optional[StrictStr] = None,
213
+ _headers: Optional[Dict[StrictStr, Any]] = None,
214
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
215
+ ) -> RESTResponseType:
216
+ """Delete all messages
217
+
218
+ Permanently delete every message in a folder (empty the folder).
219
+
220
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
221
+ :type mailbox_resource_id: str
222
+ :param folder: Folder path (URL-encoded). (required)
223
+ :type folder: str
224
+ :param _request_timeout: timeout setting for this request. If one
225
+ number provided, it will be total request
226
+ timeout. It can also be a pair (tuple) of
227
+ (connection, read) timeouts.
228
+ :type _request_timeout: int, tuple(int, int), optional
229
+ :param _request_auth: set to override the auth_settings for an a single
230
+ request; this effectively ignores the
231
+ authentication in the spec for a single request.
232
+ :type _request_auth: dict, optional
233
+ :param _content_type: force content-type for the request.
234
+ :type _content_type: str, Optional
235
+ :param _headers: set to override the headers for a single
236
+ request; this effectively ignores the headers
237
+ in the spec for a single request.
238
+ :type _headers: dict, optional
239
+ :param _host_index: set to override the host_index for a single
240
+ request; this effectively ignores the host_index
241
+ in the spec for a single request.
242
+ :type _host_index: int, optional
243
+ :return: Returns the result object.
244
+ """ # noqa: E501
245
+
246
+ _param = self._delete_all_messages_serialize(
247
+ mailbox_resource_id=mailbox_resource_id,
248
+ folder=folder,
249
+ _request_auth=_request_auth,
250
+ _content_type=_content_type,
251
+ _headers=_headers,
252
+ _host_index=_host_index
253
+ )
254
+
255
+ _response_types_map: Dict[str, Optional[str]] = {
256
+ '204': None,
257
+ '401': "Error",
258
+ '403': "Error",
259
+ '404': "Error",
260
+ '422': "Error",
261
+ '500': "Error",
262
+ '502': "Error",
263
+ }
264
+ response_data = self.api_client.call_api(
265
+ *_param,
266
+ _request_timeout=_request_timeout
267
+ )
268
+ return response_data.response
269
+
270
+
271
+ def _delete_all_messages_serialize(
272
+ self,
273
+ mailbox_resource_id,
274
+ folder,
275
+ _request_auth,
276
+ _content_type,
277
+ _headers,
278
+ _host_index,
279
+ ) -> RequestSerialized:
280
+
281
+ _host = None
282
+
283
+ _collection_formats: Dict[str, str] = {
284
+ }
285
+
286
+ _path_params: Dict[str, str] = {}
287
+ _query_params: List[Tuple[str, str]] = []
288
+ _header_params: Dict[str, Optional[str]] = _headers or {}
289
+ _form_params: List[Tuple[str, str]] = []
290
+ _files: Dict[
291
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
292
+ ] = {}
293
+ _body_params: Optional[bytes] = None
294
+
295
+ # process the path parameters
296
+ if mailbox_resource_id is not None:
297
+ _path_params['mailboxResourceId'] = mailbox_resource_id
298
+ if folder is not None:
299
+ _path_params['folder'] = folder
300
+ # process the query parameters
301
+ # process the header parameters
302
+ # process the form parameters
303
+ # process the body parameter
304
+
305
+
306
+ # set the HTTP header `Accept`
307
+ if 'Accept' not in _header_params:
308
+ _header_params['Accept'] = self.api_client.select_header_accept(
309
+ [
310
+ 'application/json'
311
+ ]
312
+ )
313
+
314
+
315
+ # authentication setting
316
+ _auth_settings: List[str] = [
317
+ 'BearerAuth'
318
+ ]
319
+
320
+ return self.api_client.param_serialize(
321
+ method='DELETE',
322
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages',
323
+ path_params=_path_params,
324
+ query_params=_query_params,
325
+ header_params=_header_params,
326
+ body=_body_params,
327
+ post_params=_form_params,
328
+ files=_files,
329
+ auth_settings=_auth_settings,
330
+ collection_formats=_collection_formats,
331
+ _host=_host,
332
+ _request_auth=_request_auth
333
+ )
334
+
335
+
336
+
337
+
338
+ @validate_call
339
+ def delete_message(
340
+ self,
341
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
342
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
343
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
344
+ _request_timeout: Union[
345
+ None,
346
+ Annotated[StrictFloat, Field(gt=0)],
347
+ Tuple[
348
+ Annotated[StrictFloat, Field(gt=0)],
349
+ Annotated[StrictFloat, Field(gt=0)]
350
+ ]
351
+ ] = None,
352
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
353
+ _content_type: Optional[StrictStr] = None,
354
+ _headers: Optional[Dict[StrictStr, Any]] = None,
355
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
356
+ ) -> None:
357
+ """Delete message
358
+
359
+ Permanently delete a single message.
360
+
361
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
362
+ :type mailbox_resource_id: str
363
+ :param folder: Folder path (URL-encoded). (required)
364
+ :type folder: str
365
+ :param uid: Message UID. (required)
366
+ :type uid: int
367
+ :param _request_timeout: timeout setting for this request. If one
368
+ number provided, it will be total request
369
+ timeout. It can also be a pair (tuple) of
370
+ (connection, read) timeouts.
371
+ :type _request_timeout: int, tuple(int, int), optional
372
+ :param _request_auth: set to override the auth_settings for an a single
373
+ request; this effectively ignores the
374
+ authentication in the spec for a single request.
375
+ :type _request_auth: dict, optional
376
+ :param _content_type: force content-type for the request.
377
+ :type _content_type: str, Optional
378
+ :param _headers: set to override the headers for a single
379
+ request; this effectively ignores the headers
380
+ in the spec for a single request.
381
+ :type _headers: dict, optional
382
+ :param _host_index: set to override the host_index for a single
383
+ request; this effectively ignores the host_index
384
+ in the spec for a single request.
385
+ :type _host_index: int, optional
386
+ :return: Returns the result object.
387
+ """ # noqa: E501
388
+
389
+ _param = self._delete_message_serialize(
390
+ mailbox_resource_id=mailbox_resource_id,
391
+ folder=folder,
392
+ uid=uid,
393
+ _request_auth=_request_auth,
394
+ _content_type=_content_type,
395
+ _headers=_headers,
396
+ _host_index=_host_index
397
+ )
398
+
399
+ _response_types_map: Dict[str, Optional[str]] = {
400
+ '204': None,
401
+ '401': "Error",
402
+ '403': "Error",
403
+ '422': "Error",
404
+ '500': "Error",
405
+ '502': "Error",
406
+ }
407
+ response_data = self.api_client.call_api(
408
+ *_param,
409
+ _request_timeout=_request_timeout
410
+ )
411
+ response_data.read()
412
+ return self.api_client.response_deserialize(
413
+ response_data=response_data,
414
+ response_types_map=_response_types_map,
415
+ ).data
416
+
417
+
418
+ @validate_call
419
+ def delete_message_with_http_info(
420
+ self,
421
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
422
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
423
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
424
+ _request_timeout: Union[
425
+ None,
426
+ Annotated[StrictFloat, Field(gt=0)],
427
+ Tuple[
428
+ Annotated[StrictFloat, Field(gt=0)],
429
+ Annotated[StrictFloat, Field(gt=0)]
430
+ ]
431
+ ] = None,
432
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
433
+ _content_type: Optional[StrictStr] = None,
434
+ _headers: Optional[Dict[StrictStr, Any]] = None,
435
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
436
+ ) -> ApiResponse[None]:
437
+ """Delete message
438
+
439
+ Permanently delete a single message.
440
+
441
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
442
+ :type mailbox_resource_id: str
443
+ :param folder: Folder path (URL-encoded). (required)
444
+ :type folder: str
445
+ :param uid: Message UID. (required)
446
+ :type uid: int
447
+ :param _request_timeout: timeout setting for this request. If one
448
+ number provided, it will be total request
449
+ timeout. It can also be a pair (tuple) of
450
+ (connection, read) timeouts.
451
+ :type _request_timeout: int, tuple(int, int), optional
452
+ :param _request_auth: set to override the auth_settings for an a single
453
+ request; this effectively ignores the
454
+ authentication in the spec for a single request.
455
+ :type _request_auth: dict, optional
456
+ :param _content_type: force content-type for the request.
457
+ :type _content_type: str, Optional
458
+ :param _headers: set to override the headers for a single
459
+ request; this effectively ignores the headers
460
+ in the spec for a single request.
461
+ :type _headers: dict, optional
462
+ :param _host_index: set to override the host_index for a single
463
+ request; this effectively ignores the host_index
464
+ in the spec for a single request.
465
+ :type _host_index: int, optional
466
+ :return: Returns the result object.
467
+ """ # noqa: E501
468
+
469
+ _param = self._delete_message_serialize(
470
+ mailbox_resource_id=mailbox_resource_id,
471
+ folder=folder,
472
+ uid=uid,
473
+ _request_auth=_request_auth,
474
+ _content_type=_content_type,
475
+ _headers=_headers,
476
+ _host_index=_host_index
477
+ )
478
+
479
+ _response_types_map: Dict[str, Optional[str]] = {
480
+ '204': None,
481
+ '401': "Error",
482
+ '403': "Error",
483
+ '422': "Error",
484
+ '500': "Error",
485
+ '502': "Error",
486
+ }
487
+ response_data = self.api_client.call_api(
488
+ *_param,
489
+ _request_timeout=_request_timeout
490
+ )
491
+ response_data.read()
492
+ return self.api_client.response_deserialize(
493
+ response_data=response_data,
494
+ response_types_map=_response_types_map,
495
+ )
496
+
497
+
498
+ @validate_call
499
+ def delete_message_without_preload_content(
500
+ self,
501
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
502
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
503
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
504
+ _request_timeout: Union[
505
+ None,
506
+ Annotated[StrictFloat, Field(gt=0)],
507
+ Tuple[
508
+ Annotated[StrictFloat, Field(gt=0)],
509
+ Annotated[StrictFloat, Field(gt=0)]
510
+ ]
511
+ ] = None,
512
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
513
+ _content_type: Optional[StrictStr] = None,
514
+ _headers: Optional[Dict[StrictStr, Any]] = None,
515
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
516
+ ) -> RESTResponseType:
517
+ """Delete message
518
+
519
+ Permanently delete a single message.
520
+
521
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
522
+ :type mailbox_resource_id: str
523
+ :param folder: Folder path (URL-encoded). (required)
524
+ :type folder: str
525
+ :param uid: Message UID. (required)
526
+ :type uid: int
527
+ :param _request_timeout: timeout setting for this request. If one
528
+ number provided, it will be total request
529
+ timeout. It can also be a pair (tuple) of
530
+ (connection, read) timeouts.
531
+ :type _request_timeout: int, tuple(int, int), optional
532
+ :param _request_auth: set to override the auth_settings for an a single
533
+ request; this effectively ignores the
534
+ authentication in the spec for a single request.
535
+ :type _request_auth: dict, optional
536
+ :param _content_type: force content-type for the request.
537
+ :type _content_type: str, Optional
538
+ :param _headers: set to override the headers for a single
539
+ request; this effectively ignores the headers
540
+ in the spec for a single request.
541
+ :type _headers: dict, optional
542
+ :param _host_index: set to override the host_index for a single
543
+ request; this effectively ignores the host_index
544
+ in the spec for a single request.
545
+ :type _host_index: int, optional
546
+ :return: Returns the result object.
547
+ """ # noqa: E501
548
+
549
+ _param = self._delete_message_serialize(
550
+ mailbox_resource_id=mailbox_resource_id,
551
+ folder=folder,
552
+ uid=uid,
553
+ _request_auth=_request_auth,
554
+ _content_type=_content_type,
555
+ _headers=_headers,
556
+ _host_index=_host_index
557
+ )
558
+
559
+ _response_types_map: Dict[str, Optional[str]] = {
560
+ '204': None,
561
+ '401': "Error",
562
+ '403': "Error",
563
+ '422': "Error",
564
+ '500': "Error",
565
+ '502': "Error",
566
+ }
567
+ response_data = self.api_client.call_api(
568
+ *_param,
569
+ _request_timeout=_request_timeout
570
+ )
571
+ return response_data.response
572
+
573
+
574
+ def _delete_message_serialize(
575
+ self,
576
+ mailbox_resource_id,
577
+ folder,
578
+ uid,
579
+ _request_auth,
580
+ _content_type,
581
+ _headers,
582
+ _host_index,
583
+ ) -> RequestSerialized:
584
+
585
+ _host = None
586
+
587
+ _collection_formats: Dict[str, str] = {
588
+ }
589
+
590
+ _path_params: Dict[str, str] = {}
591
+ _query_params: List[Tuple[str, str]] = []
592
+ _header_params: Dict[str, Optional[str]] = _headers or {}
593
+ _form_params: List[Tuple[str, str]] = []
594
+ _files: Dict[
595
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
596
+ ] = {}
597
+ _body_params: Optional[bytes] = None
598
+
599
+ # process the path parameters
600
+ if mailbox_resource_id is not None:
601
+ _path_params['mailboxResourceId'] = mailbox_resource_id
602
+ if folder is not None:
603
+ _path_params['folder'] = folder
604
+ if uid is not None:
605
+ _path_params['uid'] = uid
606
+ # process the query parameters
607
+ # process the header parameters
608
+ # process the form parameters
609
+ # process the body parameter
610
+
611
+
612
+ # set the HTTP header `Accept`
613
+ if 'Accept' not in _header_params:
614
+ _header_params['Accept'] = self.api_client.select_header_accept(
615
+ [
616
+ 'application/json'
617
+ ]
618
+ )
619
+
620
+
621
+ # authentication setting
622
+ _auth_settings: List[str] = [
623
+ 'BearerAuth'
624
+ ]
625
+
626
+ return self.api_client.param_serialize(
627
+ method='DELETE',
628
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages/{uid}',
629
+ path_params=_path_params,
630
+ query_params=_query_params,
631
+ header_params=_header_params,
632
+ body=_body_params,
633
+ post_params=_form_params,
634
+ files=_files,
635
+ auth_settings=_auth_settings,
636
+ collection_formats=_collection_formats,
637
+ _host=_host,
638
+ _request_auth=_request_auth
639
+ )
640
+
641
+
642
+
643
+
644
+ @validate_call
645
+ def delete_messages(
646
+ self,
647
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
648
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
649
+ v1_folder_messages_delete_bulk_request: V1FolderMessagesDeleteBulkRequest,
650
+ _request_timeout: Union[
651
+ None,
652
+ Annotated[StrictFloat, Field(gt=0)],
653
+ Tuple[
654
+ Annotated[StrictFloat, Field(gt=0)],
655
+ Annotated[StrictFloat, Field(gt=0)]
656
+ ]
657
+ ] = None,
658
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
659
+ _content_type: Optional[StrictStr] = None,
660
+ _headers: Optional[Dict[StrictStr, Any]] = None,
661
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
662
+ ) -> None:
663
+ """Delete messages
664
+
665
+ Permanently delete multiple messages from a folder.
666
+
667
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
668
+ :type mailbox_resource_id: str
669
+ :param folder: Folder path (URL-encoded). (required)
670
+ :type folder: str
671
+ :param v1_folder_messages_delete_bulk_request: (required)
672
+ :type v1_folder_messages_delete_bulk_request: V1FolderMessagesDeleteBulkRequest
673
+ :param _request_timeout: timeout setting for this request. If one
674
+ number provided, it will be total request
675
+ timeout. It can also be a pair (tuple) of
676
+ (connection, read) timeouts.
677
+ :type _request_timeout: int, tuple(int, int), optional
678
+ :param _request_auth: set to override the auth_settings for an a single
679
+ request; this effectively ignores the
680
+ authentication in the spec for a single request.
681
+ :type _request_auth: dict, optional
682
+ :param _content_type: force content-type for the request.
683
+ :type _content_type: str, Optional
684
+ :param _headers: set to override the headers for a single
685
+ request; this effectively ignores the headers
686
+ in the spec for a single request.
687
+ :type _headers: dict, optional
688
+ :param _host_index: set to override the host_index for a single
689
+ request; this effectively ignores the host_index
690
+ in the spec for a single request.
691
+ :type _host_index: int, optional
692
+ :return: Returns the result object.
693
+ """ # noqa: E501
694
+
695
+ _param = self._delete_messages_serialize(
696
+ mailbox_resource_id=mailbox_resource_id,
697
+ folder=folder,
698
+ v1_folder_messages_delete_bulk_request=v1_folder_messages_delete_bulk_request,
699
+ _request_auth=_request_auth,
700
+ _content_type=_content_type,
701
+ _headers=_headers,
702
+ _host_index=_host_index
703
+ )
704
+
705
+ _response_types_map: Dict[str, Optional[str]] = {
706
+ '204': None,
707
+ '401': "Error",
708
+ '403': "Error",
709
+ '422': "Error",
710
+ '500': "Error",
711
+ '502': "Error",
712
+ }
713
+ response_data = self.api_client.call_api(
714
+ *_param,
715
+ _request_timeout=_request_timeout
716
+ )
717
+ response_data.read()
718
+ return self.api_client.response_deserialize(
719
+ response_data=response_data,
720
+ response_types_map=_response_types_map,
721
+ ).data
722
+
723
+
724
+ @validate_call
725
+ def delete_messages_with_http_info(
726
+ self,
727
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
728
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
729
+ v1_folder_messages_delete_bulk_request: V1FolderMessagesDeleteBulkRequest,
730
+ _request_timeout: Union[
731
+ None,
732
+ Annotated[StrictFloat, Field(gt=0)],
733
+ Tuple[
734
+ Annotated[StrictFloat, Field(gt=0)],
735
+ Annotated[StrictFloat, Field(gt=0)]
736
+ ]
737
+ ] = None,
738
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
739
+ _content_type: Optional[StrictStr] = None,
740
+ _headers: Optional[Dict[StrictStr, Any]] = None,
741
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
742
+ ) -> ApiResponse[None]:
743
+ """Delete messages
744
+
745
+ Permanently delete multiple messages from a folder.
746
+
747
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
748
+ :type mailbox_resource_id: str
749
+ :param folder: Folder path (URL-encoded). (required)
750
+ :type folder: str
751
+ :param v1_folder_messages_delete_bulk_request: (required)
752
+ :type v1_folder_messages_delete_bulk_request: V1FolderMessagesDeleteBulkRequest
753
+ :param _request_timeout: timeout setting for this request. If one
754
+ number provided, it will be total request
755
+ timeout. It can also be a pair (tuple) of
756
+ (connection, read) timeouts.
757
+ :type _request_timeout: int, tuple(int, int), optional
758
+ :param _request_auth: set to override the auth_settings for an a single
759
+ request; this effectively ignores the
760
+ authentication in the spec for a single request.
761
+ :type _request_auth: dict, optional
762
+ :param _content_type: force content-type for the request.
763
+ :type _content_type: str, Optional
764
+ :param _headers: set to override the headers for a single
765
+ request; this effectively ignores the headers
766
+ in the spec for a single request.
767
+ :type _headers: dict, optional
768
+ :param _host_index: set to override the host_index for a single
769
+ request; this effectively ignores the host_index
770
+ in the spec for a single request.
771
+ :type _host_index: int, optional
772
+ :return: Returns the result object.
773
+ """ # noqa: E501
774
+
775
+ _param = self._delete_messages_serialize(
776
+ mailbox_resource_id=mailbox_resource_id,
777
+ folder=folder,
778
+ v1_folder_messages_delete_bulk_request=v1_folder_messages_delete_bulk_request,
779
+ _request_auth=_request_auth,
780
+ _content_type=_content_type,
781
+ _headers=_headers,
782
+ _host_index=_host_index
783
+ )
784
+
785
+ _response_types_map: Dict[str, Optional[str]] = {
786
+ '204': None,
787
+ '401': "Error",
788
+ '403': "Error",
789
+ '422': "Error",
790
+ '500': "Error",
791
+ '502': "Error",
792
+ }
793
+ response_data = self.api_client.call_api(
794
+ *_param,
795
+ _request_timeout=_request_timeout
796
+ )
797
+ response_data.read()
798
+ return self.api_client.response_deserialize(
799
+ response_data=response_data,
800
+ response_types_map=_response_types_map,
801
+ )
802
+
803
+
804
+ @validate_call
805
+ def delete_messages_without_preload_content(
806
+ self,
807
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
808
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
809
+ v1_folder_messages_delete_bulk_request: V1FolderMessagesDeleteBulkRequest,
810
+ _request_timeout: Union[
811
+ None,
812
+ Annotated[StrictFloat, Field(gt=0)],
813
+ Tuple[
814
+ Annotated[StrictFloat, Field(gt=0)],
815
+ Annotated[StrictFloat, Field(gt=0)]
816
+ ]
817
+ ] = None,
818
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
819
+ _content_type: Optional[StrictStr] = None,
820
+ _headers: Optional[Dict[StrictStr, Any]] = None,
821
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
822
+ ) -> RESTResponseType:
823
+ """Delete messages
824
+
825
+ Permanently delete multiple messages from a folder.
826
+
827
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
828
+ :type mailbox_resource_id: str
829
+ :param folder: Folder path (URL-encoded). (required)
830
+ :type folder: str
831
+ :param v1_folder_messages_delete_bulk_request: (required)
832
+ :type v1_folder_messages_delete_bulk_request: V1FolderMessagesDeleteBulkRequest
833
+ :param _request_timeout: timeout setting for this request. If one
834
+ number provided, it will be total request
835
+ timeout. It can also be a pair (tuple) of
836
+ (connection, read) timeouts.
837
+ :type _request_timeout: int, tuple(int, int), optional
838
+ :param _request_auth: set to override the auth_settings for an a single
839
+ request; this effectively ignores the
840
+ authentication in the spec for a single request.
841
+ :type _request_auth: dict, optional
842
+ :param _content_type: force content-type for the request.
843
+ :type _content_type: str, Optional
844
+ :param _headers: set to override the headers for a single
845
+ request; this effectively ignores the headers
846
+ in the spec for a single request.
847
+ :type _headers: dict, optional
848
+ :param _host_index: set to override the host_index for a single
849
+ request; this effectively ignores the host_index
850
+ in the spec for a single request.
851
+ :type _host_index: int, optional
852
+ :return: Returns the result object.
853
+ """ # noqa: E501
854
+
855
+ _param = self._delete_messages_serialize(
856
+ mailbox_resource_id=mailbox_resource_id,
857
+ folder=folder,
858
+ v1_folder_messages_delete_bulk_request=v1_folder_messages_delete_bulk_request,
859
+ _request_auth=_request_auth,
860
+ _content_type=_content_type,
861
+ _headers=_headers,
862
+ _host_index=_host_index
863
+ )
864
+
865
+ _response_types_map: Dict[str, Optional[str]] = {
866
+ '204': None,
867
+ '401': "Error",
868
+ '403': "Error",
869
+ '422': "Error",
870
+ '500': "Error",
871
+ '502': "Error",
872
+ }
873
+ response_data = self.api_client.call_api(
874
+ *_param,
875
+ _request_timeout=_request_timeout
876
+ )
877
+ return response_data.response
878
+
879
+
880
+ def _delete_messages_serialize(
881
+ self,
882
+ mailbox_resource_id,
883
+ folder,
884
+ v1_folder_messages_delete_bulk_request,
885
+ _request_auth,
886
+ _content_type,
887
+ _headers,
888
+ _host_index,
889
+ ) -> RequestSerialized:
890
+
891
+ _host = None
892
+
893
+ _collection_formats: Dict[str, str] = {
894
+ }
895
+
896
+ _path_params: Dict[str, str] = {}
897
+ _query_params: List[Tuple[str, str]] = []
898
+ _header_params: Dict[str, Optional[str]] = _headers or {}
899
+ _form_params: List[Tuple[str, str]] = []
900
+ _files: Dict[
901
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
902
+ ] = {}
903
+ _body_params: Optional[bytes] = None
904
+
905
+ # process the path parameters
906
+ if mailbox_resource_id is not None:
907
+ _path_params['mailboxResourceId'] = mailbox_resource_id
908
+ if folder is not None:
909
+ _path_params['folder'] = folder
910
+ # process the query parameters
911
+ # process the header parameters
912
+ # process the form parameters
913
+ # process the body parameter
914
+ if v1_folder_messages_delete_bulk_request is not None:
915
+ _body_params = v1_folder_messages_delete_bulk_request
916
+
917
+
918
+ # set the HTTP header `Accept`
919
+ if 'Accept' not in _header_params:
920
+ _header_params['Accept'] = self.api_client.select_header_accept(
921
+ [
922
+ 'application/json'
923
+ ]
924
+ )
925
+
926
+ # set the HTTP header `Content-Type`
927
+ if _content_type:
928
+ _header_params['Content-Type'] = _content_type
929
+ else:
930
+ _default_content_type = (
931
+ self.api_client.select_header_content_type(
932
+ [
933
+ 'application/json'
934
+ ]
935
+ )
936
+ )
937
+ if _default_content_type is not None:
938
+ _header_params['Content-Type'] = _default_content_type
939
+
940
+ # authentication setting
941
+ _auth_settings: List[str] = [
942
+ 'BearerAuth'
943
+ ]
944
+
945
+ return self.api_client.param_serialize(
946
+ method='POST',
947
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages/delete',
948
+ path_params=_path_params,
949
+ query_params=_query_params,
950
+ header_params=_header_params,
951
+ body=_body_params,
952
+ post_params=_form_params,
953
+ files=_files,
954
+ auth_settings=_auth_settings,
955
+ collection_formats=_collection_formats,
956
+ _host=_host,
957
+ _request_auth=_request_auth
958
+ )
959
+
960
+
961
+
962
+
963
+ @validate_call
964
+ def get_message(
965
+ self,
966
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
967
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
968
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
969
+ _request_timeout: Union[
970
+ None,
971
+ Annotated[StrictFloat, Field(gt=0)],
972
+ Tuple[
973
+ Annotated[StrictFloat, Field(gt=0)],
974
+ Annotated[StrictFloat, Field(gt=0)]
975
+ ]
976
+ ] = None,
977
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
978
+ _content_type: Optional[StrictStr] = None,
979
+ _headers: Optional[Dict[StrictStr, Any]] = None,
980
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
981
+ ) -> V1FolderMessagesResource:
982
+ """Get message
983
+
984
+ Retrieve a single message by UID.
985
+
986
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
987
+ :type mailbox_resource_id: str
988
+ :param folder: Folder path (URL-encoded). (required)
989
+ :type folder: str
990
+ :param uid: Message UID. (required)
991
+ :type uid: int
992
+ :param _request_timeout: timeout setting for this request. If one
993
+ number provided, it will be total request
994
+ timeout. It can also be a pair (tuple) of
995
+ (connection, read) timeouts.
996
+ :type _request_timeout: int, tuple(int, int), optional
997
+ :param _request_auth: set to override the auth_settings for an a single
998
+ request; this effectively ignores the
999
+ authentication in the spec for a single request.
1000
+ :type _request_auth: dict, optional
1001
+ :param _content_type: force content-type for the request.
1002
+ :type _content_type: str, Optional
1003
+ :param _headers: set to override the headers for a single
1004
+ request; this effectively ignores the headers
1005
+ in the spec for a single request.
1006
+ :type _headers: dict, optional
1007
+ :param _host_index: set to override the host_index for a single
1008
+ request; this effectively ignores the host_index
1009
+ in the spec for a single request.
1010
+ :type _host_index: int, optional
1011
+ :return: Returns the result object.
1012
+ """ # noqa: E501
1013
+
1014
+ _param = self._get_message_serialize(
1015
+ mailbox_resource_id=mailbox_resource_id,
1016
+ folder=folder,
1017
+ uid=uid,
1018
+ _request_auth=_request_auth,
1019
+ _content_type=_content_type,
1020
+ _headers=_headers,
1021
+ _host_index=_host_index
1022
+ )
1023
+
1024
+ _response_types_map: Dict[str, Optional[str]] = {
1025
+ '200': "V1FolderMessagesResource",
1026
+ '401': "Error",
1027
+ '403': "Error",
1028
+ '404': "Error",
1029
+ '422': "Error",
1030
+ '500': "Error",
1031
+ '502': "Error",
1032
+ }
1033
+ response_data = self.api_client.call_api(
1034
+ *_param,
1035
+ _request_timeout=_request_timeout
1036
+ )
1037
+ response_data.read()
1038
+ return self.api_client.response_deserialize(
1039
+ response_data=response_data,
1040
+ response_types_map=_response_types_map,
1041
+ ).data
1042
+
1043
+
1044
+ @validate_call
1045
+ def get_message_with_http_info(
1046
+ self,
1047
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
1048
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
1049
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
1050
+ _request_timeout: Union[
1051
+ None,
1052
+ Annotated[StrictFloat, Field(gt=0)],
1053
+ Tuple[
1054
+ Annotated[StrictFloat, Field(gt=0)],
1055
+ Annotated[StrictFloat, Field(gt=0)]
1056
+ ]
1057
+ ] = None,
1058
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1059
+ _content_type: Optional[StrictStr] = None,
1060
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1061
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1062
+ ) -> ApiResponse[V1FolderMessagesResource]:
1063
+ """Get message
1064
+
1065
+ Retrieve a single message by UID.
1066
+
1067
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
1068
+ :type mailbox_resource_id: str
1069
+ :param folder: Folder path (URL-encoded). (required)
1070
+ :type folder: str
1071
+ :param uid: Message UID. (required)
1072
+ :type uid: int
1073
+ :param _request_timeout: timeout setting for this request. If one
1074
+ number provided, it will be total request
1075
+ timeout. It can also be a pair (tuple) of
1076
+ (connection, read) timeouts.
1077
+ :type _request_timeout: int, tuple(int, int), optional
1078
+ :param _request_auth: set to override the auth_settings for an a single
1079
+ request; this effectively ignores the
1080
+ authentication in the spec for a single request.
1081
+ :type _request_auth: dict, optional
1082
+ :param _content_type: force content-type for the request.
1083
+ :type _content_type: str, Optional
1084
+ :param _headers: set to override the headers for a single
1085
+ request; this effectively ignores the headers
1086
+ in the spec for a single request.
1087
+ :type _headers: dict, optional
1088
+ :param _host_index: set to override the host_index for a single
1089
+ request; this effectively ignores the host_index
1090
+ in the spec for a single request.
1091
+ :type _host_index: int, optional
1092
+ :return: Returns the result object.
1093
+ """ # noqa: E501
1094
+
1095
+ _param = self._get_message_serialize(
1096
+ mailbox_resource_id=mailbox_resource_id,
1097
+ folder=folder,
1098
+ uid=uid,
1099
+ _request_auth=_request_auth,
1100
+ _content_type=_content_type,
1101
+ _headers=_headers,
1102
+ _host_index=_host_index
1103
+ )
1104
+
1105
+ _response_types_map: Dict[str, Optional[str]] = {
1106
+ '200': "V1FolderMessagesResource",
1107
+ '401': "Error",
1108
+ '403': "Error",
1109
+ '404': "Error",
1110
+ '422': "Error",
1111
+ '500': "Error",
1112
+ '502': "Error",
1113
+ }
1114
+ response_data = self.api_client.call_api(
1115
+ *_param,
1116
+ _request_timeout=_request_timeout
1117
+ )
1118
+ response_data.read()
1119
+ return self.api_client.response_deserialize(
1120
+ response_data=response_data,
1121
+ response_types_map=_response_types_map,
1122
+ )
1123
+
1124
+
1125
+ @validate_call
1126
+ def get_message_without_preload_content(
1127
+ self,
1128
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
1129
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
1130
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
1131
+ _request_timeout: Union[
1132
+ None,
1133
+ Annotated[StrictFloat, Field(gt=0)],
1134
+ Tuple[
1135
+ Annotated[StrictFloat, Field(gt=0)],
1136
+ Annotated[StrictFloat, Field(gt=0)]
1137
+ ]
1138
+ ] = None,
1139
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1140
+ _content_type: Optional[StrictStr] = None,
1141
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1142
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1143
+ ) -> RESTResponseType:
1144
+ """Get message
1145
+
1146
+ Retrieve a single message by UID.
1147
+
1148
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
1149
+ :type mailbox_resource_id: str
1150
+ :param folder: Folder path (URL-encoded). (required)
1151
+ :type folder: str
1152
+ :param uid: Message UID. (required)
1153
+ :type uid: int
1154
+ :param _request_timeout: timeout setting for this request. If one
1155
+ number provided, it will be total request
1156
+ timeout. It can also be a pair (tuple) of
1157
+ (connection, read) timeouts.
1158
+ :type _request_timeout: int, tuple(int, int), optional
1159
+ :param _request_auth: set to override the auth_settings for an a single
1160
+ request; this effectively ignores the
1161
+ authentication in the spec for a single request.
1162
+ :type _request_auth: dict, optional
1163
+ :param _content_type: force content-type for the request.
1164
+ :type _content_type: str, Optional
1165
+ :param _headers: set to override the headers for a single
1166
+ request; this effectively ignores the headers
1167
+ in the spec for a single request.
1168
+ :type _headers: dict, optional
1169
+ :param _host_index: set to override the host_index for a single
1170
+ request; this effectively ignores the host_index
1171
+ in the spec for a single request.
1172
+ :type _host_index: int, optional
1173
+ :return: Returns the result object.
1174
+ """ # noqa: E501
1175
+
1176
+ _param = self._get_message_serialize(
1177
+ mailbox_resource_id=mailbox_resource_id,
1178
+ folder=folder,
1179
+ uid=uid,
1180
+ _request_auth=_request_auth,
1181
+ _content_type=_content_type,
1182
+ _headers=_headers,
1183
+ _host_index=_host_index
1184
+ )
1185
+
1186
+ _response_types_map: Dict[str, Optional[str]] = {
1187
+ '200': "V1FolderMessagesResource",
1188
+ '401': "Error",
1189
+ '403': "Error",
1190
+ '404': "Error",
1191
+ '422': "Error",
1192
+ '500': "Error",
1193
+ '502': "Error",
1194
+ }
1195
+ response_data = self.api_client.call_api(
1196
+ *_param,
1197
+ _request_timeout=_request_timeout
1198
+ )
1199
+ return response_data.response
1200
+
1201
+
1202
+ def _get_message_serialize(
1203
+ self,
1204
+ mailbox_resource_id,
1205
+ folder,
1206
+ uid,
1207
+ _request_auth,
1208
+ _content_type,
1209
+ _headers,
1210
+ _host_index,
1211
+ ) -> RequestSerialized:
1212
+
1213
+ _host = None
1214
+
1215
+ _collection_formats: Dict[str, str] = {
1216
+ }
1217
+
1218
+ _path_params: Dict[str, str] = {}
1219
+ _query_params: List[Tuple[str, str]] = []
1220
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1221
+ _form_params: List[Tuple[str, str]] = []
1222
+ _files: Dict[
1223
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1224
+ ] = {}
1225
+ _body_params: Optional[bytes] = None
1226
+
1227
+ # process the path parameters
1228
+ if mailbox_resource_id is not None:
1229
+ _path_params['mailboxResourceId'] = mailbox_resource_id
1230
+ if folder is not None:
1231
+ _path_params['folder'] = folder
1232
+ if uid is not None:
1233
+ _path_params['uid'] = uid
1234
+ # process the query parameters
1235
+ # process the header parameters
1236
+ # process the form parameters
1237
+ # process the body parameter
1238
+
1239
+
1240
+ # set the HTTP header `Accept`
1241
+ if 'Accept' not in _header_params:
1242
+ _header_params['Accept'] = self.api_client.select_header_accept(
1243
+ [
1244
+ 'application/json'
1245
+ ]
1246
+ )
1247
+
1248
+
1249
+ # authentication setting
1250
+ _auth_settings: List[str] = [
1251
+ 'BearerAuth'
1252
+ ]
1253
+
1254
+ return self.api_client.param_serialize(
1255
+ method='GET',
1256
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages/{uid}',
1257
+ path_params=_path_params,
1258
+ query_params=_query_params,
1259
+ header_params=_header_params,
1260
+ body=_body_params,
1261
+ post_params=_form_params,
1262
+ files=_files,
1263
+ auth_settings=_auth_settings,
1264
+ collection_formats=_collection_formats,
1265
+ _host=_host,
1266
+ _request_auth=_request_auth
1267
+ )
1268
+
1269
+
1270
+
1271
+
1272
+ @validate_call
1273
+ def get_message_attachment(
1274
+ self,
1275
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
1276
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
1277
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
1278
+ attachment_id: Annotated[StrictStr, Field(description="Attachment ID (opaque, returned by GET message).")],
1279
+ _request_timeout: Union[
1280
+ None,
1281
+ Annotated[StrictFloat, Field(gt=0)],
1282
+ Tuple[
1283
+ Annotated[StrictFloat, Field(gt=0)],
1284
+ Annotated[StrictFloat, Field(gt=0)]
1285
+ ]
1286
+ ] = None,
1287
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1288
+ _content_type: Optional[StrictStr] = None,
1289
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1290
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1291
+ ) -> bytearray:
1292
+ """Download message attachment
1293
+
1294
+ Download a message attachment as `application/octet-stream`.
1295
+
1296
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
1297
+ :type mailbox_resource_id: str
1298
+ :param folder: Folder path (URL-encoded). (required)
1299
+ :type folder: str
1300
+ :param uid: Message UID. (required)
1301
+ :type uid: int
1302
+ :param attachment_id: Attachment ID (opaque, returned by GET message). (required)
1303
+ :type attachment_id: str
1304
+ :param _request_timeout: timeout setting for this request. If one
1305
+ number provided, it will be total request
1306
+ timeout. It can also be a pair (tuple) of
1307
+ (connection, read) timeouts.
1308
+ :type _request_timeout: int, tuple(int, int), optional
1309
+ :param _request_auth: set to override the auth_settings for an a single
1310
+ request; this effectively ignores the
1311
+ authentication in the spec for a single request.
1312
+ :type _request_auth: dict, optional
1313
+ :param _content_type: force content-type for the request.
1314
+ :type _content_type: str, Optional
1315
+ :param _headers: set to override the headers for a single
1316
+ request; this effectively ignores the headers
1317
+ in the spec for a single request.
1318
+ :type _headers: dict, optional
1319
+ :param _host_index: set to override the host_index for a single
1320
+ request; this effectively ignores the host_index
1321
+ in the spec for a single request.
1322
+ :type _host_index: int, optional
1323
+ :return: Returns the result object.
1324
+ """ # noqa: E501
1325
+
1326
+ _param = self._get_message_attachment_serialize(
1327
+ mailbox_resource_id=mailbox_resource_id,
1328
+ folder=folder,
1329
+ uid=uid,
1330
+ attachment_id=attachment_id,
1331
+ _request_auth=_request_auth,
1332
+ _content_type=_content_type,
1333
+ _headers=_headers,
1334
+ _host_index=_host_index
1335
+ )
1336
+
1337
+ _response_types_map: Dict[str, Optional[str]] = {
1338
+ '200': "bytearray",
1339
+ '401': "Error",
1340
+ '403': "Error",
1341
+ '404': "Error",
1342
+ '422': "Error",
1343
+ '500': "Error",
1344
+ '502': "Error",
1345
+ }
1346
+ response_data = self.api_client.call_api(
1347
+ *_param,
1348
+ _request_timeout=_request_timeout
1349
+ )
1350
+ response_data.read()
1351
+ return self.api_client.response_deserialize(
1352
+ response_data=response_data,
1353
+ response_types_map=_response_types_map,
1354
+ ).data
1355
+
1356
+
1357
+ @validate_call
1358
+ def get_message_attachment_with_http_info(
1359
+ self,
1360
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
1361
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
1362
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
1363
+ attachment_id: Annotated[StrictStr, Field(description="Attachment ID (opaque, returned by GET message).")],
1364
+ _request_timeout: Union[
1365
+ None,
1366
+ Annotated[StrictFloat, Field(gt=0)],
1367
+ Tuple[
1368
+ Annotated[StrictFloat, Field(gt=0)],
1369
+ Annotated[StrictFloat, Field(gt=0)]
1370
+ ]
1371
+ ] = None,
1372
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1373
+ _content_type: Optional[StrictStr] = None,
1374
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1375
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1376
+ ) -> ApiResponse[bytearray]:
1377
+ """Download message attachment
1378
+
1379
+ Download a message attachment as `application/octet-stream`.
1380
+
1381
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
1382
+ :type mailbox_resource_id: str
1383
+ :param folder: Folder path (URL-encoded). (required)
1384
+ :type folder: str
1385
+ :param uid: Message UID. (required)
1386
+ :type uid: int
1387
+ :param attachment_id: Attachment ID (opaque, returned by GET message). (required)
1388
+ :type attachment_id: str
1389
+ :param _request_timeout: timeout setting for this request. If one
1390
+ number provided, it will be total request
1391
+ timeout. It can also be a pair (tuple) of
1392
+ (connection, read) timeouts.
1393
+ :type _request_timeout: int, tuple(int, int), optional
1394
+ :param _request_auth: set to override the auth_settings for an a single
1395
+ request; this effectively ignores the
1396
+ authentication in the spec for a single request.
1397
+ :type _request_auth: dict, optional
1398
+ :param _content_type: force content-type for the request.
1399
+ :type _content_type: str, Optional
1400
+ :param _headers: set to override the headers for a single
1401
+ request; this effectively ignores the headers
1402
+ in the spec for a single request.
1403
+ :type _headers: dict, optional
1404
+ :param _host_index: set to override the host_index for a single
1405
+ request; this effectively ignores the host_index
1406
+ in the spec for a single request.
1407
+ :type _host_index: int, optional
1408
+ :return: Returns the result object.
1409
+ """ # noqa: E501
1410
+
1411
+ _param = self._get_message_attachment_serialize(
1412
+ mailbox_resource_id=mailbox_resource_id,
1413
+ folder=folder,
1414
+ uid=uid,
1415
+ attachment_id=attachment_id,
1416
+ _request_auth=_request_auth,
1417
+ _content_type=_content_type,
1418
+ _headers=_headers,
1419
+ _host_index=_host_index
1420
+ )
1421
+
1422
+ _response_types_map: Dict[str, Optional[str]] = {
1423
+ '200': "bytearray",
1424
+ '401': "Error",
1425
+ '403': "Error",
1426
+ '404': "Error",
1427
+ '422': "Error",
1428
+ '500': "Error",
1429
+ '502': "Error",
1430
+ }
1431
+ response_data = self.api_client.call_api(
1432
+ *_param,
1433
+ _request_timeout=_request_timeout
1434
+ )
1435
+ response_data.read()
1436
+ return self.api_client.response_deserialize(
1437
+ response_data=response_data,
1438
+ response_types_map=_response_types_map,
1439
+ )
1440
+
1441
+
1442
+ @validate_call
1443
+ def get_message_attachment_without_preload_content(
1444
+ self,
1445
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
1446
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
1447
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
1448
+ attachment_id: Annotated[StrictStr, Field(description="Attachment ID (opaque, returned by GET message).")],
1449
+ _request_timeout: Union[
1450
+ None,
1451
+ Annotated[StrictFloat, Field(gt=0)],
1452
+ Tuple[
1453
+ Annotated[StrictFloat, Field(gt=0)],
1454
+ Annotated[StrictFloat, Field(gt=0)]
1455
+ ]
1456
+ ] = None,
1457
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1458
+ _content_type: Optional[StrictStr] = None,
1459
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1460
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1461
+ ) -> RESTResponseType:
1462
+ """Download message attachment
1463
+
1464
+ Download a message attachment as `application/octet-stream`.
1465
+
1466
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
1467
+ :type mailbox_resource_id: str
1468
+ :param folder: Folder path (URL-encoded). (required)
1469
+ :type folder: str
1470
+ :param uid: Message UID. (required)
1471
+ :type uid: int
1472
+ :param attachment_id: Attachment ID (opaque, returned by GET message). (required)
1473
+ :type attachment_id: str
1474
+ :param _request_timeout: timeout setting for this request. If one
1475
+ number provided, it will be total request
1476
+ timeout. It can also be a pair (tuple) of
1477
+ (connection, read) timeouts.
1478
+ :type _request_timeout: int, tuple(int, int), optional
1479
+ :param _request_auth: set to override the auth_settings for an a single
1480
+ request; this effectively ignores the
1481
+ authentication in the spec for a single request.
1482
+ :type _request_auth: dict, optional
1483
+ :param _content_type: force content-type for the request.
1484
+ :type _content_type: str, Optional
1485
+ :param _headers: set to override the headers for a single
1486
+ request; this effectively ignores the headers
1487
+ in the spec for a single request.
1488
+ :type _headers: dict, optional
1489
+ :param _host_index: set to override the host_index for a single
1490
+ request; this effectively ignores the host_index
1491
+ in the spec for a single request.
1492
+ :type _host_index: int, optional
1493
+ :return: Returns the result object.
1494
+ """ # noqa: E501
1495
+
1496
+ _param = self._get_message_attachment_serialize(
1497
+ mailbox_resource_id=mailbox_resource_id,
1498
+ folder=folder,
1499
+ uid=uid,
1500
+ attachment_id=attachment_id,
1501
+ _request_auth=_request_auth,
1502
+ _content_type=_content_type,
1503
+ _headers=_headers,
1504
+ _host_index=_host_index
1505
+ )
1506
+
1507
+ _response_types_map: Dict[str, Optional[str]] = {
1508
+ '200': "bytearray",
1509
+ '401': "Error",
1510
+ '403': "Error",
1511
+ '404': "Error",
1512
+ '422': "Error",
1513
+ '500': "Error",
1514
+ '502': "Error",
1515
+ }
1516
+ response_data = self.api_client.call_api(
1517
+ *_param,
1518
+ _request_timeout=_request_timeout
1519
+ )
1520
+ return response_data.response
1521
+
1522
+
1523
+ def _get_message_attachment_serialize(
1524
+ self,
1525
+ mailbox_resource_id,
1526
+ folder,
1527
+ uid,
1528
+ attachment_id,
1529
+ _request_auth,
1530
+ _content_type,
1531
+ _headers,
1532
+ _host_index,
1533
+ ) -> RequestSerialized:
1534
+
1535
+ _host = None
1536
+
1537
+ _collection_formats: Dict[str, str] = {
1538
+ }
1539
+
1540
+ _path_params: Dict[str, str] = {}
1541
+ _query_params: List[Tuple[str, str]] = []
1542
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1543
+ _form_params: List[Tuple[str, str]] = []
1544
+ _files: Dict[
1545
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1546
+ ] = {}
1547
+ _body_params: Optional[bytes] = None
1548
+
1549
+ # process the path parameters
1550
+ if mailbox_resource_id is not None:
1551
+ _path_params['mailboxResourceId'] = mailbox_resource_id
1552
+ if folder is not None:
1553
+ _path_params['folder'] = folder
1554
+ if uid is not None:
1555
+ _path_params['uid'] = uid
1556
+ if attachment_id is not None:
1557
+ _path_params['attachmentId'] = attachment_id
1558
+ # process the query parameters
1559
+ # process the header parameters
1560
+ # process the form parameters
1561
+ # process the body parameter
1562
+
1563
+
1564
+ # set the HTTP header `Accept`
1565
+ if 'Accept' not in _header_params:
1566
+ _header_params['Accept'] = self.api_client.select_header_accept(
1567
+ [
1568
+ 'application/octet-stream',
1569
+ 'application/json'
1570
+ ]
1571
+ )
1572
+
1573
+
1574
+ # authentication setting
1575
+ _auth_settings: List[str] = [
1576
+ 'BearerAuth'
1577
+ ]
1578
+
1579
+ return self.api_client.param_serialize(
1580
+ method='GET',
1581
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages/{uid}/attachments/{attachmentId}',
1582
+ path_params=_path_params,
1583
+ query_params=_query_params,
1584
+ header_params=_header_params,
1585
+ body=_body_params,
1586
+ post_params=_form_params,
1587
+ files=_files,
1588
+ auth_settings=_auth_settings,
1589
+ collection_formats=_collection_formats,
1590
+ _host=_host,
1591
+ _request_auth=_request_auth
1592
+ )
1593
+
1594
+
1595
+
1596
+
1597
+ @validate_call
1598
+ def get_message_source(
1599
+ self,
1600
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
1601
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
1602
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
1603
+ _request_timeout: Union[
1604
+ None,
1605
+ Annotated[StrictFloat, Field(gt=0)],
1606
+ Tuple[
1607
+ Annotated[StrictFloat, Field(gt=0)],
1608
+ Annotated[StrictFloat, Field(gt=0)]
1609
+ ]
1610
+ ] = None,
1611
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1612
+ _content_type: Optional[StrictStr] = None,
1613
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1614
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1615
+ ) -> bytearray:
1616
+ """Get message source
1617
+
1618
+ Retrieve raw RFC822 source of a message as `message/rfc822` attachment.
1619
+
1620
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
1621
+ :type mailbox_resource_id: str
1622
+ :param folder: Folder path (URL-encoded). (required)
1623
+ :type folder: str
1624
+ :param uid: Message UID. (required)
1625
+ :type uid: int
1626
+ :param _request_timeout: timeout setting for this request. If one
1627
+ number provided, it will be total request
1628
+ timeout. It can also be a pair (tuple) of
1629
+ (connection, read) timeouts.
1630
+ :type _request_timeout: int, tuple(int, int), optional
1631
+ :param _request_auth: set to override the auth_settings for an a single
1632
+ request; this effectively ignores the
1633
+ authentication in the spec for a single request.
1634
+ :type _request_auth: dict, optional
1635
+ :param _content_type: force content-type for the request.
1636
+ :type _content_type: str, Optional
1637
+ :param _headers: set to override the headers for a single
1638
+ request; this effectively ignores the headers
1639
+ in the spec for a single request.
1640
+ :type _headers: dict, optional
1641
+ :param _host_index: set to override the host_index for a single
1642
+ request; this effectively ignores the host_index
1643
+ in the spec for a single request.
1644
+ :type _host_index: int, optional
1645
+ :return: Returns the result object.
1646
+ """ # noqa: E501
1647
+
1648
+ _param = self._get_message_source_serialize(
1649
+ mailbox_resource_id=mailbox_resource_id,
1650
+ folder=folder,
1651
+ uid=uid,
1652
+ _request_auth=_request_auth,
1653
+ _content_type=_content_type,
1654
+ _headers=_headers,
1655
+ _host_index=_host_index
1656
+ )
1657
+
1658
+ _response_types_map: Dict[str, Optional[str]] = {
1659
+ '200': "bytearray",
1660
+ '401': "Error",
1661
+ '403': "Error",
1662
+ '404': "Error",
1663
+ '422': "Error",
1664
+ '500': "Error",
1665
+ '502': "Error",
1666
+ }
1667
+ response_data = self.api_client.call_api(
1668
+ *_param,
1669
+ _request_timeout=_request_timeout
1670
+ )
1671
+ response_data.read()
1672
+ return self.api_client.response_deserialize(
1673
+ response_data=response_data,
1674
+ response_types_map=_response_types_map,
1675
+ ).data
1676
+
1677
+
1678
+ @validate_call
1679
+ def get_message_source_with_http_info(
1680
+ self,
1681
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
1682
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
1683
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
1684
+ _request_timeout: Union[
1685
+ None,
1686
+ Annotated[StrictFloat, Field(gt=0)],
1687
+ Tuple[
1688
+ Annotated[StrictFloat, Field(gt=0)],
1689
+ Annotated[StrictFloat, Field(gt=0)]
1690
+ ]
1691
+ ] = None,
1692
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1693
+ _content_type: Optional[StrictStr] = None,
1694
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1695
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1696
+ ) -> ApiResponse[bytearray]:
1697
+ """Get message source
1698
+
1699
+ Retrieve raw RFC822 source of a message as `message/rfc822` attachment.
1700
+
1701
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
1702
+ :type mailbox_resource_id: str
1703
+ :param folder: Folder path (URL-encoded). (required)
1704
+ :type folder: str
1705
+ :param uid: Message UID. (required)
1706
+ :type uid: int
1707
+ :param _request_timeout: timeout setting for this request. If one
1708
+ number provided, it will be total request
1709
+ timeout. It can also be a pair (tuple) of
1710
+ (connection, read) timeouts.
1711
+ :type _request_timeout: int, tuple(int, int), optional
1712
+ :param _request_auth: set to override the auth_settings for an a single
1713
+ request; this effectively ignores the
1714
+ authentication in the spec for a single request.
1715
+ :type _request_auth: dict, optional
1716
+ :param _content_type: force content-type for the request.
1717
+ :type _content_type: str, Optional
1718
+ :param _headers: set to override the headers for a single
1719
+ request; this effectively ignores the headers
1720
+ in the spec for a single request.
1721
+ :type _headers: dict, optional
1722
+ :param _host_index: set to override the host_index for a single
1723
+ request; this effectively ignores the host_index
1724
+ in the spec for a single request.
1725
+ :type _host_index: int, optional
1726
+ :return: Returns the result object.
1727
+ """ # noqa: E501
1728
+
1729
+ _param = self._get_message_source_serialize(
1730
+ mailbox_resource_id=mailbox_resource_id,
1731
+ folder=folder,
1732
+ uid=uid,
1733
+ _request_auth=_request_auth,
1734
+ _content_type=_content_type,
1735
+ _headers=_headers,
1736
+ _host_index=_host_index
1737
+ )
1738
+
1739
+ _response_types_map: Dict[str, Optional[str]] = {
1740
+ '200': "bytearray",
1741
+ '401': "Error",
1742
+ '403': "Error",
1743
+ '404': "Error",
1744
+ '422': "Error",
1745
+ '500': "Error",
1746
+ '502': "Error",
1747
+ }
1748
+ response_data = self.api_client.call_api(
1749
+ *_param,
1750
+ _request_timeout=_request_timeout
1751
+ )
1752
+ response_data.read()
1753
+ return self.api_client.response_deserialize(
1754
+ response_data=response_data,
1755
+ response_types_map=_response_types_map,
1756
+ )
1757
+
1758
+
1759
+ @validate_call
1760
+ def get_message_source_without_preload_content(
1761
+ self,
1762
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
1763
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
1764
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
1765
+ _request_timeout: Union[
1766
+ None,
1767
+ Annotated[StrictFloat, Field(gt=0)],
1768
+ Tuple[
1769
+ Annotated[StrictFloat, Field(gt=0)],
1770
+ Annotated[StrictFloat, Field(gt=0)]
1771
+ ]
1772
+ ] = None,
1773
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1774
+ _content_type: Optional[StrictStr] = None,
1775
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1776
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1777
+ ) -> RESTResponseType:
1778
+ """Get message source
1779
+
1780
+ Retrieve raw RFC822 source of a message as `message/rfc822` attachment.
1781
+
1782
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
1783
+ :type mailbox_resource_id: str
1784
+ :param folder: Folder path (URL-encoded). (required)
1785
+ :type folder: str
1786
+ :param uid: Message UID. (required)
1787
+ :type uid: int
1788
+ :param _request_timeout: timeout setting for this request. If one
1789
+ number provided, it will be total request
1790
+ timeout. It can also be a pair (tuple) of
1791
+ (connection, read) timeouts.
1792
+ :type _request_timeout: int, tuple(int, int), optional
1793
+ :param _request_auth: set to override the auth_settings for an a single
1794
+ request; this effectively ignores the
1795
+ authentication in the spec for a single request.
1796
+ :type _request_auth: dict, optional
1797
+ :param _content_type: force content-type for the request.
1798
+ :type _content_type: str, Optional
1799
+ :param _headers: set to override the headers for a single
1800
+ request; this effectively ignores the headers
1801
+ in the spec for a single request.
1802
+ :type _headers: dict, optional
1803
+ :param _host_index: set to override the host_index for a single
1804
+ request; this effectively ignores the host_index
1805
+ in the spec for a single request.
1806
+ :type _host_index: int, optional
1807
+ :return: Returns the result object.
1808
+ """ # noqa: E501
1809
+
1810
+ _param = self._get_message_source_serialize(
1811
+ mailbox_resource_id=mailbox_resource_id,
1812
+ folder=folder,
1813
+ uid=uid,
1814
+ _request_auth=_request_auth,
1815
+ _content_type=_content_type,
1816
+ _headers=_headers,
1817
+ _host_index=_host_index
1818
+ )
1819
+
1820
+ _response_types_map: Dict[str, Optional[str]] = {
1821
+ '200': "bytearray",
1822
+ '401': "Error",
1823
+ '403': "Error",
1824
+ '404': "Error",
1825
+ '422': "Error",
1826
+ '500': "Error",
1827
+ '502': "Error",
1828
+ }
1829
+ response_data = self.api_client.call_api(
1830
+ *_param,
1831
+ _request_timeout=_request_timeout
1832
+ )
1833
+ return response_data.response
1834
+
1835
+
1836
+ def _get_message_source_serialize(
1837
+ self,
1838
+ mailbox_resource_id,
1839
+ folder,
1840
+ uid,
1841
+ _request_auth,
1842
+ _content_type,
1843
+ _headers,
1844
+ _host_index,
1845
+ ) -> RequestSerialized:
1846
+
1847
+ _host = None
1848
+
1849
+ _collection_formats: Dict[str, str] = {
1850
+ }
1851
+
1852
+ _path_params: Dict[str, str] = {}
1853
+ _query_params: List[Tuple[str, str]] = []
1854
+ _header_params: Dict[str, Optional[str]] = _headers or {}
1855
+ _form_params: List[Tuple[str, str]] = []
1856
+ _files: Dict[
1857
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
1858
+ ] = {}
1859
+ _body_params: Optional[bytes] = None
1860
+
1861
+ # process the path parameters
1862
+ if mailbox_resource_id is not None:
1863
+ _path_params['mailboxResourceId'] = mailbox_resource_id
1864
+ if folder is not None:
1865
+ _path_params['folder'] = folder
1866
+ if uid is not None:
1867
+ _path_params['uid'] = uid
1868
+ # process the query parameters
1869
+ # process the header parameters
1870
+ # process the form parameters
1871
+ # process the body parameter
1872
+
1873
+
1874
+ # set the HTTP header `Accept`
1875
+ if 'Accept' not in _header_params:
1876
+ _header_params['Accept'] = self.api_client.select_header_accept(
1877
+ [
1878
+ 'message/rfc822',
1879
+ 'application/json'
1880
+ ]
1881
+ )
1882
+
1883
+
1884
+ # authentication setting
1885
+ _auth_settings: List[str] = [
1886
+ 'BearerAuth'
1887
+ ]
1888
+
1889
+ return self.api_client.param_serialize(
1890
+ method='GET',
1891
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages/{uid}/source',
1892
+ path_params=_path_params,
1893
+ query_params=_query_params,
1894
+ header_params=_header_params,
1895
+ body=_body_params,
1896
+ post_params=_form_params,
1897
+ files=_files,
1898
+ auth_settings=_auth_settings,
1899
+ collection_formats=_collection_formats,
1900
+ _host=_host,
1901
+ _request_auth=_request_auth
1902
+ )
1903
+
1904
+
1905
+
1906
+
1907
+ @validate_call
1908
+ def get_message_text(
1909
+ self,
1910
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
1911
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
1912
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
1913
+ _request_timeout: Union[
1914
+ None,
1915
+ Annotated[StrictFloat, Field(gt=0)],
1916
+ Tuple[
1917
+ Annotated[StrictFloat, Field(gt=0)],
1918
+ Annotated[StrictFloat, Field(gt=0)]
1919
+ ]
1920
+ ] = None,
1921
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
1922
+ _content_type: Optional[StrictStr] = None,
1923
+ _headers: Optional[Dict[StrictStr, Any]] = None,
1924
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
1925
+ ) -> V1FolderMessagesMessageTextResource:
1926
+ """Get message text content
1927
+
1928
+ Retrieve rendered text (plain + HTML) of a message. Marks message as `\\Seen`.
1929
+
1930
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
1931
+ :type mailbox_resource_id: str
1932
+ :param folder: Folder path (URL-encoded). (required)
1933
+ :type folder: str
1934
+ :param uid: Message UID. (required)
1935
+ :type uid: int
1936
+ :param _request_timeout: timeout setting for this request. If one
1937
+ number provided, it will be total request
1938
+ timeout. It can also be a pair (tuple) of
1939
+ (connection, read) timeouts.
1940
+ :type _request_timeout: int, tuple(int, int), optional
1941
+ :param _request_auth: set to override the auth_settings for an a single
1942
+ request; this effectively ignores the
1943
+ authentication in the spec for a single request.
1944
+ :type _request_auth: dict, optional
1945
+ :param _content_type: force content-type for the request.
1946
+ :type _content_type: str, Optional
1947
+ :param _headers: set to override the headers for a single
1948
+ request; this effectively ignores the headers
1949
+ in the spec for a single request.
1950
+ :type _headers: dict, optional
1951
+ :param _host_index: set to override the host_index for a single
1952
+ request; this effectively ignores the host_index
1953
+ in the spec for a single request.
1954
+ :type _host_index: int, optional
1955
+ :return: Returns the result object.
1956
+ """ # noqa: E501
1957
+
1958
+ _param = self._get_message_text_serialize(
1959
+ mailbox_resource_id=mailbox_resource_id,
1960
+ folder=folder,
1961
+ uid=uid,
1962
+ _request_auth=_request_auth,
1963
+ _content_type=_content_type,
1964
+ _headers=_headers,
1965
+ _host_index=_host_index
1966
+ )
1967
+
1968
+ _response_types_map: Dict[str, Optional[str]] = {
1969
+ '200': "V1FolderMessagesMessageTextResource",
1970
+ '401': "Error",
1971
+ '403': "Error",
1972
+ '404': "Error",
1973
+ '422': "Error",
1974
+ '500': "Error",
1975
+ '502': "Error",
1976
+ }
1977
+ response_data = self.api_client.call_api(
1978
+ *_param,
1979
+ _request_timeout=_request_timeout
1980
+ )
1981
+ response_data.read()
1982
+ return self.api_client.response_deserialize(
1983
+ response_data=response_data,
1984
+ response_types_map=_response_types_map,
1985
+ ).data
1986
+
1987
+
1988
+ @validate_call
1989
+ def get_message_text_with_http_info(
1990
+ self,
1991
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
1992
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
1993
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
1994
+ _request_timeout: Union[
1995
+ None,
1996
+ Annotated[StrictFloat, Field(gt=0)],
1997
+ Tuple[
1998
+ Annotated[StrictFloat, Field(gt=0)],
1999
+ Annotated[StrictFloat, Field(gt=0)]
2000
+ ]
2001
+ ] = None,
2002
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2003
+ _content_type: Optional[StrictStr] = None,
2004
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2005
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2006
+ ) -> ApiResponse[V1FolderMessagesMessageTextResource]:
2007
+ """Get message text content
2008
+
2009
+ Retrieve rendered text (plain + HTML) of a message. Marks message as `\\Seen`.
2010
+
2011
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
2012
+ :type mailbox_resource_id: str
2013
+ :param folder: Folder path (URL-encoded). (required)
2014
+ :type folder: str
2015
+ :param uid: Message UID. (required)
2016
+ :type uid: int
2017
+ :param _request_timeout: timeout setting for this request. If one
2018
+ number provided, it will be total request
2019
+ timeout. It can also be a pair (tuple) of
2020
+ (connection, read) timeouts.
2021
+ :type _request_timeout: int, tuple(int, int), optional
2022
+ :param _request_auth: set to override the auth_settings for an a single
2023
+ request; this effectively ignores the
2024
+ authentication in the spec for a single request.
2025
+ :type _request_auth: dict, optional
2026
+ :param _content_type: force content-type for the request.
2027
+ :type _content_type: str, Optional
2028
+ :param _headers: set to override the headers for a single
2029
+ request; this effectively ignores the headers
2030
+ in the spec for a single request.
2031
+ :type _headers: dict, optional
2032
+ :param _host_index: set to override the host_index for a single
2033
+ request; this effectively ignores the host_index
2034
+ in the spec for a single request.
2035
+ :type _host_index: int, optional
2036
+ :return: Returns the result object.
2037
+ """ # noqa: E501
2038
+
2039
+ _param = self._get_message_text_serialize(
2040
+ mailbox_resource_id=mailbox_resource_id,
2041
+ folder=folder,
2042
+ uid=uid,
2043
+ _request_auth=_request_auth,
2044
+ _content_type=_content_type,
2045
+ _headers=_headers,
2046
+ _host_index=_host_index
2047
+ )
2048
+
2049
+ _response_types_map: Dict[str, Optional[str]] = {
2050
+ '200': "V1FolderMessagesMessageTextResource",
2051
+ '401': "Error",
2052
+ '403': "Error",
2053
+ '404': "Error",
2054
+ '422': "Error",
2055
+ '500': "Error",
2056
+ '502': "Error",
2057
+ }
2058
+ response_data = self.api_client.call_api(
2059
+ *_param,
2060
+ _request_timeout=_request_timeout
2061
+ )
2062
+ response_data.read()
2063
+ return self.api_client.response_deserialize(
2064
+ response_data=response_data,
2065
+ response_types_map=_response_types_map,
2066
+ )
2067
+
2068
+
2069
+ @validate_call
2070
+ def get_message_text_without_preload_content(
2071
+ self,
2072
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
2073
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
2074
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
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
+ ) -> RESTResponseType:
2088
+ """Get message text content
2089
+
2090
+ Retrieve rendered text (plain + HTML) of a message. Marks message as `\\Seen`.
2091
+
2092
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
2093
+ :type mailbox_resource_id: str
2094
+ :param folder: Folder path (URL-encoded). (required)
2095
+ :type folder: str
2096
+ :param uid: Message UID. (required)
2097
+ :type uid: int
2098
+ :param _request_timeout: timeout setting for this request. If one
2099
+ number provided, it will be total request
2100
+ timeout. It can also be a pair (tuple) of
2101
+ (connection, read) timeouts.
2102
+ :type _request_timeout: int, tuple(int, int), optional
2103
+ :param _request_auth: set to override the auth_settings for an a single
2104
+ request; this effectively ignores the
2105
+ authentication in the spec for a single request.
2106
+ :type _request_auth: dict, optional
2107
+ :param _content_type: force content-type for the request.
2108
+ :type _content_type: str, Optional
2109
+ :param _headers: set to override the headers for a single
2110
+ request; this effectively ignores the headers
2111
+ in the spec for a single request.
2112
+ :type _headers: dict, optional
2113
+ :param _host_index: set to override the host_index for a single
2114
+ request; this effectively ignores the host_index
2115
+ in the spec for a single request.
2116
+ :type _host_index: int, optional
2117
+ :return: Returns the result object.
2118
+ """ # noqa: E501
2119
+
2120
+ _param = self._get_message_text_serialize(
2121
+ mailbox_resource_id=mailbox_resource_id,
2122
+ folder=folder,
2123
+ uid=uid,
2124
+ _request_auth=_request_auth,
2125
+ _content_type=_content_type,
2126
+ _headers=_headers,
2127
+ _host_index=_host_index
2128
+ )
2129
+
2130
+ _response_types_map: Dict[str, Optional[str]] = {
2131
+ '200': "V1FolderMessagesMessageTextResource",
2132
+ '401': "Error",
2133
+ '403': "Error",
2134
+ '404': "Error",
2135
+ '422': "Error",
2136
+ '500': "Error",
2137
+ '502': "Error",
2138
+ }
2139
+ response_data = self.api_client.call_api(
2140
+ *_param,
2141
+ _request_timeout=_request_timeout
2142
+ )
2143
+ return response_data.response
2144
+
2145
+
2146
+ def _get_message_text_serialize(
2147
+ self,
2148
+ mailbox_resource_id,
2149
+ folder,
2150
+ uid,
2151
+ _request_auth,
2152
+ _content_type,
2153
+ _headers,
2154
+ _host_index,
2155
+ ) -> RequestSerialized:
2156
+
2157
+ _host = None
2158
+
2159
+ _collection_formats: Dict[str, str] = {
2160
+ }
2161
+
2162
+ _path_params: Dict[str, str] = {}
2163
+ _query_params: List[Tuple[str, str]] = []
2164
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2165
+ _form_params: List[Tuple[str, str]] = []
2166
+ _files: Dict[
2167
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2168
+ ] = {}
2169
+ _body_params: Optional[bytes] = None
2170
+
2171
+ # process the path parameters
2172
+ if mailbox_resource_id is not None:
2173
+ _path_params['mailboxResourceId'] = mailbox_resource_id
2174
+ if folder is not None:
2175
+ _path_params['folder'] = folder
2176
+ if uid is not None:
2177
+ _path_params['uid'] = uid
2178
+ # process the query parameters
2179
+ # process the header parameters
2180
+ # process the form parameters
2181
+ # process the body parameter
2182
+
2183
+
2184
+ # set the HTTP header `Accept`
2185
+ if 'Accept' not in _header_params:
2186
+ _header_params['Accept'] = self.api_client.select_header_accept(
2187
+ [
2188
+ 'application/json'
2189
+ ]
2190
+ )
2191
+
2192
+
2193
+ # authentication setting
2194
+ _auth_settings: List[str] = [
2195
+ 'BearerAuth'
2196
+ ]
2197
+
2198
+ return self.api_client.param_serialize(
2199
+ method='GET',
2200
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages/{uid}/text',
2201
+ path_params=_path_params,
2202
+ query_params=_query_params,
2203
+ header_params=_header_params,
2204
+ body=_body_params,
2205
+ post_params=_form_params,
2206
+ files=_files,
2207
+ auth_settings=_auth_settings,
2208
+ collection_formats=_collection_formats,
2209
+ _host=_host,
2210
+ _request_auth=_request_auth
2211
+ )
2212
+
2213
+
2214
+
2215
+
2216
+ @validate_call
2217
+ def list_messages(
2218
+ self,
2219
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
2220
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
2221
+ page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number (1-based).")] = None,
2222
+ per_page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Items per page (max 100).")] = None,
2223
+ sort: Annotated[Optional[StrictStr], Field(description="Sort field with optional `-` prefix for descending. Allowed: uid, date, size.")] = None,
2224
+ _request_timeout: Union[
2225
+ None,
2226
+ Annotated[StrictFloat, Field(gt=0)],
2227
+ Tuple[
2228
+ Annotated[StrictFloat, Field(gt=0)],
2229
+ Annotated[StrictFloat, Field(gt=0)]
2230
+ ]
2231
+ ] = None,
2232
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2233
+ _content_type: Optional[StrictStr] = None,
2234
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2235
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2236
+ ) -> V1FolderMessagesCollection:
2237
+ """List messages
2238
+
2239
+ List messages in a folder. Use POST /search for filtering. Sort fields: uid, date, size (prefix with `-` for descending). Default `-uid`.
2240
+
2241
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
2242
+ :type mailbox_resource_id: str
2243
+ :param folder: Folder path (URL-encoded). (required)
2244
+ :type folder: str
2245
+ :param page: Page number (1-based).
2246
+ :type page: int
2247
+ :param per_page: Items per page (max 100).
2248
+ :type per_page: int
2249
+ :param sort: Sort field with optional `-` prefix for descending. Allowed: uid, date, size.
2250
+ :type sort: str
2251
+ :param _request_timeout: timeout setting for this request. If one
2252
+ number provided, it will be total request
2253
+ timeout. It can also be a pair (tuple) of
2254
+ (connection, read) timeouts.
2255
+ :type _request_timeout: int, tuple(int, int), optional
2256
+ :param _request_auth: set to override the auth_settings for an a single
2257
+ request; this effectively ignores the
2258
+ authentication in the spec for a single request.
2259
+ :type _request_auth: dict, optional
2260
+ :param _content_type: force content-type for the request.
2261
+ :type _content_type: str, Optional
2262
+ :param _headers: set to override the headers for a single
2263
+ request; this effectively ignores the headers
2264
+ in the spec for a single request.
2265
+ :type _headers: dict, optional
2266
+ :param _host_index: set to override the host_index for a single
2267
+ request; this effectively ignores the host_index
2268
+ in the spec for a single request.
2269
+ :type _host_index: int, optional
2270
+ :return: Returns the result object.
2271
+ """ # noqa: E501
2272
+
2273
+ _param = self._list_messages_serialize(
2274
+ mailbox_resource_id=mailbox_resource_id,
2275
+ folder=folder,
2276
+ page=page,
2277
+ per_page=per_page,
2278
+ sort=sort,
2279
+ _request_auth=_request_auth,
2280
+ _content_type=_content_type,
2281
+ _headers=_headers,
2282
+ _host_index=_host_index
2283
+ )
2284
+
2285
+ _response_types_map: Dict[str, Optional[str]] = {
2286
+ '200': "V1FolderMessagesCollection",
2287
+ '401': "Error",
2288
+ '403': "Error",
2289
+ '422': "Error",
2290
+ '500': "Error",
2291
+ '502': "Error",
2292
+ }
2293
+ response_data = self.api_client.call_api(
2294
+ *_param,
2295
+ _request_timeout=_request_timeout
2296
+ )
2297
+ response_data.read()
2298
+ return self.api_client.response_deserialize(
2299
+ response_data=response_data,
2300
+ response_types_map=_response_types_map,
2301
+ ).data
2302
+
2303
+
2304
+ @validate_call
2305
+ def list_messages_with_http_info(
2306
+ self,
2307
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
2308
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
2309
+ page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number (1-based).")] = None,
2310
+ per_page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Items per page (max 100).")] = None,
2311
+ sort: Annotated[Optional[StrictStr], Field(description="Sort field with optional `-` prefix for descending. Allowed: uid, date, size.")] = None,
2312
+ _request_timeout: Union[
2313
+ None,
2314
+ Annotated[StrictFloat, Field(gt=0)],
2315
+ Tuple[
2316
+ Annotated[StrictFloat, Field(gt=0)],
2317
+ Annotated[StrictFloat, Field(gt=0)]
2318
+ ]
2319
+ ] = None,
2320
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2321
+ _content_type: Optional[StrictStr] = None,
2322
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2323
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2324
+ ) -> ApiResponse[V1FolderMessagesCollection]:
2325
+ """List messages
2326
+
2327
+ List messages in a folder. Use POST /search for filtering. Sort fields: uid, date, size (prefix with `-` for descending). Default `-uid`.
2328
+
2329
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
2330
+ :type mailbox_resource_id: str
2331
+ :param folder: Folder path (URL-encoded). (required)
2332
+ :type folder: str
2333
+ :param page: Page number (1-based).
2334
+ :type page: int
2335
+ :param per_page: Items per page (max 100).
2336
+ :type per_page: int
2337
+ :param sort: Sort field with optional `-` prefix for descending. Allowed: uid, date, size.
2338
+ :type sort: str
2339
+ :param _request_timeout: timeout setting for this request. If one
2340
+ number provided, it will be total request
2341
+ timeout. It can also be a pair (tuple) of
2342
+ (connection, read) timeouts.
2343
+ :type _request_timeout: int, tuple(int, int), optional
2344
+ :param _request_auth: set to override the auth_settings for an a single
2345
+ request; this effectively ignores the
2346
+ authentication in the spec for a single request.
2347
+ :type _request_auth: dict, optional
2348
+ :param _content_type: force content-type for the request.
2349
+ :type _content_type: str, Optional
2350
+ :param _headers: set to override the headers for a single
2351
+ request; this effectively ignores the headers
2352
+ in the spec for a single request.
2353
+ :type _headers: dict, optional
2354
+ :param _host_index: set to override the host_index for a single
2355
+ request; this effectively ignores the host_index
2356
+ in the spec for a single request.
2357
+ :type _host_index: int, optional
2358
+ :return: Returns the result object.
2359
+ """ # noqa: E501
2360
+
2361
+ _param = self._list_messages_serialize(
2362
+ mailbox_resource_id=mailbox_resource_id,
2363
+ folder=folder,
2364
+ page=page,
2365
+ per_page=per_page,
2366
+ sort=sort,
2367
+ _request_auth=_request_auth,
2368
+ _content_type=_content_type,
2369
+ _headers=_headers,
2370
+ _host_index=_host_index
2371
+ )
2372
+
2373
+ _response_types_map: Dict[str, Optional[str]] = {
2374
+ '200': "V1FolderMessagesCollection",
2375
+ '401': "Error",
2376
+ '403': "Error",
2377
+ '422': "Error",
2378
+ '500': "Error",
2379
+ '502': "Error",
2380
+ }
2381
+ response_data = self.api_client.call_api(
2382
+ *_param,
2383
+ _request_timeout=_request_timeout
2384
+ )
2385
+ response_data.read()
2386
+ return self.api_client.response_deserialize(
2387
+ response_data=response_data,
2388
+ response_types_map=_response_types_map,
2389
+ )
2390
+
2391
+
2392
+ @validate_call
2393
+ def list_messages_without_preload_content(
2394
+ self,
2395
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
2396
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
2397
+ page: Annotated[Optional[Annotated[int, Field(strict=True, ge=1)]], Field(description="Page number (1-based).")] = None,
2398
+ per_page: Annotated[Optional[Annotated[int, Field(le=100, strict=True, ge=1)]], Field(description="Items per page (max 100).")] = None,
2399
+ sort: Annotated[Optional[StrictStr], Field(description="Sort field with optional `-` prefix for descending. Allowed: uid, date, size.")] = None,
2400
+ _request_timeout: Union[
2401
+ None,
2402
+ Annotated[StrictFloat, Field(gt=0)],
2403
+ Tuple[
2404
+ Annotated[StrictFloat, Field(gt=0)],
2405
+ Annotated[StrictFloat, Field(gt=0)]
2406
+ ]
2407
+ ] = None,
2408
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2409
+ _content_type: Optional[StrictStr] = None,
2410
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2411
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2412
+ ) -> RESTResponseType:
2413
+ """List messages
2414
+
2415
+ List messages in a folder. Use POST /search for filtering. Sort fields: uid, date, size (prefix with `-` for descending). Default `-uid`.
2416
+
2417
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
2418
+ :type mailbox_resource_id: str
2419
+ :param folder: Folder path (URL-encoded). (required)
2420
+ :type folder: str
2421
+ :param page: Page number (1-based).
2422
+ :type page: int
2423
+ :param per_page: Items per page (max 100).
2424
+ :type per_page: int
2425
+ :param sort: Sort field with optional `-` prefix for descending. Allowed: uid, date, size.
2426
+ :type sort: str
2427
+ :param _request_timeout: timeout setting for this request. If one
2428
+ number provided, it will be total request
2429
+ timeout. It can also be a pair (tuple) of
2430
+ (connection, read) timeouts.
2431
+ :type _request_timeout: int, tuple(int, int), optional
2432
+ :param _request_auth: set to override the auth_settings for an a single
2433
+ request; this effectively ignores the
2434
+ authentication in the spec for a single request.
2435
+ :type _request_auth: dict, optional
2436
+ :param _content_type: force content-type for the request.
2437
+ :type _content_type: str, Optional
2438
+ :param _headers: set to override the headers for a single
2439
+ request; this effectively ignores the headers
2440
+ in the spec for a single request.
2441
+ :type _headers: dict, optional
2442
+ :param _host_index: set to override the host_index for a single
2443
+ request; this effectively ignores the host_index
2444
+ in the spec for a single request.
2445
+ :type _host_index: int, optional
2446
+ :return: Returns the result object.
2447
+ """ # noqa: E501
2448
+
2449
+ _param = self._list_messages_serialize(
2450
+ mailbox_resource_id=mailbox_resource_id,
2451
+ folder=folder,
2452
+ page=page,
2453
+ per_page=per_page,
2454
+ sort=sort,
2455
+ _request_auth=_request_auth,
2456
+ _content_type=_content_type,
2457
+ _headers=_headers,
2458
+ _host_index=_host_index
2459
+ )
2460
+
2461
+ _response_types_map: Dict[str, Optional[str]] = {
2462
+ '200': "V1FolderMessagesCollection",
2463
+ '401': "Error",
2464
+ '403': "Error",
2465
+ '422': "Error",
2466
+ '500': "Error",
2467
+ '502': "Error",
2468
+ }
2469
+ response_data = self.api_client.call_api(
2470
+ *_param,
2471
+ _request_timeout=_request_timeout
2472
+ )
2473
+ return response_data.response
2474
+
2475
+
2476
+ def _list_messages_serialize(
2477
+ self,
2478
+ mailbox_resource_id,
2479
+ folder,
2480
+ page,
2481
+ per_page,
2482
+ sort,
2483
+ _request_auth,
2484
+ _content_type,
2485
+ _headers,
2486
+ _host_index,
2487
+ ) -> RequestSerialized:
2488
+
2489
+ _host = None
2490
+
2491
+ _collection_formats: Dict[str, str] = {
2492
+ }
2493
+
2494
+ _path_params: Dict[str, str] = {}
2495
+ _query_params: List[Tuple[str, str]] = []
2496
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2497
+ _form_params: List[Tuple[str, str]] = []
2498
+ _files: Dict[
2499
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2500
+ ] = {}
2501
+ _body_params: Optional[bytes] = None
2502
+
2503
+ # process the path parameters
2504
+ if mailbox_resource_id is not None:
2505
+ _path_params['mailboxResourceId'] = mailbox_resource_id
2506
+ if folder is not None:
2507
+ _path_params['folder'] = folder
2508
+ # process the query parameters
2509
+ if page is not None:
2510
+
2511
+ _query_params.append(('page', page))
2512
+
2513
+ if per_page is not None:
2514
+
2515
+ _query_params.append(('perPage', per_page))
2516
+
2517
+ if sort is not None:
2518
+
2519
+ _query_params.append(('sort', sort))
2520
+
2521
+ # process the header parameters
2522
+ # process the form parameters
2523
+ # process the body parameter
2524
+
2525
+
2526
+ # set the HTTP header `Accept`
2527
+ if 'Accept' not in _header_params:
2528
+ _header_params['Accept'] = self.api_client.select_header_accept(
2529
+ [
2530
+ 'application/json'
2531
+ ]
2532
+ )
2533
+
2534
+
2535
+ # authentication setting
2536
+ _auth_settings: List[str] = [
2537
+ 'BearerAuth'
2538
+ ]
2539
+
2540
+ return self.api_client.param_serialize(
2541
+ method='GET',
2542
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages',
2543
+ path_params=_path_params,
2544
+ query_params=_query_params,
2545
+ header_params=_header_params,
2546
+ body=_body_params,
2547
+ post_params=_form_params,
2548
+ files=_files,
2549
+ auth_settings=_auth_settings,
2550
+ collection_formats=_collection_formats,
2551
+ _host=_host,
2552
+ _request_auth=_request_auth
2553
+ )
2554
+
2555
+
2556
+
2557
+
2558
+ @validate_call
2559
+ def move_message(
2560
+ self,
2561
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
2562
+ folder: Annotated[StrictStr, Field(description="Source folder path (URL-encoded).")],
2563
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
2564
+ v1_folder_messages_move_request: V1FolderMessagesMoveRequest,
2565
+ _request_timeout: Union[
2566
+ None,
2567
+ Annotated[StrictFloat, Field(gt=0)],
2568
+ Tuple[
2569
+ Annotated[StrictFloat, Field(gt=0)],
2570
+ Annotated[StrictFloat, Field(gt=0)]
2571
+ ]
2572
+ ] = None,
2573
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2574
+ _content_type: Optional[StrictStr] = None,
2575
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2576
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2577
+ ) -> None:
2578
+ """Move message
2579
+
2580
+ Move a single message to a target folder.
2581
+
2582
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
2583
+ :type mailbox_resource_id: str
2584
+ :param folder: Source folder path (URL-encoded). (required)
2585
+ :type folder: str
2586
+ :param uid: Message UID. (required)
2587
+ :type uid: int
2588
+ :param v1_folder_messages_move_request: (required)
2589
+ :type v1_folder_messages_move_request: V1FolderMessagesMoveRequest
2590
+ :param _request_timeout: timeout setting for this request. If one
2591
+ number provided, it will be total request
2592
+ timeout. It can also be a pair (tuple) of
2593
+ (connection, read) timeouts.
2594
+ :type _request_timeout: int, tuple(int, int), optional
2595
+ :param _request_auth: set to override the auth_settings for an a single
2596
+ request; this effectively ignores the
2597
+ authentication in the spec for a single request.
2598
+ :type _request_auth: dict, optional
2599
+ :param _content_type: force content-type for the request.
2600
+ :type _content_type: str, Optional
2601
+ :param _headers: set to override the headers for a single
2602
+ request; this effectively ignores the headers
2603
+ in the spec for a single request.
2604
+ :type _headers: dict, optional
2605
+ :param _host_index: set to override the host_index for a single
2606
+ request; this effectively ignores the host_index
2607
+ in the spec for a single request.
2608
+ :type _host_index: int, optional
2609
+ :return: Returns the result object.
2610
+ """ # noqa: E501
2611
+
2612
+ _param = self._move_message_serialize(
2613
+ mailbox_resource_id=mailbox_resource_id,
2614
+ folder=folder,
2615
+ uid=uid,
2616
+ v1_folder_messages_move_request=v1_folder_messages_move_request,
2617
+ _request_auth=_request_auth,
2618
+ _content_type=_content_type,
2619
+ _headers=_headers,
2620
+ _host_index=_host_index
2621
+ )
2622
+
2623
+ _response_types_map: Dict[str, Optional[str]] = {
2624
+ '204': None,
2625
+ '401': "Error",
2626
+ '403': "Error",
2627
+ '422': "Error",
2628
+ '500': "Error",
2629
+ '502': "Error",
2630
+ }
2631
+ response_data = self.api_client.call_api(
2632
+ *_param,
2633
+ _request_timeout=_request_timeout
2634
+ )
2635
+ response_data.read()
2636
+ return self.api_client.response_deserialize(
2637
+ response_data=response_data,
2638
+ response_types_map=_response_types_map,
2639
+ ).data
2640
+
2641
+
2642
+ @validate_call
2643
+ def move_message_with_http_info(
2644
+ self,
2645
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
2646
+ folder: Annotated[StrictStr, Field(description="Source folder path (URL-encoded).")],
2647
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
2648
+ v1_folder_messages_move_request: V1FolderMessagesMoveRequest,
2649
+ _request_timeout: Union[
2650
+ None,
2651
+ Annotated[StrictFloat, Field(gt=0)],
2652
+ Tuple[
2653
+ Annotated[StrictFloat, Field(gt=0)],
2654
+ Annotated[StrictFloat, Field(gt=0)]
2655
+ ]
2656
+ ] = None,
2657
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2658
+ _content_type: Optional[StrictStr] = None,
2659
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2660
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2661
+ ) -> ApiResponse[None]:
2662
+ """Move message
2663
+
2664
+ Move a single message to a target folder.
2665
+
2666
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
2667
+ :type mailbox_resource_id: str
2668
+ :param folder: Source folder path (URL-encoded). (required)
2669
+ :type folder: str
2670
+ :param uid: Message UID. (required)
2671
+ :type uid: int
2672
+ :param v1_folder_messages_move_request: (required)
2673
+ :type v1_folder_messages_move_request: V1FolderMessagesMoveRequest
2674
+ :param _request_timeout: timeout setting for this request. If one
2675
+ number provided, it will be total request
2676
+ timeout. It can also be a pair (tuple) of
2677
+ (connection, read) timeouts.
2678
+ :type _request_timeout: int, tuple(int, int), optional
2679
+ :param _request_auth: set to override the auth_settings for an a single
2680
+ request; this effectively ignores the
2681
+ authentication in the spec for a single request.
2682
+ :type _request_auth: dict, optional
2683
+ :param _content_type: force content-type for the request.
2684
+ :type _content_type: str, Optional
2685
+ :param _headers: set to override the headers for a single
2686
+ request; this effectively ignores the headers
2687
+ in the spec for a single request.
2688
+ :type _headers: dict, optional
2689
+ :param _host_index: set to override the host_index for a single
2690
+ request; this effectively ignores the host_index
2691
+ in the spec for a single request.
2692
+ :type _host_index: int, optional
2693
+ :return: Returns the result object.
2694
+ """ # noqa: E501
2695
+
2696
+ _param = self._move_message_serialize(
2697
+ mailbox_resource_id=mailbox_resource_id,
2698
+ folder=folder,
2699
+ uid=uid,
2700
+ v1_folder_messages_move_request=v1_folder_messages_move_request,
2701
+ _request_auth=_request_auth,
2702
+ _content_type=_content_type,
2703
+ _headers=_headers,
2704
+ _host_index=_host_index
2705
+ )
2706
+
2707
+ _response_types_map: Dict[str, Optional[str]] = {
2708
+ '204': None,
2709
+ '401': "Error",
2710
+ '403': "Error",
2711
+ '422': "Error",
2712
+ '500': "Error",
2713
+ '502': "Error",
2714
+ }
2715
+ response_data = self.api_client.call_api(
2716
+ *_param,
2717
+ _request_timeout=_request_timeout
2718
+ )
2719
+ response_data.read()
2720
+ return self.api_client.response_deserialize(
2721
+ response_data=response_data,
2722
+ response_types_map=_response_types_map,
2723
+ )
2724
+
2725
+
2726
+ @validate_call
2727
+ def move_message_without_preload_content(
2728
+ self,
2729
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
2730
+ folder: Annotated[StrictStr, Field(description="Source folder path (URL-encoded).")],
2731
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
2732
+ v1_folder_messages_move_request: V1FolderMessagesMoveRequest,
2733
+ _request_timeout: Union[
2734
+ None,
2735
+ Annotated[StrictFloat, Field(gt=0)],
2736
+ Tuple[
2737
+ Annotated[StrictFloat, Field(gt=0)],
2738
+ Annotated[StrictFloat, Field(gt=0)]
2739
+ ]
2740
+ ] = None,
2741
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2742
+ _content_type: Optional[StrictStr] = None,
2743
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2744
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2745
+ ) -> RESTResponseType:
2746
+ """Move message
2747
+
2748
+ Move a single message to a target folder.
2749
+
2750
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
2751
+ :type mailbox_resource_id: str
2752
+ :param folder: Source folder path (URL-encoded). (required)
2753
+ :type folder: str
2754
+ :param uid: Message UID. (required)
2755
+ :type uid: int
2756
+ :param v1_folder_messages_move_request: (required)
2757
+ :type v1_folder_messages_move_request: V1FolderMessagesMoveRequest
2758
+ :param _request_timeout: timeout setting for this request. If one
2759
+ number provided, it will be total request
2760
+ timeout. It can also be a pair (tuple) of
2761
+ (connection, read) timeouts.
2762
+ :type _request_timeout: int, tuple(int, int), optional
2763
+ :param _request_auth: set to override the auth_settings for an a single
2764
+ request; this effectively ignores the
2765
+ authentication in the spec for a single request.
2766
+ :type _request_auth: dict, optional
2767
+ :param _content_type: force content-type for the request.
2768
+ :type _content_type: str, Optional
2769
+ :param _headers: set to override the headers for a single
2770
+ request; this effectively ignores the headers
2771
+ in the spec for a single request.
2772
+ :type _headers: dict, optional
2773
+ :param _host_index: set to override the host_index for a single
2774
+ request; this effectively ignores the host_index
2775
+ in the spec for a single request.
2776
+ :type _host_index: int, optional
2777
+ :return: Returns the result object.
2778
+ """ # noqa: E501
2779
+
2780
+ _param = self._move_message_serialize(
2781
+ mailbox_resource_id=mailbox_resource_id,
2782
+ folder=folder,
2783
+ uid=uid,
2784
+ v1_folder_messages_move_request=v1_folder_messages_move_request,
2785
+ _request_auth=_request_auth,
2786
+ _content_type=_content_type,
2787
+ _headers=_headers,
2788
+ _host_index=_host_index
2789
+ )
2790
+
2791
+ _response_types_map: Dict[str, Optional[str]] = {
2792
+ '204': None,
2793
+ '401': "Error",
2794
+ '403': "Error",
2795
+ '422': "Error",
2796
+ '500': "Error",
2797
+ '502': "Error",
2798
+ }
2799
+ response_data = self.api_client.call_api(
2800
+ *_param,
2801
+ _request_timeout=_request_timeout
2802
+ )
2803
+ return response_data.response
2804
+
2805
+
2806
+ def _move_message_serialize(
2807
+ self,
2808
+ mailbox_resource_id,
2809
+ folder,
2810
+ uid,
2811
+ v1_folder_messages_move_request,
2812
+ _request_auth,
2813
+ _content_type,
2814
+ _headers,
2815
+ _host_index,
2816
+ ) -> RequestSerialized:
2817
+
2818
+ _host = None
2819
+
2820
+ _collection_formats: Dict[str, str] = {
2821
+ }
2822
+
2823
+ _path_params: Dict[str, str] = {}
2824
+ _query_params: List[Tuple[str, str]] = []
2825
+ _header_params: Dict[str, Optional[str]] = _headers or {}
2826
+ _form_params: List[Tuple[str, str]] = []
2827
+ _files: Dict[
2828
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
2829
+ ] = {}
2830
+ _body_params: Optional[bytes] = None
2831
+
2832
+ # process the path parameters
2833
+ if mailbox_resource_id is not None:
2834
+ _path_params['mailboxResourceId'] = mailbox_resource_id
2835
+ if folder is not None:
2836
+ _path_params['folder'] = folder
2837
+ if uid is not None:
2838
+ _path_params['uid'] = uid
2839
+ # process the query parameters
2840
+ # process the header parameters
2841
+ # process the form parameters
2842
+ # process the body parameter
2843
+ if v1_folder_messages_move_request is not None:
2844
+ _body_params = v1_folder_messages_move_request
2845
+
2846
+
2847
+ # set the HTTP header `Accept`
2848
+ if 'Accept' not in _header_params:
2849
+ _header_params['Accept'] = self.api_client.select_header_accept(
2850
+ [
2851
+ 'application/json'
2852
+ ]
2853
+ )
2854
+
2855
+ # set the HTTP header `Content-Type`
2856
+ if _content_type:
2857
+ _header_params['Content-Type'] = _content_type
2858
+ else:
2859
+ _default_content_type = (
2860
+ self.api_client.select_header_content_type(
2861
+ [
2862
+ 'application/json'
2863
+ ]
2864
+ )
2865
+ )
2866
+ if _default_content_type is not None:
2867
+ _header_params['Content-Type'] = _default_content_type
2868
+
2869
+ # authentication setting
2870
+ _auth_settings: List[str] = [
2871
+ 'BearerAuth'
2872
+ ]
2873
+
2874
+ return self.api_client.param_serialize(
2875
+ method='POST',
2876
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages/{uid}/move',
2877
+ path_params=_path_params,
2878
+ query_params=_query_params,
2879
+ header_params=_header_params,
2880
+ body=_body_params,
2881
+ post_params=_form_params,
2882
+ files=_files,
2883
+ auth_settings=_auth_settings,
2884
+ collection_formats=_collection_formats,
2885
+ _host=_host,
2886
+ _request_auth=_request_auth
2887
+ )
2888
+
2889
+
2890
+
2891
+
2892
+ @validate_call
2893
+ def move_messages(
2894
+ self,
2895
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
2896
+ folder: Annotated[StrictStr, Field(description="Source folder path (URL-encoded).")],
2897
+ v1_folder_messages_move_bulk_request: V1FolderMessagesMoveBulkRequest,
2898
+ _request_timeout: Union[
2899
+ None,
2900
+ Annotated[StrictFloat, Field(gt=0)],
2901
+ Tuple[
2902
+ Annotated[StrictFloat, Field(gt=0)],
2903
+ Annotated[StrictFloat, Field(gt=0)]
2904
+ ]
2905
+ ] = None,
2906
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2907
+ _content_type: Optional[StrictStr] = None,
2908
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2909
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2910
+ ) -> None:
2911
+ """Move messages
2912
+
2913
+ Move multiple messages from a source folder to a target folder.
2914
+
2915
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
2916
+ :type mailbox_resource_id: str
2917
+ :param folder: Source folder path (URL-encoded). (required)
2918
+ :type folder: str
2919
+ :param v1_folder_messages_move_bulk_request: (required)
2920
+ :type v1_folder_messages_move_bulk_request: V1FolderMessagesMoveBulkRequest
2921
+ :param _request_timeout: timeout setting for this request. If one
2922
+ number provided, it will be total request
2923
+ timeout. It can also be a pair (tuple) of
2924
+ (connection, read) timeouts.
2925
+ :type _request_timeout: int, tuple(int, int), optional
2926
+ :param _request_auth: set to override the auth_settings for an a single
2927
+ request; this effectively ignores the
2928
+ authentication in the spec for a single request.
2929
+ :type _request_auth: dict, optional
2930
+ :param _content_type: force content-type for the request.
2931
+ :type _content_type: str, Optional
2932
+ :param _headers: set to override the headers for a single
2933
+ request; this effectively ignores the headers
2934
+ in the spec for a single request.
2935
+ :type _headers: dict, optional
2936
+ :param _host_index: set to override the host_index for a single
2937
+ request; this effectively ignores the host_index
2938
+ in the spec for a single request.
2939
+ :type _host_index: int, optional
2940
+ :return: Returns the result object.
2941
+ """ # noqa: E501
2942
+
2943
+ _param = self._move_messages_serialize(
2944
+ mailbox_resource_id=mailbox_resource_id,
2945
+ folder=folder,
2946
+ v1_folder_messages_move_bulk_request=v1_folder_messages_move_bulk_request,
2947
+ _request_auth=_request_auth,
2948
+ _content_type=_content_type,
2949
+ _headers=_headers,
2950
+ _host_index=_host_index
2951
+ )
2952
+
2953
+ _response_types_map: Dict[str, Optional[str]] = {
2954
+ '204': None,
2955
+ '401': "Error",
2956
+ '403': "Error",
2957
+ '422': "Error",
2958
+ '500': "Error",
2959
+ '502': "Error",
2960
+ }
2961
+ response_data = self.api_client.call_api(
2962
+ *_param,
2963
+ _request_timeout=_request_timeout
2964
+ )
2965
+ response_data.read()
2966
+ return self.api_client.response_deserialize(
2967
+ response_data=response_data,
2968
+ response_types_map=_response_types_map,
2969
+ ).data
2970
+
2971
+
2972
+ @validate_call
2973
+ def move_messages_with_http_info(
2974
+ self,
2975
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
2976
+ folder: Annotated[StrictStr, Field(description="Source folder path (URL-encoded).")],
2977
+ v1_folder_messages_move_bulk_request: V1FolderMessagesMoveBulkRequest,
2978
+ _request_timeout: Union[
2979
+ None,
2980
+ Annotated[StrictFloat, Field(gt=0)],
2981
+ Tuple[
2982
+ Annotated[StrictFloat, Field(gt=0)],
2983
+ Annotated[StrictFloat, Field(gt=0)]
2984
+ ]
2985
+ ] = None,
2986
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
2987
+ _content_type: Optional[StrictStr] = None,
2988
+ _headers: Optional[Dict[StrictStr, Any]] = None,
2989
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
2990
+ ) -> ApiResponse[None]:
2991
+ """Move messages
2992
+
2993
+ Move multiple messages from a source folder to a target folder.
2994
+
2995
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
2996
+ :type mailbox_resource_id: str
2997
+ :param folder: Source folder path (URL-encoded). (required)
2998
+ :type folder: str
2999
+ :param v1_folder_messages_move_bulk_request: (required)
3000
+ :type v1_folder_messages_move_bulk_request: V1FolderMessagesMoveBulkRequest
3001
+ :param _request_timeout: timeout setting for this request. If one
3002
+ number provided, it will be total request
3003
+ timeout. It can also be a pair (tuple) of
3004
+ (connection, read) timeouts.
3005
+ :type _request_timeout: int, tuple(int, int), optional
3006
+ :param _request_auth: set to override the auth_settings for an a single
3007
+ request; this effectively ignores the
3008
+ authentication in the spec for a single request.
3009
+ :type _request_auth: dict, optional
3010
+ :param _content_type: force content-type for the request.
3011
+ :type _content_type: str, Optional
3012
+ :param _headers: set to override the headers for a single
3013
+ request; this effectively ignores the headers
3014
+ in the spec for a single request.
3015
+ :type _headers: dict, optional
3016
+ :param _host_index: set to override the host_index for a single
3017
+ request; this effectively ignores the host_index
3018
+ in the spec for a single request.
3019
+ :type _host_index: int, optional
3020
+ :return: Returns the result object.
3021
+ """ # noqa: E501
3022
+
3023
+ _param = self._move_messages_serialize(
3024
+ mailbox_resource_id=mailbox_resource_id,
3025
+ folder=folder,
3026
+ v1_folder_messages_move_bulk_request=v1_folder_messages_move_bulk_request,
3027
+ _request_auth=_request_auth,
3028
+ _content_type=_content_type,
3029
+ _headers=_headers,
3030
+ _host_index=_host_index
3031
+ )
3032
+
3033
+ _response_types_map: Dict[str, Optional[str]] = {
3034
+ '204': None,
3035
+ '401': "Error",
3036
+ '403': "Error",
3037
+ '422': "Error",
3038
+ '500': "Error",
3039
+ '502': "Error",
3040
+ }
3041
+ response_data = self.api_client.call_api(
3042
+ *_param,
3043
+ _request_timeout=_request_timeout
3044
+ )
3045
+ response_data.read()
3046
+ return self.api_client.response_deserialize(
3047
+ response_data=response_data,
3048
+ response_types_map=_response_types_map,
3049
+ )
3050
+
3051
+
3052
+ @validate_call
3053
+ def move_messages_without_preload_content(
3054
+ self,
3055
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
3056
+ folder: Annotated[StrictStr, Field(description="Source folder path (URL-encoded).")],
3057
+ v1_folder_messages_move_bulk_request: V1FolderMessagesMoveBulkRequest,
3058
+ _request_timeout: Union[
3059
+ None,
3060
+ Annotated[StrictFloat, Field(gt=0)],
3061
+ Tuple[
3062
+ Annotated[StrictFloat, Field(gt=0)],
3063
+ Annotated[StrictFloat, Field(gt=0)]
3064
+ ]
3065
+ ] = None,
3066
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3067
+ _content_type: Optional[StrictStr] = None,
3068
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3069
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3070
+ ) -> RESTResponseType:
3071
+ """Move messages
3072
+
3073
+ Move multiple messages from a source folder to a target folder.
3074
+
3075
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
3076
+ :type mailbox_resource_id: str
3077
+ :param folder: Source folder path (URL-encoded). (required)
3078
+ :type folder: str
3079
+ :param v1_folder_messages_move_bulk_request: (required)
3080
+ :type v1_folder_messages_move_bulk_request: V1FolderMessagesMoveBulkRequest
3081
+ :param _request_timeout: timeout setting for this request. If one
3082
+ number provided, it will be total request
3083
+ timeout. It can also be a pair (tuple) of
3084
+ (connection, read) timeouts.
3085
+ :type _request_timeout: int, tuple(int, int), optional
3086
+ :param _request_auth: set to override the auth_settings for an a single
3087
+ request; this effectively ignores the
3088
+ authentication in the spec for a single request.
3089
+ :type _request_auth: dict, optional
3090
+ :param _content_type: force content-type for the request.
3091
+ :type _content_type: str, Optional
3092
+ :param _headers: set to override the headers for a single
3093
+ request; this effectively ignores the headers
3094
+ in the spec for a single request.
3095
+ :type _headers: dict, optional
3096
+ :param _host_index: set to override the host_index for a single
3097
+ request; this effectively ignores the host_index
3098
+ in the spec for a single request.
3099
+ :type _host_index: int, optional
3100
+ :return: Returns the result object.
3101
+ """ # noqa: E501
3102
+
3103
+ _param = self._move_messages_serialize(
3104
+ mailbox_resource_id=mailbox_resource_id,
3105
+ folder=folder,
3106
+ v1_folder_messages_move_bulk_request=v1_folder_messages_move_bulk_request,
3107
+ _request_auth=_request_auth,
3108
+ _content_type=_content_type,
3109
+ _headers=_headers,
3110
+ _host_index=_host_index
3111
+ )
3112
+
3113
+ _response_types_map: Dict[str, Optional[str]] = {
3114
+ '204': None,
3115
+ '401': "Error",
3116
+ '403': "Error",
3117
+ '422': "Error",
3118
+ '500': "Error",
3119
+ '502': "Error",
3120
+ }
3121
+ response_data = self.api_client.call_api(
3122
+ *_param,
3123
+ _request_timeout=_request_timeout
3124
+ )
3125
+ return response_data.response
3126
+
3127
+
3128
+ def _move_messages_serialize(
3129
+ self,
3130
+ mailbox_resource_id,
3131
+ folder,
3132
+ v1_folder_messages_move_bulk_request,
3133
+ _request_auth,
3134
+ _content_type,
3135
+ _headers,
3136
+ _host_index,
3137
+ ) -> RequestSerialized:
3138
+
3139
+ _host = None
3140
+
3141
+ _collection_formats: Dict[str, str] = {
3142
+ }
3143
+
3144
+ _path_params: Dict[str, str] = {}
3145
+ _query_params: List[Tuple[str, str]] = []
3146
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3147
+ _form_params: List[Tuple[str, str]] = []
3148
+ _files: Dict[
3149
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3150
+ ] = {}
3151
+ _body_params: Optional[bytes] = None
3152
+
3153
+ # process the path parameters
3154
+ if mailbox_resource_id is not None:
3155
+ _path_params['mailboxResourceId'] = mailbox_resource_id
3156
+ if folder is not None:
3157
+ _path_params['folder'] = folder
3158
+ # process the query parameters
3159
+ # process the header parameters
3160
+ # process the form parameters
3161
+ # process the body parameter
3162
+ if v1_folder_messages_move_bulk_request is not None:
3163
+ _body_params = v1_folder_messages_move_bulk_request
3164
+
3165
+
3166
+ # set the HTTP header `Accept`
3167
+ if 'Accept' not in _header_params:
3168
+ _header_params['Accept'] = self.api_client.select_header_accept(
3169
+ [
3170
+ 'application/json'
3171
+ ]
3172
+ )
3173
+
3174
+ # set the HTTP header `Content-Type`
3175
+ if _content_type:
3176
+ _header_params['Content-Type'] = _content_type
3177
+ else:
3178
+ _default_content_type = (
3179
+ self.api_client.select_header_content_type(
3180
+ [
3181
+ 'application/json'
3182
+ ]
3183
+ )
3184
+ )
3185
+ if _default_content_type is not None:
3186
+ _header_params['Content-Type'] = _default_content_type
3187
+
3188
+ # authentication setting
3189
+ _auth_settings: List[str] = [
3190
+ 'BearerAuth'
3191
+ ]
3192
+
3193
+ return self.api_client.param_serialize(
3194
+ method='POST',
3195
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages/move',
3196
+ path_params=_path_params,
3197
+ query_params=_query_params,
3198
+ header_params=_header_params,
3199
+ body=_body_params,
3200
+ post_params=_form_params,
3201
+ files=_files,
3202
+ auth_settings=_auth_settings,
3203
+ collection_formats=_collection_formats,
3204
+ _host=_host,
3205
+ _request_auth=_request_auth
3206
+ )
3207
+
3208
+
3209
+
3210
+
3211
+ @validate_call
3212
+ def patch_message(
3213
+ self,
3214
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
3215
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
3216
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
3217
+ v1_folder_messages_flags_request: V1FolderMessagesFlagsRequest,
3218
+ _request_timeout: Union[
3219
+ None,
3220
+ Annotated[StrictFloat, Field(gt=0)],
3221
+ Tuple[
3222
+ Annotated[StrictFloat, Field(gt=0)],
3223
+ Annotated[StrictFloat, Field(gt=0)]
3224
+ ]
3225
+ ] = None,
3226
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3227
+ _content_type: Optional[StrictStr] = None,
3228
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3229
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3230
+ ) -> V1FolderMessagesResource:
3231
+ """Update message flags
3232
+
3233
+ Add and/or remove flags on a single message. Returns the updated message.
3234
+
3235
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
3236
+ :type mailbox_resource_id: str
3237
+ :param folder: Folder path (URL-encoded). (required)
3238
+ :type folder: str
3239
+ :param uid: Message UID. (required)
3240
+ :type uid: int
3241
+ :param v1_folder_messages_flags_request: (required)
3242
+ :type v1_folder_messages_flags_request: V1FolderMessagesFlagsRequest
3243
+ :param _request_timeout: timeout setting for this request. If one
3244
+ number provided, it will be total request
3245
+ timeout. It can also be a pair (tuple) of
3246
+ (connection, read) timeouts.
3247
+ :type _request_timeout: int, tuple(int, int), optional
3248
+ :param _request_auth: set to override the auth_settings for an a single
3249
+ request; this effectively ignores the
3250
+ authentication in the spec for a single request.
3251
+ :type _request_auth: dict, optional
3252
+ :param _content_type: force content-type for the request.
3253
+ :type _content_type: str, Optional
3254
+ :param _headers: set to override the headers for a single
3255
+ request; this effectively ignores the headers
3256
+ in the spec for a single request.
3257
+ :type _headers: dict, optional
3258
+ :param _host_index: set to override the host_index for a single
3259
+ request; this effectively ignores the host_index
3260
+ in the spec for a single request.
3261
+ :type _host_index: int, optional
3262
+ :return: Returns the result object.
3263
+ """ # noqa: E501
3264
+
3265
+ _param = self._patch_message_serialize(
3266
+ mailbox_resource_id=mailbox_resource_id,
3267
+ folder=folder,
3268
+ uid=uid,
3269
+ v1_folder_messages_flags_request=v1_folder_messages_flags_request,
3270
+ _request_auth=_request_auth,
3271
+ _content_type=_content_type,
3272
+ _headers=_headers,
3273
+ _host_index=_host_index
3274
+ )
3275
+
3276
+ _response_types_map: Dict[str, Optional[str]] = {
3277
+ '200': "V1FolderMessagesResource",
3278
+ '401': "Error",
3279
+ '403': "Error",
3280
+ '404': "Error",
3281
+ '422': "Error",
3282
+ '500': "Error",
3283
+ '502': "Error",
3284
+ }
3285
+ response_data = self.api_client.call_api(
3286
+ *_param,
3287
+ _request_timeout=_request_timeout
3288
+ )
3289
+ response_data.read()
3290
+ return self.api_client.response_deserialize(
3291
+ response_data=response_data,
3292
+ response_types_map=_response_types_map,
3293
+ ).data
3294
+
3295
+
3296
+ @validate_call
3297
+ def patch_message_with_http_info(
3298
+ self,
3299
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
3300
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
3301
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
3302
+ v1_folder_messages_flags_request: V1FolderMessagesFlagsRequest,
3303
+ _request_timeout: Union[
3304
+ None,
3305
+ Annotated[StrictFloat, Field(gt=0)],
3306
+ Tuple[
3307
+ Annotated[StrictFloat, Field(gt=0)],
3308
+ Annotated[StrictFloat, Field(gt=0)]
3309
+ ]
3310
+ ] = None,
3311
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3312
+ _content_type: Optional[StrictStr] = None,
3313
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3314
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3315
+ ) -> ApiResponse[V1FolderMessagesResource]:
3316
+ """Update message flags
3317
+
3318
+ Add and/or remove flags on a single message. Returns the updated message.
3319
+
3320
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
3321
+ :type mailbox_resource_id: str
3322
+ :param folder: Folder path (URL-encoded). (required)
3323
+ :type folder: str
3324
+ :param uid: Message UID. (required)
3325
+ :type uid: int
3326
+ :param v1_folder_messages_flags_request: (required)
3327
+ :type v1_folder_messages_flags_request: V1FolderMessagesFlagsRequest
3328
+ :param _request_timeout: timeout setting for this request. If one
3329
+ number provided, it will be total request
3330
+ timeout. It can also be a pair (tuple) of
3331
+ (connection, read) timeouts.
3332
+ :type _request_timeout: int, tuple(int, int), optional
3333
+ :param _request_auth: set to override the auth_settings for an a single
3334
+ request; this effectively ignores the
3335
+ authentication in the spec for a single request.
3336
+ :type _request_auth: dict, optional
3337
+ :param _content_type: force content-type for the request.
3338
+ :type _content_type: str, Optional
3339
+ :param _headers: set to override the headers for a single
3340
+ request; this effectively ignores the headers
3341
+ in the spec for a single request.
3342
+ :type _headers: dict, optional
3343
+ :param _host_index: set to override the host_index for a single
3344
+ request; this effectively ignores the host_index
3345
+ in the spec for a single request.
3346
+ :type _host_index: int, optional
3347
+ :return: Returns the result object.
3348
+ """ # noqa: E501
3349
+
3350
+ _param = self._patch_message_serialize(
3351
+ mailbox_resource_id=mailbox_resource_id,
3352
+ folder=folder,
3353
+ uid=uid,
3354
+ v1_folder_messages_flags_request=v1_folder_messages_flags_request,
3355
+ _request_auth=_request_auth,
3356
+ _content_type=_content_type,
3357
+ _headers=_headers,
3358
+ _host_index=_host_index
3359
+ )
3360
+
3361
+ _response_types_map: Dict[str, Optional[str]] = {
3362
+ '200': "V1FolderMessagesResource",
3363
+ '401': "Error",
3364
+ '403': "Error",
3365
+ '404': "Error",
3366
+ '422': "Error",
3367
+ '500': "Error",
3368
+ '502': "Error",
3369
+ }
3370
+ response_data = self.api_client.call_api(
3371
+ *_param,
3372
+ _request_timeout=_request_timeout
3373
+ )
3374
+ response_data.read()
3375
+ return self.api_client.response_deserialize(
3376
+ response_data=response_data,
3377
+ response_types_map=_response_types_map,
3378
+ )
3379
+
3380
+
3381
+ @validate_call
3382
+ def patch_message_without_preload_content(
3383
+ self,
3384
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
3385
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
3386
+ uid: Annotated[int, Field(strict=True, ge=1, description="Message UID.")],
3387
+ v1_folder_messages_flags_request: V1FolderMessagesFlagsRequest,
3388
+ _request_timeout: Union[
3389
+ None,
3390
+ Annotated[StrictFloat, Field(gt=0)],
3391
+ Tuple[
3392
+ Annotated[StrictFloat, Field(gt=0)],
3393
+ Annotated[StrictFloat, Field(gt=0)]
3394
+ ]
3395
+ ] = None,
3396
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3397
+ _content_type: Optional[StrictStr] = None,
3398
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3399
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3400
+ ) -> RESTResponseType:
3401
+ """Update message flags
3402
+
3403
+ Add and/or remove flags on a single message. Returns the updated message.
3404
+
3405
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
3406
+ :type mailbox_resource_id: str
3407
+ :param folder: Folder path (URL-encoded). (required)
3408
+ :type folder: str
3409
+ :param uid: Message UID. (required)
3410
+ :type uid: int
3411
+ :param v1_folder_messages_flags_request: (required)
3412
+ :type v1_folder_messages_flags_request: V1FolderMessagesFlagsRequest
3413
+ :param _request_timeout: timeout setting for this request. If one
3414
+ number provided, it will be total request
3415
+ timeout. It can also be a pair (tuple) of
3416
+ (connection, read) timeouts.
3417
+ :type _request_timeout: int, tuple(int, int), optional
3418
+ :param _request_auth: set to override the auth_settings for an a single
3419
+ request; this effectively ignores the
3420
+ authentication in the spec for a single request.
3421
+ :type _request_auth: dict, optional
3422
+ :param _content_type: force content-type for the request.
3423
+ :type _content_type: str, Optional
3424
+ :param _headers: set to override the headers for a single
3425
+ request; this effectively ignores the headers
3426
+ in the spec for a single request.
3427
+ :type _headers: dict, optional
3428
+ :param _host_index: set to override the host_index for a single
3429
+ request; this effectively ignores the host_index
3430
+ in the spec for a single request.
3431
+ :type _host_index: int, optional
3432
+ :return: Returns the result object.
3433
+ """ # noqa: E501
3434
+
3435
+ _param = self._patch_message_serialize(
3436
+ mailbox_resource_id=mailbox_resource_id,
3437
+ folder=folder,
3438
+ uid=uid,
3439
+ v1_folder_messages_flags_request=v1_folder_messages_flags_request,
3440
+ _request_auth=_request_auth,
3441
+ _content_type=_content_type,
3442
+ _headers=_headers,
3443
+ _host_index=_host_index
3444
+ )
3445
+
3446
+ _response_types_map: Dict[str, Optional[str]] = {
3447
+ '200': "V1FolderMessagesResource",
3448
+ '401': "Error",
3449
+ '403': "Error",
3450
+ '404': "Error",
3451
+ '422': "Error",
3452
+ '500': "Error",
3453
+ '502': "Error",
3454
+ }
3455
+ response_data = self.api_client.call_api(
3456
+ *_param,
3457
+ _request_timeout=_request_timeout
3458
+ )
3459
+ return response_data.response
3460
+
3461
+
3462
+ def _patch_message_serialize(
3463
+ self,
3464
+ mailbox_resource_id,
3465
+ folder,
3466
+ uid,
3467
+ v1_folder_messages_flags_request,
3468
+ _request_auth,
3469
+ _content_type,
3470
+ _headers,
3471
+ _host_index,
3472
+ ) -> RequestSerialized:
3473
+
3474
+ _host = None
3475
+
3476
+ _collection_formats: Dict[str, str] = {
3477
+ }
3478
+
3479
+ _path_params: Dict[str, str] = {}
3480
+ _query_params: List[Tuple[str, str]] = []
3481
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3482
+ _form_params: List[Tuple[str, str]] = []
3483
+ _files: Dict[
3484
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3485
+ ] = {}
3486
+ _body_params: Optional[bytes] = None
3487
+
3488
+ # process the path parameters
3489
+ if mailbox_resource_id is not None:
3490
+ _path_params['mailboxResourceId'] = mailbox_resource_id
3491
+ if folder is not None:
3492
+ _path_params['folder'] = folder
3493
+ if uid is not None:
3494
+ _path_params['uid'] = uid
3495
+ # process the query parameters
3496
+ # process the header parameters
3497
+ # process the form parameters
3498
+ # process the body parameter
3499
+ if v1_folder_messages_flags_request is not None:
3500
+ _body_params = v1_folder_messages_flags_request
3501
+
3502
+
3503
+ # set the HTTP header `Accept`
3504
+ if 'Accept' not in _header_params:
3505
+ _header_params['Accept'] = self.api_client.select_header_accept(
3506
+ [
3507
+ 'application/json'
3508
+ ]
3509
+ )
3510
+
3511
+ # set the HTTP header `Content-Type`
3512
+ if _content_type:
3513
+ _header_params['Content-Type'] = _content_type
3514
+ else:
3515
+ _default_content_type = (
3516
+ self.api_client.select_header_content_type(
3517
+ [
3518
+ 'application/json'
3519
+ ]
3520
+ )
3521
+ )
3522
+ if _default_content_type is not None:
3523
+ _header_params['Content-Type'] = _default_content_type
3524
+
3525
+ # authentication setting
3526
+ _auth_settings: List[str] = [
3527
+ 'BearerAuth'
3528
+ ]
3529
+
3530
+ return self.api_client.param_serialize(
3531
+ method='PATCH',
3532
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages/{uid}',
3533
+ path_params=_path_params,
3534
+ query_params=_query_params,
3535
+ header_params=_header_params,
3536
+ body=_body_params,
3537
+ post_params=_form_params,
3538
+ files=_files,
3539
+ auth_settings=_auth_settings,
3540
+ collection_formats=_collection_formats,
3541
+ _host=_host,
3542
+ _request_auth=_request_auth
3543
+ )
3544
+
3545
+
3546
+
3547
+
3548
+ @validate_call
3549
+ def search_messages(
3550
+ self,
3551
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
3552
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
3553
+ page: Optional[Annotated[int, Field(strict=True, ge=1)]] = None,
3554
+ per_page: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None,
3555
+ sort: Optional[StrictStr] = None,
3556
+ v1_folder_messages_search_request: Optional[V1FolderMessagesSearchRequest] = None,
3557
+ _request_timeout: Union[
3558
+ None,
3559
+ Annotated[StrictFloat, Field(gt=0)],
3560
+ Tuple[
3561
+ Annotated[StrictFloat, Field(gt=0)],
3562
+ Annotated[StrictFloat, Field(gt=0)]
3563
+ ]
3564
+ ] = None,
3565
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3566
+ _content_type: Optional[StrictStr] = None,
3567
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3568
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3569
+ ) -> V1FolderMessagesCollection:
3570
+ """Search messages
3571
+
3572
+ Search messages in a folder. Filters in body; pagination and sort via query (`page`, `perPage`, `sort`).
3573
+
3574
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
3575
+ :type mailbox_resource_id: str
3576
+ :param folder: Folder path (URL-encoded). (required)
3577
+ :type folder: str
3578
+ :param page:
3579
+ :type page: int
3580
+ :param per_page:
3581
+ :type per_page: int
3582
+ :param sort:
3583
+ :type sort: str
3584
+ :param v1_folder_messages_search_request:
3585
+ :type v1_folder_messages_search_request: V1FolderMessagesSearchRequest
3586
+ :param _request_timeout: timeout setting for this request. If one
3587
+ number provided, it will be total request
3588
+ timeout. It can also be a pair (tuple) of
3589
+ (connection, read) timeouts.
3590
+ :type _request_timeout: int, tuple(int, int), optional
3591
+ :param _request_auth: set to override the auth_settings for an a single
3592
+ request; this effectively ignores the
3593
+ authentication in the spec for a single request.
3594
+ :type _request_auth: dict, optional
3595
+ :param _content_type: force content-type for the request.
3596
+ :type _content_type: str, Optional
3597
+ :param _headers: set to override the headers for a single
3598
+ request; this effectively ignores the headers
3599
+ in the spec for a single request.
3600
+ :type _headers: dict, optional
3601
+ :param _host_index: set to override the host_index for a single
3602
+ request; this effectively ignores the host_index
3603
+ in the spec for a single request.
3604
+ :type _host_index: int, optional
3605
+ :return: Returns the result object.
3606
+ """ # noqa: E501
3607
+
3608
+ _param = self._search_messages_serialize(
3609
+ mailbox_resource_id=mailbox_resource_id,
3610
+ folder=folder,
3611
+ page=page,
3612
+ per_page=per_page,
3613
+ sort=sort,
3614
+ v1_folder_messages_search_request=v1_folder_messages_search_request,
3615
+ _request_auth=_request_auth,
3616
+ _content_type=_content_type,
3617
+ _headers=_headers,
3618
+ _host_index=_host_index
3619
+ )
3620
+
3621
+ _response_types_map: Dict[str, Optional[str]] = {
3622
+ '200': "V1FolderMessagesCollection",
3623
+ '401': "Error",
3624
+ '403': "Error",
3625
+ '422': "Error",
3626
+ '500': "Error",
3627
+ '502': "Error",
3628
+ }
3629
+ response_data = self.api_client.call_api(
3630
+ *_param,
3631
+ _request_timeout=_request_timeout
3632
+ )
3633
+ response_data.read()
3634
+ return self.api_client.response_deserialize(
3635
+ response_data=response_data,
3636
+ response_types_map=_response_types_map,
3637
+ ).data
3638
+
3639
+
3640
+ @validate_call
3641
+ def search_messages_with_http_info(
3642
+ self,
3643
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
3644
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
3645
+ page: Optional[Annotated[int, Field(strict=True, ge=1)]] = None,
3646
+ per_page: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None,
3647
+ sort: Optional[StrictStr] = None,
3648
+ v1_folder_messages_search_request: Optional[V1FolderMessagesSearchRequest] = None,
3649
+ _request_timeout: Union[
3650
+ None,
3651
+ Annotated[StrictFloat, Field(gt=0)],
3652
+ Tuple[
3653
+ Annotated[StrictFloat, Field(gt=0)],
3654
+ Annotated[StrictFloat, Field(gt=0)]
3655
+ ]
3656
+ ] = None,
3657
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3658
+ _content_type: Optional[StrictStr] = None,
3659
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3660
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3661
+ ) -> ApiResponse[V1FolderMessagesCollection]:
3662
+ """Search messages
3663
+
3664
+ Search messages in a folder. Filters in body; pagination and sort via query (`page`, `perPage`, `sort`).
3665
+
3666
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
3667
+ :type mailbox_resource_id: str
3668
+ :param folder: Folder path (URL-encoded). (required)
3669
+ :type folder: str
3670
+ :param page:
3671
+ :type page: int
3672
+ :param per_page:
3673
+ :type per_page: int
3674
+ :param sort:
3675
+ :type sort: str
3676
+ :param v1_folder_messages_search_request:
3677
+ :type v1_folder_messages_search_request: V1FolderMessagesSearchRequest
3678
+ :param _request_timeout: timeout setting for this request. If one
3679
+ number provided, it will be total request
3680
+ timeout. It can also be a pair (tuple) of
3681
+ (connection, read) timeouts.
3682
+ :type _request_timeout: int, tuple(int, int), optional
3683
+ :param _request_auth: set to override the auth_settings for an a single
3684
+ request; this effectively ignores the
3685
+ authentication in the spec for a single request.
3686
+ :type _request_auth: dict, optional
3687
+ :param _content_type: force content-type for the request.
3688
+ :type _content_type: str, Optional
3689
+ :param _headers: set to override the headers for a single
3690
+ request; this effectively ignores the headers
3691
+ in the spec for a single request.
3692
+ :type _headers: dict, optional
3693
+ :param _host_index: set to override the host_index for a single
3694
+ request; this effectively ignores the host_index
3695
+ in the spec for a single request.
3696
+ :type _host_index: int, optional
3697
+ :return: Returns the result object.
3698
+ """ # noqa: E501
3699
+
3700
+ _param = self._search_messages_serialize(
3701
+ mailbox_resource_id=mailbox_resource_id,
3702
+ folder=folder,
3703
+ page=page,
3704
+ per_page=per_page,
3705
+ sort=sort,
3706
+ v1_folder_messages_search_request=v1_folder_messages_search_request,
3707
+ _request_auth=_request_auth,
3708
+ _content_type=_content_type,
3709
+ _headers=_headers,
3710
+ _host_index=_host_index
3711
+ )
3712
+
3713
+ _response_types_map: Dict[str, Optional[str]] = {
3714
+ '200': "V1FolderMessagesCollection",
3715
+ '401': "Error",
3716
+ '403': "Error",
3717
+ '422': "Error",
3718
+ '500': "Error",
3719
+ '502': "Error",
3720
+ }
3721
+ response_data = self.api_client.call_api(
3722
+ *_param,
3723
+ _request_timeout=_request_timeout
3724
+ )
3725
+ response_data.read()
3726
+ return self.api_client.response_deserialize(
3727
+ response_data=response_data,
3728
+ response_types_map=_response_types_map,
3729
+ )
3730
+
3731
+
3732
+ @validate_call
3733
+ def search_messages_without_preload_content(
3734
+ self,
3735
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
3736
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
3737
+ page: Optional[Annotated[int, Field(strict=True, ge=1)]] = None,
3738
+ per_page: Optional[Annotated[int, Field(le=100, strict=True, ge=1)]] = None,
3739
+ sort: Optional[StrictStr] = None,
3740
+ v1_folder_messages_search_request: Optional[V1FolderMessagesSearchRequest] = None,
3741
+ _request_timeout: Union[
3742
+ None,
3743
+ Annotated[StrictFloat, Field(gt=0)],
3744
+ Tuple[
3745
+ Annotated[StrictFloat, Field(gt=0)],
3746
+ Annotated[StrictFloat, Field(gt=0)]
3747
+ ]
3748
+ ] = None,
3749
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3750
+ _content_type: Optional[StrictStr] = None,
3751
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3752
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3753
+ ) -> RESTResponseType:
3754
+ """Search messages
3755
+
3756
+ Search messages in a folder. Filters in body; pagination and sort via query (`page`, `perPage`, `sort`).
3757
+
3758
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
3759
+ :type mailbox_resource_id: str
3760
+ :param folder: Folder path (URL-encoded). (required)
3761
+ :type folder: str
3762
+ :param page:
3763
+ :type page: int
3764
+ :param per_page:
3765
+ :type per_page: int
3766
+ :param sort:
3767
+ :type sort: str
3768
+ :param v1_folder_messages_search_request:
3769
+ :type v1_folder_messages_search_request: V1FolderMessagesSearchRequest
3770
+ :param _request_timeout: timeout setting for this request. If one
3771
+ number provided, it will be total request
3772
+ timeout. It can also be a pair (tuple) of
3773
+ (connection, read) timeouts.
3774
+ :type _request_timeout: int, tuple(int, int), optional
3775
+ :param _request_auth: set to override the auth_settings for an a single
3776
+ request; this effectively ignores the
3777
+ authentication in the spec for a single request.
3778
+ :type _request_auth: dict, optional
3779
+ :param _content_type: force content-type for the request.
3780
+ :type _content_type: str, Optional
3781
+ :param _headers: set to override the headers for a single
3782
+ request; this effectively ignores the headers
3783
+ in the spec for a single request.
3784
+ :type _headers: dict, optional
3785
+ :param _host_index: set to override the host_index for a single
3786
+ request; this effectively ignores the host_index
3787
+ in the spec for a single request.
3788
+ :type _host_index: int, optional
3789
+ :return: Returns the result object.
3790
+ """ # noqa: E501
3791
+
3792
+ _param = self._search_messages_serialize(
3793
+ mailbox_resource_id=mailbox_resource_id,
3794
+ folder=folder,
3795
+ page=page,
3796
+ per_page=per_page,
3797
+ sort=sort,
3798
+ v1_folder_messages_search_request=v1_folder_messages_search_request,
3799
+ _request_auth=_request_auth,
3800
+ _content_type=_content_type,
3801
+ _headers=_headers,
3802
+ _host_index=_host_index
3803
+ )
3804
+
3805
+ _response_types_map: Dict[str, Optional[str]] = {
3806
+ '200': "V1FolderMessagesCollection",
3807
+ '401': "Error",
3808
+ '403': "Error",
3809
+ '422': "Error",
3810
+ '500': "Error",
3811
+ '502': "Error",
3812
+ }
3813
+ response_data = self.api_client.call_api(
3814
+ *_param,
3815
+ _request_timeout=_request_timeout
3816
+ )
3817
+ return response_data.response
3818
+
3819
+
3820
+ def _search_messages_serialize(
3821
+ self,
3822
+ mailbox_resource_id,
3823
+ folder,
3824
+ page,
3825
+ per_page,
3826
+ sort,
3827
+ v1_folder_messages_search_request,
3828
+ _request_auth,
3829
+ _content_type,
3830
+ _headers,
3831
+ _host_index,
3832
+ ) -> RequestSerialized:
3833
+
3834
+ _host = None
3835
+
3836
+ _collection_formats: Dict[str, str] = {
3837
+ }
3838
+
3839
+ _path_params: Dict[str, str] = {}
3840
+ _query_params: List[Tuple[str, str]] = []
3841
+ _header_params: Dict[str, Optional[str]] = _headers or {}
3842
+ _form_params: List[Tuple[str, str]] = []
3843
+ _files: Dict[
3844
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
3845
+ ] = {}
3846
+ _body_params: Optional[bytes] = None
3847
+
3848
+ # process the path parameters
3849
+ if mailbox_resource_id is not None:
3850
+ _path_params['mailboxResourceId'] = mailbox_resource_id
3851
+ if folder is not None:
3852
+ _path_params['folder'] = folder
3853
+ # process the query parameters
3854
+ if page is not None:
3855
+
3856
+ _query_params.append(('page', page))
3857
+
3858
+ if per_page is not None:
3859
+
3860
+ _query_params.append(('perPage', per_page))
3861
+
3862
+ if sort is not None:
3863
+
3864
+ _query_params.append(('sort', sort))
3865
+
3866
+ # process the header parameters
3867
+ # process the form parameters
3868
+ # process the body parameter
3869
+ if v1_folder_messages_search_request is not None:
3870
+ _body_params = v1_folder_messages_search_request
3871
+
3872
+
3873
+ # set the HTTP header `Accept`
3874
+ if 'Accept' not in _header_params:
3875
+ _header_params['Accept'] = self.api_client.select_header_accept(
3876
+ [
3877
+ 'application/json'
3878
+ ]
3879
+ )
3880
+
3881
+ # set the HTTP header `Content-Type`
3882
+ if _content_type:
3883
+ _header_params['Content-Type'] = _content_type
3884
+ else:
3885
+ _default_content_type = (
3886
+ self.api_client.select_header_content_type(
3887
+ [
3888
+ 'application/json'
3889
+ ]
3890
+ )
3891
+ )
3892
+ if _default_content_type is not None:
3893
+ _header_params['Content-Type'] = _default_content_type
3894
+
3895
+ # authentication setting
3896
+ _auth_settings: List[str] = [
3897
+ 'BearerAuth'
3898
+ ]
3899
+
3900
+ return self.api_client.param_serialize(
3901
+ method='POST',
3902
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages/search',
3903
+ path_params=_path_params,
3904
+ query_params=_query_params,
3905
+ header_params=_header_params,
3906
+ body=_body_params,
3907
+ post_params=_form_params,
3908
+ files=_files,
3909
+ auth_settings=_auth_settings,
3910
+ collection_formats=_collection_formats,
3911
+ _host=_host,
3912
+ _request_auth=_request_auth
3913
+ )
3914
+
3915
+
3916
+
3917
+
3918
+ @validate_call
3919
+ def update_message_flags(
3920
+ self,
3921
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
3922
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
3923
+ v1_folder_messages_flags_bulk_request: V1FolderMessagesFlagsBulkRequest,
3924
+ _request_timeout: Union[
3925
+ None,
3926
+ Annotated[StrictFloat, Field(gt=0)],
3927
+ Tuple[
3928
+ Annotated[StrictFloat, Field(gt=0)],
3929
+ Annotated[StrictFloat, Field(gt=0)]
3930
+ ]
3931
+ ] = None,
3932
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
3933
+ _content_type: Optional[StrictStr] = None,
3934
+ _headers: Optional[Dict[StrictStr, Any]] = None,
3935
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
3936
+ ) -> V1FolderMessagesUpdateFlagsResult:
3937
+ """Update message flags
3938
+
3939
+ Add and/or remove flags on multiple messages. Returns 200 when all UIDs succeed, 207 with per-UID outcome when some fail.
3940
+
3941
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
3942
+ :type mailbox_resource_id: str
3943
+ :param folder: Folder path (URL-encoded). (required)
3944
+ :type folder: str
3945
+ :param v1_folder_messages_flags_bulk_request: (required)
3946
+ :type v1_folder_messages_flags_bulk_request: V1FolderMessagesFlagsBulkRequest
3947
+ :param _request_timeout: timeout setting for this request. If one
3948
+ number provided, it will be total request
3949
+ timeout. It can also be a pair (tuple) of
3950
+ (connection, read) timeouts.
3951
+ :type _request_timeout: int, tuple(int, int), optional
3952
+ :param _request_auth: set to override the auth_settings for an a single
3953
+ request; this effectively ignores the
3954
+ authentication in the spec for a single request.
3955
+ :type _request_auth: dict, optional
3956
+ :param _content_type: force content-type for the request.
3957
+ :type _content_type: str, Optional
3958
+ :param _headers: set to override the headers for a single
3959
+ request; this effectively ignores the headers
3960
+ in the spec for a single request.
3961
+ :type _headers: dict, optional
3962
+ :param _host_index: set to override the host_index for a single
3963
+ request; this effectively ignores the host_index
3964
+ in the spec for a single request.
3965
+ :type _host_index: int, optional
3966
+ :return: Returns the result object.
3967
+ """ # noqa: E501
3968
+
3969
+ _param = self._update_message_flags_serialize(
3970
+ mailbox_resource_id=mailbox_resource_id,
3971
+ folder=folder,
3972
+ v1_folder_messages_flags_bulk_request=v1_folder_messages_flags_bulk_request,
3973
+ _request_auth=_request_auth,
3974
+ _content_type=_content_type,
3975
+ _headers=_headers,
3976
+ _host_index=_host_index
3977
+ )
3978
+
3979
+ _response_types_map: Dict[str, Optional[str]] = {
3980
+ '200': "V1FolderMessagesUpdateFlagsResult",
3981
+ '207': "V1FolderMessagesUpdateFlagsResult",
3982
+ '401': "Error",
3983
+ '403': "Error",
3984
+ '422': "Error",
3985
+ '500': "Error",
3986
+ '502': "Error",
3987
+ }
3988
+ response_data = self.api_client.call_api(
3989
+ *_param,
3990
+ _request_timeout=_request_timeout
3991
+ )
3992
+ response_data.read()
3993
+ return self.api_client.response_deserialize(
3994
+ response_data=response_data,
3995
+ response_types_map=_response_types_map,
3996
+ ).data
3997
+
3998
+
3999
+ @validate_call
4000
+ def update_message_flags_with_http_info(
4001
+ self,
4002
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
4003
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
4004
+ v1_folder_messages_flags_bulk_request: V1FolderMessagesFlagsBulkRequest,
4005
+ _request_timeout: Union[
4006
+ None,
4007
+ Annotated[StrictFloat, Field(gt=0)],
4008
+ Tuple[
4009
+ Annotated[StrictFloat, Field(gt=0)],
4010
+ Annotated[StrictFloat, Field(gt=0)]
4011
+ ]
4012
+ ] = None,
4013
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
4014
+ _content_type: Optional[StrictStr] = None,
4015
+ _headers: Optional[Dict[StrictStr, Any]] = None,
4016
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
4017
+ ) -> ApiResponse[V1FolderMessagesUpdateFlagsResult]:
4018
+ """Update message flags
4019
+
4020
+ Add and/or remove flags on multiple messages. Returns 200 when all UIDs succeed, 207 with per-UID outcome when some fail.
4021
+
4022
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
4023
+ :type mailbox_resource_id: str
4024
+ :param folder: Folder path (URL-encoded). (required)
4025
+ :type folder: str
4026
+ :param v1_folder_messages_flags_bulk_request: (required)
4027
+ :type v1_folder_messages_flags_bulk_request: V1FolderMessagesFlagsBulkRequest
4028
+ :param _request_timeout: timeout setting for this request. If one
4029
+ number provided, it will be total request
4030
+ timeout. It can also be a pair (tuple) of
4031
+ (connection, read) timeouts.
4032
+ :type _request_timeout: int, tuple(int, int), optional
4033
+ :param _request_auth: set to override the auth_settings for an a single
4034
+ request; this effectively ignores the
4035
+ authentication in the spec for a single request.
4036
+ :type _request_auth: dict, optional
4037
+ :param _content_type: force content-type for the request.
4038
+ :type _content_type: str, Optional
4039
+ :param _headers: set to override the headers for a single
4040
+ request; this effectively ignores the headers
4041
+ in the spec for a single request.
4042
+ :type _headers: dict, optional
4043
+ :param _host_index: set to override the host_index for a single
4044
+ request; this effectively ignores the host_index
4045
+ in the spec for a single request.
4046
+ :type _host_index: int, optional
4047
+ :return: Returns the result object.
4048
+ """ # noqa: E501
4049
+
4050
+ _param = self._update_message_flags_serialize(
4051
+ mailbox_resource_id=mailbox_resource_id,
4052
+ folder=folder,
4053
+ v1_folder_messages_flags_bulk_request=v1_folder_messages_flags_bulk_request,
4054
+ _request_auth=_request_auth,
4055
+ _content_type=_content_type,
4056
+ _headers=_headers,
4057
+ _host_index=_host_index
4058
+ )
4059
+
4060
+ _response_types_map: Dict[str, Optional[str]] = {
4061
+ '200': "V1FolderMessagesUpdateFlagsResult",
4062
+ '207': "V1FolderMessagesUpdateFlagsResult",
4063
+ '401': "Error",
4064
+ '403': "Error",
4065
+ '422': "Error",
4066
+ '500': "Error",
4067
+ '502': "Error",
4068
+ }
4069
+ response_data = self.api_client.call_api(
4070
+ *_param,
4071
+ _request_timeout=_request_timeout
4072
+ )
4073
+ response_data.read()
4074
+ return self.api_client.response_deserialize(
4075
+ response_data=response_data,
4076
+ response_types_map=_response_types_map,
4077
+ )
4078
+
4079
+
4080
+ @validate_call
4081
+ def update_message_flags_without_preload_content(
4082
+ self,
4083
+ mailbox_resource_id: Annotated[StrictStr, Field(description="Resource ID of the managed mailbox the bearer token is authorized for.")],
4084
+ folder: Annotated[StrictStr, Field(description="Folder path (URL-encoded).")],
4085
+ v1_folder_messages_flags_bulk_request: V1FolderMessagesFlagsBulkRequest,
4086
+ _request_timeout: Union[
4087
+ None,
4088
+ Annotated[StrictFloat, Field(gt=0)],
4089
+ Tuple[
4090
+ Annotated[StrictFloat, Field(gt=0)],
4091
+ Annotated[StrictFloat, Field(gt=0)]
4092
+ ]
4093
+ ] = None,
4094
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
4095
+ _content_type: Optional[StrictStr] = None,
4096
+ _headers: Optional[Dict[StrictStr, Any]] = None,
4097
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
4098
+ ) -> RESTResponseType:
4099
+ """Update message flags
4100
+
4101
+ Add and/or remove flags on multiple messages. Returns 200 when all UIDs succeed, 207 with per-UID outcome when some fail.
4102
+
4103
+ :param mailbox_resource_id: Resource ID of the managed mailbox the bearer token is authorized for. (required)
4104
+ :type mailbox_resource_id: str
4105
+ :param folder: Folder path (URL-encoded). (required)
4106
+ :type folder: str
4107
+ :param v1_folder_messages_flags_bulk_request: (required)
4108
+ :type v1_folder_messages_flags_bulk_request: V1FolderMessagesFlagsBulkRequest
4109
+ :param _request_timeout: timeout setting for this request. If one
4110
+ number provided, it will be total request
4111
+ timeout. It can also be a pair (tuple) of
4112
+ (connection, read) timeouts.
4113
+ :type _request_timeout: int, tuple(int, int), optional
4114
+ :param _request_auth: set to override the auth_settings for an a single
4115
+ request; this effectively ignores the
4116
+ authentication in the spec for a single request.
4117
+ :type _request_auth: dict, optional
4118
+ :param _content_type: force content-type for the request.
4119
+ :type _content_type: str, Optional
4120
+ :param _headers: set to override the headers for a single
4121
+ request; this effectively ignores the headers
4122
+ in the spec for a single request.
4123
+ :type _headers: dict, optional
4124
+ :param _host_index: set to override the host_index for a single
4125
+ request; this effectively ignores the host_index
4126
+ in the spec for a single request.
4127
+ :type _host_index: int, optional
4128
+ :return: Returns the result object.
4129
+ """ # noqa: E501
4130
+
4131
+ _param = self._update_message_flags_serialize(
4132
+ mailbox_resource_id=mailbox_resource_id,
4133
+ folder=folder,
4134
+ v1_folder_messages_flags_bulk_request=v1_folder_messages_flags_bulk_request,
4135
+ _request_auth=_request_auth,
4136
+ _content_type=_content_type,
4137
+ _headers=_headers,
4138
+ _host_index=_host_index
4139
+ )
4140
+
4141
+ _response_types_map: Dict[str, Optional[str]] = {
4142
+ '200': "V1FolderMessagesUpdateFlagsResult",
4143
+ '207': "V1FolderMessagesUpdateFlagsResult",
4144
+ '401': "Error",
4145
+ '403': "Error",
4146
+ '422': "Error",
4147
+ '500': "Error",
4148
+ '502': "Error",
4149
+ }
4150
+ response_data = self.api_client.call_api(
4151
+ *_param,
4152
+ _request_timeout=_request_timeout
4153
+ )
4154
+ return response_data.response
4155
+
4156
+
4157
+ def _update_message_flags_serialize(
4158
+ self,
4159
+ mailbox_resource_id,
4160
+ folder,
4161
+ v1_folder_messages_flags_bulk_request,
4162
+ _request_auth,
4163
+ _content_type,
4164
+ _headers,
4165
+ _host_index,
4166
+ ) -> RequestSerialized:
4167
+
4168
+ _host = None
4169
+
4170
+ _collection_formats: Dict[str, str] = {
4171
+ }
4172
+
4173
+ _path_params: Dict[str, str] = {}
4174
+ _query_params: List[Tuple[str, str]] = []
4175
+ _header_params: Dict[str, Optional[str]] = _headers or {}
4176
+ _form_params: List[Tuple[str, str]] = []
4177
+ _files: Dict[
4178
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
4179
+ ] = {}
4180
+ _body_params: Optional[bytes] = None
4181
+
4182
+ # process the path parameters
4183
+ if mailbox_resource_id is not None:
4184
+ _path_params['mailboxResourceId'] = mailbox_resource_id
4185
+ if folder is not None:
4186
+ _path_params['folder'] = folder
4187
+ # process the query parameters
4188
+ # process the header parameters
4189
+ # process the form parameters
4190
+ # process the body parameter
4191
+ if v1_folder_messages_flags_bulk_request is not None:
4192
+ _body_params = v1_folder_messages_flags_bulk_request
4193
+
4194
+
4195
+ # set the HTTP header `Accept`
4196
+ if 'Accept' not in _header_params:
4197
+ _header_params['Accept'] = self.api_client.select_header_accept(
4198
+ [
4199
+ 'application/json'
4200
+ ]
4201
+ )
4202
+
4203
+ # set the HTTP header `Content-Type`
4204
+ if _content_type:
4205
+ _header_params['Content-Type'] = _content_type
4206
+ else:
4207
+ _default_content_type = (
4208
+ self.api_client.select_header_content_type(
4209
+ [
4210
+ 'application/json'
4211
+ ]
4212
+ )
4213
+ )
4214
+ if _default_content_type is not None:
4215
+ _header_params['Content-Type'] = _default_content_type
4216
+
4217
+ # authentication setting
4218
+ _auth_settings: List[str] = [
4219
+ 'BearerAuth'
4220
+ ]
4221
+
4222
+ return self.api_client.param_serialize(
4223
+ method='POST',
4224
+ resource_path='/api/v1/mailboxes/{mailboxResourceId}/folders/{folder}/messages/flags',
4225
+ path_params=_path_params,
4226
+ query_params=_query_params,
4227
+ header_params=_header_params,
4228
+ body=_body_params,
4229
+ post_params=_form_params,
4230
+ files=_files,
4231
+ auth_settings=_auth_settings,
4232
+ collection_formats=_collection_formats,
4233
+ _host=_host,
4234
+ _request_auth=_request_auth
4235
+ )
4236
+
4237
+