telnyx 3.0.0__py3-none-any.whl → 3.1.0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.

Potentially problematic release.


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

Files changed (44) hide show
  1. telnyx/_client.py +35 -786
  2. telnyx/_version.py +1 -1
  3. telnyx/resources/__init__.py +24 -24
  4. telnyx/resources/brand/brand.py +8 -4
  5. telnyx/resources/calls/calls.py +12 -0
  6. telnyx/resources/oauth.py +317 -315
  7. telnyx/resources/oauth_grants.py +15 -15
  8. telnyx/resources/verified_numbers/verified_numbers.py +25 -4
  9. telnyx/types/__init__.py +12 -19
  10. telnyx/types/addresses/action_validate_response.py +8 -3
  11. telnyx/types/ai/inference_embedding_transfer_tool_params.py +6 -0
  12. telnyx/types/ai/inference_embedding_transfer_tool_params_param.py +6 -0
  13. telnyx/types/ai/voice_settings.py +49 -2
  14. telnyx/types/ai/voice_settings_param.py +49 -2
  15. telnyx/types/brand_create_params.py +2 -1
  16. telnyx/types/brand_update_params.py +2 -1
  17. telnyx/types/call_dial_params.py +8 -0
  18. telnyx/types/country_coverage_retrieve_country_response.py +7 -0
  19. telnyx/types/country_coverage_retrieve_response.py +7 -0
  20. telnyx/types/{api_error.py → error.py} +2 -2
  21. telnyx/types/{oauth_retrieve_authorize_params.py → oauth_authorize_params.py} +2 -2
  22. telnyx/types/{oauth_grants_params.py → oauth_create_grant_params.py} +2 -2
  23. telnyx/types/{oauth_grants_response.py → oauth_create_grant_response.py} +2 -2
  24. telnyx/types/{oauth_token_params.py → oauth_exchange_token_params.py} +2 -2
  25. telnyx/types/{oauth_token_response.py → oauth_exchange_token_response.py} +2 -2
  26. telnyx/types/{oauth_grant_delete_response.py → oauth_grant_revoke_response.py} +2 -2
  27. telnyx/types/{oauth_introspect_params.py → oauth_introspect_token_params.py} +2 -2
  28. telnyx/types/{oauth_introspect_response.py → oauth_introspect_token_response.py} +2 -2
  29. telnyx/types/{oauth_register_params.py → oauth_register_client_params.py} +2 -2
  30. telnyx/types/{oauth_register_response.py → oauth_register_client_response.py} +2 -2
  31. telnyx/types/{oauth_retrieve_response.py → oauth_retrieve_consent_response.py} +2 -2
  32. telnyx/types/verified_number_create_params.py +10 -0
  33. telnyx/types/verify_profile.py +18 -3
  34. {telnyx-3.0.0.dist-info → telnyx-3.1.0.dist-info}/METADATA +1 -1
  35. {telnyx-3.0.0.dist-info → telnyx-3.1.0.dist-info}/RECORD +37 -44
  36. telnyx/types/client_create_bucket_params.py +0 -13
  37. telnyx/types/client_delete_objects_params.py +0 -20
  38. telnyx/types/client_get_object_params.py +0 -15
  39. telnyx/types/client_list_objects_params.py +0 -13
  40. telnyx/types/client_put_object_params.py +0 -20
  41. telnyx/types/list_buckets_response.py +0 -20
  42. telnyx/types/list_objects_response.py +0 -24
  43. {telnyx-3.0.0.dist-info → telnyx-3.1.0.dist-info}/WHEEL +0 -0
  44. {telnyx-3.0.0.dist-info → telnyx-3.1.0.dist-info}/licenses/LICENSE +0 -0
telnyx/_client.py CHANGED
@@ -3,56 +3,24 @@
3
3
  from __future__ import annotations
4
4
 
5
5
  import os
6
- from typing import Any, Mapping, Iterable
7
- from typing_extensions import Self, Literal, override
6
+ from typing import Any, Mapping
7
+ from typing_extensions import Self, override
8
8
 
9
9
  import httpx
10
10
 
11
11
  from . import _exceptions
12
12
  from ._qs import Querystring
13
- from .types import (
14
- client_get_object_params,
15
- client_put_object_params,
16
- client_list_objects_params,
17
- client_create_bucket_params,
18
- client_delete_objects_params,
19
- )
20
13
  from ._types import (
21
- Body,
22
14
  Omit,
23
- Query,
24
- Headers,
25
15
  Timeout,
26
- NoneType,
27
16
  NotGiven,
28
- FileTypes,
29
17
  Transport,
30
18
  ProxiesTypes,
31
19
  RequestOptions,
32
- omit,
33
20
  not_given,
34
21
  )
35
- from ._utils import (
36
- is_given,
37
- maybe_transform,
38
- get_async_library,
39
- async_maybe_transform,
40
- )
22
+ from ._utils import is_given, get_async_library
41
23
  from ._version import __version__
42
- from ._response import (
43
- BinaryAPIResponse,
44
- AsyncBinaryAPIResponse,
45
- StreamedBinaryAPIResponse,
46
- AsyncStreamedBinaryAPIResponse,
47
- to_raw_response_wrapper,
48
- to_streamed_response_wrapper,
49
- async_to_raw_response_wrapper,
50
- to_custom_raw_response_wrapper,
51
- async_to_streamed_response_wrapper,
52
- to_custom_streamed_response_wrapper,
53
- async_to_custom_raw_response_wrapper,
54
- async_to_custom_streamed_response_wrapper,
55
- )
56
24
  from .resources import (
57
25
  ips,
58
26
  enum,
@@ -174,7 +142,6 @@ from ._base_client import (
174
142
  DEFAULT_MAX_RETRIES,
175
143
  SyncAPIClient,
176
144
  AsyncAPIClient,
177
- make_request_options,
178
145
  )
179
146
  from .resources.ai import ai
180
147
  from .resources.brand import brand
@@ -208,8 +175,6 @@ from .resources.campaign_builder import campaign_builder
208
175
  from .resources.managed_accounts import managed_accounts
209
176
  from .resources.operator_connect import operator_connect
210
177
  from .resources.verified_numbers import verified_numbers
211
- from .types.list_buckets_response import ListBucketsResponse
212
- from .types.list_objects_response import ListObjectsResponse
213
178
  from .resources.messaging_profiles import messaging_profiles
214
179
  from .resources.messaging_tollfree import messaging_tollfree
215
180
  from .resources.number_reservations import number_reservations
@@ -222,10 +187,6 @@ __all__ = ["Timeout", "Transport", "ProxiesTypes", "RequestOptions", "Telnyx", "
222
187
 
223
188
 
224
189
  class Telnyx(SyncAPIClient):
225
- legacy: legacy.LegacyResource
226
- oauth: oauth.OAuthResource
227
- oauth_clients: oauth_clients.OAuthClientsResource
228
- oauth_grants: oauth_grants.OAuthGrantsResource
229
190
  webhooks: webhooks.WebhooksResource
230
191
  access_ip_address: access_ip_address.AccessIPAddressResource
231
192
  access_ip_ranges: access_ip_ranges.AccessIPRangesResource
@@ -376,6 +337,10 @@ class Telnyx(SyncAPIClient):
376
337
  wireless_blocklists: wireless_blocklists.WirelessBlocklistsResource
377
338
  partner_campaigns: partner_campaigns.PartnerCampaignsResource
378
339
  well_known: well_known.WellKnownResource
340
+ legacy: legacy.LegacyResource
341
+ oauth: oauth.OAuthResource
342
+ oauth_clients: oauth_clients.OAuthClientsResource
343
+ oauth_grants: oauth_grants.OAuthGrantsResource
379
344
  with_raw_response: TelnyxWithRawResponse
380
345
  with_streaming_response: TelnyxWithStreamedResponse
381
346
 
@@ -434,10 +399,6 @@ class Telnyx(SyncAPIClient):
434
399
  _strict_response_validation=_strict_response_validation,
435
400
  )
436
401
 
437
- self.legacy = legacy.LegacyResource(self)
438
- self.oauth = oauth.OAuthResource(self)
439
- self.oauth_clients = oauth_clients.OAuthClientsResource(self)
440
- self.oauth_grants = oauth_grants.OAuthGrantsResource(self)
441
402
  self.webhooks = webhooks.WebhooksResource(self)
442
403
  self.access_ip_address = access_ip_address.AccessIPAddressResource(self)
443
404
  self.access_ip_ranges = access_ip_ranges.AccessIPRangesResource(self)
@@ -594,6 +555,10 @@ class Telnyx(SyncAPIClient):
594
555
  self.wireless_blocklists = wireless_blocklists.WirelessBlocklistsResource(self)
595
556
  self.partner_campaigns = partner_campaigns.PartnerCampaignsResource(self)
596
557
  self.well_known = well_known.WellKnownResource(self)
558
+ self.legacy = legacy.LegacyResource(self)
559
+ self.oauth = oauth.OAuthResource(self)
560
+ self.oauth_clients = oauth_clients.OAuthClientsResource(self)
561
+ self.oauth_grants = oauth_grants.OAuthGrantsResource(self)
597
562
  self.with_raw_response = TelnyxWithRawResponse(self)
598
563
  self.with_streaming_response = TelnyxWithStreamedResponse(self)
599
564
 
@@ -670,309 +635,6 @@ class Telnyx(SyncAPIClient):
670
635
  # client.with_options(timeout=10).foo.create(...)
671
636
  with_options = copy
672
637
 
673
- def create_bucket(
674
- self,
675
- bucket_name: str,
676
- *,
677
- location_constraint: str | Omit = omit,
678
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
679
- # The extra values given here take precedence over values defined on the client or passed to this method.
680
- extra_headers: Headers | None = None,
681
- extra_query: Query | None = None,
682
- extra_body: Body | None = None,
683
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
684
- ) -> None:
685
- """
686
- Create a bucket.
687
-
688
- Args:
689
- extra_headers: Send extra headers
690
-
691
- extra_query: Add additional query parameters to the request
692
-
693
- extra_body: Add additional JSON properties to the request
694
-
695
- timeout: Override the client-level default timeout for this request, in seconds
696
- """
697
- if not bucket_name:
698
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
699
- extra_headers = {"Accept": "*/*", **(extra_headers or {})}
700
- return self.put(
701
- f"/{bucket_name}",
702
- body=maybe_transform(
703
- {"location_constraint": location_constraint}, client_create_bucket_params.ClientCreateBucketParams
704
- ),
705
- options=make_request_options(
706
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
707
- ),
708
- cast_to=NoneType,
709
- )
710
-
711
- def delete_bucket(
712
- self,
713
- bucket_name: str,
714
- *,
715
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
716
- # The extra values given here take precedence over values defined on the client or passed to this method.
717
- extra_headers: Headers | None = None,
718
- extra_query: Query | None = None,
719
- extra_body: Body | None = None,
720
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
721
- ) -> None:
722
- """Deletes a bucket.
723
-
724
- The bucket must be empty for it to be deleted.
725
-
726
- Args:
727
- extra_headers: Send extra headers
728
-
729
- extra_query: Add additional query parameters to the request
730
-
731
- extra_body: Add additional JSON properties to the request
732
-
733
- timeout: Override the client-level default timeout for this request, in seconds
734
- """
735
- if not bucket_name:
736
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
737
- extra_headers = {"Accept": "*/*", **(extra_headers or {})}
738
- return self.delete(
739
- f"/{bucket_name}",
740
- options=make_request_options(
741
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
742
- ),
743
- cast_to=NoneType,
744
- )
745
-
746
- def delete_object(
747
- self,
748
- object_name: str,
749
- *,
750
- bucket_name: str,
751
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
752
- # The extra values given here take precedence over values defined on the client or passed to this method.
753
- extra_headers: Headers | None = None,
754
- extra_query: Query | None = None,
755
- extra_body: Body | None = None,
756
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
757
- ) -> None:
758
- """
759
- Delete an object from a given bucket.
760
-
761
- Args:
762
- extra_headers: Send extra headers
763
-
764
- extra_query: Add additional query parameters to the request
765
-
766
- extra_body: Add additional JSON properties to the request
767
-
768
- timeout: Override the client-level default timeout for this request, in seconds
769
- """
770
- if not bucket_name:
771
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
772
- if not object_name:
773
- raise ValueError(f"Expected a non-empty value for `object_name` but received {object_name!r}")
774
- extra_headers = {"Accept": "*/*", **(extra_headers or {})}
775
- return self.delete(
776
- f"/{bucket_name}/{object_name}",
777
- options=make_request_options(
778
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
779
- ),
780
- cast_to=NoneType,
781
- )
782
-
783
- def delete_objects(
784
- self,
785
- bucket_name: str,
786
- *,
787
- delete: Literal[True],
788
- body: Iterable[client_delete_objects_params.Body],
789
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
790
- # The extra values given here take precedence over values defined on the client or passed to this method.
791
- extra_headers: Headers | None = None,
792
- extra_query: Query | None = None,
793
- extra_body: Body | None = None,
794
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
795
- ) -> object:
796
- """
797
- Deletes one or multiple objects from a given bucket.
798
-
799
- Args:
800
- extra_headers: Send extra headers
801
-
802
- extra_query: Add additional query parameters to the request
803
-
804
- extra_body: Add additional JSON properties to the request
805
-
806
- timeout: Override the client-level default timeout for this request, in seconds
807
- """
808
- if not bucket_name:
809
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
810
- extra_headers = {"Accept": "application/xml", **(extra_headers or {})}
811
- return self.post(
812
- f"/{bucket_name}",
813
- body=maybe_transform(body, Iterable[client_delete_objects_params.Body]),
814
- options=make_request_options(
815
- extra_headers=extra_headers,
816
- extra_query=extra_query,
817
- extra_body=extra_body,
818
- timeout=timeout,
819
- query=maybe_transform({"delete": delete}, client_delete_objects_params.ClientDeleteObjectsParams),
820
- ),
821
- cast_to=object,
822
- )
823
-
824
- def get_object(
825
- self,
826
- object_name: str,
827
- *,
828
- bucket_name: str,
829
- upload_id: str | Omit = omit,
830
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
831
- # The extra values given here take precedence over values defined on the client or passed to this method.
832
- extra_headers: Headers | None = None,
833
- extra_query: Query | None = None,
834
- extra_body: Body | None = None,
835
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
836
- ) -> BinaryAPIResponse:
837
- """
838
- Retrieves an object from a given bucket.
839
-
840
- Args:
841
- extra_headers: Send extra headers
842
-
843
- extra_query: Add additional query parameters to the request
844
-
845
- extra_body: Add additional JSON properties to the request
846
-
847
- timeout: Override the client-level default timeout for this request, in seconds
848
- """
849
- if not bucket_name:
850
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
851
- if not object_name:
852
- raise ValueError(f"Expected a non-empty value for `object_name` but received {object_name!r}")
853
- extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
854
- return self.get(
855
- f"/{bucket_name}/{object_name}",
856
- options=make_request_options(
857
- extra_headers=extra_headers,
858
- extra_query=extra_query,
859
- extra_body=extra_body,
860
- timeout=timeout,
861
- query=maybe_transform({"upload_id": upload_id}, client_get_object_params.ClientGetObjectParams),
862
- ),
863
- cast_to=BinaryAPIResponse,
864
- )
865
-
866
- def list_buckets(
867
- self,
868
- *,
869
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
870
- # The extra values given here take precedence over values defined on the client or passed to this method.
871
- extra_headers: Headers | None = None,
872
- extra_query: Query | None = None,
873
- extra_body: Body | None = None,
874
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
875
- ) -> ListBucketsResponse:
876
- """List all Buckets."""
877
- extra_headers = {"Accept": "application/xml", **(extra_headers or {})}
878
- return self.get(
879
- "/",
880
- options=make_request_options(
881
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
882
- ),
883
- cast_to=ListBucketsResponse,
884
- )
885
-
886
- def list_objects(
887
- self,
888
- bucket_name: str,
889
- *,
890
- list_type: Literal[2] | Omit = omit,
891
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
892
- # The extra values given here take precedence over values defined on the client or passed to this method.
893
- extra_headers: Headers | None = None,
894
- extra_query: Query | None = None,
895
- extra_body: Body | None = None,
896
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
897
- ) -> ListObjectsResponse:
898
- """
899
- List all objects contained in a given bucket.
900
-
901
- Args:
902
- extra_headers: Send extra headers
903
-
904
- extra_query: Add additional query parameters to the request
905
-
906
- extra_body: Add additional JSON properties to the request
907
-
908
- timeout: Override the client-level default timeout for this request, in seconds
909
- """
910
- if not bucket_name:
911
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
912
- extra_headers = {"Accept": "application/xml", **(extra_headers or {})}
913
- return self.get(
914
- f"/{bucket_name}",
915
- options=make_request_options(
916
- extra_headers=extra_headers,
917
- extra_query=extra_query,
918
- extra_body=extra_body,
919
- timeout=timeout,
920
- query=maybe_transform({"list_type": list_type}, client_list_objects_params.ClientListObjectsParams),
921
- ),
922
- cast_to=ListObjectsResponse,
923
- )
924
-
925
- def put_object(
926
- self,
927
- object_name: str,
928
- *,
929
- bucket_name: str,
930
- body: FileTypes,
931
- part_number: str | Omit = omit,
932
- upload_id: str | Omit = omit,
933
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
934
- # The extra values given here take precedence over values defined on the client or passed to this method.
935
- extra_headers: Headers | None = None,
936
- extra_query: Query | None = None,
937
- extra_body: Body | None = None,
938
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
939
- ) -> None:
940
- """
941
- Add an object to a bucket.
942
-
943
- Args:
944
- extra_headers: Send extra headers
945
-
946
- extra_query: Add additional query parameters to the request
947
-
948
- extra_body: Add additional JSON properties to the request
949
-
950
- timeout: Override the client-level default timeout for this request, in seconds
951
- """
952
- if not bucket_name:
953
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
954
- if not object_name:
955
- raise ValueError(f"Expected a non-empty value for `object_name` but received {object_name!r}")
956
- extra_headers = {"Accept": "*/*", **(extra_headers or {})}
957
- return self.put(
958
- f"/{bucket_name}/{object_name}",
959
- body=maybe_transform(body, client_put_object_params.ClientPutObjectParams),
960
- options=make_request_options(
961
- extra_headers=extra_headers,
962
- extra_query=extra_query,
963
- extra_body=extra_body,
964
- timeout=timeout,
965
- query=maybe_transform(
966
- {
967
- "part_number": part_number,
968
- "upload_id": upload_id,
969
- },
970
- client_put_object_params.ClientPutObjectParams,
971
- ),
972
- ),
973
- cast_to=NoneType,
974
- )
975
-
976
638
  @override
977
639
  def _make_status_error(
978
640
  self,
@@ -1008,10 +670,6 @@ class Telnyx(SyncAPIClient):
1008
670
 
1009
671
 
1010
672
  class AsyncTelnyx(AsyncAPIClient):
1011
- legacy: legacy.AsyncLegacyResource
1012
- oauth: oauth.AsyncOAuthResource
1013
- oauth_clients: oauth_clients.AsyncOAuthClientsResource
1014
- oauth_grants: oauth_grants.AsyncOAuthGrantsResource
1015
673
  webhooks: webhooks.AsyncWebhooksResource
1016
674
  access_ip_address: access_ip_address.AsyncAccessIPAddressResource
1017
675
  access_ip_ranges: access_ip_ranges.AsyncAccessIPRangesResource
@@ -1162,6 +820,10 @@ class AsyncTelnyx(AsyncAPIClient):
1162
820
  wireless_blocklists: wireless_blocklists.AsyncWirelessBlocklistsResource
1163
821
  partner_campaigns: partner_campaigns.AsyncPartnerCampaignsResource
1164
822
  well_known: well_known.AsyncWellKnownResource
823
+ legacy: legacy.AsyncLegacyResource
824
+ oauth: oauth.AsyncOAuthResource
825
+ oauth_clients: oauth_clients.AsyncOAuthClientsResource
826
+ oauth_grants: oauth_grants.AsyncOAuthGrantsResource
1165
827
  with_raw_response: AsyncTelnyxWithRawResponse
1166
828
  with_streaming_response: AsyncTelnyxWithStreamedResponse
1167
829
 
@@ -1220,10 +882,6 @@ class AsyncTelnyx(AsyncAPIClient):
1220
882
  _strict_response_validation=_strict_response_validation,
1221
883
  )
1222
884
 
1223
- self.legacy = legacy.AsyncLegacyResource(self)
1224
- self.oauth = oauth.AsyncOAuthResource(self)
1225
- self.oauth_clients = oauth_clients.AsyncOAuthClientsResource(self)
1226
- self.oauth_grants = oauth_grants.AsyncOAuthGrantsResource(self)
1227
885
  self.webhooks = webhooks.AsyncWebhooksResource(self)
1228
886
  self.access_ip_address = access_ip_address.AsyncAccessIPAddressResource(self)
1229
887
  self.access_ip_ranges = access_ip_ranges.AsyncAccessIPRangesResource(self)
@@ -1386,6 +1044,10 @@ class AsyncTelnyx(AsyncAPIClient):
1386
1044
  self.wireless_blocklists = wireless_blocklists.AsyncWirelessBlocklistsResource(self)
1387
1045
  self.partner_campaigns = partner_campaigns.AsyncPartnerCampaignsResource(self)
1388
1046
  self.well_known = well_known.AsyncWellKnownResource(self)
1047
+ self.legacy = legacy.AsyncLegacyResource(self)
1048
+ self.oauth = oauth.AsyncOAuthResource(self)
1049
+ self.oauth_clients = oauth_clients.AsyncOAuthClientsResource(self)
1050
+ self.oauth_grants = oauth_grants.AsyncOAuthGrantsResource(self)
1389
1051
  self.with_raw_response = AsyncTelnyxWithRawResponse(self)
1390
1052
  self.with_streaming_response = AsyncTelnyxWithStreamedResponse(self)
1391
1053
 
@@ -1462,315 +1124,6 @@ class AsyncTelnyx(AsyncAPIClient):
1462
1124
  # client.with_options(timeout=10).foo.create(...)
1463
1125
  with_options = copy
1464
1126
 
1465
- async def create_bucket(
1466
- self,
1467
- bucket_name: str,
1468
- *,
1469
- location_constraint: str | Omit = omit,
1470
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1471
- # The extra values given here take precedence over values defined on the client or passed to this method.
1472
- extra_headers: Headers | None = None,
1473
- extra_query: Query | None = None,
1474
- extra_body: Body | None = None,
1475
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
1476
- ) -> None:
1477
- """
1478
- Create a bucket.
1479
-
1480
- Args:
1481
- extra_headers: Send extra headers
1482
-
1483
- extra_query: Add additional query parameters to the request
1484
-
1485
- extra_body: Add additional JSON properties to the request
1486
-
1487
- timeout: Override the client-level default timeout for this request, in seconds
1488
- """
1489
- if not bucket_name:
1490
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
1491
- extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1492
- return await self.put(
1493
- f"/{bucket_name}",
1494
- body=await async_maybe_transform(
1495
- {"location_constraint": location_constraint}, client_create_bucket_params.ClientCreateBucketParams
1496
- ),
1497
- options=make_request_options(
1498
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1499
- ),
1500
- cast_to=NoneType,
1501
- )
1502
-
1503
- async def delete_bucket(
1504
- self,
1505
- bucket_name: str,
1506
- *,
1507
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1508
- # The extra values given here take precedence over values defined on the client or passed to this method.
1509
- extra_headers: Headers | None = None,
1510
- extra_query: Query | None = None,
1511
- extra_body: Body | None = None,
1512
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
1513
- ) -> None:
1514
- """Deletes a bucket.
1515
-
1516
- The bucket must be empty for it to be deleted.
1517
-
1518
- Args:
1519
- extra_headers: Send extra headers
1520
-
1521
- extra_query: Add additional query parameters to the request
1522
-
1523
- extra_body: Add additional JSON properties to the request
1524
-
1525
- timeout: Override the client-level default timeout for this request, in seconds
1526
- """
1527
- if not bucket_name:
1528
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
1529
- extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1530
- return await self.delete(
1531
- f"/{bucket_name}",
1532
- options=make_request_options(
1533
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1534
- ),
1535
- cast_to=NoneType,
1536
- )
1537
-
1538
- async def delete_object(
1539
- self,
1540
- object_name: str,
1541
- *,
1542
- bucket_name: str,
1543
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1544
- # The extra values given here take precedence over values defined on the client or passed to this method.
1545
- extra_headers: Headers | None = None,
1546
- extra_query: Query | None = None,
1547
- extra_body: Body | None = None,
1548
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
1549
- ) -> None:
1550
- """
1551
- Delete an object from a given bucket.
1552
-
1553
- Args:
1554
- extra_headers: Send extra headers
1555
-
1556
- extra_query: Add additional query parameters to the request
1557
-
1558
- extra_body: Add additional JSON properties to the request
1559
-
1560
- timeout: Override the client-level default timeout for this request, in seconds
1561
- """
1562
- if not bucket_name:
1563
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
1564
- if not object_name:
1565
- raise ValueError(f"Expected a non-empty value for `object_name` but received {object_name!r}")
1566
- extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1567
- return await self.delete(
1568
- f"/{bucket_name}/{object_name}",
1569
- options=make_request_options(
1570
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1571
- ),
1572
- cast_to=NoneType,
1573
- )
1574
-
1575
- async def delete_objects(
1576
- self,
1577
- bucket_name: str,
1578
- *,
1579
- delete: Literal[True],
1580
- body: Iterable[client_delete_objects_params.Body],
1581
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1582
- # The extra values given here take precedence over values defined on the client or passed to this method.
1583
- extra_headers: Headers | None = None,
1584
- extra_query: Query | None = None,
1585
- extra_body: Body | None = None,
1586
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
1587
- ) -> object:
1588
- """
1589
- Deletes one or multiple objects from a given bucket.
1590
-
1591
- Args:
1592
- extra_headers: Send extra headers
1593
-
1594
- extra_query: Add additional query parameters to the request
1595
-
1596
- extra_body: Add additional JSON properties to the request
1597
-
1598
- timeout: Override the client-level default timeout for this request, in seconds
1599
- """
1600
- if not bucket_name:
1601
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
1602
- extra_headers = {"Accept": "application/xml", **(extra_headers or {})}
1603
- return await self.post(
1604
- f"/{bucket_name}",
1605
- body=await async_maybe_transform(body, Iterable[client_delete_objects_params.Body]),
1606
- options=make_request_options(
1607
- extra_headers=extra_headers,
1608
- extra_query=extra_query,
1609
- extra_body=extra_body,
1610
- timeout=timeout,
1611
- query=await async_maybe_transform(
1612
- {"delete": delete}, client_delete_objects_params.ClientDeleteObjectsParams
1613
- ),
1614
- ),
1615
- cast_to=object,
1616
- )
1617
-
1618
- async def get_object(
1619
- self,
1620
- object_name: str,
1621
- *,
1622
- bucket_name: str,
1623
- upload_id: str | Omit = omit,
1624
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1625
- # The extra values given here take precedence over values defined on the client or passed to this method.
1626
- extra_headers: Headers | None = None,
1627
- extra_query: Query | None = None,
1628
- extra_body: Body | None = None,
1629
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
1630
- ) -> AsyncBinaryAPIResponse:
1631
- """
1632
- Retrieves an object from a given bucket.
1633
-
1634
- Args:
1635
- extra_headers: Send extra headers
1636
-
1637
- extra_query: Add additional query parameters to the request
1638
-
1639
- extra_body: Add additional JSON properties to the request
1640
-
1641
- timeout: Override the client-level default timeout for this request, in seconds
1642
- """
1643
- if not bucket_name:
1644
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
1645
- if not object_name:
1646
- raise ValueError(f"Expected a non-empty value for `object_name` but received {object_name!r}")
1647
- extra_headers = {"Accept": "application/octet-stream", **(extra_headers or {})}
1648
- return await self.get(
1649
- f"/{bucket_name}/{object_name}",
1650
- options=make_request_options(
1651
- extra_headers=extra_headers,
1652
- extra_query=extra_query,
1653
- extra_body=extra_body,
1654
- timeout=timeout,
1655
- query=await async_maybe_transform(
1656
- {"upload_id": upload_id}, client_get_object_params.ClientGetObjectParams
1657
- ),
1658
- ),
1659
- cast_to=AsyncBinaryAPIResponse,
1660
- )
1661
-
1662
- async def list_buckets(
1663
- self,
1664
- *,
1665
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1666
- # The extra values given here take precedence over values defined on the client or passed to this method.
1667
- extra_headers: Headers | None = None,
1668
- extra_query: Query | None = None,
1669
- extra_body: Body | None = None,
1670
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
1671
- ) -> ListBucketsResponse:
1672
- """List all Buckets."""
1673
- extra_headers = {"Accept": "application/xml", **(extra_headers or {})}
1674
- return await self.get(
1675
- "/",
1676
- options=make_request_options(
1677
- extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
1678
- ),
1679
- cast_to=ListBucketsResponse,
1680
- )
1681
-
1682
- async def list_objects(
1683
- self,
1684
- bucket_name: str,
1685
- *,
1686
- list_type: Literal[2] | Omit = omit,
1687
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1688
- # The extra values given here take precedence over values defined on the client or passed to this method.
1689
- extra_headers: Headers | None = None,
1690
- extra_query: Query | None = None,
1691
- extra_body: Body | None = None,
1692
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
1693
- ) -> ListObjectsResponse:
1694
- """
1695
- List all objects contained in a given bucket.
1696
-
1697
- Args:
1698
- extra_headers: Send extra headers
1699
-
1700
- extra_query: Add additional query parameters to the request
1701
-
1702
- extra_body: Add additional JSON properties to the request
1703
-
1704
- timeout: Override the client-level default timeout for this request, in seconds
1705
- """
1706
- if not bucket_name:
1707
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
1708
- extra_headers = {"Accept": "application/xml", **(extra_headers or {})}
1709
- return await self.get(
1710
- f"/{bucket_name}",
1711
- options=make_request_options(
1712
- extra_headers=extra_headers,
1713
- extra_query=extra_query,
1714
- extra_body=extra_body,
1715
- timeout=timeout,
1716
- query=await async_maybe_transform(
1717
- {"list_type": list_type}, client_list_objects_params.ClientListObjectsParams
1718
- ),
1719
- ),
1720
- cast_to=ListObjectsResponse,
1721
- )
1722
-
1723
- async def put_object(
1724
- self,
1725
- object_name: str,
1726
- *,
1727
- bucket_name: str,
1728
- body: FileTypes,
1729
- part_number: str | Omit = omit,
1730
- upload_id: str | Omit = omit,
1731
- # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
1732
- # The extra values given here take precedence over values defined on the client or passed to this method.
1733
- extra_headers: Headers | None = None,
1734
- extra_query: Query | None = None,
1735
- extra_body: Body | None = None,
1736
- timeout: float | httpx.Timeout | None | NotGiven = not_given,
1737
- ) -> None:
1738
- """
1739
- Add an object to a bucket.
1740
-
1741
- Args:
1742
- extra_headers: Send extra headers
1743
-
1744
- extra_query: Add additional query parameters to the request
1745
-
1746
- extra_body: Add additional JSON properties to the request
1747
-
1748
- timeout: Override the client-level default timeout for this request, in seconds
1749
- """
1750
- if not bucket_name:
1751
- raise ValueError(f"Expected a non-empty value for `bucket_name` but received {bucket_name!r}")
1752
- if not object_name:
1753
- raise ValueError(f"Expected a non-empty value for `object_name` but received {object_name!r}")
1754
- extra_headers = {"Accept": "*/*", **(extra_headers or {})}
1755
- return await self.put(
1756
- f"/{bucket_name}/{object_name}",
1757
- body=await async_maybe_transform(body, client_put_object_params.ClientPutObjectParams),
1758
- options=make_request_options(
1759
- extra_headers=extra_headers,
1760
- extra_query=extra_query,
1761
- extra_body=extra_body,
1762
- timeout=timeout,
1763
- query=await async_maybe_transform(
1764
- {
1765
- "part_number": part_number,
1766
- "upload_id": upload_id,
1767
- },
1768
- client_put_object_params.ClientPutObjectParams,
1769
- ),
1770
- ),
1771
- cast_to=NoneType,
1772
- )
1773
-
1774
1127
  @override
1775
1128
  def _make_status_error(
1776
1129
  self,
@@ -1807,10 +1160,6 @@ class AsyncTelnyx(AsyncAPIClient):
1807
1160
 
1808
1161
  class TelnyxWithRawResponse:
1809
1162
  def __init__(self, client: Telnyx) -> None:
1810
- self.legacy = legacy.LegacyResourceWithRawResponse(client.legacy)
1811
- self.oauth = oauth.OAuthResourceWithRawResponse(client.oauth)
1812
- self.oauth_clients = oauth_clients.OAuthClientsResourceWithRawResponse(client.oauth_clients)
1813
- self.oauth_grants = oauth_grants.OAuthGrantsResourceWithRawResponse(client.oauth_grants)
1814
1163
  self.access_ip_address = access_ip_address.AccessIPAddressResourceWithRawResponse(client.access_ip_address)
1815
1164
  self.access_ip_ranges = access_ip_ranges.AccessIPRangesResourceWithRawResponse(client.access_ip_ranges)
1816
1165
  self.actions = actions.ActionsResourceWithRawResponse(client.actions)
@@ -2086,40 +1435,14 @@ class TelnyxWithRawResponse:
2086
1435
  )
2087
1436
  self.partner_campaigns = partner_campaigns.PartnerCampaignsResourceWithRawResponse(client.partner_campaigns)
2088
1437
  self.well_known = well_known.WellKnownResourceWithRawResponse(client.well_known)
2089
-
2090
- self.create_bucket = to_raw_response_wrapper(
2091
- client.create_bucket,
2092
- )
2093
- self.delete_bucket = to_raw_response_wrapper(
2094
- client.delete_bucket,
2095
- )
2096
- self.delete_object = to_raw_response_wrapper(
2097
- client.delete_object,
2098
- )
2099
- self.delete_objects = to_raw_response_wrapper(
2100
- client.delete_objects,
2101
- )
2102
- self.get_object = to_custom_raw_response_wrapper(
2103
- client.get_object,
2104
- BinaryAPIResponse,
2105
- )
2106
- self.list_buckets = to_raw_response_wrapper(
2107
- client.list_buckets,
2108
- )
2109
- self.list_objects = to_raw_response_wrapper(
2110
- client.list_objects,
2111
- )
2112
- self.put_object = to_raw_response_wrapper(
2113
- client.put_object,
2114
- )
1438
+ self.legacy = legacy.LegacyResourceWithRawResponse(client.legacy)
1439
+ self.oauth = oauth.OAuthResourceWithRawResponse(client.oauth)
1440
+ self.oauth_clients = oauth_clients.OAuthClientsResourceWithRawResponse(client.oauth_clients)
1441
+ self.oauth_grants = oauth_grants.OAuthGrantsResourceWithRawResponse(client.oauth_grants)
2115
1442
 
2116
1443
 
2117
1444
  class AsyncTelnyxWithRawResponse:
2118
1445
  def __init__(self, client: AsyncTelnyx) -> None:
2119
- self.legacy = legacy.AsyncLegacyResourceWithRawResponse(client.legacy)
2120
- self.oauth = oauth.AsyncOAuthResourceWithRawResponse(client.oauth)
2121
- self.oauth_clients = oauth_clients.AsyncOAuthClientsResourceWithRawResponse(client.oauth_clients)
2122
- self.oauth_grants = oauth_grants.AsyncOAuthGrantsResourceWithRawResponse(client.oauth_grants)
2123
1446
  self.access_ip_address = access_ip_address.AsyncAccessIPAddressResourceWithRawResponse(client.access_ip_address)
2124
1447
  self.access_ip_ranges = access_ip_ranges.AsyncAccessIPRangesResourceWithRawResponse(client.access_ip_ranges)
2125
1448
  self.actions = actions.AsyncActionsResourceWithRawResponse(client.actions)
@@ -2435,40 +1758,14 @@ class AsyncTelnyxWithRawResponse:
2435
1758
  client.partner_campaigns
2436
1759
  )
2437
1760
  self.well_known = well_known.AsyncWellKnownResourceWithRawResponse(client.well_known)
2438
-
2439
- self.create_bucket = async_to_raw_response_wrapper(
2440
- client.create_bucket,
2441
- )
2442
- self.delete_bucket = async_to_raw_response_wrapper(
2443
- client.delete_bucket,
2444
- )
2445
- self.delete_object = async_to_raw_response_wrapper(
2446
- client.delete_object,
2447
- )
2448
- self.delete_objects = async_to_raw_response_wrapper(
2449
- client.delete_objects,
2450
- )
2451
- self.get_object = async_to_custom_raw_response_wrapper(
2452
- client.get_object,
2453
- AsyncBinaryAPIResponse,
2454
- )
2455
- self.list_buckets = async_to_raw_response_wrapper(
2456
- client.list_buckets,
2457
- )
2458
- self.list_objects = async_to_raw_response_wrapper(
2459
- client.list_objects,
2460
- )
2461
- self.put_object = async_to_raw_response_wrapper(
2462
- client.put_object,
2463
- )
1761
+ self.legacy = legacy.AsyncLegacyResourceWithRawResponse(client.legacy)
1762
+ self.oauth = oauth.AsyncOAuthResourceWithRawResponse(client.oauth)
1763
+ self.oauth_clients = oauth_clients.AsyncOAuthClientsResourceWithRawResponse(client.oauth_clients)
1764
+ self.oauth_grants = oauth_grants.AsyncOAuthGrantsResourceWithRawResponse(client.oauth_grants)
2464
1765
 
2465
1766
 
2466
1767
  class TelnyxWithStreamedResponse:
2467
1768
  def __init__(self, client: Telnyx) -> None:
2468
- self.legacy = legacy.LegacyResourceWithStreamingResponse(client.legacy)
2469
- self.oauth = oauth.OAuthResourceWithStreamingResponse(client.oauth)
2470
- self.oauth_clients = oauth_clients.OAuthClientsResourceWithStreamingResponse(client.oauth_clients)
2471
- self.oauth_grants = oauth_grants.OAuthGrantsResourceWithStreamingResponse(client.oauth_grants)
2472
1769
  self.access_ip_address = access_ip_address.AccessIPAddressResourceWithStreamingResponse(
2473
1770
  client.access_ip_address
2474
1771
  )
@@ -2790,40 +2087,14 @@ class TelnyxWithStreamedResponse:
2790
2087
  client.partner_campaigns
2791
2088
  )
2792
2089
  self.well_known = well_known.WellKnownResourceWithStreamingResponse(client.well_known)
2793
-
2794
- self.create_bucket = to_streamed_response_wrapper(
2795
- client.create_bucket,
2796
- )
2797
- self.delete_bucket = to_streamed_response_wrapper(
2798
- client.delete_bucket,
2799
- )
2800
- self.delete_object = to_streamed_response_wrapper(
2801
- client.delete_object,
2802
- )
2803
- self.delete_objects = to_streamed_response_wrapper(
2804
- client.delete_objects,
2805
- )
2806
- self.get_object = to_custom_streamed_response_wrapper(
2807
- client.get_object,
2808
- StreamedBinaryAPIResponse,
2809
- )
2810
- self.list_buckets = to_streamed_response_wrapper(
2811
- client.list_buckets,
2812
- )
2813
- self.list_objects = to_streamed_response_wrapper(
2814
- client.list_objects,
2815
- )
2816
- self.put_object = to_streamed_response_wrapper(
2817
- client.put_object,
2818
- )
2090
+ self.legacy = legacy.LegacyResourceWithStreamingResponse(client.legacy)
2091
+ self.oauth = oauth.OAuthResourceWithStreamingResponse(client.oauth)
2092
+ self.oauth_clients = oauth_clients.OAuthClientsResourceWithStreamingResponse(client.oauth_clients)
2093
+ self.oauth_grants = oauth_grants.OAuthGrantsResourceWithStreamingResponse(client.oauth_grants)
2819
2094
 
2820
2095
 
2821
2096
  class AsyncTelnyxWithStreamedResponse:
2822
2097
  def __init__(self, client: AsyncTelnyx) -> None:
2823
- self.legacy = legacy.AsyncLegacyResourceWithStreamingResponse(client.legacy)
2824
- self.oauth = oauth.AsyncOAuthResourceWithStreamingResponse(client.oauth)
2825
- self.oauth_clients = oauth_clients.AsyncOAuthClientsResourceWithStreamingResponse(client.oauth_clients)
2826
- self.oauth_grants = oauth_grants.AsyncOAuthGrantsResourceWithStreamingResponse(client.oauth_grants)
2827
2098
  self.access_ip_address = access_ip_address.AsyncAccessIPAddressResourceWithStreamingResponse(
2828
2099
  client.access_ip_address
2829
2100
  )
@@ -3187,32 +2458,10 @@ class AsyncTelnyxWithStreamedResponse:
3187
2458
  client.partner_campaigns
3188
2459
  )
3189
2460
  self.well_known = well_known.AsyncWellKnownResourceWithStreamingResponse(client.well_known)
3190
-
3191
- self.create_bucket = async_to_streamed_response_wrapper(
3192
- client.create_bucket,
3193
- )
3194
- self.delete_bucket = async_to_streamed_response_wrapper(
3195
- client.delete_bucket,
3196
- )
3197
- self.delete_object = async_to_streamed_response_wrapper(
3198
- client.delete_object,
3199
- )
3200
- self.delete_objects = async_to_streamed_response_wrapper(
3201
- client.delete_objects,
3202
- )
3203
- self.get_object = async_to_custom_streamed_response_wrapper(
3204
- client.get_object,
3205
- AsyncStreamedBinaryAPIResponse,
3206
- )
3207
- self.list_buckets = async_to_streamed_response_wrapper(
3208
- client.list_buckets,
3209
- )
3210
- self.list_objects = async_to_streamed_response_wrapper(
3211
- client.list_objects,
3212
- )
3213
- self.put_object = async_to_streamed_response_wrapper(
3214
- client.put_object,
3215
- )
2461
+ self.legacy = legacy.AsyncLegacyResourceWithStreamingResponse(client.legacy)
2462
+ self.oauth = oauth.AsyncOAuthResourceWithStreamingResponse(client.oauth)
2463
+ self.oauth_clients = oauth_clients.AsyncOAuthClientsResourceWithStreamingResponse(client.oauth_clients)
2464
+ self.oauth_grants = oauth_grants.AsyncOAuthGrantsResourceWithStreamingResponse(client.oauth_grants)
3216
2465
 
3217
2466
 
3218
2467
  Client = Telnyx