inttegro.async_resources.file_links
Generated public typing surface. Do not edit by hand.
1# Generated by scripts/generate_async_resources.py; do not edit by hand. 2"""Controlled-link operations for serving managed Inttegro files.""" 3from __future__ import annotations 4from inttegro.file_link.file_link import FileLink 5from inttegro.file_link.creation import Creation 6from inttegro.file_link.page import Page 7from ..async_http_client import AsyncHttpClient 8from inttegro.file_link.create_request import CreateRequest 9from inttegro.file_link.page_request import PageRequest 10from inttegro.file_link.revoke_request import RevokeRequest 11from .files import FileDownload 12 13class AsyncFileLinks: 14 """Create and manage controlled links to managed file content. 15 16 Access this service as ``AsyncInttegroClient.file_links``. Methods use the client's shared transport and return the typed resource shapes documented below. 17 """ 18 19 def __init__(self, http: AsyncHttpClient): 20 """Bind file-link operations to the client's shared HTTP transport.""" 21 self.http = http 22 23 async def create(self, payload: CreateRequest, idempotency_key: str | None=None) -> Creation: 24 """Create a controlled file link and return its one-time creation data. 25 26 API endpoint: ``/file_links/create``. 27 28 Args: 29 payload (CreateRequest): Typed request object or equivalent request mapping for this operation. 30 idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write. 31 32 Returns: 33 ``Creation`` decoded from the documented response shape. 34 35 Raises: 36 APIError: The API rejected the request or could not complete it. 37 NetworkError: The request could not reach the Inttegro API. 38 TimeoutError: The configured request deadline elapsed. 39 """ 40 headers = {'Idempotency-Key': idempotency_key} if idempotency_key else {} 41 return await self.http.post_with_headers('/file_links/create', payload, headers) 42 43 async def lookup(self, id: str) -> FileLink: 44 """Return the file link identified by ``id``. 45 46 API endpoint: ``/file_links/lookup``. 47 48 Args: 49 id (str): Unique identifier of the id. 50 51 Returns: 52 ``FileLink`` decoded from the documented response shape. 53 54 Raises: 55 APIError: The API rejected the request or could not complete it. 56 NetworkError: The request could not reach the Inttegro API. 57 TimeoutError: The configured request deadline elapsed. 58 """ 59 return await self.http.post('/file_links/lookup', {'id': id}) 60 61 async def page(self, payload: PageRequest | None=None) -> Page: 62 """Return a page of file links for the authenticated application. 63 64 API endpoint: ``/file_links/page``. 65 66 Args: 67 payload (PageRequest | None): Typed request object or equivalent request mapping for this operation. 68 69 Returns: 70 ``Page`` decoded from the documented response shape. 71 72 Raises: 73 APIError: The API rejected the request or could not complete it. 74 NetworkError: The request could not reach the Inttegro API. 75 TimeoutError: The configured request deadline elapsed. 76 """ 77 return await self.http.post('/file_links/page', payload or {}) 78 79 async def revoke(self, payload: RevokeRequest, idempotency_key: str | None=None) -> FileLink: 80 """Revoke a file link so future attempts cannot use it. 81 82 API endpoint: ``/file_links/revoke``. 83 84 Args: 85 payload (RevokeRequest): Typed request object or equivalent request mapping for this operation. 86 idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write. 87 88 Returns: 89 ``FileLink`` decoded from the documented response shape. 90 91 Raises: 92 APIError: The API rejected the request or could not complete it. 93 NetworkError: The request could not reach the Inttegro API. 94 TimeoutError: The configured request deadline elapsed. 95 """ 96 headers = {'Idempotency-Key': idempotency_key} if idempotency_key else {} 97 return await self.http.post_with_headers('/file_links/revoke', payload, headers) 98 99 async def open(self, url: str, save_to: str | None=None) -> FileDownload: 100 """Download a public file-link ``url`` and optionally save it to ``save_to``. 101 102 Args: 103 url (str): Inttegro-issued public URL; credentials are not attached to this request. 104 save_to (str | None): Optional local path where the downloaded bytes are written. 105 106 Returns: 107 ``FileDownload`` decoded from the documented response shape. 108 """ 109 (data, headers) = await self.http.get_binary_public(url) 110 download = FileDownload(data, headers) 111 if save_to: 112 download.save_to(save_to) 113 return download
14class AsyncFileLinks: 15 """Create and manage controlled links to managed file content. 16 17 Access this service as ``AsyncInttegroClient.file_links``. Methods use the client's shared transport and return the typed resource shapes documented below. 18 """ 19 20 def __init__(self, http: AsyncHttpClient): 21 """Bind file-link operations to the client's shared HTTP transport.""" 22 self.http = http 23 24 async def create(self, payload: CreateRequest, idempotency_key: str | None=None) -> Creation: 25 """Create a controlled file link and return its one-time creation data. 26 27 API endpoint: ``/file_links/create``. 28 29 Args: 30 payload (CreateRequest): Typed request object or equivalent request mapping for this operation. 31 idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write. 32 33 Returns: 34 ``Creation`` decoded from the documented response shape. 35 36 Raises: 37 APIError: The API rejected the request or could not complete it. 38 NetworkError: The request could not reach the Inttegro API. 39 TimeoutError: The configured request deadline elapsed. 40 """ 41 headers = {'Idempotency-Key': idempotency_key} if idempotency_key else {} 42 return await self.http.post_with_headers('/file_links/create', payload, headers) 43 44 async def lookup(self, id: str) -> FileLink: 45 """Return the file link identified by ``id``. 46 47 API endpoint: ``/file_links/lookup``. 48 49 Args: 50 id (str): Unique identifier of the id. 51 52 Returns: 53 ``FileLink`` decoded from the documented response shape. 54 55 Raises: 56 APIError: The API rejected the request or could not complete it. 57 NetworkError: The request could not reach the Inttegro API. 58 TimeoutError: The configured request deadline elapsed. 59 """ 60 return await self.http.post('/file_links/lookup', {'id': id}) 61 62 async def page(self, payload: PageRequest | None=None) -> Page: 63 """Return a page of file links for the authenticated application. 64 65 API endpoint: ``/file_links/page``. 66 67 Args: 68 payload (PageRequest | None): Typed request object or equivalent request mapping for this operation. 69 70 Returns: 71 ``Page`` decoded from the documented response shape. 72 73 Raises: 74 APIError: The API rejected the request or could not complete it. 75 NetworkError: The request could not reach the Inttegro API. 76 TimeoutError: The configured request deadline elapsed. 77 """ 78 return await self.http.post('/file_links/page', payload or {}) 79 80 async def revoke(self, payload: RevokeRequest, idempotency_key: str | None=None) -> FileLink: 81 """Revoke a file link so future attempts cannot use it. 82 83 API endpoint: ``/file_links/revoke``. 84 85 Args: 86 payload (RevokeRequest): Typed request object or equivalent request mapping for this operation. 87 idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write. 88 89 Returns: 90 ``FileLink`` decoded from the documented response shape. 91 92 Raises: 93 APIError: The API rejected the request or could not complete it. 94 NetworkError: The request could not reach the Inttegro API. 95 TimeoutError: The configured request deadline elapsed. 96 """ 97 headers = {'Idempotency-Key': idempotency_key} if idempotency_key else {} 98 return await self.http.post_with_headers('/file_links/revoke', payload, headers) 99 100 async def open(self, url: str, save_to: str | None=None) -> FileDownload: 101 """Download a public file-link ``url`` and optionally save it to ``save_to``. 102 103 Args: 104 url (str): Inttegro-issued public URL; credentials are not attached to this request. 105 save_to (str | None): Optional local path where the downloaded bytes are written. 106 107 Returns: 108 ``FileDownload`` decoded from the documented response shape. 109 """ 110 (data, headers) = await self.http.get_binary_public(url) 111 download = FileDownload(data, headers) 112 if save_to: 113 download.save_to(save_to) 114 return download
Create and manage controlled links to managed file content.
Access this service as AsyncInttegroClient.file_links. Methods use the client's shared transport and return the typed resource shapes documented below.
20 def __init__(self, http: AsyncHttpClient): 21 """Bind file-link operations to the client's shared HTTP transport.""" 22 self.http = http
Bind file-link operations to the client's shared HTTP transport.
24 async def create(self, payload: CreateRequest, idempotency_key: str | None=None) -> Creation: 25 """Create a controlled file link and return its one-time creation data. 26 27 API endpoint: ``/file_links/create``. 28 29 Args: 30 payload (CreateRequest): Typed request object or equivalent request mapping for this operation. 31 idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write. 32 33 Returns: 34 ``Creation`` decoded from the documented response shape. 35 36 Raises: 37 APIError: The API rejected the request or could not complete it. 38 NetworkError: The request could not reach the Inttegro API. 39 TimeoutError: The configured request deadline elapsed. 40 """ 41 headers = {'Idempotency-Key': idempotency_key} if idempotency_key else {} 42 return await self.http.post_with_headers('/file_links/create', payload, headers)
Create a controlled file link and return its one-time creation data.
API endpoint: /file_links/create.
Arguments:
- payload (CreateRequest): Typed request object or equivalent request mapping for this operation.
- idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
Returns:
Creationdecoded from the documented response shape.
Raises:
- APIError: The API rejected the request or could not complete it.
- NetworkError: The request could not reach the Inttegro API.
- TimeoutError: The configured request deadline elapsed.
44 async def lookup(self, id: str) -> FileLink: 45 """Return the file link identified by ``id``. 46 47 API endpoint: ``/file_links/lookup``. 48 49 Args: 50 id (str): Unique identifier of the id. 51 52 Returns: 53 ``FileLink`` decoded from the documented response shape. 54 55 Raises: 56 APIError: The API rejected the request or could not complete it. 57 NetworkError: The request could not reach the Inttegro API. 58 TimeoutError: The configured request deadline elapsed. 59 """ 60 return await self.http.post('/file_links/lookup', {'id': id})
Return the file link identified by id.
API endpoint: /file_links/lookup.
Arguments:
- id (str): Unique identifier of the id.
Returns:
FileLinkdecoded from the documented response shape.
Raises:
- APIError: The API rejected the request or could not complete it.
- NetworkError: The request could not reach the Inttegro API.
- TimeoutError: The configured request deadline elapsed.
62 async def page(self, payload: PageRequest | None=None) -> Page: 63 """Return a page of file links for the authenticated application. 64 65 API endpoint: ``/file_links/page``. 66 67 Args: 68 payload (PageRequest | None): Typed request object or equivalent request mapping for this operation. 69 70 Returns: 71 ``Page`` decoded from the documented response shape. 72 73 Raises: 74 APIError: The API rejected the request or could not complete it. 75 NetworkError: The request could not reach the Inttegro API. 76 TimeoutError: The configured request deadline elapsed. 77 """ 78 return await self.http.post('/file_links/page', payload or {})
Return a page of file links for the authenticated application.
API endpoint: /file_links/page.
Arguments:
- payload (PageRequest | None): Typed request object or equivalent request mapping for this operation.
Returns:
Pagedecoded from the documented response shape.
Raises:
- APIError: The API rejected the request or could not complete it.
- NetworkError: The request could not reach the Inttegro API.
- TimeoutError: The configured request deadline elapsed.
80 async def revoke(self, payload: RevokeRequest, idempotency_key: str | None=None) -> FileLink: 81 """Revoke a file link so future attempts cannot use it. 82 83 API endpoint: ``/file_links/revoke``. 84 85 Args: 86 payload (RevokeRequest): Typed request object or equivalent request mapping for this operation. 87 idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write. 88 89 Returns: 90 ``FileLink`` decoded from the documented response shape. 91 92 Raises: 93 APIError: The API rejected the request or could not complete it. 94 NetworkError: The request could not reach the Inttegro API. 95 TimeoutError: The configured request deadline elapsed. 96 """ 97 headers = {'Idempotency-Key': idempotency_key} if idempotency_key else {} 98 return await self.http.post_with_headers('/file_links/revoke', payload, headers)
Revoke a file link so future attempts cannot use it.
API endpoint: /file_links/revoke.
Arguments:
- payload (RevokeRequest): Typed request object or equivalent request mapping for this operation.
- idempotency_key (str | None): Optional stable key to reuse when retrying the same logical write.
Returns:
FileLinkdecoded from the documented response shape.
Raises:
- APIError: The API rejected the request or could not complete it.
- NetworkError: The request could not reach the Inttegro API.
- TimeoutError: The configured request deadline elapsed.
100 async def open(self, url: str, save_to: str | None=None) -> FileDownload: 101 """Download a public file-link ``url`` and optionally save it to ``save_to``. 102 103 Args: 104 url (str): Inttegro-issued public URL; credentials are not attached to this request. 105 save_to (str | None): Optional local path where the downloaded bytes are written. 106 107 Returns: 108 ``FileDownload`` decoded from the documented response shape. 109 """ 110 (data, headers) = await self.http.get_binary_public(url) 111 download = FileDownload(data, headers) 112 if save_to: 113 download.save_to(save_to) 114 return download
Download a public file-link url and optionally save it to save_to.
Arguments:
- url (str): Inttegro-issued public URL; credentials are not attached to this request.
- save_to (str | None): Optional local path where the downloaded bytes are written.
Returns:
FileDownloaddecoded from the documented response shape.