telnyx 3.5.0a0__py3-none-any.whl → 3.6.0a0__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.

Potentially problematic release.


This version of telnyx might be problematic. Click here for more details.

Files changed (128) hide show
  1. telnyx/_client.py +53 -2
  2. telnyx/_version.py +1 -1
  3. telnyx/resources/__init__.py +70 -0
  4. telnyx/resources/ai/conversations/conversations.py +137 -3
  5. telnyx/resources/ai/conversations/messages.py +1 -134
  6. telnyx/resources/calls/actions.py +146 -146
  7. telnyx/resources/calls/calls.py +4 -10
  8. telnyx/resources/conferences/actions.py +8 -24
  9. telnyx/resources/conferences/conferences.py +2 -6
  10. telnyx/resources/legacy/__init__.py +33 -0
  11. telnyx/resources/legacy/legacy.py +102 -0
  12. telnyx/resources/legacy/reporting/__init__.py +47 -0
  13. telnyx/resources/legacy/reporting/batch_detail_records/__init__.py +61 -0
  14. telnyx/resources/legacy/reporting/batch_detail_records/batch_detail_records.py +166 -0
  15. telnyx/resources/legacy/reporting/batch_detail_records/messaging.py +481 -0
  16. telnyx/resources/legacy/reporting/batch_detail_records/speech_to_text.py +399 -0
  17. telnyx/resources/legacy/reporting/batch_detail_records/voice.py +538 -0
  18. telnyx/resources/legacy/reporting/reporting.py +134 -0
  19. telnyx/resources/legacy/reporting/usage_reports/__init__.py +61 -0
  20. telnyx/resources/legacy/reporting/usage_reports/messaging.py +471 -0
  21. telnyx/resources/legacy/reporting/usage_reports/number_lookup.py +464 -0
  22. telnyx/resources/legacy/reporting/usage_reports/usage_reports.py +288 -0
  23. telnyx/resources/legacy/reporting/usage_reports/voice.py +493 -0
  24. telnyx/resources/oauth.py +855 -0
  25. telnyx/resources/oauth_clients.py +711 -0
  26. telnyx/resources/oauth_grants.py +349 -0
  27. telnyx/resources/phone_numbers/jobs.py +12 -0
  28. telnyx/resources/porting_orders/porting_orders.py +20 -8
  29. telnyx/resources/sim_cards/sim_cards.py +3 -2
  30. telnyx/resources/verifications/verifications.py +10 -0
  31. telnyx/resources/verify_profiles.py +183 -1
  32. telnyx/resources/well_known.py +198 -0
  33. telnyx/types/__init__.py +40 -0
  34. telnyx/types/ai/__init__.py +1 -0
  35. telnyx/types/ai/{conversations/message_create_params.py → conversation_add_message_params.py} +4 -4
  36. telnyx/types/ai/conversations/__init__.py +0 -1
  37. telnyx/types/ai/inference_embedding_webhook_tool_params.py +2 -0
  38. telnyx/types/ai/inference_embedding_webhook_tool_params_param.py +2 -0
  39. telnyx/types/call_dial_params.py +2 -3
  40. telnyx/types/calls/action_answer_params.py +1 -2
  41. telnyx/types/calls/action_gather_using_ai_params.py +5 -8
  42. telnyx/types/calls/action_start_streaming_params.py +4 -2
  43. telnyx/types/calls/action_transfer_params.py +50 -0
  44. telnyx/types/campaign_submit_appeal_response.py +0 -3
  45. telnyx/types/legacy/__init__.py +3 -0
  46. telnyx/types/legacy/reporting/__init__.py +10 -0
  47. telnyx/types/legacy/reporting/batch_detail_records/__init__.py +20 -0
  48. telnyx/types/legacy/reporting/batch_detail_records/messaging_create_params.py +77 -0
  49. telnyx/types/legacy/reporting/batch_detail_records/messaging_create_response.py +68 -0
  50. telnyx/types/legacy/reporting/batch_detail_records/messaging_delete_response.py +68 -0
  51. telnyx/types/legacy/reporting/batch_detail_records/messaging_list_response.py +80 -0
  52. telnyx/types/legacy/reporting/batch_detail_records/messaging_retrieve_response.py +68 -0
  53. telnyx/types/legacy/reporting/batch_detail_records/speech_to_text_create_params.py +19 -0
  54. telnyx/types/legacy/reporting/batch_detail_records/speech_to_text_create_response.py +31 -0
  55. telnyx/types/legacy/reporting/batch_detail_records/speech_to_text_delete_response.py +31 -0
  56. telnyx/types/legacy/reporting/batch_detail_records/speech_to_text_list_response.py +31 -0
  57. telnyx/types/legacy/reporting/batch_detail_records/speech_to_text_retrieve_response.py +31 -0
  58. telnyx/types/legacy/reporting/batch_detail_records/voice_create_params.py +79 -0
  59. telnyx/types/legacy/reporting/batch_detail_records/voice_create_response.py +91 -0
  60. telnyx/types/legacy/reporting/batch_detail_records/voice_delete_response.py +91 -0
  61. telnyx/types/legacy/reporting/batch_detail_records/voice_list_response.py +102 -0
  62. telnyx/types/legacy/reporting/batch_detail_records/voice_retrieve_fields_response.py +23 -0
  63. telnyx/types/legacy/reporting/batch_detail_records/voice_retrieve_response.py +91 -0
  64. telnyx/types/legacy/reporting/usage_report_retrieve_speech_to_text_params.py +17 -0
  65. telnyx/types/legacy/reporting/usage_report_retrieve_speech_to_text_response.py +11 -0
  66. telnyx/types/legacy/reporting/usage_reports/__init__.py +18 -0
  67. telnyx/types/legacy/reporting/usage_reports/messaging_create_params.py +29 -0
  68. telnyx/types/legacy/reporting/usage_reports/messaging_create_response.py +43 -0
  69. telnyx/types/legacy/reporting/usage_reports/messaging_delete_response.py +43 -0
  70. telnyx/types/legacy/reporting/usage_reports/messaging_list_params.py +15 -0
  71. telnyx/types/legacy/reporting/usage_reports/messaging_list_response.py +54 -0
  72. telnyx/types/legacy/reporting/usage_reports/messaging_retrieve_response.py +43 -0
  73. telnyx/types/legacy/reporting/usage_reports/number_lookup_create_params.py +26 -0
  74. telnyx/types/legacy/reporting/usage_reports/number_lookup_list_params.py +13 -0
  75. telnyx/types/legacy/reporting/usage_reports/voice_create_params.py +40 -0
  76. telnyx/types/legacy/reporting/usage_reports/voice_create_response.py +48 -0
  77. telnyx/types/legacy/reporting/usage_reports/voice_delete_response.py +48 -0
  78. telnyx/types/legacy/reporting/usage_reports/voice_list_params.py +15 -0
  79. telnyx/types/legacy/reporting/usage_reports/voice_list_response.py +59 -0
  80. telnyx/types/legacy/reporting/usage_reports/voice_retrieve_response.py +48 -0
  81. telnyx/types/number_order_status_update_webhook_event.py +30 -4
  82. telnyx/types/oauth_client_create_params.py +39 -0
  83. telnyx/types/oauth_client_create_response.py +63 -0
  84. telnyx/types/oauth_client_list_params.py +38 -0
  85. telnyx/types/oauth_client_list_response.py +79 -0
  86. telnyx/types/oauth_client_retrieve_response.py +63 -0
  87. telnyx/types/oauth_client_update_params.py +36 -0
  88. telnyx/types/oauth_client_update_response.py +63 -0
  89. telnyx/types/oauth_grant_delete_response.py +33 -0
  90. telnyx/types/oauth_grant_list_params.py +17 -0
  91. telnyx/types/oauth_grant_list_response.py +49 -0
  92. telnyx/types/oauth_grant_retrieve_response.py +33 -0
  93. telnyx/types/oauth_grants_params.py +15 -0
  94. telnyx/types/oauth_grants_response.py +10 -0
  95. telnyx/types/oauth_introspect_params.py +12 -0
  96. telnyx/types/oauth_introspect_response.py +30 -0
  97. telnyx/types/oauth_register_params.py +39 -0
  98. telnyx/types/oauth_register_response.py +45 -0
  99. telnyx/types/oauth_retrieve_authorize_params.py +30 -0
  100. telnyx/types/oauth_retrieve_jwks_response.py +25 -0
  101. telnyx/types/oauth_retrieve_response.py +47 -0
  102. telnyx/types/oauth_token_params.py +33 -0
  103. telnyx/types/oauth_token_response.py +25 -0
  104. telnyx/types/phone_number_delete_response.py +7 -0
  105. telnyx/types/phone_number_detailed.py +7 -0
  106. telnyx/types/phone_number_list_params.py +6 -0
  107. telnyx/types/phone_numbers/job_update_batch_params.py +7 -0
  108. telnyx/types/porting_order.py +3 -0
  109. telnyx/types/porting_order_create_params.py +3 -0
  110. telnyx/types/porting_order_list_params.py +52 -31
  111. telnyx/types/porting_order_update_params.py +2 -0
  112. telnyx/types/porting_orders/phone_number_configuration_list_params.py +19 -19
  113. telnyx/types/shared/simple_sim_card.py +15 -0
  114. telnyx/types/sim_card.py +12 -0
  115. telnyx/types/sim_card_update_params.py +2 -1
  116. telnyx/types/stream_bidirectional_codec.py +1 -1
  117. telnyx/types/stream_codec.py +1 -1
  118. telnyx/types/verification_trigger_call_params.py +7 -0
  119. telnyx/types/verify_profile_create_template_params.py +12 -0
  120. telnyx/types/verify_profile_create_template_response.py +17 -0
  121. telnyx/types/verify_profile_update_template_params.py +12 -0
  122. telnyx/types/verify_profile_update_template_response.py +17 -0
  123. telnyx/types/well_known_retrieve_authorization_server_metadata_response.py +42 -0
  124. telnyx/types/well_known_retrieve_protected_resource_metadata_response.py +15 -0
  125. {telnyx-3.5.0a0.dist-info → telnyx-3.6.0a0.dist-info}/METADATA +1 -1
  126. {telnyx-3.5.0a0.dist-info → telnyx-3.6.0a0.dist-info}/RECORD +128 -46
  127. {telnyx-3.5.0a0.dist-info → telnyx-3.6.0a0.dist-info}/WHEEL +0 -0
  128. {telnyx-3.5.0a0.dist-info → telnyx-3.6.0a0.dist-info}/licenses/LICENSE +0 -0
@@ -0,0 +1,538 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from typing import Union, Iterable
6
+ from datetime import datetime
7
+
8
+ import httpx
9
+
10
+ from ....._types import Body, Omit, Query, Headers, NotGiven, SequenceNotStr, omit, not_given
11
+ from ....._utils import maybe_transform, async_maybe_transform
12
+ from ....._compat import cached_property
13
+ from ....._resource import SyncAPIResource, AsyncAPIResource
14
+ from ....._response import (
15
+ to_raw_response_wrapper,
16
+ to_streamed_response_wrapper,
17
+ async_to_raw_response_wrapper,
18
+ async_to_streamed_response_wrapper,
19
+ )
20
+ from ....._base_client import make_request_options
21
+ from .....types.legacy.reporting.batch_detail_records import voice_create_params
22
+ from .....types.legacy.reporting.batch_detail_records.voice_list_response import VoiceListResponse
23
+ from .....types.legacy.reporting.batch_detail_records.voice_create_response import VoiceCreateResponse
24
+ from .....types.legacy.reporting.batch_detail_records.voice_delete_response import VoiceDeleteResponse
25
+ from .....types.legacy.reporting.batch_detail_records.voice_retrieve_response import VoiceRetrieveResponse
26
+ from .....types.legacy.reporting.batch_detail_records.voice_retrieve_fields_response import VoiceRetrieveFieldsResponse
27
+
28
+ __all__ = ["VoiceResource", "AsyncVoiceResource"]
29
+
30
+
31
+ class VoiceResource(SyncAPIResource):
32
+ @cached_property
33
+ def with_raw_response(self) -> VoiceResourceWithRawResponse:
34
+ """
35
+ This property can be used as a prefix for any HTTP method call to return
36
+ the raw response object instead of the parsed content.
37
+
38
+ For more information, see https://www.github.com/team-telnyx/telnyx-python#accessing-raw-response-data-eg-headers
39
+ """
40
+ return VoiceResourceWithRawResponse(self)
41
+
42
+ @cached_property
43
+ def with_streaming_response(self) -> VoiceResourceWithStreamingResponse:
44
+ """
45
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
46
+
47
+ For more information, see https://www.github.com/team-telnyx/telnyx-python#with_streaming_response
48
+ """
49
+ return VoiceResourceWithStreamingResponse(self)
50
+
51
+ def create(
52
+ self,
53
+ *,
54
+ end_time: Union[str, datetime],
55
+ start_time: Union[str, datetime],
56
+ call_types: Iterable[int] | Omit = omit,
57
+ connections: Iterable[int] | Omit = omit,
58
+ fields: SequenceNotStr[str] | Omit = omit,
59
+ filters: Iterable[voice_create_params.Filter] | Omit = omit,
60
+ include_all_metadata: bool | Omit = omit,
61
+ managed_accounts: SequenceNotStr[str] | Omit = omit,
62
+ record_types: Iterable[int] | Omit = omit,
63
+ report_name: str | Omit = omit,
64
+ select_all_managed_accounts: bool | Omit = omit,
65
+ source: str | Omit = omit,
66
+ timezone: str | Omit = omit,
67
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
68
+ # The extra values given here take precedence over values defined on the client or passed to this method.
69
+ extra_headers: Headers | None = None,
70
+ extra_query: Query | None = None,
71
+ extra_body: Body | None = None,
72
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
73
+ ) -> VoiceCreateResponse:
74
+ """
75
+ Creates a new CDR report request with the specified filters
76
+
77
+ Args:
78
+ end_time: End time in ISO format
79
+
80
+ start_time: Start time in ISO format
81
+
82
+ call_types: List of call types to filter by (Inbound = 1, Outbound = 2)
83
+
84
+ connections: List of connections to filter by
85
+
86
+ fields: Set of fields to include in the report
87
+
88
+ filters: List of filters to apply
89
+
90
+ include_all_metadata: Whether to include all metadata
91
+
92
+ managed_accounts: List of managed accounts to include
93
+
94
+ record_types: List of record types to filter by (Complete = 1, Incomplete = 2, Errors = 3)
95
+
96
+ report_name: Name of the report
97
+
98
+ select_all_managed_accounts: Whether to select all managed accounts
99
+
100
+ source: Source of the report. Valid values: calls (default), call-control, fax-api,
101
+ webrtc
102
+
103
+ timezone: Timezone for the report
104
+
105
+ extra_headers: Send extra headers
106
+
107
+ extra_query: Add additional query parameters to the request
108
+
109
+ extra_body: Add additional JSON properties to the request
110
+
111
+ timeout: Override the client-level default timeout for this request, in seconds
112
+ """
113
+ return self._post(
114
+ "/legacy/reporting/batch_detail_records/voice",
115
+ body=maybe_transform(
116
+ {
117
+ "end_time": end_time,
118
+ "start_time": start_time,
119
+ "call_types": call_types,
120
+ "connections": connections,
121
+ "fields": fields,
122
+ "filters": filters,
123
+ "include_all_metadata": include_all_metadata,
124
+ "managed_accounts": managed_accounts,
125
+ "record_types": record_types,
126
+ "report_name": report_name,
127
+ "select_all_managed_accounts": select_all_managed_accounts,
128
+ "source": source,
129
+ "timezone": timezone,
130
+ },
131
+ voice_create_params.VoiceCreateParams,
132
+ ),
133
+ options=make_request_options(
134
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
135
+ ),
136
+ cast_to=VoiceCreateResponse,
137
+ )
138
+
139
+ def retrieve(
140
+ self,
141
+ id: str,
142
+ *,
143
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
144
+ # The extra values given here take precedence over values defined on the client or passed to this method.
145
+ extra_headers: Headers | None = None,
146
+ extra_query: Query | None = None,
147
+ extra_body: Body | None = None,
148
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
149
+ ) -> VoiceRetrieveResponse:
150
+ """
151
+ Retrieves a specific CDR report request by ID
152
+
153
+ Args:
154
+ extra_headers: Send extra headers
155
+
156
+ extra_query: Add additional query parameters to the request
157
+
158
+ extra_body: Add additional JSON properties to the request
159
+
160
+ timeout: Override the client-level default timeout for this request, in seconds
161
+ """
162
+ if not id:
163
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
164
+ return self._get(
165
+ f"/legacy/reporting/batch_detail_records/voice/{id}",
166
+ options=make_request_options(
167
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
168
+ ),
169
+ cast_to=VoiceRetrieveResponse,
170
+ )
171
+
172
+ def list(
173
+ self,
174
+ *,
175
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
176
+ # The extra values given here take precedence over values defined on the client or passed to this method.
177
+ extra_headers: Headers | None = None,
178
+ extra_query: Query | None = None,
179
+ extra_body: Body | None = None,
180
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
181
+ ) -> VoiceListResponse:
182
+ """Retrieves all CDR report requests for the authenticated user"""
183
+ return self._get(
184
+ "/legacy/reporting/batch_detail_records/voice",
185
+ options=make_request_options(
186
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
187
+ ),
188
+ cast_to=VoiceListResponse,
189
+ )
190
+
191
+ def delete(
192
+ self,
193
+ id: str,
194
+ *,
195
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
196
+ # The extra values given here take precedence over values defined on the client or passed to this method.
197
+ extra_headers: Headers | None = None,
198
+ extra_query: Query | None = None,
199
+ extra_body: Body | None = None,
200
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
201
+ ) -> VoiceDeleteResponse:
202
+ """
203
+ Deletes a specific CDR report request by ID
204
+
205
+ Args:
206
+ extra_headers: Send extra headers
207
+
208
+ extra_query: Add additional query parameters to the request
209
+
210
+ extra_body: Add additional JSON properties to the request
211
+
212
+ timeout: Override the client-level default timeout for this request, in seconds
213
+ """
214
+ if not id:
215
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
216
+ return self._delete(
217
+ f"/legacy/reporting/batch_detail_records/voice/{id}",
218
+ options=make_request_options(
219
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
220
+ ),
221
+ cast_to=VoiceDeleteResponse,
222
+ )
223
+
224
+ def retrieve_fields(
225
+ self,
226
+ *,
227
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
228
+ # The extra values given here take precedence over values defined on the client or passed to this method.
229
+ extra_headers: Headers | None = None,
230
+ extra_query: Query | None = None,
231
+ extra_body: Body | None = None,
232
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
233
+ ) -> VoiceRetrieveFieldsResponse:
234
+ """Retrieves all available fields that can be used in CDR reports"""
235
+ return self._get(
236
+ "/legacy/reporting/batch_detail_records/voice/fields",
237
+ options=make_request_options(
238
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
239
+ ),
240
+ cast_to=VoiceRetrieveFieldsResponse,
241
+ )
242
+
243
+
244
+ class AsyncVoiceResource(AsyncAPIResource):
245
+ @cached_property
246
+ def with_raw_response(self) -> AsyncVoiceResourceWithRawResponse:
247
+ """
248
+ This property can be used as a prefix for any HTTP method call to return
249
+ the raw response object instead of the parsed content.
250
+
251
+ For more information, see https://www.github.com/team-telnyx/telnyx-python#accessing-raw-response-data-eg-headers
252
+ """
253
+ return AsyncVoiceResourceWithRawResponse(self)
254
+
255
+ @cached_property
256
+ def with_streaming_response(self) -> AsyncVoiceResourceWithStreamingResponse:
257
+ """
258
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
259
+
260
+ For more information, see https://www.github.com/team-telnyx/telnyx-python#with_streaming_response
261
+ """
262
+ return AsyncVoiceResourceWithStreamingResponse(self)
263
+
264
+ async def create(
265
+ self,
266
+ *,
267
+ end_time: Union[str, datetime],
268
+ start_time: Union[str, datetime],
269
+ call_types: Iterable[int] | Omit = omit,
270
+ connections: Iterable[int] | Omit = omit,
271
+ fields: SequenceNotStr[str] | Omit = omit,
272
+ filters: Iterable[voice_create_params.Filter] | Omit = omit,
273
+ include_all_metadata: bool | Omit = omit,
274
+ managed_accounts: SequenceNotStr[str] | Omit = omit,
275
+ record_types: Iterable[int] | Omit = omit,
276
+ report_name: str | Omit = omit,
277
+ select_all_managed_accounts: bool | Omit = omit,
278
+ source: str | Omit = omit,
279
+ timezone: str | Omit = omit,
280
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
281
+ # The extra values given here take precedence over values defined on the client or passed to this method.
282
+ extra_headers: Headers | None = None,
283
+ extra_query: Query | None = None,
284
+ extra_body: Body | None = None,
285
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
286
+ ) -> VoiceCreateResponse:
287
+ """
288
+ Creates a new CDR report request with the specified filters
289
+
290
+ Args:
291
+ end_time: End time in ISO format
292
+
293
+ start_time: Start time in ISO format
294
+
295
+ call_types: List of call types to filter by (Inbound = 1, Outbound = 2)
296
+
297
+ connections: List of connections to filter by
298
+
299
+ fields: Set of fields to include in the report
300
+
301
+ filters: List of filters to apply
302
+
303
+ include_all_metadata: Whether to include all metadata
304
+
305
+ managed_accounts: List of managed accounts to include
306
+
307
+ record_types: List of record types to filter by (Complete = 1, Incomplete = 2, Errors = 3)
308
+
309
+ report_name: Name of the report
310
+
311
+ select_all_managed_accounts: Whether to select all managed accounts
312
+
313
+ source: Source of the report. Valid values: calls (default), call-control, fax-api,
314
+ webrtc
315
+
316
+ timezone: Timezone for the report
317
+
318
+ extra_headers: Send extra headers
319
+
320
+ extra_query: Add additional query parameters to the request
321
+
322
+ extra_body: Add additional JSON properties to the request
323
+
324
+ timeout: Override the client-level default timeout for this request, in seconds
325
+ """
326
+ return await self._post(
327
+ "/legacy/reporting/batch_detail_records/voice",
328
+ body=await async_maybe_transform(
329
+ {
330
+ "end_time": end_time,
331
+ "start_time": start_time,
332
+ "call_types": call_types,
333
+ "connections": connections,
334
+ "fields": fields,
335
+ "filters": filters,
336
+ "include_all_metadata": include_all_metadata,
337
+ "managed_accounts": managed_accounts,
338
+ "record_types": record_types,
339
+ "report_name": report_name,
340
+ "select_all_managed_accounts": select_all_managed_accounts,
341
+ "source": source,
342
+ "timezone": timezone,
343
+ },
344
+ voice_create_params.VoiceCreateParams,
345
+ ),
346
+ options=make_request_options(
347
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
348
+ ),
349
+ cast_to=VoiceCreateResponse,
350
+ )
351
+
352
+ async def retrieve(
353
+ self,
354
+ id: str,
355
+ *,
356
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
357
+ # The extra values given here take precedence over values defined on the client or passed to this method.
358
+ extra_headers: Headers | None = None,
359
+ extra_query: Query | None = None,
360
+ extra_body: Body | None = None,
361
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
362
+ ) -> VoiceRetrieveResponse:
363
+ """
364
+ Retrieves a specific CDR report request by ID
365
+
366
+ Args:
367
+ extra_headers: Send extra headers
368
+
369
+ extra_query: Add additional query parameters to the request
370
+
371
+ extra_body: Add additional JSON properties to the request
372
+
373
+ timeout: Override the client-level default timeout for this request, in seconds
374
+ """
375
+ if not id:
376
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
377
+ return await self._get(
378
+ f"/legacy/reporting/batch_detail_records/voice/{id}",
379
+ options=make_request_options(
380
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
381
+ ),
382
+ cast_to=VoiceRetrieveResponse,
383
+ )
384
+
385
+ async def list(
386
+ self,
387
+ *,
388
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
389
+ # The extra values given here take precedence over values defined on the client or passed to this method.
390
+ extra_headers: Headers | None = None,
391
+ extra_query: Query | None = None,
392
+ extra_body: Body | None = None,
393
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
394
+ ) -> VoiceListResponse:
395
+ """Retrieves all CDR report requests for the authenticated user"""
396
+ return await self._get(
397
+ "/legacy/reporting/batch_detail_records/voice",
398
+ options=make_request_options(
399
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
400
+ ),
401
+ cast_to=VoiceListResponse,
402
+ )
403
+
404
+ async def delete(
405
+ self,
406
+ id: str,
407
+ *,
408
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
409
+ # The extra values given here take precedence over values defined on the client or passed to this method.
410
+ extra_headers: Headers | None = None,
411
+ extra_query: Query | None = None,
412
+ extra_body: Body | None = None,
413
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
414
+ ) -> VoiceDeleteResponse:
415
+ """
416
+ Deletes a specific CDR report request by ID
417
+
418
+ Args:
419
+ extra_headers: Send extra headers
420
+
421
+ extra_query: Add additional query parameters to the request
422
+
423
+ extra_body: Add additional JSON properties to the request
424
+
425
+ timeout: Override the client-level default timeout for this request, in seconds
426
+ """
427
+ if not id:
428
+ raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
429
+ return await self._delete(
430
+ f"/legacy/reporting/batch_detail_records/voice/{id}",
431
+ options=make_request_options(
432
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
433
+ ),
434
+ cast_to=VoiceDeleteResponse,
435
+ )
436
+
437
+ async def retrieve_fields(
438
+ self,
439
+ *,
440
+ # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
441
+ # The extra values given here take precedence over values defined on the client or passed to this method.
442
+ extra_headers: Headers | None = None,
443
+ extra_query: Query | None = None,
444
+ extra_body: Body | None = None,
445
+ timeout: float | httpx.Timeout | None | NotGiven = not_given,
446
+ ) -> VoiceRetrieveFieldsResponse:
447
+ """Retrieves all available fields that can be used in CDR reports"""
448
+ return await self._get(
449
+ "/legacy/reporting/batch_detail_records/voice/fields",
450
+ options=make_request_options(
451
+ extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
452
+ ),
453
+ cast_to=VoiceRetrieveFieldsResponse,
454
+ )
455
+
456
+
457
+ class VoiceResourceWithRawResponse:
458
+ def __init__(self, voice: VoiceResource) -> None:
459
+ self._voice = voice
460
+
461
+ self.create = to_raw_response_wrapper(
462
+ voice.create,
463
+ )
464
+ self.retrieve = to_raw_response_wrapper(
465
+ voice.retrieve,
466
+ )
467
+ self.list = to_raw_response_wrapper(
468
+ voice.list,
469
+ )
470
+ self.delete = to_raw_response_wrapper(
471
+ voice.delete,
472
+ )
473
+ self.retrieve_fields = to_raw_response_wrapper(
474
+ voice.retrieve_fields,
475
+ )
476
+
477
+
478
+ class AsyncVoiceResourceWithRawResponse:
479
+ def __init__(self, voice: AsyncVoiceResource) -> None:
480
+ self._voice = voice
481
+
482
+ self.create = async_to_raw_response_wrapper(
483
+ voice.create,
484
+ )
485
+ self.retrieve = async_to_raw_response_wrapper(
486
+ voice.retrieve,
487
+ )
488
+ self.list = async_to_raw_response_wrapper(
489
+ voice.list,
490
+ )
491
+ self.delete = async_to_raw_response_wrapper(
492
+ voice.delete,
493
+ )
494
+ self.retrieve_fields = async_to_raw_response_wrapper(
495
+ voice.retrieve_fields,
496
+ )
497
+
498
+
499
+ class VoiceResourceWithStreamingResponse:
500
+ def __init__(self, voice: VoiceResource) -> None:
501
+ self._voice = voice
502
+
503
+ self.create = to_streamed_response_wrapper(
504
+ voice.create,
505
+ )
506
+ self.retrieve = to_streamed_response_wrapper(
507
+ voice.retrieve,
508
+ )
509
+ self.list = to_streamed_response_wrapper(
510
+ voice.list,
511
+ )
512
+ self.delete = to_streamed_response_wrapper(
513
+ voice.delete,
514
+ )
515
+ self.retrieve_fields = to_streamed_response_wrapper(
516
+ voice.retrieve_fields,
517
+ )
518
+
519
+
520
+ class AsyncVoiceResourceWithStreamingResponse:
521
+ def __init__(self, voice: AsyncVoiceResource) -> None:
522
+ self._voice = voice
523
+
524
+ self.create = async_to_streamed_response_wrapper(
525
+ voice.create,
526
+ )
527
+ self.retrieve = async_to_streamed_response_wrapper(
528
+ voice.retrieve,
529
+ )
530
+ self.list = async_to_streamed_response_wrapper(
531
+ voice.list,
532
+ )
533
+ self.delete = async_to_streamed_response_wrapper(
534
+ voice.delete,
535
+ )
536
+ self.retrieve_fields = async_to_streamed_response_wrapper(
537
+ voice.retrieve_fields,
538
+ )
@@ -0,0 +1,134 @@
1
+ # File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2
+
3
+ from __future__ import annotations
4
+
5
+ from ...._compat import cached_property
6
+ from ...._resource import SyncAPIResource, AsyncAPIResource
7
+ from .usage_reports.usage_reports import (
8
+ UsageReportsResource,
9
+ AsyncUsageReportsResource,
10
+ UsageReportsResourceWithRawResponse,
11
+ AsyncUsageReportsResourceWithRawResponse,
12
+ UsageReportsResourceWithStreamingResponse,
13
+ AsyncUsageReportsResourceWithStreamingResponse,
14
+ )
15
+ from .batch_detail_records.batch_detail_records import (
16
+ BatchDetailRecordsResource,
17
+ AsyncBatchDetailRecordsResource,
18
+ BatchDetailRecordsResourceWithRawResponse,
19
+ AsyncBatchDetailRecordsResourceWithRawResponse,
20
+ BatchDetailRecordsResourceWithStreamingResponse,
21
+ AsyncBatchDetailRecordsResourceWithStreamingResponse,
22
+ )
23
+
24
+ __all__ = ["ReportingResource", "AsyncReportingResource"]
25
+
26
+
27
+ class ReportingResource(SyncAPIResource):
28
+ @cached_property
29
+ def batch_detail_records(self) -> BatchDetailRecordsResource:
30
+ return BatchDetailRecordsResource(self._client)
31
+
32
+ @cached_property
33
+ def usage_reports(self) -> UsageReportsResource:
34
+ return UsageReportsResource(self._client)
35
+
36
+ @cached_property
37
+ def with_raw_response(self) -> ReportingResourceWithRawResponse:
38
+ """
39
+ This property can be used as a prefix for any HTTP method call to return
40
+ the raw response object instead of the parsed content.
41
+
42
+ For more information, see https://www.github.com/team-telnyx/telnyx-python#accessing-raw-response-data-eg-headers
43
+ """
44
+ return ReportingResourceWithRawResponse(self)
45
+
46
+ @cached_property
47
+ def with_streaming_response(self) -> ReportingResourceWithStreamingResponse:
48
+ """
49
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
50
+
51
+ For more information, see https://www.github.com/team-telnyx/telnyx-python#with_streaming_response
52
+ """
53
+ return ReportingResourceWithStreamingResponse(self)
54
+
55
+
56
+ class AsyncReportingResource(AsyncAPIResource):
57
+ @cached_property
58
+ def batch_detail_records(self) -> AsyncBatchDetailRecordsResource:
59
+ return AsyncBatchDetailRecordsResource(self._client)
60
+
61
+ @cached_property
62
+ def usage_reports(self) -> AsyncUsageReportsResource:
63
+ return AsyncUsageReportsResource(self._client)
64
+
65
+ @cached_property
66
+ def with_raw_response(self) -> AsyncReportingResourceWithRawResponse:
67
+ """
68
+ This property can be used as a prefix for any HTTP method call to return
69
+ the raw response object instead of the parsed content.
70
+
71
+ For more information, see https://www.github.com/team-telnyx/telnyx-python#accessing-raw-response-data-eg-headers
72
+ """
73
+ return AsyncReportingResourceWithRawResponse(self)
74
+
75
+ @cached_property
76
+ def with_streaming_response(self) -> AsyncReportingResourceWithStreamingResponse:
77
+ """
78
+ An alternative to `.with_raw_response` that doesn't eagerly read the response body.
79
+
80
+ For more information, see https://www.github.com/team-telnyx/telnyx-python#with_streaming_response
81
+ """
82
+ return AsyncReportingResourceWithStreamingResponse(self)
83
+
84
+
85
+ class ReportingResourceWithRawResponse:
86
+ def __init__(self, reporting: ReportingResource) -> None:
87
+ self._reporting = reporting
88
+
89
+ @cached_property
90
+ def batch_detail_records(self) -> BatchDetailRecordsResourceWithRawResponse:
91
+ return BatchDetailRecordsResourceWithRawResponse(self._reporting.batch_detail_records)
92
+
93
+ @cached_property
94
+ def usage_reports(self) -> UsageReportsResourceWithRawResponse:
95
+ return UsageReportsResourceWithRawResponse(self._reporting.usage_reports)
96
+
97
+
98
+ class AsyncReportingResourceWithRawResponse:
99
+ def __init__(self, reporting: AsyncReportingResource) -> None:
100
+ self._reporting = reporting
101
+
102
+ @cached_property
103
+ def batch_detail_records(self) -> AsyncBatchDetailRecordsResourceWithRawResponse:
104
+ return AsyncBatchDetailRecordsResourceWithRawResponse(self._reporting.batch_detail_records)
105
+
106
+ @cached_property
107
+ def usage_reports(self) -> AsyncUsageReportsResourceWithRawResponse:
108
+ return AsyncUsageReportsResourceWithRawResponse(self._reporting.usage_reports)
109
+
110
+
111
+ class ReportingResourceWithStreamingResponse:
112
+ def __init__(self, reporting: ReportingResource) -> None:
113
+ self._reporting = reporting
114
+
115
+ @cached_property
116
+ def batch_detail_records(self) -> BatchDetailRecordsResourceWithStreamingResponse:
117
+ return BatchDetailRecordsResourceWithStreamingResponse(self._reporting.batch_detail_records)
118
+
119
+ @cached_property
120
+ def usage_reports(self) -> UsageReportsResourceWithStreamingResponse:
121
+ return UsageReportsResourceWithStreamingResponse(self._reporting.usage_reports)
122
+
123
+
124
+ class AsyncReportingResourceWithStreamingResponse:
125
+ def __init__(self, reporting: AsyncReportingResource) -> None:
126
+ self._reporting = reporting
127
+
128
+ @cached_property
129
+ def batch_detail_records(self) -> AsyncBatchDetailRecordsResourceWithStreamingResponse:
130
+ return AsyncBatchDetailRecordsResourceWithStreamingResponse(self._reporting.batch_detail_records)
131
+
132
+ @cached_property
133
+ def usage_reports(self) -> AsyncUsageReportsResourceWithStreamingResponse:
134
+ return AsyncUsageReportsResourceWithStreamingResponse(self._reporting.usage_reports)