Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 4 additions & 3 deletions clients/python/agenta_client/__init__.py

Large diffs are not rendered by default.

23 changes: 23 additions & 0 deletions clients/python/agenta_client/mounts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,3 +2,26 @@

# isort: skip_file

import typing
from importlib import import_module
if typing.TYPE_CHECKING:
from .types import GetMountFilesRequestOrder
_dynamic_imports: typing.Dict[str, str] = {"GetMountFilesRequestOrder": ".types"}
def __getattr__(attr_name: str) -> typing.Any:
module_name = _dynamic_imports.get(attr_name)
if module_name is None:
raise AttributeError(f"No {attr_name} found in _dynamic_imports for module name -> {__name__}")
try:
module = import_module(module_name, __package__)
if module_name == f".{attr_name}":
return module
else:
return getattr(module, attr_name)
except ImportError as e:
raise ImportError(f"Failed to import {attr_name} from {module_name}: {e}") from e
except AttributeError as e:
raise AttributeError(f"Failed to get {attr_name} from {module_name}: {e}") from e
def __dir__():
lazy_attrs = list(_dynamic_imports.keys())
return sorted(lazy_attrs)
__all__ = ["GetMountFilesRequestOrder"]
138 changes: 115 additions & 23 deletions clients/python/agenta_client/mounts/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
from .. import core
from ..core.client_wrapper import AsyncClientWrapper, SyncClientWrapper
from ..core.request_options import RequestOptions
from ..types.mount_create import MountCreate
from ..types.archive_mount import ArchiveMount
from ..types.mount_credentials_response import MountCredentialsResponse
from ..types.mount_edit import MountEdit
from ..types.mount_file_deleted_response import MountFileDeletedResponse
Expand All @@ -14,8 +14,10 @@
from ..types.mount_query import MountQuery
from ..types.mount_response import MountResponse
from ..types.mounts_response import MountsResponse
from ..types.public_mount_create import PublicMountCreate
from ..types.windowing import Windowing
from .raw_client import AsyncRawMountsClient, RawMountsClient
from .types.get_mount_files_request_order import GetMountFilesRequestOrder

# this is used as the default value for optional parameters
OMIT = typing.cast(typing.Any, ...)
Expand All @@ -34,11 +36,11 @@ def with_raw_response(self) -> RawMountsClient:
"""
return self._raw_client

def create_mount(self, *, mount: MountCreate, request_options: typing.Optional[RequestOptions] = None) -> MountResponse:
def create_mount(self, *, mount: PublicMountCreate, request_options: typing.Optional[RequestOptions] = None) -> MountResponse:
"""
Parameters
----------
mount : MountCreate
mount : PublicMountCreate

request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Expand All @@ -50,13 +52,13 @@ def create_mount(self, *, mount: MountCreate, request_options: typing.Optional[R

Examples
--------
from agenta import AgentaApi, MountCreate
from agenta import AgentaApi, PublicMountCreate

client = AgentaApi(
api_key="YOUR_API_KEY",
)
client.mounts.create_mount(
mount=MountCreate(),
mount=PublicMountCreate(),
)
"""
_response = self._raw_client.create_mount(mount=mount, request_options=request_options)
Expand Down Expand Up @@ -243,6 +245,34 @@ def sign_mount_credentials(self, mount_id: str, *, request_options: typing.Optio
_response = self._raw_client.sign_mount_credentials(mount_id, request_options=request_options)
return _response.data

def export_mount_files(self, *, mounts: typing.Optional[typing.Sequence[ArchiveMount]] = OMIT, filename: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None) -> typing.Iterator[bytes]:
"""
Parameters
----------
mounts : typing.Optional[typing.Sequence[ArchiveMount]]

filename : typing.Optional[str]

request_options : typing.Optional[RequestOptions]
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

Returns
-------
typing.Iterator[bytes]
Successful Response

Examples
--------
from agenta import AgentaApi

client = AgentaApi(
api_key="YOUR_API_KEY",
)
client.mounts.export_mount_files()
"""
with self._raw_client.export_mount_files(mounts=mounts, filename=filename, request_options=request_options) as r:
yield from r.data

def archive_mount(self, mount_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> MountResponse:
"""
Parameters
Expand Down Expand Up @@ -363,7 +393,7 @@ def upload_mount_file(self, mount_id: str, *, file: core.File, path: typing.Opti
_response = self._raw_client.upload_mount_file(mount_id, file=file, path=path, request_options=request_options)
return _response.data

def download_mount_file(self, mount_id: str, *, path: str, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
def download_mount_file(self, mount_id: str, *, path: str, request_options: typing.Optional[RequestOptions] = None) -> typing.Iterator[bytes]:
"""
Parameters
----------
Expand All @@ -372,11 +402,11 @@ def download_mount_file(self, mount_id: str, *, path: str, request_options: typi
path : str

request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

Returns
-------
typing.Any
typing.Iterator[bytes]
Successful Response

Examples
Expand All @@ -391,10 +421,10 @@ def download_mount_file(self, mount_id: str, *, path: str, request_options: typi
path="path",
)
"""
_response = self._raw_client.download_mount_file(mount_id, path=path, request_options=request_options)
return _response.data
with self._raw_client.download_mount_file(mount_id, path=path, request_options=request_options) as r:
yield from r.data

def get_mount_files(self, mount_id: str, *, path: typing.Optional[str] = None, read: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
def get_mount_files(self, mount_id: str, *, path: typing.Optional[str] = None, read: typing.Optional[str] = None, order: typing.Optional[GetMountFilesRequestOrder] = None, limit: typing.Optional[int] = None, depth: typing.Optional[int] = None, with_counts: typing.Optional[bool] = None, git_aware: typing.Optional[bool] = None, include_gitignored: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
"""
Parameters
----------
Expand All @@ -404,6 +434,18 @@ def get_mount_files(self, mount_id: str, *, path: typing.Optional[str] = None, r

read : typing.Optional[str]

order : typing.Optional[GetMountFilesRequestOrder]

limit : typing.Optional[int]

depth : typing.Optional[int]

with_counts : typing.Optional[bool]

git_aware : typing.Optional[bool]

include_gitignored : typing.Optional[bool]

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand All @@ -423,7 +465,7 @@ def get_mount_files(self, mount_id: str, *, path: typing.Optional[str] = None, r
mount_id="mount_id",
)
"""
_response = self._raw_client.get_mount_files(mount_id, path=path, read=read, request_options=request_options)
_response = self._raw_client.get_mount_files(mount_id, path=path, read=read, order=order, limit=limit, depth=depth, with_counts=with_counts, git_aware=git_aware, include_gitignored=include_gitignored, request_options=request_options)
return _response.data

def write_mount_file(self, mount_id: str, *, path: str, request_options: typing.Optional[RequestOptions] = None) -> MountFileWrittenResponse:
Expand Down Expand Up @@ -502,11 +544,11 @@ def with_raw_response(self) -> AsyncRawMountsClient:
"""
return self._raw_client

async def create_mount(self, *, mount: MountCreate, request_options: typing.Optional[RequestOptions] = None) -> MountResponse:
async def create_mount(self, *, mount: PublicMountCreate, request_options: typing.Optional[RequestOptions] = None) -> MountResponse:
"""
Parameters
----------
mount : MountCreate
mount : PublicMountCreate

request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Expand All @@ -520,7 +562,7 @@ async def create_mount(self, *, mount: MountCreate, request_options: typing.Opti
--------
import asyncio

from agenta import AsyncAgentaApi, MountCreate
from agenta import AsyncAgentaApi, PublicMountCreate

client = AsyncAgentaApi(
api_key="YOUR_API_KEY",
Expand All @@ -529,7 +571,7 @@ async def create_mount(self, *, mount: MountCreate, request_options: typing.Opti

async def main() -> None:
await client.mounts.create_mount(
mount=MountCreate(),
mount=PublicMountCreate(),
)


Expand Down Expand Up @@ -767,6 +809,43 @@ async def main() -> None:
_response = await self._raw_client.sign_mount_credentials(mount_id, request_options=request_options)
return _response.data

async def export_mount_files(self, *, mounts: typing.Optional[typing.Sequence[ArchiveMount]] = OMIT, filename: typing.Optional[str] = OMIT, request_options: typing.Optional[RequestOptions] = None) -> typing.AsyncIterator[bytes]:
"""
Parameters
----------
mounts : typing.Optional[typing.Sequence[ArchiveMount]]

filename : typing.Optional[str]

request_options : typing.Optional[RequestOptions]
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

Returns
-------
typing.AsyncIterator[bytes]
Successful Response

Examples
--------
import asyncio

from agenta import AsyncAgentaApi

client = AsyncAgentaApi(
api_key="YOUR_API_KEY",
)


async def main() -> None:
await client.mounts.export_mount_files()


asyncio.run(main())
"""
async with self._raw_client.export_mount_files(mounts=mounts, filename=filename, request_options=request_options) as r:
async for _chunk in r.data:
yield _chunk

async def archive_mount(self, mount_id: str, *, request_options: typing.Optional[RequestOptions] = None) -> MountResponse:
"""
Parameters
Expand Down Expand Up @@ -919,7 +998,7 @@ async def main() -> None:
_response = await self._raw_client.upload_mount_file(mount_id, file=file, path=path, request_options=request_options)
return _response.data

async def download_mount_file(self, mount_id: str, *, path: str, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
async def download_mount_file(self, mount_id: str, *, path: str, request_options: typing.Optional[RequestOptions] = None) -> typing.AsyncIterator[bytes]:
"""
Parameters
----------
Expand All @@ -928,11 +1007,11 @@ async def download_mount_file(self, mount_id: str, *, path: str, request_options
path : str

request_options : typing.Optional[RequestOptions]
Request-specific configuration.
Request-specific configuration. You can pass in configuration such as `chunk_size`, and more to customize the request and response.

Returns
-------
typing.Any
typing.AsyncIterator[bytes]
Successful Response

Examples
Expand All @@ -955,10 +1034,11 @@ async def main() -> None:

asyncio.run(main())
"""
_response = await self._raw_client.download_mount_file(mount_id, path=path, request_options=request_options)
return _response.data
async with self._raw_client.download_mount_file(mount_id, path=path, request_options=request_options) as r:
async for _chunk in r.data:
yield _chunk

async def get_mount_files(self, mount_id: str, *, path: typing.Optional[str] = None, read: typing.Optional[str] = None, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
async def get_mount_files(self, mount_id: str, *, path: typing.Optional[str] = None, read: typing.Optional[str] = None, order: typing.Optional[GetMountFilesRequestOrder] = None, limit: typing.Optional[int] = None, depth: typing.Optional[int] = None, with_counts: typing.Optional[bool] = None, git_aware: typing.Optional[bool] = None, include_gitignored: typing.Optional[bool] = None, request_options: typing.Optional[RequestOptions] = None) -> typing.Any:
"""
Parameters
----------
Expand All @@ -968,6 +1048,18 @@ async def get_mount_files(self, mount_id: str, *, path: typing.Optional[str] = N

read : typing.Optional[str]

order : typing.Optional[GetMountFilesRequestOrder]

limit : typing.Optional[int]

depth : typing.Optional[int]

with_counts : typing.Optional[bool]

git_aware : typing.Optional[bool]

include_gitignored : typing.Optional[bool]

request_options : typing.Optional[RequestOptions]
Request-specific configuration.

Expand Down Expand Up @@ -995,7 +1087,7 @@ async def main() -> None:

asyncio.run(main())
"""
_response = await self._raw_client.get_mount_files(mount_id, path=path, read=read, request_options=request_options)
_response = await self._raw_client.get_mount_files(mount_id, path=path, read=read, order=order, limit=limit, depth=depth, with_counts=with_counts, git_aware=git_aware, include_gitignored=include_gitignored, request_options=request_options)
return _response.data

async def write_mount_file(self, mount_id: str, *, path: str, request_options: typing.Optional[RequestOptions] = None) -> MountFileWrittenResponse:
Expand Down
Loading
Loading