one-msg-sdk 1.0.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (85) hide show
  1. one_msg_sdk/__init__.py +189 -0
  2. one_msg_sdk/api/__init__.py +14 -0
  3. one_msg_sdk/api/calling_api.py +901 -0
  4. one_msg_sdk/api/catalog_api.py +607 -0
  5. one_msg_sdk/api/channel_api.py +874 -0
  6. one_msg_sdk/api/flows_api.py +3212 -0
  7. one_msg_sdk/api/groups_api.py +1935 -0
  8. one_msg_sdk/api/messaging_api.py +7419 -0
  9. one_msg_sdk/api/profile_api.py +609 -0
  10. one_msg_sdk/api/templates_api.py +1180 -0
  11. one_msg_sdk/api/users_api.py +903 -0
  12. one_msg_sdk/api/webhooks_api.py +605 -0
  13. one_msg_sdk/api_client.py +805 -0
  14. one_msg_sdk/api_response.py +21 -0
  15. one_msg_sdk/configuration.py +635 -0
  16. one_msg_sdk/exceptions.py +219 -0
  17. one_msg_sdk/models/__init__.py +78 -0
  18. one_msg_sdk/models/add_template_request.py +108 -0
  19. one_msg_sdk/models/block_user_request.py +102 -0
  20. one_msg_sdk/models/conversational_automation.py +115 -0
  21. one_msg_sdk/models/conversational_automation_commands_inner.py +105 -0
  22. one_msg_sdk/models/create_commerce200_response.py +102 -0
  23. one_msg_sdk/models/create_commerce_request.py +106 -0
  24. one_msg_sdk/models/create_commerce_request_params.py +104 -0
  25. one_msg_sdk/models/create_groups200_response.py +107 -0
  26. one_msg_sdk/models/create_read_message200_response.py +102 -0
  27. one_msg_sdk/models/create_read_message401_response.py +89 -0
  28. one_msg_sdk/models/create_read_message_request.py +93 -0
  29. one_msg_sdk/models/delete_flows_flow_id200_response.py +109 -0
  30. one_msg_sdk/models/delete_groups_group_id200_response.py +104 -0
  31. one_msg_sdk/models/delete_media_legacy_request.py +102 -0
  32. one_msg_sdk/models/error_response.py +89 -0
  33. one_msg_sdk/models/get_commerce200_response_inner.py +106 -0
  34. one_msg_sdk/models/get_mm_lite_status200_response.py +106 -0
  35. one_msg_sdk/models/get_webhook200_response.py +102 -0
  36. one_msg_sdk/models/get_whatsapp_business_encryption200_response.py +116 -0
  37. one_msg_sdk/models/list_blocked_users200_response.py +102 -0
  38. one_msg_sdk/models/list_flows200_response.py +115 -0
  39. one_msg_sdk/models/list_messages200_response.py +104 -0
  40. one_msg_sdk/models/list_templates200_response.py +106 -0
  41. one_msg_sdk/models/message_sent_response.py +108 -0
  42. one_msg_sdk/models/patch_flows_flow_id_assets200_response.py +111 -0
  43. one_msg_sdk/models/profile_info.py +126 -0
  44. one_msg_sdk/models/retrieve_media200_response.py +110 -0
  45. one_msg_sdk/models/send_address_message_request.py +126 -0
  46. one_msg_sdk/models/send_button_request.py +103 -0
  47. one_msg_sdk/models/send_button_request_sections_inner.py +95 -0
  48. one_msg_sdk/models/send_button_request_sections_inner_reply.py +91 -0
  49. one_msg_sdk/models/send_carousel_request1.py +97 -0
  50. one_msg_sdk/models/send_contact_request.py +99 -0
  51. one_msg_sdk/models/send_contact_request_contacts_inner.py +117 -0
  52. one_msg_sdk/models/send_contact_request_contacts_inner_name.py +99 -0
  53. one_msg_sdk/models/send_contact_request_contacts_inner_org.py +93 -0
  54. one_msg_sdk/models/send_contact_request_contacts_inner_phones_inner.py +93 -0
  55. one_msg_sdk/models/send_cta_url_request.py +116 -0
  56. one_msg_sdk/models/send_file_request.py +129 -0
  57. one_msg_sdk/models/send_flow_request1.py +141 -0
  58. one_msg_sdk/models/send_flow_request1_header.py +144 -0
  59. one_msg_sdk/models/send_flow_request_header.py +144 -0
  60. one_msg_sdk/models/send_list_request.py +105 -0
  61. one_msg_sdk/models/send_list_request_sections_inner.py +99 -0
  62. one_msg_sdk/models/send_list_request_sections_inner_rows_inner.py +93 -0
  63. one_msg_sdk/models/send_location_request1.py +101 -0
  64. one_msg_sdk/models/send_location_request_request.py +91 -0
  65. one_msg_sdk/models/send_message_request.py +122 -0
  66. one_msg_sdk/models/send_order_details_request.py +128 -0
  67. one_msg_sdk/models/send_order_details_request_language.py +104 -0
  68. one_msg_sdk/models/send_order_details_request_order.py +124 -0
  69. one_msg_sdk/models/send_order_details_request_order_items_inner.py +112 -0
  70. one_msg_sdk/models/send_order_details_request_order_items_inner_amount.py +104 -0
  71. one_msg_sdk/models/send_payment_request_request.py +117 -0
  72. one_msg_sdk/models/send_reaction_request.py +93 -0
  73. one_msg_sdk/models/send_sticker_request.py +110 -0
  74. one_msg_sdk/models/send_template_request.py +107 -0
  75. one_msg_sdk/models/send_template_request_language.py +91 -0
  76. one_msg_sdk/models/set_whatsapp_business_encryption_request.py +89 -0
  77. one_msg_sdk/models/success_response.py +102 -0
  78. one_msg_sdk/models/update_me_request.py +114 -0
  79. one_msg_sdk/py.typed +0 -0
  80. one_msg_sdk/rest.py +264 -0
  81. one_msg_sdk-1.0.0.dist-info/METADATA +19 -0
  82. one_msg_sdk-1.0.0.dist-info/RECORD +85 -0
  83. one_msg_sdk-1.0.0.dist-info/WHEEL +5 -0
  84. one_msg_sdk-1.0.0.dist-info/licenses/LICENSE +21 -0
  85. one_msg_sdk-1.0.0.dist-info/top_level.txt +1 -0
@@ -0,0 +1,901 @@
1
+ """
2
+ 1MSG WhatsApp Business API (Public)
3
+
4
+ Public client API for sending messages, managing groups, flows, and templates. This is the API exposed to end customers via platform.1msg.io **Authentication:** All requests require `token` query parameter with JWT or API key. **Documentation:** https://help.1msg.io/platform-1msg/getting-start/quick-start **API Docs:** https://docs.1msg.io/
5
+
6
+ The version of the OpenAPI document: 1.0.0
7
+ Contact: support@1msg.io
8
+ Generated by OpenAPI Generator (https://openapi-generator.tech)
9
+
10
+ Do not edit the class manually.
11
+ """ # noqa: E501
12
+
13
+
14
+ import warnings
15
+ from pydantic import validate_call, Field, StrictFloat, StrictStr, StrictInt
16
+ from typing import Any, Dict, List, Optional, Tuple, Union
17
+ from typing_extensions import Annotated
18
+
19
+ from pydantic import Field, StrictStr
20
+ from typing import Any, Dict, Optional
21
+ from typing_extensions import Annotated
22
+
23
+ from one_msg_sdk.api_client import ApiClient, RequestSerialized
24
+ from one_msg_sdk.api_response import ApiResponse
25
+ from one_msg_sdk.rest import RESTResponseType
26
+
27
+
28
+ class CallingApi:
29
+ """NOTE: This class is auto generated by OpenAPI Generator
30
+ Ref: https://openapi-generator.tech
31
+
32
+ Do not edit the class manually.
33
+ """
34
+
35
+ def __init__(self, api_client=None) -> None:
36
+ if api_client is None:
37
+ api_client = ApiClient.get_default()
38
+ self.api_client = api_client
39
+
40
+
41
+ @validate_call
42
+ def get_calling_settings(
43
+ self,
44
+ token: Annotated[StrictStr, Field(description="JWT token or API key for authorization")],
45
+ _request_timeout: Union[
46
+ None,
47
+ Annotated[StrictFloat, Field(gt=0)],
48
+ Tuple[
49
+ Annotated[StrictFloat, Field(gt=0)],
50
+ Annotated[StrictFloat, Field(gt=0)]
51
+ ]
52
+ ] = None,
53
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
54
+ _content_type: Optional[StrictStr] = None,
55
+ _headers: Optional[Dict[StrictStr, Any]] = None,
56
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
57
+ ) -> Dict[str, object]:
58
+ """Get calling settings
59
+
60
+ WhatsApp Calling API settings (beta). Requires Meta Calling enablement on the WABA. Not production-complete — paths and webhook field names may change. Trial/subscription-limited channels are blocked.
61
+
62
+ :param token: JWT token or API key for authorization (required)
63
+ :type token: str
64
+ :param _request_timeout: timeout setting for this request. If one
65
+ number provided, it will be total request
66
+ timeout. It can also be a pair (tuple) of
67
+ (connection, read) timeouts.
68
+ :type _request_timeout: int, tuple(int, int), optional
69
+ :param _request_auth: set to override the auth_settings for an a single
70
+ request; this effectively ignores the
71
+ authentication in the spec for a single request.
72
+ :type _request_auth: dict, optional
73
+ :param _content_type: force content-type for the request.
74
+ :type _content_type: str, Optional
75
+ :param _headers: set to override the headers for a single
76
+ request; this effectively ignores the headers
77
+ in the spec for a single request.
78
+ :type _headers: dict, optional
79
+ :param _host_index: set to override the host_index for a single
80
+ request; this effectively ignores the host_index
81
+ in the spec for a single request.
82
+ :type _host_index: int, optional
83
+ :return: Returns the result object.
84
+ """ # noqa: E501
85
+
86
+ _param = self._get_calling_settings_serialize(
87
+ token=token,
88
+ _request_auth=_request_auth,
89
+ _content_type=_content_type,
90
+ _headers=_headers,
91
+ _host_index=_host_index
92
+ )
93
+
94
+ _response_types_map: Dict[str, Optional[str]] = {
95
+ '200': "Dict[str, object]",
96
+ '401': "ErrorResponse",
97
+ '500': "ErrorResponse",
98
+ }
99
+ response_data = self.api_client.call_api(
100
+ *_param,
101
+ _request_timeout=_request_timeout
102
+ )
103
+ response_data.read()
104
+ return self.api_client.response_deserialize(
105
+ response_data=response_data,
106
+ response_types_map=_response_types_map,
107
+ ).data
108
+
109
+
110
+ @validate_call
111
+ def get_calling_settings_with_http_info(
112
+ self,
113
+ token: Annotated[StrictStr, Field(description="JWT token or API key for authorization")],
114
+ _request_timeout: Union[
115
+ None,
116
+ Annotated[StrictFloat, Field(gt=0)],
117
+ Tuple[
118
+ Annotated[StrictFloat, Field(gt=0)],
119
+ Annotated[StrictFloat, Field(gt=0)]
120
+ ]
121
+ ] = None,
122
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
123
+ _content_type: Optional[StrictStr] = None,
124
+ _headers: Optional[Dict[StrictStr, Any]] = None,
125
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
126
+ ) -> ApiResponse[Dict[str, object]]:
127
+ """Get calling settings
128
+
129
+ WhatsApp Calling API settings (beta). Requires Meta Calling enablement on the WABA. Not production-complete — paths and webhook field names may change. Trial/subscription-limited channels are blocked.
130
+
131
+ :param token: JWT token or API key for authorization (required)
132
+ :type token: str
133
+ :param _request_timeout: timeout setting for this request. If one
134
+ number provided, it will be total request
135
+ timeout. It can also be a pair (tuple) of
136
+ (connection, read) timeouts.
137
+ :type _request_timeout: int, tuple(int, int), optional
138
+ :param _request_auth: set to override the auth_settings for an a single
139
+ request; this effectively ignores the
140
+ authentication in the spec for a single request.
141
+ :type _request_auth: dict, optional
142
+ :param _content_type: force content-type for the request.
143
+ :type _content_type: str, Optional
144
+ :param _headers: set to override the headers for a single
145
+ request; this effectively ignores the headers
146
+ in the spec for a single request.
147
+ :type _headers: dict, optional
148
+ :param _host_index: set to override the host_index for a single
149
+ request; this effectively ignores the host_index
150
+ in the spec for a single request.
151
+ :type _host_index: int, optional
152
+ :return: Returns the result object.
153
+ """ # noqa: E501
154
+
155
+ _param = self._get_calling_settings_serialize(
156
+ token=token,
157
+ _request_auth=_request_auth,
158
+ _content_type=_content_type,
159
+ _headers=_headers,
160
+ _host_index=_host_index
161
+ )
162
+
163
+ _response_types_map: Dict[str, Optional[str]] = {
164
+ '200': "Dict[str, object]",
165
+ '401': "ErrorResponse",
166
+ '500': "ErrorResponse",
167
+ }
168
+ response_data = self.api_client.call_api(
169
+ *_param,
170
+ _request_timeout=_request_timeout
171
+ )
172
+ response_data.read()
173
+ return self.api_client.response_deserialize(
174
+ response_data=response_data,
175
+ response_types_map=_response_types_map,
176
+ )
177
+
178
+
179
+ @validate_call
180
+ def get_calling_settings_without_preload_content(
181
+ self,
182
+ token: Annotated[StrictStr, Field(description="JWT token or API key for authorization")],
183
+ _request_timeout: Union[
184
+ None,
185
+ Annotated[StrictFloat, Field(gt=0)],
186
+ Tuple[
187
+ Annotated[StrictFloat, Field(gt=0)],
188
+ Annotated[StrictFloat, Field(gt=0)]
189
+ ]
190
+ ] = None,
191
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
192
+ _content_type: Optional[StrictStr] = None,
193
+ _headers: Optional[Dict[StrictStr, Any]] = None,
194
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
195
+ ) -> RESTResponseType:
196
+ """Get calling settings
197
+
198
+ WhatsApp Calling API settings (beta). Requires Meta Calling enablement on the WABA. Not production-complete — paths and webhook field names may change. Trial/subscription-limited channels are blocked.
199
+
200
+ :param token: JWT token or API key for authorization (required)
201
+ :type token: str
202
+ :param _request_timeout: timeout setting for this request. If one
203
+ number provided, it will be total request
204
+ timeout. It can also be a pair (tuple) of
205
+ (connection, read) timeouts.
206
+ :type _request_timeout: int, tuple(int, int), optional
207
+ :param _request_auth: set to override the auth_settings for an a single
208
+ request; this effectively ignores the
209
+ authentication in the spec for a single request.
210
+ :type _request_auth: dict, optional
211
+ :param _content_type: force content-type for the request.
212
+ :type _content_type: str, Optional
213
+ :param _headers: set to override the headers for a single
214
+ request; this effectively ignores the headers
215
+ in the spec for a single request.
216
+ :type _headers: dict, optional
217
+ :param _host_index: set to override the host_index for a single
218
+ request; this effectively ignores the host_index
219
+ in the spec for a single request.
220
+ :type _host_index: int, optional
221
+ :return: Returns the result object.
222
+ """ # noqa: E501
223
+
224
+ _param = self._get_calling_settings_serialize(
225
+ token=token,
226
+ _request_auth=_request_auth,
227
+ _content_type=_content_type,
228
+ _headers=_headers,
229
+ _host_index=_host_index
230
+ )
231
+
232
+ _response_types_map: Dict[str, Optional[str]] = {
233
+ '200': "Dict[str, object]",
234
+ '401': "ErrorResponse",
235
+ '500': "ErrorResponse",
236
+ }
237
+ response_data = self.api_client.call_api(
238
+ *_param,
239
+ _request_timeout=_request_timeout
240
+ )
241
+ return response_data.response
242
+
243
+
244
+ def _get_calling_settings_serialize(
245
+ self,
246
+ token,
247
+ _request_auth,
248
+ _content_type,
249
+ _headers,
250
+ _host_index,
251
+ ) -> RequestSerialized:
252
+
253
+ _host = None
254
+
255
+ _collection_formats: Dict[str, str] = {
256
+ }
257
+
258
+ _path_params: Dict[str, str] = {}
259
+ _query_params: List[Tuple[str, str]] = []
260
+ _header_params: Dict[str, Optional[str]] = _headers or {}
261
+ _form_params: List[Tuple[str, str]] = []
262
+ _files: Dict[
263
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
264
+ ] = {}
265
+ _body_params: Optional[bytes] = None
266
+
267
+ # process the path parameters
268
+ # process the query parameters
269
+ if token is not None:
270
+
271
+ _query_params.append(('token', token))
272
+
273
+ # process the header parameters
274
+ # process the form parameters
275
+ # process the body parameter
276
+
277
+
278
+ # set the HTTP header `Accept`
279
+ if 'Accept' not in _header_params:
280
+ _header_params['Accept'] = self.api_client.select_header_accept(
281
+ [
282
+ 'application/json'
283
+ ]
284
+ )
285
+
286
+
287
+ # authentication setting
288
+ _auth_settings: List[str] = [
289
+ 'tokenAuth'
290
+ ]
291
+
292
+ return self.api_client.param_serialize(
293
+ method='GET',
294
+ resource_path='/callingSettings',
295
+ path_params=_path_params,
296
+ query_params=_query_params,
297
+ header_params=_header_params,
298
+ body=_body_params,
299
+ post_params=_form_params,
300
+ files=_files,
301
+ auth_settings=_auth_settings,
302
+ collection_formats=_collection_formats,
303
+ _host=_host,
304
+ _request_auth=_request_auth
305
+ )
306
+
307
+
308
+
309
+
310
+ @validate_call
311
+ def initiate_call(
312
+ self,
313
+ token: Annotated[StrictStr, Field(description="JWT token or API key for authorization")],
314
+ request_body: Optional[Dict[str, Any]] = None,
315
+ _request_timeout: Union[
316
+ None,
317
+ Annotated[StrictFloat, Field(gt=0)],
318
+ Tuple[
319
+ Annotated[StrictFloat, Field(gt=0)],
320
+ Annotated[StrictFloat, Field(gt=0)]
321
+ ]
322
+ ] = None,
323
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
324
+ _content_type: Optional[StrictStr] = None,
325
+ _headers: Optional[Dict[StrictStr, Any]] = None,
326
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
327
+ ) -> Dict[str, object]:
328
+ """Initiate WhatsApp call
329
+
330
+ Outbound Calling API (beta). Requires Meta Calling enablement and product consent. Not production-complete — verify on stage before relying on this in production. Trial/subscription-limited channels are blocked.
331
+
332
+ :param token: JWT token or API key for authorization (required)
333
+ :type token: str
334
+ :param request_body:
335
+ :type request_body: Dict[str, object]
336
+ :param _request_timeout: timeout setting for this request. If one
337
+ number provided, it will be total request
338
+ timeout. It can also be a pair (tuple) of
339
+ (connection, read) timeouts.
340
+ :type _request_timeout: int, tuple(int, int), optional
341
+ :param _request_auth: set to override the auth_settings for an a single
342
+ request; this effectively ignores the
343
+ authentication in the spec for a single request.
344
+ :type _request_auth: dict, optional
345
+ :param _content_type: force content-type for the request.
346
+ :type _content_type: str, Optional
347
+ :param _headers: set to override the headers for a single
348
+ request; this effectively ignores the headers
349
+ in the spec for a single request.
350
+ :type _headers: dict, optional
351
+ :param _host_index: set to override the host_index for a single
352
+ request; this effectively ignores the host_index
353
+ in the spec for a single request.
354
+ :type _host_index: int, optional
355
+ :return: Returns the result object.
356
+ """ # noqa: E501
357
+
358
+ _param = self._initiate_call_serialize(
359
+ token=token,
360
+ request_body=request_body,
361
+ _request_auth=_request_auth,
362
+ _content_type=_content_type,
363
+ _headers=_headers,
364
+ _host_index=_host_index
365
+ )
366
+
367
+ _response_types_map: Dict[str, Optional[str]] = {
368
+ '200': "Dict[str, object]",
369
+ '401': "ErrorResponse",
370
+ '500': "ErrorResponse",
371
+ }
372
+ response_data = self.api_client.call_api(
373
+ *_param,
374
+ _request_timeout=_request_timeout
375
+ )
376
+ response_data.read()
377
+ return self.api_client.response_deserialize(
378
+ response_data=response_data,
379
+ response_types_map=_response_types_map,
380
+ ).data
381
+
382
+
383
+ @validate_call
384
+ def initiate_call_with_http_info(
385
+ self,
386
+ token: Annotated[StrictStr, Field(description="JWT token or API key for authorization")],
387
+ request_body: Optional[Dict[str, Any]] = None,
388
+ _request_timeout: Union[
389
+ None,
390
+ Annotated[StrictFloat, Field(gt=0)],
391
+ Tuple[
392
+ Annotated[StrictFloat, Field(gt=0)],
393
+ Annotated[StrictFloat, Field(gt=0)]
394
+ ]
395
+ ] = None,
396
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
397
+ _content_type: Optional[StrictStr] = None,
398
+ _headers: Optional[Dict[StrictStr, Any]] = None,
399
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
400
+ ) -> ApiResponse[Dict[str, object]]:
401
+ """Initiate WhatsApp call
402
+
403
+ Outbound Calling API (beta). Requires Meta Calling enablement and product consent. Not production-complete — verify on stage before relying on this in production. Trial/subscription-limited channels are blocked.
404
+
405
+ :param token: JWT token or API key for authorization (required)
406
+ :type token: str
407
+ :param request_body:
408
+ :type request_body: Dict[str, object]
409
+ :param _request_timeout: timeout setting for this request. If one
410
+ number provided, it will be total request
411
+ timeout. It can also be a pair (tuple) of
412
+ (connection, read) timeouts.
413
+ :type _request_timeout: int, tuple(int, int), optional
414
+ :param _request_auth: set to override the auth_settings for an a single
415
+ request; this effectively ignores the
416
+ authentication in the spec for a single request.
417
+ :type _request_auth: dict, optional
418
+ :param _content_type: force content-type for the request.
419
+ :type _content_type: str, Optional
420
+ :param _headers: set to override the headers for a single
421
+ request; this effectively ignores the headers
422
+ in the spec for a single request.
423
+ :type _headers: dict, optional
424
+ :param _host_index: set to override the host_index for a single
425
+ request; this effectively ignores the host_index
426
+ in the spec for a single request.
427
+ :type _host_index: int, optional
428
+ :return: Returns the result object.
429
+ """ # noqa: E501
430
+
431
+ _param = self._initiate_call_serialize(
432
+ token=token,
433
+ request_body=request_body,
434
+ _request_auth=_request_auth,
435
+ _content_type=_content_type,
436
+ _headers=_headers,
437
+ _host_index=_host_index
438
+ )
439
+
440
+ _response_types_map: Dict[str, Optional[str]] = {
441
+ '200': "Dict[str, object]",
442
+ '401': "ErrorResponse",
443
+ '500': "ErrorResponse",
444
+ }
445
+ response_data = self.api_client.call_api(
446
+ *_param,
447
+ _request_timeout=_request_timeout
448
+ )
449
+ response_data.read()
450
+ return self.api_client.response_deserialize(
451
+ response_data=response_data,
452
+ response_types_map=_response_types_map,
453
+ )
454
+
455
+
456
+ @validate_call
457
+ def initiate_call_without_preload_content(
458
+ self,
459
+ token: Annotated[StrictStr, Field(description="JWT token or API key for authorization")],
460
+ request_body: Optional[Dict[str, Any]] = None,
461
+ _request_timeout: Union[
462
+ None,
463
+ Annotated[StrictFloat, Field(gt=0)],
464
+ Tuple[
465
+ Annotated[StrictFloat, Field(gt=0)],
466
+ Annotated[StrictFloat, Field(gt=0)]
467
+ ]
468
+ ] = None,
469
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
470
+ _content_type: Optional[StrictStr] = None,
471
+ _headers: Optional[Dict[StrictStr, Any]] = None,
472
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
473
+ ) -> RESTResponseType:
474
+ """Initiate WhatsApp call
475
+
476
+ Outbound Calling API (beta). Requires Meta Calling enablement and product consent. Not production-complete — verify on stage before relying on this in production. Trial/subscription-limited channels are blocked.
477
+
478
+ :param token: JWT token or API key for authorization (required)
479
+ :type token: str
480
+ :param request_body:
481
+ :type request_body: Dict[str, object]
482
+ :param _request_timeout: timeout setting for this request. If one
483
+ number provided, it will be total request
484
+ timeout. It can also be a pair (tuple) of
485
+ (connection, read) timeouts.
486
+ :type _request_timeout: int, tuple(int, int), optional
487
+ :param _request_auth: set to override the auth_settings for an a single
488
+ request; this effectively ignores the
489
+ authentication in the spec for a single request.
490
+ :type _request_auth: dict, optional
491
+ :param _content_type: force content-type for the request.
492
+ :type _content_type: str, Optional
493
+ :param _headers: set to override the headers for a single
494
+ request; this effectively ignores the headers
495
+ in the spec for a single request.
496
+ :type _headers: dict, optional
497
+ :param _host_index: set to override the host_index for a single
498
+ request; this effectively ignores the host_index
499
+ in the spec for a single request.
500
+ :type _host_index: int, optional
501
+ :return: Returns the result object.
502
+ """ # noqa: E501
503
+
504
+ _param = self._initiate_call_serialize(
505
+ token=token,
506
+ request_body=request_body,
507
+ _request_auth=_request_auth,
508
+ _content_type=_content_type,
509
+ _headers=_headers,
510
+ _host_index=_host_index
511
+ )
512
+
513
+ _response_types_map: Dict[str, Optional[str]] = {
514
+ '200': "Dict[str, object]",
515
+ '401': "ErrorResponse",
516
+ '500': "ErrorResponse",
517
+ }
518
+ response_data = self.api_client.call_api(
519
+ *_param,
520
+ _request_timeout=_request_timeout
521
+ )
522
+ return response_data.response
523
+
524
+
525
+ def _initiate_call_serialize(
526
+ self,
527
+ token,
528
+ request_body,
529
+ _request_auth,
530
+ _content_type,
531
+ _headers,
532
+ _host_index,
533
+ ) -> RequestSerialized:
534
+
535
+ _host = None
536
+
537
+ _collection_formats: Dict[str, str] = {
538
+ }
539
+
540
+ _path_params: Dict[str, str] = {}
541
+ _query_params: List[Tuple[str, str]] = []
542
+ _header_params: Dict[str, Optional[str]] = _headers or {}
543
+ _form_params: List[Tuple[str, str]] = []
544
+ _files: Dict[
545
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
546
+ ] = {}
547
+ _body_params: Optional[bytes] = None
548
+
549
+ # process the path parameters
550
+ # process the query parameters
551
+ if token is not None:
552
+
553
+ _query_params.append(('token', token))
554
+
555
+ # process the header parameters
556
+ # process the form parameters
557
+ # process the body parameter
558
+ if request_body is not None:
559
+ _body_params = request_body
560
+
561
+
562
+ # set the HTTP header `Accept`
563
+ if 'Accept' not in _header_params:
564
+ _header_params['Accept'] = self.api_client.select_header_accept(
565
+ [
566
+ 'application/json'
567
+ ]
568
+ )
569
+
570
+ # set the HTTP header `Content-Type`
571
+ if _content_type:
572
+ _header_params['Content-Type'] = _content_type
573
+ else:
574
+ _default_content_type = (
575
+ self.api_client.select_header_content_type(
576
+ [
577
+ 'application/json'
578
+ ]
579
+ )
580
+ )
581
+ if _default_content_type is not None:
582
+ _header_params['Content-Type'] = _default_content_type
583
+
584
+ # authentication setting
585
+ _auth_settings: List[str] = [
586
+ 'tokenAuth'
587
+ ]
588
+
589
+ return self.api_client.param_serialize(
590
+ method='POST',
591
+ resource_path='/initiateCall',
592
+ path_params=_path_params,
593
+ query_params=_query_params,
594
+ header_params=_header_params,
595
+ body=_body_params,
596
+ post_params=_form_params,
597
+ files=_files,
598
+ auth_settings=_auth_settings,
599
+ collection_formats=_collection_formats,
600
+ _host=_host,
601
+ _request_auth=_request_auth
602
+ )
603
+
604
+
605
+
606
+
607
+ @validate_call
608
+ def update_calling_settings(
609
+ self,
610
+ token: Annotated[StrictStr, Field(description="JWT token or API key for authorization")],
611
+ request_body: Optional[Dict[str, Any]] = None,
612
+ _request_timeout: Union[
613
+ None,
614
+ Annotated[StrictFloat, Field(gt=0)],
615
+ Tuple[
616
+ Annotated[StrictFloat, Field(gt=0)],
617
+ Annotated[StrictFloat, Field(gt=0)]
618
+ ]
619
+ ] = None,
620
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
621
+ _content_type: Optional[StrictStr] = None,
622
+ _headers: Optional[Dict[StrictStr, Any]] = None,
623
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
624
+ ) -> Dict[str, object]:
625
+ """Update calling settings
626
+
627
+ Update WhatsApp Calling API settings (beta). Requires Meta Calling enablement. Trial/subscription-limited channels are blocked.
628
+
629
+ :param token: JWT token or API key for authorization (required)
630
+ :type token: str
631
+ :param request_body:
632
+ :type request_body: Dict[str, object]
633
+ :param _request_timeout: timeout setting for this request. If one
634
+ number provided, it will be total request
635
+ timeout. It can also be a pair (tuple) of
636
+ (connection, read) timeouts.
637
+ :type _request_timeout: int, tuple(int, int), optional
638
+ :param _request_auth: set to override the auth_settings for an a single
639
+ request; this effectively ignores the
640
+ authentication in the spec for a single request.
641
+ :type _request_auth: dict, optional
642
+ :param _content_type: force content-type for the request.
643
+ :type _content_type: str, Optional
644
+ :param _headers: set to override the headers for a single
645
+ request; this effectively ignores the headers
646
+ in the spec for a single request.
647
+ :type _headers: dict, optional
648
+ :param _host_index: set to override the host_index for a single
649
+ request; this effectively ignores the host_index
650
+ in the spec for a single request.
651
+ :type _host_index: int, optional
652
+ :return: Returns the result object.
653
+ """ # noqa: E501
654
+
655
+ _param = self._update_calling_settings_serialize(
656
+ token=token,
657
+ request_body=request_body,
658
+ _request_auth=_request_auth,
659
+ _content_type=_content_type,
660
+ _headers=_headers,
661
+ _host_index=_host_index
662
+ )
663
+
664
+ _response_types_map: Dict[str, Optional[str]] = {
665
+ '200': "Dict[str, object]",
666
+ '401': "ErrorResponse",
667
+ '500': "ErrorResponse",
668
+ }
669
+ response_data = self.api_client.call_api(
670
+ *_param,
671
+ _request_timeout=_request_timeout
672
+ )
673
+ response_data.read()
674
+ return self.api_client.response_deserialize(
675
+ response_data=response_data,
676
+ response_types_map=_response_types_map,
677
+ ).data
678
+
679
+
680
+ @validate_call
681
+ def update_calling_settings_with_http_info(
682
+ self,
683
+ token: Annotated[StrictStr, Field(description="JWT token or API key for authorization")],
684
+ request_body: Optional[Dict[str, Any]] = None,
685
+ _request_timeout: Union[
686
+ None,
687
+ Annotated[StrictFloat, Field(gt=0)],
688
+ Tuple[
689
+ Annotated[StrictFloat, Field(gt=0)],
690
+ Annotated[StrictFloat, Field(gt=0)]
691
+ ]
692
+ ] = None,
693
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
694
+ _content_type: Optional[StrictStr] = None,
695
+ _headers: Optional[Dict[StrictStr, Any]] = None,
696
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
697
+ ) -> ApiResponse[Dict[str, object]]:
698
+ """Update calling settings
699
+
700
+ Update WhatsApp Calling API settings (beta). Requires Meta Calling enablement. Trial/subscription-limited channels are blocked.
701
+
702
+ :param token: JWT token or API key for authorization (required)
703
+ :type token: str
704
+ :param request_body:
705
+ :type request_body: Dict[str, object]
706
+ :param _request_timeout: timeout setting for this request. If one
707
+ number provided, it will be total request
708
+ timeout. It can also be a pair (tuple) of
709
+ (connection, read) timeouts.
710
+ :type _request_timeout: int, tuple(int, int), optional
711
+ :param _request_auth: set to override the auth_settings for an a single
712
+ request; this effectively ignores the
713
+ authentication in the spec for a single request.
714
+ :type _request_auth: dict, optional
715
+ :param _content_type: force content-type for the request.
716
+ :type _content_type: str, Optional
717
+ :param _headers: set to override the headers for a single
718
+ request; this effectively ignores the headers
719
+ in the spec for a single request.
720
+ :type _headers: dict, optional
721
+ :param _host_index: set to override the host_index for a single
722
+ request; this effectively ignores the host_index
723
+ in the spec for a single request.
724
+ :type _host_index: int, optional
725
+ :return: Returns the result object.
726
+ """ # noqa: E501
727
+
728
+ _param = self._update_calling_settings_serialize(
729
+ token=token,
730
+ request_body=request_body,
731
+ _request_auth=_request_auth,
732
+ _content_type=_content_type,
733
+ _headers=_headers,
734
+ _host_index=_host_index
735
+ )
736
+
737
+ _response_types_map: Dict[str, Optional[str]] = {
738
+ '200': "Dict[str, object]",
739
+ '401': "ErrorResponse",
740
+ '500': "ErrorResponse",
741
+ }
742
+ response_data = self.api_client.call_api(
743
+ *_param,
744
+ _request_timeout=_request_timeout
745
+ )
746
+ response_data.read()
747
+ return self.api_client.response_deserialize(
748
+ response_data=response_data,
749
+ response_types_map=_response_types_map,
750
+ )
751
+
752
+
753
+ @validate_call
754
+ def update_calling_settings_without_preload_content(
755
+ self,
756
+ token: Annotated[StrictStr, Field(description="JWT token or API key for authorization")],
757
+ request_body: Optional[Dict[str, Any]] = None,
758
+ _request_timeout: Union[
759
+ None,
760
+ Annotated[StrictFloat, Field(gt=0)],
761
+ Tuple[
762
+ Annotated[StrictFloat, Field(gt=0)],
763
+ Annotated[StrictFloat, Field(gt=0)]
764
+ ]
765
+ ] = None,
766
+ _request_auth: Optional[Dict[StrictStr, Any]] = None,
767
+ _content_type: Optional[StrictStr] = None,
768
+ _headers: Optional[Dict[StrictStr, Any]] = None,
769
+ _host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,
770
+ ) -> RESTResponseType:
771
+ """Update calling settings
772
+
773
+ Update WhatsApp Calling API settings (beta). Requires Meta Calling enablement. Trial/subscription-limited channels are blocked.
774
+
775
+ :param token: JWT token or API key for authorization (required)
776
+ :type token: str
777
+ :param request_body:
778
+ :type request_body: Dict[str, object]
779
+ :param _request_timeout: timeout setting for this request. If one
780
+ number provided, it will be total request
781
+ timeout. It can also be a pair (tuple) of
782
+ (connection, read) timeouts.
783
+ :type _request_timeout: int, tuple(int, int), optional
784
+ :param _request_auth: set to override the auth_settings for an a single
785
+ request; this effectively ignores the
786
+ authentication in the spec for a single request.
787
+ :type _request_auth: dict, optional
788
+ :param _content_type: force content-type for the request.
789
+ :type _content_type: str, Optional
790
+ :param _headers: set to override the headers for a single
791
+ request; this effectively ignores the headers
792
+ in the spec for a single request.
793
+ :type _headers: dict, optional
794
+ :param _host_index: set to override the host_index for a single
795
+ request; this effectively ignores the host_index
796
+ in the spec for a single request.
797
+ :type _host_index: int, optional
798
+ :return: Returns the result object.
799
+ """ # noqa: E501
800
+
801
+ _param = self._update_calling_settings_serialize(
802
+ token=token,
803
+ request_body=request_body,
804
+ _request_auth=_request_auth,
805
+ _content_type=_content_type,
806
+ _headers=_headers,
807
+ _host_index=_host_index
808
+ )
809
+
810
+ _response_types_map: Dict[str, Optional[str]] = {
811
+ '200': "Dict[str, object]",
812
+ '401': "ErrorResponse",
813
+ '500': "ErrorResponse",
814
+ }
815
+ response_data = self.api_client.call_api(
816
+ *_param,
817
+ _request_timeout=_request_timeout
818
+ )
819
+ return response_data.response
820
+
821
+
822
+ def _update_calling_settings_serialize(
823
+ self,
824
+ token,
825
+ request_body,
826
+ _request_auth,
827
+ _content_type,
828
+ _headers,
829
+ _host_index,
830
+ ) -> RequestSerialized:
831
+
832
+ _host = None
833
+
834
+ _collection_formats: Dict[str, str] = {
835
+ }
836
+
837
+ _path_params: Dict[str, str] = {}
838
+ _query_params: List[Tuple[str, str]] = []
839
+ _header_params: Dict[str, Optional[str]] = _headers or {}
840
+ _form_params: List[Tuple[str, str]] = []
841
+ _files: Dict[
842
+ str, Union[str, bytes, List[str], List[bytes], List[Tuple[str, bytes]]]
843
+ ] = {}
844
+ _body_params: Optional[bytes] = None
845
+
846
+ # process the path parameters
847
+ # process the query parameters
848
+ if token is not None:
849
+
850
+ _query_params.append(('token', token))
851
+
852
+ # process the header parameters
853
+ # process the form parameters
854
+ # process the body parameter
855
+ if request_body is not None:
856
+ _body_params = request_body
857
+
858
+
859
+ # set the HTTP header `Accept`
860
+ if 'Accept' not in _header_params:
861
+ _header_params['Accept'] = self.api_client.select_header_accept(
862
+ [
863
+ 'application/json'
864
+ ]
865
+ )
866
+
867
+ # set the HTTP header `Content-Type`
868
+ if _content_type:
869
+ _header_params['Content-Type'] = _content_type
870
+ else:
871
+ _default_content_type = (
872
+ self.api_client.select_header_content_type(
873
+ [
874
+ 'application/json'
875
+ ]
876
+ )
877
+ )
878
+ if _default_content_type is not None:
879
+ _header_params['Content-Type'] = _default_content_type
880
+
881
+ # authentication setting
882
+ _auth_settings: List[str] = [
883
+ 'tokenAuth'
884
+ ]
885
+
886
+ return self.api_client.param_serialize(
887
+ method='POST',
888
+ resource_path='/callingSettings',
889
+ path_params=_path_params,
890
+ query_params=_query_params,
891
+ header_params=_header_params,
892
+ body=_body_params,
893
+ post_params=_form_params,
894
+ files=_files,
895
+ auth_settings=_auth_settings,
896
+ collection_formats=_collection_formats,
897
+ _host=_host,
898
+ _request_auth=_request_auth
899
+ )
900
+
901
+