Skip to content

Commit 32ea1f2

Browse files
release: 3.2.0-alpha (#95)
* codegen metadata * codegen metadata * feat: port-4304: add public download document link specs * codegen metadata * codegen metadata * codegen metadata * codegen metadata * codegen metadata * release: 3.2.0-alpha --------- Co-authored-by: stainless-app[bot] <142633134+stainless-app[bot]@users.noreply.github.com>
1 parent 515105e commit 32ea1f2

10 files changed

Lines changed: 200 additions & 7 deletions

File tree

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "3.1.0-alpha"
2+
".": "3.2.0-alpha"
33
}

.stats.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
configured_endpoints: 800
2-
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/telnyx%2Ftelnyx-40a540682e7307b506c6d48ed7fc93b2751075b37276bbf6d1871415abc701a4.yml
3-
openapi_spec_hash: 2d2c92c05002d51217cb901152d4439a
4-
config_hash: 042e8a6e781fd484663a6c2142daaae5
1+
configured_endpoints: 801
2+
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/telnyx%2Ftelnyx-f817dc5db29d722549a84a416041e8b986274237116593a3feeaefb1c5e93ed0.yml
3+
openapi_spec_hash: e344d1e9ae23ddd4cd7646113ee76e7f
4+
config_hash: 6bab75d5a002089c3f9b042706f8c4eb

CHANGELOG.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,13 @@
11
# Changelog
22

3+
## 3.2.0-alpha (2025-08-27)
4+
5+
Full Changelog: [v3.1.0-alpha...v3.2.0-alpha](https://github.com/team-telnyx/telnyx-python/compare/v3.1.0-alpha...v3.2.0-alpha)
6+
7+
### Features
8+
9+
* port-4304: add public download document link specs ([c99efa8](https://github.com/team-telnyx/telnyx-python/commit/c99efa8fe272848ccdb18b984238b44f065dd0b2))
10+
311
## 3.1.0-alpha (2025-08-27)
412

513
Full Changelog: [v3.0.0-alpha...v3.1.0-alpha](https://github.com/team-telnyx/telnyx-python/compare/v3.0.0-alpha...v3.1.0-alpha)

api.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1221,6 +1221,7 @@ from telnyx.types import (
12211221
DocumentUpdateResponse,
12221222
DocumentListResponse,
12231223
DocumentDeleteResponse,
1224+
DocumentGenerateDownloadLinkResponse,
12241225
DocumentUploadResponse,
12251226
)
12261227
```
@@ -1232,6 +1233,7 @@ Methods:
12321233
- <code title="get /documents">client.documents.<a href="./src/telnyx/resources/documents.py">list</a>(\*\*<a href="src/telnyx/types/document_list_params.py">params</a>) -> <a href="./src/telnyx/types/document_list_response.py">DocumentListResponse</a></code>
12331234
- <code title="delete /documents/{id}">client.documents.<a href="./src/telnyx/resources/documents.py">delete</a>(id) -> <a href="./src/telnyx/types/document_delete_response.py">DocumentDeleteResponse</a></code>
12341235
- <code title="get /documents/{id}/download">client.documents.<a href="./src/telnyx/resources/documents.py">download</a>(id) -> BinaryAPIResponse</code>
1236+
- <code title="get /documents/{id}/download_link">client.documents.<a href="./src/telnyx/resources/documents.py">generate_download_link</a>(id) -> <a href="./src/telnyx/types/document_generate_download_link_response.py">DocumentGenerateDownloadLinkResponse</a></code>
12351237
- <code title="post /documents">client.documents.<a href="./src/telnyx/resources/documents.py">upload</a>(\*\*<a href="src/telnyx/types/document_upload_params.py">params</a>) -> <a href="./src/telnyx/types/document_upload_response.py">DocumentUploadResponse</a></code>
12361238

12371239
# DynamicEmergencyAddresses

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[project]
22
name = "telnyx"
3-
version = "3.1.0-alpha"
3+
version = "3.2.0-alpha"
44
description = "The official Python library for the telnyx API"
55
dynamic = ["readme"]
66
license = "MIT"

src/telnyx/_version.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
22

33
__title__ = "telnyx"
4-
__version__ = "3.1.0-alpha" # x-release-please-version
4+
__version__ = "3.2.0-alpha" # x-release-please-version

src/telnyx/resources/documents.py

Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@
3232
from ..types.document_update_response import DocumentUpdateResponse
3333
from ..types.document_upload_response import DocumentUploadResponse
3434
from ..types.document_retrieve_response import DocumentRetrieveResponse
35+
from ..types.document_generate_download_link_response import DocumentGenerateDownloadLinkResponse
3536

3637
__all__ = ["DocumentsResource", "AsyncDocumentsResource"]
3738

@@ -259,6 +260,40 @@ def download(
259260
cast_to=BinaryAPIResponse,
260261
)
261262

263+
def generate_download_link(
264+
self,
265+
id: str,
266+
*,
267+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
268+
# The extra values given here take precedence over values defined on the client or passed to this method.
269+
extra_headers: Headers | None = None,
270+
extra_query: Query | None = None,
271+
extra_body: Body | None = None,
272+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
273+
) -> DocumentGenerateDownloadLinkResponse:
274+
"""
275+
Generates a temporary pre-signed URL that can be used to download the document
276+
directly from the storage backend without authentication.
277+
278+
Args:
279+
extra_headers: Send extra headers
280+
281+
extra_query: Add additional query parameters to the request
282+
283+
extra_body: Add additional JSON properties to the request
284+
285+
timeout: Override the client-level default timeout for this request, in seconds
286+
"""
287+
if not id:
288+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
289+
return self._get(
290+
f"/documents/{id}/download_link",
291+
options=make_request_options(
292+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
293+
),
294+
cast_to=DocumentGenerateDownloadLinkResponse,
295+
)
296+
262297
@overload
263298
def upload(
264299
self,
@@ -593,6 +628,40 @@ async def download(
593628
cast_to=AsyncBinaryAPIResponse,
594629
)
595630

631+
async def generate_download_link(
632+
self,
633+
id: str,
634+
*,
635+
# Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
636+
# The extra values given here take precedence over values defined on the client or passed to this method.
637+
extra_headers: Headers | None = None,
638+
extra_query: Query | None = None,
639+
extra_body: Body | None = None,
640+
timeout: float | httpx.Timeout | None | NotGiven = NOT_GIVEN,
641+
) -> DocumentGenerateDownloadLinkResponse:
642+
"""
643+
Generates a temporary pre-signed URL that can be used to download the document
644+
directly from the storage backend without authentication.
645+
646+
Args:
647+
extra_headers: Send extra headers
648+
649+
extra_query: Add additional query parameters to the request
650+
651+
extra_body: Add additional JSON properties to the request
652+
653+
timeout: Override the client-level default timeout for this request, in seconds
654+
"""
655+
if not id:
656+
raise ValueError(f"Expected a non-empty value for `id` but received {id!r}")
657+
return await self._get(
658+
f"/documents/{id}/download_link",
659+
options=make_request_options(
660+
extra_headers=extra_headers, extra_query=extra_query, extra_body=extra_body, timeout=timeout
661+
),
662+
cast_to=DocumentGenerateDownloadLinkResponse,
663+
)
664+
596665
@overload
597666
async def upload(
598667
self,
@@ -724,6 +793,9 @@ def __init__(self, documents: DocumentsResource) -> None:
724793
documents.download,
725794
BinaryAPIResponse,
726795
)
796+
self.generate_download_link = to_raw_response_wrapper(
797+
documents.generate_download_link,
798+
)
727799
self.upload = to_raw_response_wrapper(
728800
documents.upload,
729801
)
@@ -749,6 +821,9 @@ def __init__(self, documents: AsyncDocumentsResource) -> None:
749821
documents.download,
750822
AsyncBinaryAPIResponse,
751823
)
824+
self.generate_download_link = async_to_raw_response_wrapper(
825+
documents.generate_download_link,
826+
)
752827
self.upload = async_to_raw_response_wrapper(
753828
documents.upload,
754829
)
@@ -774,6 +849,9 @@ def __init__(self, documents: DocumentsResource) -> None:
774849
documents.download,
775850
StreamedBinaryAPIResponse,
776851
)
852+
self.generate_download_link = to_streamed_response_wrapper(
853+
documents.generate_download_link,
854+
)
777855
self.upload = to_streamed_response_wrapper(
778856
documents.upload,
779857
)
@@ -799,6 +877,9 @@ def __init__(self, documents: AsyncDocumentsResource) -> None:
799877
documents.download,
800878
AsyncStreamedBinaryAPIResponse,
801879
)
880+
self.generate_download_link = async_to_streamed_response_wrapper(
881+
documents.generate_download_link,
882+
)
802883
self.upload = async_to_streamed_response_wrapper(
803884
documents.upload,
804885
)

src/telnyx/types/__init__.py

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -893,6 +893,9 @@
893893
from .call_control_application_update_response import (
894894
CallControlApplicationUpdateResponse as CallControlApplicationUpdateResponse,
895895
)
896+
from .document_generate_download_link_response import (
897+
DocumentGenerateDownloadLinkResponse as DocumentGenerateDownloadLinkResponse,
898+
)
896899
from .dynamic_emergency_endpoint_create_params import (
897900
DynamicEmergencyEndpointCreateParams as DynamicEmergencyEndpointCreateParams,
898901
)
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
# File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details.
2+
3+
from .._models import BaseModel
4+
5+
__all__ = ["DocumentGenerateDownloadLinkResponse", "Data"]
6+
7+
8+
class Data(BaseModel):
9+
url: str
10+
"""Pre-signed temporary URL for downloading the document"""
11+
12+
13+
class DocumentGenerateDownloadLinkResponse(BaseModel):
14+
data: Data

tests/api_resources/test_documents.py

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,7 @@
1717
DocumentUpdateResponse,
1818
DocumentUploadResponse,
1919
DocumentRetrieveResponse,
20+
DocumentGenerateDownloadLinkResponse,
2021
)
2122
from telnyx._utils import parse_datetime
2223
from telnyx._response import (
@@ -275,6 +276,48 @@ def test_path_params_download(self, client: Telnyx) -> None:
275276
"",
276277
)
277278

279+
@pytest.mark.skip(reason="Prism tests are disabled")
280+
@parametrize
281+
def test_method_generate_download_link(self, client: Telnyx) -> None:
282+
document = client.documents.generate_download_link(
283+
"550e8400-e29b-41d4-a716-446655440000",
284+
)
285+
assert_matches_type(DocumentGenerateDownloadLinkResponse, document, path=["response"])
286+
287+
@pytest.mark.skip(reason="Prism tests are disabled")
288+
@parametrize
289+
def test_raw_response_generate_download_link(self, client: Telnyx) -> None:
290+
response = client.documents.with_raw_response.generate_download_link(
291+
"550e8400-e29b-41d4-a716-446655440000",
292+
)
293+
294+
assert response.is_closed is True
295+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
296+
document = response.parse()
297+
assert_matches_type(DocumentGenerateDownloadLinkResponse, document, path=["response"])
298+
299+
@pytest.mark.skip(reason="Prism tests are disabled")
300+
@parametrize
301+
def test_streaming_response_generate_download_link(self, client: Telnyx) -> None:
302+
with client.documents.with_streaming_response.generate_download_link(
303+
"550e8400-e29b-41d4-a716-446655440000",
304+
) as response:
305+
assert not response.is_closed
306+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
307+
308+
document = response.parse()
309+
assert_matches_type(DocumentGenerateDownloadLinkResponse, document, path=["response"])
310+
311+
assert cast(Any, response.is_closed) is True
312+
313+
@pytest.mark.skip(reason="Prism tests are disabled")
314+
@parametrize
315+
def test_path_params_generate_download_link(self, client: Telnyx) -> None:
316+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
317+
client.documents.with_raw_response.generate_download_link(
318+
"",
319+
)
320+
278321
@pytest.mark.skip(reason="Prism tests are disabled")
279322
@parametrize
280323
def test_method_upload_overload_1(self, client: Telnyx) -> None:
@@ -612,6 +655,48 @@ async def test_path_params_download(self, async_client: AsyncTelnyx) -> None:
612655
"",
613656
)
614657

658+
@pytest.mark.skip(reason="Prism tests are disabled")
659+
@parametrize
660+
async def test_method_generate_download_link(self, async_client: AsyncTelnyx) -> None:
661+
document = await async_client.documents.generate_download_link(
662+
"550e8400-e29b-41d4-a716-446655440000",
663+
)
664+
assert_matches_type(DocumentGenerateDownloadLinkResponse, document, path=["response"])
665+
666+
@pytest.mark.skip(reason="Prism tests are disabled")
667+
@parametrize
668+
async def test_raw_response_generate_download_link(self, async_client: AsyncTelnyx) -> None:
669+
response = await async_client.documents.with_raw_response.generate_download_link(
670+
"550e8400-e29b-41d4-a716-446655440000",
671+
)
672+
673+
assert response.is_closed is True
674+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
675+
document = await response.parse()
676+
assert_matches_type(DocumentGenerateDownloadLinkResponse, document, path=["response"])
677+
678+
@pytest.mark.skip(reason="Prism tests are disabled")
679+
@parametrize
680+
async def test_streaming_response_generate_download_link(self, async_client: AsyncTelnyx) -> None:
681+
async with async_client.documents.with_streaming_response.generate_download_link(
682+
"550e8400-e29b-41d4-a716-446655440000",
683+
) as response:
684+
assert not response.is_closed
685+
assert response.http_request.headers.get("X-Stainless-Lang") == "python"
686+
687+
document = await response.parse()
688+
assert_matches_type(DocumentGenerateDownloadLinkResponse, document, path=["response"])
689+
690+
assert cast(Any, response.is_closed) is True
691+
692+
@pytest.mark.skip(reason="Prism tests are disabled")
693+
@parametrize
694+
async def test_path_params_generate_download_link(self, async_client: AsyncTelnyx) -> None:
695+
with pytest.raises(ValueError, match=r"Expected a non-empty value for `id` but received ''"):
696+
await async_client.documents.with_raw_response.generate_download_link(
697+
"",
698+
)
699+
615700
@pytest.mark.skip(reason="Prism tests are disabled")
616701
@parametrize
617702
async def test_method_upload_overload_1(self, async_client: AsyncTelnyx) -> None:

0 commit comments

Comments
 (0)