3232from ..types .document_update_response import DocumentUpdateResponse
3333from ..types .document_upload_response import DocumentUploadResponse
3434from ..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 )
0 commit comments