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