From 5251e2418eaf5ac62d1c96a4d0927601cef04a4e Mon Sep 17 00:00:00 2001 From: Tomas Beran Date: Fri, 13 Feb 2026 16:36:04 -0800 Subject: [PATCH 1/5] feat: add GET /templates/{templateID}/tags to JS and Python SDKs Add support for listing all tags for a template, matching the existing infra API endpoint. Includes OpenAPI spec update, regenerated clients, SDK methods, types, and unit tests for both SDKs. --- packages/js-sdk/src/api/schema.gen.ts | 55 ++++++ packages/js-sdk/src/template/buildApi.ts | 29 +++ packages/js-sdk/src/template/index.ts | 28 +++ packages/js-sdk/src/template/types.ts | 18 ++ packages/js-sdk/tests/template/tags.test.ts | 39 ++++ packages/python-sdk/e2b/__init__.py | 2 + .../tags/get_templates_template_id_tags.py | 176 ++++++++++++++++++ .../e2b/api/client/models/__init__.py | 2 + .../e2b/api/client/models/template_tag.py | 80 ++++++++ packages/python-sdk/e2b/template/types.py | 17 ++ .../e2b/template_async/build_api.py | 36 ++++ .../python-sdk/e2b/template_async/main.py | 32 +++- .../python-sdk/e2b/template_sync/build_api.py | 36 ++++ packages/python-sdk/e2b/template_sync/main.py | 32 +++- .../tests/async/template_async/test_tags.py | 58 +++++- .../tests/sync/template_sync/test_tags.py | 56 +++++- spec/openapi.yml | 44 +++++ 17 files changed, 736 insertions(+), 4 deletions(-) create mode 100644 packages/python-sdk/e2b/api/client/api/tags/get_templates_template_id_tags.py create mode 100644 packages/python-sdk/e2b/api/client/models/template_tag.py diff --git a/packages/js-sdk/src/api/schema.gen.ts b/packages/js-sdk/src/api/schema.gen.ts index 70c98a1919..fdc43874af 100644 --- a/packages/js-sdk/src/api/schema.gen.ts +++ b/packages/js-sdk/src/api/schema.gen.ts @@ -1023,6 +1023,47 @@ export interface paths { patch?: never; trace?: never; }; + "/templates/{templateID}/tags": { + parameters: { + query?: never; + header?: never; + path?: never; + cookie?: never; + }; + /** @description List all tags for a template */ + get: { + parameters: { + query?: never; + header?: never; + path: { + templateID: components["parameters"]["templateID"]; + }; + cookie?: never; + }; + requestBody?: never; + responses: { + /** @description Successfully listed template tags */ + 200: { + headers: { + [name: string]: unknown; + }; + content: { + "application/json": components["schemas"]["TemplateTag"][]; + }; + }; + 401: components["responses"]["401"]; + 404: components["responses"]["404"]; + 500: components["responses"]["500"]; + }; + }; + put?: never; + post?: never; + delete?: never; + options?: never; + head?: never; + patch?: never; + trace?: never; + }; "/templates/aliases/{alias}": { parameters: { query?: never; @@ -2261,6 +2302,20 @@ export interface components { /** @description Type of the step */ type: string; }; + TemplateTag: { + /** + * Format: uuid + * @description Identifier of the build associated with this tag + */ + buildID: string; + /** + * Format: date-time + * @description When this tag was assigned + */ + createdAt: string; + /** @description Name of the tag */ + tag: string; + }; TemplateUpdateRequest: { /** @description Whether the template is public or only accessible by the team */ public?: boolean; diff --git a/packages/js-sdk/src/template/buildApi.ts b/packages/js-sdk/src/template/buildApi.ts index d56d953c67..3306c2f74f 100644 --- a/packages/js-sdk/src/template/buildApi.ts +++ b/packages/js-sdk/src/template/buildApi.ts @@ -7,6 +7,7 @@ import { BuildStatusReason, TemplateBuildStatus, TemplateBuildStatusResponse, + TemplateTag, TemplateTagInfo, } from './types' @@ -358,3 +359,31 @@ export async function removeTags( throw error } } + +export async function getTemplateTags( + client: ApiClient, + { templateID }: { templateID: string } +): Promise { + const res = await client.api.GET('/templates/{templateID}/tags', { + params: { + path: { + templateID, + }, + }, + }) + + const error = handleApiError(res, TemplateError) + if (error) { + throw error + } + + if (!res.data) { + throw new TemplateError('Failed to get template tags') + } + + return res.data.map((item) => ({ + tag: item.tag, + buildId: item.buildID, + createdAt: new Date(item.createdAt), + })) +} diff --git a/packages/js-sdk/src/template/index.ts b/packages/js-sdk/src/template/index.ts index 78d9035907..e7bc1e6742 100644 --- a/packages/js-sdk/src/template/index.ts +++ b/packages/js-sdk/src/template/index.ts @@ -6,6 +6,7 @@ import { runtime } from '../utils' import { assignTags, checkAliasExists, + getTemplateTags, removeTags, getBuildStatus, getFileUploadLink, @@ -34,6 +35,7 @@ import { TemplateFinal, TemplateFromImage, TemplateOptions, + TemplateTag, TemplateTagInfo, } from './types' import { @@ -371,6 +373,30 @@ export class TemplateBase return removeTags(client, { name, tags: normalizedTags }) } + /** + * Get all tags for a template. + * + * @param templateId Template ID or name + * @param options Authentication options + * @returns Array of tag details including tag name, buildId, and creation date + * + * @example + * ```ts + * const tags = await Template.getTags('my-template') + * for (const tag of tags) { + * console.log(`Tag: ${tag.tag}, Build: ${tag.buildId}, Created: ${tag.createdAt}`) + * } + * ``` + */ + static async getTags( + templateId: string, + options?: ConnectionOpts + ): Promise { + const config = new ConnectionConfig(options) + const client = new ApiClient(config) + return getTemplateTags(client, { templateID: templateId }) + } + fromDebianImage(variant: string = 'stable'): TemplateBuilder { return this.fromImage(`debian:${variant}`) } @@ -1265,6 +1291,7 @@ Template.exists = TemplateBase.exists Template.aliasExists = TemplateBase.aliasExists Template.assignTags = TemplateBase.assignTags Template.removeTags = TemplateBase.removeTags +Template.getTags = TemplateBase.getTags Template.toJSON = TemplateBase.toJSON Template.toDockerfile = TemplateBase.toDockerfile @@ -1279,5 +1306,6 @@ export type { TemplateBuildStatus, TemplateBuildStatusResponse, TemplateClass, + TemplateTag, TemplateTagInfo, } from './types' diff --git a/packages/js-sdk/src/template/types.ts b/packages/js-sdk/src/template/types.ts index 23999de7c0..4b032b6ba5 100644 --- a/packages/js-sdk/src/template/types.ts +++ b/packages/js-sdk/src/template/types.ts @@ -158,6 +158,24 @@ export type TemplateTagInfo = { tags: string[] } +/** + * Detailed information about a single template tag. + */ +export type TemplateTag = { + /** + * Name of the tag. + */ + tag: string + /** + * Build identifier associated with this tag. + */ + buildId: string + /** + * When this tag was assigned. + */ + createdAt: Date +} + /** * Types of instructions that can be used in a template. */ diff --git a/packages/js-sdk/tests/template/tags.test.ts b/packages/js-sdk/tests/template/tags.test.ts index 04767457b7..38b077b88a 100644 --- a/packages/js-sdk/tests/template/tags.test.ts +++ b/packages/js-sdk/tests/template/tags.test.ts @@ -18,6 +18,28 @@ const mockHandlers = [ tags: tags, }) }), + // Get template tags endpoint + http.get(apiUrl('/templates/:templateID/tags'), ({ params }) => { + const { templateID } = params + if (templateID === 'nonexistent') { + return HttpResponse.json( + { message: 'Template not found' }, + { status: 404 } + ) + } + return HttpResponse.json([ + { + tag: 'v1.0', + buildID: '00000000-0000-0000-0000-000000000000', + createdAt: '2024-01-15T10:30:00Z', + }, + { + tag: 'latest', + buildID: '11111111-1111-1111-1111-111111111111', + createdAt: '2024-01-16T12:00:00Z', + }, + ]) + }), // Bulk delete endpoint http.delete(apiUrl('/templates/tags'), async ({ request }) => { const { name } = (await request.clone().json()) as { @@ -81,6 +103,23 @@ describe('Template tags unit tests', () => { ).rejects.toThrow() }) }) + + describe('Template.getTags', () => { + test('returns tags for a template', async () => { + const tags = await Template.getTags('my-template-id') + expect(tags).toHaveLength(2) + expect(tags[0].tag).toBe('v1.0') + expect(tags[0].buildId).toBe('00000000-0000-0000-0000-000000000000') + expect(tags[0].createdAt).toBeInstanceOf(Date) + expect(tags[1].tag).toBe('latest') + expect(tags[1].buildId).toBe('11111111-1111-1111-1111-111111111111') + expect(tags[1].createdAt).toBeInstanceOf(Date) + }) + + test('handles 404 for nonexistent template', async () => { + await expect(Template.getTags('nonexistent')).rejects.toThrow() + }) + }) }) // Integration tests diff --git a/packages/python-sdk/e2b/__init__.py b/packages/python-sdk/e2b/__init__.py index c0a9316120..7bd56bb59e 100644 --- a/packages/python-sdk/e2b/__init__.py +++ b/packages/python-sdk/e2b/__init__.py @@ -103,6 +103,7 @@ CopyItem, TemplateBuildStatus, TemplateBuildStatusResponse, + TemplateTag, TemplateTagInfo, ) from .template_async.main import AsyncTemplate @@ -174,6 +175,7 @@ "BuildStatusReason", "TemplateBuildStatus", "TemplateBuildStatusResponse", + "TemplateTag", "TemplateTagInfo", "ReadyCmd", "wait_for_file", diff --git a/packages/python-sdk/e2b/api/client/api/tags/get_templates_template_id_tags.py b/packages/python-sdk/e2b/api/client/api/tags/get_templates_template_id_tags.py new file mode 100644 index 0000000000..b279f94428 --- /dev/null +++ b/packages/python-sdk/e2b/api/client/api/tags/get_templates_template_id_tags.py @@ -0,0 +1,176 @@ +from http import HTTPStatus +from typing import Any +from urllib.parse import quote + +import httpx + +from ... import errors +from ...client import AuthenticatedClient, Client +from ...models.error import Error +from ...models.template_tag import TemplateTag +from ...types import Response + + +def _get_kwargs( + template_id: str, +) -> dict[str, Any]: + + _kwargs: dict[str, Any] = { + "method": "get", + "url": "/templates/{template_id}/tags".format( + template_id=quote(str(template_id), safe=""), + ), + } + + return _kwargs + + +def _parse_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | list[TemplateTag] | None: + if response.status_code == 200: + response_200 = [] + _response_200 = response.json() + for response_200_item_data in _response_200: + response_200_item = TemplateTag.from_dict(response_200_item_data) + + response_200.append(response_200_item) + + return response_200 + + if response.status_code == 401: + response_401 = Error.from_dict(response.json()) + + return response_401 + + if response.status_code == 404: + response_404 = Error.from_dict(response.json()) + + return response_404 + + if response.status_code == 500: + response_500 = Error.from_dict(response.json()) + + return response_500 + + if client.raise_on_unexpected_status: + raise errors.UnexpectedStatus(response.status_code, response.content) + else: + return None + + +def _build_response( + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | list[TemplateTag]]: + return Response( + status_code=HTTPStatus(response.status_code), + content=response.content, + headers=response.headers, + parsed=_parse_response(client=client, response=response), + ) + + +def sync_detailed( + template_id: str, + *, + client: AuthenticatedClient, +) -> Response[Error | list[TemplateTag]]: + """List all tags for a template + + Args: + template_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Error | list[TemplateTag]] + """ + + kwargs = _get_kwargs( + template_id=template_id, + ) + + response = client.get_httpx_client().request( + **kwargs, + ) + + return _build_response(client=client, response=response) + + +def sync( + template_id: str, + *, + client: AuthenticatedClient, +) -> Error | list[TemplateTag] | None: + """List all tags for a template + + Args: + template_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Error | list[TemplateTag] + """ + + return sync_detailed( + template_id=template_id, + client=client, + ).parsed + + +async def asyncio_detailed( + template_id: str, + *, + client: AuthenticatedClient, +) -> Response[Error | list[TemplateTag]]: + """List all tags for a template + + Args: + template_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Response[Error | list[TemplateTag]] + """ + + kwargs = _get_kwargs( + template_id=template_id, + ) + + response = await client.get_async_httpx_client().request(**kwargs) + + return _build_response(client=client, response=response) + + +async def asyncio( + template_id: str, + *, + client: AuthenticatedClient, +) -> Error | list[TemplateTag] | None: + """List all tags for a template + + Args: + template_id (str): + + Raises: + errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. + httpx.TimeoutException: If the request takes longer than Client.timeout. + + Returns: + Error | list[TemplateTag] + """ + + return ( + await asyncio_detailed( + template_id=template_id, + client=client, + ) + ).parsed diff --git a/packages/python-sdk/e2b/api/client/models/__init__.py b/packages/python-sdk/e2b/api/client/models/__init__.py index 163e03f977..1aebac9a0a 100644 --- a/packages/python-sdk/e2b/api/client/models/__init__.py +++ b/packages/python-sdk/e2b/api/client/models/__init__.py @@ -66,6 +66,7 @@ from .template_legacy import TemplateLegacy from .template_request_response_v3 import TemplateRequestResponseV3 from .template_step import TemplateStep +from .template_tag import TemplateTag from .template_update_request import TemplateUpdateRequest from .template_update_response import TemplateUpdateResponse from .template_with_builds import TemplateWithBuilds @@ -136,6 +137,7 @@ "TemplateLegacy", "TemplateRequestResponseV3", "TemplateStep", + "TemplateTag", "TemplateUpdateRequest", "TemplateUpdateResponse", "TemplateWithBuilds", diff --git a/packages/python-sdk/e2b/api/client/models/template_tag.py b/packages/python-sdk/e2b/api/client/models/template_tag.py new file mode 100644 index 0000000000..a140786836 --- /dev/null +++ b/packages/python-sdk/e2b/api/client/models/template_tag.py @@ -0,0 +1,80 @@ +from __future__ import annotations + +import datetime +from collections.abc import Mapping +from typing import Any, TypeVar +from uuid import UUID + +from attrs import define as _attrs_define +from attrs import field as _attrs_field +from dateutil.parser import isoparse + +T = TypeVar("T", bound="TemplateTag") + + +@_attrs_define +class TemplateTag: + """ + Attributes: + build_id (UUID): Identifier of the build associated with this tag + created_at (datetime.datetime): When this tag was assigned + tag (str): Name of the tag + """ + + build_id: UUID + created_at: datetime.datetime + tag: str + additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) + + def to_dict(self) -> dict[str, Any]: + build_id = str(self.build_id) + + created_at = self.created_at.isoformat() + + tag = self.tag + + field_dict: dict[str, Any] = {} + field_dict.update(self.additional_properties) + field_dict.update( + { + "buildID": build_id, + "createdAt": created_at, + "tag": tag, + } + ) + + return field_dict + + @classmethod + def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: + d = dict(src_dict) + build_id = UUID(d.pop("buildID")) + + created_at = isoparse(d.pop("createdAt")) + + tag = d.pop("tag") + + template_tag = cls( + build_id=build_id, + created_at=created_at, + tag=tag, + ) + + template_tag.additional_properties = d + return template_tag + + @property + def additional_keys(self) -> list[str]: + return list(self.additional_properties.keys()) + + def __getitem__(self, key: str) -> Any: + return self.additional_properties[key] + + def __setitem__(self, key: str, value: Any) -> None: + self.additional_properties[key] = value + + def __delitem__(self, key: str) -> None: + del self.additional_properties[key] + + def __contains__(self, key: str) -> bool: + return key in self.additional_properties diff --git a/packages/python-sdk/e2b/template/types.py b/packages/python-sdk/e2b/template/types.py index b1ed5c6d18..05b6307d42 100644 --- a/packages/python-sdk/e2b/template/types.py +++ b/packages/python-sdk/e2b/template/types.py @@ -1,4 +1,5 @@ from dataclasses import dataclass, field +from datetime import datetime from enum import Enum from pathlib import Path from typing import List, Literal, Optional, TypedDict, Union @@ -73,6 +74,22 @@ class TemplateTagInfo: """Assigned tags of the template.""" +@dataclass +class TemplateTag: + """ + Detailed information about a single template tag. + """ + + tag: str + """Name of the tag.""" + + build_id: str + """Build identifier associated with this tag.""" + + created_at: datetime + """When this tag was assigned.""" + + class InstructionType(str, Enum): """ Types of instructions that can be used in a template. diff --git a/packages/python-sdk/e2b/template_async/build_api.py b/packages/python-sdk/e2b/template_async/build_api.py index b45937a84a..7da04b1d89 100644 --- a/packages/python-sdk/e2b/template_async/build_api.py +++ b/packages/python-sdk/e2b/template_async/build_api.py @@ -15,6 +15,7 @@ from e2b.api.client.api.tags import ( post_templates_tags, delete_templates_tags, + get_templates_template_id_tags, ) from e2b.api.client.client import AuthenticatedClient from e2b.api.client.models import ( @@ -33,6 +34,7 @@ BuildStatusReason, TemplateBuildStatus, TemplateBuildStatusResponse, + TemplateTag, TemplateTagInfo, ) from e2b.template.utils import get_build_step_index, tar_file_stream @@ -336,3 +338,37 @@ async def remove_tags(client: AuthenticatedClient, name: str, tags: List[str]) - if res.status_code >= 300: raise handle_api_exception(res, TemplateException) + + +async def get_template_tags( + client: AuthenticatedClient, template_id: str +) -> List[TemplateTag]: + """ + Get all tags for a template. + + Args: + client: Authenticated API client + template_id: Template ID or name + """ + res = await get_templates_template_id_tags.asyncio_detailed( + template_id=template_id, + client=client, + ) + + if res.status_code >= 300: + raise handle_api_exception(res, TemplateException) + + if isinstance(res.parsed, Error): + raise TemplateException(f"API error: {res.parsed.message}") + + if res.parsed is None: + raise TemplateException("Failed to get template tags") + + return [ + TemplateTag( + tag=item.tag, + build_id=str(item.build_id), + created_at=item.created_at, + ) + for item in res.parsed + ] diff --git a/packages/python-sdk/e2b/template_async/main.py b/packages/python-sdk/e2b/template_async/main.py index a459af2cc9..b894ffb1fd 100644 --- a/packages/python-sdk/e2b/template_async/main.py +++ b/packages/python-sdk/e2b/template_async/main.py @@ -8,12 +8,13 @@ from e2b.template.consts import RESOLVE_SYMLINKS from e2b.template.logger import LogEntry, LogEntryEnd, LogEntryStart from e2b.template.main import TemplateBase, TemplateClass -from e2b.template.types import BuildInfo, InstructionType, TemplateTagInfo +from e2b.template.types import BuildInfo, InstructionType, TemplateTag, TemplateTagInfo from e2b.template.utils import normalize_build_arguments, read_dockerignore from .build_api import ( assign_tags, check_alias_exists, + get_template_tags, remove_tags, get_build_status, get_file_upload_link, @@ -496,3 +497,32 @@ async def remove_tags( normalized_tags = [tags] if isinstance(tags, str) else tags await remove_tags(api_client, name, normalized_tags) + + @staticmethod + async def get_tags( + template_id: str, + **opts: Unpack[ApiParams], + ) -> List[TemplateTag]: + """ + Get all tags for a template. + + :param template_id: Template ID or name + :return: List of TemplateTag with tag name, build_id, and created_at + + Example + ```python + from e2b import AsyncTemplate + + tags = await AsyncTemplate.get_tags('my-template') + for tag in tags: + print(f"Tag: {tag.tag}, Build: {tag.build_id}, Created: {tag.created_at}") + ``` + """ + config = ConnectionConfig(**opts) + api_client = get_api_client( + config, + require_api_key=True, + require_access_token=False, + ) + + return await get_template_tags(api_client, template_id) diff --git a/packages/python-sdk/e2b/template_sync/build_api.py b/packages/python-sdk/e2b/template_sync/build_api.py index 87e10e95d2..22f0be9033 100644 --- a/packages/python-sdk/e2b/template_sync/build_api.py +++ b/packages/python-sdk/e2b/template_sync/build_api.py @@ -15,6 +15,7 @@ from e2b.api.client.api.tags import ( post_templates_tags, delete_templates_tags, + get_templates_template_id_tags, ) from e2b.api.client.client import AuthenticatedClient from e2b.api.client.models import ( @@ -33,6 +34,7 @@ BuildStatusReason, TemplateBuildStatus, TemplateBuildStatusResponse, + TemplateTag, TemplateTagInfo, ) from e2b.template.utils import get_build_step_index, tar_file_stream @@ -333,3 +335,37 @@ def remove_tags(client: AuthenticatedClient, name: str, tags: List[str]) -> None if res.status_code >= 300: raise handle_api_exception(res, TemplateException) + + +def get_template_tags( + client: AuthenticatedClient, template_id: str +) -> List[TemplateTag]: + """ + Get all tags for a template. + + Args: + client: Authenticated API client + template_id: Template ID or name + """ + res = get_templates_template_id_tags.sync_detailed( + template_id=template_id, + client=client, + ) + + if res.status_code >= 300: + raise handle_api_exception(res, TemplateException) + + if isinstance(res.parsed, Error): + raise TemplateException(f"API error: {res.parsed.message}") + + if res.parsed is None: + raise TemplateException("Failed to get template tags") + + return [ + TemplateTag( + tag=item.tag, + build_id=str(item.build_id), + created_at=item.created_at, + ) + for item in res.parsed + ] diff --git a/packages/python-sdk/e2b/template_sync/main.py b/packages/python-sdk/e2b/template_sync/main.py index 1278e4d0c6..0758821789 100644 --- a/packages/python-sdk/e2b/template_sync/main.py +++ b/packages/python-sdk/e2b/template_sync/main.py @@ -10,10 +10,11 @@ from e2b.template.consts import RESOLVE_SYMLINKS from e2b.template.logger import LogEntry, LogEntryEnd, LogEntryStart from e2b.template.main import TemplateBase, TemplateClass -from e2b.template.types import BuildInfo, InstructionType, TemplateTagInfo +from e2b.template.types import BuildInfo, InstructionType, TemplateTag, TemplateTagInfo from e2b.template_sync.build_api import ( assign_tags, check_alias_exists, + get_template_tags, remove_tags, get_build_status, get_file_upload_link, @@ -497,3 +498,32 @@ def remove_tags( normalized_tags = [tags] if isinstance(tags, str) else tags remove_tags(api_client, name, normalized_tags) + + @staticmethod + def get_tags( + template_id: str, + **opts: Unpack[ApiParams], + ) -> List[TemplateTag]: + """ + Get all tags for a template. + + :param template_id: Template ID or name + :return: List of TemplateTag with tag name, build_id, and created_at + + Example + ```python + from e2b import Template + + tags = Template.get_tags('my-template') + for tag in tags: + print(f"Tag: {tag.tag}, Build: {tag.build_id}, Created: {tag.created_at}") + ``` + """ + config = ConnectionConfig(**opts) + api_client = get_api_client( + config, + require_api_key=True, + require_access_token=False, + ) + + return get_template_tags(api_client, template_id) diff --git a/packages/python-sdk/tests/async/template_async/test_tags.py b/packages/python-sdk/tests/async/template_async/test_tags.py index c25ce42819..d5cf211375 100644 --- a/packages/python-sdk/tests/async/template_async/test_tags.py +++ b/packages/python-sdk/tests/async/template_async/test_tags.py @@ -1,9 +1,10 @@ import uuid +from datetime import datetime, timezone from unittest.mock import AsyncMock import pytest -from e2b import AsyncTemplate, TemplateTagInfo, Template +from e2b import AsyncTemplate, TemplateTag, TemplateTagInfo, Template from e2b.exceptions import TemplateException import e2b.template_async.main as template_async_main @@ -115,6 +116,61 @@ async def test_remove_tags_error(self, monkeypatch): await AsyncTemplate.remove_tags("nonexistent", ["tag"]) +class TestGetTags: + """Tests for AsyncTemplate.get_tags method.""" + + @pytest.mark.asyncio + async def test_get_tags(self, monkeypatch): + """Test getting tags for a template.""" + mock_get_template_tags = AsyncMock( + return_value=[ + TemplateTag( + tag="v1.0", + build_id="00000000-0000-0000-0000-000000000000", + created_at=datetime(2024, 1, 15, 10, 30, 0, tzinfo=timezone.utc), + ), + TemplateTag( + tag="latest", + build_id="11111111-1111-1111-1111-111111111111", + created_at=datetime(2024, 1, 16, 12, 0, 0, tzinfo=timezone.utc), + ), + ] + ) + + monkeypatch.setattr( + template_async_main, "get_api_client", lambda *args, **kwargs: None + ) + monkeypatch.setattr( + template_async_main, "get_template_tags", mock_get_template_tags + ) + + result = await AsyncTemplate.get_tags("my-template") + + assert len(result) == 2 + assert result[0].tag == "v1.0" + assert result[0].build_id == "00000000-0000-0000-0000-000000000000" + assert isinstance(result[0].created_at, datetime) + assert result[1].tag == "latest" + mock_get_template_tags.assert_called_once() + + @pytest.mark.asyncio + async def test_get_tags_error(self, monkeypatch): + """Test that get_tags raises an error for nonexistent template.""" + mock_get_template_tags = AsyncMock( + side_effect=TemplateException("Template not found") + ) + + monkeypatch.setattr( + template_async_main, "get_api_client", lambda *args, **kwargs: None + ) + monkeypatch.setattr( + template_async_main, "get_template_tags", mock_get_template_tags + ) + + with pytest.raises(TemplateException): + await AsyncTemplate.get_tags("nonexistent") + + # Integration tests class TestTagsIntegration: """Integration tests for AsyncTemplate tags functionality.""" diff --git a/packages/python-sdk/tests/sync/template_sync/test_tags.py b/packages/python-sdk/tests/sync/template_sync/test_tags.py index d2648894ab..f586e9b8c6 100644 --- a/packages/python-sdk/tests/sync/template_sync/test_tags.py +++ b/packages/python-sdk/tests/sync/template_sync/test_tags.py @@ -1,9 +1,10 @@ import uuid +from datetime import datetime, timezone from unittest.mock import Mock import pytest -from e2b import TemplateTagInfo, Template +from e2b import TemplateTag, TemplateTagInfo, Template from e2b.exceptions import TemplateException import e2b.template_sync.main as template_sync_main @@ -106,6 +107,59 @@ def test_remove_tags_error(self, monkeypatch): Template.remove_tags("nonexistent", ["tag"]) +class TestGetTags: + """Tests for Template.get_tags method.""" + + def test_get_tags(self, monkeypatch): + """Test getting tags for a template.""" + mock_get_template_tags = Mock( + return_value=[ + TemplateTag( + tag="v1.0", + build_id="00000000-0000-0000-0000-000000000000", + created_at=datetime(2024, 1, 15, 10, 30, 0, tzinfo=timezone.utc), + ), + TemplateTag( + tag="latest", + build_id="11111111-1111-1111-1111-111111111111", + created_at=datetime(2024, 1, 16, 12, 0, 0, tzinfo=timezone.utc), + ), + ] + ) + + monkeypatch.setattr( + template_sync_main, "get_api_client", lambda *args, **kwargs: None + ) + monkeypatch.setattr( + template_sync_main, "get_template_tags", mock_get_template_tags + ) + + result = Template.get_tags("my-template") + + assert len(result) == 2 + assert result[0].tag == "v1.0" + assert result[0].build_id == "00000000-0000-0000-0000-000000000000" + assert isinstance(result[0].created_at, datetime) + assert result[1].tag == "latest" + mock_get_template_tags.assert_called_once() + + def test_get_tags_error(self, monkeypatch): + """Test that get_tags raises an error for nonexistent template.""" + mock_get_template_tags = Mock( + side_effect=TemplateException("Template not found") + ) + + monkeypatch.setattr( + template_sync_main, "get_api_client", lambda *args, **kwargs: None + ) + monkeypatch.setattr( + template_sync_main, "get_template_tags", mock_get_template_tags + ) + + with pytest.raises(TemplateException): + Template.get_tags("nonexistent") + + # Integration tests class TestTagsIntegration: """Integration tests for Template tags functionality.""" diff --git a/spec/openapi.yml b/spec/openapi.yml index dab7c95535..223179a599 100644 --- a/spec/openapi.yml +++ b/spec/openapi.yml @@ -1577,6 +1577,24 @@ components: items: type: string + TemplateTag: + required: + - tag + - buildID + - createdAt + properties: + tag: + type: string + description: Name of the tag + buildID: + type: string + format: uuid + description: Identifier of the build associated with this tag + createdAt: + type: string + format: date-time + description: When this tag was assigned + Error: required: - code @@ -2635,6 +2653,32 @@ paths: "500": $ref: "#/components/responses/500" + /templates/{templateID}/tags: + get: + description: List all tags for a template + tags: [tags] + security: + - ApiKeyAuth: [] + - Supabase1TokenAuth: [] + Supabase2TeamAuth: [] + parameters: + - $ref: "#/components/parameters/templateID" + responses: + "200": + description: Successfully listed template tags + content: + application/json: + schema: + type: array + items: + $ref: "#/components/schemas/TemplateTag" + "401": + $ref: "#/components/responses/401" + "404": + $ref: "#/components/responses/404" + "500": + $ref: "#/components/responses/500" + /templates/aliases/{alias}: get: description: Check if template with given alias exists From d37f05f1c8516e49b57aa5af06bcd35d309b5b33 Mon Sep 17 00:00:00 2001 From: Tomas Beran Date: Fri, 13 Feb 2026 16:39:06 -0800 Subject: [PATCH 2/5] chore: add changeset for get template tags --- .changeset/get-template-tags.md | 6 ++++++ 1 file changed, 6 insertions(+) create mode 100644 .changeset/get-template-tags.md diff --git a/.changeset/get-template-tags.md b/.changeset/get-template-tags.md new file mode 100644 index 0000000000..cec61f7812 --- /dev/null +++ b/.changeset/get-template-tags.md @@ -0,0 +1,6 @@ +--- +'e2b': patch +'@e2b/python-sdk': patch +--- + +Add `getTags`/`get_tags` method to list all tags for a template From baa613f90ea31828e26d200371963463ef0a99ee Mon Sep 17 00:00:00 2001 From: Tomas Beran Date: Fri, 13 Feb 2026 16:40:22 -0800 Subject: [PATCH 3/5] chore: regenerate Python API client --- .../sandboxes/delete_sandboxes_sandbox_id.py | 36 +++-- .../api/client/api/sandboxes/get_sandboxes.py | 49 ++++--- .../api/sandboxes/get_sandboxes_metrics.py | 33 +++-- .../api/sandboxes/get_sandboxes_sandbox_id.py | 36 +++-- .../get_sandboxes_sandbox_id_logs.py | 72 +++++----- .../get_sandboxes_sandbox_id_metrics.py | 81 ++++++----- .../client/api/sandboxes/get_v2_sandboxes.py | 108 +++++++------- .../client/api/sandboxes/post_sandboxes.py | 30 ++-- .../post_sandboxes_sandbox_id_connect.py | 37 +++-- .../post_sandboxes_sandbox_id_pause.py | 37 +++-- .../post_sandboxes_sandbox_id_refreshes.py | 57 ++++---- .../post_sandboxes_sandbox_id_resume.py | 36 +++-- .../post_sandboxes_sandbox_id_timeout.py | 58 ++++---- .../client/api/tags/delete_templates_tags.py | 31 ++-- .../client/api/tags/post_templates_tags.py | 31 ++-- .../templates/delete_templates_template_id.py | 35 +++-- .../api/client/api/templates/get_templates.py | 48 ++++--- .../templates/get_templates_aliases_alias.py | 37 +++-- .../templates/get_templates_template_id.py | 71 +++++----- ...plates_template_id_builds_build_id_logs.py | 133 ++++++++++-------- ...ates_template_id_builds_build_id_status.py | 93 ++++++------ .../get_templates_template_id_files_hash.py | 38 +++-- .../templates/patch_templates_template_id.py | 35 +++-- .../patch_v_2_templates_template_id.py | 35 +++-- .../client/api/templates/post_templates.py | 30 ++-- .../templates/post_templates_template_id.py | 34 +++-- ...t_templates_template_id_builds_build_id.py | 36 +++-- .../client/api/templates/post_v2_templates.py | 30 ++-- .../client/api/templates/post_v3_templates.py | 30 ++-- ...2_templates_template_id_builds_build_id.py | 35 +++-- packages/python-sdk/e2b/api/client/client.py | 30 ++-- .../models/admin_sandbox_kill_result.py | 2 + .../models/assign_template_tags_request.py | 2 + .../client/models/assigned_template_tags.py | 2 + .../e2b/api/client/models/aws_registry.py | 2 + .../e2b/api/client/models/build_log_entry.py | 8 +- .../api/client/models/build_status_reason.py | 24 ++-- .../e2b/api/client/models/connect_sandbox.py | 2 + .../api/client/models/created_access_token.py | 4 +- .../api/client/models/created_team_api_key.py | 30 ++-- .../models/delete_template_tags_request.py | 2 + .../e2b/api/client/models/disk_metrics.py | 2 + .../python-sdk/e2b/api/client/models/error.py | 2 + .../e2b/api/client/models/gcp_registry.py | 2 + .../e2b/api/client/models/general_registry.py | 2 + .../models/identifier_masking_details.py | 2 + .../e2b/api/client/models/listed_sandbox.py | 12 +- .../e2b/api/client/models/machine_info.py | 2 + .../e2b/api/client/models/max_team_metric.py | 2 + .../e2b/api/client/models/mcp_type_0.py | 3 + .../e2b/api/client/models/new_access_token.py | 2 + .../e2b/api/client/models/new_sandbox.py | 50 +++---- .../e2b/api/client/models/new_team_api_key.py | 2 + .../python-sdk/e2b/api/client/models/node.py | 6 +- .../e2b/api/client/models/node_detail.py | 10 +- .../e2b/api/client/models/node_metrics.py | 6 +- .../api/client/models/node_status_change.py | 12 +- ...ost_sandboxes_sandbox_id_refreshes_body.py | 8 +- .../post_sandboxes_sandbox_id_timeout_body.py | 2 + .../e2b/api/client/models/resumed_sandbox.py | 12 +- .../e2b/api/client/models/sandbox.py | 32 +++-- .../e2b/api/client/models/sandbox_detail.py | 26 ++-- .../e2b/api/client/models/sandbox_log.py | 2 + .../api/client/models/sandbox_log_entry.py | 4 +- .../client/models/sandbox_log_entry_fields.py | 3 + .../e2b/api/client/models/sandbox_logs.py | 10 +- .../e2b/api/client/models/sandbox_metric.py | 2 + .../client/models/sandbox_network_config.py | 28 ++-- .../client/models/sandboxes_with_metrics.py | 2 + .../python-sdk/e2b/api/client/models/team.py | 2 + .../e2b/api/client/models/team_api_key.py | 30 ++-- .../e2b/api/client/models/team_metric.py | 2 + .../e2b/api/client/models/team_user.py | 2 + .../e2b/api/client/models/template.py | 28 ++-- .../client/models/template_alias_response.py | 2 + .../e2b/api/client/models/template_build.py | 20 +-- .../models/template_build_file_upload.py | 8 +- .../api/client/models/template_build_info.py | 16 ++- .../models/template_build_logs_response.py | 6 +- .../client/models/template_build_request.py | 28 ++-- .../models/template_build_request_v2.py | 16 ++- .../models/template_build_request_v3.py | 32 +++-- .../client/models/template_build_start_v2.py | 55 ++++---- .../e2b/api/client/models/template_legacy.py | 28 ++-- .../models/template_request_response_v3.py | 2 + .../e2b/api/client/models/template_step.py | 18 +-- .../client/models/template_update_request.py | 8 +- .../client/models/template_update_response.py | 2 + .../api/client/models/template_with_builds.py | 20 +-- .../api/client/models/update_team_api_key.py | 2 + packages/python-sdk/e2b/api/client/types.py | 18 +-- .../async/template_async/test_stacktrace.py | 14 +- .../sync/template_sync/test_stacktrace.py | 8 +- 93 files changed, 1250 insertions(+), 925 deletions(-) diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py b/packages/python-sdk/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py index 77288c4ca0..dd51492c6b 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -12,32 +13,39 @@ def _get_kwargs( sandbox_id: str, ) -> dict[str, Any]: + _kwargs: dict[str, Any] = { "method": "delete", - "url": f"/sandboxes/{sandbox_id}", + "url": "/sandboxes/{sandbox_id}".format( + sandbox_id=quote(str(sandbox_id), safe=""), + ), } return _kwargs def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 204: response_204 = cast(Any, None) return response_204 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -45,8 +53,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -59,7 +67,7 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Kill a sandbox Args: @@ -70,7 +78,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -88,7 +96,7 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Kill a sandbox Args: @@ -99,7 +107,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -112,7 +120,7 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Kill a sandbox Args: @@ -123,7 +131,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -139,7 +147,7 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Kill a sandbox Args: @@ -150,7 +158,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes.py index 19829e5ca6..0d3a75bfe2 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -12,8 +12,9 @@ def _get_kwargs( *, - metadata: Union[Unset, str] = UNSET, + metadata: str | Unset = UNSET, ) -> dict[str, Any]: + params: dict[str, Any] = {} params["metadata"] = metadata @@ -30,8 +31,8 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, list["ListedSandbox"]]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | list[ListedSandbox] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -41,18 +42,22 @@ def _parse_response( response_200.append(response_200_item) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -60,8 +65,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, list["ListedSandbox"]]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | list[ListedSandbox]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -73,19 +78,19 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient, - metadata: Union[Unset, str] = UNSET, -) -> Response[Union[Error, list["ListedSandbox"]]]: + metadata: str | Unset = UNSET, +) -> Response[Error | list[ListedSandbox]]: """List all running sandboxes Args: - metadata (Union[Unset, str]): + metadata (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, list['ListedSandbox']]] + Response[Error | list[ListedSandbox]] """ kwargs = _get_kwargs( @@ -102,19 +107,19 @@ def sync_detailed( def sync( *, client: AuthenticatedClient, - metadata: Union[Unset, str] = UNSET, -) -> Optional[Union[Error, list["ListedSandbox"]]]: + metadata: str | Unset = UNSET, +) -> Error | list[ListedSandbox] | None: """List all running sandboxes Args: - metadata (Union[Unset, str]): + metadata (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, list['ListedSandbox']] + Error | list[ListedSandbox] """ return sync_detailed( @@ -126,19 +131,19 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient, - metadata: Union[Unset, str] = UNSET, -) -> Response[Union[Error, list["ListedSandbox"]]]: + metadata: str | Unset = UNSET, +) -> Response[Error | list[ListedSandbox]]: """List all running sandboxes Args: - metadata (Union[Unset, str]): + metadata (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, list['ListedSandbox']]] + Response[Error | list[ListedSandbox]] """ kwargs = _get_kwargs( @@ -153,19 +158,19 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient, - metadata: Union[Unset, str] = UNSET, -) -> Optional[Union[Error, list["ListedSandbox"]]]: + metadata: str | Unset = UNSET, +) -> Error | list[ListedSandbox] | None: """List all running sandboxes Args: - metadata (Union[Unset, str]): + metadata (str | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, list['ListedSandbox']] + Error | list[ListedSandbox] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py index d05b6f900b..3f266f1ce9 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -14,11 +14,12 @@ def _get_kwargs( *, sandbox_ids: list[str], ) -> dict[str, Any]: + params: dict[str, Any] = {} json_sandbox_ids = sandbox_ids - params["sandbox_ids"] = ",".join(str(item) for item in json_sandbox_ids) + params["sandbox_ids"] = json_sandbox_ids params = {k: v for k, v in params.items() if v is not UNSET and v is not None} @@ -32,24 +33,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, SandboxesWithMetrics]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | SandboxesWithMetrics | None: if response.status_code == 200: response_200 = SandboxesWithMetrics.from_dict(response.json()) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -57,8 +62,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, SandboxesWithMetrics]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | SandboxesWithMetrics]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -71,7 +76,7 @@ def sync_detailed( *, client: AuthenticatedClient, sandbox_ids: list[str], -) -> Response[Union[Error, SandboxesWithMetrics]]: +) -> Response[Error | SandboxesWithMetrics]: """List metrics for given sandboxes Args: @@ -82,7 +87,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, SandboxesWithMetrics]] + Response[Error | SandboxesWithMetrics] """ kwargs = _get_kwargs( @@ -100,7 +105,7 @@ def sync( *, client: AuthenticatedClient, sandbox_ids: list[str], -) -> Optional[Union[Error, SandboxesWithMetrics]]: +) -> Error | SandboxesWithMetrics | None: """List metrics for given sandboxes Args: @@ -111,7 +116,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, SandboxesWithMetrics] + Error | SandboxesWithMetrics """ return sync_detailed( @@ -124,7 +129,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, sandbox_ids: list[str], -) -> Response[Union[Error, SandboxesWithMetrics]]: +) -> Response[Error | SandboxesWithMetrics]: """List metrics for given sandboxes Args: @@ -135,7 +140,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, SandboxesWithMetrics]] + Response[Error | SandboxesWithMetrics] """ kwargs = _get_kwargs( @@ -151,7 +156,7 @@ async def asyncio( *, client: AuthenticatedClient, sandbox_ids: list[str], -) -> Optional[Union[Error, SandboxesWithMetrics]]: +) -> Error | SandboxesWithMetrics | None: """List metrics for given sandboxes Args: @@ -162,7 +167,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, SandboxesWithMetrics] + Error | SandboxesWithMetrics """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id.py index 74f0b27f83..210b268bb0 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -13,33 +14,40 @@ def _get_kwargs( sandbox_id: str, ) -> dict[str, Any]: + _kwargs: dict[str, Any] = { "method": "get", - "url": f"/sandboxes/{sandbox_id}", + "url": "/sandboxes/{sandbox_id}".format( + sandbox_id=quote(str(sandbox_id), safe=""), + ), } return _kwargs def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, SandboxDetail]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | SandboxDetail | None: if response.status_code == 200: response_200 = SandboxDetail.from_dict(response.json()) return response_200 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -47,8 +55,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, SandboxDetail]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | SandboxDetail]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -61,7 +69,7 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, SandboxDetail]]: +) -> Response[Error | SandboxDetail]: """Get a sandbox by id Args: @@ -72,7 +80,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, SandboxDetail]] + Response[Error | SandboxDetail] """ kwargs = _get_kwargs( @@ -90,7 +98,7 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, SandboxDetail]]: +) -> Error | SandboxDetail | None: """Get a sandbox by id Args: @@ -101,7 +109,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, SandboxDetail] + Error | SandboxDetail """ return sync_detailed( @@ -114,7 +122,7 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, SandboxDetail]]: +) -> Response[Error | SandboxDetail]: """Get a sandbox by id Args: @@ -125,7 +133,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, SandboxDetail]] + Response[Error | SandboxDetail] """ kwargs = _get_kwargs( @@ -141,7 +149,7 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, SandboxDetail]]: +) -> Error | SandboxDetail | None: """Get a sandbox by id Args: @@ -152,7 +160,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, SandboxDetail] + Error | SandboxDetail """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py index a72765c53b..9711275396 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -13,9 +14,10 @@ def _get_kwargs( sandbox_id: str, *, - start: Union[Unset, int] = UNSET, - limit: Union[Unset, int] = 1000, + start: int | Unset = UNSET, + limit: int | Unset = 1000, ) -> dict[str, Any]: + params: dict[str, Any] = {} params["start"] = start @@ -26,7 +28,9 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": f"/sandboxes/{sandbox_id}/logs", + "url": "/sandboxes/{sandbox_id}/logs".format( + sandbox_id=quote(str(sandbox_id), safe=""), + ), "params": params, } @@ -34,24 +38,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, SandboxLogs]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | SandboxLogs | None: if response.status_code == 200: response_200 = SandboxLogs.from_dict(response.json()) return response_200 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -59,8 +67,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, SandboxLogs]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | SandboxLogs]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -73,22 +81,22 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, - start: Union[Unset, int] = UNSET, - limit: Union[Unset, int] = 1000, -) -> Response[Union[Error, SandboxLogs]]: + start: int | Unset = UNSET, + limit: int | Unset = 1000, +) -> Response[Error | SandboxLogs]: """Get sandbox logs Args: sandbox_id (str): - start (Union[Unset, int]): - limit (Union[Unset, int]): Default: 1000. + start (int | Unset): + limit (int | Unset): Default: 1000. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, SandboxLogs]] + Response[Error | SandboxLogs] """ kwargs = _get_kwargs( @@ -108,22 +116,22 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, - start: Union[Unset, int] = UNSET, - limit: Union[Unset, int] = 1000, -) -> Optional[Union[Error, SandboxLogs]]: + start: int | Unset = UNSET, + limit: int | Unset = 1000, +) -> Error | SandboxLogs | None: """Get sandbox logs Args: sandbox_id (str): - start (Union[Unset, int]): - limit (Union[Unset, int]): Default: 1000. + start (int | Unset): + limit (int | Unset): Default: 1000. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, SandboxLogs] + Error | SandboxLogs """ return sync_detailed( @@ -138,22 +146,22 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, - start: Union[Unset, int] = UNSET, - limit: Union[Unset, int] = 1000, -) -> Response[Union[Error, SandboxLogs]]: + start: int | Unset = UNSET, + limit: int | Unset = 1000, +) -> Response[Error | SandboxLogs]: """Get sandbox logs Args: sandbox_id (str): - start (Union[Unset, int]): - limit (Union[Unset, int]): Default: 1000. + start (int | Unset): + limit (int | Unset): Default: 1000. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, SandboxLogs]] + Response[Error | SandboxLogs] """ kwargs = _get_kwargs( @@ -171,22 +179,22 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, - start: Union[Unset, int] = UNSET, - limit: Union[Unset, int] = 1000, -) -> Optional[Union[Error, SandboxLogs]]: + start: int | Unset = UNSET, + limit: int | Unset = 1000, +) -> Error | SandboxLogs | None: """Get sandbox logs Args: sandbox_id (str): - start (Union[Unset, int]): - limit (Union[Unset, int]): Default: 1000. + start (int | Unset): + limit (int | Unset): Default: 1000. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, SandboxLogs] + Error | SandboxLogs """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py index 48302c562a..0010f62712 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -13,9 +14,10 @@ def _get_kwargs( sandbox_id: str, *, - start: Union[Unset, int] = UNSET, - end: Union[Unset, int] = UNSET, + start: int | Unset = UNSET, + end: int | Unset = UNSET, ) -> dict[str, Any]: + params: dict[str, Any] = {} params["start"] = start @@ -26,7 +28,9 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": f"/sandboxes/{sandbox_id}/metrics", + "url": "/sandboxes/{sandbox_id}/metrics".format( + sandbox_id=quote(str(sandbox_id), safe=""), + ), "params": params, } @@ -34,8 +38,8 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, list["SandboxMetric"]]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | list[SandboxMetric] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -45,22 +49,27 @@ def _parse_response( response_200.append(response_200_item) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -68,8 +77,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, list["SandboxMetric"]]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | list[SandboxMetric]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -82,23 +91,23 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, - start: Union[Unset, int] = UNSET, - end: Union[Unset, int] = UNSET, -) -> Response[Union[Error, list["SandboxMetric"]]]: + start: int | Unset = UNSET, + end: int | Unset = UNSET, +) -> Response[Error | list[SandboxMetric]]: """Get sandbox metrics Args: sandbox_id (str): - start (Union[Unset, int]): - end (Union[Unset, int]): Unix timestamp for the end of the interval, in seconds, for which - the metrics + start (int | Unset): + end (int | Unset): Unix timestamp for the end of the interval, in seconds, for which the + metrics Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, list['SandboxMetric']]] + Response[Error | list[SandboxMetric]] """ kwargs = _get_kwargs( @@ -118,23 +127,23 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, - start: Union[Unset, int] = UNSET, - end: Union[Unset, int] = UNSET, -) -> Optional[Union[Error, list["SandboxMetric"]]]: + start: int | Unset = UNSET, + end: int | Unset = UNSET, +) -> Error | list[SandboxMetric] | None: """Get sandbox metrics Args: sandbox_id (str): - start (Union[Unset, int]): - end (Union[Unset, int]): Unix timestamp for the end of the interval, in seconds, for which - the metrics + start (int | Unset): + end (int | Unset): Unix timestamp for the end of the interval, in seconds, for which the + metrics Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, list['SandboxMetric']] + Error | list[SandboxMetric] """ return sync_detailed( @@ -149,23 +158,23 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, - start: Union[Unset, int] = UNSET, - end: Union[Unset, int] = UNSET, -) -> Response[Union[Error, list["SandboxMetric"]]]: + start: int | Unset = UNSET, + end: int | Unset = UNSET, +) -> Response[Error | list[SandboxMetric]]: """Get sandbox metrics Args: sandbox_id (str): - start (Union[Unset, int]): - end (Union[Unset, int]): Unix timestamp for the end of the interval, in seconds, for which - the metrics + start (int | Unset): + end (int | Unset): Unix timestamp for the end of the interval, in seconds, for which the + metrics Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, list['SandboxMetric']]] + Response[Error | list[SandboxMetric]] """ kwargs = _get_kwargs( @@ -183,23 +192,23 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, - start: Union[Unset, int] = UNSET, - end: Union[Unset, int] = UNSET, -) -> Optional[Union[Error, list["SandboxMetric"]]]: + start: int | Unset = UNSET, + end: int | Unset = UNSET, +) -> Error | list[SandboxMetric] | None: """Get sandbox metrics Args: sandbox_id (str): - start (Union[Unset, int]): - end (Union[Unset, int]): Unix timestamp for the end of the interval, in seconds, for which - the metrics + start (int | Unset): + end (int | Unset): Unix timestamp for the end of the interval, in seconds, for which the + metrics Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, list['SandboxMetric']] + Error | list[SandboxMetric] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_v2_sandboxes.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_v2_sandboxes.py index 4955f815c7..89be7943c8 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_v2_sandboxes.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_v2_sandboxes.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -13,24 +13,24 @@ def _get_kwargs( *, - metadata: Union[Unset, str] = UNSET, - state: Union[Unset, list[SandboxState]] = UNSET, - next_token: Union[Unset, str] = UNSET, - limit: Union[Unset, int] = 100, + metadata: str | Unset = UNSET, + state: list[SandboxState] | Unset = UNSET, + next_token: str | Unset = UNSET, + limit: int | Unset = 100, ) -> dict[str, Any]: + params: dict[str, Any] = {} params["metadata"] = metadata - json_state: Union[Unset, list[str]] = UNSET + json_state: list[str] | Unset = UNSET if not isinstance(state, Unset): json_state = [] for state_item_data in state: state_item = state_item_data.value json_state.append(state_item) - if not isinstance(json_state, Unset): - params["state"] = ",".join(str(item) for item in json_state) + params["state"] = json_state params["nextToken"] = next_token @@ -48,8 +48,8 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, list["ListedSandbox"]]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | list[ListedSandbox] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -59,18 +59,22 @@ def _parse_response( response_200.append(response_200_item) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -78,8 +82,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, list["ListedSandbox"]]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | list[ListedSandbox]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -91,25 +95,25 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient, - metadata: Union[Unset, str] = UNSET, - state: Union[Unset, list[SandboxState]] = UNSET, - next_token: Union[Unset, str] = UNSET, - limit: Union[Unset, int] = 100, -) -> Response[Union[Error, list["ListedSandbox"]]]: + metadata: str | Unset = UNSET, + state: list[SandboxState] | Unset = UNSET, + next_token: str | Unset = UNSET, + limit: int | Unset = 100, +) -> Response[Error | list[ListedSandbox]]: """List all sandboxes Args: - metadata (Union[Unset, str]): - state (Union[Unset, list[SandboxState]]): - next_token (Union[Unset, str]): - limit (Union[Unset, int]): Default: 100. + metadata (str | Unset): + state (list[SandboxState] | Unset): + next_token (str | Unset): + limit (int | Unset): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, list['ListedSandbox']]] + Response[Error | list[ListedSandbox]] """ kwargs = _get_kwargs( @@ -129,25 +133,25 @@ def sync_detailed( def sync( *, client: AuthenticatedClient, - metadata: Union[Unset, str] = UNSET, - state: Union[Unset, list[SandboxState]] = UNSET, - next_token: Union[Unset, str] = UNSET, - limit: Union[Unset, int] = 100, -) -> Optional[Union[Error, list["ListedSandbox"]]]: + metadata: str | Unset = UNSET, + state: list[SandboxState] | Unset = UNSET, + next_token: str | Unset = UNSET, + limit: int | Unset = 100, +) -> Error | list[ListedSandbox] | None: """List all sandboxes Args: - metadata (Union[Unset, str]): - state (Union[Unset, list[SandboxState]]): - next_token (Union[Unset, str]): - limit (Union[Unset, int]): Default: 100. + metadata (str | Unset): + state (list[SandboxState] | Unset): + next_token (str | Unset): + limit (int | Unset): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, list['ListedSandbox']] + Error | list[ListedSandbox] """ return sync_detailed( @@ -162,25 +166,25 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient, - metadata: Union[Unset, str] = UNSET, - state: Union[Unset, list[SandboxState]] = UNSET, - next_token: Union[Unset, str] = UNSET, - limit: Union[Unset, int] = 100, -) -> Response[Union[Error, list["ListedSandbox"]]]: + metadata: str | Unset = UNSET, + state: list[SandboxState] | Unset = UNSET, + next_token: str | Unset = UNSET, + limit: int | Unset = 100, +) -> Response[Error | list[ListedSandbox]]: """List all sandboxes Args: - metadata (Union[Unset, str]): - state (Union[Unset, list[SandboxState]]): - next_token (Union[Unset, str]): - limit (Union[Unset, int]): Default: 100. + metadata (str | Unset): + state (list[SandboxState] | Unset): + next_token (str | Unset): + limit (int | Unset): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, list['ListedSandbox']]] + Response[Error | list[ListedSandbox]] """ kwargs = _get_kwargs( @@ -198,25 +202,25 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient, - metadata: Union[Unset, str] = UNSET, - state: Union[Unset, list[SandboxState]] = UNSET, - next_token: Union[Unset, str] = UNSET, - limit: Union[Unset, int] = 100, -) -> Optional[Union[Error, list["ListedSandbox"]]]: + metadata: str | Unset = UNSET, + state: list[SandboxState] | Unset = UNSET, + next_token: str | Unset = UNSET, + limit: int | Unset = 100, +) -> Error | list[ListedSandbox] | None: """List all sandboxes Args: - metadata (Union[Unset, str]): - state (Union[Unset, list[SandboxState]]): - next_token (Union[Unset, str]): - limit (Union[Unset, int]): Default: 100. + metadata (str | Unset): + state (list[SandboxState] | Unset): + next_token (str | Unset): + limit (int | Unset): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, list['ListedSandbox']] + Error | list[ListedSandbox] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes.py index 36d79cbf62..02007c33ed 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -31,24 +31,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, Sandbox]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | Sandbox | None: if response.status_code == 201: response_201 = Sandbox.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -56,8 +60,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, Sandbox]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | Sandbox]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +74,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: NewSandbox, -) -> Response[Union[Error, Sandbox]]: +) -> Response[Error | Sandbox]: """Create a sandbox from the template Args: @@ -81,7 +85,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, Sandbox]] + Response[Error | Sandbox] """ kwargs = _get_kwargs( @@ -99,7 +103,7 @@ def sync( *, client: AuthenticatedClient, body: NewSandbox, -) -> Optional[Union[Error, Sandbox]]: +) -> Error | Sandbox | None: """Create a sandbox from the template Args: @@ -110,7 +114,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, Sandbox] + Error | Sandbox """ return sync_detailed( @@ -123,7 +127,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: NewSandbox, -) -> Response[Union[Error, Sandbox]]: +) -> Response[Error | Sandbox]: """Create a sandbox from the template Args: @@ -134,7 +138,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, Sandbox]] + Response[Error | Sandbox] """ kwargs = _get_kwargs( @@ -150,7 +154,7 @@ async def asyncio( *, client: AuthenticatedClient, body: NewSandbox, -) -> Optional[Union[Error, Sandbox]]: +) -> Error | Sandbox | None: """Create a sandbox from the template Args: @@ -161,7 +165,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, Sandbox] + Error | Sandbox """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py index c3b71fcd4c..2cecebcab8 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -20,7 +21,9 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": f"/sandboxes/{sandbox_id}/connect", + "url": "/sandboxes/{sandbox_id}/connect".format( + sandbox_id=quote(str(sandbox_id), safe=""), + ), } _kwargs["json"] = body.to_dict() @@ -32,32 +35,38 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, Sandbox]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | Sandbox | None: if response.status_code == 200: response_200 = Sandbox.from_dict(response.json()) return response_200 + if response.status_code == 201: response_201 = Sandbox.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -65,8 +74,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, Sandbox]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | Sandbox]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -80,7 +89,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: ConnectSandbox, -) -> Response[Union[Error, Sandbox]]: +) -> Response[Error | Sandbox]: """Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. Args: @@ -92,7 +101,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, Sandbox]] + Response[Error | Sandbox] """ kwargs = _get_kwargs( @@ -112,7 +121,7 @@ def sync( *, client: AuthenticatedClient, body: ConnectSandbox, -) -> Optional[Union[Error, Sandbox]]: +) -> Error | Sandbox | None: """Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. Args: @@ -124,7 +133,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, Sandbox] + Error | Sandbox """ return sync_detailed( @@ -139,7 +148,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: ConnectSandbox, -) -> Response[Union[Error, Sandbox]]: +) -> Response[Error | Sandbox]: """Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. Args: @@ -151,7 +160,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, Sandbox]] + Response[Error | Sandbox] """ kwargs = _get_kwargs( @@ -169,7 +178,7 @@ async def asyncio( *, client: AuthenticatedClient, body: ConnectSandbox, -) -> Optional[Union[Error, Sandbox]]: +) -> Error | Sandbox | None: """Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. Args: @@ -181,7 +190,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, Sandbox] + Error | Sandbox """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py index f1c55c62f2..e26ae869f6 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -12,36 +13,44 @@ def _get_kwargs( sandbox_id: str, ) -> dict[str, Any]: + _kwargs: dict[str, Any] = { "method": "post", - "url": f"/sandboxes/{sandbox_id}/pause", + "url": "/sandboxes/{sandbox_id}/pause".format( + sandbox_id=quote(str(sandbox_id), safe=""), + ), } return _kwargs def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 204: response_204 = cast(Any, None) return response_204 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 409: response_409 = Error.from_dict(response.json()) return response_409 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -49,8 +58,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -63,7 +72,7 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Pause the sandbox Args: @@ -74,7 +83,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -92,7 +101,7 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Pause the sandbox Args: @@ -103,7 +112,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -116,7 +125,7 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Pause the sandbox Args: @@ -127,7 +136,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -143,7 +152,7 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Pause the sandbox Args: @@ -154,7 +163,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py index 5b667ba5dc..cbfed1983e 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -9,22 +10,25 @@ from ...models.post_sandboxes_sandbox_id_refreshes_body import ( PostSandboxesSandboxIDRefreshesBody, ) -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( sandbox_id: str, *, - body: PostSandboxesSandboxIDRefreshesBody, + body: PostSandboxesSandboxIDRefreshesBody | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} _kwargs: dict[str, Any] = { "method": "post", - "url": f"/sandboxes/{sandbox_id}/refreshes", + "url": "/sandboxes/{sandbox_id}/refreshes".format( + sandbox_id=quote(str(sandbox_id), safe=""), + ), } - _kwargs["json"] = body.to_dict() + if not isinstance(body, Unset): + _kwargs["json"] = body.to_dict() headers["Content-Type"] = "application/json" @@ -33,19 +37,22 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 204: response_204 = cast(Any, None) return response_204 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -53,8 +60,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,20 +74,20 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDRefreshesBody, -) -> Response[Union[Any, Error]]: + body: PostSandboxesSandboxIDRefreshesBody | Unset = UNSET, +) -> Response[Any | Error]: """Refresh the sandbox extending its time to live Args: sandbox_id (str): - body (PostSandboxesSandboxIDRefreshesBody): + body (PostSandboxesSandboxIDRefreshesBody | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -99,20 +106,20 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDRefreshesBody, -) -> Optional[Union[Any, Error]]: + body: PostSandboxesSandboxIDRefreshesBody | Unset = UNSET, +) -> Any | Error | None: """Refresh the sandbox extending its time to live Args: sandbox_id (str): - body (PostSandboxesSandboxIDRefreshesBody): + body (PostSandboxesSandboxIDRefreshesBody | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -126,20 +133,20 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDRefreshesBody, -) -> Response[Union[Any, Error]]: + body: PostSandboxesSandboxIDRefreshesBody | Unset = UNSET, +) -> Response[Any | Error]: """Refresh the sandbox extending its time to live Args: sandbox_id (str): - body (PostSandboxesSandboxIDRefreshesBody): + body (PostSandboxesSandboxIDRefreshesBody | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -156,20 +163,20 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDRefreshesBody, -) -> Optional[Union[Any, Error]]: + body: PostSandboxesSandboxIDRefreshesBody | Unset = UNSET, +) -> Any | Error | None: """Refresh the sandbox extending its time to live Args: sandbox_id (str): - body (PostSandboxesSandboxIDRefreshesBody): + body (PostSandboxesSandboxIDRefreshesBody | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py index caca6292ab..181ad5e815 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -20,7 +21,9 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": f"/sandboxes/{sandbox_id}/resume", + "url": "/sandboxes/{sandbox_id}/resume".format( + sandbox_id=quote(str(sandbox_id), safe=""), + ), } _kwargs["json"] = body.to_dict() @@ -32,28 +35,33 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, Sandbox]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | Sandbox | None: if response.status_code == 201: response_201 = Sandbox.from_dict(response.json()) return response_201 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 409: response_409 = Error.from_dict(response.json()) return response_409 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -61,8 +69,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, Sandbox]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | Sandbox]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +84,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: ResumedSandbox, -) -> Response[Union[Error, Sandbox]]: +) -> Response[Error | Sandbox]: """Resume the sandbox Args: @@ -88,7 +96,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, Sandbox]] + Response[Error | Sandbox] """ kwargs = _get_kwargs( @@ -108,7 +116,7 @@ def sync( *, client: AuthenticatedClient, body: ResumedSandbox, -) -> Optional[Union[Error, Sandbox]]: +) -> Error | Sandbox | None: """Resume the sandbox Args: @@ -120,7 +128,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, Sandbox] + Error | Sandbox """ return sync_detailed( @@ -135,7 +143,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: ResumedSandbox, -) -> Response[Union[Error, Sandbox]]: +) -> Response[Error | Sandbox]: """Resume the sandbox Args: @@ -147,7 +155,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, Sandbox]] + Response[Error | Sandbox] """ kwargs = _get_kwargs( @@ -165,7 +173,7 @@ async def asyncio( *, client: AuthenticatedClient, body: ResumedSandbox, -) -> Optional[Union[Error, Sandbox]]: +) -> Error | Sandbox | None: """Resume the sandbox Args: @@ -177,7 +185,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, Sandbox] + Error | Sandbox """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py index 2756f30a86..5dfb6ad62f 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -9,22 +10,25 @@ from ...models.post_sandboxes_sandbox_id_timeout_body import ( PostSandboxesSandboxIDTimeoutBody, ) -from ...types import Response +from ...types import UNSET, Response, Unset def _get_kwargs( sandbox_id: str, *, - body: PostSandboxesSandboxIDTimeoutBody, + body: PostSandboxesSandboxIDTimeoutBody | Unset = UNSET, ) -> dict[str, Any]: headers: dict[str, Any] = {} _kwargs: dict[str, Any] = { "method": "post", - "url": f"/sandboxes/{sandbox_id}/timeout", + "url": "/sandboxes/{sandbox_id}/timeout".format( + sandbox_id=quote(str(sandbox_id), safe=""), + ), } - _kwargs["json"] = body.to_dict() + if not isinstance(body, Unset): + _kwargs["json"] = body.to_dict() headers["Content-Type"] = "application/json" @@ -33,23 +37,27 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 204: response_204 = cast(Any, None) return response_204 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -57,8 +65,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -71,22 +79,22 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDTimeoutBody, -) -> Response[Union[Any, Error]]: + body: PostSandboxesSandboxIDTimeoutBody | Unset = UNSET, +) -> Response[Any | Error]: """Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. Args: sandbox_id (str): - body (PostSandboxesSandboxIDTimeoutBody): + body (PostSandboxesSandboxIDTimeoutBody | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -105,22 +113,22 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDTimeoutBody, -) -> Optional[Union[Any, Error]]: + body: PostSandboxesSandboxIDTimeoutBody | Unset = UNSET, +) -> Any | Error | None: """Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. Args: sandbox_id (str): - body (PostSandboxesSandboxIDTimeoutBody): + body (PostSandboxesSandboxIDTimeoutBody | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -134,22 +142,22 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDTimeoutBody, -) -> Response[Union[Any, Error]]: + body: PostSandboxesSandboxIDTimeoutBody | Unset = UNSET, +) -> Response[Any | Error]: """Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. Args: sandbox_id (str): - body (PostSandboxesSandboxIDTimeoutBody): + body (PostSandboxesSandboxIDTimeoutBody | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -166,22 +174,22 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDTimeoutBody, -) -> Optional[Union[Any, Error]]: + body: PostSandboxesSandboxIDTimeoutBody | Unset = UNSET, +) -> Any | Error | None: """Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. Args: sandbox_id (str): - body (PostSandboxesSandboxIDTimeoutBody): + body (PostSandboxesSandboxIDTimeoutBody | Unset): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/tags/delete_templates_tags.py b/packages/python-sdk/e2b/api/client/api/tags/delete_templates_tags.py index 16a764aa16..bcbfcb05a3 100644 --- a/packages/python-sdk/e2b/api/client/api/tags/delete_templates_tags.py +++ b/packages/python-sdk/e2b/api/client/api/tags/delete_templates_tags.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast import httpx @@ -30,27 +30,32 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 204: response_204 = cast(Any, None) return response_204 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -58,8 +63,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,7 +77,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: DeleteTemplateTagsRequest, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Delete multiple tags from templates Args: @@ -83,7 +88,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -101,7 +106,7 @@ def sync( *, client: AuthenticatedClient, body: DeleteTemplateTagsRequest, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Delete multiple tags from templates Args: @@ -112,7 +117,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -125,7 +130,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: DeleteTemplateTagsRequest, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Delete multiple tags from templates Args: @@ -136,7 +141,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -152,7 +157,7 @@ async def asyncio( *, client: AuthenticatedClient, body: DeleteTemplateTagsRequest, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Delete multiple tags from templates Args: @@ -163,7 +168,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/tags/post_templates_tags.py b/packages/python-sdk/e2b/api/client/api/tags/post_templates_tags.py index fbc0ab49ec..1590cfb7f9 100644 --- a/packages/python-sdk/e2b/api/client/api/tags/post_templates_tags.py +++ b/packages/python-sdk/e2b/api/client/api/tags/post_templates_tags.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -31,28 +31,33 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[AssignedTemplateTags, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> AssignedTemplateTags | Error | None: if response.status_code == 201: response_201 = AssignedTemplateTags.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -60,8 +65,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[AssignedTemplateTags, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[AssignedTemplateTags | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +79,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: AssignTemplateTagsRequest, -) -> Response[Union[AssignedTemplateTags, Error]]: +) -> Response[AssignedTemplateTags | Error]: """Assign tag(s) to a template build Args: @@ -85,7 +90,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[AssignedTemplateTags, Error]] + Response[AssignedTemplateTags | Error] """ kwargs = _get_kwargs( @@ -103,7 +108,7 @@ def sync( *, client: AuthenticatedClient, body: AssignTemplateTagsRequest, -) -> Optional[Union[AssignedTemplateTags, Error]]: +) -> AssignedTemplateTags | Error | None: """Assign tag(s) to a template build Args: @@ -114,7 +119,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[AssignedTemplateTags, Error] + AssignedTemplateTags | Error """ return sync_detailed( @@ -127,7 +132,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: AssignTemplateTagsRequest, -) -> Response[Union[AssignedTemplateTags, Error]]: +) -> Response[AssignedTemplateTags | Error]: """Assign tag(s) to a template build Args: @@ -138,7 +143,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[AssignedTemplateTags, Error]] + Response[AssignedTemplateTags | Error] """ kwargs = _get_kwargs( @@ -154,7 +159,7 @@ async def asyncio( *, client: AuthenticatedClient, body: AssignTemplateTagsRequest, -) -> Optional[Union[AssignedTemplateTags, Error]]: +) -> AssignedTemplateTags | Error | None: """Assign tag(s) to a template build Args: @@ -165,7 +170,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[AssignedTemplateTags, Error] + AssignedTemplateTags | Error """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/delete_templates_template_id.py b/packages/python-sdk/e2b/api/client/api/templates/delete_templates_template_id.py index d73839c73b..44f402a81d 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/delete_templates_template_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/delete_templates_template_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -12,28 +13,34 @@ def _get_kwargs( template_id: str, ) -> dict[str, Any]: + _kwargs: dict[str, Any] = { "method": "delete", - "url": f"/templates/{template_id}", + "url": "/templates/{template_id}".format( + template_id=quote(str(template_id), safe=""), + ), } return _kwargs def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 204: response_204 = cast(Any, None) return response_204 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -41,8 +48,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -55,7 +62,7 @@ def sync_detailed( template_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Delete a template Args: @@ -66,7 +73,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -84,7 +91,7 @@ def sync( template_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Delete a template Args: @@ -95,7 +102,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -108,7 +115,7 @@ async def asyncio_detailed( template_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Delete a template Args: @@ -119,7 +126,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -135,7 +142,7 @@ async def asyncio( template_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Delete a template Args: @@ -146,7 +153,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates.py index a25db12f81..414ba6fcdc 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/get_templates.py +++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -12,8 +12,9 @@ def _get_kwargs( *, - team_id: Union[Unset, str] = UNSET, + team_id: str | Unset = UNSET, ) -> dict[str, Any]: + params: dict[str, Any] = {} params["teamID"] = team_id @@ -30,8 +31,8 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, list["Template"]]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | list[Template] | None: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -41,14 +42,17 @@ def _parse_response( response_200.append(response_200_item) return response_200 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -56,8 +60,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, list["Template"]]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | list[Template]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,19 +73,19 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient, - team_id: Union[Unset, str] = UNSET, -) -> Response[Union[Error, list["Template"]]]: + team_id: str | Unset = UNSET, +) -> Response[Error | list[Template]]: """List all templates Args: - team_id (Union[Unset, str]): Identifier of the team + team_id (str | Unset): Identifier of the team Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, list['Template']]] + Response[Error | list[Template]] """ kwargs = _get_kwargs( @@ -98,19 +102,19 @@ def sync_detailed( def sync( *, client: AuthenticatedClient, - team_id: Union[Unset, str] = UNSET, -) -> Optional[Union[Error, list["Template"]]]: + team_id: str | Unset = UNSET, +) -> Error | list[Template] | None: """List all templates Args: - team_id (Union[Unset, str]): Identifier of the team + team_id (str | Unset): Identifier of the team Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, list['Template']] + Error | list[Template] """ return sync_detailed( @@ -122,19 +126,19 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient, - team_id: Union[Unset, str] = UNSET, -) -> Response[Union[Error, list["Template"]]]: + team_id: str | Unset = UNSET, +) -> Response[Error | list[Template]]: """List all templates Args: - team_id (Union[Unset, str]): Identifier of the team + team_id (str | Unset): Identifier of the team Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, list['Template']]] + Response[Error | list[Template]] """ kwargs = _get_kwargs( @@ -149,19 +153,19 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient, - team_id: Union[Unset, str] = UNSET, -) -> Optional[Union[Error, list["Template"]]]: + team_id: str | Unset = UNSET, +) -> Error | list[Template] | None: """List all templates Args: - team_id (Union[Unset, str]): Identifier of the team + team_id (str | Unset): Identifier of the team Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, list['Template']] + Error | list[Template] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates_aliases_alias.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates_aliases_alias.py index c862846d60..1a9e497c7e 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/get_templates_aliases_alias.py +++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates_aliases_alias.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -13,37 +14,45 @@ def _get_kwargs( alias: str, ) -> dict[str, Any]: + _kwargs: dict[str, Any] = { "method": "get", - "url": f"/templates/aliases/{alias}", + "url": "/templates/aliases/{alias}".format( + alias=quote(str(alias), safe=""), + ), } return _kwargs def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, TemplateAliasResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | TemplateAliasResponse | None: if response.status_code == 200: response_200 = TemplateAliasResponse.from_dict(response.json()) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 403: response_403 = Error.from_dict(response.json()) return response_403 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -51,8 +60,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, TemplateAliasResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | TemplateAliasResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -65,7 +74,7 @@ def sync_detailed( alias: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, TemplateAliasResponse]]: +) -> Response[Error | TemplateAliasResponse]: """Check if template with given alias exists Args: @@ -76,7 +85,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateAliasResponse]] + Response[Error | TemplateAliasResponse] """ kwargs = _get_kwargs( @@ -94,7 +103,7 @@ def sync( alias: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, TemplateAliasResponse]]: +) -> Error | TemplateAliasResponse | None: """Check if template with given alias exists Args: @@ -105,7 +114,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateAliasResponse] + Error | TemplateAliasResponse """ return sync_detailed( @@ -118,7 +127,7 @@ async def asyncio_detailed( alias: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, TemplateAliasResponse]]: +) -> Response[Error | TemplateAliasResponse]: """Check if template with given alias exists Args: @@ -129,7 +138,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateAliasResponse]] + Response[Error | TemplateAliasResponse] """ kwargs = _get_kwargs( @@ -145,7 +154,7 @@ async def asyncio( alias: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, TemplateAliasResponse]]: +) -> Error | TemplateAliasResponse | None: """Check if template with given alias exists Args: @@ -156,7 +165,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateAliasResponse] + Error | TemplateAliasResponse """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id.py index 875f9e945f..a2fd5c57eb 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -13,9 +14,10 @@ def _get_kwargs( template_id: str, *, - next_token: Union[Unset, str] = UNSET, - limit: Union[Unset, int] = 100, + next_token: str | Unset = UNSET, + limit: int | Unset = 100, ) -> dict[str, Any]: + params: dict[str, Any] = {} params["nextToken"] = next_token @@ -26,7 +28,9 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": f"/templates/{template_id}", + "url": "/templates/{template_id}".format( + template_id=quote(str(template_id), safe=""), + ), "params": params, } @@ -34,20 +38,23 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, TemplateWithBuilds]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | TemplateWithBuilds | None: if response.status_code == 200: response_200 = TemplateWithBuilds.from_dict(response.json()) return response_200 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -55,8 +62,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, TemplateWithBuilds]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | TemplateWithBuilds]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,22 +76,22 @@ def sync_detailed( template_id: str, *, client: AuthenticatedClient, - next_token: Union[Unset, str] = UNSET, - limit: Union[Unset, int] = 100, -) -> Response[Union[Error, TemplateWithBuilds]]: + next_token: str | Unset = UNSET, + limit: int | Unset = 100, +) -> Response[Error | TemplateWithBuilds]: """List all builds for a template Args: template_id (str): - next_token (Union[Unset, str]): - limit (Union[Unset, int]): Default: 100. + next_token (str | Unset): + limit (int | Unset): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateWithBuilds]] + Response[Error | TemplateWithBuilds] """ kwargs = _get_kwargs( @@ -104,22 +111,22 @@ def sync( template_id: str, *, client: AuthenticatedClient, - next_token: Union[Unset, str] = UNSET, - limit: Union[Unset, int] = 100, -) -> Optional[Union[Error, TemplateWithBuilds]]: + next_token: str | Unset = UNSET, + limit: int | Unset = 100, +) -> Error | TemplateWithBuilds | None: """List all builds for a template Args: template_id (str): - next_token (Union[Unset, str]): - limit (Union[Unset, int]): Default: 100. + next_token (str | Unset): + limit (int | Unset): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateWithBuilds] + Error | TemplateWithBuilds """ return sync_detailed( @@ -134,22 +141,22 @@ async def asyncio_detailed( template_id: str, *, client: AuthenticatedClient, - next_token: Union[Unset, str] = UNSET, - limit: Union[Unset, int] = 100, -) -> Response[Union[Error, TemplateWithBuilds]]: + next_token: str | Unset = UNSET, + limit: int | Unset = 100, +) -> Response[Error | TemplateWithBuilds]: """List all builds for a template Args: template_id (str): - next_token (Union[Unset, str]): - limit (Union[Unset, int]): Default: 100. + next_token (str | Unset): + limit (int | Unset): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateWithBuilds]] + Response[Error | TemplateWithBuilds] """ kwargs = _get_kwargs( @@ -167,22 +174,22 @@ async def asyncio( template_id: str, *, client: AuthenticatedClient, - next_token: Union[Unset, str] = UNSET, - limit: Union[Unset, int] = 100, -) -> Optional[Union[Error, TemplateWithBuilds]]: + next_token: str | Unset = UNSET, + limit: int | Unset = 100, +) -> Error | TemplateWithBuilds | None: """List all builds for a template Args: template_id (str): - next_token (Union[Unset, str]): - limit (Union[Unset, int]): Default: 100. + next_token (str | Unset): + limit (int | Unset): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateWithBuilds] + Error | TemplateWithBuilds """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py index 1f4fee6f31..dc668b2808 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py +++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -17,31 +18,32 @@ def _get_kwargs( template_id: str, build_id: str, *, - cursor: Union[Unset, int] = UNSET, - limit: Union[Unset, int] = 100, - direction: Union[Unset, LogsDirection] = UNSET, - level: Union[Unset, LogLevel] = UNSET, - source: Union[Unset, LogsSource] = UNSET, + cursor: int | Unset = UNSET, + limit: int | Unset = 100, + direction: LogsDirection | Unset = UNSET, + level: LogLevel | Unset = UNSET, + source: LogsSource | Unset = UNSET, ) -> dict[str, Any]: + params: dict[str, Any] = {} params["cursor"] = cursor params["limit"] = limit - json_direction: Union[Unset, str] = UNSET + json_direction: str | Unset = UNSET if not isinstance(direction, Unset): json_direction = direction.value params["direction"] = json_direction - json_level: Union[Unset, str] = UNSET + json_level: str | Unset = UNSET if not isinstance(level, Unset): json_level = level.value params["level"] = json_level - json_source: Union[Unset, str] = UNSET + json_source: str | Unset = UNSET if not isinstance(source, Unset): json_source = source.value @@ -51,7 +53,10 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": f"/templates/{template_id}/builds/{build_id}/logs", + "url": "/templates/{template_id}/builds/{build_id}/logs".format( + template_id=quote(str(template_id), safe=""), + build_id=quote(str(build_id), safe=""), + ), "params": params, } @@ -59,24 +64,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, TemplateBuildLogsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | TemplateBuildLogsResponse | None: if response.status_code == 200: response_200 = TemplateBuildLogsResponse.from_dict(response.json()) return response_200 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -84,8 +93,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, TemplateBuildLogsResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | TemplateBuildLogsResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -99,29 +108,29 @@ def sync_detailed( build_id: str, *, client: AuthenticatedClient, - cursor: Union[Unset, int] = UNSET, - limit: Union[Unset, int] = 100, - direction: Union[Unset, LogsDirection] = UNSET, - level: Union[Unset, LogLevel] = UNSET, - source: Union[Unset, LogsSource] = UNSET, -) -> Response[Union[Error, TemplateBuildLogsResponse]]: + cursor: int | Unset = UNSET, + limit: int | Unset = 100, + direction: LogsDirection | Unset = UNSET, + level: LogLevel | Unset = UNSET, + source: LogsSource | Unset = UNSET, +) -> Response[Error | TemplateBuildLogsResponse]: """Get template build logs Args: template_id (str): build_id (str): - cursor (Union[Unset, int]): - limit (Union[Unset, int]): Default: 100. - direction (Union[Unset, LogsDirection]): Direction of the logs that should be returned - level (Union[Unset, LogLevel]): State of the sandbox - source (Union[Unset, LogsSource]): Source of the logs that should be returned + cursor (int | Unset): + limit (int | Unset): Default: 100. + direction (LogsDirection | Unset): Direction of the logs that should be returned + level (LogLevel | Unset): State of the sandbox + source (LogsSource | Unset): Source of the logs that should be returned Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateBuildLogsResponse]] + Response[Error | TemplateBuildLogsResponse] """ kwargs = _get_kwargs( @@ -146,29 +155,29 @@ def sync( build_id: str, *, client: AuthenticatedClient, - cursor: Union[Unset, int] = UNSET, - limit: Union[Unset, int] = 100, - direction: Union[Unset, LogsDirection] = UNSET, - level: Union[Unset, LogLevel] = UNSET, - source: Union[Unset, LogsSource] = UNSET, -) -> Optional[Union[Error, TemplateBuildLogsResponse]]: + cursor: int | Unset = UNSET, + limit: int | Unset = 100, + direction: LogsDirection | Unset = UNSET, + level: LogLevel | Unset = UNSET, + source: LogsSource | Unset = UNSET, +) -> Error | TemplateBuildLogsResponse | None: """Get template build logs Args: template_id (str): build_id (str): - cursor (Union[Unset, int]): - limit (Union[Unset, int]): Default: 100. - direction (Union[Unset, LogsDirection]): Direction of the logs that should be returned - level (Union[Unset, LogLevel]): State of the sandbox - source (Union[Unset, LogsSource]): Source of the logs that should be returned + cursor (int | Unset): + limit (int | Unset): Default: 100. + direction (LogsDirection | Unset): Direction of the logs that should be returned + level (LogLevel | Unset): State of the sandbox + source (LogsSource | Unset): Source of the logs that should be returned Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateBuildLogsResponse] + Error | TemplateBuildLogsResponse """ return sync_detailed( @@ -188,29 +197,29 @@ async def asyncio_detailed( build_id: str, *, client: AuthenticatedClient, - cursor: Union[Unset, int] = UNSET, - limit: Union[Unset, int] = 100, - direction: Union[Unset, LogsDirection] = UNSET, - level: Union[Unset, LogLevel] = UNSET, - source: Union[Unset, LogsSource] = UNSET, -) -> Response[Union[Error, TemplateBuildLogsResponse]]: + cursor: int | Unset = UNSET, + limit: int | Unset = 100, + direction: LogsDirection | Unset = UNSET, + level: LogLevel | Unset = UNSET, + source: LogsSource | Unset = UNSET, +) -> Response[Error | TemplateBuildLogsResponse]: """Get template build logs Args: template_id (str): build_id (str): - cursor (Union[Unset, int]): - limit (Union[Unset, int]): Default: 100. - direction (Union[Unset, LogsDirection]): Direction of the logs that should be returned - level (Union[Unset, LogLevel]): State of the sandbox - source (Union[Unset, LogsSource]): Source of the logs that should be returned + cursor (int | Unset): + limit (int | Unset): Default: 100. + direction (LogsDirection | Unset): Direction of the logs that should be returned + level (LogLevel | Unset): State of the sandbox + source (LogsSource | Unset): Source of the logs that should be returned Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateBuildLogsResponse]] + Response[Error | TemplateBuildLogsResponse] """ kwargs = _get_kwargs( @@ -233,29 +242,29 @@ async def asyncio( build_id: str, *, client: AuthenticatedClient, - cursor: Union[Unset, int] = UNSET, - limit: Union[Unset, int] = 100, - direction: Union[Unset, LogsDirection] = UNSET, - level: Union[Unset, LogLevel] = UNSET, - source: Union[Unset, LogsSource] = UNSET, -) -> Optional[Union[Error, TemplateBuildLogsResponse]]: + cursor: int | Unset = UNSET, + limit: int | Unset = 100, + direction: LogsDirection | Unset = UNSET, + level: LogLevel | Unset = UNSET, + source: LogsSource | Unset = UNSET, +) -> Error | TemplateBuildLogsResponse | None: """Get template build logs Args: template_id (str): build_id (str): - cursor (Union[Unset, int]): - limit (Union[Unset, int]): Default: 100. - direction (Union[Unset, LogsDirection]): Direction of the logs that should be returned - level (Union[Unset, LogLevel]): State of the sandbox - source (Union[Unset, LogsSource]): Source of the logs that should be returned + cursor (int | Unset): + limit (int | Unset): Default: 100. + direction (LogsDirection | Unset): Direction of the logs that should be returned + level (LogLevel | Unset): State of the sandbox + source (LogsSource | Unset): Source of the logs that should be returned Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateBuildLogsResponse] + Error | TemplateBuildLogsResponse """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py index 8185e2e082..436a368e2d 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py +++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -15,17 +16,18 @@ def _get_kwargs( template_id: str, build_id: str, *, - logs_offset: Union[Unset, int] = 0, - limit: Union[Unset, int] = 100, - level: Union[Unset, LogLevel] = UNSET, + logs_offset: int | Unset = 0, + limit: int | Unset = 100, + level: LogLevel | Unset = UNSET, ) -> dict[str, Any]: + params: dict[str, Any] = {} params["logsOffset"] = logs_offset params["limit"] = limit - json_level: Union[Unset, str] = UNSET + json_level: str | Unset = UNSET if not isinstance(level, Unset): json_level = level.value @@ -35,7 +37,10 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": f"/templates/{template_id}/builds/{build_id}/status", + "url": "/templates/{template_id}/builds/{build_id}/status".format( + template_id=quote(str(template_id), safe=""), + build_id=quote(str(build_id), safe=""), + ), "params": params, } @@ -43,24 +48,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, TemplateBuildInfo]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | TemplateBuildInfo | None: if response.status_code == 200: response_200 = TemplateBuildInfo.from_dict(response.json()) return response_200 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -68,8 +77,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, TemplateBuildInfo]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | TemplateBuildInfo]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -83,25 +92,25 @@ def sync_detailed( build_id: str, *, client: AuthenticatedClient, - logs_offset: Union[Unset, int] = 0, - limit: Union[Unset, int] = 100, - level: Union[Unset, LogLevel] = UNSET, -) -> Response[Union[Error, TemplateBuildInfo]]: + logs_offset: int | Unset = 0, + limit: int | Unset = 100, + level: LogLevel | Unset = UNSET, +) -> Response[Error | TemplateBuildInfo]: """Get template build info Args: template_id (str): build_id (str): - logs_offset (Union[Unset, int]): Default: 0. - limit (Union[Unset, int]): Default: 100. - level (Union[Unset, LogLevel]): State of the sandbox + logs_offset (int | Unset): Default: 0. + limit (int | Unset): Default: 100. + level (LogLevel | Unset): State of the sandbox Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateBuildInfo]] + Response[Error | TemplateBuildInfo] """ kwargs = _get_kwargs( @@ -124,25 +133,25 @@ def sync( build_id: str, *, client: AuthenticatedClient, - logs_offset: Union[Unset, int] = 0, - limit: Union[Unset, int] = 100, - level: Union[Unset, LogLevel] = UNSET, -) -> Optional[Union[Error, TemplateBuildInfo]]: + logs_offset: int | Unset = 0, + limit: int | Unset = 100, + level: LogLevel | Unset = UNSET, +) -> Error | TemplateBuildInfo | None: """Get template build info Args: template_id (str): build_id (str): - logs_offset (Union[Unset, int]): Default: 0. - limit (Union[Unset, int]): Default: 100. - level (Union[Unset, LogLevel]): State of the sandbox + logs_offset (int | Unset): Default: 0. + limit (int | Unset): Default: 100. + level (LogLevel | Unset): State of the sandbox Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateBuildInfo] + Error | TemplateBuildInfo """ return sync_detailed( @@ -160,25 +169,25 @@ async def asyncio_detailed( build_id: str, *, client: AuthenticatedClient, - logs_offset: Union[Unset, int] = 0, - limit: Union[Unset, int] = 100, - level: Union[Unset, LogLevel] = UNSET, -) -> Response[Union[Error, TemplateBuildInfo]]: + logs_offset: int | Unset = 0, + limit: int | Unset = 100, + level: LogLevel | Unset = UNSET, +) -> Response[Error | TemplateBuildInfo]: """Get template build info Args: template_id (str): build_id (str): - logs_offset (Union[Unset, int]): Default: 0. - limit (Union[Unset, int]): Default: 100. - level (Union[Unset, LogLevel]): State of the sandbox + logs_offset (int | Unset): Default: 0. + limit (int | Unset): Default: 100. + level (LogLevel | Unset): State of the sandbox Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateBuildInfo]] + Response[Error | TemplateBuildInfo] """ kwargs = _get_kwargs( @@ -199,25 +208,25 @@ async def asyncio( build_id: str, *, client: AuthenticatedClient, - logs_offset: Union[Unset, int] = 0, - limit: Union[Unset, int] = 100, - level: Union[Unset, LogLevel] = UNSET, -) -> Optional[Union[Error, TemplateBuildInfo]]: + logs_offset: int | Unset = 0, + limit: int | Unset = 100, + level: LogLevel | Unset = UNSET, +) -> Error | TemplateBuildInfo | None: """Get template build info Args: template_id (str): build_id (str): - logs_offset (Union[Unset, int]): Default: 0. - limit (Union[Unset, int]): Default: 100. - level (Union[Unset, LogLevel]): State of the sandbox + logs_offset (int | Unset): Default: 0. + limit (int | Unset): Default: 100. + level (LogLevel | Unset): State of the sandbox Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateBuildInfo] + Error | TemplateBuildInfo """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_files_hash.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_files_hash.py index 0f6a1e4cac..67d18c684a 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_files_hash.py +++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_files_hash.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -14,37 +15,46 @@ def _get_kwargs( template_id: str, hash_: str, ) -> dict[str, Any]: + _kwargs: dict[str, Any] = { "method": "get", - "url": f"/templates/{template_id}/files/{hash_}", + "url": "/templates/{template_id}/files/{hash_}".format( + template_id=quote(str(template_id), safe=""), + hash_=quote(str(hash_), safe=""), + ), } return _kwargs def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, TemplateBuildFileUpload]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | TemplateBuildFileUpload | None: if response.status_code == 201: response_201 = TemplateBuildFileUpload.from_dict(response.json()) return response_201 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -52,8 +62,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, TemplateBuildFileUpload]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | TemplateBuildFileUpload]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +77,7 @@ def sync_detailed( hash_: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, TemplateBuildFileUpload]]: +) -> Response[Error | TemplateBuildFileUpload]: """Get an upload link for a tar file containing build layer files Args: @@ -79,7 +89,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateBuildFileUpload]] + Response[Error | TemplateBuildFileUpload] """ kwargs = _get_kwargs( @@ -99,7 +109,7 @@ def sync( hash_: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, TemplateBuildFileUpload]]: +) -> Error | TemplateBuildFileUpload | None: """Get an upload link for a tar file containing build layer files Args: @@ -111,7 +121,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateBuildFileUpload] + Error | TemplateBuildFileUpload """ return sync_detailed( @@ -126,7 +136,7 @@ async def asyncio_detailed( hash_: str, *, client: AuthenticatedClient, -) -> Response[Union[Error, TemplateBuildFileUpload]]: +) -> Response[Error | TemplateBuildFileUpload]: """Get an upload link for a tar file containing build layer files Args: @@ -138,7 +148,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateBuildFileUpload]] + Response[Error | TemplateBuildFileUpload] """ kwargs = _get_kwargs( @@ -156,7 +166,7 @@ async def asyncio( hash_: str, *, client: AuthenticatedClient, -) -> Optional[Union[Error, TemplateBuildFileUpload]]: +) -> Error | TemplateBuildFileUpload | None: """Get an upload link for a tar file containing build layer files Args: @@ -168,7 +178,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateBuildFileUpload] + Error | TemplateBuildFileUpload """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/patch_templates_template_id.py b/packages/python-sdk/e2b/api/client/api/templates/patch_templates_template_id.py index cf19391f40..7e87e2ef6d 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/patch_templates_template_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/patch_templates_template_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -19,7 +20,9 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "patch", - "url": f"/templates/{template_id}", + "url": "/templates/{template_id}".format( + template_id=quote(str(template_id), safe=""), + ), } _kwargs["json"] = body.to_dict() @@ -31,23 +34,27 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 200: response_200 = cast(Any, None) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -55,8 +62,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +77,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Update template Args: @@ -82,7 +89,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -102,7 +109,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Update template Args: @@ -114,7 +121,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -129,7 +136,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Update template Args: @@ -141,7 +148,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -159,7 +166,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Update template Args: @@ -171,7 +178,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/patch_v_2_templates_template_id.py b/packages/python-sdk/e2b/api/client/api/templates/patch_v_2_templates_template_id.py index b262332534..bc638bc908 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/patch_v_2_templates_template_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/patch_v_2_templates_template_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -20,7 +21,9 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "patch", - "url": f"/v2/templates/{template_id}", + "url": "/v2/templates/{template_id}".format( + template_id=quote(str(template_id), safe=""), + ), } _kwargs["json"] = body.to_dict() @@ -32,24 +35,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, TemplateUpdateResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | TemplateUpdateResponse | None: if response.status_code == 200: response_200 = TemplateUpdateResponse.from_dict(response.json()) return response_200 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -57,8 +64,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, TemplateUpdateResponse]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | TemplateUpdateResponse]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,7 +79,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Response[Union[Error, TemplateUpdateResponse]]: +) -> Response[Error | TemplateUpdateResponse]: """Update template Args: @@ -84,7 +91,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateUpdateResponse]] + Response[Error | TemplateUpdateResponse] """ kwargs = _get_kwargs( @@ -104,7 +111,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Optional[Union[Error, TemplateUpdateResponse]]: +) -> Error | TemplateUpdateResponse | None: """Update template Args: @@ -116,7 +123,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateUpdateResponse] + Error | TemplateUpdateResponse """ return sync_detailed( @@ -131,7 +138,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Response[Union[Error, TemplateUpdateResponse]]: +) -> Response[Error | TemplateUpdateResponse]: """Update template Args: @@ -143,7 +150,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateUpdateResponse]] + Response[Error | TemplateUpdateResponse] """ kwargs = _get_kwargs( @@ -161,7 +168,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Optional[Union[Error, TemplateUpdateResponse]]: +) -> Error | TemplateUpdateResponse | None: """Update template Args: @@ -173,7 +180,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateUpdateResponse] + Error | TemplateUpdateResponse """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_templates.py b/packages/python-sdk/e2b/api/client/api/templates/post_templates.py index 015b0d9115..c618f883d8 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/post_templates.py +++ b/packages/python-sdk/e2b/api/client/api/templates/post_templates.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -31,24 +31,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, TemplateLegacy]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | TemplateLegacy | None: if response.status_code == 202: response_202 = TemplateLegacy.from_dict(response.json()) return response_202 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -56,8 +60,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, TemplateLegacy]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | TemplateLegacy]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +74,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Response[Union[Error, TemplateLegacy]]: +) -> Response[Error | TemplateLegacy]: """Create a new template Args: @@ -81,7 +85,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateLegacy]] + Response[Error | TemplateLegacy] """ kwargs = _get_kwargs( @@ -99,7 +103,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Optional[Union[Error, TemplateLegacy]]: +) -> Error | TemplateLegacy | None: """Create a new template Args: @@ -110,7 +114,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateLegacy] + Error | TemplateLegacy """ return sync_detailed( @@ -123,7 +127,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Response[Union[Error, TemplateLegacy]]: +) -> Response[Error | TemplateLegacy]: """Create a new template Args: @@ -134,7 +138,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateLegacy]] + Response[Error | TemplateLegacy] """ kwargs = _get_kwargs( @@ -150,7 +154,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Optional[Union[Error, TemplateLegacy]]: +) -> Error | TemplateLegacy | None: """Create a new template Args: @@ -161,7 +165,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateLegacy] + Error | TemplateLegacy """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id.py b/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id.py index 986a3b51f3..749aae113e 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any +from urllib.parse import quote import httpx @@ -20,7 +21,9 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": f"/templates/{template_id}", + "url": "/templates/{template_id}".format( + template_id=quote(str(template_id), safe=""), + ), } _kwargs["json"] = body.to_dict() @@ -32,20 +35,23 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, TemplateLegacy]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | TemplateLegacy | None: if response.status_code == 202: response_202 = TemplateLegacy.from_dict(response.json()) return response_202 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -53,8 +59,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, TemplateLegacy]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | TemplateLegacy]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +74,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Response[Union[Error, TemplateLegacy]]: +) -> Response[Error | TemplateLegacy]: """Rebuild an template Args: @@ -80,7 +86,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateLegacy]] + Response[Error | TemplateLegacy] """ kwargs = _get_kwargs( @@ -100,7 +106,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Optional[Union[Error, TemplateLegacy]]: +) -> Error | TemplateLegacy | None: """Rebuild an template Args: @@ -112,7 +118,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateLegacy] + Error | TemplateLegacy """ return sync_detailed( @@ -127,7 +133,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Response[Union[Error, TemplateLegacy]]: +) -> Response[Error | TemplateLegacy]: """Rebuild an template Args: @@ -139,7 +145,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateLegacy]] + Response[Error | TemplateLegacy] """ kwargs = _get_kwargs( @@ -157,7 +163,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Optional[Union[Error, TemplateLegacy]]: +) -> Error | TemplateLegacy | None: """Rebuild an template Args: @@ -169,7 +175,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateLegacy] + Error | TemplateLegacy """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id_builds_build_id.py b/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id_builds_build_id.py index d2709ffd44..a4ce2bae20 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id_builds_build_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id_builds_build_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -13,28 +14,35 @@ def _get_kwargs( template_id: str, build_id: str, ) -> dict[str, Any]: + _kwargs: dict[str, Any] = { "method": "post", - "url": f"/templates/{template_id}/builds/{build_id}", + "url": "/templates/{template_id}/builds/{build_id}".format( + template_id=quote(str(template_id), safe=""), + build_id=quote(str(build_id), safe=""), + ), } return _kwargs def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 202: response_202 = cast(Any, None) return response_202 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -42,8 +50,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -57,7 +65,7 @@ def sync_detailed( build_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Start the build Args: @@ -69,7 +77,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -89,7 +97,7 @@ def sync( build_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Start the build Args: @@ -101,7 +109,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -116,7 +124,7 @@ async def asyncio_detailed( build_id: str, *, client: AuthenticatedClient, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Start the build Args: @@ -128,7 +136,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -146,7 +154,7 @@ async def asyncio( build_id: str, *, client: AuthenticatedClient, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Start the build Args: @@ -158,7 +166,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_v2_templates.py b/packages/python-sdk/e2b/api/client/api/templates/post_v2_templates.py index 86b5ebeb05..4ffe74da7b 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/post_v2_templates.py +++ b/packages/python-sdk/e2b/api/client/api/templates/post_v2_templates.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -31,24 +31,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, TemplateLegacy]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | TemplateLegacy | None: if response.status_code == 202: response_202 = TemplateLegacy.from_dict(response.json()) return response_202 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -56,8 +60,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, TemplateLegacy]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | TemplateLegacy]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +74,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequestV2, -) -> Response[Union[Error, TemplateLegacy]]: +) -> Response[Error | TemplateLegacy]: """Create a new template Args: @@ -81,7 +85,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateLegacy]] + Response[Error | TemplateLegacy] """ kwargs = _get_kwargs( @@ -99,7 +103,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateBuildRequestV2, -) -> Optional[Union[Error, TemplateLegacy]]: +) -> Error | TemplateLegacy | None: """Create a new template Args: @@ -110,7 +114,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateLegacy] + Error | TemplateLegacy """ return sync_detailed( @@ -123,7 +127,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequestV2, -) -> Response[Union[Error, TemplateLegacy]]: +) -> Response[Error | TemplateLegacy]: """Create a new template Args: @@ -134,7 +138,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateLegacy]] + Response[Error | TemplateLegacy] """ kwargs = _get_kwargs( @@ -150,7 +154,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateBuildRequestV2, -) -> Optional[Union[Error, TemplateLegacy]]: +) -> Error | TemplateLegacy | None: """Create a new template Args: @@ -161,7 +165,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateLegacy] + Error | TemplateLegacy """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_v3_templates.py b/packages/python-sdk/e2b/api/client/api/templates/post_v3_templates.py index 4a39ba3f2e..92268d5f01 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/post_v3_templates.py +++ b/packages/python-sdk/e2b/api/client/api/templates/post_v3_templates.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, Optional, Union +from typing import Any import httpx @@ -31,24 +31,28 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Error, TemplateRequestResponseV3]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Error | TemplateRequestResponseV3 | None: if response.status_code == 202: response_202 = TemplateRequestResponseV3.from_dict(response.json()) return response_202 + if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -56,8 +60,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Error, TemplateRequestResponseV3]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Error | TemplateRequestResponseV3]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -70,7 +74,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequestV3, -) -> Response[Union[Error, TemplateRequestResponseV3]]: +) -> Response[Error | TemplateRequestResponseV3]: """Create a new template Args: @@ -81,7 +85,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateRequestResponseV3]] + Response[Error | TemplateRequestResponseV3] """ kwargs = _get_kwargs( @@ -99,7 +103,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateBuildRequestV3, -) -> Optional[Union[Error, TemplateRequestResponseV3]]: +) -> Error | TemplateRequestResponseV3 | None: """Create a new template Args: @@ -110,7 +114,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateRequestResponseV3] + Error | TemplateRequestResponseV3 """ return sync_detailed( @@ -123,7 +127,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequestV3, -) -> Response[Union[Error, TemplateRequestResponseV3]]: +) -> Response[Error | TemplateRequestResponseV3]: """Create a new template Args: @@ -134,7 +138,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Error, TemplateRequestResponseV3]] + Response[Error | TemplateRequestResponseV3] """ kwargs = _get_kwargs( @@ -150,7 +154,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateBuildRequestV3, -) -> Optional[Union[Error, TemplateRequestResponseV3]]: +) -> Error | TemplateRequestResponseV3 | None: """Create a new template Args: @@ -161,7 +165,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Error, TemplateRequestResponseV3] + Error | TemplateRequestResponseV3 """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py b/packages/python-sdk/e2b/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py index 0d3da1fb5e..47f9599d1e 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py @@ -1,5 +1,6 @@ from http import HTTPStatus -from typing import Any, Optional, Union, cast +from typing import Any, cast +from urllib.parse import quote import httpx @@ -20,7 +21,10 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": f"/v2/templates/{template_id}/builds/{build_id}", + "url": "/v2/templates/{template_id}/builds/{build_id}".format( + template_id=quote(str(template_id), safe=""), + build_id=quote(str(build_id), safe=""), + ), } _kwargs["json"] = body.to_dict() @@ -32,19 +36,22 @@ def _get_kwargs( def _parse_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Optional[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Any | Error | None: if response.status_code == 202: response_202 = cast(Any, None) return response_202 + if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 + if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 + if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -52,8 +59,8 @@ def _parse_response( def _build_response( - *, client: Union[AuthenticatedClient, Client], response: httpx.Response -) -> Response[Union[Any, Error]]: + *, client: AuthenticatedClient | Client, response: httpx.Response +) -> Response[Any | Error]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -68,7 +75,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateBuildStartV2, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Start the build Args: @@ -81,7 +88,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -103,7 +110,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateBuildStartV2, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Start the build Args: @@ -116,7 +123,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return sync_detailed( @@ -133,7 +140,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateBuildStartV2, -) -> Response[Union[Any, Error]]: +) -> Response[Any | Error]: """Start the build Args: @@ -146,7 +153,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Union[Any, Error]] + Response[Any | Error] """ kwargs = _get_kwargs( @@ -166,7 +173,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateBuildStartV2, -) -> Optional[Union[Any, Error]]: +) -> Any | Error | None: """Start the build Args: @@ -179,7 +186,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Union[Any, Error] + Any | Error """ return ( diff --git a/packages/python-sdk/e2b/api/client/client.py b/packages/python-sdk/e2b/api/client/client.py index eeffd00c86..0ab15895e7 100644 --- a/packages/python-sdk/e2b/api/client/client.py +++ b/packages/python-sdk/e2b/api/client/client.py @@ -1,5 +1,5 @@ import ssl -from typing import Any, Optional, Union +from typing import Any import httpx from attrs import define, evolve, field @@ -38,18 +38,16 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field( - default=None, kw_only=True, alias="timeout" - ) - _verify_ssl: Union[str, bool, ssl.SSLContext] = field( + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field( default=True, kw_only=True, alias="verify_ssl" ) _follow_redirects: bool = field( default=False, kw_only=True, alias="follow_redirects" ) _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -68,7 +66,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "Client": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -107,7 +105,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ @@ -174,18 +172,16 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: Optional[httpx.Timeout] = field( - default=None, kw_only=True, alias="timeout" - ) - _verify_ssl: Union[str, bool, ssl.SSLContext] = field( + _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") + _verify_ssl: str | bool | ssl.SSLContext = field( default=True, kw_only=True, alias="verify_ssl" ) _follow_redirects: bool = field( default=False, kw_only=True, alias="follow_redirects" ) _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: Optional[httpx.Client] = field(default=None, init=False) - _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) + _client: httpx.Client | None = field(default=None, init=False) + _async_client: httpx.AsyncClient | None = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -208,7 +204,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": - """Get a new client matching this one with a new timeout (in seconds)""" + """Get a new client matching this one with a new timeout configuration""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -252,7 +248,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: def set_async_httpx_client( self, async_client: httpx.AsyncClient ) -> "AuthenticatedClient": - """Manually the underlying httpx.AsyncClient + """Manually set the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ diff --git a/packages/python-sdk/e2b/api/client/models/admin_sandbox_kill_result.py b/packages/python-sdk/e2b/api/client/models/admin_sandbox_kill_result.py index ac1df89119..fb6bd10b92 100644 --- a/packages/python-sdk/e2b/api/client/models/admin_sandbox_kill_result.py +++ b/packages/python-sdk/e2b/api/client/models/admin_sandbox_kill_result.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/assign_template_tags_request.py b/packages/python-sdk/e2b/api/client/models/assign_template_tags_request.py index 3fb10a069a..8a9114287d 100644 --- a/packages/python-sdk/e2b/api/client/models/assign_template_tags_request.py +++ b/packages/python-sdk/e2b/api/client/models/assign_template_tags_request.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar, cast diff --git a/packages/python-sdk/e2b/api/client/models/assigned_template_tags.py b/packages/python-sdk/e2b/api/client/models/assigned_template_tags.py index 7f9ecaa7ff..ad1d77240d 100644 --- a/packages/python-sdk/e2b/api/client/models/assigned_template_tags.py +++ b/packages/python-sdk/e2b/api/client/models/assigned_template_tags.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar, cast from uuid import UUID diff --git a/packages/python-sdk/e2b/api/client/models/aws_registry.py b/packages/python-sdk/e2b/api/client/models/aws_registry.py index ef1ea97482..7b966fd56e 100644 --- a/packages/python-sdk/e2b/api/client/models/aws_registry.py +++ b/packages/python-sdk/e2b/api/client/models/aws_registry.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/build_log_entry.py b/packages/python-sdk/e2b/api/client/models/build_log_entry.py index 35cae954ff..a8c56798c3 100644 --- a/packages/python-sdk/e2b/api/client/models/build_log_entry.py +++ b/packages/python-sdk/e2b/api/client/models/build_log_entry.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import Any, TypeVar, Union +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -19,13 +21,13 @@ class BuildLogEntry: level (LogLevel): State of the sandbox message (str): Log message content timestamp (datetime.datetime): Timestamp of the log entry - step (Union[Unset, str]): Step in the build process related to the log entry + step (str | Unset): Step in the build process related to the log entry """ level: LogLevel message: str timestamp: datetime.datetime - step: Union[Unset, str] = UNSET + step: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/build_status_reason.py b/packages/python-sdk/e2b/api/client/models/build_status_reason.py index e2af40317a..ce9ac0c7a2 100644 --- a/packages/python-sdk/e2b/api/client/models/build_status_reason.py +++ b/packages/python-sdk/e2b/api/client/models/build_status_reason.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -18,19 +20,19 @@ class BuildStatusReason: """ Attributes: message (str): Message with the status reason, currently reporting only for error status - log_entries (Union[Unset, list['BuildLogEntry']]): Log entries related to the status reason - step (Union[Unset, str]): Step that failed + log_entries (list[BuildLogEntry] | Unset): Log entries related to the status reason + step (str | Unset): Step that failed """ message: str - log_entries: Union[Unset, list["BuildLogEntry"]] = UNSET - step: Union[Unset, str] = UNSET + log_entries: list[BuildLogEntry] | Unset = UNSET + step: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: message = self.message - log_entries: Union[Unset, list[dict[str, Any]]] = UNSET + log_entries: list[dict[str, Any]] | Unset = UNSET if not isinstance(self.log_entries, Unset): log_entries = [] for log_entries_item_data in self.log_entries: @@ -60,12 +62,14 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) message = d.pop("message") - log_entries = [] _log_entries = d.pop("logEntries", UNSET) - for log_entries_item_data in _log_entries or []: - log_entries_item = BuildLogEntry.from_dict(log_entries_item_data) + log_entries: list[BuildLogEntry] | Unset = UNSET + if _log_entries is not UNSET: + log_entries = [] + for log_entries_item_data in _log_entries: + log_entries_item = BuildLogEntry.from_dict(log_entries_item_data) - log_entries.append(log_entries_item) + log_entries.append(log_entries_item) step = d.pop("step", UNSET) diff --git a/packages/python-sdk/e2b/api/client/models/connect_sandbox.py b/packages/python-sdk/e2b/api/client/models/connect_sandbox.py index de7a8f8c19..a2166e269a 100644 --- a/packages/python-sdk/e2b/api/client/models/connect_sandbox.py +++ b/packages/python-sdk/e2b/api/client/models/connect_sandbox.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/created_access_token.py b/packages/python-sdk/e2b/api/client/models/created_access_token.py index 04224adbc5..4457641a22 100644 --- a/packages/python-sdk/e2b/api/client/models/created_access_token.py +++ b/packages/python-sdk/e2b/api/client/models/created_access_token.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -27,7 +29,7 @@ class CreatedAccessToken: created_at: datetime.datetime id: UUID - mask: "IdentifierMaskingDetails" + mask: IdentifierMaskingDetails name: str token: str additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) diff --git a/packages/python-sdk/e2b/api/client/models/created_team_api_key.py b/packages/python-sdk/e2b/api/client/models/created_team_api_key.py index f1d4150b7f..55b2a1f79d 100644 --- a/packages/python-sdk/e2b/api/client/models/created_team_api_key.py +++ b/packages/python-sdk/e2b/api/client/models/created_team_api_key.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from typing import TYPE_CHECKING, Any, TypeVar, cast from uuid import UUID from attrs import define as _attrs_define @@ -26,17 +28,17 @@ class CreatedTeamAPIKey: key (str): Raw value of the API key mask (IdentifierMaskingDetails): name (str): Name of the API key - created_by (Union['TeamUser', None, Unset]): - last_used (Union[None, Unset, datetime.datetime]): Last time this API key was used + created_by (None | TeamUser | Unset): + last_used (datetime.datetime | None | Unset): Last time this API key was used """ created_at: datetime.datetime id: UUID key: str - mask: "IdentifierMaskingDetails" + mask: IdentifierMaskingDetails name: str - created_by: Union["TeamUser", None, Unset] = UNSET - last_used: Union[None, Unset, datetime.datetime] = UNSET + created_by: None | TeamUser | Unset = UNSET + last_used: datetime.datetime | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -52,7 +54,7 @@ def to_dict(self) -> dict[str, Any]: name = self.name - created_by: Union[None, Unset, dict[str, Any]] + created_by: dict[str, Any] | None | Unset if isinstance(self.created_by, Unset): created_by = UNSET elif isinstance(self.created_by, TeamUser): @@ -60,7 +62,7 @@ def to_dict(self) -> dict[str, Any]: else: created_by = self.created_by - last_used: Union[None, Unset, str] + last_used: None | str | Unset if isinstance(self.last_used, Unset): last_used = UNSET elif isinstance(self.last_used, datetime.datetime): @@ -102,7 +104,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: name = d.pop("name") - def _parse_created_by(data: object) -> Union["TeamUser", None, Unset]: + def _parse_created_by(data: object) -> None | TeamUser | Unset: if data is None: return data if isinstance(data, Unset): @@ -113,13 +115,13 @@ def _parse_created_by(data: object) -> Union["TeamUser", None, Unset]: created_by_type_1 = TeamUser.from_dict(data) return created_by_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["TeamUser", None, Unset], data) + return cast(None | TeamUser | Unset, data) created_by = _parse_created_by(d.pop("createdBy", UNSET)) - def _parse_last_used(data: object) -> Union[None, Unset, datetime.datetime]: + def _parse_last_used(data: object) -> datetime.datetime | None | Unset: if data is None: return data if isinstance(data, Unset): @@ -130,9 +132,9 @@ def _parse_last_used(data: object) -> Union[None, Unset, datetime.datetime]: last_used_type_0 = isoparse(data) return last_used_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union[None, Unset, datetime.datetime], data) + return cast(datetime.datetime | None | Unset, data) last_used = _parse_last_used(d.pop("lastUsed", UNSET)) diff --git a/packages/python-sdk/e2b/api/client/models/delete_template_tags_request.py b/packages/python-sdk/e2b/api/client/models/delete_template_tags_request.py index 2aa06ae9ac..808a535445 100644 --- a/packages/python-sdk/e2b/api/client/models/delete_template_tags_request.py +++ b/packages/python-sdk/e2b/api/client/models/delete_template_tags_request.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar, cast diff --git a/packages/python-sdk/e2b/api/client/models/disk_metrics.py b/packages/python-sdk/e2b/api/client/models/disk_metrics.py index 6d2b75c8ff..fb2c06b06d 100644 --- a/packages/python-sdk/e2b/api/client/models/disk_metrics.py +++ b/packages/python-sdk/e2b/api/client/models/disk_metrics.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/error.py b/packages/python-sdk/e2b/api/client/models/error.py index 362b4361e9..d4730116bc 100644 --- a/packages/python-sdk/e2b/api/client/models/error.py +++ b/packages/python-sdk/e2b/api/client/models/error.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/gcp_registry.py b/packages/python-sdk/e2b/api/client/models/gcp_registry.py index 01b6ded008..fbab87459e 100644 --- a/packages/python-sdk/e2b/api/client/models/gcp_registry.py +++ b/packages/python-sdk/e2b/api/client/models/gcp_registry.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/general_registry.py b/packages/python-sdk/e2b/api/client/models/general_registry.py index 38bc1795d7..ad0a3c97ca 100644 --- a/packages/python-sdk/e2b/api/client/models/general_registry.py +++ b/packages/python-sdk/e2b/api/client/models/general_registry.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/identifier_masking_details.py b/packages/python-sdk/e2b/api/client/models/identifier_masking_details.py index 60c0bdedb3..12e5012411 100644 --- a/packages/python-sdk/e2b/api/client/models/identifier_masking_details.py +++ b/packages/python-sdk/e2b/api/client/models/identifier_masking_details.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/listed_sandbox.py b/packages/python-sdk/e2b/api/client/models/listed_sandbox.py index 2d385a48e3..bd0b1ca86f 100644 --- a/packages/python-sdk/e2b/api/client/models/listed_sandbox.py +++ b/packages/python-sdk/e2b/api/client/models/listed_sandbox.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import Any, TypeVar, Union +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -26,8 +28,8 @@ class ListedSandbox: started_at (datetime.datetime): Time when the sandbox was started state (SandboxState): State of the sandbox template_id (str): Identifier of the template from which is the sandbox created - alias (Union[Unset, str]): Alias of the template - metadata (Union[Unset, Any]): + alias (str | Unset): Alias of the template + metadata (Any | Unset): """ client_id: str @@ -40,8 +42,8 @@ class ListedSandbox: started_at: datetime.datetime state: SandboxState template_id: str - alias: Union[Unset, str] = UNSET - metadata: Union[Unset, Any] = UNSET + alias: str | Unset = UNSET + metadata: Any | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/machine_info.py b/packages/python-sdk/e2b/api/client/models/machine_info.py index cd63ef0cb3..6619610335 100644 --- a/packages/python-sdk/e2b/api/client/models/machine_info.py +++ b/packages/python-sdk/e2b/api/client/models/machine_info.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/max_team_metric.py b/packages/python-sdk/e2b/api/client/models/max_team_metric.py index 4a9c3e5268..9b2b8b5051 100644 --- a/packages/python-sdk/e2b/api/client/models/max_team_metric.py +++ b/packages/python-sdk/e2b/api/client/models/max_team_metric.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/mcp_type_0.py b/packages/python-sdk/e2b/api/client/models/mcp_type_0.py index a58d6ea245..138344eb7e 100644 --- a/packages/python-sdk/e2b/api/client/models/mcp_type_0.py +++ b/packages/python-sdk/e2b/api/client/models/mcp_type_0.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar @@ -14,6 +16,7 @@ class McpType0: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) diff --git a/packages/python-sdk/e2b/api/client/models/new_access_token.py b/packages/python-sdk/e2b/api/client/models/new_access_token.py index 642dac80d4..2e358141bf 100644 --- a/packages/python-sdk/e2b/api/client/models/new_access_token.py +++ b/packages/python-sdk/e2b/api/client/models/new_access_token.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/new_sandbox.py b/packages/python-sdk/e2b/api/client/models/new_sandbox.py index 1f80c900c4..becee7a345 100644 --- a/packages/python-sdk/e2b/api/client/models/new_sandbox.py +++ b/packages/python-sdk/e2b/api/client/models/new_sandbox.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -19,26 +21,26 @@ class NewSandbox: """ Attributes: template_id (str): Identifier of the required template - allow_internet_access (Union[Unset, bool]): Allow sandbox to access the internet. When set to false, it behaves - the same as specifying denyOut to 0.0.0.0/0 in the network config. - auto_pause (Union[Unset, bool]): Automatically pauses the sandbox after the timeout Default: False. - env_vars (Union[Unset, Any]): - mcp (Union['McpType0', None, Unset]): MCP configuration for the sandbox - metadata (Union[Unset, Any]): - network (Union[Unset, SandboxNetworkConfig]): - secure (Union[Unset, bool]): Secure all system communication with sandbox - timeout (Union[Unset, int]): Time to live for the sandbox in seconds. Default: 15. + allow_internet_access (bool | Unset): Allow sandbox to access the internet. When set to false, it behaves the + same as specifying denyOut to 0.0.0.0/0 in the network config. + auto_pause (bool | Unset): Automatically pauses the sandbox after the timeout Default: False. + env_vars (Any | Unset): + mcp (McpType0 | None | Unset): MCP configuration for the sandbox + metadata (Any | Unset): + network (SandboxNetworkConfig | Unset): + secure (bool | Unset): Secure all system communication with sandbox + timeout (int | Unset): Time to live for the sandbox in seconds. Default: 15. """ template_id: str - allow_internet_access: Union[Unset, bool] = UNSET - auto_pause: Union[Unset, bool] = False - env_vars: Union[Unset, Any] = UNSET - mcp: Union["McpType0", None, Unset] = UNSET - metadata: Union[Unset, Any] = UNSET - network: Union[Unset, "SandboxNetworkConfig"] = UNSET - secure: Union[Unset, bool] = UNSET - timeout: Union[Unset, int] = 15 + allow_internet_access: bool | Unset = UNSET + auto_pause: bool | Unset = False + env_vars: Any | Unset = UNSET + mcp: McpType0 | None | Unset = UNSET + metadata: Any | Unset = UNSET + network: SandboxNetworkConfig | Unset = UNSET + secure: bool | Unset = UNSET + timeout: int | Unset = 15 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -52,7 +54,7 @@ def to_dict(self) -> dict[str, Any]: env_vars = self.env_vars - mcp: Union[None, Unset, dict[str, Any]] + mcp: dict[str, Any] | None | Unset if isinstance(self.mcp, Unset): mcp = UNSET elif isinstance(self.mcp, McpType0): @@ -62,7 +64,7 @@ def to_dict(self) -> dict[str, Any]: metadata = self.metadata - network: Union[Unset, dict[str, Any]] = UNSET + network: dict[str, Any] | Unset = UNSET if not isinstance(self.network, Unset): network = self.network.to_dict() @@ -110,7 +112,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: env_vars = d.pop("envVars", UNSET) - def _parse_mcp(data: object) -> Union["McpType0", None, Unset]: + def _parse_mcp(data: object) -> McpType0 | None | Unset: if data is None: return data if isinstance(data, Unset): @@ -121,16 +123,16 @@ def _parse_mcp(data: object) -> Union["McpType0", None, Unset]: componentsschemas_mcp_type_0 = McpType0.from_dict(data) return componentsschemas_mcp_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["McpType0", None, Unset], data) + return cast(McpType0 | None | Unset, data) mcp = _parse_mcp(d.pop("mcp", UNSET)) metadata = d.pop("metadata", UNSET) _network = d.pop("network", UNSET) - network: Union[Unset, SandboxNetworkConfig] + network: SandboxNetworkConfig | Unset if isinstance(_network, Unset): network = UNSET else: diff --git a/packages/python-sdk/e2b/api/client/models/new_team_api_key.py b/packages/python-sdk/e2b/api/client/models/new_team_api_key.py index 2fac8a6bf0..037f3a3dad 100644 --- a/packages/python-sdk/e2b/api/client/models/new_team_api_key.py +++ b/packages/python-sdk/e2b/api/client/models/new_team_api_key.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/node.py b/packages/python-sdk/e2b/api/client/models/node.py index af839117c1..5ceba4af2d 100644 --- a/packages/python-sdk/e2b/api/client/models/node.py +++ b/packages/python-sdk/e2b/api/client/models/node.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -38,8 +40,8 @@ class Node: create_fails: int create_successes: int id: str - machine_info: "MachineInfo" - metrics: "NodeMetrics" + machine_info: MachineInfo + metrics: NodeMetrics node_id: str sandbox_count: int sandbox_starting_count: int diff --git a/packages/python-sdk/e2b/api/client/models/node_detail.py b/packages/python-sdk/e2b/api/client/models/node_detail.py index 41b32a09f8..6fa81c386e 100644 --- a/packages/python-sdk/e2b/api/client/models/node_detail.py +++ b/packages/python-sdk/e2b/api/client/models/node_detail.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar, cast @@ -28,7 +30,7 @@ class NodeDetail: machine_info (MachineInfo): metrics (NodeMetrics): Node metrics node_id (str): Identifier of the nomad node - sandboxes (list['ListedSandbox']): List of sandboxes running on the node + sandboxes (list[ListedSandbox]): List of sandboxes running on the node service_instance_id (str): Service instance identifier of the node status (NodeStatus): Status of the node version (str): Version of the orchestrator @@ -40,10 +42,10 @@ class NodeDetail: create_fails: int create_successes: int id: str - machine_info: "MachineInfo" - metrics: "NodeMetrics" + machine_info: MachineInfo + metrics: NodeMetrics node_id: str - sandboxes: list["ListedSandbox"] + sandboxes: list[ListedSandbox] service_instance_id: str status: NodeStatus version: str diff --git a/packages/python-sdk/e2b/api/client/models/node_metrics.py b/packages/python-sdk/e2b/api/client/models/node_metrics.py index 129d74fc48..e969d2eb73 100644 --- a/packages/python-sdk/e2b/api/client/models/node_metrics.py +++ b/packages/python-sdk/e2b/api/client/models/node_metrics.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -20,7 +22,7 @@ class NodeMetrics: allocated_memory_bytes (int): Amount of allocated memory in bytes cpu_count (int): Total number of CPU cores on the node cpu_percent (int): Node CPU usage percentage - disks (list['DiskMetrics']): Detailed metrics for each disk/mount point + disks (list[DiskMetrics]): Detailed metrics for each disk/mount point memory_total_bytes (int): Total node memory in bytes memory_used_bytes (int): Node memory used in bytes """ @@ -29,7 +31,7 @@ class NodeMetrics: allocated_memory_bytes: int cpu_count: int cpu_percent: int - disks: list["DiskMetrics"] + disks: list[DiskMetrics] memory_total_bytes: int memory_used_bytes: int additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) diff --git a/packages/python-sdk/e2b/api/client/models/node_status_change.py b/packages/python-sdk/e2b/api/client/models/node_status_change.py index b628e429c6..21edb403f3 100644 --- a/packages/python-sdk/e2b/api/client/models/node_status_change.py +++ b/packages/python-sdk/e2b/api/client/models/node_status_change.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import Any, TypeVar, Union +from typing import Any, TypeVar from uuid import UUID from attrs import define as _attrs_define @@ -16,17 +18,17 @@ class NodeStatusChange: """ Attributes: status (NodeStatus): Status of the node - cluster_id (Union[Unset, UUID]): Identifier of the cluster + cluster_id (UUID | Unset): Identifier of the cluster """ status: NodeStatus - cluster_id: Union[Unset, UUID] = UNSET + cluster_id: UUID | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: status = self.status.value - cluster_id: Union[Unset, str] = UNSET + cluster_id: str | Unset = UNSET if not isinstance(self.cluster_id, Unset): cluster_id = str(self.cluster_id) @@ -48,7 +50,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: status = NodeStatus(d.pop("status")) _cluster_id = d.pop("clusterID", UNSET) - cluster_id: Union[Unset, UUID] + cluster_id: UUID | Unset if isinstance(_cluster_id, Unset): cluster_id = UNSET else: diff --git a/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py b/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py index 5a35d2612e..76bcdc2151 100644 --- a/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py +++ b/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import Any, TypeVar, Union +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,10 +15,10 @@ class PostSandboxesSandboxIDRefreshesBody: """ Attributes: - duration (Union[Unset, int]): Duration for which the sandbox should be kept alive in seconds + duration (int | Unset): Duration for which the sandbox should be kept alive in seconds """ - duration: Union[Unset, int] = UNSET + duration: int | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_timeout_body.py b/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_timeout_body.py index 4d06c65f6e..eab3738d70 100644 --- a/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_timeout_body.py +++ b/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_timeout_body.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/resumed_sandbox.py b/packages/python-sdk/e2b/api/client/models/resumed_sandbox.py index d990dc84f2..b94c77f775 100644 --- a/packages/python-sdk/e2b/api/client/models/resumed_sandbox.py +++ b/packages/python-sdk/e2b/api/client/models/resumed_sandbox.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import Any, TypeVar, Union +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,12 +15,12 @@ class ResumedSandbox: """ Attributes: - auto_pause (Union[Unset, bool]): Automatically pauses the sandbox after the timeout - timeout (Union[Unset, int]): Time to live for the sandbox in seconds. Default: 15. + auto_pause (bool | Unset): Automatically pauses the sandbox after the timeout + timeout (int | Unset): Time to live for the sandbox in seconds. Default: 15. """ - auto_pause: Union[Unset, bool] = UNSET - timeout: Union[Unset, int] = 15 + auto_pause: bool | Unset = UNSET + timeout: int | Unset = 15 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/sandbox.py b/packages/python-sdk/e2b/api/client/models/sandbox.py index 2eddc5f55a..3b14c0fa7d 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import Any, TypeVar, Union, cast +from typing import Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -17,20 +19,20 @@ class Sandbox: envd_version (str): Version of the envd running in the sandbox sandbox_id (str): Identifier of the sandbox template_id (str): Identifier of the template from which is the sandbox created - alias (Union[Unset, str]): Alias of the template - domain (Union[None, Unset, str]): Base domain where the sandbox traffic is accessible - envd_access_token (Union[Unset, str]): Access token used for envd communication - traffic_access_token (Union[None, Unset, str]): Token required for accessing sandbox via proxy. + alias (str | Unset): Alias of the template + domain (None | str | Unset): Base domain where the sandbox traffic is accessible + envd_access_token (str | Unset): Access token used for envd communication + traffic_access_token (None | str | Unset): Token required for accessing sandbox via proxy. """ client_id: str envd_version: str sandbox_id: str template_id: str - alias: Union[Unset, str] = UNSET - domain: Union[None, Unset, str] = UNSET - envd_access_token: Union[Unset, str] = UNSET - traffic_access_token: Union[None, Unset, str] = UNSET + alias: str | Unset = UNSET + domain: None | str | Unset = UNSET + envd_access_token: str | Unset = UNSET + traffic_access_token: None | str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -44,7 +46,7 @@ def to_dict(self) -> dict[str, Any]: alias = self.alias - domain: Union[None, Unset, str] + domain: None | str | Unset if isinstance(self.domain, Unset): domain = UNSET else: @@ -52,7 +54,7 @@ def to_dict(self) -> dict[str, Any]: envd_access_token = self.envd_access_token - traffic_access_token: Union[None, Unset, str] + traffic_access_token: None | str | Unset if isinstance(self.traffic_access_token, Unset): traffic_access_token = UNSET else: @@ -92,23 +94,23 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: alias = d.pop("alias", UNSET) - def _parse_domain(data: object) -> Union[None, Unset, str]: + def _parse_domain(data: object) -> None | str | Unset: if data is None: return data if isinstance(data, Unset): return data - return cast(Union[None, Unset, str], data) + return cast(None | str | Unset, data) domain = _parse_domain(d.pop("domain", UNSET)) envd_access_token = d.pop("envdAccessToken", UNSET) - def _parse_traffic_access_token(data: object) -> Union[None, Unset, str]: + def _parse_traffic_access_token(data: object) -> None | str | Unset: if data is None: return data if isinstance(data, Unset): return data - return cast(Union[None, Unset, str], data) + return cast(None | str | Unset, data) traffic_access_token = _parse_traffic_access_token( d.pop("trafficAccessToken", UNSET) diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_detail.py b/packages/python-sdk/e2b/api/client/models/sandbox_detail.py index da864cc449..8e3f248807 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_detail.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_detail.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import Any, TypeVar, Union, cast +from typing import Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -26,10 +28,10 @@ class SandboxDetail: started_at (datetime.datetime): Time when the sandbox was started state (SandboxState): State of the sandbox template_id (str): Identifier of the template from which is the sandbox created - alias (Union[Unset, str]): Alias of the template - domain (Union[None, Unset, str]): Base domain where the sandbox traffic is accessible - envd_access_token (Union[Unset, str]): Access token used for envd communication - metadata (Union[Unset, Any]): + alias (str | Unset): Alias of the template + domain (None | str | Unset): Base domain where the sandbox traffic is accessible + envd_access_token (str | Unset): Access token used for envd communication + metadata (Any | Unset): """ client_id: str @@ -42,10 +44,10 @@ class SandboxDetail: started_at: datetime.datetime state: SandboxState template_id: str - alias: Union[Unset, str] = UNSET - domain: Union[None, Unset, str] = UNSET - envd_access_token: Union[Unset, str] = UNSET - metadata: Union[Unset, Any] = UNSET + alias: str | Unset = UNSET + domain: None | str | Unset = UNSET + envd_access_token: str | Unset = UNSET + metadata: Any | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -71,7 +73,7 @@ def to_dict(self) -> dict[str, Any]: alias = self.alias - domain: Union[None, Unset, str] + domain: None | str | Unset if isinstance(self.domain, Unset): domain = UNSET else: @@ -133,12 +135,12 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: alias = d.pop("alias", UNSET) - def _parse_domain(data: object) -> Union[None, Unset, str]: + def _parse_domain(data: object) -> None | str | Unset: if data is None: return data if isinstance(data, Unset): return data - return cast(Union[None, Unset, str], data) + return cast(None | str | Unset, data) domain = _parse_domain(d.pop("domain", UNSET)) diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_log.py b/packages/python-sdk/e2b/api/client/models/sandbox_log.py index 65b9144efb..3b0dd3e028 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_log.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_log.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_log_entry.py b/packages/python-sdk/e2b/api/client/models/sandbox_log_entry.py index bcbbe7d3e5..8547957407 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_log_entry.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_log_entry.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -25,7 +27,7 @@ class SandboxLogEntry: timestamp (datetime.datetime): Timestamp of the log entry """ - fields: "SandboxLogEntryFields" + fields: SandboxLogEntryFields level: LogLevel message: str timestamp: datetime.datetime diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_log_entry_fields.py b/packages/python-sdk/e2b/api/client/models/sandbox_log_entry_fields.py index 6ac463d361..400fec1344 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_log_entry_fields.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_log_entry_fields.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar @@ -14,6 +16,7 @@ class SandboxLogEntryFields: additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: + field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_logs.py b/packages/python-sdk/e2b/api/client/models/sandbox_logs.py index 39a1eb500c..6dac14cd0c 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_logs.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_logs.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -16,12 +18,12 @@ class SandboxLogs: """ Attributes: - log_entries (list['SandboxLogEntry']): Structured logs of the sandbox - logs (list['SandboxLog']): Logs of the sandbox + log_entries (list[SandboxLogEntry]): Structured logs of the sandbox + logs (list[SandboxLog]): Logs of the sandbox """ - log_entries: list["SandboxLogEntry"] - logs: list["SandboxLog"] + log_entries: list[SandboxLogEntry] + logs: list[SandboxLog] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_metric.py b/packages/python-sdk/e2b/api/client/models/sandbox_metric.py index eb7442fd9e..1cb6dee0c1 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_metric.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_metric.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_network_config.py b/packages/python-sdk/e2b/api/client/models/sandbox_network_config.py index 08284c792f..f63d0349fe 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_network_config.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_network_config.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import Any, TypeVar, Union, cast +from typing import Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,28 +15,28 @@ class SandboxNetworkConfig: """ Attributes: - allow_out (Union[Unset, list[str]]): List of allowed CIDR blocks or IP addresses for egress traffic. Allowed - addresses always take precedence over blocked addresses. - allow_public_traffic (Union[Unset, bool]): Specify if the sandbox URLs should be accessible only with - authentication. Default: True. - deny_out (Union[Unset, list[str]]): List of denied CIDR blocks or IP addresses for egress traffic - mask_request_host (Union[Unset, str]): Specify host mask which will be used for all sandbox requests + allow_out (list[str] | Unset): List of allowed CIDR blocks or IP addresses for egress traffic. Allowed addresses + always take precedence over blocked addresses. + allow_public_traffic (bool | Unset): Specify if the sandbox URLs should be accessible only with authentication. + Default: True. + deny_out (list[str] | Unset): List of denied CIDR blocks or IP addresses for egress traffic + mask_request_host (str | Unset): Specify host mask which will be used for all sandbox requests """ - allow_out: Union[Unset, list[str]] = UNSET - allow_public_traffic: Union[Unset, bool] = True - deny_out: Union[Unset, list[str]] = UNSET - mask_request_host: Union[Unset, str] = UNSET + allow_out: list[str] | Unset = UNSET + allow_public_traffic: bool | Unset = True + deny_out: list[str] | Unset = UNSET + mask_request_host: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - allow_out: Union[Unset, list[str]] = UNSET + allow_out: list[str] | Unset = UNSET if not isinstance(self.allow_out, Unset): allow_out = self.allow_out allow_public_traffic = self.allow_public_traffic - deny_out: Union[Unset, list[str]] = UNSET + deny_out: list[str] | Unset = UNSET if not isinstance(self.deny_out, Unset): deny_out = self.deny_out diff --git a/packages/python-sdk/e2b/api/client/models/sandboxes_with_metrics.py b/packages/python-sdk/e2b/api/client/models/sandboxes_with_metrics.py index 64981d955d..04cdb5041c 100644 --- a/packages/python-sdk/e2b/api/client/models/sandboxes_with_metrics.py +++ b/packages/python-sdk/e2b/api/client/models/sandboxes_with_metrics.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/team.py b/packages/python-sdk/e2b/api/client/models/team.py index 81a434c144..b1f8e677a3 100644 --- a/packages/python-sdk/e2b/api/client/models/team.py +++ b/packages/python-sdk/e2b/api/client/models/team.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/team_api_key.py b/packages/python-sdk/e2b/api/client/models/team_api_key.py index 7edbbc1e47..69717eac72 100644 --- a/packages/python-sdk/e2b/api/client/models/team_api_key.py +++ b/packages/python-sdk/e2b/api/client/models/team_api_key.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from typing import TYPE_CHECKING, Any, TypeVar, cast from uuid import UUID from attrs import define as _attrs_define @@ -25,16 +27,16 @@ class TeamAPIKey: id (UUID): Identifier of the API key mask (IdentifierMaskingDetails): name (str): Name of the API key - created_by (Union['TeamUser', None, Unset]): - last_used (Union[None, Unset, datetime.datetime]): Last time this API key was used + created_by (None | TeamUser | Unset): + last_used (datetime.datetime | None | Unset): Last time this API key was used """ created_at: datetime.datetime id: UUID - mask: "IdentifierMaskingDetails" + mask: IdentifierMaskingDetails name: str - created_by: Union["TeamUser", None, Unset] = UNSET - last_used: Union[None, Unset, datetime.datetime] = UNSET + created_by: None | TeamUser | Unset = UNSET + last_used: datetime.datetime | None | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -48,7 +50,7 @@ def to_dict(self) -> dict[str, Any]: name = self.name - created_by: Union[None, Unset, dict[str, Any]] + created_by: dict[str, Any] | None | Unset if isinstance(self.created_by, Unset): created_by = UNSET elif isinstance(self.created_by, TeamUser): @@ -56,7 +58,7 @@ def to_dict(self) -> dict[str, Any]: else: created_by = self.created_by - last_used: Union[None, Unset, str] + last_used: None | str | Unset if isinstance(self.last_used, Unset): last_used = UNSET elif isinstance(self.last_used, datetime.datetime): @@ -95,7 +97,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: name = d.pop("name") - def _parse_created_by(data: object) -> Union["TeamUser", None, Unset]: + def _parse_created_by(data: object) -> None | TeamUser | Unset: if data is None: return data if isinstance(data, Unset): @@ -106,13 +108,13 @@ def _parse_created_by(data: object) -> Union["TeamUser", None, Unset]: created_by_type_1 = TeamUser.from_dict(data) return created_by_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["TeamUser", None, Unset], data) + return cast(None | TeamUser | Unset, data) created_by = _parse_created_by(d.pop("createdBy", UNSET)) - def _parse_last_used(data: object) -> Union[None, Unset, datetime.datetime]: + def _parse_last_used(data: object) -> datetime.datetime | None | Unset: if data is None: return data if isinstance(data, Unset): @@ -123,9 +125,9 @@ def _parse_last_used(data: object) -> Union[None, Unset, datetime.datetime]: last_used_type_0 = isoparse(data) return last_used_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union[None, Unset, datetime.datetime], data) + return cast(datetime.datetime | None | Unset, data) last_used = _parse_last_used(d.pop("lastUsed", UNSET)) diff --git a/packages/python-sdk/e2b/api/client/models/team_metric.py b/packages/python-sdk/e2b/api/client/models/team_metric.py index 97d30d751a..606b963ccf 100644 --- a/packages/python-sdk/e2b/api/client/models/team_metric.py +++ b/packages/python-sdk/e2b/api/client/models/team_metric.py @@ -1,3 +1,5 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/team_user.py b/packages/python-sdk/e2b/api/client/models/team_user.py index cd42f7fc5c..66746082ae 100644 --- a/packages/python-sdk/e2b/api/client/models/team_user.py +++ b/packages/python-sdk/e2b/api/client/models/team_user.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar from uuid import UUID diff --git a/packages/python-sdk/e2b/api/client/models/template.py b/packages/python-sdk/e2b/api/client/models/template.py index c75d4d8e09..fa4ef607f6 100644 --- a/packages/python-sdk/e2b/api/client/models/template.py +++ b/packages/python-sdk/e2b/api/client/models/template.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -25,10 +27,10 @@ class Template: build_status (TemplateBuildStatus): Status of the template build cpu_count (int): CPU cores for the sandbox created_at (datetime.datetime): Time when the template was created - created_by (Union['TeamUser', None]): + created_by (None | TeamUser): disk_size_mb (int): Disk size for the sandbox in MiB envd_version (str): Version of the envd running in the sandbox - last_spawned_at (Union[None, datetime.datetime]): Time when the template was last used + last_spawned_at (datetime.datetime | None): Time when the template was last used memory_mb (int): Memory for the sandbox in MiB names (list[str]): Names of the template (namespace/alias format when namespaced) public (bool): Whether the template is public or only accessible by the team @@ -43,10 +45,10 @@ class Template: build_status: TemplateBuildStatus cpu_count: int created_at: datetime.datetime - created_by: Union["TeamUser", None] + created_by: None | TeamUser disk_size_mb: int envd_version: str - last_spawned_at: Union[None, datetime.datetime] + last_spawned_at: datetime.datetime | None memory_mb: int names: list[str] public: bool @@ -70,7 +72,7 @@ def to_dict(self) -> dict[str, Any]: created_at = self.created_at.isoformat() - created_by: Union[None, dict[str, Any]] + created_by: dict[str, Any] | None if isinstance(self.created_by, TeamUser): created_by = self.created_by.to_dict() else: @@ -80,7 +82,7 @@ def to_dict(self) -> dict[str, Any]: envd_version = self.envd_version - last_spawned_at: Union[None, str] + last_spawned_at: None | str if isinstance(self.last_spawned_at, datetime.datetime): last_spawned_at = self.last_spawned_at.isoformat() else: @@ -140,7 +142,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: created_at = isoparse(d.pop("createdAt")) - def _parse_created_by(data: object) -> Union["TeamUser", None]: + def _parse_created_by(data: object) -> None | TeamUser: if data is None: return data try: @@ -149,9 +151,9 @@ def _parse_created_by(data: object) -> Union["TeamUser", None]: created_by_type_1 = TeamUser.from_dict(data) return created_by_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["TeamUser", None], data) + return cast(None | TeamUser, data) created_by = _parse_created_by(d.pop("createdBy")) @@ -159,7 +161,7 @@ def _parse_created_by(data: object) -> Union["TeamUser", None]: envd_version = d.pop("envdVersion") - def _parse_last_spawned_at(data: object) -> Union[None, datetime.datetime]: + def _parse_last_spawned_at(data: object) -> datetime.datetime | None: if data is None: return data try: @@ -168,9 +170,9 @@ def _parse_last_spawned_at(data: object) -> Union[None, datetime.datetime]: last_spawned_at_type_0 = isoparse(data) return last_spawned_at_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union[None, datetime.datetime], data) + return cast(datetime.datetime | None, data) last_spawned_at = _parse_last_spawned_at(d.pop("lastSpawnedAt")) diff --git a/packages/python-sdk/e2b/api/client/models/template_alias_response.py b/packages/python-sdk/e2b/api/client/models/template_alias_response.py index 7c91061972..f3932cc0e3 100644 --- a/packages/python-sdk/e2b/api/client/models/template_alias_response.py +++ b/packages/python-sdk/e2b/api/client/models/template_alias_response.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/template_build.py b/packages/python-sdk/e2b/api/client/models/template_build.py index f42a3f6fee..050a6e7738 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build.py +++ b/packages/python-sdk/e2b/api/client/models/template_build.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import Any, TypeVar, Union +from typing import Any, TypeVar from uuid import UUID from attrs import define as _attrs_define @@ -23,9 +25,9 @@ class TemplateBuild: memory_mb (int): Memory for the sandbox in MiB status (TemplateBuildStatus): Status of the template build updated_at (datetime.datetime): Time when the build was last updated - disk_size_mb (Union[Unset, int]): Disk size for the sandbox in MiB - envd_version (Union[Unset, str]): Version of the envd running in the sandbox - finished_at (Union[Unset, datetime.datetime]): Time when the build was finished + disk_size_mb (int | Unset): Disk size for the sandbox in MiB + envd_version (str | Unset): Version of the envd running in the sandbox + finished_at (datetime.datetime | Unset): Time when the build was finished """ build_id: UUID @@ -34,9 +36,9 @@ class TemplateBuild: memory_mb: int status: TemplateBuildStatus updated_at: datetime.datetime - disk_size_mb: Union[Unset, int] = UNSET - envd_version: Union[Unset, str] = UNSET - finished_at: Union[Unset, datetime.datetime] = UNSET + disk_size_mb: int | Unset = UNSET + envd_version: str | Unset = UNSET + finished_at: datetime.datetime | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -56,7 +58,7 @@ def to_dict(self) -> dict[str, Any]: envd_version = self.envd_version - finished_at: Union[Unset, str] = UNSET + finished_at: str | Unset = UNSET if not isinstance(self.finished_at, Unset): finished_at = self.finished_at.isoformat() @@ -101,7 +103,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: envd_version = d.pop("envdVersion", UNSET) _finished_at = d.pop("finishedAt", UNSET) - finished_at: Union[Unset, datetime.datetime] + finished_at: datetime.datetime | Unset if isinstance(_finished_at, Unset): finished_at = UNSET else: diff --git a/packages/python-sdk/e2b/api/client/models/template_build_file_upload.py b/packages/python-sdk/e2b/api/client/models/template_build_file_upload.py index a7d4e44a04..41bfbec378 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_file_upload.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_file_upload.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import Any, TypeVar, Union +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -14,11 +16,11 @@ class TemplateBuildFileUpload: """ Attributes: present (bool): Whether the file is already present in the cache - url (Union[Unset, str]): Url where the file should be uploaded to + url (str | Unset): Url where the file should be uploaded to """ present: bool - url: Union[Unset, str] = UNSET + url: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/template_build_info.py b/packages/python-sdk/e2b/api/client/models/template_build_info.py index 90b670c24d..ac1bfcded9 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_info.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_info.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -20,19 +22,19 @@ class TemplateBuildInfo: """ Attributes: build_id (str): Identifier of the build - log_entries (list['BuildLogEntry']): Build logs structured + log_entries (list[BuildLogEntry]): Build logs structured logs (list[str]): Build logs status (TemplateBuildStatus): Status of the template build template_id (str): Identifier of the template - reason (Union[Unset, BuildStatusReason]): + reason (BuildStatusReason | Unset): """ build_id: str - log_entries: list["BuildLogEntry"] + log_entries: list[BuildLogEntry] logs: list[str] status: TemplateBuildStatus template_id: str - reason: Union[Unset, "BuildStatusReason"] = UNSET + reason: BuildStatusReason | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -49,7 +51,7 @@ def to_dict(self) -> dict[str, Any]: template_id = self.template_id - reason: Union[Unset, dict[str, Any]] = UNSET + reason: dict[str, Any] | Unset = UNSET if not isinstance(self.reason, Unset): reason = self.reason.to_dict() @@ -91,7 +93,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: template_id = d.pop("templateID") _reason = d.pop("reason", UNSET) - reason: Union[Unset, BuildStatusReason] + reason: BuildStatusReason | Unset if isinstance(_reason, Unset): reason = UNSET else: diff --git a/packages/python-sdk/e2b/api/client/models/template_build_logs_response.py b/packages/python-sdk/e2b/api/client/models/template_build_logs_response.py index 6f3f70998d..b2b97ab8bf 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_logs_response.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_logs_response.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -15,10 +17,10 @@ class TemplateBuildLogsResponse: """ Attributes: - logs (list['BuildLogEntry']): Build logs structured + logs (list[BuildLogEntry]): Build logs structured """ - logs: list["BuildLogEntry"] + logs: list[BuildLogEntry] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/template_build_request.py b/packages/python-sdk/e2b/api/client/models/template_build_request.py index b41e1d0cdc..971717fc0f 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_request.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_request.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import Any, TypeVar, Union +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -14,21 +16,21 @@ class TemplateBuildRequest: """ Attributes: dockerfile (str): Dockerfile for the template - alias (Union[Unset, str]): Alias of the template - cpu_count (Union[Unset, int]): CPU cores for the sandbox - memory_mb (Union[Unset, int]): Memory for the sandbox in MiB - ready_cmd (Union[Unset, str]): Ready check command to execute in the template after the build - start_cmd (Union[Unset, str]): Start command to execute in the template after the build - team_id (Union[Unset, str]): Identifier of the team + alias (str | Unset): Alias of the template + cpu_count (int | Unset): CPU cores for the sandbox + memory_mb (int | Unset): Memory for the sandbox in MiB + ready_cmd (str | Unset): Ready check command to execute in the template after the build + start_cmd (str | Unset): Start command to execute in the template after the build + team_id (str | Unset): Identifier of the team """ dockerfile: str - alias: Union[Unset, str] = UNSET - cpu_count: Union[Unset, int] = UNSET - memory_mb: Union[Unset, int] = UNSET - ready_cmd: Union[Unset, str] = UNSET - start_cmd: Union[Unset, str] = UNSET - team_id: Union[Unset, str] = UNSET + alias: str | Unset = UNSET + cpu_count: int | Unset = UNSET + memory_mb: int | Unset = UNSET + ready_cmd: str | Unset = UNSET + start_cmd: str | Unset = UNSET + team_id: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/template_build_request_v2.py b/packages/python-sdk/e2b/api/client/models/template_build_request_v2.py index 1473424e04..658b2a7432 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_request_v2.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_request_v2.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import Any, TypeVar, Union +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -14,15 +16,15 @@ class TemplateBuildRequestV2: """ Attributes: alias (str): Alias of the template - cpu_count (Union[Unset, int]): CPU cores for the sandbox - memory_mb (Union[Unset, int]): Memory for the sandbox in MiB - team_id (Union[Unset, str]): Identifier of the team + cpu_count (int | Unset): CPU cores for the sandbox + memory_mb (int | Unset): Memory for the sandbox in MiB + team_id (str | Unset): Identifier of the team """ alias: str - cpu_count: Union[Unset, int] = UNSET - memory_mb: Union[Unset, int] = UNSET - team_id: Union[Unset, str] = UNSET + cpu_count: int | Unset = UNSET + memory_mb: int | Unset = UNSET + team_id: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/template_build_request_v3.py b/packages/python-sdk/e2b/api/client/models/template_build_request_v3.py index dda90f01f3..da703c1c78 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_request_v3.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_request_v3.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import Any, TypeVar, Union, cast +from typing import Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,21 +15,21 @@ class TemplateBuildRequestV3: """ Attributes: - alias (Union[Unset, str]): Alias of the template. Deprecated, use name instead. - cpu_count (Union[Unset, int]): CPU cores for the sandbox - memory_mb (Union[Unset, int]): Memory for the sandbox in MiB - name (Union[Unset, str]): Name of the template. Can include a tag with colon separator (e.g. "my-template" or - "my-template:v1"). If tag is included, it will be treated as if the tag was provided in the tags array. - tags (Union[Unset, list[str]]): Tags to assign to the template build - team_id (Union[Unset, str]): Identifier of the team + alias (str | Unset): Alias of the template. Deprecated, use name instead. + cpu_count (int | Unset): CPU cores for the sandbox + memory_mb (int | Unset): Memory for the sandbox in MiB + name (str | Unset): Name of the template. Can include a tag with colon separator (e.g. "my-template" or "my- + template:v1"). If tag is included, it will be treated as if the tag was provided in the tags array. + tags (list[str] | Unset): Tags to assign to the template build + team_id (str | Unset): Identifier of the team """ - alias: Union[Unset, str] = UNSET - cpu_count: Union[Unset, int] = UNSET - memory_mb: Union[Unset, int] = UNSET - name: Union[Unset, str] = UNSET - tags: Union[Unset, list[str]] = UNSET - team_id: Union[Unset, str] = UNSET + alias: str | Unset = UNSET + cpu_count: int | Unset = UNSET + memory_mb: int | Unset = UNSET + name: str | Unset = UNSET + tags: list[str] | Unset = UNSET + team_id: str | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -39,7 +41,7 @@ def to_dict(self) -> dict[str, Any]: name = self.name - tags: Union[Unset, list[str]] = UNSET + tags: list[str] | Unset = UNSET if not isinstance(self.tags, Unset): tags = self.tags diff --git a/packages/python-sdk/e2b/api/client/models/template_build_start_v2.py b/packages/python-sdk/e2b/api/client/models/template_build_start_v2.py index 32adf844e5..1c3177925d 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_start_v2.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_start_v2.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union +from typing import TYPE_CHECKING, Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -20,25 +22,22 @@ class TemplateBuildStartV2: """ Attributes: - force (Union[Unset, bool]): Whether the whole build should be forced to run regardless of the cache Default: - False. - from_image (Union[Unset, str]): Image to use as a base for the template build - from_image_registry (Union['AWSRegistry', 'GCPRegistry', 'GeneralRegistry', Unset]): - from_template (Union[Unset, str]): Template to use as a base for the template build - ready_cmd (Union[Unset, str]): Ready check command to execute in the template after the build - start_cmd (Union[Unset, str]): Start command to execute in the template after the build - steps (Union[Unset, list['TemplateStep']]): List of steps to execute in the template build + force (bool | Unset): Whether the whole build should be forced to run regardless of the cache Default: False. + from_image (str | Unset): Image to use as a base for the template build + from_image_registry (AWSRegistry | GCPRegistry | GeneralRegistry | Unset): + from_template (str | Unset): Template to use as a base for the template build + ready_cmd (str | Unset): Ready check command to execute in the template after the build + start_cmd (str | Unset): Start command to execute in the template after the build + steps (list[TemplateStep] | Unset): List of steps to execute in the template build """ - force: Union[Unset, bool] = False - from_image: Union[Unset, str] = UNSET - from_image_registry: Union[ - "AWSRegistry", "GCPRegistry", "GeneralRegistry", Unset - ] = UNSET - from_template: Union[Unset, str] = UNSET - ready_cmd: Union[Unset, str] = UNSET - start_cmd: Union[Unset, str] = UNSET - steps: Union[Unset, list["TemplateStep"]] = UNSET + force: bool | Unset = False + from_image: str | Unset = UNSET + from_image_registry: AWSRegistry | GCPRegistry | GeneralRegistry | Unset = UNSET + from_template: str | Unset = UNSET + ready_cmd: str | Unset = UNSET + start_cmd: str | Unset = UNSET + steps: list[TemplateStep] | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -49,7 +48,7 @@ def to_dict(self) -> dict[str, Any]: from_image = self.from_image - from_image_registry: Union[Unset, dict[str, Any]] + from_image_registry: dict[str, Any] | Unset if isinstance(self.from_image_registry, Unset): from_image_registry = UNSET elif isinstance(self.from_image_registry, AWSRegistry): @@ -65,7 +64,7 @@ def to_dict(self) -> dict[str, Any]: start_cmd = self.start_cmd - steps: Union[Unset, list[dict[str, Any]]] = UNSET + steps: list[dict[str, Any]] | Unset = UNSET if not isinstance(self.steps, Unset): steps = [] for steps_item_data in self.steps: @@ -106,7 +105,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: def _parse_from_image_registry( data: object, - ) -> Union["AWSRegistry", "GCPRegistry", "GeneralRegistry", Unset]: + ) -> AWSRegistry | GCPRegistry | GeneralRegistry | Unset: if isinstance(data, Unset): return data try: @@ -117,7 +116,7 @@ def _parse_from_image_registry( ) return componentsschemas_from_image_registry_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass try: if not isinstance(data, dict): @@ -127,7 +126,7 @@ def _parse_from_image_registry( ) return componentsschemas_from_image_registry_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass if not isinstance(data, dict): raise TypeError() @@ -147,12 +146,14 @@ def _parse_from_image_registry( start_cmd = d.pop("startCmd", UNSET) - steps = [] _steps = d.pop("steps", UNSET) - for steps_item_data in _steps or []: - steps_item = TemplateStep.from_dict(steps_item_data) + steps: list[TemplateStep] | Unset = UNSET + if _steps is not UNSET: + steps = [] + for steps_item_data in _steps: + steps_item = TemplateStep.from_dict(steps_item_data) - steps.append(steps_item) + steps.append(steps_item) template_build_start_v2 = cls( force=force, diff --git a/packages/python-sdk/e2b/api/client/models/template_legacy.py b/packages/python-sdk/e2b/api/client/models/template_legacy.py index 69501e5654..179cce29d4 100644 --- a/packages/python-sdk/e2b/api/client/models/template_legacy.py +++ b/packages/python-sdk/e2b/api/client/models/template_legacy.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -22,10 +24,10 @@ class TemplateLegacy: build_id (str): Identifier of the last successful build for given template cpu_count (int): CPU cores for the sandbox created_at (datetime.datetime): Time when the template was created - created_by (Union['TeamUser', None]): + created_by (None | TeamUser): disk_size_mb (int): Disk size for the sandbox in MiB envd_version (str): Version of the envd running in the sandbox - last_spawned_at (Union[None, datetime.datetime]): Time when the template was last used + last_spawned_at (datetime.datetime | None): Time when the template was last used memory_mb (int): Memory for the sandbox in MiB public (bool): Whether the template is public or only accessible by the team spawn_count (int): Number of times the template was used @@ -38,10 +40,10 @@ class TemplateLegacy: build_id: str cpu_count: int created_at: datetime.datetime - created_by: Union["TeamUser", None] + created_by: None | TeamUser disk_size_mb: int envd_version: str - last_spawned_at: Union[None, datetime.datetime] + last_spawned_at: datetime.datetime | None memory_mb: int public: bool spawn_count: int @@ -62,7 +64,7 @@ def to_dict(self) -> dict[str, Any]: created_at = self.created_at.isoformat() - created_by: Union[None, dict[str, Any]] + created_by: dict[str, Any] | None if isinstance(self.created_by, TeamUser): created_by = self.created_by.to_dict() else: @@ -72,7 +74,7 @@ def to_dict(self) -> dict[str, Any]: envd_version = self.envd_version - last_spawned_at: Union[None, str] + last_spawned_at: None | str if isinstance(self.last_spawned_at, datetime.datetime): last_spawned_at = self.last_spawned_at.isoformat() else: @@ -126,7 +128,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: created_at = isoparse(d.pop("createdAt")) - def _parse_created_by(data: object) -> Union["TeamUser", None]: + def _parse_created_by(data: object) -> None | TeamUser: if data is None: return data try: @@ -135,9 +137,9 @@ def _parse_created_by(data: object) -> Union["TeamUser", None]: created_by_type_1 = TeamUser.from_dict(data) return created_by_type_1 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union["TeamUser", None], data) + return cast(None | TeamUser, data) created_by = _parse_created_by(d.pop("createdBy")) @@ -145,7 +147,7 @@ def _parse_created_by(data: object) -> Union["TeamUser", None]: envd_version = d.pop("envdVersion") - def _parse_last_spawned_at(data: object) -> Union[None, datetime.datetime]: + def _parse_last_spawned_at(data: object) -> datetime.datetime | None: if data is None: return data try: @@ -154,9 +156,9 @@ def _parse_last_spawned_at(data: object) -> Union[None, datetime.datetime]: last_spawned_at_type_0 = isoparse(data) return last_spawned_at_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union[None, datetime.datetime], data) + return cast(datetime.datetime | None, data) last_spawned_at = _parse_last_spawned_at(d.pop("lastSpawnedAt")) diff --git a/packages/python-sdk/e2b/api/client/models/template_request_response_v3.py b/packages/python-sdk/e2b/api/client/models/template_request_response_v3.py index 9921980c5a..59b5d6ae12 100644 --- a/packages/python-sdk/e2b/api/client/models/template_request_response_v3.py +++ b/packages/python-sdk/e2b/api/client/models/template_request_response_v3.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar, cast diff --git a/packages/python-sdk/e2b/api/client/models/template_step.py b/packages/python-sdk/e2b/api/client/models/template_step.py index 45daaecd06..c32b346755 100644 --- a/packages/python-sdk/e2b/api/client/models/template_step.py +++ b/packages/python-sdk/e2b/api/client/models/template_step.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import Any, TypeVar, Union, cast +from typing import Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -15,21 +17,21 @@ class TemplateStep: Attributes: type_ (str): Type of the step - args (Union[Unset, list[str]]): Arguments for the step - files_hash (Union[Unset, str]): Hash of the files used in the step - force (Union[Unset, bool]): Whether the step should be forced to run regardless of the cache Default: False. + args (list[str] | Unset): Arguments for the step + files_hash (str | Unset): Hash of the files used in the step + force (bool | Unset): Whether the step should be forced to run regardless of the cache Default: False. """ type_: str - args: Union[Unset, list[str]] = UNSET - files_hash: Union[Unset, str] = UNSET - force: Union[Unset, bool] = False + args: list[str] | Unset = UNSET + files_hash: str | Unset = UNSET + force: bool | Unset = False additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: type_ = self.type_ - args: Union[Unset, list[str]] = UNSET + args: list[str] | Unset = UNSET if not isinstance(self.args, Unset): args = self.args diff --git a/packages/python-sdk/e2b/api/client/models/template_update_request.py b/packages/python-sdk/e2b/api/client/models/template_update_request.py index 8a9f5bee82..b017fc1e2e 100644 --- a/packages/python-sdk/e2b/api/client/models/template_update_request.py +++ b/packages/python-sdk/e2b/api/client/models/template_update_request.py @@ -1,5 +1,7 @@ +from __future__ import annotations + from collections.abc import Mapping -from typing import Any, TypeVar, Union +from typing import Any, TypeVar from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -13,10 +15,10 @@ class TemplateUpdateRequest: """ Attributes: - public (Union[Unset, bool]): Whether the template is public or only accessible by the team + public (bool | Unset): Whether the template is public or only accessible by the team """ - public: Union[Unset, bool] = UNSET + public: bool | Unset = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/template_update_response.py b/packages/python-sdk/e2b/api/client/models/template_update_response.py index 7a273c84d0..cfe3c2deaf 100644 --- a/packages/python-sdk/e2b/api/client/models/template_update_response.py +++ b/packages/python-sdk/e2b/api/client/models/template_update_response.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar, cast diff --git a/packages/python-sdk/e2b/api/client/models/template_with_builds.py b/packages/python-sdk/e2b/api/client/models/template_with_builds.py index 90c0a63445..bb077713e8 100644 --- a/packages/python-sdk/e2b/api/client/models/template_with_builds.py +++ b/packages/python-sdk/e2b/api/client/models/template_with_builds.py @@ -1,6 +1,8 @@ +from __future__ import annotations + import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, Union, cast +from typing import TYPE_CHECKING, Any, TypeVar, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -18,9 +20,9 @@ class TemplateWithBuilds: """ Attributes: aliases (list[str]): Aliases of the template - builds (list['TemplateBuild']): List of builds for the template + builds (list[TemplateBuild]): List of builds for the template created_at (datetime.datetime): Time when the template was created - last_spawned_at (Union[None, datetime.datetime]): Time when the template was last used + last_spawned_at (datetime.datetime | None): Time when the template was last used names (list[str]): Names of the template (namespace/alias format when namespaced) public (bool): Whether the template is public or only accessible by the team spawn_count (int): Number of times the template was used @@ -29,9 +31,9 @@ class TemplateWithBuilds: """ aliases: list[str] - builds: list["TemplateBuild"] + builds: list[TemplateBuild] created_at: datetime.datetime - last_spawned_at: Union[None, datetime.datetime] + last_spawned_at: datetime.datetime | None names: list[str] public: bool spawn_count: int @@ -49,7 +51,7 @@ def to_dict(self) -> dict[str, Any]: created_at = self.created_at.isoformat() - last_spawned_at: Union[None, str] + last_spawned_at: None | str if isinstance(self.last_spawned_at, datetime.datetime): last_spawned_at = self.last_spawned_at.isoformat() else: @@ -99,7 +101,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: created_at = isoparse(d.pop("createdAt")) - def _parse_last_spawned_at(data: object) -> Union[None, datetime.datetime]: + def _parse_last_spawned_at(data: object) -> datetime.datetime | None: if data is None: return data try: @@ -108,9 +110,9 @@ def _parse_last_spawned_at(data: object) -> Union[None, datetime.datetime]: last_spawned_at_type_0 = isoparse(data) return last_spawned_at_type_0 - except: # noqa: E722 + except (TypeError, ValueError, AttributeError, KeyError): pass - return cast(Union[None, datetime.datetime], data) + return cast(datetime.datetime | None, data) last_spawned_at = _parse_last_spawned_at(d.pop("lastSpawnedAt")) diff --git a/packages/python-sdk/e2b/api/client/models/update_team_api_key.py b/packages/python-sdk/e2b/api/client/models/update_team_api_key.py index 34fb9679ae..8d98e99542 100644 --- a/packages/python-sdk/e2b/api/client/models/update_team_api_key.py +++ b/packages/python-sdk/e2b/api/client/models/update_team_api_key.py @@ -1,3 +1,5 @@ +from __future__ import annotations + from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/types.py b/packages/python-sdk/e2b/api/client/types.py index 1b96ca408a..b64af09529 100644 --- a/packages/python-sdk/e2b/api/client/types.py +++ b/packages/python-sdk/e2b/api/client/types.py @@ -2,7 +2,7 @@ from collections.abc import Mapping, MutableMapping from http import HTTPStatus -from typing import IO, BinaryIO, Generic, Literal, Optional, TypeVar, Union +from typing import IO, BinaryIO, Generic, Literal, TypeVar from attrs import define @@ -15,13 +15,13 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() # The types that `httpx.Client(files=)` can accept, copied from that library. -FileContent = Union[IO[bytes], bytes, str] -FileTypes = Union[ +FileContent = IO[bytes] | bytes | str +FileTypes = ( # (filename, file (or bytes), content_type) - tuple[Optional[str], FileContent, Optional[str]], + tuple[str | None, FileContent, str | None] # (filename, file (or bytes), content_type, headers) - tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], -] + | tuple[str | None, FileContent, str | None, Mapping[str, str]] +) RequestFiles = list[tuple[str, FileTypes]] @@ -30,8 +30,8 @@ class File: """Contains information for file uploads""" payload: BinaryIO - file_name: Optional[str] = None - mime_type: Optional[str] = None + file_name: str | None = None + mime_type: str | None = None def to_tuple(self) -> FileTypes: """Return a tuple representation that httpx will accept for multipart/form-data""" @@ -48,7 +48,7 @@ class Response(Generic[T]): status_code: HTTPStatus content: bytes headers: MutableMapping[str, str] - parsed: Optional[T] + parsed: T | None __all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"] diff --git a/packages/python-sdk/tests/async/template_async/test_stacktrace.py b/packages/python-sdk/tests/async/template_async/test_stacktrace.py index 03bc2ca162..29dcde11b0 100644 --- a/packages/python-sdk/tests/async/template_async/test_stacktrace.py +++ b/packages/python-sdk/tests/async/template_async/test_stacktrace.py @@ -182,9 +182,9 @@ async def test_traces_on_copyItems(async_build): @pytest.mark.skip_debug() async def test_traces_on_copy_absolute_path(): await _expect_to_throw_and_check_trace( - lambda: AsyncTemplate() - .from_base_image() - .copy("/absolute/path", "/absolute/path"), + lambda: ( + AsyncTemplate().from_base_image().copy("/absolute/path", "/absolute/path") + ), "copy", ) @@ -192,9 +192,11 @@ async def test_traces_on_copy_absolute_path(): @pytest.mark.skip_debug() async def test_traces_on_copyItems_absolute_path(): await _expect_to_throw_and_check_trace( - lambda: AsyncTemplate() - .from_base_image() - .copy_items([CopyItem(src="/absolute/path", dest="/absolute/path")]), + lambda: ( + AsyncTemplate() + .from_base_image() + .copy_items([CopyItem(src="/absolute/path", dest="/absolute/path")]) + ), "copy_items", ) diff --git a/packages/python-sdk/tests/sync/template_sync/test_stacktrace.py b/packages/python-sdk/tests/sync/template_sync/test_stacktrace.py index 5801247523..c2dd79028f 100644 --- a/packages/python-sdk/tests/sync/template_sync/test_stacktrace.py +++ b/packages/python-sdk/tests/sync/template_sync/test_stacktrace.py @@ -192,9 +192,11 @@ def test_traces_on_copy_absolute_path(): @pytest.mark.skip_debug() def test_traces_on_copyItems_absolute_path(): _expect_to_throw_and_check_trace( - lambda: Template() - .from_base_image() - .copy_items([CopyItem(src="/absolute/path", dest="/absolute/path")]), + lambda: ( + Template() + .from_base_image() + .copy_items([CopyItem(src="/absolute/path", dest="/absolute/path")]) + ), "copy_items", ) From a93b17bda57a440dbcc3dd7c4996eeb2bb4f0186 Mon Sep 17 00:00:00 2001 From: Tomas Beran Date: Fri, 13 Feb 2026 16:50:01 -0800 Subject: [PATCH 4/5] Revert unrelated generated Python API client changes Only keep the two new generated files needed for get_tags: - get_templates_template_id_tags.py - template_tag.py --- .../sandboxes/delete_sandboxes_sandbox_id.py | 36 ++--- .../api/client/api/sandboxes/get_sandboxes.py | 49 +++---- .../api/sandboxes/get_sandboxes_metrics.py | 33 ++--- .../api/sandboxes/get_sandboxes_sandbox_id.py | 36 ++--- .../get_sandboxes_sandbox_id_logs.py | 72 +++++----- .../get_sandboxes_sandbox_id_metrics.py | 81 +++++------ .../client/api/sandboxes/get_v2_sandboxes.py | 108 +++++++------- .../client/api/sandboxes/post_sandboxes.py | 30 ++-- .../post_sandboxes_sandbox_id_connect.py | 37 ++--- .../post_sandboxes_sandbox_id_pause.py | 37 ++--- .../post_sandboxes_sandbox_id_refreshes.py | 57 ++++---- .../post_sandboxes_sandbox_id_resume.py | 36 ++--- .../post_sandboxes_sandbox_id_timeout.py | 58 ++++---- .../client/api/tags/delete_templates_tags.py | 31 ++-- .../client/api/tags/post_templates_tags.py | 31 ++-- .../templates/delete_templates_template_id.py | 35 ++--- .../api/client/api/templates/get_templates.py | 48 +++---- .../templates/get_templates_aliases_alias.py | 37 ++--- .../templates/get_templates_template_id.py | 71 +++++----- ...plates_template_id_builds_build_id_logs.py | 133 ++++++++---------- ...ates_template_id_builds_build_id_status.py | 93 ++++++------ .../get_templates_template_id_files_hash.py | 38 ++--- .../templates/patch_templates_template_id.py | 35 ++--- .../patch_v_2_templates_template_id.py | 35 ++--- .../client/api/templates/post_templates.py | 30 ++-- .../templates/post_templates_template_id.py | 34 ++--- ...t_templates_template_id_builds_build_id.py | 36 ++--- .../client/api/templates/post_v2_templates.py | 30 ++-- .../client/api/templates/post_v3_templates.py | 30 ++-- ...2_templates_template_id_builds_build_id.py | 35 ++--- packages/python-sdk/e2b/api/client/client.py | 30 ++-- .../models/admin_sandbox_kill_result.py | 2 - .../models/assign_template_tags_request.py | 2 - .../client/models/assigned_template_tags.py | 2 - .../e2b/api/client/models/aws_registry.py | 2 - .../e2b/api/client/models/build_log_entry.py | 8 +- .../api/client/models/build_status_reason.py | 24 ++-- .../e2b/api/client/models/connect_sandbox.py | 2 - .../api/client/models/created_access_token.py | 4 +- .../api/client/models/created_team_api_key.py | 30 ++-- .../models/delete_template_tags_request.py | 2 - .../e2b/api/client/models/disk_metrics.py | 2 - .../python-sdk/e2b/api/client/models/error.py | 2 - .../e2b/api/client/models/gcp_registry.py | 2 - .../e2b/api/client/models/general_registry.py | 2 - .../models/identifier_masking_details.py | 2 - .../e2b/api/client/models/listed_sandbox.py | 12 +- .../e2b/api/client/models/machine_info.py | 2 - .../e2b/api/client/models/max_team_metric.py | 2 - .../e2b/api/client/models/mcp_type_0.py | 3 - .../e2b/api/client/models/new_access_token.py | 2 - .../e2b/api/client/models/new_sandbox.py | 50 ++++--- .../e2b/api/client/models/new_team_api_key.py | 2 - .../python-sdk/e2b/api/client/models/node.py | 6 +- .../e2b/api/client/models/node_detail.py | 10 +- .../e2b/api/client/models/node_metrics.py | 6 +- .../api/client/models/node_status_change.py | 12 +- ...ost_sandboxes_sandbox_id_refreshes_body.py | 8 +- .../post_sandboxes_sandbox_id_timeout_body.py | 2 - .../e2b/api/client/models/resumed_sandbox.py | 12 +- .../e2b/api/client/models/sandbox.py | 32 ++--- .../e2b/api/client/models/sandbox_detail.py | 26 ++-- .../e2b/api/client/models/sandbox_log.py | 2 - .../api/client/models/sandbox_log_entry.py | 4 +- .../client/models/sandbox_log_entry_fields.py | 3 - .../e2b/api/client/models/sandbox_logs.py | 10 +- .../e2b/api/client/models/sandbox_metric.py | 2 - .../client/models/sandbox_network_config.py | 28 ++-- .../client/models/sandboxes_with_metrics.py | 2 - .../python-sdk/e2b/api/client/models/team.py | 2 - .../e2b/api/client/models/team_api_key.py | 30 ++-- .../e2b/api/client/models/team_metric.py | 2 - .../e2b/api/client/models/team_user.py | 2 - .../e2b/api/client/models/template.py | 28 ++-- .../client/models/template_alias_response.py | 2 - .../e2b/api/client/models/template_build.py | 20 ++- .../models/template_build_file_upload.py | 8 +- .../api/client/models/template_build_info.py | 16 +-- .../models/template_build_logs_response.py | 6 +- .../client/models/template_build_request.py | 28 ++-- .../models/template_build_request_v2.py | 16 +-- .../models/template_build_request_v3.py | 32 ++--- .../client/models/template_build_start_v2.py | 55 ++++---- .../e2b/api/client/models/template_legacy.py | 28 ++-- .../models/template_request_response_v3.py | 2 - .../e2b/api/client/models/template_step.py | 18 ++- .../client/models/template_update_request.py | 8 +- .../client/models/template_update_response.py | 2 - .../api/client/models/template_with_builds.py | 20 ++- .../api/client/models/update_team_api_key.py | 2 - packages/python-sdk/e2b/api/client/types.py | 18 +-- 91 files changed, 916 insertions(+), 1237 deletions(-) diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py b/packages/python-sdk/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py index dd51492c6b..77288c4ca0 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/delete_sandboxes_sandbox_id.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any, Optional, Union, cast import httpx @@ -13,39 +12,32 @@ def _get_kwargs( sandbox_id: str, ) -> dict[str, Any]: - _kwargs: dict[str, Any] = { "method": "delete", - "url": "/sandboxes/{sandbox_id}".format( - sandbox_id=quote(str(sandbox_id), safe=""), - ), + "url": f"/sandboxes/{sandbox_id}", } return _kwargs def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Any | Error | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Error]]: if response.status_code == 204: response_204 = cast(Any, None) return response_204 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -53,8 +45,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | Error]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Error]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -67,7 +59,7 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Kill a sandbox Args: @@ -78,7 +70,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -96,7 +88,7 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Kill a sandbox Args: @@ -107,7 +99,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return sync_detailed( @@ -120,7 +112,7 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Kill a sandbox Args: @@ -131,7 +123,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -147,7 +139,7 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Kill a sandbox Args: @@ -158,7 +150,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes.py index 0d3a75bfe2..19829e5ca6 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any +from typing import Any, Optional, Union import httpx @@ -12,9 +12,8 @@ def _get_kwargs( *, - metadata: str | Unset = UNSET, + metadata: Union[Unset, str] = UNSET, ) -> dict[str, Any]: - params: dict[str, Any] = {} params["metadata"] = metadata @@ -31,8 +30,8 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | list[ListedSandbox] | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, list["ListedSandbox"]]]: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -42,22 +41,18 @@ def _parse_response( response_200.append(response_200_item) return response_200 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -65,8 +60,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | list[ListedSandbox]]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, list["ListedSandbox"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -78,19 +73,19 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient, - metadata: str | Unset = UNSET, -) -> Response[Error | list[ListedSandbox]]: + metadata: Union[Unset, str] = UNSET, +) -> Response[Union[Error, list["ListedSandbox"]]]: """List all running sandboxes Args: - metadata (str | Unset): + metadata (Union[Unset, str]): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | list[ListedSandbox]] + Response[Union[Error, list['ListedSandbox']]] """ kwargs = _get_kwargs( @@ -107,19 +102,19 @@ def sync_detailed( def sync( *, client: AuthenticatedClient, - metadata: str | Unset = UNSET, -) -> Error | list[ListedSandbox] | None: + metadata: Union[Unset, str] = UNSET, +) -> Optional[Union[Error, list["ListedSandbox"]]]: """List all running sandboxes Args: - metadata (str | Unset): + metadata (Union[Unset, str]): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | list[ListedSandbox] + Union[Error, list['ListedSandbox']] """ return sync_detailed( @@ -131,19 +126,19 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient, - metadata: str | Unset = UNSET, -) -> Response[Error | list[ListedSandbox]]: + metadata: Union[Unset, str] = UNSET, +) -> Response[Union[Error, list["ListedSandbox"]]]: """List all running sandboxes Args: - metadata (str | Unset): + metadata (Union[Unset, str]): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | list[ListedSandbox]] + Response[Union[Error, list['ListedSandbox']]] """ kwargs = _get_kwargs( @@ -158,19 +153,19 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient, - metadata: str | Unset = UNSET, -) -> Error | list[ListedSandbox] | None: + metadata: Union[Unset, str] = UNSET, +) -> Optional[Union[Error, list["ListedSandbox"]]]: """List all running sandboxes Args: - metadata (str | Unset): + metadata (Union[Unset, str]): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | list[ListedSandbox] + Union[Error, list['ListedSandbox']] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py index 3f266f1ce9..d05b6f900b 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_metrics.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any +from typing import Any, Optional, Union import httpx @@ -14,12 +14,11 @@ def _get_kwargs( *, sandbox_ids: list[str], ) -> dict[str, Any]: - params: dict[str, Any] = {} json_sandbox_ids = sandbox_ids - params["sandbox_ids"] = json_sandbox_ids + params["sandbox_ids"] = ",".join(str(item) for item in json_sandbox_ids) params = {k: v for k, v in params.items() if v is not UNSET and v is not None} @@ -33,28 +32,24 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | SandboxesWithMetrics | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, SandboxesWithMetrics]]: if response.status_code == 200: response_200 = SandboxesWithMetrics.from_dict(response.json()) return response_200 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -62,8 +57,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | SandboxesWithMetrics]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, SandboxesWithMetrics]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,7 +71,7 @@ def sync_detailed( *, client: AuthenticatedClient, sandbox_ids: list[str], -) -> Response[Error | SandboxesWithMetrics]: +) -> Response[Union[Error, SandboxesWithMetrics]]: """List metrics for given sandboxes Args: @@ -87,7 +82,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | SandboxesWithMetrics] + Response[Union[Error, SandboxesWithMetrics]] """ kwargs = _get_kwargs( @@ -105,7 +100,7 @@ def sync( *, client: AuthenticatedClient, sandbox_ids: list[str], -) -> Error | SandboxesWithMetrics | None: +) -> Optional[Union[Error, SandboxesWithMetrics]]: """List metrics for given sandboxes Args: @@ -116,7 +111,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | SandboxesWithMetrics + Union[Error, SandboxesWithMetrics] """ return sync_detailed( @@ -129,7 +124,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, sandbox_ids: list[str], -) -> Response[Error | SandboxesWithMetrics]: +) -> Response[Union[Error, SandboxesWithMetrics]]: """List metrics for given sandboxes Args: @@ -140,7 +135,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | SandboxesWithMetrics] + Response[Union[Error, SandboxesWithMetrics]] """ kwargs = _get_kwargs( @@ -156,7 +151,7 @@ async def asyncio( *, client: AuthenticatedClient, sandbox_ids: list[str], -) -> Error | SandboxesWithMetrics | None: +) -> Optional[Union[Error, SandboxesWithMetrics]]: """List metrics for given sandboxes Args: @@ -167,7 +162,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | SandboxesWithMetrics + Union[Error, SandboxesWithMetrics] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id.py index 210b268bb0..74f0b27f83 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -14,40 +13,33 @@ def _get_kwargs( sandbox_id: str, ) -> dict[str, Any]: - _kwargs: dict[str, Any] = { "method": "get", - "url": "/sandboxes/{sandbox_id}".format( - sandbox_id=quote(str(sandbox_id), safe=""), - ), + "url": f"/sandboxes/{sandbox_id}", } return _kwargs def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | SandboxDetail | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, SandboxDetail]]: if response.status_code == 200: response_200 = SandboxDetail.from_dict(response.json()) return response_200 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -55,8 +47,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | SandboxDetail]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, SandboxDetail]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -69,7 +61,7 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, -) -> Response[Error | SandboxDetail]: +) -> Response[Union[Error, SandboxDetail]]: """Get a sandbox by id Args: @@ -80,7 +72,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | SandboxDetail] + Response[Union[Error, SandboxDetail]] """ kwargs = _get_kwargs( @@ -98,7 +90,7 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, -) -> Error | SandboxDetail | None: +) -> Optional[Union[Error, SandboxDetail]]: """Get a sandbox by id Args: @@ -109,7 +101,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | SandboxDetail + Union[Error, SandboxDetail] """ return sync_detailed( @@ -122,7 +114,7 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, -) -> Response[Error | SandboxDetail]: +) -> Response[Union[Error, SandboxDetail]]: """Get a sandbox by id Args: @@ -133,7 +125,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | SandboxDetail] + Response[Union[Error, SandboxDetail]] """ kwargs = _get_kwargs( @@ -149,7 +141,7 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, -) -> Error | SandboxDetail | None: +) -> Optional[Union[Error, SandboxDetail]]: """Get a sandbox by id Args: @@ -160,7 +152,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | SandboxDetail + Union[Error, SandboxDetail] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py index 9711275396..a72765c53b 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_logs.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -14,10 +13,9 @@ def _get_kwargs( sandbox_id: str, *, - start: int | Unset = UNSET, - limit: int | Unset = 1000, + start: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = 1000, ) -> dict[str, Any]: - params: dict[str, Any] = {} params["start"] = start @@ -28,9 +26,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": "/sandboxes/{sandbox_id}/logs".format( - sandbox_id=quote(str(sandbox_id), safe=""), - ), + "url": f"/sandboxes/{sandbox_id}/logs", "params": params, } @@ -38,28 +34,24 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | SandboxLogs | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, SandboxLogs]]: if response.status_code == 200: response_200 = SandboxLogs.from_dict(response.json()) return response_200 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -67,8 +59,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | SandboxLogs]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, SandboxLogs]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -81,22 +73,22 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, - start: int | Unset = UNSET, - limit: int | Unset = 1000, -) -> Response[Error | SandboxLogs]: + start: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = 1000, +) -> Response[Union[Error, SandboxLogs]]: """Get sandbox logs Args: sandbox_id (str): - start (int | Unset): - limit (int | Unset): Default: 1000. + start (Union[Unset, int]): + limit (Union[Unset, int]): Default: 1000. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | SandboxLogs] + Response[Union[Error, SandboxLogs]] """ kwargs = _get_kwargs( @@ -116,22 +108,22 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, - start: int | Unset = UNSET, - limit: int | Unset = 1000, -) -> Error | SandboxLogs | None: + start: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = 1000, +) -> Optional[Union[Error, SandboxLogs]]: """Get sandbox logs Args: sandbox_id (str): - start (int | Unset): - limit (int | Unset): Default: 1000. + start (Union[Unset, int]): + limit (Union[Unset, int]): Default: 1000. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | SandboxLogs + Union[Error, SandboxLogs] """ return sync_detailed( @@ -146,22 +138,22 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, - start: int | Unset = UNSET, - limit: int | Unset = 1000, -) -> Response[Error | SandboxLogs]: + start: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = 1000, +) -> Response[Union[Error, SandboxLogs]]: """Get sandbox logs Args: sandbox_id (str): - start (int | Unset): - limit (int | Unset): Default: 1000. + start (Union[Unset, int]): + limit (Union[Unset, int]): Default: 1000. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | SandboxLogs] + Response[Union[Error, SandboxLogs]] """ kwargs = _get_kwargs( @@ -179,22 +171,22 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, - start: int | Unset = UNSET, - limit: int | Unset = 1000, -) -> Error | SandboxLogs | None: + start: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = 1000, +) -> Optional[Union[Error, SandboxLogs]]: """Get sandbox logs Args: sandbox_id (str): - start (int | Unset): - limit (int | Unset): Default: 1000. + start (Union[Unset, int]): + limit (Union[Unset, int]): Default: 1000. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | SandboxLogs + Union[Error, SandboxLogs] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py index 0010f62712..48302c562a 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_sandboxes_sandbox_id_metrics.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -14,10 +13,9 @@ def _get_kwargs( sandbox_id: str, *, - start: int | Unset = UNSET, - end: int | Unset = UNSET, + start: Union[Unset, int] = UNSET, + end: Union[Unset, int] = UNSET, ) -> dict[str, Any]: - params: dict[str, Any] = {} params["start"] = start @@ -28,9 +26,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": "/sandboxes/{sandbox_id}/metrics".format( - sandbox_id=quote(str(sandbox_id), safe=""), - ), + "url": f"/sandboxes/{sandbox_id}/metrics", "params": params, } @@ -38,8 +34,8 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | list[SandboxMetric] | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, list["SandboxMetric"]]]: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -49,27 +45,22 @@ def _parse_response( response_200.append(response_200_item) return response_200 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -77,8 +68,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | list[SandboxMetric]]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, list["SandboxMetric"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -91,23 +82,23 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, - start: int | Unset = UNSET, - end: int | Unset = UNSET, -) -> Response[Error | list[SandboxMetric]]: + start: Union[Unset, int] = UNSET, + end: Union[Unset, int] = UNSET, +) -> Response[Union[Error, list["SandboxMetric"]]]: """Get sandbox metrics Args: sandbox_id (str): - start (int | Unset): - end (int | Unset): Unix timestamp for the end of the interval, in seconds, for which the - metrics + start (Union[Unset, int]): + end (Union[Unset, int]): Unix timestamp for the end of the interval, in seconds, for which + the metrics Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | list[SandboxMetric]] + Response[Union[Error, list['SandboxMetric']]] """ kwargs = _get_kwargs( @@ -127,23 +118,23 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, - start: int | Unset = UNSET, - end: int | Unset = UNSET, -) -> Error | list[SandboxMetric] | None: + start: Union[Unset, int] = UNSET, + end: Union[Unset, int] = UNSET, +) -> Optional[Union[Error, list["SandboxMetric"]]]: """Get sandbox metrics Args: sandbox_id (str): - start (int | Unset): - end (int | Unset): Unix timestamp for the end of the interval, in seconds, for which the - metrics + start (Union[Unset, int]): + end (Union[Unset, int]): Unix timestamp for the end of the interval, in seconds, for which + the metrics Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | list[SandboxMetric] + Union[Error, list['SandboxMetric']] """ return sync_detailed( @@ -158,23 +149,23 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, - start: int | Unset = UNSET, - end: int | Unset = UNSET, -) -> Response[Error | list[SandboxMetric]]: + start: Union[Unset, int] = UNSET, + end: Union[Unset, int] = UNSET, +) -> Response[Union[Error, list["SandboxMetric"]]]: """Get sandbox metrics Args: sandbox_id (str): - start (int | Unset): - end (int | Unset): Unix timestamp for the end of the interval, in seconds, for which the - metrics + start (Union[Unset, int]): + end (Union[Unset, int]): Unix timestamp for the end of the interval, in seconds, for which + the metrics Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | list[SandboxMetric]] + Response[Union[Error, list['SandboxMetric']]] """ kwargs = _get_kwargs( @@ -192,23 +183,23 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, - start: int | Unset = UNSET, - end: int | Unset = UNSET, -) -> Error | list[SandboxMetric] | None: + start: Union[Unset, int] = UNSET, + end: Union[Unset, int] = UNSET, +) -> Optional[Union[Error, list["SandboxMetric"]]]: """Get sandbox metrics Args: sandbox_id (str): - start (int | Unset): - end (int | Unset): Unix timestamp for the end of the interval, in seconds, for which the - metrics + start (Union[Unset, int]): + end (Union[Unset, int]): Unix timestamp for the end of the interval, in seconds, for which + the metrics Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | list[SandboxMetric] + Union[Error, list['SandboxMetric']] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/get_v2_sandboxes.py b/packages/python-sdk/e2b/api/client/api/sandboxes/get_v2_sandboxes.py index 89be7943c8..4955f815c7 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/get_v2_sandboxes.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/get_v2_sandboxes.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any +from typing import Any, Optional, Union import httpx @@ -13,24 +13,24 @@ def _get_kwargs( *, - metadata: str | Unset = UNSET, - state: list[SandboxState] | Unset = UNSET, - next_token: str | Unset = UNSET, - limit: int | Unset = 100, + metadata: Union[Unset, str] = UNSET, + state: Union[Unset, list[SandboxState]] = UNSET, + next_token: Union[Unset, str] = UNSET, + limit: Union[Unset, int] = 100, ) -> dict[str, Any]: - params: dict[str, Any] = {} params["metadata"] = metadata - json_state: list[str] | Unset = UNSET + json_state: Union[Unset, list[str]] = UNSET if not isinstance(state, Unset): json_state = [] for state_item_data in state: state_item = state_item_data.value json_state.append(state_item) - params["state"] = json_state + if not isinstance(json_state, Unset): + params["state"] = ",".join(str(item) for item in json_state) params["nextToken"] = next_token @@ -48,8 +48,8 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | list[ListedSandbox] | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, list["ListedSandbox"]]]: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -59,22 +59,18 @@ def _parse_response( response_200.append(response_200_item) return response_200 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -82,8 +78,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | list[ListedSandbox]]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, list["ListedSandbox"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -95,25 +91,25 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient, - metadata: str | Unset = UNSET, - state: list[SandboxState] | Unset = UNSET, - next_token: str | Unset = UNSET, - limit: int | Unset = 100, -) -> Response[Error | list[ListedSandbox]]: + metadata: Union[Unset, str] = UNSET, + state: Union[Unset, list[SandboxState]] = UNSET, + next_token: Union[Unset, str] = UNSET, + limit: Union[Unset, int] = 100, +) -> Response[Union[Error, list["ListedSandbox"]]]: """List all sandboxes Args: - metadata (str | Unset): - state (list[SandboxState] | Unset): - next_token (str | Unset): - limit (int | Unset): Default: 100. + metadata (Union[Unset, str]): + state (Union[Unset, list[SandboxState]]): + next_token (Union[Unset, str]): + limit (Union[Unset, int]): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | list[ListedSandbox]] + Response[Union[Error, list['ListedSandbox']]] """ kwargs = _get_kwargs( @@ -133,25 +129,25 @@ def sync_detailed( def sync( *, client: AuthenticatedClient, - metadata: str | Unset = UNSET, - state: list[SandboxState] | Unset = UNSET, - next_token: str | Unset = UNSET, - limit: int | Unset = 100, -) -> Error | list[ListedSandbox] | None: + metadata: Union[Unset, str] = UNSET, + state: Union[Unset, list[SandboxState]] = UNSET, + next_token: Union[Unset, str] = UNSET, + limit: Union[Unset, int] = 100, +) -> Optional[Union[Error, list["ListedSandbox"]]]: """List all sandboxes Args: - metadata (str | Unset): - state (list[SandboxState] | Unset): - next_token (str | Unset): - limit (int | Unset): Default: 100. + metadata (Union[Unset, str]): + state (Union[Unset, list[SandboxState]]): + next_token (Union[Unset, str]): + limit (Union[Unset, int]): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | list[ListedSandbox] + Union[Error, list['ListedSandbox']] """ return sync_detailed( @@ -166,25 +162,25 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient, - metadata: str | Unset = UNSET, - state: list[SandboxState] | Unset = UNSET, - next_token: str | Unset = UNSET, - limit: int | Unset = 100, -) -> Response[Error | list[ListedSandbox]]: + metadata: Union[Unset, str] = UNSET, + state: Union[Unset, list[SandboxState]] = UNSET, + next_token: Union[Unset, str] = UNSET, + limit: Union[Unset, int] = 100, +) -> Response[Union[Error, list["ListedSandbox"]]]: """List all sandboxes Args: - metadata (str | Unset): - state (list[SandboxState] | Unset): - next_token (str | Unset): - limit (int | Unset): Default: 100. + metadata (Union[Unset, str]): + state (Union[Unset, list[SandboxState]]): + next_token (Union[Unset, str]): + limit (Union[Unset, int]): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | list[ListedSandbox]] + Response[Union[Error, list['ListedSandbox']]] """ kwargs = _get_kwargs( @@ -202,25 +198,25 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient, - metadata: str | Unset = UNSET, - state: list[SandboxState] | Unset = UNSET, - next_token: str | Unset = UNSET, - limit: int | Unset = 100, -) -> Error | list[ListedSandbox] | None: + metadata: Union[Unset, str] = UNSET, + state: Union[Unset, list[SandboxState]] = UNSET, + next_token: Union[Unset, str] = UNSET, + limit: Union[Unset, int] = 100, +) -> Optional[Union[Error, list["ListedSandbox"]]]: """List all sandboxes Args: - metadata (str | Unset): - state (list[SandboxState] | Unset): - next_token (str | Unset): - limit (int | Unset): Default: 100. + metadata (Union[Unset, str]): + state (Union[Unset, list[SandboxState]]): + next_token (Union[Unset, str]): + limit (Union[Unset, int]): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | list[ListedSandbox] + Union[Error, list['ListedSandbox']] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes.py index 02007c33ed..36d79cbf62 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any +from typing import Any, Optional, Union import httpx @@ -31,28 +31,24 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | Sandbox | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, Sandbox]]: if response.status_code == 201: response_201 = Sandbox.from_dict(response.json()) return response_201 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -60,8 +56,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | Sandbox]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, Sandbox]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +70,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: NewSandbox, -) -> Response[Error | Sandbox]: +) -> Response[Union[Error, Sandbox]]: """Create a sandbox from the template Args: @@ -85,7 +81,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | Sandbox] + Response[Union[Error, Sandbox]] """ kwargs = _get_kwargs( @@ -103,7 +99,7 @@ def sync( *, client: AuthenticatedClient, body: NewSandbox, -) -> Error | Sandbox | None: +) -> Optional[Union[Error, Sandbox]]: """Create a sandbox from the template Args: @@ -114,7 +110,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | Sandbox + Union[Error, Sandbox] """ return sync_detailed( @@ -127,7 +123,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: NewSandbox, -) -> Response[Error | Sandbox]: +) -> Response[Union[Error, Sandbox]]: """Create a sandbox from the template Args: @@ -138,7 +134,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | Sandbox] + Response[Union[Error, Sandbox]] """ kwargs = _get_kwargs( @@ -154,7 +150,7 @@ async def asyncio( *, client: AuthenticatedClient, body: NewSandbox, -) -> Error | Sandbox | None: +) -> Optional[Union[Error, Sandbox]]: """Create a sandbox from the template Args: @@ -165,7 +161,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | Sandbox + Union[Error, Sandbox] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py index 2cecebcab8..c3b71fcd4c 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_connect.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -21,9 +20,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": "/sandboxes/{sandbox_id}/connect".format( - sandbox_id=quote(str(sandbox_id), safe=""), - ), + "url": f"/sandboxes/{sandbox_id}/connect", } _kwargs["json"] = body.to_dict() @@ -35,38 +32,32 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | Sandbox | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, Sandbox]]: if response.status_code == 200: response_200 = Sandbox.from_dict(response.json()) return response_200 - if response.status_code == 201: response_201 = Sandbox.from_dict(response.json()) return response_201 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -74,8 +65,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | Sandbox]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, Sandbox]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -89,7 +80,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: ConnectSandbox, -) -> Response[Error | Sandbox]: +) -> Response[Union[Error, Sandbox]]: """Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. Args: @@ -101,7 +92,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | Sandbox] + Response[Union[Error, Sandbox]] """ kwargs = _get_kwargs( @@ -121,7 +112,7 @@ def sync( *, client: AuthenticatedClient, body: ConnectSandbox, -) -> Error | Sandbox | None: +) -> Optional[Union[Error, Sandbox]]: """Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. Args: @@ -133,7 +124,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | Sandbox + Union[Error, Sandbox] """ return sync_detailed( @@ -148,7 +139,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: ConnectSandbox, -) -> Response[Error | Sandbox]: +) -> Response[Union[Error, Sandbox]]: """Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. Args: @@ -160,7 +151,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | Sandbox] + Response[Union[Error, Sandbox]] """ kwargs = _get_kwargs( @@ -178,7 +169,7 @@ async def asyncio( *, client: AuthenticatedClient, body: ConnectSandbox, -) -> Error | Sandbox | None: +) -> Optional[Union[Error, Sandbox]]: """Returns sandbox details. If the sandbox is paused, it will be resumed. TTL is only extended. Args: @@ -190,7 +181,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | Sandbox + Union[Error, Sandbox] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py index e26ae869f6..f1c55c62f2 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_pause.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any, Optional, Union, cast import httpx @@ -13,44 +12,36 @@ def _get_kwargs( sandbox_id: str, ) -> dict[str, Any]: - _kwargs: dict[str, Any] = { "method": "post", - "url": "/sandboxes/{sandbox_id}/pause".format( - sandbox_id=quote(str(sandbox_id), safe=""), - ), + "url": f"/sandboxes/{sandbox_id}/pause", } return _kwargs def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Any | Error | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Error]]: if response.status_code == 204: response_204 = cast(Any, None) return response_204 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 409: response_409 = Error.from_dict(response.json()) return response_409 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -58,8 +49,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | Error]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Error]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -72,7 +63,7 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Pause the sandbox Args: @@ -83,7 +74,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -101,7 +92,7 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Pause the sandbox Args: @@ -112,7 +103,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return sync_detailed( @@ -125,7 +116,7 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Pause the sandbox Args: @@ -136,7 +127,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -152,7 +143,7 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Pause the sandbox Args: @@ -163,7 +154,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py index cbfed1983e..5b667ba5dc 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_refreshes.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any, Optional, Union, cast import httpx @@ -10,25 +9,22 @@ from ...models.post_sandboxes_sandbox_id_refreshes_body import ( PostSandboxesSandboxIDRefreshesBody, ) -from ...types import UNSET, Response, Unset +from ...types import Response def _get_kwargs( sandbox_id: str, *, - body: PostSandboxesSandboxIDRefreshesBody | Unset = UNSET, + body: PostSandboxesSandboxIDRefreshesBody, ) -> dict[str, Any]: headers: dict[str, Any] = {} _kwargs: dict[str, Any] = { "method": "post", - "url": "/sandboxes/{sandbox_id}/refreshes".format( - sandbox_id=quote(str(sandbox_id), safe=""), - ), + "url": f"/sandboxes/{sandbox_id}/refreshes", } - if not isinstance(body, Unset): - _kwargs["json"] = body.to_dict() + _kwargs["json"] = body.to_dict() headers["Content-Type"] = "application/json" @@ -37,22 +33,19 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Any | Error | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Error]]: if response.status_code == 204: response_204 = cast(Any, None) return response_204 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -60,8 +53,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | Error]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Error]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,20 +67,20 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDRefreshesBody | Unset = UNSET, -) -> Response[Any | Error]: + body: PostSandboxesSandboxIDRefreshesBody, +) -> Response[Union[Any, Error]]: """Refresh the sandbox extending its time to live Args: sandbox_id (str): - body (PostSandboxesSandboxIDRefreshesBody | Unset): + body (PostSandboxesSandboxIDRefreshesBody): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -106,20 +99,20 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDRefreshesBody | Unset = UNSET, -) -> Any | Error | None: + body: PostSandboxesSandboxIDRefreshesBody, +) -> Optional[Union[Any, Error]]: """Refresh the sandbox extending its time to live Args: sandbox_id (str): - body (PostSandboxesSandboxIDRefreshesBody | Unset): + body (PostSandboxesSandboxIDRefreshesBody): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return sync_detailed( @@ -133,20 +126,20 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDRefreshesBody | Unset = UNSET, -) -> Response[Any | Error]: + body: PostSandboxesSandboxIDRefreshesBody, +) -> Response[Union[Any, Error]]: """Refresh the sandbox extending its time to live Args: sandbox_id (str): - body (PostSandboxesSandboxIDRefreshesBody | Unset): + body (PostSandboxesSandboxIDRefreshesBody): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -163,20 +156,20 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDRefreshesBody | Unset = UNSET, -) -> Any | Error | None: + body: PostSandboxesSandboxIDRefreshesBody, +) -> Optional[Union[Any, Error]]: """Refresh the sandbox extending its time to live Args: sandbox_id (str): - body (PostSandboxesSandboxIDRefreshesBody | Unset): + body (PostSandboxesSandboxIDRefreshesBody): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py index 181ad5e815..caca6292ab 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_resume.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -21,9 +20,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": "/sandboxes/{sandbox_id}/resume".format( - sandbox_id=quote(str(sandbox_id), safe=""), - ), + "url": f"/sandboxes/{sandbox_id}/resume", } _kwargs["json"] = body.to_dict() @@ -35,33 +32,28 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | Sandbox | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, Sandbox]]: if response.status_code == 201: response_201 = Sandbox.from_dict(response.json()) return response_201 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 409: response_409 = Error.from_dict(response.json()) return response_409 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -69,8 +61,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | Sandbox]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, Sandbox]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -84,7 +76,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: ResumedSandbox, -) -> Response[Error | Sandbox]: +) -> Response[Union[Error, Sandbox]]: """Resume the sandbox Args: @@ -96,7 +88,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | Sandbox] + Response[Union[Error, Sandbox]] """ kwargs = _get_kwargs( @@ -116,7 +108,7 @@ def sync( *, client: AuthenticatedClient, body: ResumedSandbox, -) -> Error | Sandbox | None: +) -> Optional[Union[Error, Sandbox]]: """Resume the sandbox Args: @@ -128,7 +120,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | Sandbox + Union[Error, Sandbox] """ return sync_detailed( @@ -143,7 +135,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: ResumedSandbox, -) -> Response[Error | Sandbox]: +) -> Response[Union[Error, Sandbox]]: """Resume the sandbox Args: @@ -155,7 +147,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | Sandbox] + Response[Union[Error, Sandbox]] """ kwargs = _get_kwargs( @@ -173,7 +165,7 @@ async def asyncio( *, client: AuthenticatedClient, body: ResumedSandbox, -) -> Error | Sandbox | None: +) -> Optional[Union[Error, Sandbox]]: """Resume the sandbox Args: @@ -185,7 +177,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | Sandbox + Union[Error, Sandbox] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py index 5dfb6ad62f..2756f30a86 100644 --- a/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py +++ b/packages/python-sdk/e2b/api/client/api/sandboxes/post_sandboxes_sandbox_id_timeout.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any, Optional, Union, cast import httpx @@ -10,25 +9,22 @@ from ...models.post_sandboxes_sandbox_id_timeout_body import ( PostSandboxesSandboxIDTimeoutBody, ) -from ...types import UNSET, Response, Unset +from ...types import Response def _get_kwargs( sandbox_id: str, *, - body: PostSandboxesSandboxIDTimeoutBody | Unset = UNSET, + body: PostSandboxesSandboxIDTimeoutBody, ) -> dict[str, Any]: headers: dict[str, Any] = {} _kwargs: dict[str, Any] = { "method": "post", - "url": "/sandboxes/{sandbox_id}/timeout".format( - sandbox_id=quote(str(sandbox_id), safe=""), - ), + "url": f"/sandboxes/{sandbox_id}/timeout", } - if not isinstance(body, Unset): - _kwargs["json"] = body.to_dict() + _kwargs["json"] = body.to_dict() headers["Content-Type"] = "application/json" @@ -37,27 +33,23 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Any | Error | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Error]]: if response.status_code == 204: response_204 = cast(Any, None) return response_204 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -65,8 +57,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | Error]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Error]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,22 +71,22 @@ def sync_detailed( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDTimeoutBody | Unset = UNSET, -) -> Response[Any | Error]: + body: PostSandboxesSandboxIDTimeoutBody, +) -> Response[Union[Any, Error]]: """Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. Args: sandbox_id (str): - body (PostSandboxesSandboxIDTimeoutBody | Unset): + body (PostSandboxesSandboxIDTimeoutBody): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -113,22 +105,22 @@ def sync( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDTimeoutBody | Unset = UNSET, -) -> Any | Error | None: + body: PostSandboxesSandboxIDTimeoutBody, +) -> Optional[Union[Any, Error]]: """Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. Args: sandbox_id (str): - body (PostSandboxesSandboxIDTimeoutBody | Unset): + body (PostSandboxesSandboxIDTimeoutBody): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return sync_detailed( @@ -142,22 +134,22 @@ async def asyncio_detailed( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDTimeoutBody | Unset = UNSET, -) -> Response[Any | Error]: + body: PostSandboxesSandboxIDTimeoutBody, +) -> Response[Union[Any, Error]]: """Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. Args: sandbox_id (str): - body (PostSandboxesSandboxIDTimeoutBody | Unset): + body (PostSandboxesSandboxIDTimeoutBody): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -174,22 +166,22 @@ async def asyncio( sandbox_id: str, *, client: AuthenticatedClient, - body: PostSandboxesSandboxIDTimeoutBody | Unset = UNSET, -) -> Any | Error | None: + body: PostSandboxesSandboxIDTimeoutBody, +) -> Optional[Union[Any, Error]]: """Set the timeout for the sandbox. The sandbox will expire x seconds from the time of the request. Calling this method multiple times overwrites the TTL, each time using the current timestamp as the starting point to measure the timeout duration. Args: sandbox_id (str): - body (PostSandboxesSandboxIDTimeoutBody | Unset): + body (PostSandboxesSandboxIDTimeoutBody): Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/tags/delete_templates_tags.py b/packages/python-sdk/e2b/api/client/api/tags/delete_templates_tags.py index bcbfcb05a3..16a764aa16 100644 --- a/packages/python-sdk/e2b/api/client/api/tags/delete_templates_tags.py +++ b/packages/python-sdk/e2b/api/client/api/tags/delete_templates_tags.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any, cast +from typing import Any, Optional, Union, cast import httpx @@ -30,32 +30,27 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Any | Error | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Error]]: if response.status_code == 204: response_204 = cast(Any, None) return response_204 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -63,8 +58,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | Error]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Error]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -77,7 +72,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: DeleteTemplateTagsRequest, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Delete multiple tags from templates Args: @@ -88,7 +83,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -106,7 +101,7 @@ def sync( *, client: AuthenticatedClient, body: DeleteTemplateTagsRequest, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Delete multiple tags from templates Args: @@ -117,7 +112,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return sync_detailed( @@ -130,7 +125,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: DeleteTemplateTagsRequest, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Delete multiple tags from templates Args: @@ -141,7 +136,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -157,7 +152,7 @@ async def asyncio( *, client: AuthenticatedClient, body: DeleteTemplateTagsRequest, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Delete multiple tags from templates Args: @@ -168,7 +163,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/tags/post_templates_tags.py b/packages/python-sdk/e2b/api/client/api/tags/post_templates_tags.py index 1590cfb7f9..fbc0ab49ec 100644 --- a/packages/python-sdk/e2b/api/client/api/tags/post_templates_tags.py +++ b/packages/python-sdk/e2b/api/client/api/tags/post_templates_tags.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any +from typing import Any, Optional, Union import httpx @@ -31,33 +31,28 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> AssignedTemplateTags | Error | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[AssignedTemplateTags, Error]]: if response.status_code == 201: response_201 = AssignedTemplateTags.from_dict(response.json()) return response_201 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -65,8 +60,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[AssignedTemplateTags | Error]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[AssignedTemplateTags, Error]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,7 +74,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: AssignTemplateTagsRequest, -) -> Response[AssignedTemplateTags | Error]: +) -> Response[Union[AssignedTemplateTags, Error]]: """Assign tag(s) to a template build Args: @@ -90,7 +85,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[AssignedTemplateTags | Error] + Response[Union[AssignedTemplateTags, Error]] """ kwargs = _get_kwargs( @@ -108,7 +103,7 @@ def sync( *, client: AuthenticatedClient, body: AssignTemplateTagsRequest, -) -> AssignedTemplateTags | Error | None: +) -> Optional[Union[AssignedTemplateTags, Error]]: """Assign tag(s) to a template build Args: @@ -119,7 +114,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - AssignedTemplateTags | Error + Union[AssignedTemplateTags, Error] """ return sync_detailed( @@ -132,7 +127,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: AssignTemplateTagsRequest, -) -> Response[AssignedTemplateTags | Error]: +) -> Response[Union[AssignedTemplateTags, Error]]: """Assign tag(s) to a template build Args: @@ -143,7 +138,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[AssignedTemplateTags | Error] + Response[Union[AssignedTemplateTags, Error]] """ kwargs = _get_kwargs( @@ -159,7 +154,7 @@ async def asyncio( *, client: AuthenticatedClient, body: AssignTemplateTagsRequest, -) -> AssignedTemplateTags | Error | None: +) -> Optional[Union[AssignedTemplateTags, Error]]: """Assign tag(s) to a template build Args: @@ -170,7 +165,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - AssignedTemplateTags | Error + Union[AssignedTemplateTags, Error] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/delete_templates_template_id.py b/packages/python-sdk/e2b/api/client/api/templates/delete_templates_template_id.py index 44f402a81d..d73839c73b 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/delete_templates_template_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/delete_templates_template_id.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any, Optional, Union, cast import httpx @@ -13,34 +12,28 @@ def _get_kwargs( template_id: str, ) -> dict[str, Any]: - _kwargs: dict[str, Any] = { "method": "delete", - "url": "/templates/{template_id}".format( - template_id=quote(str(template_id), safe=""), - ), + "url": f"/templates/{template_id}", } return _kwargs def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Any | Error | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Error]]: if response.status_code == 204: response_204 = cast(Any, None) return response_204 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -48,8 +41,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | Error]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Error]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -62,7 +55,7 @@ def sync_detailed( template_id: str, *, client: AuthenticatedClient, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Delete a template Args: @@ -73,7 +66,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -91,7 +84,7 @@ def sync( template_id: str, *, client: AuthenticatedClient, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Delete a template Args: @@ -102,7 +95,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return sync_detailed( @@ -115,7 +108,7 @@ async def asyncio_detailed( template_id: str, *, client: AuthenticatedClient, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Delete a template Args: @@ -126,7 +119,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -142,7 +135,7 @@ async def asyncio( template_id: str, *, client: AuthenticatedClient, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Delete a template Args: @@ -153,7 +146,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates.py index 414ba6fcdc..a25db12f81 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/get_templates.py +++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any +from typing import Any, Optional, Union import httpx @@ -12,9 +12,8 @@ def _get_kwargs( *, - team_id: str | Unset = UNSET, + team_id: Union[Unset, str] = UNSET, ) -> dict[str, Any]: - params: dict[str, Any] = {} params["teamID"] = team_id @@ -31,8 +30,8 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | list[Template] | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, list["Template"]]]: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -42,17 +41,14 @@ def _parse_response( response_200.append(response_200_item) return response_200 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -60,8 +56,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | list[Template]]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, list["Template"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -73,19 +69,19 @@ def _build_response( def sync_detailed( *, client: AuthenticatedClient, - team_id: str | Unset = UNSET, -) -> Response[Error | list[Template]]: + team_id: Union[Unset, str] = UNSET, +) -> Response[Union[Error, list["Template"]]]: """List all templates Args: - team_id (str | Unset): Identifier of the team + team_id (Union[Unset, str]): Identifier of the team Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | list[Template]] + Response[Union[Error, list['Template']]] """ kwargs = _get_kwargs( @@ -102,19 +98,19 @@ def sync_detailed( def sync( *, client: AuthenticatedClient, - team_id: str | Unset = UNSET, -) -> Error | list[Template] | None: + team_id: Union[Unset, str] = UNSET, +) -> Optional[Union[Error, list["Template"]]]: """List all templates Args: - team_id (str | Unset): Identifier of the team + team_id (Union[Unset, str]): Identifier of the team Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | list[Template] + Union[Error, list['Template']] """ return sync_detailed( @@ -126,19 +122,19 @@ def sync( async def asyncio_detailed( *, client: AuthenticatedClient, - team_id: str | Unset = UNSET, -) -> Response[Error | list[Template]]: + team_id: Union[Unset, str] = UNSET, +) -> Response[Union[Error, list["Template"]]]: """List all templates Args: - team_id (str | Unset): Identifier of the team + team_id (Union[Unset, str]): Identifier of the team Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | list[Template]] + Response[Union[Error, list['Template']]] """ kwargs = _get_kwargs( @@ -153,19 +149,19 @@ async def asyncio_detailed( async def asyncio( *, client: AuthenticatedClient, - team_id: str | Unset = UNSET, -) -> Error | list[Template] | None: + team_id: Union[Unset, str] = UNSET, +) -> Optional[Union[Error, list["Template"]]]: """List all templates Args: - team_id (str | Unset): Identifier of the team + team_id (Union[Unset, str]): Identifier of the team Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | list[Template] + Union[Error, list['Template']] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates_aliases_alias.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates_aliases_alias.py index 1a9e497c7e..c862846d60 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/get_templates_aliases_alias.py +++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates_aliases_alias.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -14,45 +13,37 @@ def _get_kwargs( alias: str, ) -> dict[str, Any]: - _kwargs: dict[str, Any] = { "method": "get", - "url": "/templates/aliases/{alias}".format( - alias=quote(str(alias), safe=""), - ), + "url": f"/templates/aliases/{alias}", } return _kwargs def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | TemplateAliasResponse | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, TemplateAliasResponse]]: if response.status_code == 200: response_200 = TemplateAliasResponse.from_dict(response.json()) return response_200 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 403: response_403 = Error.from_dict(response.json()) return response_403 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -60,8 +51,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | TemplateAliasResponse]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, TemplateAliasResponse]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +65,7 @@ def sync_detailed( alias: str, *, client: AuthenticatedClient, -) -> Response[Error | TemplateAliasResponse]: +) -> Response[Union[Error, TemplateAliasResponse]]: """Check if template with given alias exists Args: @@ -85,7 +76,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateAliasResponse] + Response[Union[Error, TemplateAliasResponse]] """ kwargs = _get_kwargs( @@ -103,7 +94,7 @@ def sync( alias: str, *, client: AuthenticatedClient, -) -> Error | TemplateAliasResponse | None: +) -> Optional[Union[Error, TemplateAliasResponse]]: """Check if template with given alias exists Args: @@ -114,7 +105,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateAliasResponse + Union[Error, TemplateAliasResponse] """ return sync_detailed( @@ -127,7 +118,7 @@ async def asyncio_detailed( alias: str, *, client: AuthenticatedClient, -) -> Response[Error | TemplateAliasResponse]: +) -> Response[Union[Error, TemplateAliasResponse]]: """Check if template with given alias exists Args: @@ -138,7 +129,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateAliasResponse] + Response[Union[Error, TemplateAliasResponse]] """ kwargs = _get_kwargs( @@ -154,7 +145,7 @@ async def asyncio( alias: str, *, client: AuthenticatedClient, -) -> Error | TemplateAliasResponse | None: +) -> Optional[Union[Error, TemplateAliasResponse]]: """Check if template with given alias exists Args: @@ -165,7 +156,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateAliasResponse + Union[Error, TemplateAliasResponse] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id.py index a2fd5c57eb..875f9e945f 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -14,10 +13,9 @@ def _get_kwargs( template_id: str, *, - next_token: str | Unset = UNSET, - limit: int | Unset = 100, + next_token: Union[Unset, str] = UNSET, + limit: Union[Unset, int] = 100, ) -> dict[str, Any]: - params: dict[str, Any] = {} params["nextToken"] = next_token @@ -28,9 +26,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": "/templates/{template_id}".format( - template_id=quote(str(template_id), safe=""), - ), + "url": f"/templates/{template_id}", "params": params, } @@ -38,23 +34,20 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | TemplateWithBuilds | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, TemplateWithBuilds]]: if response.status_code == 200: response_200 = TemplateWithBuilds.from_dict(response.json()) return response_200 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -62,8 +55,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | TemplateWithBuilds]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, TemplateWithBuilds]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -76,22 +69,22 @@ def sync_detailed( template_id: str, *, client: AuthenticatedClient, - next_token: str | Unset = UNSET, - limit: int | Unset = 100, -) -> Response[Error | TemplateWithBuilds]: + next_token: Union[Unset, str] = UNSET, + limit: Union[Unset, int] = 100, +) -> Response[Union[Error, TemplateWithBuilds]]: """List all builds for a template Args: template_id (str): - next_token (str | Unset): - limit (int | Unset): Default: 100. + next_token (Union[Unset, str]): + limit (Union[Unset, int]): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateWithBuilds] + Response[Union[Error, TemplateWithBuilds]] """ kwargs = _get_kwargs( @@ -111,22 +104,22 @@ def sync( template_id: str, *, client: AuthenticatedClient, - next_token: str | Unset = UNSET, - limit: int | Unset = 100, -) -> Error | TemplateWithBuilds | None: + next_token: Union[Unset, str] = UNSET, + limit: Union[Unset, int] = 100, +) -> Optional[Union[Error, TemplateWithBuilds]]: """List all builds for a template Args: template_id (str): - next_token (str | Unset): - limit (int | Unset): Default: 100. + next_token (Union[Unset, str]): + limit (Union[Unset, int]): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateWithBuilds + Union[Error, TemplateWithBuilds] """ return sync_detailed( @@ -141,22 +134,22 @@ async def asyncio_detailed( template_id: str, *, client: AuthenticatedClient, - next_token: str | Unset = UNSET, - limit: int | Unset = 100, -) -> Response[Error | TemplateWithBuilds]: + next_token: Union[Unset, str] = UNSET, + limit: Union[Unset, int] = 100, +) -> Response[Union[Error, TemplateWithBuilds]]: """List all builds for a template Args: template_id (str): - next_token (str | Unset): - limit (int | Unset): Default: 100. + next_token (Union[Unset, str]): + limit (Union[Unset, int]): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateWithBuilds] + Response[Union[Error, TemplateWithBuilds]] """ kwargs = _get_kwargs( @@ -174,22 +167,22 @@ async def asyncio( template_id: str, *, client: AuthenticatedClient, - next_token: str | Unset = UNSET, - limit: int | Unset = 100, -) -> Error | TemplateWithBuilds | None: + next_token: Union[Unset, str] = UNSET, + limit: Union[Unset, int] = 100, +) -> Optional[Union[Error, TemplateWithBuilds]]: """List all builds for a template Args: template_id (str): - next_token (str | Unset): - limit (int | Unset): Default: 100. + next_token (Union[Unset, str]): + limit (Union[Unset, int]): Default: 100. Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateWithBuilds + Union[Error, TemplateWithBuilds] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py index dc668b2808..1f4fee6f31 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py +++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_logs.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -18,32 +17,31 @@ def _get_kwargs( template_id: str, build_id: str, *, - cursor: int | Unset = UNSET, - limit: int | Unset = 100, - direction: LogsDirection | Unset = UNSET, - level: LogLevel | Unset = UNSET, - source: LogsSource | Unset = UNSET, + cursor: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = 100, + direction: Union[Unset, LogsDirection] = UNSET, + level: Union[Unset, LogLevel] = UNSET, + source: Union[Unset, LogsSource] = UNSET, ) -> dict[str, Any]: - params: dict[str, Any] = {} params["cursor"] = cursor params["limit"] = limit - json_direction: str | Unset = UNSET + json_direction: Union[Unset, str] = UNSET if not isinstance(direction, Unset): json_direction = direction.value params["direction"] = json_direction - json_level: str | Unset = UNSET + json_level: Union[Unset, str] = UNSET if not isinstance(level, Unset): json_level = level.value params["level"] = json_level - json_source: str | Unset = UNSET + json_source: Union[Unset, str] = UNSET if not isinstance(source, Unset): json_source = source.value @@ -53,10 +51,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": "/templates/{template_id}/builds/{build_id}/logs".format( - template_id=quote(str(template_id), safe=""), - build_id=quote(str(build_id), safe=""), - ), + "url": f"/templates/{template_id}/builds/{build_id}/logs", "params": params, } @@ -64,28 +59,24 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | TemplateBuildLogsResponse | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, TemplateBuildLogsResponse]]: if response.status_code == 200: response_200 = TemplateBuildLogsResponse.from_dict(response.json()) return response_200 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -93,8 +84,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | TemplateBuildLogsResponse]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, TemplateBuildLogsResponse]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -108,29 +99,29 @@ def sync_detailed( build_id: str, *, client: AuthenticatedClient, - cursor: int | Unset = UNSET, - limit: int | Unset = 100, - direction: LogsDirection | Unset = UNSET, - level: LogLevel | Unset = UNSET, - source: LogsSource | Unset = UNSET, -) -> Response[Error | TemplateBuildLogsResponse]: + cursor: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = 100, + direction: Union[Unset, LogsDirection] = UNSET, + level: Union[Unset, LogLevel] = UNSET, + source: Union[Unset, LogsSource] = UNSET, +) -> Response[Union[Error, TemplateBuildLogsResponse]]: """Get template build logs Args: template_id (str): build_id (str): - cursor (int | Unset): - limit (int | Unset): Default: 100. - direction (LogsDirection | Unset): Direction of the logs that should be returned - level (LogLevel | Unset): State of the sandbox - source (LogsSource | Unset): Source of the logs that should be returned + cursor (Union[Unset, int]): + limit (Union[Unset, int]): Default: 100. + direction (Union[Unset, LogsDirection]): Direction of the logs that should be returned + level (Union[Unset, LogLevel]): State of the sandbox + source (Union[Unset, LogsSource]): Source of the logs that should be returned Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateBuildLogsResponse] + Response[Union[Error, TemplateBuildLogsResponse]] """ kwargs = _get_kwargs( @@ -155,29 +146,29 @@ def sync( build_id: str, *, client: AuthenticatedClient, - cursor: int | Unset = UNSET, - limit: int | Unset = 100, - direction: LogsDirection | Unset = UNSET, - level: LogLevel | Unset = UNSET, - source: LogsSource | Unset = UNSET, -) -> Error | TemplateBuildLogsResponse | None: + cursor: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = 100, + direction: Union[Unset, LogsDirection] = UNSET, + level: Union[Unset, LogLevel] = UNSET, + source: Union[Unset, LogsSource] = UNSET, +) -> Optional[Union[Error, TemplateBuildLogsResponse]]: """Get template build logs Args: template_id (str): build_id (str): - cursor (int | Unset): - limit (int | Unset): Default: 100. - direction (LogsDirection | Unset): Direction of the logs that should be returned - level (LogLevel | Unset): State of the sandbox - source (LogsSource | Unset): Source of the logs that should be returned + cursor (Union[Unset, int]): + limit (Union[Unset, int]): Default: 100. + direction (Union[Unset, LogsDirection]): Direction of the logs that should be returned + level (Union[Unset, LogLevel]): State of the sandbox + source (Union[Unset, LogsSource]): Source of the logs that should be returned Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateBuildLogsResponse + Union[Error, TemplateBuildLogsResponse] """ return sync_detailed( @@ -197,29 +188,29 @@ async def asyncio_detailed( build_id: str, *, client: AuthenticatedClient, - cursor: int | Unset = UNSET, - limit: int | Unset = 100, - direction: LogsDirection | Unset = UNSET, - level: LogLevel | Unset = UNSET, - source: LogsSource | Unset = UNSET, -) -> Response[Error | TemplateBuildLogsResponse]: + cursor: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = 100, + direction: Union[Unset, LogsDirection] = UNSET, + level: Union[Unset, LogLevel] = UNSET, + source: Union[Unset, LogsSource] = UNSET, +) -> Response[Union[Error, TemplateBuildLogsResponse]]: """Get template build logs Args: template_id (str): build_id (str): - cursor (int | Unset): - limit (int | Unset): Default: 100. - direction (LogsDirection | Unset): Direction of the logs that should be returned - level (LogLevel | Unset): State of the sandbox - source (LogsSource | Unset): Source of the logs that should be returned + cursor (Union[Unset, int]): + limit (Union[Unset, int]): Default: 100. + direction (Union[Unset, LogsDirection]): Direction of the logs that should be returned + level (Union[Unset, LogLevel]): State of the sandbox + source (Union[Unset, LogsSource]): Source of the logs that should be returned Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateBuildLogsResponse] + Response[Union[Error, TemplateBuildLogsResponse]] """ kwargs = _get_kwargs( @@ -242,29 +233,29 @@ async def asyncio( build_id: str, *, client: AuthenticatedClient, - cursor: int | Unset = UNSET, - limit: int | Unset = 100, - direction: LogsDirection | Unset = UNSET, - level: LogLevel | Unset = UNSET, - source: LogsSource | Unset = UNSET, -) -> Error | TemplateBuildLogsResponse | None: + cursor: Union[Unset, int] = UNSET, + limit: Union[Unset, int] = 100, + direction: Union[Unset, LogsDirection] = UNSET, + level: Union[Unset, LogLevel] = UNSET, + source: Union[Unset, LogsSource] = UNSET, +) -> Optional[Union[Error, TemplateBuildLogsResponse]]: """Get template build logs Args: template_id (str): build_id (str): - cursor (int | Unset): - limit (int | Unset): Default: 100. - direction (LogsDirection | Unset): Direction of the logs that should be returned - level (LogLevel | Unset): State of the sandbox - source (LogsSource | Unset): Source of the logs that should be returned + cursor (Union[Unset, int]): + limit (Union[Unset, int]): Default: 100. + direction (Union[Unset, LogsDirection]): Direction of the logs that should be returned + level (Union[Unset, LogLevel]): State of the sandbox + source (Union[Unset, LogsSource]): Source of the logs that should be returned Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateBuildLogsResponse + Union[Error, TemplateBuildLogsResponse] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py index 436a368e2d..8185e2e082 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py +++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_builds_build_id_status.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -16,18 +15,17 @@ def _get_kwargs( template_id: str, build_id: str, *, - logs_offset: int | Unset = 0, - limit: int | Unset = 100, - level: LogLevel | Unset = UNSET, + logs_offset: Union[Unset, int] = 0, + limit: Union[Unset, int] = 100, + level: Union[Unset, LogLevel] = UNSET, ) -> dict[str, Any]: - params: dict[str, Any] = {} params["logsOffset"] = logs_offset params["limit"] = limit - json_level: str | Unset = UNSET + json_level: Union[Unset, str] = UNSET if not isinstance(level, Unset): json_level = level.value @@ -37,10 +35,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "get", - "url": "/templates/{template_id}/builds/{build_id}/status".format( - template_id=quote(str(template_id), safe=""), - build_id=quote(str(build_id), safe=""), - ), + "url": f"/templates/{template_id}/builds/{build_id}/status", "params": params, } @@ -48,28 +43,24 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | TemplateBuildInfo | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, TemplateBuildInfo]]: if response.status_code == 200: response_200 = TemplateBuildInfo.from_dict(response.json()) return response_200 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -77,8 +68,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | TemplateBuildInfo]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, TemplateBuildInfo]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -92,25 +83,25 @@ def sync_detailed( build_id: str, *, client: AuthenticatedClient, - logs_offset: int | Unset = 0, - limit: int | Unset = 100, - level: LogLevel | Unset = UNSET, -) -> Response[Error | TemplateBuildInfo]: + logs_offset: Union[Unset, int] = 0, + limit: Union[Unset, int] = 100, + level: Union[Unset, LogLevel] = UNSET, +) -> Response[Union[Error, TemplateBuildInfo]]: """Get template build info Args: template_id (str): build_id (str): - logs_offset (int | Unset): Default: 0. - limit (int | Unset): Default: 100. - level (LogLevel | Unset): State of the sandbox + logs_offset (Union[Unset, int]): Default: 0. + limit (Union[Unset, int]): Default: 100. + level (Union[Unset, LogLevel]): State of the sandbox Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateBuildInfo] + Response[Union[Error, TemplateBuildInfo]] """ kwargs = _get_kwargs( @@ -133,25 +124,25 @@ def sync( build_id: str, *, client: AuthenticatedClient, - logs_offset: int | Unset = 0, - limit: int | Unset = 100, - level: LogLevel | Unset = UNSET, -) -> Error | TemplateBuildInfo | None: + logs_offset: Union[Unset, int] = 0, + limit: Union[Unset, int] = 100, + level: Union[Unset, LogLevel] = UNSET, +) -> Optional[Union[Error, TemplateBuildInfo]]: """Get template build info Args: template_id (str): build_id (str): - logs_offset (int | Unset): Default: 0. - limit (int | Unset): Default: 100. - level (LogLevel | Unset): State of the sandbox + logs_offset (Union[Unset, int]): Default: 0. + limit (Union[Unset, int]): Default: 100. + level (Union[Unset, LogLevel]): State of the sandbox Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateBuildInfo + Union[Error, TemplateBuildInfo] """ return sync_detailed( @@ -169,25 +160,25 @@ async def asyncio_detailed( build_id: str, *, client: AuthenticatedClient, - logs_offset: int | Unset = 0, - limit: int | Unset = 100, - level: LogLevel | Unset = UNSET, -) -> Response[Error | TemplateBuildInfo]: + logs_offset: Union[Unset, int] = 0, + limit: Union[Unset, int] = 100, + level: Union[Unset, LogLevel] = UNSET, +) -> Response[Union[Error, TemplateBuildInfo]]: """Get template build info Args: template_id (str): build_id (str): - logs_offset (int | Unset): Default: 0. - limit (int | Unset): Default: 100. - level (LogLevel | Unset): State of the sandbox + logs_offset (Union[Unset, int]): Default: 0. + limit (Union[Unset, int]): Default: 100. + level (Union[Unset, LogLevel]): State of the sandbox Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateBuildInfo] + Response[Union[Error, TemplateBuildInfo]] """ kwargs = _get_kwargs( @@ -208,25 +199,25 @@ async def asyncio( build_id: str, *, client: AuthenticatedClient, - logs_offset: int | Unset = 0, - limit: int | Unset = 100, - level: LogLevel | Unset = UNSET, -) -> Error | TemplateBuildInfo | None: + logs_offset: Union[Unset, int] = 0, + limit: Union[Unset, int] = 100, + level: Union[Unset, LogLevel] = UNSET, +) -> Optional[Union[Error, TemplateBuildInfo]]: """Get template build info Args: template_id (str): build_id (str): - logs_offset (int | Unset): Default: 0. - limit (int | Unset): Default: 100. - level (LogLevel | Unset): State of the sandbox + logs_offset (Union[Unset, int]): Default: 0. + limit (Union[Unset, int]): Default: 100. + level (Union[Unset, LogLevel]): State of the sandbox Raises: errors.UnexpectedStatus: If the server returns an undocumented status code and Client.raise_on_unexpected_status is True. httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateBuildInfo + Union[Error, TemplateBuildInfo] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_files_hash.py b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_files_hash.py index 67d18c684a..0f6a1e4cac 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_files_hash.py +++ b/packages/python-sdk/e2b/api/client/api/templates/get_templates_template_id_files_hash.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -15,46 +14,37 @@ def _get_kwargs( template_id: str, hash_: str, ) -> dict[str, Any]: - _kwargs: dict[str, Any] = { "method": "get", - "url": "/templates/{template_id}/files/{hash_}".format( - template_id=quote(str(template_id), safe=""), - hash_=quote(str(hash_), safe=""), - ), + "url": f"/templates/{template_id}/files/{hash_}", } return _kwargs def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | TemplateBuildFileUpload | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, TemplateBuildFileUpload]]: if response.status_code == 201: response_201 = TemplateBuildFileUpload.from_dict(response.json()) return response_201 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -62,8 +52,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | TemplateBuildFileUpload]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, TemplateBuildFileUpload]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -77,7 +67,7 @@ def sync_detailed( hash_: str, *, client: AuthenticatedClient, -) -> Response[Error | TemplateBuildFileUpload]: +) -> Response[Union[Error, TemplateBuildFileUpload]]: """Get an upload link for a tar file containing build layer files Args: @@ -89,7 +79,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateBuildFileUpload] + Response[Union[Error, TemplateBuildFileUpload]] """ kwargs = _get_kwargs( @@ -109,7 +99,7 @@ def sync( hash_: str, *, client: AuthenticatedClient, -) -> Error | TemplateBuildFileUpload | None: +) -> Optional[Union[Error, TemplateBuildFileUpload]]: """Get an upload link for a tar file containing build layer files Args: @@ -121,7 +111,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateBuildFileUpload + Union[Error, TemplateBuildFileUpload] """ return sync_detailed( @@ -136,7 +126,7 @@ async def asyncio_detailed( hash_: str, *, client: AuthenticatedClient, -) -> Response[Error | TemplateBuildFileUpload]: +) -> Response[Union[Error, TemplateBuildFileUpload]]: """Get an upload link for a tar file containing build layer files Args: @@ -148,7 +138,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateBuildFileUpload] + Response[Union[Error, TemplateBuildFileUpload]] """ kwargs = _get_kwargs( @@ -166,7 +156,7 @@ async def asyncio( hash_: str, *, client: AuthenticatedClient, -) -> Error | TemplateBuildFileUpload | None: +) -> Optional[Union[Error, TemplateBuildFileUpload]]: """Get an upload link for a tar file containing build layer files Args: @@ -178,7 +168,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateBuildFileUpload + Union[Error, TemplateBuildFileUpload] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/patch_templates_template_id.py b/packages/python-sdk/e2b/api/client/api/templates/patch_templates_template_id.py index 7e87e2ef6d..cf19391f40 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/patch_templates_template_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/patch_templates_template_id.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any, Optional, Union, cast import httpx @@ -20,9 +19,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "patch", - "url": "/templates/{template_id}".format( - template_id=quote(str(template_id), safe=""), - ), + "url": f"/templates/{template_id}", } _kwargs["json"] = body.to_dict() @@ -34,27 +31,23 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Any | Error | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Error]]: if response.status_code == 200: response_200 = cast(Any, None) return response_200 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -62,8 +55,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | Error]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Error]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -77,7 +70,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Update template Args: @@ -89,7 +82,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -109,7 +102,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Update template Args: @@ -121,7 +114,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return sync_detailed( @@ -136,7 +129,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Update template Args: @@ -148,7 +141,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -166,7 +159,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Update template Args: @@ -178,7 +171,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/patch_v_2_templates_template_id.py b/packages/python-sdk/e2b/api/client/api/templates/patch_v_2_templates_template_id.py index bc638bc908..b262332534 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/patch_v_2_templates_template_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/patch_v_2_templates_template_id.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -21,9 +20,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "patch", - "url": "/v2/templates/{template_id}".format( - template_id=quote(str(template_id), safe=""), - ), + "url": f"/v2/templates/{template_id}", } _kwargs["json"] = body.to_dict() @@ -35,28 +32,24 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | TemplateUpdateResponse | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, TemplateUpdateResponse]]: if response.status_code == 200: response_200 = TemplateUpdateResponse.from_dict(response.json()) return response_200 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -64,8 +57,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | TemplateUpdateResponse]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, TemplateUpdateResponse]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -79,7 +72,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Response[Error | TemplateUpdateResponse]: +) -> Response[Union[Error, TemplateUpdateResponse]]: """Update template Args: @@ -91,7 +84,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateUpdateResponse] + Response[Union[Error, TemplateUpdateResponse]] """ kwargs = _get_kwargs( @@ -111,7 +104,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Error | TemplateUpdateResponse | None: +) -> Optional[Union[Error, TemplateUpdateResponse]]: """Update template Args: @@ -123,7 +116,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateUpdateResponse + Union[Error, TemplateUpdateResponse] """ return sync_detailed( @@ -138,7 +131,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Response[Error | TemplateUpdateResponse]: +) -> Response[Union[Error, TemplateUpdateResponse]]: """Update template Args: @@ -150,7 +143,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateUpdateResponse] + Response[Union[Error, TemplateUpdateResponse]] """ kwargs = _get_kwargs( @@ -168,7 +161,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateUpdateRequest, -) -> Error | TemplateUpdateResponse | None: +) -> Optional[Union[Error, TemplateUpdateResponse]]: """Update template Args: @@ -180,7 +173,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateUpdateResponse + Union[Error, TemplateUpdateResponse] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_templates.py b/packages/python-sdk/e2b/api/client/api/templates/post_templates.py index c618f883d8..015b0d9115 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/post_templates.py +++ b/packages/python-sdk/e2b/api/client/api/templates/post_templates.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any +from typing import Any, Optional, Union import httpx @@ -31,28 +31,24 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | TemplateLegacy | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, TemplateLegacy]]: if response.status_code == 202: response_202 = TemplateLegacy.from_dict(response.json()) return response_202 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -60,8 +56,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | TemplateLegacy]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, TemplateLegacy]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +70,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Response[Error | TemplateLegacy]: +) -> Response[Union[Error, TemplateLegacy]]: """Create a new template Args: @@ -85,7 +81,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateLegacy] + Response[Union[Error, TemplateLegacy]] """ kwargs = _get_kwargs( @@ -103,7 +99,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Error | TemplateLegacy | None: +) -> Optional[Union[Error, TemplateLegacy]]: """Create a new template Args: @@ -114,7 +110,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateLegacy + Union[Error, TemplateLegacy] """ return sync_detailed( @@ -127,7 +123,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Response[Error | TemplateLegacy]: +) -> Response[Union[Error, TemplateLegacy]]: """Create a new template Args: @@ -138,7 +134,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateLegacy] + Response[Union[Error, TemplateLegacy]] """ kwargs = _get_kwargs( @@ -154,7 +150,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Error | TemplateLegacy | None: +) -> Optional[Union[Error, TemplateLegacy]]: """Create a new template Args: @@ -165,7 +161,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateLegacy + Union[Error, TemplateLegacy] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id.py b/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id.py index 749aae113e..986a3b51f3 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -21,9 +20,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": "/templates/{template_id}".format( - template_id=quote(str(template_id), safe=""), - ), + "url": f"/templates/{template_id}", } _kwargs["json"] = body.to_dict() @@ -35,23 +32,20 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | TemplateLegacy | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, TemplateLegacy]]: if response.status_code == 202: response_202 = TemplateLegacy.from_dict(response.json()) return response_202 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -59,8 +53,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | TemplateLegacy]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, TemplateLegacy]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +68,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Response[Error | TemplateLegacy]: +) -> Response[Union[Error, TemplateLegacy]]: """Rebuild an template Args: @@ -86,7 +80,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateLegacy] + Response[Union[Error, TemplateLegacy]] """ kwargs = _get_kwargs( @@ -106,7 +100,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Error | TemplateLegacy | None: +) -> Optional[Union[Error, TemplateLegacy]]: """Rebuild an template Args: @@ -118,7 +112,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateLegacy + Union[Error, TemplateLegacy] """ return sync_detailed( @@ -133,7 +127,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Response[Error | TemplateLegacy]: +) -> Response[Union[Error, TemplateLegacy]]: """Rebuild an template Args: @@ -145,7 +139,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateLegacy] + Response[Union[Error, TemplateLegacy]] """ kwargs = _get_kwargs( @@ -163,7 +157,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateBuildRequest, -) -> Error | TemplateLegacy | None: +) -> Optional[Union[Error, TemplateLegacy]]: """Rebuild an template Args: @@ -175,7 +169,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateLegacy + Union[Error, TemplateLegacy] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id_builds_build_id.py b/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id_builds_build_id.py index a4ce2bae20..d2709ffd44 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id_builds_build_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/post_templates_template_id_builds_build_id.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any, Optional, Union, cast import httpx @@ -14,35 +13,28 @@ def _get_kwargs( template_id: str, build_id: str, ) -> dict[str, Any]: - _kwargs: dict[str, Any] = { "method": "post", - "url": "/templates/{template_id}/builds/{build_id}".format( - template_id=quote(str(template_id), safe=""), - build_id=quote(str(build_id), safe=""), - ), + "url": f"/templates/{template_id}/builds/{build_id}", } return _kwargs def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Any | Error | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Error]]: if response.status_code == 202: response_202 = cast(Any, None) return response_202 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -50,8 +42,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | Error]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Error]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -65,7 +57,7 @@ def sync_detailed( build_id: str, *, client: AuthenticatedClient, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Start the build Args: @@ -77,7 +69,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -97,7 +89,7 @@ def sync( build_id: str, *, client: AuthenticatedClient, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Start the build Args: @@ -109,7 +101,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return sync_detailed( @@ -124,7 +116,7 @@ async def asyncio_detailed( build_id: str, *, client: AuthenticatedClient, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Start the build Args: @@ -136,7 +128,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -154,7 +146,7 @@ async def asyncio( build_id: str, *, client: AuthenticatedClient, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Start the build Args: @@ -166,7 +158,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_v2_templates.py b/packages/python-sdk/e2b/api/client/api/templates/post_v2_templates.py index 4ffe74da7b..86b5ebeb05 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/post_v2_templates.py +++ b/packages/python-sdk/e2b/api/client/api/templates/post_v2_templates.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any +from typing import Any, Optional, Union import httpx @@ -31,28 +31,24 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | TemplateLegacy | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, TemplateLegacy]]: if response.status_code == 202: response_202 = TemplateLegacy.from_dict(response.json()) return response_202 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -60,8 +56,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | TemplateLegacy]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, TemplateLegacy]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +70,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequestV2, -) -> Response[Error | TemplateLegacy]: +) -> Response[Union[Error, TemplateLegacy]]: """Create a new template Args: @@ -85,7 +81,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateLegacy] + Response[Union[Error, TemplateLegacy]] """ kwargs = _get_kwargs( @@ -103,7 +99,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateBuildRequestV2, -) -> Error | TemplateLegacy | None: +) -> Optional[Union[Error, TemplateLegacy]]: """Create a new template Args: @@ -114,7 +110,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateLegacy + Union[Error, TemplateLegacy] """ return sync_detailed( @@ -127,7 +123,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequestV2, -) -> Response[Error | TemplateLegacy]: +) -> Response[Union[Error, TemplateLegacy]]: """Create a new template Args: @@ -138,7 +134,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateLegacy] + Response[Union[Error, TemplateLegacy]] """ kwargs = _get_kwargs( @@ -154,7 +150,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateBuildRequestV2, -) -> Error | TemplateLegacy | None: +) -> Optional[Union[Error, TemplateLegacy]]: """Create a new template Args: @@ -165,7 +161,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateLegacy + Union[Error, TemplateLegacy] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_v3_templates.py b/packages/python-sdk/e2b/api/client/api/templates/post_v3_templates.py index 92268d5f01..4a39ba3f2e 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/post_v3_templates.py +++ b/packages/python-sdk/e2b/api/client/api/templates/post_v3_templates.py @@ -1,5 +1,5 @@ from http import HTTPStatus -from typing import Any +from typing import Any, Optional, Union import httpx @@ -31,28 +31,24 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | TemplateRequestResponseV3 | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, TemplateRequestResponseV3]]: if response.status_code == 202: response_202 = TemplateRequestResponseV3.from_dict(response.json()) return response_202 - if response.status_code == 400: response_400 = Error.from_dict(response.json()) return response_400 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -60,8 +56,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | TemplateRequestResponseV3]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, TemplateRequestResponseV3]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +70,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequestV3, -) -> Response[Error | TemplateRequestResponseV3]: +) -> Response[Union[Error, TemplateRequestResponseV3]]: """Create a new template Args: @@ -85,7 +81,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateRequestResponseV3] + Response[Union[Error, TemplateRequestResponseV3]] """ kwargs = _get_kwargs( @@ -103,7 +99,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateBuildRequestV3, -) -> Error | TemplateRequestResponseV3 | None: +) -> Optional[Union[Error, TemplateRequestResponseV3]]: """Create a new template Args: @@ -114,7 +110,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateRequestResponseV3 + Union[Error, TemplateRequestResponseV3] """ return sync_detailed( @@ -127,7 +123,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateBuildRequestV3, -) -> Response[Error | TemplateRequestResponseV3]: +) -> Response[Union[Error, TemplateRequestResponseV3]]: """Create a new template Args: @@ -138,7 +134,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | TemplateRequestResponseV3] + Response[Union[Error, TemplateRequestResponseV3]] """ kwargs = _get_kwargs( @@ -154,7 +150,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateBuildRequestV3, -) -> Error | TemplateRequestResponseV3 | None: +) -> Optional[Union[Error, TemplateRequestResponseV3]]: """Create a new template Args: @@ -165,7 +161,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | TemplateRequestResponseV3 + Union[Error, TemplateRequestResponseV3] """ return ( diff --git a/packages/python-sdk/e2b/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py b/packages/python-sdk/e2b/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py index 47f9599d1e..0d3da1fb5e 100644 --- a/packages/python-sdk/e2b/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py +++ b/packages/python-sdk/e2b/api/client/api/templates/post_v_2_templates_template_id_builds_build_id.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any, cast -from urllib.parse import quote +from typing import Any, Optional, Union, cast import httpx @@ -21,10 +20,7 @@ def _get_kwargs( _kwargs: dict[str, Any] = { "method": "post", - "url": "/v2/templates/{template_id}/builds/{build_id}".format( - template_id=quote(str(template_id), safe=""), - build_id=quote(str(build_id), safe=""), - ), + "url": f"/v2/templates/{template_id}/builds/{build_id}", } _kwargs["json"] = body.to_dict() @@ -36,22 +32,19 @@ def _get_kwargs( def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Any | Error | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Any, Error]]: if response.status_code == 202: response_202 = cast(Any, None) return response_202 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -59,8 +52,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Any | Error]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Any, Error]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -75,7 +68,7 @@ def sync_detailed( *, client: AuthenticatedClient, body: TemplateBuildStartV2, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Start the build Args: @@ -88,7 +81,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -110,7 +103,7 @@ def sync( *, client: AuthenticatedClient, body: TemplateBuildStartV2, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Start the build Args: @@ -123,7 +116,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return sync_detailed( @@ -140,7 +133,7 @@ async def asyncio_detailed( *, client: AuthenticatedClient, body: TemplateBuildStartV2, -) -> Response[Any | Error]: +) -> Response[Union[Any, Error]]: """Start the build Args: @@ -153,7 +146,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Any | Error] + Response[Union[Any, Error]] """ kwargs = _get_kwargs( @@ -173,7 +166,7 @@ async def asyncio( *, client: AuthenticatedClient, body: TemplateBuildStartV2, -) -> Any | Error | None: +) -> Optional[Union[Any, Error]]: """Start the build Args: @@ -186,7 +179,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Any | Error + Union[Any, Error] """ return ( diff --git a/packages/python-sdk/e2b/api/client/client.py b/packages/python-sdk/e2b/api/client/client.py index 0ab15895e7..eeffd00c86 100644 --- a/packages/python-sdk/e2b/api/client/client.py +++ b/packages/python-sdk/e2b/api/client/client.py @@ -1,5 +1,5 @@ import ssl -from typing import Any +from typing import Any, Optional, Union import httpx from attrs import define, evolve, field @@ -38,16 +38,18 @@ class Client: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") - _verify_ssl: str | bool | ssl.SSLContext = field( + _timeout: Optional[httpx.Timeout] = field( + default=None, kw_only=True, alias="timeout" + ) + _verify_ssl: Union[str, bool, ssl.SSLContext] = field( default=True, kw_only=True, alias="verify_ssl" ) _follow_redirects: bool = field( default=False, kw_only=True, alias="follow_redirects" ) _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _client: Optional[httpx.Client] = field(default=None, init=False) + _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) def with_headers(self, headers: dict[str, str]) -> "Client": """Get a new client matching this one with additional headers""" @@ -66,7 +68,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "Client": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "Client": - """Get a new client matching this one with a new timeout configuration""" + """Get a new client matching this one with a new timeout (in seconds)""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -105,7 +107,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: self.get_httpx_client().__exit__(*args, **kwargs) def set_async_httpx_client(self, async_client: httpx.AsyncClient) -> "Client": - """Manually set the underlying httpx.AsyncClient + """Manually the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ @@ -172,16 +174,18 @@ class AuthenticatedClient: _base_url: str = field(alias="base_url") _cookies: dict[str, str] = field(factory=dict, kw_only=True, alias="cookies") _headers: dict[str, str] = field(factory=dict, kw_only=True, alias="headers") - _timeout: httpx.Timeout | None = field(default=None, kw_only=True, alias="timeout") - _verify_ssl: str | bool | ssl.SSLContext = field( + _timeout: Optional[httpx.Timeout] = field( + default=None, kw_only=True, alias="timeout" + ) + _verify_ssl: Union[str, bool, ssl.SSLContext] = field( default=True, kw_only=True, alias="verify_ssl" ) _follow_redirects: bool = field( default=False, kw_only=True, alias="follow_redirects" ) _httpx_args: dict[str, Any] = field(factory=dict, kw_only=True, alias="httpx_args") - _client: httpx.Client | None = field(default=None, init=False) - _async_client: httpx.AsyncClient | None = field(default=None, init=False) + _client: Optional[httpx.Client] = field(default=None, init=False) + _async_client: Optional[httpx.AsyncClient] = field(default=None, init=False) token: str prefix: str = "Bearer" @@ -204,7 +208,7 @@ def with_cookies(self, cookies: dict[str, str]) -> "AuthenticatedClient": return evolve(self, cookies={**self._cookies, **cookies}) def with_timeout(self, timeout: httpx.Timeout) -> "AuthenticatedClient": - """Get a new client matching this one with a new timeout configuration""" + """Get a new client matching this one with a new timeout (in seconds)""" if self._client is not None: self._client.timeout = timeout if self._async_client is not None: @@ -248,7 +252,7 @@ def __exit__(self, *args: Any, **kwargs: Any) -> None: def set_async_httpx_client( self, async_client: httpx.AsyncClient ) -> "AuthenticatedClient": - """Manually set the underlying httpx.AsyncClient + """Manually the underlying httpx.AsyncClient **NOTE**: This will override any other settings on the client, including cookies, headers, and timeout. """ diff --git a/packages/python-sdk/e2b/api/client/models/admin_sandbox_kill_result.py b/packages/python-sdk/e2b/api/client/models/admin_sandbox_kill_result.py index fb6bd10b92..ac1df89119 100644 --- a/packages/python-sdk/e2b/api/client/models/admin_sandbox_kill_result.py +++ b/packages/python-sdk/e2b/api/client/models/admin_sandbox_kill_result.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/assign_template_tags_request.py b/packages/python-sdk/e2b/api/client/models/assign_template_tags_request.py index 8a9114287d..3fb10a069a 100644 --- a/packages/python-sdk/e2b/api/client/models/assign_template_tags_request.py +++ b/packages/python-sdk/e2b/api/client/models/assign_template_tags_request.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar, cast diff --git a/packages/python-sdk/e2b/api/client/models/assigned_template_tags.py b/packages/python-sdk/e2b/api/client/models/assigned_template_tags.py index ad1d77240d..7f9ecaa7ff 100644 --- a/packages/python-sdk/e2b/api/client/models/assigned_template_tags.py +++ b/packages/python-sdk/e2b/api/client/models/assigned_template_tags.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar, cast from uuid import UUID diff --git a/packages/python-sdk/e2b/api/client/models/aws_registry.py b/packages/python-sdk/e2b/api/client/models/aws_registry.py index 7b966fd56e..ef1ea97482 100644 --- a/packages/python-sdk/e2b/api/client/models/aws_registry.py +++ b/packages/python-sdk/e2b/api/client/models/aws_registry.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/build_log_entry.py b/packages/python-sdk/e2b/api/client/models/build_log_entry.py index a8c56798c3..35cae954ff 100644 --- a/packages/python-sdk/e2b/api/client/models/build_log_entry.py +++ b/packages/python-sdk/e2b/api/client/models/build_log_entry.py @@ -1,8 +1,6 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping -from typing import Any, TypeVar +from typing import Any, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -21,13 +19,13 @@ class BuildLogEntry: level (LogLevel): State of the sandbox message (str): Log message content timestamp (datetime.datetime): Timestamp of the log entry - step (str | Unset): Step in the build process related to the log entry + step (Union[Unset, str]): Step in the build process related to the log entry """ level: LogLevel message: str timestamp: datetime.datetime - step: str | Unset = UNSET + step: Union[Unset, str] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/build_status_reason.py b/packages/python-sdk/e2b/api/client/models/build_status_reason.py index ce9ac0c7a2..e2af40317a 100644 --- a/packages/python-sdk/e2b/api/client/models/build_status_reason.py +++ b/packages/python-sdk/e2b/api/client/models/build_status_reason.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar +from typing import TYPE_CHECKING, Any, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -20,19 +18,19 @@ class BuildStatusReason: """ Attributes: message (str): Message with the status reason, currently reporting only for error status - log_entries (list[BuildLogEntry] | Unset): Log entries related to the status reason - step (str | Unset): Step that failed + log_entries (Union[Unset, list['BuildLogEntry']]): Log entries related to the status reason + step (Union[Unset, str]): Step that failed """ message: str - log_entries: list[BuildLogEntry] | Unset = UNSET - step: str | Unset = UNSET + log_entries: Union[Unset, list["BuildLogEntry"]] = UNSET + step: Union[Unset, str] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: message = self.message - log_entries: list[dict[str, Any]] | Unset = UNSET + log_entries: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.log_entries, Unset): log_entries = [] for log_entries_item_data in self.log_entries: @@ -62,14 +60,12 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: d = dict(src_dict) message = d.pop("message") + log_entries = [] _log_entries = d.pop("logEntries", UNSET) - log_entries: list[BuildLogEntry] | Unset = UNSET - if _log_entries is not UNSET: - log_entries = [] - for log_entries_item_data in _log_entries: - log_entries_item = BuildLogEntry.from_dict(log_entries_item_data) + for log_entries_item_data in _log_entries or []: + log_entries_item = BuildLogEntry.from_dict(log_entries_item_data) - log_entries.append(log_entries_item) + log_entries.append(log_entries_item) step = d.pop("step", UNSET) diff --git a/packages/python-sdk/e2b/api/client/models/connect_sandbox.py b/packages/python-sdk/e2b/api/client/models/connect_sandbox.py index a2166e269a..de7a8f8c19 100644 --- a/packages/python-sdk/e2b/api/client/models/connect_sandbox.py +++ b/packages/python-sdk/e2b/api/client/models/connect_sandbox.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/created_access_token.py b/packages/python-sdk/e2b/api/client/models/created_access_token.py index 4457641a22..04224adbc5 100644 --- a/packages/python-sdk/e2b/api/client/models/created_access_token.py +++ b/packages/python-sdk/e2b/api/client/models/created_access_token.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -29,7 +27,7 @@ class CreatedAccessToken: created_at: datetime.datetime id: UUID - mask: IdentifierMaskingDetails + mask: "IdentifierMaskingDetails" name: str token: str additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) diff --git a/packages/python-sdk/e2b/api/client/models/created_team_api_key.py b/packages/python-sdk/e2b/api/client/models/created_team_api_key.py index 55b2a1f79d..f1d4150b7f 100644 --- a/packages/python-sdk/e2b/api/client/models/created_team_api_key.py +++ b/packages/python-sdk/e2b/api/client/models/created_team_api_key.py @@ -1,8 +1,6 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, cast +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast from uuid import UUID from attrs import define as _attrs_define @@ -28,17 +26,17 @@ class CreatedTeamAPIKey: key (str): Raw value of the API key mask (IdentifierMaskingDetails): name (str): Name of the API key - created_by (None | TeamUser | Unset): - last_used (datetime.datetime | None | Unset): Last time this API key was used + created_by (Union['TeamUser', None, Unset]): + last_used (Union[None, Unset, datetime.datetime]): Last time this API key was used """ created_at: datetime.datetime id: UUID key: str - mask: IdentifierMaskingDetails + mask: "IdentifierMaskingDetails" name: str - created_by: None | TeamUser | Unset = UNSET - last_used: datetime.datetime | None | Unset = UNSET + created_by: Union["TeamUser", None, Unset] = UNSET + last_used: Union[None, Unset, datetime.datetime] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -54,7 +52,7 @@ def to_dict(self) -> dict[str, Any]: name = self.name - created_by: dict[str, Any] | None | Unset + created_by: Union[None, Unset, dict[str, Any]] if isinstance(self.created_by, Unset): created_by = UNSET elif isinstance(self.created_by, TeamUser): @@ -62,7 +60,7 @@ def to_dict(self) -> dict[str, Any]: else: created_by = self.created_by - last_used: None | str | Unset + last_used: Union[None, Unset, str] if isinstance(self.last_used, Unset): last_used = UNSET elif isinstance(self.last_used, datetime.datetime): @@ -104,7 +102,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: name = d.pop("name") - def _parse_created_by(data: object) -> None | TeamUser | Unset: + def _parse_created_by(data: object) -> Union["TeamUser", None, Unset]: if data is None: return data if isinstance(data, Unset): @@ -115,13 +113,13 @@ def _parse_created_by(data: object) -> None | TeamUser | Unset: created_by_type_1 = TeamUser.from_dict(data) return created_by_type_1 - except (TypeError, ValueError, AttributeError, KeyError): + except: # noqa: E722 pass - return cast(None | TeamUser | Unset, data) + return cast(Union["TeamUser", None, Unset], data) created_by = _parse_created_by(d.pop("createdBy", UNSET)) - def _parse_last_used(data: object) -> datetime.datetime | None | Unset: + def _parse_last_used(data: object) -> Union[None, Unset, datetime.datetime]: if data is None: return data if isinstance(data, Unset): @@ -132,9 +130,9 @@ def _parse_last_used(data: object) -> datetime.datetime | None | Unset: last_used_type_0 = isoparse(data) return last_used_type_0 - except (TypeError, ValueError, AttributeError, KeyError): + except: # noqa: E722 pass - return cast(datetime.datetime | None | Unset, data) + return cast(Union[None, Unset, datetime.datetime], data) last_used = _parse_last_used(d.pop("lastUsed", UNSET)) diff --git a/packages/python-sdk/e2b/api/client/models/delete_template_tags_request.py b/packages/python-sdk/e2b/api/client/models/delete_template_tags_request.py index 808a535445..2aa06ae9ac 100644 --- a/packages/python-sdk/e2b/api/client/models/delete_template_tags_request.py +++ b/packages/python-sdk/e2b/api/client/models/delete_template_tags_request.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar, cast diff --git a/packages/python-sdk/e2b/api/client/models/disk_metrics.py b/packages/python-sdk/e2b/api/client/models/disk_metrics.py index fb2c06b06d..6d2b75c8ff 100644 --- a/packages/python-sdk/e2b/api/client/models/disk_metrics.py +++ b/packages/python-sdk/e2b/api/client/models/disk_metrics.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/error.py b/packages/python-sdk/e2b/api/client/models/error.py index d4730116bc..362b4361e9 100644 --- a/packages/python-sdk/e2b/api/client/models/error.py +++ b/packages/python-sdk/e2b/api/client/models/error.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/gcp_registry.py b/packages/python-sdk/e2b/api/client/models/gcp_registry.py index fbab87459e..01b6ded008 100644 --- a/packages/python-sdk/e2b/api/client/models/gcp_registry.py +++ b/packages/python-sdk/e2b/api/client/models/gcp_registry.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/general_registry.py b/packages/python-sdk/e2b/api/client/models/general_registry.py index ad0a3c97ca..38bc1795d7 100644 --- a/packages/python-sdk/e2b/api/client/models/general_registry.py +++ b/packages/python-sdk/e2b/api/client/models/general_registry.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/identifier_masking_details.py b/packages/python-sdk/e2b/api/client/models/identifier_masking_details.py index 12e5012411..60c0bdedb3 100644 --- a/packages/python-sdk/e2b/api/client/models/identifier_masking_details.py +++ b/packages/python-sdk/e2b/api/client/models/identifier_masking_details.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/listed_sandbox.py b/packages/python-sdk/e2b/api/client/models/listed_sandbox.py index bd0b1ca86f..2d385a48e3 100644 --- a/packages/python-sdk/e2b/api/client/models/listed_sandbox.py +++ b/packages/python-sdk/e2b/api/client/models/listed_sandbox.py @@ -1,8 +1,6 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping -from typing import Any, TypeVar +from typing import Any, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -28,8 +26,8 @@ class ListedSandbox: started_at (datetime.datetime): Time when the sandbox was started state (SandboxState): State of the sandbox template_id (str): Identifier of the template from which is the sandbox created - alias (str | Unset): Alias of the template - metadata (Any | Unset): + alias (Union[Unset, str]): Alias of the template + metadata (Union[Unset, Any]): """ client_id: str @@ -42,8 +40,8 @@ class ListedSandbox: started_at: datetime.datetime state: SandboxState template_id: str - alias: str | Unset = UNSET - metadata: Any | Unset = UNSET + alias: Union[Unset, str] = UNSET + metadata: Union[Unset, Any] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/machine_info.py b/packages/python-sdk/e2b/api/client/models/machine_info.py index 6619610335..cd63ef0cb3 100644 --- a/packages/python-sdk/e2b/api/client/models/machine_info.py +++ b/packages/python-sdk/e2b/api/client/models/machine_info.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/max_team_metric.py b/packages/python-sdk/e2b/api/client/models/max_team_metric.py index 9b2b8b5051..4a9c3e5268 100644 --- a/packages/python-sdk/e2b/api/client/models/max_team_metric.py +++ b/packages/python-sdk/e2b/api/client/models/max_team_metric.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/mcp_type_0.py b/packages/python-sdk/e2b/api/client/models/mcp_type_0.py index 138344eb7e..a58d6ea245 100644 --- a/packages/python-sdk/e2b/api/client/models/mcp_type_0.py +++ b/packages/python-sdk/e2b/api/client/models/mcp_type_0.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar @@ -16,7 +14,6 @@ class McpType0: additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) diff --git a/packages/python-sdk/e2b/api/client/models/new_access_token.py b/packages/python-sdk/e2b/api/client/models/new_access_token.py index 2e358141bf..642dac80d4 100644 --- a/packages/python-sdk/e2b/api/client/models/new_access_token.py +++ b/packages/python-sdk/e2b/api/client/models/new_access_token.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/new_sandbox.py b/packages/python-sdk/e2b/api/client/models/new_sandbox.py index becee7a345..1f80c900c4 100644 --- a/packages/python-sdk/e2b/api/client/models/new_sandbox.py +++ b/packages/python-sdk/e2b/api/client/models/new_sandbox.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, cast +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -21,26 +19,26 @@ class NewSandbox: """ Attributes: template_id (str): Identifier of the required template - allow_internet_access (bool | Unset): Allow sandbox to access the internet. When set to false, it behaves the - same as specifying denyOut to 0.0.0.0/0 in the network config. - auto_pause (bool | Unset): Automatically pauses the sandbox after the timeout Default: False. - env_vars (Any | Unset): - mcp (McpType0 | None | Unset): MCP configuration for the sandbox - metadata (Any | Unset): - network (SandboxNetworkConfig | Unset): - secure (bool | Unset): Secure all system communication with sandbox - timeout (int | Unset): Time to live for the sandbox in seconds. Default: 15. + allow_internet_access (Union[Unset, bool]): Allow sandbox to access the internet. When set to false, it behaves + the same as specifying denyOut to 0.0.0.0/0 in the network config. + auto_pause (Union[Unset, bool]): Automatically pauses the sandbox after the timeout Default: False. + env_vars (Union[Unset, Any]): + mcp (Union['McpType0', None, Unset]): MCP configuration for the sandbox + metadata (Union[Unset, Any]): + network (Union[Unset, SandboxNetworkConfig]): + secure (Union[Unset, bool]): Secure all system communication with sandbox + timeout (Union[Unset, int]): Time to live for the sandbox in seconds. Default: 15. """ template_id: str - allow_internet_access: bool | Unset = UNSET - auto_pause: bool | Unset = False - env_vars: Any | Unset = UNSET - mcp: McpType0 | None | Unset = UNSET - metadata: Any | Unset = UNSET - network: SandboxNetworkConfig | Unset = UNSET - secure: bool | Unset = UNSET - timeout: int | Unset = 15 + allow_internet_access: Union[Unset, bool] = UNSET + auto_pause: Union[Unset, bool] = False + env_vars: Union[Unset, Any] = UNSET + mcp: Union["McpType0", None, Unset] = UNSET + metadata: Union[Unset, Any] = UNSET + network: Union[Unset, "SandboxNetworkConfig"] = UNSET + secure: Union[Unset, bool] = UNSET + timeout: Union[Unset, int] = 15 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -54,7 +52,7 @@ def to_dict(self) -> dict[str, Any]: env_vars = self.env_vars - mcp: dict[str, Any] | None | Unset + mcp: Union[None, Unset, dict[str, Any]] if isinstance(self.mcp, Unset): mcp = UNSET elif isinstance(self.mcp, McpType0): @@ -64,7 +62,7 @@ def to_dict(self) -> dict[str, Any]: metadata = self.metadata - network: dict[str, Any] | Unset = UNSET + network: Union[Unset, dict[str, Any]] = UNSET if not isinstance(self.network, Unset): network = self.network.to_dict() @@ -112,7 +110,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: env_vars = d.pop("envVars", UNSET) - def _parse_mcp(data: object) -> McpType0 | None | Unset: + def _parse_mcp(data: object) -> Union["McpType0", None, Unset]: if data is None: return data if isinstance(data, Unset): @@ -123,16 +121,16 @@ def _parse_mcp(data: object) -> McpType0 | None | Unset: componentsschemas_mcp_type_0 = McpType0.from_dict(data) return componentsschemas_mcp_type_0 - except (TypeError, ValueError, AttributeError, KeyError): + except: # noqa: E722 pass - return cast(McpType0 | None | Unset, data) + return cast(Union["McpType0", None, Unset], data) mcp = _parse_mcp(d.pop("mcp", UNSET)) metadata = d.pop("metadata", UNSET) _network = d.pop("network", UNSET) - network: SandboxNetworkConfig | Unset + network: Union[Unset, SandboxNetworkConfig] if isinstance(_network, Unset): network = UNSET else: diff --git a/packages/python-sdk/e2b/api/client/models/new_team_api_key.py b/packages/python-sdk/e2b/api/client/models/new_team_api_key.py index 037f3a3dad..2fac8a6bf0 100644 --- a/packages/python-sdk/e2b/api/client/models/new_team_api_key.py +++ b/packages/python-sdk/e2b/api/client/models/new_team_api_key.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/node.py b/packages/python-sdk/e2b/api/client/models/node.py index 5ceba4af2d..af839117c1 100644 --- a/packages/python-sdk/e2b/api/client/models/node.py +++ b/packages/python-sdk/e2b/api/client/models/node.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -40,8 +38,8 @@ class Node: create_fails: int create_successes: int id: str - machine_info: MachineInfo - metrics: NodeMetrics + machine_info: "MachineInfo" + metrics: "NodeMetrics" node_id: str sandbox_count: int sandbox_starting_count: int diff --git a/packages/python-sdk/e2b/api/client/models/node_detail.py b/packages/python-sdk/e2b/api/client/models/node_detail.py index 6fa81c386e..41b32a09f8 100644 --- a/packages/python-sdk/e2b/api/client/models/node_detail.py +++ b/packages/python-sdk/e2b/api/client/models/node_detail.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar, cast @@ -30,7 +28,7 @@ class NodeDetail: machine_info (MachineInfo): metrics (NodeMetrics): Node metrics node_id (str): Identifier of the nomad node - sandboxes (list[ListedSandbox]): List of sandboxes running on the node + sandboxes (list['ListedSandbox']): List of sandboxes running on the node service_instance_id (str): Service instance identifier of the node status (NodeStatus): Status of the node version (str): Version of the orchestrator @@ -42,10 +40,10 @@ class NodeDetail: create_fails: int create_successes: int id: str - machine_info: MachineInfo - metrics: NodeMetrics + machine_info: "MachineInfo" + metrics: "NodeMetrics" node_id: str - sandboxes: list[ListedSandbox] + sandboxes: list["ListedSandbox"] service_instance_id: str status: NodeStatus version: str diff --git a/packages/python-sdk/e2b/api/client/models/node_metrics.py b/packages/python-sdk/e2b/api/client/models/node_metrics.py index e969d2eb73..129d74fc48 100644 --- a/packages/python-sdk/e2b/api/client/models/node_metrics.py +++ b/packages/python-sdk/e2b/api/client/models/node_metrics.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -22,7 +20,7 @@ class NodeMetrics: allocated_memory_bytes (int): Amount of allocated memory in bytes cpu_count (int): Total number of CPU cores on the node cpu_percent (int): Node CPU usage percentage - disks (list[DiskMetrics]): Detailed metrics for each disk/mount point + disks (list['DiskMetrics']): Detailed metrics for each disk/mount point memory_total_bytes (int): Total node memory in bytes memory_used_bytes (int): Node memory used in bytes """ @@ -31,7 +29,7 @@ class NodeMetrics: allocated_memory_bytes: int cpu_count: int cpu_percent: int - disks: list[DiskMetrics] + disks: list["DiskMetrics"] memory_total_bytes: int memory_used_bytes: int additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) diff --git a/packages/python-sdk/e2b/api/client/models/node_status_change.py b/packages/python-sdk/e2b/api/client/models/node_status_change.py index 21edb403f3..b628e429c6 100644 --- a/packages/python-sdk/e2b/api/client/models/node_status_change.py +++ b/packages/python-sdk/e2b/api/client/models/node_status_change.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import Any, TypeVar +from typing import Any, TypeVar, Union from uuid import UUID from attrs import define as _attrs_define @@ -18,17 +16,17 @@ class NodeStatusChange: """ Attributes: status (NodeStatus): Status of the node - cluster_id (UUID | Unset): Identifier of the cluster + cluster_id (Union[Unset, UUID]): Identifier of the cluster """ status: NodeStatus - cluster_id: UUID | Unset = UNSET + cluster_id: Union[Unset, UUID] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: status = self.status.value - cluster_id: str | Unset = UNSET + cluster_id: Union[Unset, str] = UNSET if not isinstance(self.cluster_id, Unset): cluster_id = str(self.cluster_id) @@ -50,7 +48,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: status = NodeStatus(d.pop("status")) _cluster_id = d.pop("clusterID", UNSET) - cluster_id: UUID | Unset + cluster_id: Union[Unset, UUID] if isinstance(_cluster_id, Unset): cluster_id = UNSET else: diff --git a/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py b/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py index 76bcdc2151..5a35d2612e 100644 --- a/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py +++ b/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_refreshes_body.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import Any, TypeVar +from typing import Any, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -15,10 +13,10 @@ class PostSandboxesSandboxIDRefreshesBody: """ Attributes: - duration (int | Unset): Duration for which the sandbox should be kept alive in seconds + duration (Union[Unset, int]): Duration for which the sandbox should be kept alive in seconds """ - duration: int | Unset = UNSET + duration: Union[Unset, int] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_timeout_body.py b/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_timeout_body.py index eab3738d70..4d06c65f6e 100644 --- a/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_timeout_body.py +++ b/packages/python-sdk/e2b/api/client/models/post_sandboxes_sandbox_id_timeout_body.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/resumed_sandbox.py b/packages/python-sdk/e2b/api/client/models/resumed_sandbox.py index b94c77f775..d990dc84f2 100644 --- a/packages/python-sdk/e2b/api/client/models/resumed_sandbox.py +++ b/packages/python-sdk/e2b/api/client/models/resumed_sandbox.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import Any, TypeVar +from typing import Any, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -15,12 +13,12 @@ class ResumedSandbox: """ Attributes: - auto_pause (bool | Unset): Automatically pauses the sandbox after the timeout - timeout (int | Unset): Time to live for the sandbox in seconds. Default: 15. + auto_pause (Union[Unset, bool]): Automatically pauses the sandbox after the timeout + timeout (Union[Unset, int]): Time to live for the sandbox in seconds. Default: 15. """ - auto_pause: bool | Unset = UNSET - timeout: int | Unset = 15 + auto_pause: Union[Unset, bool] = UNSET + timeout: Union[Unset, int] = 15 additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/sandbox.py b/packages/python-sdk/e2b/api/client/models/sandbox.py index 3b14c0fa7d..2eddc5f55a 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import Any, TypeVar, cast +from typing import Any, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -19,20 +17,20 @@ class Sandbox: envd_version (str): Version of the envd running in the sandbox sandbox_id (str): Identifier of the sandbox template_id (str): Identifier of the template from which is the sandbox created - alias (str | Unset): Alias of the template - domain (None | str | Unset): Base domain where the sandbox traffic is accessible - envd_access_token (str | Unset): Access token used for envd communication - traffic_access_token (None | str | Unset): Token required for accessing sandbox via proxy. + alias (Union[Unset, str]): Alias of the template + domain (Union[None, Unset, str]): Base domain where the sandbox traffic is accessible + envd_access_token (Union[Unset, str]): Access token used for envd communication + traffic_access_token (Union[None, Unset, str]): Token required for accessing sandbox via proxy. """ client_id: str envd_version: str sandbox_id: str template_id: str - alias: str | Unset = UNSET - domain: None | str | Unset = UNSET - envd_access_token: str | Unset = UNSET - traffic_access_token: None | str | Unset = UNSET + alias: Union[Unset, str] = UNSET + domain: Union[None, Unset, str] = UNSET + envd_access_token: Union[Unset, str] = UNSET + traffic_access_token: Union[None, Unset, str] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -46,7 +44,7 @@ def to_dict(self) -> dict[str, Any]: alias = self.alias - domain: None | str | Unset + domain: Union[None, Unset, str] if isinstance(self.domain, Unset): domain = UNSET else: @@ -54,7 +52,7 @@ def to_dict(self) -> dict[str, Any]: envd_access_token = self.envd_access_token - traffic_access_token: None | str | Unset + traffic_access_token: Union[None, Unset, str] if isinstance(self.traffic_access_token, Unset): traffic_access_token = UNSET else: @@ -94,23 +92,23 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: alias = d.pop("alias", UNSET) - def _parse_domain(data: object) -> None | str | Unset: + def _parse_domain(data: object) -> Union[None, Unset, str]: if data is None: return data if isinstance(data, Unset): return data - return cast(None | str | Unset, data) + return cast(Union[None, Unset, str], data) domain = _parse_domain(d.pop("domain", UNSET)) envd_access_token = d.pop("envdAccessToken", UNSET) - def _parse_traffic_access_token(data: object) -> None | str | Unset: + def _parse_traffic_access_token(data: object) -> Union[None, Unset, str]: if data is None: return data if isinstance(data, Unset): return data - return cast(None | str | Unset, data) + return cast(Union[None, Unset, str], data) traffic_access_token = _parse_traffic_access_token( d.pop("trafficAccessToken", UNSET) diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_detail.py b/packages/python-sdk/e2b/api/client/models/sandbox_detail.py index 8e3f248807..da864cc449 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_detail.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_detail.py @@ -1,8 +1,6 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping -from typing import Any, TypeVar, cast +from typing import Any, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -28,10 +26,10 @@ class SandboxDetail: started_at (datetime.datetime): Time when the sandbox was started state (SandboxState): State of the sandbox template_id (str): Identifier of the template from which is the sandbox created - alias (str | Unset): Alias of the template - domain (None | str | Unset): Base domain where the sandbox traffic is accessible - envd_access_token (str | Unset): Access token used for envd communication - metadata (Any | Unset): + alias (Union[Unset, str]): Alias of the template + domain (Union[None, Unset, str]): Base domain where the sandbox traffic is accessible + envd_access_token (Union[Unset, str]): Access token used for envd communication + metadata (Union[Unset, Any]): """ client_id: str @@ -44,10 +42,10 @@ class SandboxDetail: started_at: datetime.datetime state: SandboxState template_id: str - alias: str | Unset = UNSET - domain: None | str | Unset = UNSET - envd_access_token: str | Unset = UNSET - metadata: Any | Unset = UNSET + alias: Union[Unset, str] = UNSET + domain: Union[None, Unset, str] = UNSET + envd_access_token: Union[Unset, str] = UNSET + metadata: Union[Unset, Any] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -73,7 +71,7 @@ def to_dict(self) -> dict[str, Any]: alias = self.alias - domain: None | str | Unset + domain: Union[None, Unset, str] if isinstance(self.domain, Unset): domain = UNSET else: @@ -135,12 +133,12 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: alias = d.pop("alias", UNSET) - def _parse_domain(data: object) -> None | str | Unset: + def _parse_domain(data: object) -> Union[None, Unset, str]: if data is None: return data if isinstance(data, Unset): return data - return cast(None | str | Unset, data) + return cast(Union[None, Unset, str], data) domain = _parse_domain(d.pop("domain", UNSET)) diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_log.py b/packages/python-sdk/e2b/api/client/models/sandbox_log.py index 3b0dd3e028..65b9144efb 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_log.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_log.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_log_entry.py b/packages/python-sdk/e2b/api/client/models/sandbox_log_entry.py index 8547957407..bcbbe7d3e5 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_log_entry.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_log_entry.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -27,7 +25,7 @@ class SandboxLogEntry: timestamp (datetime.datetime): Timestamp of the log entry """ - fields: SandboxLogEntryFields + fields: "SandboxLogEntryFields" level: LogLevel message: str timestamp: datetime.datetime diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_log_entry_fields.py b/packages/python-sdk/e2b/api/client/models/sandbox_log_entry_fields.py index 400fec1344..6ac463d361 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_log_entry_fields.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_log_entry_fields.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar @@ -16,7 +14,6 @@ class SandboxLogEntryFields: additional_properties: dict[str, str] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - field_dict: dict[str, Any] = {} field_dict.update(self.additional_properties) diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_logs.py b/packages/python-sdk/e2b/api/client/models/sandbox_logs.py index 6dac14cd0c..39a1eb500c 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_logs.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_logs.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -18,12 +16,12 @@ class SandboxLogs: """ Attributes: - log_entries (list[SandboxLogEntry]): Structured logs of the sandbox - logs (list[SandboxLog]): Logs of the sandbox + log_entries (list['SandboxLogEntry']): Structured logs of the sandbox + logs (list['SandboxLog']): Logs of the sandbox """ - log_entries: list[SandboxLogEntry] - logs: list[SandboxLog] + log_entries: list["SandboxLogEntry"] + logs: list["SandboxLog"] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_metric.py b/packages/python-sdk/e2b/api/client/models/sandbox_metric.py index 1cb6dee0c1..eb7442fd9e 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_metric.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_metric.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/sandbox_network_config.py b/packages/python-sdk/e2b/api/client/models/sandbox_network_config.py index f63d0349fe..08284c792f 100644 --- a/packages/python-sdk/e2b/api/client/models/sandbox_network_config.py +++ b/packages/python-sdk/e2b/api/client/models/sandbox_network_config.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import Any, TypeVar, cast +from typing import Any, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -15,28 +13,28 @@ class SandboxNetworkConfig: """ Attributes: - allow_out (list[str] | Unset): List of allowed CIDR blocks or IP addresses for egress traffic. Allowed addresses - always take precedence over blocked addresses. - allow_public_traffic (bool | Unset): Specify if the sandbox URLs should be accessible only with authentication. - Default: True. - deny_out (list[str] | Unset): List of denied CIDR blocks or IP addresses for egress traffic - mask_request_host (str | Unset): Specify host mask which will be used for all sandbox requests + allow_out (Union[Unset, list[str]]): List of allowed CIDR blocks or IP addresses for egress traffic. Allowed + addresses always take precedence over blocked addresses. + allow_public_traffic (Union[Unset, bool]): Specify if the sandbox URLs should be accessible only with + authentication. Default: True. + deny_out (Union[Unset, list[str]]): List of denied CIDR blocks or IP addresses for egress traffic + mask_request_host (Union[Unset, str]): Specify host mask which will be used for all sandbox requests """ - allow_out: list[str] | Unset = UNSET - allow_public_traffic: bool | Unset = True - deny_out: list[str] | Unset = UNSET - mask_request_host: str | Unset = UNSET + allow_out: Union[Unset, list[str]] = UNSET + allow_public_traffic: Union[Unset, bool] = True + deny_out: Union[Unset, list[str]] = UNSET + mask_request_host: Union[Unset, str] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: - allow_out: list[str] | Unset = UNSET + allow_out: Union[Unset, list[str]] = UNSET if not isinstance(self.allow_out, Unset): allow_out = self.allow_out allow_public_traffic = self.allow_public_traffic - deny_out: list[str] | Unset = UNSET + deny_out: Union[Unset, list[str]] = UNSET if not isinstance(self.deny_out, Unset): deny_out = self.deny_out diff --git a/packages/python-sdk/e2b/api/client/models/sandboxes_with_metrics.py b/packages/python-sdk/e2b/api/client/models/sandboxes_with_metrics.py index 04cdb5041c..64981d955d 100644 --- a/packages/python-sdk/e2b/api/client/models/sandboxes_with_metrics.py +++ b/packages/python-sdk/e2b/api/client/models/sandboxes_with_metrics.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/team.py b/packages/python-sdk/e2b/api/client/models/team.py index b1f8e677a3..81a434c144 100644 --- a/packages/python-sdk/e2b/api/client/models/team.py +++ b/packages/python-sdk/e2b/api/client/models/team.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/team_api_key.py b/packages/python-sdk/e2b/api/client/models/team_api_key.py index 69717eac72..7edbbc1e47 100644 --- a/packages/python-sdk/e2b/api/client/models/team_api_key.py +++ b/packages/python-sdk/e2b/api/client/models/team_api_key.py @@ -1,8 +1,6 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, cast +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast from uuid import UUID from attrs import define as _attrs_define @@ -27,16 +25,16 @@ class TeamAPIKey: id (UUID): Identifier of the API key mask (IdentifierMaskingDetails): name (str): Name of the API key - created_by (None | TeamUser | Unset): - last_used (datetime.datetime | None | Unset): Last time this API key was used + created_by (Union['TeamUser', None, Unset]): + last_used (Union[None, Unset, datetime.datetime]): Last time this API key was used """ created_at: datetime.datetime id: UUID - mask: IdentifierMaskingDetails + mask: "IdentifierMaskingDetails" name: str - created_by: None | TeamUser | Unset = UNSET - last_used: datetime.datetime | None | Unset = UNSET + created_by: Union["TeamUser", None, Unset] = UNSET + last_used: Union[None, Unset, datetime.datetime] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -50,7 +48,7 @@ def to_dict(self) -> dict[str, Any]: name = self.name - created_by: dict[str, Any] | None | Unset + created_by: Union[None, Unset, dict[str, Any]] if isinstance(self.created_by, Unset): created_by = UNSET elif isinstance(self.created_by, TeamUser): @@ -58,7 +56,7 @@ def to_dict(self) -> dict[str, Any]: else: created_by = self.created_by - last_used: None | str | Unset + last_used: Union[None, Unset, str] if isinstance(self.last_used, Unset): last_used = UNSET elif isinstance(self.last_used, datetime.datetime): @@ -97,7 +95,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: name = d.pop("name") - def _parse_created_by(data: object) -> None | TeamUser | Unset: + def _parse_created_by(data: object) -> Union["TeamUser", None, Unset]: if data is None: return data if isinstance(data, Unset): @@ -108,13 +106,13 @@ def _parse_created_by(data: object) -> None | TeamUser | Unset: created_by_type_1 = TeamUser.from_dict(data) return created_by_type_1 - except (TypeError, ValueError, AttributeError, KeyError): + except: # noqa: E722 pass - return cast(None | TeamUser | Unset, data) + return cast(Union["TeamUser", None, Unset], data) created_by = _parse_created_by(d.pop("createdBy", UNSET)) - def _parse_last_used(data: object) -> datetime.datetime | None | Unset: + def _parse_last_used(data: object) -> Union[None, Unset, datetime.datetime]: if data is None: return data if isinstance(data, Unset): @@ -125,9 +123,9 @@ def _parse_last_used(data: object) -> datetime.datetime | None | Unset: last_used_type_0 = isoparse(data) return last_used_type_0 - except (TypeError, ValueError, AttributeError, KeyError): + except: # noqa: E722 pass - return cast(datetime.datetime | None | Unset, data) + return cast(Union[None, Unset, datetime.datetime], data) last_used = _parse_last_used(d.pop("lastUsed", UNSET)) diff --git a/packages/python-sdk/e2b/api/client/models/team_metric.py b/packages/python-sdk/e2b/api/client/models/team_metric.py index 606b963ccf..97d30d751a 100644 --- a/packages/python-sdk/e2b/api/client/models/team_metric.py +++ b/packages/python-sdk/e2b/api/client/models/team_metric.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/team_user.py b/packages/python-sdk/e2b/api/client/models/team_user.py index 66746082ae..cd42f7fc5c 100644 --- a/packages/python-sdk/e2b/api/client/models/team_user.py +++ b/packages/python-sdk/e2b/api/client/models/team_user.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar from uuid import UUID diff --git a/packages/python-sdk/e2b/api/client/models/template.py b/packages/python-sdk/e2b/api/client/models/template.py index fa4ef607f6..c75d4d8e09 100644 --- a/packages/python-sdk/e2b/api/client/models/template.py +++ b/packages/python-sdk/e2b/api/client/models/template.py @@ -1,8 +1,6 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, cast +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -27,10 +25,10 @@ class Template: build_status (TemplateBuildStatus): Status of the template build cpu_count (int): CPU cores for the sandbox created_at (datetime.datetime): Time when the template was created - created_by (None | TeamUser): + created_by (Union['TeamUser', None]): disk_size_mb (int): Disk size for the sandbox in MiB envd_version (str): Version of the envd running in the sandbox - last_spawned_at (datetime.datetime | None): Time when the template was last used + last_spawned_at (Union[None, datetime.datetime]): Time when the template was last used memory_mb (int): Memory for the sandbox in MiB names (list[str]): Names of the template (namespace/alias format when namespaced) public (bool): Whether the template is public or only accessible by the team @@ -45,10 +43,10 @@ class Template: build_status: TemplateBuildStatus cpu_count: int created_at: datetime.datetime - created_by: None | TeamUser + created_by: Union["TeamUser", None] disk_size_mb: int envd_version: str - last_spawned_at: datetime.datetime | None + last_spawned_at: Union[None, datetime.datetime] memory_mb: int names: list[str] public: bool @@ -72,7 +70,7 @@ def to_dict(self) -> dict[str, Any]: created_at = self.created_at.isoformat() - created_by: dict[str, Any] | None + created_by: Union[None, dict[str, Any]] if isinstance(self.created_by, TeamUser): created_by = self.created_by.to_dict() else: @@ -82,7 +80,7 @@ def to_dict(self) -> dict[str, Any]: envd_version = self.envd_version - last_spawned_at: None | str + last_spawned_at: Union[None, str] if isinstance(self.last_spawned_at, datetime.datetime): last_spawned_at = self.last_spawned_at.isoformat() else: @@ -142,7 +140,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: created_at = isoparse(d.pop("createdAt")) - def _parse_created_by(data: object) -> None | TeamUser: + def _parse_created_by(data: object) -> Union["TeamUser", None]: if data is None: return data try: @@ -151,9 +149,9 @@ def _parse_created_by(data: object) -> None | TeamUser: created_by_type_1 = TeamUser.from_dict(data) return created_by_type_1 - except (TypeError, ValueError, AttributeError, KeyError): + except: # noqa: E722 pass - return cast(None | TeamUser, data) + return cast(Union["TeamUser", None], data) created_by = _parse_created_by(d.pop("createdBy")) @@ -161,7 +159,7 @@ def _parse_created_by(data: object) -> None | TeamUser: envd_version = d.pop("envdVersion") - def _parse_last_spawned_at(data: object) -> datetime.datetime | None: + def _parse_last_spawned_at(data: object) -> Union[None, datetime.datetime]: if data is None: return data try: @@ -170,9 +168,9 @@ def _parse_last_spawned_at(data: object) -> datetime.datetime | None: last_spawned_at_type_0 = isoparse(data) return last_spawned_at_type_0 - except (TypeError, ValueError, AttributeError, KeyError): + except: # noqa: E722 pass - return cast(datetime.datetime | None, data) + return cast(Union[None, datetime.datetime], data) last_spawned_at = _parse_last_spawned_at(d.pop("lastSpawnedAt")) diff --git a/packages/python-sdk/e2b/api/client/models/template_alias_response.py b/packages/python-sdk/e2b/api/client/models/template_alias_response.py index f3932cc0e3..7c91061972 100644 --- a/packages/python-sdk/e2b/api/client/models/template_alias_response.py +++ b/packages/python-sdk/e2b/api/client/models/template_alias_response.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/models/template_build.py b/packages/python-sdk/e2b/api/client/models/template_build.py index 050a6e7738..f42a3f6fee 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build.py +++ b/packages/python-sdk/e2b/api/client/models/template_build.py @@ -1,8 +1,6 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping -from typing import Any, TypeVar +from typing import Any, TypeVar, Union from uuid import UUID from attrs import define as _attrs_define @@ -25,9 +23,9 @@ class TemplateBuild: memory_mb (int): Memory for the sandbox in MiB status (TemplateBuildStatus): Status of the template build updated_at (datetime.datetime): Time when the build was last updated - disk_size_mb (int | Unset): Disk size for the sandbox in MiB - envd_version (str | Unset): Version of the envd running in the sandbox - finished_at (datetime.datetime | Unset): Time when the build was finished + disk_size_mb (Union[Unset, int]): Disk size for the sandbox in MiB + envd_version (Union[Unset, str]): Version of the envd running in the sandbox + finished_at (Union[Unset, datetime.datetime]): Time when the build was finished """ build_id: UUID @@ -36,9 +34,9 @@ class TemplateBuild: memory_mb: int status: TemplateBuildStatus updated_at: datetime.datetime - disk_size_mb: int | Unset = UNSET - envd_version: str | Unset = UNSET - finished_at: datetime.datetime | Unset = UNSET + disk_size_mb: Union[Unset, int] = UNSET + envd_version: Union[Unset, str] = UNSET + finished_at: Union[Unset, datetime.datetime] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -58,7 +56,7 @@ def to_dict(self) -> dict[str, Any]: envd_version = self.envd_version - finished_at: str | Unset = UNSET + finished_at: Union[Unset, str] = UNSET if not isinstance(self.finished_at, Unset): finished_at = self.finished_at.isoformat() @@ -103,7 +101,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: envd_version = d.pop("envdVersion", UNSET) _finished_at = d.pop("finishedAt", UNSET) - finished_at: datetime.datetime | Unset + finished_at: Union[Unset, datetime.datetime] if isinstance(_finished_at, Unset): finished_at = UNSET else: diff --git a/packages/python-sdk/e2b/api/client/models/template_build_file_upload.py b/packages/python-sdk/e2b/api/client/models/template_build_file_upload.py index 41bfbec378..a7d4e44a04 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_file_upload.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_file_upload.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import Any, TypeVar +from typing import Any, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -16,11 +14,11 @@ class TemplateBuildFileUpload: """ Attributes: present (bool): Whether the file is already present in the cache - url (str | Unset): Url where the file should be uploaded to + url (Union[Unset, str]): Url where the file should be uploaded to """ present: bool - url: str | Unset = UNSET + url: Union[Unset, str] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/template_build_info.py b/packages/python-sdk/e2b/api/client/models/template_build_info.py index ac1bfcded9..90b670c24d 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_info.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_info.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, cast +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -22,19 +20,19 @@ class TemplateBuildInfo: """ Attributes: build_id (str): Identifier of the build - log_entries (list[BuildLogEntry]): Build logs structured + log_entries (list['BuildLogEntry']): Build logs structured logs (list[str]): Build logs status (TemplateBuildStatus): Status of the template build template_id (str): Identifier of the template - reason (BuildStatusReason | Unset): + reason (Union[Unset, BuildStatusReason]): """ build_id: str - log_entries: list[BuildLogEntry] + log_entries: list["BuildLogEntry"] logs: list[str] status: TemplateBuildStatus template_id: str - reason: BuildStatusReason | Unset = UNSET + reason: Union[Unset, "BuildStatusReason"] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -51,7 +49,7 @@ def to_dict(self) -> dict[str, Any]: template_id = self.template_id - reason: dict[str, Any] | Unset = UNSET + reason: Union[Unset, dict[str, Any]] = UNSET if not isinstance(self.reason, Unset): reason = self.reason.to_dict() @@ -93,7 +91,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: template_id = d.pop("templateID") _reason = d.pop("reason", UNSET) - reason: BuildStatusReason | Unset + reason: Union[Unset, BuildStatusReason] if isinstance(_reason, Unset): reason = UNSET else: diff --git a/packages/python-sdk/e2b/api/client/models/template_build_logs_response.py b/packages/python-sdk/e2b/api/client/models/template_build_logs_response.py index b2b97ab8bf..6f3f70998d 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_logs_response.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_logs_response.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import TYPE_CHECKING, Any, TypeVar @@ -17,10 +15,10 @@ class TemplateBuildLogsResponse: """ Attributes: - logs (list[BuildLogEntry]): Build logs structured + logs (list['BuildLogEntry']): Build logs structured """ - logs: list[BuildLogEntry] + logs: list["BuildLogEntry"] additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/template_build_request.py b/packages/python-sdk/e2b/api/client/models/template_build_request.py index 971717fc0f..b41e1d0cdc 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_request.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_request.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import Any, TypeVar +from typing import Any, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -16,21 +14,21 @@ class TemplateBuildRequest: """ Attributes: dockerfile (str): Dockerfile for the template - alias (str | Unset): Alias of the template - cpu_count (int | Unset): CPU cores for the sandbox - memory_mb (int | Unset): Memory for the sandbox in MiB - ready_cmd (str | Unset): Ready check command to execute in the template after the build - start_cmd (str | Unset): Start command to execute in the template after the build - team_id (str | Unset): Identifier of the team + alias (Union[Unset, str]): Alias of the template + cpu_count (Union[Unset, int]): CPU cores for the sandbox + memory_mb (Union[Unset, int]): Memory for the sandbox in MiB + ready_cmd (Union[Unset, str]): Ready check command to execute in the template after the build + start_cmd (Union[Unset, str]): Start command to execute in the template after the build + team_id (Union[Unset, str]): Identifier of the team """ dockerfile: str - alias: str | Unset = UNSET - cpu_count: int | Unset = UNSET - memory_mb: int | Unset = UNSET - ready_cmd: str | Unset = UNSET - start_cmd: str | Unset = UNSET - team_id: str | Unset = UNSET + alias: Union[Unset, str] = UNSET + cpu_count: Union[Unset, int] = UNSET + memory_mb: Union[Unset, int] = UNSET + ready_cmd: Union[Unset, str] = UNSET + start_cmd: Union[Unset, str] = UNSET + team_id: Union[Unset, str] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/template_build_request_v2.py b/packages/python-sdk/e2b/api/client/models/template_build_request_v2.py index 658b2a7432..1473424e04 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_request_v2.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_request_v2.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import Any, TypeVar +from typing import Any, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -16,15 +14,15 @@ class TemplateBuildRequestV2: """ Attributes: alias (str): Alias of the template - cpu_count (int | Unset): CPU cores for the sandbox - memory_mb (int | Unset): Memory for the sandbox in MiB - team_id (str | Unset): Identifier of the team + cpu_count (Union[Unset, int]): CPU cores for the sandbox + memory_mb (Union[Unset, int]): Memory for the sandbox in MiB + team_id (Union[Unset, str]): Identifier of the team """ alias: str - cpu_count: int | Unset = UNSET - memory_mb: int | Unset = UNSET - team_id: str | Unset = UNSET + cpu_count: Union[Unset, int] = UNSET + memory_mb: Union[Unset, int] = UNSET + team_id: Union[Unset, str] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/template_build_request_v3.py b/packages/python-sdk/e2b/api/client/models/template_build_request_v3.py index da703c1c78..dda90f01f3 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_request_v3.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_request_v3.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import Any, TypeVar, cast +from typing import Any, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -15,21 +13,21 @@ class TemplateBuildRequestV3: """ Attributes: - alias (str | Unset): Alias of the template. Deprecated, use name instead. - cpu_count (int | Unset): CPU cores for the sandbox - memory_mb (int | Unset): Memory for the sandbox in MiB - name (str | Unset): Name of the template. Can include a tag with colon separator (e.g. "my-template" or "my- - template:v1"). If tag is included, it will be treated as if the tag was provided in the tags array. - tags (list[str] | Unset): Tags to assign to the template build - team_id (str | Unset): Identifier of the team + alias (Union[Unset, str]): Alias of the template. Deprecated, use name instead. + cpu_count (Union[Unset, int]): CPU cores for the sandbox + memory_mb (Union[Unset, int]): Memory for the sandbox in MiB + name (Union[Unset, str]): Name of the template. Can include a tag with colon separator (e.g. "my-template" or + "my-template:v1"). If tag is included, it will be treated as if the tag was provided in the tags array. + tags (Union[Unset, list[str]]): Tags to assign to the template build + team_id (Union[Unset, str]): Identifier of the team """ - alias: str | Unset = UNSET - cpu_count: int | Unset = UNSET - memory_mb: int | Unset = UNSET - name: str | Unset = UNSET - tags: list[str] | Unset = UNSET - team_id: str | Unset = UNSET + alias: Union[Unset, str] = UNSET + cpu_count: Union[Unset, int] = UNSET + memory_mb: Union[Unset, int] = UNSET + name: Union[Unset, str] = UNSET + tags: Union[Unset, list[str]] = UNSET + team_id: Union[Unset, str] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -41,7 +39,7 @@ def to_dict(self) -> dict[str, Any]: name = self.name - tags: list[str] | Unset = UNSET + tags: Union[Unset, list[str]] = UNSET if not isinstance(self.tags, Unset): tags = self.tags diff --git a/packages/python-sdk/e2b/api/client/models/template_build_start_v2.py b/packages/python-sdk/e2b/api/client/models/template_build_start_v2.py index 1c3177925d..32adf844e5 100644 --- a/packages/python-sdk/e2b/api/client/models/template_build_start_v2.py +++ b/packages/python-sdk/e2b/api/client/models/template_build_start_v2.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar +from typing import TYPE_CHECKING, Any, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -22,22 +20,25 @@ class TemplateBuildStartV2: """ Attributes: - force (bool | Unset): Whether the whole build should be forced to run regardless of the cache Default: False. - from_image (str | Unset): Image to use as a base for the template build - from_image_registry (AWSRegistry | GCPRegistry | GeneralRegistry | Unset): - from_template (str | Unset): Template to use as a base for the template build - ready_cmd (str | Unset): Ready check command to execute in the template after the build - start_cmd (str | Unset): Start command to execute in the template after the build - steps (list[TemplateStep] | Unset): List of steps to execute in the template build + force (Union[Unset, bool]): Whether the whole build should be forced to run regardless of the cache Default: + False. + from_image (Union[Unset, str]): Image to use as a base for the template build + from_image_registry (Union['AWSRegistry', 'GCPRegistry', 'GeneralRegistry', Unset]): + from_template (Union[Unset, str]): Template to use as a base for the template build + ready_cmd (Union[Unset, str]): Ready check command to execute in the template after the build + start_cmd (Union[Unset, str]): Start command to execute in the template after the build + steps (Union[Unset, list['TemplateStep']]): List of steps to execute in the template build """ - force: bool | Unset = False - from_image: str | Unset = UNSET - from_image_registry: AWSRegistry | GCPRegistry | GeneralRegistry | Unset = UNSET - from_template: str | Unset = UNSET - ready_cmd: str | Unset = UNSET - start_cmd: str | Unset = UNSET - steps: list[TemplateStep] | Unset = UNSET + force: Union[Unset, bool] = False + from_image: Union[Unset, str] = UNSET + from_image_registry: Union[ + "AWSRegistry", "GCPRegistry", "GeneralRegistry", Unset + ] = UNSET + from_template: Union[Unset, str] = UNSET + ready_cmd: Union[Unset, str] = UNSET + start_cmd: Union[Unset, str] = UNSET + steps: Union[Unset, list["TemplateStep"]] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: @@ -48,7 +49,7 @@ def to_dict(self) -> dict[str, Any]: from_image = self.from_image - from_image_registry: dict[str, Any] | Unset + from_image_registry: Union[Unset, dict[str, Any]] if isinstance(self.from_image_registry, Unset): from_image_registry = UNSET elif isinstance(self.from_image_registry, AWSRegistry): @@ -64,7 +65,7 @@ def to_dict(self) -> dict[str, Any]: start_cmd = self.start_cmd - steps: list[dict[str, Any]] | Unset = UNSET + steps: Union[Unset, list[dict[str, Any]]] = UNSET if not isinstance(self.steps, Unset): steps = [] for steps_item_data in self.steps: @@ -105,7 +106,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: def _parse_from_image_registry( data: object, - ) -> AWSRegistry | GCPRegistry | GeneralRegistry | Unset: + ) -> Union["AWSRegistry", "GCPRegistry", "GeneralRegistry", Unset]: if isinstance(data, Unset): return data try: @@ -116,7 +117,7 @@ def _parse_from_image_registry( ) return componentsschemas_from_image_registry_type_0 - except (TypeError, ValueError, AttributeError, KeyError): + except: # noqa: E722 pass try: if not isinstance(data, dict): @@ -126,7 +127,7 @@ def _parse_from_image_registry( ) return componentsschemas_from_image_registry_type_1 - except (TypeError, ValueError, AttributeError, KeyError): + except: # noqa: E722 pass if not isinstance(data, dict): raise TypeError() @@ -146,14 +147,12 @@ def _parse_from_image_registry( start_cmd = d.pop("startCmd", UNSET) + steps = [] _steps = d.pop("steps", UNSET) - steps: list[TemplateStep] | Unset = UNSET - if _steps is not UNSET: - steps = [] - for steps_item_data in _steps: - steps_item = TemplateStep.from_dict(steps_item_data) + for steps_item_data in _steps or []: + steps_item = TemplateStep.from_dict(steps_item_data) - steps.append(steps_item) + steps.append(steps_item) template_build_start_v2 = cls( force=force, diff --git a/packages/python-sdk/e2b/api/client/models/template_legacy.py b/packages/python-sdk/e2b/api/client/models/template_legacy.py index 179cce29d4..69501e5654 100644 --- a/packages/python-sdk/e2b/api/client/models/template_legacy.py +++ b/packages/python-sdk/e2b/api/client/models/template_legacy.py @@ -1,8 +1,6 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, cast +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -24,10 +22,10 @@ class TemplateLegacy: build_id (str): Identifier of the last successful build for given template cpu_count (int): CPU cores for the sandbox created_at (datetime.datetime): Time when the template was created - created_by (None | TeamUser): + created_by (Union['TeamUser', None]): disk_size_mb (int): Disk size for the sandbox in MiB envd_version (str): Version of the envd running in the sandbox - last_spawned_at (datetime.datetime | None): Time when the template was last used + last_spawned_at (Union[None, datetime.datetime]): Time when the template was last used memory_mb (int): Memory for the sandbox in MiB public (bool): Whether the template is public or only accessible by the team spawn_count (int): Number of times the template was used @@ -40,10 +38,10 @@ class TemplateLegacy: build_id: str cpu_count: int created_at: datetime.datetime - created_by: None | TeamUser + created_by: Union["TeamUser", None] disk_size_mb: int envd_version: str - last_spawned_at: datetime.datetime | None + last_spawned_at: Union[None, datetime.datetime] memory_mb: int public: bool spawn_count: int @@ -64,7 +62,7 @@ def to_dict(self) -> dict[str, Any]: created_at = self.created_at.isoformat() - created_by: dict[str, Any] | None + created_by: Union[None, dict[str, Any]] if isinstance(self.created_by, TeamUser): created_by = self.created_by.to_dict() else: @@ -74,7 +72,7 @@ def to_dict(self) -> dict[str, Any]: envd_version = self.envd_version - last_spawned_at: None | str + last_spawned_at: Union[None, str] if isinstance(self.last_spawned_at, datetime.datetime): last_spawned_at = self.last_spawned_at.isoformat() else: @@ -128,7 +126,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: created_at = isoparse(d.pop("createdAt")) - def _parse_created_by(data: object) -> None | TeamUser: + def _parse_created_by(data: object) -> Union["TeamUser", None]: if data is None: return data try: @@ -137,9 +135,9 @@ def _parse_created_by(data: object) -> None | TeamUser: created_by_type_1 = TeamUser.from_dict(data) return created_by_type_1 - except (TypeError, ValueError, AttributeError, KeyError): + except: # noqa: E722 pass - return cast(None | TeamUser, data) + return cast(Union["TeamUser", None], data) created_by = _parse_created_by(d.pop("createdBy")) @@ -147,7 +145,7 @@ def _parse_created_by(data: object) -> None | TeamUser: envd_version = d.pop("envdVersion") - def _parse_last_spawned_at(data: object) -> datetime.datetime | None: + def _parse_last_spawned_at(data: object) -> Union[None, datetime.datetime]: if data is None: return data try: @@ -156,9 +154,9 @@ def _parse_last_spawned_at(data: object) -> datetime.datetime | None: last_spawned_at_type_0 = isoparse(data) return last_spawned_at_type_0 - except (TypeError, ValueError, AttributeError, KeyError): + except: # noqa: E722 pass - return cast(datetime.datetime | None, data) + return cast(Union[None, datetime.datetime], data) last_spawned_at = _parse_last_spawned_at(d.pop("lastSpawnedAt")) diff --git a/packages/python-sdk/e2b/api/client/models/template_request_response_v3.py b/packages/python-sdk/e2b/api/client/models/template_request_response_v3.py index 59b5d6ae12..9921980c5a 100644 --- a/packages/python-sdk/e2b/api/client/models/template_request_response_v3.py +++ b/packages/python-sdk/e2b/api/client/models/template_request_response_v3.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar, cast diff --git a/packages/python-sdk/e2b/api/client/models/template_step.py b/packages/python-sdk/e2b/api/client/models/template_step.py index c32b346755..45daaecd06 100644 --- a/packages/python-sdk/e2b/api/client/models/template_step.py +++ b/packages/python-sdk/e2b/api/client/models/template_step.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import Any, TypeVar, cast +from typing import Any, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -17,21 +15,21 @@ class TemplateStep: Attributes: type_ (str): Type of the step - args (list[str] | Unset): Arguments for the step - files_hash (str | Unset): Hash of the files used in the step - force (bool | Unset): Whether the step should be forced to run regardless of the cache Default: False. + args (Union[Unset, list[str]]): Arguments for the step + files_hash (Union[Unset, str]): Hash of the files used in the step + force (Union[Unset, bool]): Whether the step should be forced to run regardless of the cache Default: False. """ type_: str - args: list[str] | Unset = UNSET - files_hash: str | Unset = UNSET - force: bool | Unset = False + args: Union[Unset, list[str]] = UNSET + files_hash: Union[Unset, str] = UNSET + force: Union[Unset, bool] = False additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: type_ = self.type_ - args: list[str] | Unset = UNSET + args: Union[Unset, list[str]] = UNSET if not isinstance(self.args, Unset): args = self.args diff --git a/packages/python-sdk/e2b/api/client/models/template_update_request.py b/packages/python-sdk/e2b/api/client/models/template_update_request.py index b017fc1e2e..8a9f5bee82 100644 --- a/packages/python-sdk/e2b/api/client/models/template_update_request.py +++ b/packages/python-sdk/e2b/api/client/models/template_update_request.py @@ -1,7 +1,5 @@ -from __future__ import annotations - from collections.abc import Mapping -from typing import Any, TypeVar +from typing import Any, TypeVar, Union from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -15,10 +13,10 @@ class TemplateUpdateRequest: """ Attributes: - public (bool | Unset): Whether the template is public or only accessible by the team + public (Union[Unset, bool]): Whether the template is public or only accessible by the team """ - public: bool | Unset = UNSET + public: Union[Unset, bool] = UNSET additional_properties: dict[str, Any] = _attrs_field(init=False, factory=dict) def to_dict(self) -> dict[str, Any]: diff --git a/packages/python-sdk/e2b/api/client/models/template_update_response.py b/packages/python-sdk/e2b/api/client/models/template_update_response.py index cfe3c2deaf..7a273c84d0 100644 --- a/packages/python-sdk/e2b/api/client/models/template_update_response.py +++ b/packages/python-sdk/e2b/api/client/models/template_update_response.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar, cast diff --git a/packages/python-sdk/e2b/api/client/models/template_with_builds.py b/packages/python-sdk/e2b/api/client/models/template_with_builds.py index bb077713e8..90c0a63445 100644 --- a/packages/python-sdk/e2b/api/client/models/template_with_builds.py +++ b/packages/python-sdk/e2b/api/client/models/template_with_builds.py @@ -1,8 +1,6 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping -from typing import TYPE_CHECKING, Any, TypeVar, cast +from typing import TYPE_CHECKING, Any, TypeVar, Union, cast from attrs import define as _attrs_define from attrs import field as _attrs_field @@ -20,9 +18,9 @@ class TemplateWithBuilds: """ Attributes: aliases (list[str]): Aliases of the template - builds (list[TemplateBuild]): List of builds for the template + builds (list['TemplateBuild']): List of builds for the template created_at (datetime.datetime): Time when the template was created - last_spawned_at (datetime.datetime | None): Time when the template was last used + last_spawned_at (Union[None, datetime.datetime]): Time when the template was last used names (list[str]): Names of the template (namespace/alias format when namespaced) public (bool): Whether the template is public or only accessible by the team spawn_count (int): Number of times the template was used @@ -31,9 +29,9 @@ class TemplateWithBuilds: """ aliases: list[str] - builds: list[TemplateBuild] + builds: list["TemplateBuild"] created_at: datetime.datetime - last_spawned_at: datetime.datetime | None + last_spawned_at: Union[None, datetime.datetime] names: list[str] public: bool spawn_count: int @@ -51,7 +49,7 @@ def to_dict(self) -> dict[str, Any]: created_at = self.created_at.isoformat() - last_spawned_at: None | str + last_spawned_at: Union[None, str] if isinstance(self.last_spawned_at, datetime.datetime): last_spawned_at = self.last_spawned_at.isoformat() else: @@ -101,7 +99,7 @@ def from_dict(cls: type[T], src_dict: Mapping[str, Any]) -> T: created_at = isoparse(d.pop("createdAt")) - def _parse_last_spawned_at(data: object) -> datetime.datetime | None: + def _parse_last_spawned_at(data: object) -> Union[None, datetime.datetime]: if data is None: return data try: @@ -110,9 +108,9 @@ def _parse_last_spawned_at(data: object) -> datetime.datetime | None: last_spawned_at_type_0 = isoparse(data) return last_spawned_at_type_0 - except (TypeError, ValueError, AttributeError, KeyError): + except: # noqa: E722 pass - return cast(datetime.datetime | None, data) + return cast(Union[None, datetime.datetime], data) last_spawned_at = _parse_last_spawned_at(d.pop("lastSpawnedAt")) diff --git a/packages/python-sdk/e2b/api/client/models/update_team_api_key.py b/packages/python-sdk/e2b/api/client/models/update_team_api_key.py index 8d98e99542..34fb9679ae 100644 --- a/packages/python-sdk/e2b/api/client/models/update_team_api_key.py +++ b/packages/python-sdk/e2b/api/client/models/update_team_api_key.py @@ -1,5 +1,3 @@ -from __future__ import annotations - from collections.abc import Mapping from typing import Any, TypeVar diff --git a/packages/python-sdk/e2b/api/client/types.py b/packages/python-sdk/e2b/api/client/types.py index b64af09529..1b96ca408a 100644 --- a/packages/python-sdk/e2b/api/client/types.py +++ b/packages/python-sdk/e2b/api/client/types.py @@ -2,7 +2,7 @@ from collections.abc import Mapping, MutableMapping from http import HTTPStatus -from typing import IO, BinaryIO, Generic, Literal, TypeVar +from typing import IO, BinaryIO, Generic, Literal, Optional, TypeVar, Union from attrs import define @@ -15,13 +15,13 @@ def __bool__(self) -> Literal[False]: UNSET: Unset = Unset() # The types that `httpx.Client(files=)` can accept, copied from that library. -FileContent = IO[bytes] | bytes | str -FileTypes = ( +FileContent = Union[IO[bytes], bytes, str] +FileTypes = Union[ # (filename, file (or bytes), content_type) - tuple[str | None, FileContent, str | None] + tuple[Optional[str], FileContent, Optional[str]], # (filename, file (or bytes), content_type, headers) - | tuple[str | None, FileContent, str | None, Mapping[str, str]] -) + tuple[Optional[str], FileContent, Optional[str], Mapping[str, str]], +] RequestFiles = list[tuple[str, FileTypes]] @@ -30,8 +30,8 @@ class File: """Contains information for file uploads""" payload: BinaryIO - file_name: str | None = None - mime_type: str | None = None + file_name: Optional[str] = None + mime_type: Optional[str] = None def to_tuple(self) -> FileTypes: """Return a tuple representation that httpx will accept for multipart/form-data""" @@ -48,7 +48,7 @@ class Response(Generic[T]): status_code: HTTPStatus content: bytes headers: MutableMapping[str, str] - parsed: T | None + parsed: Optional[T] __all__ = ["UNSET", "File", "FileTypes", "RequestFiles", "Response", "Unset"] From d4a325a6f85fb1eb1af30dca6018c8fbd5c8afa7 Mon Sep 17 00:00:00 2001 From: Tomas Beran Date: Fri, 13 Feb 2026 16:58:36 -0800 Subject: [PATCH 5/5] Fix CI failures: TS type annotation and generated file style - Add explicit type for `item` parameter in getTemplateTags .map() to fix TS7006 error in CLI build - Rewrite generated Python files to match CI's openapi-python-client output style (Union/Optional syntax, f-strings, no __future__ import) --- packages/js-sdk/src/template/buildApi.ts | 4 +-- .../tags/get_templates_template_id_tags.py | 36 ++++++++----------- .../e2b/api/client/models/template_tag.py | 2 -- 3 files changed, 16 insertions(+), 26 deletions(-) diff --git a/packages/js-sdk/src/template/buildApi.ts b/packages/js-sdk/src/template/buildApi.ts index 3306c2f74f..d699efe03c 100644 --- a/packages/js-sdk/src/template/buildApi.ts +++ b/packages/js-sdk/src/template/buildApi.ts @@ -1,4 +1,4 @@ -import { ApiClient, handleApiError, paths } from '../api' +import { ApiClient, handleApiError, paths, components } from '../api' import { stripAnsi } from '../utils' import { BuildError, FileUploadError, TemplateError } from '../errors' import { LogEntry } from './logger' @@ -381,7 +381,7 @@ export async function getTemplateTags( throw new TemplateError('Failed to get template tags') } - return res.data.map((item) => ({ + return res.data.map((item: components['schemas']['TemplateTag']) => ({ tag: item.tag, buildId: item.buildID, createdAt: new Date(item.createdAt), diff --git a/packages/python-sdk/e2b/api/client/api/tags/get_templates_template_id_tags.py b/packages/python-sdk/e2b/api/client/api/tags/get_templates_template_id_tags.py index b279f94428..1bc7dd7537 100644 --- a/packages/python-sdk/e2b/api/client/api/tags/get_templates_template_id_tags.py +++ b/packages/python-sdk/e2b/api/client/api/tags/get_templates_template_id_tags.py @@ -1,6 +1,5 @@ from http import HTTPStatus -from typing import Any -from urllib.parse import quote +from typing import Any, Optional, Union import httpx @@ -14,20 +13,17 @@ def _get_kwargs( template_id: str, ) -> dict[str, Any]: - _kwargs: dict[str, Any] = { "method": "get", - "url": "/templates/{template_id}/tags".format( - template_id=quote(str(template_id), safe=""), - ), + "url": f"/templates/{template_id}/tags", } return _kwargs def _parse_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Error | list[TemplateTag] | None: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Optional[Union[Error, list["TemplateTag"]]]: if response.status_code == 200: response_200 = [] _response_200 = response.json() @@ -37,22 +33,18 @@ def _parse_response( response_200.append(response_200_item) return response_200 - if response.status_code == 401: response_401 = Error.from_dict(response.json()) return response_401 - if response.status_code == 404: response_404 = Error.from_dict(response.json()) return response_404 - if response.status_code == 500: response_500 = Error.from_dict(response.json()) return response_500 - if client.raise_on_unexpected_status: raise errors.UnexpectedStatus(response.status_code, response.content) else: @@ -60,8 +52,8 @@ def _parse_response( def _build_response( - *, client: AuthenticatedClient | Client, response: httpx.Response -) -> Response[Error | list[TemplateTag]]: + *, client: Union[AuthenticatedClient, Client], response: httpx.Response +) -> Response[Union[Error, list["TemplateTag"]]]: return Response( status_code=HTTPStatus(response.status_code), content=response.content, @@ -74,7 +66,7 @@ def sync_detailed( template_id: str, *, client: AuthenticatedClient, -) -> Response[Error | list[TemplateTag]]: +) -> Response[Union[Error, list["TemplateTag"]]]: """List all tags for a template Args: @@ -85,7 +77,7 @@ def sync_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | list[TemplateTag]] + Response[Union[Error, list['TemplateTag']]] """ kwargs = _get_kwargs( @@ -103,7 +95,7 @@ def sync( template_id: str, *, client: AuthenticatedClient, -) -> Error | list[TemplateTag] | None: +) -> Optional[Union[Error, list["TemplateTag"]]]: """List all tags for a template Args: @@ -114,7 +106,7 @@ def sync( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | list[TemplateTag] + Union[Error, list['TemplateTag']] """ return sync_detailed( @@ -127,7 +119,7 @@ async def asyncio_detailed( template_id: str, *, client: AuthenticatedClient, -) -> Response[Error | list[TemplateTag]]: +) -> Response[Union[Error, list["TemplateTag"]]]: """List all tags for a template Args: @@ -138,7 +130,7 @@ async def asyncio_detailed( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Response[Error | list[TemplateTag]] + Response[Union[Error, list['TemplateTag']]] """ kwargs = _get_kwargs( @@ -154,7 +146,7 @@ async def asyncio( template_id: str, *, client: AuthenticatedClient, -) -> Error | list[TemplateTag] | None: +) -> Optional[Union[Error, list["TemplateTag"]]]: """List all tags for a template Args: @@ -165,7 +157,7 @@ async def asyncio( httpx.TimeoutException: If the request takes longer than Client.timeout. Returns: - Error | list[TemplateTag] + Union[Error, list['TemplateTag']] """ return ( diff --git a/packages/python-sdk/e2b/api/client/models/template_tag.py b/packages/python-sdk/e2b/api/client/models/template_tag.py index a140786836..7718241281 100644 --- a/packages/python-sdk/e2b/api/client/models/template_tag.py +++ b/packages/python-sdk/e2b/api/client/models/template_tag.py @@ -1,5 +1,3 @@ -from __future__ import annotations - import datetime from collections.abc import Mapping from typing import Any, TypeVar