diff --git a/.fern/metadata.json b/.fern/metadata.json index 84dffbc..d2115eb 100644 --- a/.fern/metadata.json +++ b/.fern/metadata.json @@ -1,10 +1,10 @@ { - "cliVersion": "3.51.2", + "cliVersion": "3.56.8", "generatorName": "fernapi/fern-python-sdk", - "generatorVersion": "4.51.1", + "generatorVersion": "4.54.2", "generatorConfig": { "client_class_name": "Lattice", "package_name": "anduril" }, - "sdkVersion": "4.2.0" + "sdkVersion": "4.3.0" } \ No newline at end of file diff --git a/README.md b/README.md index 67135ce..48b0f93 100644 --- a/README.md +++ b/README.md @@ -56,10 +56,7 @@ Instantiate and use the client with the following: ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.entities.long_poll_entity_events( session_token="sessionToken", ) @@ -74,10 +71,7 @@ import asyncio from anduril import AsyncLattice -client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = AsyncLattice() async def main() -> None: @@ -111,10 +105,7 @@ The SDK supports streaming responses, as well, the response will be a generator ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() response = client.entities.stream_entities() for chunk in response.data: yield chunk @@ -127,10 +118,7 @@ Paginated requests will return a `SyncPager` or `AsyncPager`, which can be used ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() response = client.objects.list_objects() for item in response: yield item @@ -181,6 +169,7 @@ client = Lattice( ) response = client.entities.with_raw_response.long_poll_entity_events(...) print(response.headers) # access the response headers +print(response.status_code) # access the response status code print(response.data) # access the underlying object pager = client.objects.list_objects(...) print(pager.response) # access the typed response for the first page @@ -191,7 +180,9 @@ for page in pager.iter_pages(): for item in page: print(item) # access the underlying object(s) with client.entities.with_raw_response.stream_entities(...) as response: - print(response.headers) # access the response headers + print( + response.headers + ) # access the response headersprint(response.status_code) # access the response status code for chunk in response.data: print(chunk) # access the underlying object(s) ``` diff --git a/pyproject.toml b/pyproject.toml index ed52f5a..41efc63 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -4,7 +4,7 @@ dynamic = ["version"] [tool.poetry] name = "anduril-lattice-sdk" -version = "4.2.0" +version = "4.3.0" description = "HTTP clients for the Anduril Lattice SDK" readme = "README.md" authors = [ @@ -24,6 +24,9 @@ classifiers = [ "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Programming Language :: Python :: 3.12", + "Programming Language :: Python :: 3.13", + "Programming Language :: Python :: 3.14", + "Programming Language :: Python :: 3.15", "Operating System :: OS Independent", "Operating System :: POSIX", "Operating System :: MacOS", diff --git a/reference.md b/reference.md index 2f31df7..093da84 100644 --- a/reference.md +++ b/reference.md @@ -35,10 +35,7 @@ provenance.sourceUpdateTime is greater than the provenance.sourceUpdateTime of t ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.entities.publish_entity() ``` @@ -420,10 +417,7 @@ Describes an entity's security classification levels at an overall classificatio ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.entities.get_entity( entity_id="entityId", ) @@ -497,10 +491,7 @@ concurrently for the same field path, the last writer wins. ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.entities.override_entity( entity_id="entityId", field_path="mil_view.disposition", @@ -596,10 +587,7 @@ This operation clears the override value from the specified field path on the en ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.entities.remove_entity_override( entity_id="entityId", field_path="mil_view.disposition", @@ -684,10 +672,7 @@ In this case you must start a new session by sending a request with an empty ses ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.entities.long_poll_entity_events( session_token="sessionToken", ) @@ -783,10 +768,7 @@ this provides real-time updates with minimal latency and reduced server load. ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() response = client.entities.stream_entities() for chunk in response.data: yield chunk @@ -878,10 +860,7 @@ through other Tasks API endpoints. ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.tasks.create_task() ``` @@ -1023,10 +1002,7 @@ perspective. ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.tasks.get_task( task_id="taskId", ) @@ -1104,10 +1080,7 @@ reaches these states, no further updates are allowed. ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.tasks.update_task_status( task_id="taskId", ) @@ -1218,10 +1191,7 @@ By default, this returns the latest task version for each matching task from the ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.tasks.query_tasks() ``` @@ -1320,10 +1290,7 @@ updates for task creation and status changes. Additionally, heartbeat messages a ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() response = client.tasks.stream_tasks() for chunk in response.data: yield chunk @@ -1440,10 +1407,7 @@ period you will be expected to reinitiate a new request. ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.tasks.listen_as_agent() ``` @@ -1527,10 +1491,7 @@ to provide progress information back to Tasks API. ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() response = client.tasks.stream_as_agent() for chunk in response.data: yield chunk @@ -1607,10 +1568,7 @@ Lists objects in your environment. You can define a prefix to list a subset of y ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() response = client.objects.list_objects() for item in response: yield item @@ -1664,6 +1622,14 @@ for page in response.iter_pages():
+**max_page_size:** `typing.Optional[int]` — Sets the maximum number of items that should be returned on a single page. + +
+
+ +
+
+ **request_options:** `typing.Optional[RequestOptions]` — Request-specific configuration.
@@ -1705,10 +1671,7 @@ Fetches an object from your environment using the objectPath path parameter. ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.objects.get_object( object_path="objectPath", ) @@ -1792,10 +1755,7 @@ Uploads an object. The object must be 1 GiB or smaller. ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.objects.upload_object() ``` @@ -1869,10 +1829,7 @@ Deletes an object from your environment given the objectPath path parameter. ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.objects.delete_object( object_path="objectPath", ) @@ -1940,10 +1897,7 @@ Returns metadata for a specified object path. Use this to fetch metadata such as ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.objects.get_object_metadata( object_path="objectPath", ) @@ -2012,10 +1966,7 @@ Gets a new short-lived token using the specified client credentials ```python from anduril import Lattice -client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", -) +client = Lattice() client.oauth.get_token() ``` diff --git a/src/anduril/client.py b/src/anduril/client.py index 3db7e78..c8de905 100644 --- a/src/anduril/client.py +++ b/src/anduril/client.py @@ -63,10 +63,7 @@ class Lattice: -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() # or ... @@ -244,10 +241,7 @@ class AsyncLattice: -------- from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() # or ... diff --git a/src/anduril/core/client_wrapper.py b/src/anduril/core/client_wrapper.py index 01a22f9..5cf25be 100644 --- a/src/anduril/core/client_wrapper.py +++ b/src/anduril/core/client_wrapper.py @@ -24,12 +24,12 @@ def get_headers(self) -> typing.Dict[str, str]: import platform headers: typing.Dict[str, str] = { - "User-Agent": "anduril-lattice-sdk/4.2.0", + "User-Agent": "anduril-lattice-sdk/4.3.0", "X-Fern-Language": "Python", "X-Fern-Runtime": f"python/{platform.python_version()}", "X-Fern-Platform": f"{platform.system().lower()}/{platform.release()}", "X-Fern-SDK-Name": "anduril-lattice-sdk", - "X-Fern-SDK-Version": "4.2.0", + "X-Fern-SDK-Version": "4.3.0", **(self.get_custom_headers() or {}), } token = self._get_token() diff --git a/src/anduril/core/http_response.py b/src/anduril/core/http_response.py index 2479747..00bb109 100644 --- a/src/anduril/core/http_response.py +++ b/src/anduril/core/http_response.py @@ -9,7 +9,7 @@ class BaseHttpResponse: - """Minimalist HTTP response wrapper that exposes response headers.""" + """Minimalist HTTP response wrapper that exposes response headers and status code.""" _response: httpx.Response @@ -20,6 +20,10 @@ def __init__(self, response: httpx.Response): def headers(self) -> Dict[str, str]: return dict(self._response.headers) + @property + def status_code(self) -> int: + return self._response.status_code + class HttpResponse(Generic[T], BaseHttpResponse): """HTTP response wrapper that exposes response headers and data.""" diff --git a/src/anduril/entities/client.py b/src/anduril/entities/client.py index acb9f92..027807e 100644 --- a/src/anduril/entities/client.py +++ b/src/anduril/entities/client.py @@ -259,10 +259,7 @@ def publish_entity( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.entities.publish_entity() """ _response = self._raw_client.publish_entity( @@ -327,10 +324,7 @@ def get_entity(self, entity_id: str, *, request_options: typing.Optional[Request -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.entities.get_entity( entity_id="entityId", ) @@ -383,10 +377,7 @@ def override_entity( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.entities.override_entity( entity_id="entityId", field_path="mil_view.disposition", @@ -423,10 +414,7 @@ def remove_entity_override( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.entities.remove_entity_override( entity_id="entityId", field_path="mil_view.disposition", @@ -473,10 +461,7 @@ def long_poll_entity_events( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.entities.long_poll_entity_events( session_token="sessionToken", ) @@ -538,10 +523,7 @@ def stream_entities( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() response = client.entities.stream_entities() for chunk in response: yield chunk @@ -770,10 +752,7 @@ async def publish_entity( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -846,10 +825,7 @@ async def get_entity(self, entity_id: str, *, request_options: typing.Optional[R from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -910,10 +886,7 @@ async def override_entity( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -958,10 +931,7 @@ async def remove_entity_override( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -1018,10 +988,7 @@ async def long_poll_entity_events( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -1091,10 +1058,7 @@ async def stream_entities( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: diff --git a/src/anduril/entities/raw_client.py b/src/anduril/entities/raw_client.py index 3e74acf..e563cf2 100644 --- a/src/anduril/entities/raw_client.py +++ b/src/anduril/entities/raw_client.py @@ -14,6 +14,7 @@ from ..core.pydantic_utilities import parse_obj_as, parse_sse_obj from ..core.request_options import RequestOptions from ..core.serialization import convert_and_respect_annotation_metadata +from ..entity.types.error import Error from ..errors.bad_request_error import BadRequestError from ..errors.not_found_error import NotFoundError from ..errors.request_timeout_error import RequestTimeoutError @@ -740,9 +741,9 @@ def long_poll_entity_events( raise RequestTimeoutError( headers=dict(_response.headers), body=typing.cast( - typing.Any, + Error, parse_obj_as( - type_=typing.Any, # type: ignore + type_=Error, # type: ignore object_=_response.json(), ), ), @@ -751,9 +752,9 @@ def long_poll_entity_events( raise TooManyRequestsError( headers=dict(_response.headers), body=typing.cast( - typing.Any, + Error, parse_obj_as( - type_=typing.Any, # type: ignore + type_=Error, # type: ignore object_=_response.json(), ), ), @@ -1571,9 +1572,9 @@ async def long_poll_entity_events( raise RequestTimeoutError( headers=dict(_response.headers), body=typing.cast( - typing.Any, + Error, parse_obj_as( - type_=typing.Any, # type: ignore + type_=Error, # type: ignore object_=_response.json(), ), ), @@ -1582,9 +1583,9 @@ async def long_poll_entity_events( raise TooManyRequestsError( headers=dict(_response.headers), body=typing.cast( - typing.Any, + Error, parse_obj_as( - type_=typing.Any, # type: ignore + type_=Error, # type: ignore object_=_response.json(), ), ), diff --git a/src/anduril/errors/content_too_large_error.py b/src/anduril/errors/content_too_large_error.py index 28d4f48..e3243b2 100644 --- a/src/anduril/errors/content_too_large_error.py +++ b/src/anduril/errors/content_too_large_error.py @@ -3,8 +3,9 @@ import typing from ..core.api_error import ApiError +from ..object.types.error import Error class ContentTooLargeError(ApiError): - def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): + def __init__(self, body: Error, headers: typing.Optional[typing.Dict[str, str]] = None): super().__init__(status_code=413, headers=headers, body=body) diff --git a/src/anduril/errors/insufficient_storage_error.py b/src/anduril/errors/insufficient_storage_error.py index f0dc628..5c258ac 100644 --- a/src/anduril/errors/insufficient_storage_error.py +++ b/src/anduril/errors/insufficient_storage_error.py @@ -3,8 +3,9 @@ import typing from ..core.api_error import ApiError +from ..object.types.error import Error class InsufficientStorageError(ApiError): - def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): + def __init__(self, body: Error, headers: typing.Optional[typing.Dict[str, str]] = None): super().__init__(status_code=507, headers=headers, body=body) diff --git a/src/anduril/errors/request_timeout_error.py b/src/anduril/errors/request_timeout_error.py index 8406576..33ebdc8 100644 --- a/src/anduril/errors/request_timeout_error.py +++ b/src/anduril/errors/request_timeout_error.py @@ -3,8 +3,9 @@ import typing from ..core.api_error import ApiError +from ..entity.types.error import Error class RequestTimeoutError(ApiError): - def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): + def __init__(self, body: Error, headers: typing.Optional[typing.Dict[str, str]] = None): super().__init__(status_code=408, headers=headers, body=body) diff --git a/src/anduril/errors/too_many_requests_error.py b/src/anduril/errors/too_many_requests_error.py index 705d6f1..80eba19 100644 --- a/src/anduril/errors/too_many_requests_error.py +++ b/src/anduril/errors/too_many_requests_error.py @@ -3,8 +3,9 @@ import typing from ..core.api_error import ApiError +from ..entity.types.error import Error class TooManyRequestsError(ApiError): - def __init__(self, body: typing.Any, headers: typing.Optional[typing.Dict[str, str]] = None): + def __init__(self, body: Error, headers: typing.Optional[typing.Dict[str, str]] = None): super().__init__(status_code=429, headers=headers, body=body) diff --git a/src/anduril/oauth/client.py b/src/anduril/oauth/client.py index a8a1554..93726c1 100644 --- a/src/anduril/oauth/client.py +++ b/src/anduril/oauth/client.py @@ -56,10 +56,7 @@ def get_token( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.oauth.get_token() """ _response = self._raw_client.get_token( @@ -115,10 +112,7 @@ async def get_token( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: diff --git a/src/anduril/objects/client.py b/src/anduril/objects/client.py index 2fd622c..474c06a 100644 --- a/src/anduril/objects/client.py +++ b/src/anduril/objects/client.py @@ -37,6 +37,7 @@ def list_objects( since_timestamp: typing.Optional[dt.datetime] = None, page_token: typing.Optional[str] = None, all_objects_in_mesh: typing.Optional[bool] = None, + max_page_size: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, ) -> SyncPager[PathMetadata, ListResponse]: """ @@ -56,6 +57,9 @@ def list_objects( all_objects_in_mesh : typing.Optional[bool] Lists objects across all environment nodes in a Lattice Mesh. + max_page_size : typing.Optional[int] + Sets the maximum number of items that should be returned on a single page. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -68,10 +72,7 @@ def list_objects( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() response = client.objects.list_objects() for item in response: yield item @@ -84,6 +85,7 @@ def list_objects( since_timestamp=since_timestamp, page_token=page_token, all_objects_in_mesh=all_objects_in_mesh, + max_page_size=max_page_size, request_options=request_options, ) @@ -121,10 +123,7 @@ def get_object( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.objects.get_object( object_path="objectPath", ) @@ -163,10 +162,7 @@ def upload_object( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.objects.upload_object() """ _response = self._raw_client.upload_object(object_path, request=request, request_options=request_options) @@ -192,10 +188,7 @@ def delete_object(self, object_path: str, *, request_options: typing.Optional[Re -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.objects.delete_object( object_path="objectPath", ) @@ -225,10 +218,7 @@ def get_object_metadata( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.objects.get_object_metadata( object_path="objectPath", ) @@ -259,6 +249,7 @@ async def list_objects( since_timestamp: typing.Optional[dt.datetime] = None, page_token: typing.Optional[str] = None, all_objects_in_mesh: typing.Optional[bool] = None, + max_page_size: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncPager[PathMetadata, ListResponse]: """ @@ -278,6 +269,9 @@ async def list_objects( all_objects_in_mesh : typing.Optional[bool] Lists objects across all environment nodes in a Lattice Mesh. + max_page_size : typing.Optional[int] + Sets the maximum number of items that should be returned on a single page. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -292,10 +286,7 @@ async def list_objects( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -315,6 +306,7 @@ async def main() -> None: since_timestamp=since_timestamp, page_token=page_token, all_objects_in_mesh=all_objects_in_mesh, + max_page_size=max_page_size, request_options=request_options, ) @@ -354,10 +346,7 @@ async def get_object( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -405,10 +394,7 @@ async def upload_object( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -442,10 +428,7 @@ async def delete_object(self, object_path: str, *, request_options: typing.Optio from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -483,10 +466,7 @@ async def get_object_metadata( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: diff --git a/src/anduril/objects/raw_client.py b/src/anduril/objects/raw_client.py index e8cdc1b..a265813 100644 --- a/src/anduril/objects/raw_client.py +++ b/src/anduril/objects/raw_client.py @@ -19,6 +19,7 @@ from ..errors.internal_server_error import InternalServerError from ..errors.not_found_error import NotFoundError from ..errors.unauthorized_error import UnauthorizedError +from ..object.types.error import Error from ..types.list_response import ListResponse from ..types.path_metadata import PathMetadata from .types.get_object_request_accept_encoding import GetObjectRequestAcceptEncoding @@ -38,6 +39,7 @@ def list_objects( since_timestamp: typing.Optional[dt.datetime] = None, page_token: typing.Optional[str] = None, all_objects_in_mesh: typing.Optional[bool] = None, + max_page_size: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, ) -> SyncPager[PathMetadata, ListResponse]: """ @@ -57,6 +59,9 @@ def list_objects( all_objects_in_mesh : typing.Optional[bool] Lists objects across all environment nodes in a Lattice Mesh. + max_page_size : typing.Optional[int] + Sets the maximum number of items that should be returned on a single page. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -73,6 +78,7 @@ def list_objects( "sinceTimestamp": serialize_datetime(since_timestamp) if since_timestamp is not None else None, "pageToken": page_token, "allObjectsInMesh": all_objects_in_mesh, + "maxPageSize": max_page_size, }, request_options=request_options, ) @@ -93,6 +99,7 @@ def list_objects( since_timestamp=since_timestamp, page_token=_parsed_next, all_objects_in_mesh=all_objects_in_mesh, + max_page_size=max_page_size, request_options=request_options, ) return SyncPager(has_next=_has_next, items=_items, get_next=_get_next, response=_parsed_response) @@ -307,9 +314,9 @@ def upload_object( raise ContentTooLargeError( headers=dict(_response.headers), body=typing.cast( - typing.Any, + Error, parse_obj_as( - type_=typing.Any, # type: ignore + type_=Error, # type: ignore object_=_response.json(), ), ), @@ -329,9 +336,9 @@ def upload_object( raise InsufficientStorageError( headers=dict(_response.headers), body=typing.cast( - typing.Any, + Error, parse_obj_as( - type_=typing.Any, # type: ignore + type_=Error, # type: ignore object_=_response.json(), ), ), @@ -492,6 +499,7 @@ async def list_objects( since_timestamp: typing.Optional[dt.datetime] = None, page_token: typing.Optional[str] = None, all_objects_in_mesh: typing.Optional[bool] = None, + max_page_size: typing.Optional[int] = None, request_options: typing.Optional[RequestOptions] = None, ) -> AsyncPager[PathMetadata, ListResponse]: """ @@ -511,6 +519,9 @@ async def list_objects( all_objects_in_mesh : typing.Optional[bool] Lists objects across all environment nodes in a Lattice Mesh. + max_page_size : typing.Optional[int] + Sets the maximum number of items that should be returned on a single page. + request_options : typing.Optional[RequestOptions] Request-specific configuration. @@ -527,6 +538,7 @@ async def list_objects( "sinceTimestamp": serialize_datetime(since_timestamp) if since_timestamp is not None else None, "pageToken": page_token, "allObjectsInMesh": all_objects_in_mesh, + "maxPageSize": max_page_size, }, request_options=request_options, ) @@ -549,6 +561,7 @@ async def _get_next(): since_timestamp=since_timestamp, page_token=_parsed_next, all_objects_in_mesh=all_objects_in_mesh, + max_page_size=max_page_size, request_options=request_options, ) @@ -765,9 +778,9 @@ async def upload_object( raise ContentTooLargeError( headers=dict(_response.headers), body=typing.cast( - typing.Any, + Error, parse_obj_as( - type_=typing.Any, # type: ignore + type_=Error, # type: ignore object_=_response.json(), ), ), @@ -787,9 +800,9 @@ async def upload_object( raise InsufficientStorageError( headers=dict(_response.headers), body=typing.cast( - typing.Any, + Error, parse_obj_as( - type_=typing.Any, # type: ignore + type_=Error, # type: ignore object_=_response.json(), ), ), diff --git a/src/anduril/tasks/client.py b/src/anduril/tasks/client.py index eaeac22..9c0a091 100644 --- a/src/anduril/tasks/client.py +++ b/src/anduril/tasks/client.py @@ -104,10 +104,7 @@ def create_task( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.tasks.create_task() """ _response = self._raw_client.create_task( @@ -151,10 +148,7 @@ def get_task(self, task_id: str, *, request_options: typing.Optional[RequestOpti -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.tasks.get_task( task_id="taskId", ) @@ -212,10 +206,7 @@ def update_task_status( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.tasks.update_task_status( task_id="taskId", ) @@ -282,10 +273,7 @@ def query_tasks( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.tasks.query_tasks() """ _response = self._raw_client.query_tasks( @@ -340,10 +328,7 @@ def stream_tasks( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() response = client.tasks.stream_tasks() for chunk in response: yield chunk @@ -402,10 +387,7 @@ def listen_as_agent( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() client.tasks.listen_as_agent() """ _response = self._raw_client.listen_as_agent(agent_selector=agent_selector, request_options=request_options) @@ -457,10 +439,7 @@ def stream_as_agent( -------- from anduril import Lattice - client = Lattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = Lattice() response = client.tasks.stream_as_agent() for chunk in response: yield chunk @@ -553,10 +532,7 @@ async def create_task( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -608,10 +584,7 @@ async def get_task(self, task_id: str, *, request_options: typing.Optional[Reque from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -677,10 +650,7 @@ async def update_task_status( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -755,10 +725,7 @@ async def query_tasks( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -821,10 +788,7 @@ async def stream_tasks( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -892,10 +856,7 @@ async def listen_as_agent( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: @@ -957,10 +918,7 @@ async def stream_as_agent( from anduril import AsyncLattice - client = AsyncLattice( - client_id="YOUR_CLIENT_ID", - client_secret="YOUR_CLIENT_SECRET", - ) + client = AsyncLattice() async def main() -> None: