From d47871a637eec84f48452a29ae43de95b31e5dfc Mon Sep 17 00:00:00 2001 From: Jakub Novak Date: Fri, 13 Oct 2023 12:33:34 -0700 Subject: [PATCH] Regenerate python clients --- packages/python-sdk/Makefile | 5 +- .../python-sdk/e2b/api/v1/client/__init__.py | 20 +- .../e2b/api/v1/client/api/__init__.py | 2 +- .../e2b/api/v1/client/api/default_api.py | 6 +- .../e2b/api/v1/client/api/envs_api.py | 1005 ++-------------- .../e2b/api/v1/client/api/sessions_api.py | 748 ------------ .../e2b/api/v1/client/api_client.py | 6 +- .../e2b/api/v1/client/configuration.py | 65 +- .../e2b/api/v1/client/exceptions.py | 6 +- .../e2b/api/v1/client/models/__init__.py | 18 +- .../e2b/api/v1/client/models/environment.py | 37 +- .../api/v1/client/models/environment_state.py | 36 - .../client/models/environment_state_update.py | 75 -- .../client/models/environment_title_update.py | 75 -- .../models/envs_get200_response_inner.py | 37 +- .../e2b/api/v1/client/models/error.py | 6 +- .../api/v1/client/models/new_environment.py | 78 -- .../e2b/api/v1/client/models/new_session.py | 91 -- .../e2b/api/v1/client/models/session.py | 96 -- .../models/sessions_get200_response_inner.py | 96 -- .../e2b/api/v1/client/models/template.py | 42 - packages/python-sdk/e2b/api/v1/client/rest.py | 6 +- .../python-sdk/e2b/api/v1/client_README.md | 41 +- .../python-sdk/e2b/api/v2/client/__init__.py | 17 +- .../e2b/api/v2/client/api/__init__.py | 2 +- .../e2b/api/v2/client/api/default_api.py | 6 +- .../e2b/api/v2/client/api/envs_api.py | 1028 +++-------------- .../e2b/api/v2/client/api/sessions_api.py | 739 ------------ .../e2b/api/v2/client/api_client.py | 6 +- .../e2b/api/v2/client/configuration.py | 62 +- .../e2b/api/v2/client/exceptions.py | 6 +- .../e2b/api/v2/client/models/__init__.py | 15 +- .../e2b/api/v2/client/models/environment.py | 37 +- .../api/v2/client/models/environment_state.py | 36 - .../client/models/environment_state_update.py | 74 -- .../client/models/environment_title_update.py | 74 -- .../e2b/api/v2/client/models/error.py | 6 +- .../api/v2/client/models/new_environment.py | 77 -- .../e2b/api/v2/client/models/new_session.py | 90 -- .../e2b/api/v2/client/models/session.py | 95 -- .../e2b/api/v2/client/models/template.py | 42 - packages/python-sdk/e2b/api/v2/client/rest.py | 6 +- .../python-sdk/e2b/api/v2/client_README.md | 40 +- packages/python-sdk/e2b/session/main.py | 6 +- packages/python-sdk/e2b/session/run_code.py | 6 +- .../python-sdk/tests/test_file_download.py | 4 +- packages/python-sdk/tests/test_file_upload.py | 1 + spec/openapi.yml | 366 ++---- 48 files changed, 599 insertions(+), 4839 deletions(-) delete mode 100644 packages/python-sdk/e2b/api/v1/client/api/sessions_api.py delete mode 100644 packages/python-sdk/e2b/api/v1/client/models/environment_state.py delete mode 100644 packages/python-sdk/e2b/api/v1/client/models/environment_state_update.py delete mode 100644 packages/python-sdk/e2b/api/v1/client/models/environment_title_update.py delete mode 100644 packages/python-sdk/e2b/api/v1/client/models/new_environment.py delete mode 100644 packages/python-sdk/e2b/api/v1/client/models/new_session.py delete mode 100644 packages/python-sdk/e2b/api/v1/client/models/session.py delete mode 100644 packages/python-sdk/e2b/api/v1/client/models/sessions_get200_response_inner.py delete mode 100644 packages/python-sdk/e2b/api/v1/client/models/template.py delete mode 100644 packages/python-sdk/e2b/api/v2/client/api/sessions_api.py delete mode 100644 packages/python-sdk/e2b/api/v2/client/models/environment_state.py delete mode 100644 packages/python-sdk/e2b/api/v2/client/models/environment_state_update.py delete mode 100644 packages/python-sdk/e2b/api/v2/client/models/environment_title_update.py delete mode 100644 packages/python-sdk/e2b/api/v2/client/models/new_environment.py delete mode 100644 packages/python-sdk/e2b/api/v2/client/models/new_session.py delete mode 100644 packages/python-sdk/e2b/api/v2/client/models/session.py delete mode 100644 packages/python-sdk/e2b/api/v2/client/models/template.py diff --git a/packages/python-sdk/Makefile b/packages/python-sdk/Makefile index 3dcf603ee..c4e2d5a0b 100644 --- a/packages/python-sdk/Makefile +++ b/packages/python-sdk/Makefile @@ -5,7 +5,7 @@ generate-v2: # Waiting for https://github.com/OpenAPITools/openapi-generator/pull/16655 to be merged # Using this branch to use pydantic v2: https://github.com/fa0311/openapi-generator/tree/oshmoun-master-2 # After released, use npx -yes @openapitools/openapi-generator-cli generate - java -jar /openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \ + java -jar ~/Work/e2b/openapi-generator/modules/openapi-generator-cli/target/openapi-generator-cli.jar generate \ -i ../../spec/openapi.yml \ --library asyncio \ -g python \ @@ -43,3 +43,6 @@ generate-v1: rm -r ./e2b/api/.openapi-generator mv ./e2b/api/__init__.py.bck ./e2b/api/__init__.py black . + +.PHONY: generate +generate: generate-v1 generate-v2 diff --git a/packages/python-sdk/e2b/api/v1/client/__init__.py b/packages/python-sdk/e2b/api/v1/client/__init__.py index a897a1620..ccdf7a0cf 100644 --- a/packages/python-sdk/e2b/api/v1/client/__init__.py +++ b/packages/python-sdk/e2b/api/v1/client/__init__.py @@ -3,11 +3,11 @@ # flake8: noqa """ - Devbook + E2B API - Devbook API # noqa: E501 + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,7 +19,7 @@ # import apis into sdk package from e2b.api.v1.client.api.default_api import DefaultApi from e2b.api.v1.client.api.envs_api import EnvsApi -from e2b.api.v1.client.api.sessions_api import SessionsApi +from e2b.api.v1.client.api.instances_api import InstancesApi # import ApiClient from e2b.api.v1.client.api_response import ApiResponse @@ -34,15 +34,7 @@ # import models into sdk package from e2b.api.v1.client.models.environment import Environment -from e2b.api.v1.client.models.environment_state import EnvironmentState -from e2b.api.v1.client.models.environment_state_update import EnvironmentStateUpdate -from e2b.api.v1.client.models.environment_title_update import EnvironmentTitleUpdate from e2b.api.v1.client.models.envs_get200_response_inner import EnvsGet200ResponseInner from e2b.api.v1.client.models.error import Error -from e2b.api.v1.client.models.new_environment import NewEnvironment -from e2b.api.v1.client.models.new_session import NewSession -from e2b.api.v1.client.models.session import Session -from e2b.api.v1.client.models.sessions_get200_response_inner import ( - SessionsGet200ResponseInner, -) -from e2b.api.v1.client.models.template import Template +from e2b.api.v1.client.models.instance import Instance +from e2b.api.v1.client.models.new_instance import NewInstance diff --git a/packages/python-sdk/e2b/api/v1/client/api/__init__.py b/packages/python-sdk/e2b/api/v1/client/api/__init__.py index f1ca49c03..b4f6ed3fb 100644 --- a/packages/python-sdk/e2b/api/v1/client/api/__init__.py +++ b/packages/python-sdk/e2b/api/v1/client/api/__init__.py @@ -3,4 +3,4 @@ # import apis into api package from e2b.api.v1.client.api.default_api import DefaultApi from e2b.api.v1.client.api.envs_api import EnvsApi -from e2b.api.v1.client.api.sessions_api import SessionsApi +from e2b.api.v1.client.api.instances_api import InstancesApi diff --git a/packages/python-sdk/e2b/api/v1/client/api/default_api.py b/packages/python-sdk/e2b/api/v1/client/api/default_api.py index deb32527a..e81b881b5 100644 --- a/packages/python-sdk/e2b/api/v1/client/api/default_api.py +++ b/packages/python-sdk/e2b/api/v1/client/api/default_api.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API # noqa: E501 + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/packages/python-sdk/e2b/api/v1/client/api/envs_api.py b/packages/python-sdk/e2b/api/v1/client/api/envs_api.py index a2ba1d006..6f85cc536 100644 --- a/packages/python-sdk/e2b/api/v1/client/api/envs_api.py +++ b/packages/python-sdk/e2b/api/v1/client/api/envs_api.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API # noqa: E501 + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -20,15 +20,12 @@ from typing_extensions import Annotated from typing import overload, Optional, Union, Awaitable -from pydantic import StrictStr +from pydantic import Field, StrictBytes, StrictStr -from typing import List +from typing import List, Optional, Union from e2b.api.v1.client.models.environment import Environment -from e2b.api.v1.client.models.environment_state_update import EnvironmentStateUpdate -from e2b.api.v1.client.models.environment_title_update import EnvironmentTitleUpdate from e2b.api.v1.client.models.envs_get200_response_inner import EnvsGet200ResponseInner -from e2b.api.v1.client.models.new_environment import NewEnvironment from e2b.api.v1.client.api_client import ApiClient from e2b.api.v1.client.api_response import ApiResponse @@ -48,796 +45,32 @@ def __init__(self, api_client=None): self.api_client = api_client @overload - async def envs_code_snippet_id_delete( - self, api_key: StrictStr, code_snippet_id: StrictStr, **kwargs - ) -> None: # noqa: E501 - ... - - @overload - def envs_code_snippet_id_delete( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 - ... - - @validate_arguments - def envs_code_snippet_id_delete( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """envs_code_snippet_id_delete # noqa: E501 - - Delete the code snippet environment # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_delete(api_key, code_snippet_id, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - raise ValueError( - "Error! Please call the envs_code_snippet_id_delete_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" - ) - if async_req is not None: - kwargs["async_req"] = async_req - return self.envs_code_snippet_id_delete_with_http_info( - api_key, code_snippet_id, **kwargs - ) # noqa: E501 - - @validate_arguments - def envs_code_snippet_id_delete_with_http_info( - self, api_key: StrictStr, code_snippet_id: StrictStr, **kwargs - ) -> ApiResponse: # noqa: E501 - """envs_code_snippet_id_delete # noqa: E501 - - Delete the code snippet environment # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_delete_with_http_info(api_key, code_snippet_id, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["api_key", "code_snippet_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method envs_code_snippet_id_delete" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["code_snippet_id"]: - _path_params["codeSnippetID"] = _params["code_snippet_id"] - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - "/envs/{codeSnippetID}", - "DELETE", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def envs_code_snippet_id_patch( - self, api_key: StrictStr, code_snippet_id: StrictStr, **kwargs - ) -> None: # noqa: E501 - ... - - @overload - def envs_code_snippet_id_patch( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 - ... - - @validate_arguments - def envs_code_snippet_id_patch( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """envs_code_snippet_id_patch # noqa: E501 - - Update the environment of the code snippet to match the edit environment # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_patch(api_key, code_snippet_id, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - raise ValueError( - "Error! Please call the envs_code_snippet_id_patch_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" - ) - if async_req is not None: - kwargs["async_req"] = async_req - return self.envs_code_snippet_id_patch_with_http_info( - api_key, code_snippet_id, **kwargs - ) # noqa: E501 - - @validate_arguments - def envs_code_snippet_id_patch_with_http_info( - self, api_key: StrictStr, code_snippet_id: StrictStr, **kwargs - ) -> ApiResponse: # noqa: E501 - """envs_code_snippet_id_patch # noqa: E501 - - Update the environment of the code snippet to match the edit environment # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_patch_with_http_info(api_key, code_snippet_id, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["api_key", "code_snippet_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method envs_code_snippet_id_patch" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["code_snippet_id"]: - _path_params["codeSnippetID"] = _params["code_snippet_id"] - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - "/envs/{codeSnippetID}", - "PATCH", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def envs_code_snippet_id_post( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - new_environment: NewEnvironment, - **kwargs - ) -> None: # noqa: E501 - ... - - @overload - def envs_code_snippet_id_post( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - new_environment: NewEnvironment, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 - ... - - @validate_arguments - def envs_code_snippet_id_post( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - new_environment: NewEnvironment, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """envs_code_snippet_id_post # noqa: E501 - - Create a new env for a code snippet # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_post(api_key, code_snippet_id, new_environment, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param new_environment: (required) - :type new_environment: NewEnvironment - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - raise ValueError( - "Error! Please call the envs_code_snippet_id_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" - ) - if async_req is not None: - kwargs["async_req"] = async_req - return self.envs_code_snippet_id_post_with_http_info( - api_key, code_snippet_id, new_environment, **kwargs - ) # noqa: E501 - - @validate_arguments - def envs_code_snippet_id_post_with_http_info( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - new_environment: NewEnvironment, - **kwargs - ) -> ApiResponse: # noqa: E501 - """envs_code_snippet_id_post # noqa: E501 - - Create a new env for a code snippet # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_post_with_http_info(api_key, code_snippet_id, new_environment, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param new_environment: (required) - :type new_environment: NewEnvironment - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["api_key", "code_snippet_id", "new_environment"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method envs_code_snippet_id_post" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["code_snippet_id"]: - _path_params["codeSnippetID"] = _params["code_snippet_id"] - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["new_environment"] is not None: - _body_params = _params["new_environment"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - "/envs/{codeSnippetID}", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def envs_code_snippet_id_state_put( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_state_update: EnvironmentStateUpdate, - **kwargs - ) -> None: # noqa: E501 - ... - - @overload - def envs_code_snippet_id_state_put( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_state_update: EnvironmentStateUpdate, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 - ... - - @validate_arguments - def envs_code_snippet_id_state_put( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_state_update: EnvironmentStateUpdate, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """envs_code_snippet_id_state_put # noqa: E501 - - Update the state of the environment # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_state_put(api_key, code_snippet_id, environment_state_update, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param environment_state_update: (required) - :type environment_state_update: EnvironmentStateUpdate - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - raise ValueError( - "Error! Please call the envs_code_snippet_id_state_put_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" - ) - if async_req is not None: - kwargs["async_req"] = async_req - return self.envs_code_snippet_id_state_put_with_http_info( - api_key, code_snippet_id, environment_state_update, **kwargs - ) # noqa: E501 - - @validate_arguments - def envs_code_snippet_id_state_put_with_http_info( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_state_update: EnvironmentStateUpdate, - **kwargs - ) -> ApiResponse: # noqa: E501 - """envs_code_snippet_id_state_put # noqa: E501 - - Update the state of the environment # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_state_put_with_http_info(api_key, code_snippet_id, environment_state_update, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param environment_state_update: (required) - :type environment_state_update: EnvironmentStateUpdate - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["api_key", "code_snippet_id", "environment_state_update"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method envs_code_snippet_id_state_put" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["code_snippet_id"]: - _path_params["codeSnippetID"] = _params["code_snippet_id"] - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["environment_state_update"] is not None: - _body_params = _params["environment_state_update"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - "/envs/{codeSnippetID}/state", - "PUT", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def envs_code_snippet_id_title_put( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_title_update: EnvironmentTitleUpdate, - **kwargs - ) -> None: # noqa: E501 + async def envs_env_id_get( + self, env_id: StrictStr, **kwargs + ) -> Environment: # noqa: E501 ... @overload - def envs_code_snippet_id_title_put( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_title_update: EnvironmentTitleUpdate, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 + def envs_env_id_get( + self, env_id: StrictStr, async_req: Optional[bool] = True, **kwargs + ) -> Environment: # noqa: E501 ... @validate_arguments - def envs_code_snippet_id_title_put( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_title_update: EnvironmentTitleUpdate, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """envs_code_snippet_id_title_put # noqa: E501 + def envs_env_id_get( + self, env_id: StrictStr, async_req: Optional[bool] = None, **kwargs + ) -> Union[Environment, Awaitable[Environment]]: # noqa: E501 + """envs_env_id_get # noqa: E501 - Update the title of the environment # noqa: E501 + Get environment info # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.envs_code_snippet_id_title_put(api_key, code_snippet_id, environment_title_update, async_req=True) + >>> thread = api.envs_env_id_get(env_id, async_req=True) >>> result = thread.get() - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param environment_title_update: (required) - :type environment_title_update: EnvironmentTitleUpdate + :param env_id: (required) + :type env_id: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one @@ -847,42 +80,32 @@ def envs_code_snippet_id_title_put( :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: None + :rtype: Environment """ kwargs["_return_http_data_only"] = True if "_preload_content" in kwargs: raise ValueError( - "Error! Please call the envs_code_snippet_id_title_put_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" + "Error! Please call the envs_env_id_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" ) if async_req is not None: kwargs["async_req"] = async_req - return self.envs_code_snippet_id_title_put_with_http_info( - api_key, code_snippet_id, environment_title_update, **kwargs - ) # noqa: E501 + return self.envs_env_id_get_with_http_info(env_id, **kwargs) # noqa: E501 @validate_arguments - def envs_code_snippet_id_title_put_with_http_info( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_title_update: EnvironmentTitleUpdate, - **kwargs + def envs_env_id_get_with_http_info( + self, env_id: StrictStr, **kwargs ) -> ApiResponse: # noqa: E501 - """envs_code_snippet_id_title_put # noqa: E501 + """envs_env_id_get # noqa: E501 - Update the title of the environment # noqa: E501 + Get environment info # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.envs_code_snippet_id_title_put_with_http_info(api_key, code_snippet_id, environment_title_update, async_req=True) + >>> thread = api.envs_env_id_get_with_http_info(env_id, async_req=True) >>> result = thread.get() - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param environment_title_update: (required) - :type environment_title_update: EnvironmentTitleUpdate + :param env_id: (required) + :type env_id: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _preload_content: if False, the ApiResponse.data will @@ -905,12 +128,12 @@ def envs_code_snippet_id_title_put_with_http_info( :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: None + :rtype: tuple(Environment, status_code(int), headers(HTTPHeaderDict)) """ _params = locals() - _all_params = ["api_key", "code_snippet_id", "environment_title_update"] + _all_params = ["env_id"] _all_params.extend( [ "async_req", @@ -928,7 +151,7 @@ def envs_code_snippet_id_title_put_with_http_info( if _key not in _all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method envs_code_snippet_id_title_put" % _key + " to method envs_env_id_get" % _key ) _params[_key] = _val del _params["kwargs"] @@ -937,14 +160,11 @@ def envs_code_snippet_id_title_put_with_http_info( # process the path parameters _path_params = {} - if _params["code_snippet_id"]: - _path_params["codeSnippetID"] = _params["code_snippet_id"] + if _params["env_id"]: + _path_params["envID"] = _params["env_id"] # process the query parameters _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - # process the header parameters _header_params = dict(_params.get("_headers", {})) # process the form parameters @@ -952,30 +172,24 @@ def envs_code_snippet_id_title_put_with_http_info( _files = {} # process the body parameter _body_params = None - if _params["environment_title_update"] is not None: - _body_params = _params["environment_title_update"] - # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] ) # noqa: E501 - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - # authentication setting - _auth_settings = [] # noqa: E501 + _auth_settings = ["AccessTokenAuth"] # noqa: E501 - _response_types_map = {} + _response_types_map = { + "200": "Environment", + "401": "Error", + "404": "Error", + "500": "Error", + } return self.api_client.call_api( - "/envs/{codeSnippetID}/title", - "PUT", + "/envs/{envID}", + "GET", _path_params, _query_params, _header_params, @@ -993,20 +207,18 @@ def envs_code_snippet_id_title_put_with_http_info( ) @overload - async def envs_get( - self, api_key: StrictStr, **kwargs - ) -> List[EnvsGet200ResponseInner]: # noqa: E501 + async def envs_get(self, **kwargs) -> List[EnvsGet200ResponseInner]: # noqa: E501 ... @overload def envs_get( - self, api_key: StrictStr, async_req: Optional[bool] = True, **kwargs + self, async_req: Optional[bool] = True, **kwargs ) -> List[EnvsGet200ResponseInner]: # noqa: E501 ... @validate_arguments def envs_get( - self, api_key: StrictStr, async_req: Optional[bool] = None, **kwargs + self, async_req: Optional[bool] = None, **kwargs ) -> Union[ List[EnvsGet200ResponseInner], Awaitable[List[EnvsGet200ResponseInner]] ]: # noqa: E501 @@ -1016,11 +228,9 @@ def envs_get( This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.envs_get(api_key, async_req=True) + >>> thread = api.envs_get(async_req=True) >>> result = thread.get() - :param api_key: (required) - :type api_key: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one @@ -1039,23 +249,19 @@ def envs_get( ) if async_req is not None: kwargs["async_req"] = async_req - return self.envs_get_with_http_info(api_key, **kwargs) # noqa: E501 + return self.envs_get_with_http_info(**kwargs) # noqa: E501 @validate_arguments - def envs_get_with_http_info( - self, api_key: StrictStr, **kwargs - ) -> ApiResponse: # noqa: E501 + def envs_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """envs_get # noqa: E501 List all environments # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.envs_get_with_http_info(api_key, async_req=True) + >>> thread = api.envs_get_with_http_info(async_req=True) >>> result = thread.get() - :param api_key: (required) - :type api_key: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _preload_content: if False, the ApiResponse.data will @@ -1083,7 +289,7 @@ def envs_get_with_http_info( _params = locals() - _all_params = ["api_key"] + _all_params = [] _all_params.extend( [ "async_req", @@ -1113,9 +319,6 @@ def envs_get_with_http_info( # process the query parameters _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - # process the header parameters _header_params = dict(_params.get("_headers", {})) # process the form parameters @@ -1129,7 +332,7 @@ def envs_get_with_http_info( ) # noqa: E501 # authentication setting - _auth_settings = [] # noqa: E501 + _auth_settings = ["AccessTokenAuth"] # noqa: E501 _response_types_map = { "200": "List[EnvsGet200ResponseInner]", @@ -1158,15 +361,36 @@ def envs_get_with_http_info( @overload async def envs_post( - self, api_key: StrictStr, new_environment: NewEnvironment, **kwargs + self, + build_context: Annotated[ + Union[StrictBytes, StrictStr], + Field(..., description="Docker build context"), + ], + dockerfile: Annotated[StrictStr, Field(..., description="Dockerfile content")], + env_id: Annotated[ + Optional[StrictStr], + Field( + description="ID of the environment, only present if the environment should be rebuilt" + ), + ] = None, + **kwargs ) -> Environment: # noqa: E501 ... @overload def envs_post( self, - api_key: StrictStr, - new_environment: NewEnvironment, + build_context: Annotated[ + Union[StrictBytes, StrictStr], + Field(..., description="Docker build context"), + ], + dockerfile: Annotated[StrictStr, Field(..., description="Dockerfile content")], + env_id: Annotated[ + Optional[StrictStr], + Field( + description="ID of the environment, only present if the environment should be rebuilt" + ), + ] = None, async_req: Optional[bool] = True, **kwargs ) -> Environment: # noqa: E501 @@ -1175,8 +399,17 @@ def envs_post( @validate_arguments def envs_post( self, - api_key: StrictStr, - new_environment: NewEnvironment, + build_context: Annotated[ + Union[StrictBytes, StrictStr], + Field(..., description="Docker build context"), + ], + dockerfile: Annotated[StrictStr, Field(..., description="Dockerfile content")], + env_id: Annotated[ + Optional[StrictStr], + Field( + description="ID of the environment, only present if the environment should be rebuilt" + ), + ] = None, async_req: Optional[bool] = None, **kwargs ) -> Union[Environment, Awaitable[Environment]]: # noqa: E501 @@ -1186,13 +419,15 @@ def envs_post( This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.envs_post(api_key, new_environment, async_req=True) + >>> thread = api.envs_post(build_context, dockerfile, env_id, async_req=True) >>> result = thread.get() - :param api_key: (required) - :type api_key: str - :param new_environment: (required) - :type new_environment: NewEnvironment + :param build_context: Docker build context (required) + :type build_context: bytearray + :param dockerfile: Dockerfile content (required) + :type dockerfile: str + :param env_id: ID of the environment, only present if the environment should be rebuilt + :type env_id: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _request_timeout: timeout setting for this request. If one @@ -1212,12 +447,24 @@ def envs_post( if async_req is not None: kwargs["async_req"] = async_req return self.envs_post_with_http_info( - api_key, new_environment, **kwargs + build_context, dockerfile, env_id, **kwargs ) # noqa: E501 @validate_arguments def envs_post_with_http_info( - self, api_key: StrictStr, new_environment: NewEnvironment, **kwargs + self, + build_context: Annotated[ + Union[StrictBytes, StrictStr], + Field(..., description="Docker build context"), + ], + dockerfile: Annotated[StrictStr, Field(..., description="Dockerfile content")], + env_id: Annotated[ + Optional[StrictStr], + Field( + description="ID of the environment, only present if the environment should be rebuilt" + ), + ] = None, + **kwargs ) -> ApiResponse: # noqa: E501 """envs_post # noqa: E501 @@ -1225,13 +472,15 @@ def envs_post_with_http_info( This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.envs_post_with_http_info(api_key, new_environment, async_req=True) + >>> thread = api.envs_post_with_http_info(build_context, dockerfile, env_id, async_req=True) >>> result = thread.get() - :param api_key: (required) - :type api_key: str - :param new_environment: (required) - :type new_environment: NewEnvironment + :param build_context: Docker build context (required) + :type build_context: bytearray + :param dockerfile: Dockerfile content (required) + :type dockerfile: str + :param env_id: ID of the environment, only present if the environment should be rebuilt + :type env_id: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _preload_content: if False, the ApiResponse.data will @@ -1259,7 +508,7 @@ def envs_post_with_http_info( _params = locals() - _all_params = ["api_key", "new_environment"] + _all_params = ["build_context", "dockerfile", "env_id"] _all_params.extend( [ "async_req", @@ -1289,19 +538,22 @@ def envs_post_with_http_info( # process the query parameters _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - # process the header parameters _header_params = dict(_params.get("_headers", {})) # process the form parameters _form_params = [] _files = {} + if _params["build_context"]: + _files["buildContext"] = _params["build_context"] + + if _params["dockerfile"]: + _form_params.append(("dockerfile", _params["dockerfile"])) + + if _params["env_id"]: + _form_params.append(("envID", _params["env_id"])) + # process the body parameter _body_params = None - if _params["new_environment"] is not None: - _body_params = _params["new_environment"] - # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] @@ -1310,17 +562,16 @@ def envs_post_with_http_info( # set the HTTP header `Content-Type` _content_types_list = _params.get( "_content_type", - self.api_client.select_header_content_type(["application/json"]), + self.api_client.select_header_content_type(["multipart/form-data"]), ) if _content_types_list: _header_params["Content-Type"] = _content_types_list # authentication setting - _auth_settings = [] # noqa: E501 + _auth_settings = ["AccessTokenAuth"] # noqa: E501 _response_types_map = { - "200": "Environment", - "400": "Error", + "202": "Environment", "401": "Error", "500": "Error", } diff --git a/packages/python-sdk/e2b/api/v1/client/api/sessions_api.py b/packages/python-sdk/e2b/api/v1/client/api/sessions_api.py deleted file mode 100644 index 99b2a0a84..000000000 --- a/packages/python-sdk/e2b/api/v1/client/api/sessions_api.py +++ /dev/null @@ -1,748 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -import re # noqa: F401 -import io -import warnings - -from pydantic import validate_arguments, ValidationError -from typing_extensions import Annotated -from typing import overload, Optional, Union, Awaitable - -from pydantic import StrictStr - -from typing import List, Optional - -from e2b.api.v1.client.models.new_session import NewSession -from e2b.api.v1.client.models.session import Session -from e2b.api.v1.client.models.sessions_get200_response_inner import ( - SessionsGet200ResponseInner, -) - -from e2b.api.v1.client.api_client import ApiClient -from e2b.api.v1.client.api_response import ApiResponse -from e2b.api.v1.client.exceptions import ApiTypeError, ApiValueError # noqa: F401 - - -class SessionsApi(object): - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None): - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - @overload - async def sessions_get( - self, api_key: StrictStr, **kwargs - ) -> List[SessionsGet200ResponseInner]: # noqa: E501 - ... - - @overload - def sessions_get( - self, api_key: StrictStr, async_req: Optional[bool] = True, **kwargs - ) -> List[SessionsGet200ResponseInner]: # noqa: E501 - ... - - @validate_arguments - def sessions_get( - self, api_key: StrictStr, async_req: Optional[bool] = None, **kwargs - ) -> Union[ - List[SessionsGet200ResponseInner], Awaitable[List[SessionsGet200ResponseInner]] - ]: # noqa: E501 - """sessions_get # noqa: E501 - - List all sessions # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_get(api_key, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[SessionsGet200ResponseInner] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - raise ValueError( - "Error! Please call the sessions_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" - ) - if async_req is not None: - kwargs["async_req"] = async_req - return self.sessions_get_with_http_info(api_key, **kwargs) # noqa: E501 - - @validate_arguments - def sessions_get_with_http_info( - self, api_key: StrictStr, **kwargs - ) -> ApiResponse: # noqa: E501 - """sessions_get # noqa: E501 - - List all sessions # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_get_with_http_info(api_key, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[SessionsGet200ResponseInner], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["api_key"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method sessions_get" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "List[SessionsGet200ResponseInner]", - "401": "Error", - "500": "Error", - } - - return self.api_client.call_api( - "/sessions", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def sessions_post( - self, new_session: NewSession, api_key: Optional[StrictStr] = None, **kwargs - ) -> Session: # noqa: E501 - ... - - @overload - def sessions_post( - self, - new_session: NewSession, - api_key: Optional[StrictStr] = None, - async_req: Optional[bool] = True, - **kwargs - ) -> Session: # noqa: E501 - ... - - @validate_arguments - def sessions_post( - self, - new_session: NewSession, - api_key: Optional[StrictStr] = None, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[Session, Awaitable[Session]]: # noqa: E501 - """sessions_post # noqa: E501 - - Create a session on the server # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_post(new_session, api_key, async_req=True) - >>> result = thread.get() - - :param new_session: (required) - :type new_session: NewSession - :param api_key: - :type api_key: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Session - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - raise ValueError( - "Error! Please call the sessions_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" - ) - if async_req is not None: - kwargs["async_req"] = async_req - return self.sessions_post_with_http_info( - new_session, api_key, **kwargs - ) # noqa: E501 - - @validate_arguments - def sessions_post_with_http_info( - self, new_session: NewSession, api_key: Optional[StrictStr] = None, **kwargs - ) -> ApiResponse: # noqa: E501 - """sessions_post # noqa: E501 - - Create a session on the server # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_post_with_http_info(new_session, api_key, async_req=True) - >>> result = thread.get() - - :param new_session: (required) - :type new_session: NewSession - :param api_key: - :type api_key: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Session, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["new_session", "api_key"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method sessions_post" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["new_session"] is not None: - _body_params = _params["new_session"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "201": "Session", - "401": "Error", - "400": "Error", - "500": "Error", - } - - return self.api_client.call_api( - "/sessions", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def sessions_session_id_delete( - self, api_key: StrictStr, session_id: StrictStr, **kwargs - ) -> None: # noqa: E501 - ... - - @overload - def sessions_session_id_delete( - self, - api_key: StrictStr, - session_id: StrictStr, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 - ... - - @validate_arguments - def sessions_session_id_delete( - self, - api_key: StrictStr, - session_id: StrictStr, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """sessions_session_id_delete # noqa: E501 - - Delete a session on the server # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_session_id_delete(api_key, session_id, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param session_id: (required) - :type session_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - raise ValueError( - "Error! Please call the sessions_session_id_delete_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" - ) - if async_req is not None: - kwargs["async_req"] = async_req - return self.sessions_session_id_delete_with_http_info( - api_key, session_id, **kwargs - ) # noqa: E501 - - @validate_arguments - def sessions_session_id_delete_with_http_info( - self, api_key: StrictStr, session_id: StrictStr, **kwargs - ) -> ApiResponse: # noqa: E501 - """sessions_session_id_delete # noqa: E501 - - Delete a session on the server # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_session_id_delete_with_http_info(api_key, session_id, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param session_id: (required) - :type session_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["api_key", "session_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method sessions_session_id_delete" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["session_id"]: - _path_params["sessionID"] = _params["session_id"] - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - "/sessions/{sessionID}", - "DELETE", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def sessions_session_id_refresh_post( - self, session_id: StrictStr, api_key: Optional[StrictStr] = None, **kwargs - ) -> None: # noqa: E501 - ... - - @overload - def sessions_session_id_refresh_post( - self, - session_id: StrictStr, - api_key: Optional[StrictStr] = None, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 - ... - - @validate_arguments - def sessions_session_id_refresh_post( - self, - session_id: StrictStr, - api_key: Optional[StrictStr] = None, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """sessions_session_id_refresh_post # noqa: E501 - - Refresh the session extending its time to live # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_session_id_refresh_post(session_id, api_key, async_req=True) - >>> result = thread.get() - - :param session_id: (required) - :type session_id: str - :param api_key: - :type api_key: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - raise ValueError( - "Error! Please call the sessions_session_id_refresh_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" - ) - if async_req is not None: - kwargs["async_req"] = async_req - return self.sessions_session_id_refresh_post_with_http_info( - session_id, api_key, **kwargs - ) # noqa: E501 - - @validate_arguments - def sessions_session_id_refresh_post_with_http_info( - self, session_id: StrictStr, api_key: Optional[StrictStr] = None, **kwargs - ) -> ApiResponse: # noqa: E501 - """sessions_session_id_refresh_post # noqa: E501 - - Refresh the session extending its time to live # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_session_id_refresh_post_with_http_info(session_id, api_key, async_req=True) - >>> result = thread.get() - - :param session_id: (required) - :type session_id: str - :param api_key: - :type api_key: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["session_id", "api_key"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method sessions_session_id_refresh_post" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["session_id"]: - _path_params["sessionID"] = _params["session_id"] - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - "/sessions/{sessionID}/refresh", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) diff --git a/packages/python-sdk/e2b/api/v1/client/api_client.py b/packages/python-sdk/e2b/api/v1/client/api_client.py index f7b0b69d2..8ad777abb 100644 --- a/packages/python-sdk/e2b/api/v1/client/api_client.py +++ b/packages/python-sdk/e2b/api/v1/client/api_client.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API # noqa: E501 + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/packages/python-sdk/e2b/api/v1/client/configuration.py b/packages/python-sdk/e2b/api/v1/client/configuration.py index a206b6d70..005573680 100644 --- a/packages/python-sdk/e2b/api/v1/client/configuration.py +++ b/packages/python-sdk/e2b/api/v1/client/configuration.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API # noqa: E501 + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -99,7 +99,7 @@ def __init__( ssl_ca_cert=None, ): """Constructor""" - self._base_path = "https://ondevbook.com" if host is None else host + self._base_path = "https://api.e2b.dev/v1" if host is None else host """Default Base url """ self.server_index = 0 if server_index is None and host is None else server_index @@ -136,6 +136,9 @@ def __init__( self.access_token = access_token """Access token """ + self.access_token = None + """access token for OAuth/Bearer + """ self.logger = {} """Logging Settings """ @@ -391,12 +394,20 @@ def auth_settings(self): if "ApiKeyAuth" in self.api_key: auth["ApiKeyAuth"] = { "type": "api_key", - "in": "query", - "key": "api_key", + "in": "header", + "key": "X-API-Key", "value": self.get_api_key_with_prefix( "ApiKeyAuth", ), } + if self.access_token is not None: + auth["AccessTokenAuth"] = { + "type": "bearer", + "in": "header", + "format": "access_token", + "key": "Authorization", + "value": "Bearer " + self.access_token, + } return auth def to_debug_report(self): @@ -408,7 +419,7 @@ def to_debug_report(self): "Python SDK Debug Report:\n" "OS: {env}\n" "Python Version: {pyversion}\n" - "Version of the API: 1.0.0\n" + "Version of the API: 0.1.0\n" "SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version) ) @@ -419,41 +430,15 @@ def get_host_settings(self): """ return [ { - "url": "https://ondevbook.com", - "description": "API endpoint", - }, - { - "url": "https://{sessionID}-{clientID}.ondevbook.com", - "description": "Session endpoint without a specified port", + "url": "{server}/v1", + "description": "No description provided", "variables": { - "sessionID": { - "description": "ID of the session", - "default_value": "_sessionID", - }, - "clientID": { - "description": "ID of the client", - "default_value": "_clientID", - }, + "server": { + "description": "No description provided", + "default_value": "https://api.e2b.dev", + } }, - }, - { - "url": "https://{port}-{sessionID}-{clientID}.ondevbook.com", - "description": "Session endpoint with a specificed port", - "variables": { - "sessionID": { - "description": "ID of the session", - "default_value": "_sessionID", - }, - "clientID": { - "description": "ID of the client", - "default_value": "_clientID", - }, - "port": { - "description": "Devbook Daemon default port", - "default_value": "49982", - }, - }, - }, + } ] def get_host_from_settings(self, index, variables=None, servers=None): diff --git a/packages/python-sdk/e2b/api/v1/client/exceptions.py b/packages/python-sdk/e2b/api/v1/client/exceptions.py index 442c03e60..adb1ca56c 100644 --- a/packages/python-sdk/e2b/api/v1/client/exceptions.py +++ b/packages/python-sdk/e2b/api/v1/client/exceptions.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API # noqa: E501 + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/packages/python-sdk/e2b/api/v1/client/models/__init__.py b/packages/python-sdk/e2b/api/v1/client/models/__init__.py index 964598998..101f53864 100644 --- a/packages/python-sdk/e2b/api/v1/client/models/__init__.py +++ b/packages/python-sdk/e2b/api/v1/client/models/__init__.py @@ -2,11 +2,11 @@ # flake8: noqa """ - Devbook + E2B API - Devbook API # noqa: E501 + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -15,15 +15,7 @@ # import models into model package from e2b.api.v1.client.models.environment import Environment -from e2b.api.v1.client.models.environment_state import EnvironmentState -from e2b.api.v1.client.models.environment_state_update import EnvironmentStateUpdate -from e2b.api.v1.client.models.environment_title_update import EnvironmentTitleUpdate from e2b.api.v1.client.models.envs_get200_response_inner import EnvsGet200ResponseInner from e2b.api.v1.client.models.error import Error -from e2b.api.v1.client.models.new_environment import NewEnvironment -from e2b.api.v1.client.models.new_session import NewSession -from e2b.api.v1.client.models.session import Session -from e2b.api.v1.client.models.sessions_get200_response_inner import ( - SessionsGet200ResponseInner, -) -from e2b.api.v1.client.models.template import Template +from e2b.api.v1.client.models.instance import Instance +from e2b.api.v1.client.models.new_instance import NewInstance diff --git a/packages/python-sdk/e2b/api/v1/client/models/environment.py b/packages/python-sdk/e2b/api/v1/client/models/environment.py index 42b722466..76d68cf66 100644 --- a/packages/python-sdk/e2b/api/v1/client/models/environment.py +++ b/packages/python-sdk/e2b/api/v1/client/models/environment.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API # noqa: E501 + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,8 +18,7 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, Field, StrictBool, StrictStr, validator class Environment(BaseModel): @@ -27,10 +26,24 @@ class Environment(BaseModel): Environment """ - id: StrictStr = Field(...) - template: Optional[StrictStr] = None - title: Optional[StrictStr] = None - __properties = ["id", "template", "title"] + env_id: StrictStr = Field( + ..., alias="envID", description="Identifier of the environment" + ) + status: StrictStr = Field(..., description="Status of the environment") + public: StrictBool = Field( + ..., + description="Whether the environment is public or only accessible by the team", + ) + __properties = ["envID", "status", "public"] + + @validator("status") + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in ("building", "ready", "error"): + raise ValueError( + "must be one of enum values ('building', 'ready', 'error')" + ) + return value class Config: """Pydantic configuration""" @@ -75,9 +88,9 @@ def from_dict(cls, obj: dict) -> Environment: _obj = Environment.parse_obj( { - "id": obj.get("id"), - "template": obj.get("template"), - "title": obj.get("title"), + "env_id": obj.get("envID"), + "status": obj.get("status"), + "public": obj.get("public"), } ) return _obj diff --git a/packages/python-sdk/e2b/api/v1/client/models/environment_state.py b/packages/python-sdk/e2b/api/v1/client/models/environment_state.py deleted file mode 100644 index 0674e93a0..000000000 --- a/packages/python-sdk/e2b/api/v1/client/models/environment_state.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - -class EnvironmentState(str, Enum): - """ - EnvironmentState - """ - - """ - allowed enum values - """ - BUILDING = "Building" - FAILED = "Failed" - DONE = "Done" - - @classmethod - def from_json(cls, json_str: str) -> EnvironmentState: - """Create an instance of EnvironmentState from a JSON string""" - return EnvironmentState(json.loads(json_str)) diff --git a/packages/python-sdk/e2b/api/v1/client/models/environment_state_update.py b/packages/python-sdk/e2b/api/v1/client/models/environment_state_update.py deleted file mode 100644 index 84adc9f33..000000000 --- a/packages/python-sdk/e2b/api/v1/client/models/environment_state_update.py +++ /dev/null @@ -1,75 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from pydantic import BaseModel, Field -from e2b.api.v1.client.models.environment_state import EnvironmentState - - -class EnvironmentStateUpdate(BaseModel): - """ - EnvironmentStateUpdate - """ - - state: EnvironmentState = Field(...) - __properties = ["state"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> EnvironmentStateUpdate: - """Create an instance of EnvironmentStateUpdate from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> EnvironmentStateUpdate: - """Create an instance of EnvironmentStateUpdate from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return EnvironmentStateUpdate.parse_obj(obj) - - # raise errors for additional fields in the input - for _key in obj.keys(): - if _key not in cls.__properties: - raise ValueError( - "Error due to additional fields (not defined in EnvironmentStateUpdate) in the input: " - + obj - ) - - _obj = EnvironmentStateUpdate.parse_obj({"state": obj.get("state")}) - return _obj diff --git a/packages/python-sdk/e2b/api/v1/client/models/environment_title_update.py b/packages/python-sdk/e2b/api/v1/client/models/environment_title_update.py deleted file mode 100644 index 4bee57af1..000000000 --- a/packages/python-sdk/e2b/api/v1/client/models/environment_title_update.py +++ /dev/null @@ -1,75 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - - -class EnvironmentTitleUpdate(BaseModel): - """ - EnvironmentTitleUpdate - """ - - title: Optional[StrictStr] = None - __properties = ["title"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> EnvironmentTitleUpdate: - """Create an instance of EnvironmentTitleUpdate from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> EnvironmentTitleUpdate: - """Create an instance of EnvironmentTitleUpdate from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return EnvironmentTitleUpdate.parse_obj(obj) - - # raise errors for additional fields in the input - for _key in obj.keys(): - if _key not in cls.__properties: - raise ValueError( - "Error due to additional fields (not defined in EnvironmentTitleUpdate) in the input: " - + obj - ) - - _obj = EnvironmentTitleUpdate.parse_obj({"title": obj.get("title")}) - return _obj diff --git a/packages/python-sdk/e2b/api/v1/client/models/envs_get200_response_inner.py b/packages/python-sdk/e2b/api/v1/client/models/envs_get200_response_inner.py index 0596a79f2..2d253c9f9 100644 --- a/packages/python-sdk/e2b/api/v1/client/models/envs_get200_response_inner.py +++ b/packages/python-sdk/e2b/api/v1/client/models/envs_get200_response_inner.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API # noqa: E501 + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,8 +18,7 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, Field, StrictBool, StrictStr, validator class EnvsGet200ResponseInner(BaseModel): @@ -27,10 +26,24 @@ class EnvsGet200ResponseInner(BaseModel): EnvsGet200ResponseInner """ - id: StrictStr = Field(...) - template: Optional[StrictStr] = None - title: Optional[StrictStr] = None - __properties = ["id", "template", "title"] + env_id: StrictStr = Field( + ..., alias="envID", description="Identifier of the environment" + ) + status: StrictStr = Field(..., description="Status of the environment") + public: StrictBool = Field( + ..., + description="Whether the environment is public or only accessible by the team", + ) + __properties = ["envID", "status", "public"] + + @validator("status") + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in ("building", "ready", "error"): + raise ValueError( + "must be one of enum values ('building', 'ready', 'error')" + ) + return value class Config: """Pydantic configuration""" @@ -75,9 +88,9 @@ def from_dict(cls, obj: dict) -> EnvsGet200ResponseInner: _obj = EnvsGet200ResponseInner.parse_obj( { - "id": obj.get("id"), - "template": obj.get("template"), - "title": obj.get("title"), + "env_id": obj.get("envID"), + "status": obj.get("status"), + "public": obj.get("public"), } ) return _obj diff --git a/packages/python-sdk/e2b/api/v1/client/models/error.py b/packages/python-sdk/e2b/api/v1/client/models/error.py index f5520fe65..6c960a15d 100644 --- a/packages/python-sdk/e2b/api/v1/client/models/error.py +++ b/packages/python-sdk/e2b/api/v1/client/models/error.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API # noqa: E501 + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/packages/python-sdk/e2b/api/v1/client/models/new_environment.py b/packages/python-sdk/e2b/api/v1/client/models/new_environment.py deleted file mode 100644 index d8b17d845..000000000 --- a/packages/python-sdk/e2b/api/v1/client/models/new_environment.py +++ /dev/null @@ -1,78 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr - - -class NewEnvironment(BaseModel): - """ - NewEnvironment - """ - - title: Optional[StrictStr] = None - template: StrictStr = Field(...) - __properties = ["title", "template"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> NewEnvironment: - """Create an instance of NewEnvironment from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> NewEnvironment: - """Create an instance of NewEnvironment from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return NewEnvironment.parse_obj(obj) - - # raise errors for additional fields in the input - for _key in obj.keys(): - if _key not in cls.__properties: - raise ValueError( - "Error due to additional fields (not defined in NewEnvironment) in the input: " - + obj - ) - - _obj = NewEnvironment.parse_obj( - {"title": obj.get("title"), "template": obj.get("template")} - ) - return _obj diff --git a/packages/python-sdk/e2b/api/v1/client/models/new_session.py b/packages/python-sdk/e2b/api/v1/client/models/new_session.py deleted file mode 100644 index 23e0e4c35..000000000 --- a/packages/python-sdk/e2b/api/v1/client/models/new_session.py +++ /dev/null @@ -1,91 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr - - -class NewSession(BaseModel): - """ - NewSession - """ - - edit_enabled: Optional[StrictBool] = Field( - False, - alias="editEnabled", - description="Option determining if the session is a shared persistent edit session", - ) - code_snippet_id: StrictStr = Field( - ..., - alias="codeSnippetID", - description="Identifier of a code snippet which which is the environment associated", - ) - __properties = ["editEnabled", "codeSnippetID"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> NewSession: - """Create an instance of NewSession from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> NewSession: - """Create an instance of NewSession from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return NewSession.parse_obj(obj) - - # raise errors for additional fields in the input - for _key in obj.keys(): - if _key not in cls.__properties: - raise ValueError( - "Error due to additional fields (not defined in NewSession) in the input: " - + obj - ) - - _obj = NewSession.parse_obj( - { - "edit_enabled": obj.get("editEnabled") - if obj.get("editEnabled") is not None - else False, - "code_snippet_id": obj.get("codeSnippetID"), - } - ) - return _obj diff --git a/packages/python-sdk/e2b/api/v1/client/models/session.py b/packages/python-sdk/e2b/api/v1/client/models/session.py deleted file mode 100644 index caca7dd75..000000000 --- a/packages/python-sdk/e2b/api/v1/client/models/session.py +++ /dev/null @@ -1,96 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from pydantic import BaseModel, Field, StrictBool, StrictStr - - -class Session(BaseModel): - """ - Session - """ - - code_snippet_id: StrictStr = Field( - ..., - alias="codeSnippetID", - description="Identifier of a code snippet which which is the environment associated", - ) - edit_enabled: StrictBool = Field( - ..., - alias="editEnabled", - description="Information if the session is a shared persistent edit session", - ) - session_id: StrictStr = Field( - ..., alias="sessionID", description="Identifier of the session" - ) - client_id: StrictStr = Field( - ..., alias="clientID", description="Identifier of the client" - ) - __properties = ["codeSnippetID", "editEnabled", "sessionID", "clientID"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Session: - """Create an instance of Session from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Session: - """Create an instance of Session from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Session.parse_obj(obj) - - # raise errors for additional fields in the input - for _key in obj.keys(): - if _key not in cls.__properties: - raise ValueError( - "Error due to additional fields (not defined in Session) in the input: " - + obj - ) - - _obj = Session.parse_obj( - { - "code_snippet_id": obj.get("codeSnippetID"), - "edit_enabled": obj.get("editEnabled"), - "session_id": obj.get("sessionID"), - "client_id": obj.get("clientID"), - } - ) - return _obj diff --git a/packages/python-sdk/e2b/api/v1/client/models/sessions_get200_response_inner.py b/packages/python-sdk/e2b/api/v1/client/models/sessions_get200_response_inner.py deleted file mode 100644 index 9f451a51b..000000000 --- a/packages/python-sdk/e2b/api/v1/client/models/sessions_get200_response_inner.py +++ /dev/null @@ -1,96 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from pydantic import BaseModel, Field, StrictBool, StrictStr - - -class SessionsGet200ResponseInner(BaseModel): - """ - SessionsGet200ResponseInner - """ - - code_snippet_id: StrictStr = Field( - ..., - alias="codeSnippetID", - description="Identifier of a code snippet which which is the environment associated", - ) - edit_enabled: StrictBool = Field( - ..., - alias="editEnabled", - description="Information if the session is a shared persistent edit session", - ) - session_id: StrictStr = Field( - ..., alias="sessionID", description="Identifier of the session" - ) - client_id: StrictStr = Field( - ..., alias="clientID", description="Identifier of the client" - ) - __properties = ["codeSnippetID", "editEnabled", "sessionID", "clientID"] - - class Config: - """Pydantic configuration""" - - allow_population_by_field_name = True - validate_assignment = True - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.dict(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> SessionsGet200ResponseInner: - """Create an instance of SessionsGet200ResponseInner from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.dict(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> SessionsGet200ResponseInner: - """Create an instance of SessionsGet200ResponseInner from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return SessionsGet200ResponseInner.parse_obj(obj) - - # raise errors for additional fields in the input - for _key in obj.keys(): - if _key not in cls.__properties: - raise ValueError( - "Error due to additional fields (not defined in SessionsGet200ResponseInner) in the input: " - + obj - ) - - _obj = SessionsGet200ResponseInner.parse_obj( - { - "code_snippet_id": obj.get("codeSnippetID"), - "edit_enabled": obj.get("editEnabled"), - "session_id": obj.get("sessionID"), - "client_id": obj.get("clientID"), - } - ) - return _obj diff --git a/packages/python-sdk/e2b/api/v1/client/models/template.py b/packages/python-sdk/e2b/api/v1/client/models/template.py deleted file mode 100644 index daa6a22b8..000000000 --- a/packages/python-sdk/e2b/api/v1/client/models/template.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API # noqa: E501 - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - -class Template(str, Enum): - """ - Template - """ - - """ - allowed enum values - """ - NODEJS = "Nodejs" - GO = "Go" - BASH = "Bash" - RUST = "Rust" - PYTHON3 = "Python3" - PHP = "PHP" - JAVA = "Java" - PERL = "Perl" - DOTNET = "DotNET" - - @classmethod - def from_json(cls, json_str: str) -> Template: - """Create an instance of Template from a JSON string""" - return Template(json.loads(json_str)) diff --git a/packages/python-sdk/e2b/api/v1/client/rest.py b/packages/python-sdk/e2b/api/v1/client/rest.py index 1b9ff0eba..80ee99249 100644 --- a/packages/python-sdk/e2b/api/v1/client/rest.py +++ b/packages/python-sdk/e2b/api/v1/client/rest.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API # noqa: E501 + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) # noqa: E501 - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/packages/python-sdk/e2b/api/v1/client_README.md b/packages/python-sdk/e2b/api/v1/client_README.md index b8b83e196..2eee3b9fa 100644 --- a/packages/python-sdk/e2b/api/v1/client_README.md +++ b/packages/python-sdk/e2b/api/v1/client_README.md @@ -1,9 +1,9 @@ # e2b.api.v1.client -Devbook API +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The `e2b.api.v1.client` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 1.0.0 +- API version: 0.1.0 - Package version: 1.0.0 - Build package: org.openapitools.codegen.languages.PythonNextgenClientCodegen @@ -35,10 +35,10 @@ import e2b.api.v1.client from e2b.api.v1.client.rest import ApiException from pprint import pprint -# Defining the host is optional and defaults to https://ondevbook.com +# Defining the host is optional and defaults to https://api.e2b.dev/v1 # See configuration.py for a list of all supported configuration parameters. configuration = e2b.api.v1.client.Configuration( - host = "https://ondevbook.com" + host = "https://api.e2b.dev/v1" ) @@ -57,37 +57,25 @@ async with e2b.api.v1.client.ApiClient(configuration) as api_client: ## Documentation for API Endpoints -All URIs are relative to *https://ondevbook.com* +All URIs are relative to *https://api.e2b.dev/v1* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *DefaultApi* | [**health_get**](e2b/api/v1/client/docs/DefaultApi.md#health_get) | **GET** /health | -*EnvsApi* | [**envs_code_snippet_id_delete**](e2b/api/v1/client/docs/EnvsApi.md#envs_code_snippet_id_delete) | **DELETE** /envs/{codeSnippetID} | -*EnvsApi* | [**envs_code_snippet_id_patch**](e2b/api/v1/client/docs/EnvsApi.md#envs_code_snippet_id_patch) | **PATCH** /envs/{codeSnippetID} | -*EnvsApi* | [**envs_code_snippet_id_post**](e2b/api/v1/client/docs/EnvsApi.md#envs_code_snippet_id_post) | **POST** /envs/{codeSnippetID} | -*EnvsApi* | [**envs_code_snippet_id_state_put**](e2b/api/v1/client/docs/EnvsApi.md#envs_code_snippet_id_state_put) | **PUT** /envs/{codeSnippetID}/state | -*EnvsApi* | [**envs_code_snippet_id_title_put**](e2b/api/v1/client/docs/EnvsApi.md#envs_code_snippet_id_title_put) | **PUT** /envs/{codeSnippetID}/title | +*EnvsApi* | [**envs_env_id_get**](e2b/api/v1/client/docs/EnvsApi.md#envs_env_id_get) | **GET** /envs/{envID} | *EnvsApi* | [**envs_get**](e2b/api/v1/client/docs/EnvsApi.md#envs_get) | **GET** /envs | *EnvsApi* | [**envs_post**](e2b/api/v1/client/docs/EnvsApi.md#envs_post) | **POST** /envs | -*SessionsApi* | [**sessions_get**](e2b/api/v1/client/docs/SessionsApi.md#sessions_get) | **GET** /sessions | -*SessionsApi* | [**sessions_post**](e2b/api/v1/client/docs/SessionsApi.md#sessions_post) | **POST** /sessions | -*SessionsApi* | [**sessions_session_id_delete**](e2b/api/v1/client/docs/SessionsApi.md#sessions_session_id_delete) | **DELETE** /sessions/{sessionID} | -*SessionsApi* | [**sessions_session_id_refresh_post**](e2b/api/v1/client/docs/SessionsApi.md#sessions_session_id_refresh_post) | **POST** /sessions/{sessionID}/refresh | +*InstancesApi* | [**instances_instance_id_refreshes_post**](e2b/api/v1/client/docs/InstancesApi.md#instances_instance_id_refreshes_post) | **POST** /instances/{instanceID}/refreshes | +*InstancesApi* | [**instances_post**](e2b/api/v1/client/docs/InstancesApi.md#instances_post) | **POST** /instances | ## Documentation For Models - [Environment](e2b/api/v1/client/docs/Environment.md) - - [EnvironmentState](e2b/api/v1/client/docs/EnvironmentState.md) - - [EnvironmentStateUpdate](e2b/api/v1/client/docs/EnvironmentStateUpdate.md) - - [EnvironmentTitleUpdate](e2b/api/v1/client/docs/EnvironmentTitleUpdate.md) - [EnvsGet200ResponseInner](e2b/api/v1/client/docs/EnvsGet200ResponseInner.md) - [Error](e2b/api/v1/client/docs/Error.md) - - [NewEnvironment](e2b/api/v1/client/docs/NewEnvironment.md) - - [NewSession](e2b/api/v1/client/docs/NewSession.md) - - [Session](e2b/api/v1/client/docs/Session.md) - - [SessionsGet200ResponseInner](e2b/api/v1/client/docs/SessionsGet200ResponseInner.md) - - [Template](e2b/api/v1/client/docs/Template.md) + - [Instance](e2b/api/v1/client/docs/Instance.md) + - [NewInstance](e2b/api/v1/client/docs/NewInstance.md) @@ -99,8 +87,13 @@ Authentication schemes defined for the API: ### ApiKeyAuth - **Type**: API key -- **API key parameter name**: api_key -- **Location**: URL query string +- **API key parameter name**: X-API-Key +- **Location**: HTTP header + + +### AccessTokenAuth + +- **Type**: Bearer authentication (access_token) ## Author diff --git a/packages/python-sdk/e2b/api/v2/client/__init__.py b/packages/python-sdk/e2b/api/v2/client/__init__.py index e93d907f1..fbfb51c79 100644 --- a/packages/python-sdk/e2b/api/v2/client/__init__.py +++ b/packages/python-sdk/e2b/api/v2/client/__init__.py @@ -3,11 +3,11 @@ # flake8: noqa """ - Devbook + E2B API - Devbook API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -19,7 +19,7 @@ # import apis into sdk package from e2b.api.v2.client.api.default_api import DefaultApi from e2b.api.v2.client.api.envs_api import EnvsApi -from e2b.api.v2.client.api.sessions_api import SessionsApi +from e2b.api.v2.client.api.instances_api import InstancesApi # import ApiClient from e2b.api.v2.client.api_response import ApiResponse @@ -34,11 +34,6 @@ # import models into sdk package from e2b.api.v2.client.models.environment import Environment -from e2b.api.v2.client.models.environment_state import EnvironmentState -from e2b.api.v2.client.models.environment_state_update import EnvironmentStateUpdate -from e2b.api.v2.client.models.environment_title_update import EnvironmentTitleUpdate from e2b.api.v2.client.models.error import Error -from e2b.api.v2.client.models.new_environment import NewEnvironment -from e2b.api.v2.client.models.new_session import NewSession -from e2b.api.v2.client.models.session import Session -from e2b.api.v2.client.models.template import Template +from e2b.api.v2.client.models.instance import Instance +from e2b.api.v2.client.models.new_instance import NewInstance diff --git a/packages/python-sdk/e2b/api/v2/client/api/__init__.py b/packages/python-sdk/e2b/api/v2/client/api/__init__.py index bb625a8f4..c209fd254 100644 --- a/packages/python-sdk/e2b/api/v2/client/api/__init__.py +++ b/packages/python-sdk/e2b/api/v2/client/api/__init__.py @@ -3,4 +3,4 @@ # import apis into api package from e2b.api.v2.client.api.default_api import DefaultApi from e2b.api.v2.client.api.envs_api import EnvsApi -from e2b.api.v2.client.api.sessions_api import SessionsApi +from e2b.api.v2.client.api.instances_api import InstancesApi diff --git a/packages/python-sdk/e2b/api/v2/client/api/default_api.py b/packages/python-sdk/e2b/api/v2/client/api/default_api.py index 687e35e19..216256d33 100644 --- a/packages/python-sdk/e2b/api/v2/client/api/default_api.py +++ b/packages/python-sdk/e2b/api/v2/client/api/default_api.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/packages/python-sdk/e2b/api/v2/client/api/envs_api.py b/packages/python-sdk/e2b/api/v2/client/api/envs_api.py index d8099fd8a..1274f005e 100644 --- a/packages/python-sdk/e2b/api/v2/client/api/envs_api.py +++ b/packages/python-sdk/e2b/api/v2/client/api/envs_api.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -20,819 +20,57 @@ from typing_extensions import Annotated from typing import overload, Optional, Union, Awaitable -from pydantic import StrictStr - -from typing import List - -from e2b.api.v2.client.models.environment import Environment -from e2b.api.v2.client.models.environment_state_update import EnvironmentStateUpdate -from e2b.api.v2.client.models.environment_title_update import EnvironmentTitleUpdate -from e2b.api.v2.client.models.new_environment import NewEnvironment - -from e2b.api.v2.client.api_client import ApiClient -from e2b.api.v2.client.api_response import ApiResponse -from e2b.api.v2.client.exceptions import ApiTypeError, ApiValueError # noqa: F401 - - -class EnvsApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - @overload - async def envs_code_snippet_id_delete( - self, api_key: StrictStr, code_snippet_id: StrictStr, **kwargs - ) -> None: # noqa: E501 - ... - - @overload - def envs_code_snippet_id_delete( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 - ... - - @validate_call - def envs_code_snippet_id_delete( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """envs_code_snippet_id_delete # noqa: E501 - - Delete the code snippet environment # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_delete(api_key, code_snippet_id, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the envs_code_snippet_id_delete_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - if async_req is not None: - kwargs["async_req"] = async_req - return self.envs_code_snippet_id_delete_with_http_info( - api_key, code_snippet_id, **kwargs - ) # noqa: E501 - - @validate_call - def envs_code_snippet_id_delete_with_http_info( - self, api_key: StrictStr, code_snippet_id: StrictStr, **kwargs - ) -> ApiResponse: # noqa: E501 - """envs_code_snippet_id_delete # noqa: E501 - - Delete the code snippet environment # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_delete_with_http_info(api_key, code_snippet_id, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["api_key", "code_snippet_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method envs_code_snippet_id_delete" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["code_snippet_id"]: - _path_params["codeSnippetID"] = _params["code_snippet_id"] - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - "/envs/{codeSnippetID}", - "DELETE", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def envs_code_snippet_id_patch( - self, api_key: StrictStr, code_snippet_id: StrictStr, **kwargs - ) -> None: # noqa: E501 - ... - - @overload - def envs_code_snippet_id_patch( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 - ... - - @validate_call - def envs_code_snippet_id_patch( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """envs_code_snippet_id_patch # noqa: E501 - - Update the environment of the code snippet to match the edit environment # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_patch(api_key, code_snippet_id, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the envs_code_snippet_id_patch_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - if async_req is not None: - kwargs["async_req"] = async_req - return self.envs_code_snippet_id_patch_with_http_info( - api_key, code_snippet_id, **kwargs - ) # noqa: E501 - - @validate_call - def envs_code_snippet_id_patch_with_http_info( - self, api_key: StrictStr, code_snippet_id: StrictStr, **kwargs - ) -> ApiResponse: # noqa: E501 - """envs_code_snippet_id_patch # noqa: E501 - - Update the environment of the code snippet to match the edit environment # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_patch_with_http_info(api_key, code_snippet_id, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["api_key", "code_snippet_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method envs_code_snippet_id_patch" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["code_snippet_id"]: - _path_params["codeSnippetID"] = _params["code_snippet_id"] - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - "/envs/{codeSnippetID}", - "PATCH", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def envs_code_snippet_id_post( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - new_environment: NewEnvironment, - **kwargs - ) -> None: # noqa: E501 - ... - - @overload - def envs_code_snippet_id_post( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - new_environment: NewEnvironment, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 - ... - - @validate_call - def envs_code_snippet_id_post( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - new_environment: NewEnvironment, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """envs_code_snippet_id_post # noqa: E501 - - Create a new env for a code snippet # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_post(api_key, code_snippet_id, new_environment, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param new_environment: (required) - :type new_environment: NewEnvironment - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the envs_code_snippet_id_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - if async_req is not None: - kwargs["async_req"] = async_req - return self.envs_code_snippet_id_post_with_http_info( - api_key, code_snippet_id, new_environment, **kwargs - ) # noqa: E501 - - @validate_call - def envs_code_snippet_id_post_with_http_info( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - new_environment: NewEnvironment, - **kwargs - ) -> ApiResponse: # noqa: E501 - """envs_code_snippet_id_post # noqa: E501 - - Create a new env for a code snippet # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_post_with_http_info(api_key, code_snippet_id, new_environment, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param new_environment: (required) - :type new_environment: NewEnvironment - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["api_key", "code_snippet_id", "new_environment"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method envs_code_snippet_id_post" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["code_snippet_id"]: - _path_params["codeSnippetID"] = _params["code_snippet_id"] - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["new_environment"] is not None: - _body_params = _params["new_environment"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - "/envs/{codeSnippetID}", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def envs_code_snippet_id_state_put( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_state_update: EnvironmentStateUpdate, - **kwargs - ) -> None: # noqa: E501 - ... - - @overload - def envs_code_snippet_id_state_put( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_state_update: EnvironmentStateUpdate, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 - ... - - @validate_call - def envs_code_snippet_id_state_put( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_state_update: EnvironmentStateUpdate, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """envs_code_snippet_id_state_put # noqa: E501 - - Update the state of the environment # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_state_put(api_key, code_snippet_id, environment_state_update, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param environment_state_update: (required) - :type environment_state_update: EnvironmentStateUpdate - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the envs_code_snippet_id_state_put_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - if async_req is not None: - kwargs["async_req"] = async_req - return self.envs_code_snippet_id_state_put_with_http_info( - api_key, code_snippet_id, environment_state_update, **kwargs - ) # noqa: E501 - - @validate_call - def envs_code_snippet_id_state_put_with_http_info( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_state_update: EnvironmentStateUpdate, - **kwargs - ) -> ApiResponse: # noqa: E501 - """envs_code_snippet_id_state_put # noqa: E501 - - Update the state of the environment # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.envs_code_snippet_id_state_put_with_http_info(api_key, code_snippet_id, environment_state_update, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param environment_state_update: (required) - :type environment_state_update: EnvironmentStateUpdate - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["api_key", "code_snippet_id", "environment_state_update"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method envs_code_snippet_id_state_put" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["code_snippet_id"]: - _path_params["codeSnippetID"] = _params["code_snippet_id"] +from typing_extensions import Annotated +from pydantic import Field, StrictBytes, StrictStr - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) +from typing import List, Optional, Union - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["environment_state_update"] is not None: - _body_params = _params["environment_state_update"] +from e2b.api.v2.client.models.environment import Environment - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 +from e2b.api.v2.client.api_client import ApiClient +from e2b.api.v2.client.api_response import ApiResponse +from e2b.api.v2.client.exceptions import ApiTypeError, ApiValueError # noqa: F401 - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - # authentication setting - _auth_settings = [] # noqa: E501 +class EnvsApi: + """NOTE: This class is auto generated by OpenAPI Generator + Ref: https://openapi-generator.tech - _response_types_map = {} + Do not edit the class manually. + """ - return self.api_client.call_api( - "/envs/{codeSnippetID}/state", - "PUT", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) + def __init__(self, api_client=None) -> None: + if api_client is None: + api_client = ApiClient.get_default() + self.api_client = api_client @overload - async def envs_code_snippet_id_title_put( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_title_update: EnvironmentTitleUpdate, - **kwargs - ) -> None: # noqa: E501 + async def envs_env_id_get( + self, env_id: StrictStr, **kwargs + ) -> Environment: # noqa: E501 ... @overload - def envs_code_snippet_id_title_put( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_title_update: EnvironmentTitleUpdate, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 + def envs_env_id_get( + self, env_id: StrictStr, async_req: Optional[bool] = True, **kwargs + ) -> Environment: # noqa: E501 ... @validate_call - def envs_code_snippet_id_title_put( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_title_update: EnvironmentTitleUpdate, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """envs_code_snippet_id_title_put # noqa: E501 + def envs_env_id_get( + self, env_id: StrictStr, async_req: Optional[bool] = None, **kwargs + ) -> Union[Environment, Awaitable[Environment]]: # noqa: E501 + """envs_env_id_get # noqa: E501 - Update the title of the environment # noqa: E501 + Get environment info # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.envs_code_snippet_id_title_put(api_key, code_snippet_id, environment_title_update, async_req=True) + >>> thread = api.envs_env_id_get(env_id, async_req=True) >>> result = thread.get() - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param environment_title_update: (required) - :type environment_title_update: EnvironmentTitleUpdate + :param env_id: (required) + :type env_id: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _request_timeout: timeout setting for this request. @@ -842,41 +80,31 @@ def envs_code_snippet_id_title_put( :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: None + :rtype: Environment """ kwargs["_return_http_data_only"] = True if "_preload_content" in kwargs: - message = "Error! Please call the envs_code_snippet_id_title_put_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 + message = "Error! Please call the envs_env_id_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 raise ValueError(message) if async_req is not None: kwargs["async_req"] = async_req - return self.envs_code_snippet_id_title_put_with_http_info( - api_key, code_snippet_id, environment_title_update, **kwargs - ) # noqa: E501 + return self.envs_env_id_get_with_http_info(env_id, **kwargs) # noqa: E501 @validate_call - def envs_code_snippet_id_title_put_with_http_info( - self, - api_key: StrictStr, - code_snippet_id: StrictStr, - environment_title_update: EnvironmentTitleUpdate, - **kwargs + def envs_env_id_get_with_http_info( + self, env_id: StrictStr, **kwargs ) -> ApiResponse: # noqa: E501 - """envs_code_snippet_id_title_put # noqa: E501 + """envs_env_id_get # noqa: E501 - Update the title of the environment # noqa: E501 + Get environment info # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.envs_code_snippet_id_title_put_with_http_info(api_key, code_snippet_id, environment_title_update, async_req=True) + >>> thread = api.envs_env_id_get_with_http_info(env_id, async_req=True) >>> result = thread.get() - :param api_key: (required) - :type api_key: str - :param code_snippet_id: (required) - :type code_snippet_id: str - :param environment_title_update: (required) - :type environment_title_update: EnvironmentTitleUpdate + :param env_id: (required) + :type env_id: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _preload_content: if False, the ApiResponse.data will @@ -899,12 +127,12 @@ def envs_code_snippet_id_title_put_with_http_info( :return: Returns the result object. If the method is called asynchronously, returns the request thread. - :rtype: None + :rtype: tuple(Environment, status_code(int), headers(HTTPHeaderDict)) """ _params = locals() - _all_params = ["api_key", "code_snippet_id", "environment_title_update"] + _all_params = ["env_id"] _all_params.extend( [ "async_req", @@ -922,7 +150,7 @@ def envs_code_snippet_id_title_put_with_http_info( if _key not in _all_params: raise ApiTypeError( "Got an unexpected keyword argument '%s'" - " to method envs_code_snippet_id_title_put" % _key + " to method envs_env_id_get" % _key ) _params[_key] = _val del _params["kwargs"] @@ -931,14 +159,11 @@ def envs_code_snippet_id_title_put_with_http_info( # process the path parameters _path_params = {} - if _params["code_snippet_id"]: - _path_params["codeSnippetID"] = _params["code_snippet_id"] + if _params["env_id"]: + _path_params["envID"] = _params["env_id"] # process the query parameters _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - # process the header parameters _header_params = dict(_params.get("_headers", {})) # process the form parameters @@ -946,30 +171,24 @@ def envs_code_snippet_id_title_put_with_http_info( _files = {} # process the body parameter _body_params = None - if _params["environment_title_update"] is not None: - _body_params = _params["environment_title_update"] - # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] ) # noqa: E501 - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - # authentication setting - _auth_settings = [] # noqa: E501 + _auth_settings = ["AccessTokenAuth"] # noqa: E501 - _response_types_map = {} + _response_types_map = { + "200": "Environment", + "401": "Error", + "404": "Error", + "500": "Error", + } return self.api_client.call_api( - "/envs/{codeSnippetID}/title", - "PUT", + "/envs/{envID}", + "GET", _path_params, _query_params, _header_params, @@ -987,20 +206,18 @@ def envs_code_snippet_id_title_put_with_http_info( ) @overload - async def envs_get( - self, api_key: StrictStr, **kwargs - ) -> List[Environment]: # noqa: E501 + async def envs_get(self, **kwargs) -> List[Environment]: # noqa: E501 ... @overload def envs_get( - self, api_key: StrictStr, async_req: Optional[bool] = True, **kwargs + self, async_req: Optional[bool] = True, **kwargs ) -> List[Environment]: # noqa: E501 ... @validate_call def envs_get( - self, api_key: StrictStr, async_req: Optional[bool] = None, **kwargs + self, async_req: Optional[bool] = None, **kwargs ) -> Union[List[Environment], Awaitable[List[Environment]]]: # noqa: E501 """envs_get # noqa: E501 @@ -1008,11 +225,9 @@ def envs_get( This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.envs_get(api_key, async_req=True) + >>> thread = api.envs_get(async_req=True) >>> result = thread.get() - :param api_key: (required) - :type api_key: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _request_timeout: timeout setting for this request. @@ -1030,23 +245,19 @@ def envs_get( raise ValueError(message) if async_req is not None: kwargs["async_req"] = async_req - return self.envs_get_with_http_info(api_key, **kwargs) # noqa: E501 + return self.envs_get_with_http_info(**kwargs) # noqa: E501 @validate_call - def envs_get_with_http_info( - self, api_key: StrictStr, **kwargs - ) -> ApiResponse: # noqa: E501 + def envs_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501 """envs_get # noqa: E501 List all environments # noqa: E501 This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.envs_get_with_http_info(api_key, async_req=True) + >>> thread = api.envs_get_with_http_info(async_req=True) >>> result = thread.get() - :param api_key: (required) - :type api_key: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _preload_content: if False, the ApiResponse.data will @@ -1074,7 +285,7 @@ def envs_get_with_http_info( _params = locals() - _all_params = ["api_key"] + _all_params = [] _all_params.extend( [ "async_req", @@ -1104,9 +315,6 @@ def envs_get_with_http_info( # process the query parameters _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - # process the header parameters _header_params = dict(_params.get("_headers", {})) # process the form parameters @@ -1120,7 +328,7 @@ def envs_get_with_http_info( ) # noqa: E501 # authentication setting - _auth_settings = [] # noqa: E501 + _auth_settings = ["AccessTokenAuth"] # noqa: E501 _response_types_map = { "200": "List[Environment]", @@ -1149,15 +357,36 @@ def envs_get_with_http_info( @overload async def envs_post( - self, api_key: StrictStr, new_environment: NewEnvironment, **kwargs + self, + build_context: Annotated[ + Union[StrictBytes, StrictStr], + Field(..., description="Docker build context"), + ], + dockerfile: Annotated[StrictStr, Field(..., description="Dockerfile content")], + env_id: Annotated[ + Optional[StrictStr], + Field( + description="ID of the environment, only present if the environment should be rebuilt" + ), + ] = None, + **kwargs ) -> Environment: # noqa: E501 ... @overload def envs_post( self, - api_key: StrictStr, - new_environment: NewEnvironment, + build_context: Annotated[ + Union[StrictBytes, StrictStr], + Field(..., description="Docker build context"), + ], + dockerfile: Annotated[StrictStr, Field(..., description="Dockerfile content")], + env_id: Annotated[ + Optional[StrictStr], + Field( + description="ID of the environment, only present if the environment should be rebuilt" + ), + ] = None, async_req: Optional[bool] = True, **kwargs ) -> Environment: # noqa: E501 @@ -1166,8 +395,17 @@ def envs_post( @validate_call def envs_post( self, - api_key: StrictStr, - new_environment: NewEnvironment, + build_context: Annotated[ + Union[StrictBytes, StrictStr], + Field(..., description="Docker build context"), + ], + dockerfile: Annotated[StrictStr, Field(..., description="Dockerfile content")], + env_id: Annotated[ + Optional[StrictStr], + Field( + description="ID of the environment, only present if the environment should be rebuilt" + ), + ] = None, async_req: Optional[bool] = None, **kwargs ) -> Union[Environment, Awaitable[Environment]]: # noqa: E501 @@ -1177,13 +415,15 @@ def envs_post( This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.envs_post(api_key, new_environment, async_req=True) + >>> thread = api.envs_post(build_context, dockerfile, env_id, async_req=True) >>> result = thread.get() - :param api_key: (required) - :type api_key: str - :param new_environment: (required) - :type new_environment: NewEnvironment + :param build_context: Docker build context (required) + :type build_context: bytearray + :param dockerfile: Dockerfile content (required) + :type dockerfile: str + :param env_id: ID of the environment, only present if the environment should be rebuilt + :type env_id: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _request_timeout: timeout setting for this request. @@ -1202,12 +442,24 @@ def envs_post( if async_req is not None: kwargs["async_req"] = async_req return self.envs_post_with_http_info( - api_key, new_environment, **kwargs + build_context, dockerfile, env_id, **kwargs ) # noqa: E501 @validate_call def envs_post_with_http_info( - self, api_key: StrictStr, new_environment: NewEnvironment, **kwargs + self, + build_context: Annotated[ + Union[StrictBytes, StrictStr], + Field(..., description="Docker build context"), + ], + dockerfile: Annotated[StrictStr, Field(..., description="Dockerfile content")], + env_id: Annotated[ + Optional[StrictStr], + Field( + description="ID of the environment, only present if the environment should be rebuilt" + ), + ] = None, + **kwargs ) -> ApiResponse: # noqa: E501 """envs_post # noqa: E501 @@ -1215,13 +467,15 @@ def envs_post_with_http_info( This method makes a synchronous HTTP request by default. To make an asynchronous HTTP request, please pass async_req=True - >>> thread = api.envs_post_with_http_info(api_key, new_environment, async_req=True) + >>> thread = api.envs_post_with_http_info(build_context, dockerfile, env_id, async_req=True) >>> result = thread.get() - :param api_key: (required) - :type api_key: str - :param new_environment: (required) - :type new_environment: NewEnvironment + :param build_context: Docker build context (required) + :type build_context: bytearray + :param dockerfile: Dockerfile content (required) + :type dockerfile: str + :param env_id: ID of the environment, only present if the environment should be rebuilt + :type env_id: str :param async_req: Whether to execute the request asynchronously. :type async_req: bool, optional :param _preload_content: if False, the ApiResponse.data will @@ -1249,7 +503,7 @@ def envs_post_with_http_info( _params = locals() - _all_params = ["api_key", "new_environment"] + _all_params = ["build_context", "dockerfile", "env_id"] _all_params.extend( [ "async_req", @@ -1279,19 +533,22 @@ def envs_post_with_http_info( # process the query parameters _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - # process the header parameters _header_params = dict(_params.get("_headers", {})) # process the form parameters _form_params = [] _files = {} + if _params["build_context"]: + _files["buildContext"] = _params["build_context"] + + if _params["dockerfile"]: + _form_params.append(("dockerfile", _params["dockerfile"])) + + if _params["env_id"]: + _form_params.append(("envID", _params["env_id"])) + # process the body parameter _body_params = None - if _params["new_environment"] is not None: - _body_params = _params["new_environment"] - # set the HTTP header `Accept` _header_params["Accept"] = self.api_client.select_header_accept( ["application/json"] @@ -1300,17 +557,16 @@ def envs_post_with_http_info( # set the HTTP header `Content-Type` _content_types_list = _params.get( "_content_type", - self.api_client.select_header_content_type(["application/json"]), + self.api_client.select_header_content_type(["multipart/form-data"]), ) if _content_types_list: _header_params["Content-Type"] = _content_types_list # authentication setting - _auth_settings = [] # noqa: E501 + _auth_settings = ["AccessTokenAuth"] # noqa: E501 _response_types_map = { - "200": "Environment", - "400": "Error", + "202": "Environment", "401": "Error", "500": "Error", } diff --git a/packages/python-sdk/e2b/api/v2/client/api/sessions_api.py b/packages/python-sdk/e2b/api/v2/client/api/sessions_api.py deleted file mode 100644 index 47031b9ef..000000000 --- a/packages/python-sdk/e2b/api/v2/client/api/sessions_api.py +++ /dev/null @@ -1,739 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import re # noqa: F401 -import io -import warnings - -from pydantic import validate_call, ValidationError -from typing_extensions import Annotated -from typing import overload, Optional, Union, Awaitable - -from pydantic import StrictStr - -from typing import List, Optional - -from e2b.api.v2.client.models.new_session import NewSession -from e2b.api.v2.client.models.session import Session - -from e2b.api.v2.client.api_client import ApiClient -from e2b.api.v2.client.api_response import ApiResponse -from e2b.api.v2.client.exceptions import ApiTypeError, ApiValueError # noqa: F401 - - -class SessionsApi: - """NOTE: This class is auto generated by OpenAPI Generator - Ref: https://openapi-generator.tech - - Do not edit the class manually. - """ - - def __init__(self, api_client=None) -> None: - if api_client is None: - api_client = ApiClient.get_default() - self.api_client = api_client - - @overload - async def sessions_get( - self, api_key: StrictStr, **kwargs - ) -> List[Session]: # noqa: E501 - ... - - @overload - def sessions_get( - self, api_key: StrictStr, async_req: Optional[bool] = True, **kwargs - ) -> List[Session]: # noqa: E501 - ... - - @validate_call - def sessions_get( - self, api_key: StrictStr, async_req: Optional[bool] = None, **kwargs - ) -> Union[List[Session], Awaitable[List[Session]]]: # noqa: E501 - """sessions_get # noqa: E501 - - List all sessions # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_get(api_key, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: List[Session] - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the sessions_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - if async_req is not None: - kwargs["async_req"] = async_req - return self.sessions_get_with_http_info(api_key, **kwargs) # noqa: E501 - - @validate_call - def sessions_get_with_http_info( - self, api_key: StrictStr, **kwargs - ) -> ApiResponse: # noqa: E501 - """sessions_get # noqa: E501 - - List all sessions # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_get_with_http_info(api_key, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(List[Session], status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["api_key"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method sessions_get" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "200": "List[Session]", - "401": "Error", - "500": "Error", - } - - return self.api_client.call_api( - "/sessions", - "GET", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def sessions_post( - self, new_session: NewSession, api_key: Optional[StrictStr] = None, **kwargs - ) -> Session: # noqa: E501 - ... - - @overload - def sessions_post( - self, - new_session: NewSession, - api_key: Optional[StrictStr] = None, - async_req: Optional[bool] = True, - **kwargs - ) -> Session: # noqa: E501 - ... - - @validate_call - def sessions_post( - self, - new_session: NewSession, - api_key: Optional[StrictStr] = None, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[Session, Awaitable[Session]]: # noqa: E501 - """sessions_post # noqa: E501 - - Create a session on the server # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_post(new_session, api_key, async_req=True) - >>> result = thread.get() - - :param new_session: (required) - :type new_session: NewSession - :param api_key: - :type api_key: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: Session - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the sessions_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - if async_req is not None: - kwargs["async_req"] = async_req - return self.sessions_post_with_http_info( - new_session, api_key, **kwargs - ) # noqa: E501 - - @validate_call - def sessions_post_with_http_info( - self, new_session: NewSession, api_key: Optional[StrictStr] = None, **kwargs - ) -> ApiResponse: # noqa: E501 - """sessions_post # noqa: E501 - - Create a session on the server # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_post_with_http_info(new_session, api_key, async_req=True) - >>> result = thread.get() - - :param new_session: (required) - :type new_session: NewSession - :param api_key: - :type api_key: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: tuple(Session, status_code(int), headers(HTTPHeaderDict)) - """ - - _params = locals() - - _all_params = ["new_session", "api_key"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method sessions_post" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - if _params["new_session"] is not None: - _body_params = _params["new_session"] - - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # set the HTTP header `Content-Type` - _content_types_list = _params.get( - "_content_type", - self.api_client.select_header_content_type(["application/json"]), - ) - if _content_types_list: - _header_params["Content-Type"] = _content_types_list - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = { - "201": "Session", - "401": "Error", - "400": "Error", - "500": "Error", - } - - return self.api_client.call_api( - "/sessions", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def sessions_session_id_delete( - self, api_key: StrictStr, session_id: StrictStr, **kwargs - ) -> None: # noqa: E501 - ... - - @overload - def sessions_session_id_delete( - self, - api_key: StrictStr, - session_id: StrictStr, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 - ... - - @validate_call - def sessions_session_id_delete( - self, - api_key: StrictStr, - session_id: StrictStr, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """sessions_session_id_delete # noqa: E501 - - Delete a session on the server # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_session_id_delete(api_key, session_id, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param session_id: (required) - :type session_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the sessions_session_id_delete_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - if async_req is not None: - kwargs["async_req"] = async_req - return self.sessions_session_id_delete_with_http_info( - api_key, session_id, **kwargs - ) # noqa: E501 - - @validate_call - def sessions_session_id_delete_with_http_info( - self, api_key: StrictStr, session_id: StrictStr, **kwargs - ) -> ApiResponse: # noqa: E501 - """sessions_session_id_delete # noqa: E501 - - Delete a session on the server # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_session_id_delete_with_http_info(api_key, session_id, async_req=True) - >>> result = thread.get() - - :param api_key: (required) - :type api_key: str - :param session_id: (required) - :type session_id: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["api_key", "session_id"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method sessions_session_id_delete" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["session_id"]: - _path_params["sessionID"] = _params["session_id"] - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - "/sessions/{sessionID}", - "DELETE", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) - - @overload - async def sessions_session_id_refresh_post( - self, session_id: StrictStr, api_key: Optional[StrictStr] = None, **kwargs - ) -> None: # noqa: E501 - ... - - @overload - def sessions_session_id_refresh_post( - self, - session_id: StrictStr, - api_key: Optional[StrictStr] = None, - async_req: Optional[bool] = True, - **kwargs - ) -> None: # noqa: E501 - ... - - @validate_call - def sessions_session_id_refresh_post( - self, - session_id: StrictStr, - api_key: Optional[StrictStr] = None, - async_req: Optional[bool] = None, - **kwargs - ) -> Union[None, Awaitable[None]]: # noqa: E501 - """sessions_session_id_refresh_post # noqa: E501 - - Refresh the session extending its time to live # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_session_id_refresh_post(session_id, api_key, async_req=True) - >>> result = thread.get() - - :param session_id: (required) - :type session_id: str - :param api_key: - :type api_key: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _request_timeout: timeout setting for this request. - If one number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - kwargs["_return_http_data_only"] = True - if "_preload_content" in kwargs: - message = "Error! Please call the sessions_session_id_refresh_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501 - raise ValueError(message) - if async_req is not None: - kwargs["async_req"] = async_req - return self.sessions_session_id_refresh_post_with_http_info( - session_id, api_key, **kwargs - ) # noqa: E501 - - @validate_call - def sessions_session_id_refresh_post_with_http_info( - self, session_id: StrictStr, api_key: Optional[StrictStr] = None, **kwargs - ) -> ApiResponse: # noqa: E501 - """sessions_session_id_refresh_post # noqa: E501 - - Refresh the session extending its time to live # noqa: E501 - This method makes a synchronous HTTP request by default. To make an - asynchronous HTTP request, please pass async_req=True - - >>> thread = api.sessions_session_id_refresh_post_with_http_info(session_id, api_key, async_req=True) - >>> result = thread.get() - - :param session_id: (required) - :type session_id: str - :param api_key: - :type api_key: str - :param async_req: Whether to execute the request asynchronously. - :type async_req: bool, optional - :param _preload_content: if False, the ApiResponse.data will - be set to none and raw_data will store the - HTTP response body without reading/decoding. - Default is True. - :type _preload_content: bool, optional - :param _return_http_data_only: response data instead of ApiResponse - object with status code, headers, etc - :type _return_http_data_only: bool, optional - :param _request_timeout: timeout setting for this request. If one - number provided, it will be total request - timeout. It can also be a pair (tuple) of - (connection, read) timeouts. - :param _request_auth: set to override the auth_settings for an a single - request; this effectively ignores the authentication - in the spec for a single request. - :type _request_auth: dict, optional - :type _content_type: string, optional: force content-type for the request - :return: Returns the result object. - If the method is called asynchronously, - returns the request thread. - :rtype: None - """ - - _params = locals() - - _all_params = ["session_id", "api_key"] - _all_params.extend( - [ - "async_req", - "_return_http_data_only", - "_preload_content", - "_request_timeout", - "_request_auth", - "_content_type", - "_headers", - ] - ) - - # validate the arguments - for _key, _val in _params["kwargs"].items(): - if _key not in _all_params: - raise ApiTypeError( - "Got an unexpected keyword argument '%s'" - " to method sessions_session_id_refresh_post" % _key - ) - _params[_key] = _val - del _params["kwargs"] - - _collection_formats = {} - - # process the path parameters - _path_params = {} - if _params["session_id"]: - _path_params["sessionID"] = _params["session_id"] - - # process the query parameters - _query_params = [] - if _params.get("api_key") is not None: # noqa: E501 - _query_params.append(("api_key", _params["api_key"])) - - # process the header parameters - _header_params = dict(_params.get("_headers", {})) - # process the form parameters - _form_params = [] - _files = {} - # process the body parameter - _body_params = None - # set the HTTP header `Accept` - _header_params["Accept"] = self.api_client.select_header_accept( - ["application/json"] - ) # noqa: E501 - - # authentication setting - _auth_settings = [] # noqa: E501 - - _response_types_map = {} - - return self.api_client.call_api( - "/sessions/{sessionID}/refresh", - "POST", - _path_params, - _query_params, - _header_params, - body=_body_params, - post_params=_form_params, - files=_files, - response_types_map=_response_types_map, - auth_settings=_auth_settings, - async_req=_params.get("async_req"), - _return_http_data_only=_params.get("_return_http_data_only"), # noqa: E501 - _preload_content=_params.get("_preload_content", True), - _request_timeout=_params.get("_request_timeout"), - collection_formats=_collection_formats, - _request_auth=_params.get("_request_auth"), - ) diff --git a/packages/python-sdk/e2b/api/v2/client/api_client.py b/packages/python-sdk/e2b/api/v2/client/api_client.py index adad1647d..a99298dc8 100644 --- a/packages/python-sdk/e2b/api/v2/client/api_client.py +++ b/packages/python-sdk/e2b/api/v2/client/api_client.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/packages/python-sdk/e2b/api/v2/client/configuration.py b/packages/python-sdk/e2b/api/v2/client/configuration.py index a86e81724..b270756bb 100644 --- a/packages/python-sdk/e2b/api/v2/client/configuration.py +++ b/packages/python-sdk/e2b/api/v2/client/configuration.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -99,7 +99,7 @@ def __init__( ssl_ca_cert=None, ) -> None: """Constructor""" - self._base_path = "https://ondevbook.com" if host is None else host + self._base_path = "https://api.e2b.dev/v1" if host is None else host """Default Base url """ self.server_index = 0 if server_index is None and host is None else server_index @@ -391,12 +391,20 @@ def auth_settings(self): if "ApiKeyAuth" in self.api_key: auth["ApiKeyAuth"] = { "type": "api_key", - "in": "query", - "key": "api_key", + "in": "header", + "key": "X-API-Key", "value": self.get_api_key_with_prefix( "ApiKeyAuth", ), } + if self.access_token is not None: + auth["AccessTokenAuth"] = { + "type": "bearer", + "in": "header", + "format": "access_token", + "key": "Authorization", + "value": "Bearer " + self.access_token, + } return auth def to_debug_report(self): @@ -408,7 +416,7 @@ def to_debug_report(self): "Python SDK Debug Report:\n" "OS: {env}\n" "Python Version: {pyversion}\n" - "Version of the API: 1.0.0\n" + "Version of the API: 0.1.0\n" "SDK Package Version: 1.0.0".format(env=sys.platform, pyversion=sys.version) ) @@ -419,41 +427,15 @@ def get_host_settings(self): """ return [ { - "url": "https://ondevbook.com", - "description": "API endpoint", - }, - { - "url": "https://{sessionID}-{clientID}.ondevbook.com", - "description": "Session endpoint without a specified port", - "variables": { - "sessionID": { - "description": "ID of the session", - "default_value": "_sessionID", - }, - "clientID": { - "description": "ID of the client", - "default_value": "_clientID", - }, - }, - }, - { - "url": "https://{port}-{sessionID}-{clientID}.ondevbook.com", - "description": "Session endpoint with a specificed port", + "url": "{server}/v1", + "description": "No description provided", "variables": { - "sessionID": { - "description": "ID of the session", - "default_value": "_sessionID", - }, - "clientID": { - "description": "ID of the client", - "default_value": "_clientID", - }, - "port": { - "description": "Devbook Daemon default port", - "default_value": "49982", - }, + "server": { + "description": "No description provided", + "default_value": "https://api.e2b.dev", + } }, - }, + } ] def get_host_from_settings(self, index, variables=None, servers=None): diff --git a/packages/python-sdk/e2b/api/v2/client/exceptions.py b/packages/python-sdk/e2b/api/v2/client/exceptions.py index 4c4b7ef7b..5a56914c5 100644 --- a/packages/python-sdk/e2b/api/v2/client/exceptions.py +++ b/packages/python-sdk/e2b/api/v2/client/exceptions.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/packages/python-sdk/e2b/api/v2/client/models/__init__.py b/packages/python-sdk/e2b/api/v2/client/models/__init__.py index a1f74fef6..30a1df0ce 100644 --- a/packages/python-sdk/e2b/api/v2/client/models/__init__.py +++ b/packages/python-sdk/e2b/api/v2/client/models/__init__.py @@ -2,11 +2,11 @@ # flake8: noqa """ - Devbook + E2B API - Devbook API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -15,11 +15,6 @@ # import models into model package from e2b.api.v2.client.models.environment import Environment -from e2b.api.v2.client.models.environment_state import EnvironmentState -from e2b.api.v2.client.models.environment_state_update import EnvironmentStateUpdate -from e2b.api.v2.client.models.environment_title_update import EnvironmentTitleUpdate from e2b.api.v2.client.models.error import Error -from e2b.api.v2.client.models.new_environment import NewEnvironment -from e2b.api.v2.client.models.new_session import NewSession -from e2b.api.v2.client.models.session import Session -from e2b.api.v2.client.models.template import Template +from e2b.api.v2.client.models.instance import Instance +from e2b.api.v2.client.models.new_instance import NewInstance diff --git a/packages/python-sdk/e2b/api/v2/client/models/environment.py b/packages/python-sdk/e2b/api/v2/client/models/environment.py index b8e959b25..5c01350d6 100644 --- a/packages/python-sdk/e2b/api/v2/client/models/environment.py +++ b/packages/python-sdk/e2b/api/v2/client/models/environment.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. @@ -18,8 +18,7 @@ import json -from typing import Optional -from pydantic import BaseModel, Field, StrictStr +from pydantic import BaseModel, Field, StrictBool, StrictStr, field_validator class Environment(BaseModel): @@ -27,9 +26,23 @@ class Environment(BaseModel): Environment """ - id: StrictStr = Field(...) - template: Optional[StrictStr] = None - title: Optional[StrictStr] = None + env_id: StrictStr = Field( + ..., alias="envID", description="Identifier of the environment" + ) + status: StrictStr = Field(..., description="Status of the environment") + public: StrictBool = Field( + ..., + description="Whether the environment is public or only accessible by the team", + ) + + @field_validator("status") + def status_validate_enum(cls, value): + """Validates the enum""" + if value not in ("building", "ready", "error"): + raise ValueError( + "must be one of enum values ('building', 'ready', 'error')" + ) + return value """Pydantic configuration""" model_config = { @@ -66,7 +79,7 @@ def from_dict(cls, obj: dict) -> Environment: # raise errors for additional fields in the input for _key in obj.keys(): - if _key not in ["id", "template", "title"]: + if _key not in ["envID", "status", "public"]: raise ValueError( "Error due to additional fields (not defined in Environment) in the input: " + obj @@ -74,9 +87,9 @@ def from_dict(cls, obj: dict) -> Environment: _obj = Environment.model_validate( { - "id": obj.get("id"), - "template": obj.get("template"), - "title": obj.get("title"), + "env_id": obj.get("envID"), + "status": obj.get("status"), + "public": obj.get("public"), } ) return _obj diff --git a/packages/python-sdk/e2b/api/v2/client/models/environment_state.py b/packages/python-sdk/e2b/api/v2/client/models/environment_state.py deleted file mode 100644 index 6ee94e4dd..000000000 --- a/packages/python-sdk/e2b/api/v2/client/models/environment_state.py +++ /dev/null @@ -1,36 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - -class EnvironmentState(str, Enum): - """ - EnvironmentState - """ - - """ - allowed enum values - """ - BUILDING = "Building" - FAILED = "Failed" - DONE = "Done" - - @classmethod - def from_json(cls, json_str: str) -> EnvironmentState: - """Create an instance of EnvironmentState from a JSON string""" - return EnvironmentState(json.loads(json_str)) diff --git a/packages/python-sdk/e2b/api/v2/client/models/environment_state_update.py b/packages/python-sdk/e2b/api/v2/client/models/environment_state_update.py deleted file mode 100644 index 2388f0a23..000000000 --- a/packages/python-sdk/e2b/api/v2/client/models/environment_state_update.py +++ /dev/null @@ -1,74 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from pydantic import BaseModel, Field -from e2b.api.v2.client.models.environment_state import EnvironmentState - - -class EnvironmentStateUpdate(BaseModel): - """ - EnvironmentStateUpdate - """ - - state: EnvironmentState = Field(...) - - """Pydantic configuration""" - model_config = { - "populate_by_name": True, - "validate_assignment": True, - } - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> EnvironmentStateUpdate: - """Create an instance of EnvironmentStateUpdate from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.model_dump(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> EnvironmentStateUpdate: - """Create an instance of EnvironmentStateUpdate from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return EnvironmentStateUpdate.model_validate(obj) - - # raise errors for additional fields in the input - for _key in obj.keys(): - if _key not in ["state"]: - raise ValueError( - "Error due to additional fields (not defined in EnvironmentStateUpdate) in the input: " - + obj - ) - - _obj = EnvironmentStateUpdate.model_validate({"state": obj.get("state")}) - return _obj diff --git a/packages/python-sdk/e2b/api/v2/client/models/environment_title_update.py b/packages/python-sdk/e2b/api/v2/client/models/environment_title_update.py deleted file mode 100644 index 5f9163960..000000000 --- a/packages/python-sdk/e2b/api/v2/client/models/environment_title_update.py +++ /dev/null @@ -1,74 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, StrictStr - - -class EnvironmentTitleUpdate(BaseModel): - """ - EnvironmentTitleUpdate - """ - - title: Optional[StrictStr] = None - - """Pydantic configuration""" - model_config = { - "populate_by_name": True, - "validate_assignment": True, - } - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> EnvironmentTitleUpdate: - """Create an instance of EnvironmentTitleUpdate from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.model_dump(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> EnvironmentTitleUpdate: - """Create an instance of EnvironmentTitleUpdate from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return EnvironmentTitleUpdate.model_validate(obj) - - # raise errors for additional fields in the input - for _key in obj.keys(): - if _key not in ["title"]: - raise ValueError( - "Error due to additional fields (not defined in EnvironmentTitleUpdate) in the input: " - + obj - ) - - _obj = EnvironmentTitleUpdate.model_validate({"title": obj.get("title")}) - return _obj diff --git a/packages/python-sdk/e2b/api/v2/client/models/error.py b/packages/python-sdk/e2b/api/v2/client/models/error.py index 5003ab819..7eadb2165 100644 --- a/packages/python-sdk/e2b/api/v2/client/models/error.py +++ b/packages/python-sdk/e2b/api/v2/client/models/error.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/packages/python-sdk/e2b/api/v2/client/models/new_environment.py b/packages/python-sdk/e2b/api/v2/client/models/new_environment.py deleted file mode 100644 index b98a4a8f0..000000000 --- a/packages/python-sdk/e2b/api/v2/client/models/new_environment.py +++ /dev/null @@ -1,77 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictStr - - -class NewEnvironment(BaseModel): - """ - NewEnvironment - """ - - title: Optional[StrictStr] = None - template: StrictStr = Field(...) - - """Pydantic configuration""" - model_config = { - "populate_by_name": True, - "validate_assignment": True, - } - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> NewEnvironment: - """Create an instance of NewEnvironment from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.model_dump(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> NewEnvironment: - """Create an instance of NewEnvironment from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return NewEnvironment.model_validate(obj) - - # raise errors for additional fields in the input - for _key in obj.keys(): - if _key not in ["title", "template"]: - raise ValueError( - "Error due to additional fields (not defined in NewEnvironment) in the input: " - + obj - ) - - _obj = NewEnvironment.model_validate( - {"title": obj.get("title"), "template": obj.get("template")} - ) - return _obj diff --git a/packages/python-sdk/e2b/api/v2/client/models/new_session.py b/packages/python-sdk/e2b/api/v2/client/models/new_session.py deleted file mode 100644 index f6352af16..000000000 --- a/packages/python-sdk/e2b/api/v2/client/models/new_session.py +++ /dev/null @@ -1,90 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from typing import Optional -from pydantic import BaseModel, Field, StrictBool, StrictStr - - -class NewSession(BaseModel): - """ - NewSession - """ - - edit_enabled: Optional[StrictBool] = Field( - False, - alias="editEnabled", - description="Option determining if the session is a shared persistent edit session", - ) - code_snippet_id: StrictStr = Field( - ..., - alias="codeSnippetID", - description="Identifier of a code snippet which which is the environment associated", - ) - - """Pydantic configuration""" - model_config = { - "populate_by_name": True, - "validate_assignment": True, - } - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> NewSession: - """Create an instance of NewSession from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.model_dump(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> NewSession: - """Create an instance of NewSession from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return NewSession.model_validate(obj) - - # raise errors for additional fields in the input - for _key in obj.keys(): - if _key not in ["editEnabled", "codeSnippetID"]: - raise ValueError( - "Error due to additional fields (not defined in NewSession) in the input: " - + obj - ) - - _obj = NewSession.model_validate( - { - "edit_enabled": obj.get("editEnabled") - if obj.get("editEnabled") is not None - else False, - "code_snippet_id": obj.get("codeSnippetID"), - } - ) - return _obj diff --git a/packages/python-sdk/e2b/api/v2/client/models/session.py b/packages/python-sdk/e2b/api/v2/client/models/session.py deleted file mode 100644 index 908922918..000000000 --- a/packages/python-sdk/e2b/api/v2/client/models/session.py +++ /dev/null @@ -1,95 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -from __future__ import annotations -import pprint -import re # noqa: F401 -import json - - -from pydantic import BaseModel, Field, StrictBool, StrictStr - - -class Session(BaseModel): - """ - Session - """ - - code_snippet_id: StrictStr = Field( - ..., - alias="codeSnippetID", - description="Identifier of a code snippet which which is the environment associated", - ) - edit_enabled: StrictBool = Field( - ..., - alias="editEnabled", - description="Information if the session is a shared persistent edit session", - ) - session_id: StrictStr = Field( - ..., alias="sessionID", description="Identifier of the session" - ) - client_id: StrictStr = Field( - ..., alias="clientID", description="Identifier of the client" - ) - - """Pydantic configuration""" - model_config = { - "populate_by_name": True, - "validate_assignment": True, - } - - def to_str(self) -> str: - """Returns the string representation of the model using alias""" - return pprint.pformat(self.model_dump(by_alias=True)) - - def to_json(self) -> str: - """Returns the JSON representation of the model using alias""" - return json.dumps(self.to_dict()) - - @classmethod - def from_json(cls, json_str: str) -> Session: - """Create an instance of Session from a JSON string""" - return cls.from_dict(json.loads(json_str)) - - def to_dict(self): - """Returns the dictionary representation of the model using alias""" - _dict = self.model_dump(by_alias=True, exclude={}, exclude_none=True) - return _dict - - @classmethod - def from_dict(cls, obj: dict) -> Session: - """Create an instance of Session from a dict""" - if obj is None: - return None - - if not isinstance(obj, dict): - return Session.model_validate(obj) - - # raise errors for additional fields in the input - for _key in obj.keys(): - if _key not in ["codeSnippetID", "editEnabled", "sessionID", "clientID"]: - raise ValueError( - "Error due to additional fields (not defined in Session) in the input: " - + obj - ) - - _obj = Session.model_validate( - { - "code_snippet_id": obj.get("codeSnippetID"), - "edit_enabled": obj.get("editEnabled"), - "session_id": obj.get("sessionID"), - "client_id": obj.get("clientID"), - } - ) - return _obj diff --git a/packages/python-sdk/e2b/api/v2/client/models/template.py b/packages/python-sdk/e2b/api/v2/client/models/template.py deleted file mode 100644 index 86004936c..000000000 --- a/packages/python-sdk/e2b/api/v2/client/models/template.py +++ /dev/null @@ -1,42 +0,0 @@ -# coding: utf-8 - -""" - Devbook - - Devbook API - - The version of the OpenAPI document: 1.0.0 - Generated by OpenAPI Generator (https://openapi-generator.tech) - - Do not edit the class manually. -""" # noqa: E501 - - -import json -import pprint -import re # noqa: F401 -from aenum import Enum, no_arg - - -class Template(str, Enum): - """ - Template - """ - - """ - allowed enum values - """ - NODEJS = "Nodejs" - GO = "Go" - BASH = "Bash" - RUST = "Rust" - PYTHON3 = "Python3" - PHP = "PHP" - JAVA = "Java" - PERL = "Perl" - DOTNET = "DotNET" - - @classmethod - def from_json(cls, json_str: str) -> Template: - """Create an instance of Template from a JSON string""" - return Template(json.loads(json_str)) diff --git a/packages/python-sdk/e2b/api/v2/client/rest.py b/packages/python-sdk/e2b/api/v2/client/rest.py index 857a1d2ea..47ac65944 100644 --- a/packages/python-sdk/e2b/api/v2/client/rest.py +++ b/packages/python-sdk/e2b/api/v2/client/rest.py @@ -1,11 +1,11 @@ # coding: utf-8 """ - Devbook + E2B API - Devbook API + No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) - The version of the OpenAPI document: 1.0.0 + The version of the OpenAPI document: 0.1.0 Generated by OpenAPI Generator (https://openapi-generator.tech) Do not edit the class manually. diff --git a/packages/python-sdk/e2b/api/v2/client_README.md b/packages/python-sdk/e2b/api/v2/client_README.md index e08ae2cec..dcaa60dfd 100644 --- a/packages/python-sdk/e2b/api/v2/client_README.md +++ b/packages/python-sdk/e2b/api/v2/client_README.md @@ -1,9 +1,9 @@ # e2b.api.v2.client -Devbook API +No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator) The `e2b.api.v2.client` package is automatically generated by the [OpenAPI Generator](https://openapi-generator.tech) project: -- API version: 1.0.0 +- API version: 0.1.0 - Package version: 1.0.0 - Build package: org.openapitools.codegen.languages.PythonClientCodegen @@ -35,10 +35,10 @@ import e2b.api.v2.client from e2b.api.v2.client.rest import ApiException from pprint import pprint -# Defining the host is optional and defaults to https://ondevbook.com +# Defining the host is optional and defaults to https://api.e2b.dev/v1 # See configuration.py for a list of all supported configuration parameters. configuration = e2b.api.v2.client.Configuration( - host = "https://ondevbook.com" + host = "https://api.e2b.dev/v1" ) @@ -57,35 +57,24 @@ async with e2b.api.v2.client.ApiClient(configuration) as api_client: ## Documentation for API Endpoints -All URIs are relative to *https://ondevbook.com* +All URIs are relative to *https://api.e2b.dev/v1* Class | Method | HTTP request | Description ------------ | ------------- | ------------- | ------------- *DefaultApi* | [**health_get**](e2b/api/v2/client/docs/DefaultApi.md#health_get) | **GET** /health | -*EnvsApi* | [**envs_code_snippet_id_delete**](e2b/api/v2/client/docs/EnvsApi.md#envs_code_snippet_id_delete) | **DELETE** /envs/{codeSnippetID} | -*EnvsApi* | [**envs_code_snippet_id_patch**](e2b/api/v2/client/docs/EnvsApi.md#envs_code_snippet_id_patch) | **PATCH** /envs/{codeSnippetID} | -*EnvsApi* | [**envs_code_snippet_id_post**](e2b/api/v2/client/docs/EnvsApi.md#envs_code_snippet_id_post) | **POST** /envs/{codeSnippetID} | -*EnvsApi* | [**envs_code_snippet_id_state_put**](e2b/api/v2/client/docs/EnvsApi.md#envs_code_snippet_id_state_put) | **PUT** /envs/{codeSnippetID}/state | -*EnvsApi* | [**envs_code_snippet_id_title_put**](e2b/api/v2/client/docs/EnvsApi.md#envs_code_snippet_id_title_put) | **PUT** /envs/{codeSnippetID}/title | +*EnvsApi* | [**envs_env_id_get**](e2b/api/v2/client/docs/EnvsApi.md#envs_env_id_get) | **GET** /envs/{envID} | *EnvsApi* | [**envs_get**](e2b/api/v2/client/docs/EnvsApi.md#envs_get) | **GET** /envs | *EnvsApi* | [**envs_post**](e2b/api/v2/client/docs/EnvsApi.md#envs_post) | **POST** /envs | -*SessionsApi* | [**sessions_get**](e2b/api/v2/client/docs/SessionsApi.md#sessions_get) | **GET** /sessions | -*SessionsApi* | [**sessions_post**](e2b/api/v2/client/docs/SessionsApi.md#sessions_post) | **POST** /sessions | -*SessionsApi* | [**sessions_session_id_delete**](e2b/api/v2/client/docs/SessionsApi.md#sessions_session_id_delete) | **DELETE** /sessions/{sessionID} | -*SessionsApi* | [**sessions_session_id_refresh_post**](e2b/api/v2/client/docs/SessionsApi.md#sessions_session_id_refresh_post) | **POST** /sessions/{sessionID}/refresh | +*InstancesApi* | [**instances_instance_id_refreshes_post**](e2b/api/v2/client/docs/InstancesApi.md#instances_instance_id_refreshes_post) | **POST** /instances/{instanceID}/refreshes | +*InstancesApi* | [**instances_post**](e2b/api/v2/client/docs/InstancesApi.md#instances_post) | **POST** /instances | ## Documentation For Models - [Environment](e2b/api/v2/client/docs/Environment.md) - - [EnvironmentState](e2b/api/v2/client/docs/EnvironmentState.md) - - [EnvironmentStateUpdate](e2b/api/v2/client/docs/EnvironmentStateUpdate.md) - - [EnvironmentTitleUpdate](e2b/api/v2/client/docs/EnvironmentTitleUpdate.md) - [Error](e2b/api/v2/client/docs/Error.md) - - [NewEnvironment](e2b/api/v2/client/docs/NewEnvironment.md) - - [NewSession](e2b/api/v2/client/docs/NewSession.md) - - [Session](e2b/api/v2/client/docs/Session.md) - - [Template](e2b/api/v2/client/docs/Template.md) + - [Instance](e2b/api/v2/client/docs/Instance.md) + - [NewInstance](e2b/api/v2/client/docs/NewInstance.md) @@ -97,8 +86,13 @@ Authentication schemes defined for the API: ### ApiKeyAuth - **Type**: API key -- **API key parameter name**: api_key -- **Location**: URL query string +- **API key parameter name**: X-API-Key +- **Location**: HTTP header + + +### AccessTokenAuth + +- **Type**: Bearer authentication (access_token) ## Author diff --git a/packages/python-sdk/e2b/session/main.py b/packages/python-sdk/e2b/session/main.py index 0c34ff448..d948ca3f9 100644 --- a/packages/python-sdk/e2b/session/main.py +++ b/packages/python-sdk/e2b/session/main.py @@ -172,7 +172,7 @@ def upload_file(self, file: IO) -> str: :param file: The file to upload """ - files = {'file': file} + files = {"file": file} r = requests.post(self.file_url(), files=files) if r.status_code != 200: raise Exception(f"Failed to upload file: {r.reason} {r.text}") @@ -191,7 +191,9 @@ def download_file(self, remote_path: str) -> bytes: r = requests.get(url) if r.status_code != 200: - raise Exception(f"Failed to download file '{remote_path}'. {r.reason} {r.text}") + raise Exception( + f"Failed to download file '{remote_path}'. {r.reason} {r.text}" + ) return r.content async def __aenter__(self): diff --git a/packages/python-sdk/e2b/session/run_code.py b/packages/python-sdk/e2b/session/run_code.py index 740c46989..4736ea9aa 100644 --- a/packages/python-sdk/e2b/session/run_code.py +++ b/packages/python-sdk/e2b/session/run_code.py @@ -79,9 +79,9 @@ async def run_code( def run_code_sync( - runtime: Union[CodeRuntime, str], - code: str, - api_key: Optional[str] = None, + runtime: Union[CodeRuntime, str], + code: str, + api_key: Optional[str] = None, ): """ Runs code in a sandboxed cloud playground and return the stdout and stderr diff --git a/packages/python-sdk/tests/test_file_download.py b/packages/python-sdk/tests/test_file_download.py index 5044e4920..5c4a3c83d 100644 --- a/packages/python-sdk/tests/test_file_download.py +++ b/packages/python-sdk/tests/test_file_download.py @@ -2,6 +2,7 @@ from os import path from e2b import Session + async def test_download(): file_name = "video.webm" local_dir = "tests/assets" @@ -16,10 +17,9 @@ async def test_download(): # Download the file back and save it in the local filesystem file_content = session.download_file(uploaded_file_path) - with open(path.join(local_dir, "video-downloaded.webm"), 'wb') as f: + with open(path.join(local_dir, "video-downloaded.webm"), "wb") as f: f.write(file_content) - # Compare the downloaded file with the original assert filecmp.cmp(local_path, path.join(local_dir, "video-downloaded.webm")) diff --git a/packages/python-sdk/tests/test_file_upload.py b/packages/python-sdk/tests/test_file_upload.py index f0b787ce9..295c89e17 100644 --- a/packages/python-sdk/tests/test_file_upload.py +++ b/packages/python-sdk/tests/test_file_upload.py @@ -1,6 +1,7 @@ from os import path from e2b import Session + async def test_file_upload(): file_name = "video.webm" local_dir = "tests/assets" diff --git a/spec/openapi.yml b/spec/openapi.yml index c6cb7dfab..fc54925ff 100644 --- a/spec/openapi.yml +++ b/spec/openapi.yml @@ -1,62 +1,34 @@ openapi: 3.0.0 info: - version: 1.0.0 - title: Devbook - description: Devbook API + version: 0.1.0 + title: E2B API servers: - - url: https://ondevbook.com/ - description: API endpoint - - url: https://{sessionID}-{clientID}.ondevbook.com/ - description: Session endpoint without a specified port + - url: "{server}/v1" variables: - sessionID: - description: ID of the session - default: _sessionID - clientID: - description: ID of the client - default: _clientID - - url: https://{port}-{sessionID}-{clientID}.ondevbook.com/ - description: Session endpoint with a specificed port - variables: - sessionID: - description: ID of the session - default: _sessionID - clientID: - description: ID of the client - default: _clientID - port: - description: Devbook Daemon default port - default: "49982" + server: + default: https://api.e2b.dev components: securitySchemes: ApiKeyAuth: - name: api_key type: apiKey - in: query + in: header + name: X-API-Key + AccessTokenAuth: + type: http + scheme: bearer + bearerFormat: access_token parameters: - apiKeyOpt: - name: api_key - in: query - required: false - schema: - type: string - apiKeyReq: - name: api_key - in: query - required: true - schema: - type: string - codeSnippetID: - name: codeSnippetID + envID: + name: envID in: path required: true schema: type: string - sessionID: - name: sessionID + instanceID: + name: instanceID in: path required: true schema: @@ -75,6 +47,13 @@ components: application/json: schema: $ref: "#/components/schemas/Error" + 404: + description: Not found + content: + application/json: + schema: + $ref: "#/components/schemas/Error" + 500: description: Server error content: @@ -83,85 +62,46 @@ components: $ref: "#/components/schemas/Error" schemas: - Template: - type: string - enum: - - Nodejs - - Go - - Bash - - Rust - - Python3 - - PHP - - Java - - Perl - - DotNET - - EnvironmentState: - type: string - enum: - - Building - - Failed - - Done - - Environment: + NewInstance: required: - - id + - envID properties: - id: - type: string - template: - type: string - title: + envID: type: string + description: Identifier of the required environment - NewEnvironment: + Environment: required: - - template + - envID + - status + - public properties: - title: - type: string - template: + envID: type: string - - EnvironmentStateUpdate: - required: - - state - properties: - state: - $ref: "#/components/schemas/EnvironmentState" - - EnvironmentTitleUpdate: - properties: - title: + description: Identifier of the environment + status: type: string - - NewSession: - required: - - codeSnippetID - properties: - editEnabled: + description: Status of the environment + enum: + - building + - ready + - error + public: type: boolean - default: false - description: Option determining if the session is a shared persistent edit session - codeSnippetID: - type: string - description: Identifier of a code snippet which which is the environment associated - Session: + description: Whether the environment is public or only accessible by the team + + Instance: required: - - sessionID + - envID + - instanceID - clientID - - editEnabled - - codeSnippetID properties: - codeSnippetID: + envID: type: string - description: Identifier of a code snippet which which is the environment associated - editEnabled: - type: boolean - description: Information if the session is a shared persistent edit session - sessionID: + description: Identifier of the environment from which is the instance created + instanceID: type: string - description: Identifier of the session + description: Identifier of the instance clientID: type: string description: Identifier of the client @@ -180,10 +120,8 @@ components: description: Error tags: - - name: sessions - description: Managing VM sessions + - name: instances - name: envs - description: Environment for VM paths: /health: @@ -195,44 +133,26 @@ paths: 401: $ref: "#/components/responses/401" - /sessions: - get: - description: List all sessions - tags: [ sessions ] - parameters: - - $ref: "#/components/parameters/apiKeyReq" - responses: - 200: - description: Successfully returned all sessions - content: - application/json: - schema: - type: array - items: - allOf: - - $ref: "#/components/schemas/Session" - 401: - $ref: "#/components/responses/401" - 500: - $ref: "#/components/responses/500" + + /instances: post: - description: Create a session on the server - tags: [ sessions ] - parameters: - - $ref: "#/components/parameters/apiKeyOpt" + description: Create an instance from the environment + tags: [instances] + security: + - ApiKeyAuth: [ ] requestBody: required: true content: application/json: schema: - $ref: "#/components/schemas/NewSession" + $ref: "#/components/schemas/NewInstance" responses: 201: - description: Successfully created a session + description: The instance was created successfully content: application/json: schema: - $ref: "#/components/schemas/Session" + $ref: "#/components/schemas/Instance" 401: $ref: "#/components/responses/401" 400: @@ -240,35 +160,21 @@ paths: 500: $ref: "#/components/responses/500" - /sessions/{sessionID}: - delete: - description: Delete a session on the server - tags: [ sessions ] - parameters: - - $ref: "#/components/parameters/apiKeyReq" - - $ref: "#/components/parameters/sessionID" - responses: - 204: - description: Successfully deleted the session - 401: - $ref: "#/components/responses/401" - 500: - $ref: "#/components/responses/500" - - /sessions/{sessionID}/refresh: + /instances/{instanceID}/refreshes: post: - description: Refresh the session extending its time to live - tags: [ sessions ] + description: Refresh the instance extending its time to live + security: + - ApiKeyAuth: [ ] + tags: [ instances ] parameters: - - $ref: "#/components/parameters/apiKeyOpt" - - $ref: "#/components/parameters/sessionID" + - $ref: "#/components/parameters/instanceID" responses: 204: - description: Successfully refreshed the session + description: Successfully refreshed the instance 401: $ref: "#/components/responses/401" 404: - description: Error refreshing session - session not found + description: Error refreshing instance - not found content: application/json: schema: @@ -277,9 +183,9 @@ paths: /envs: get: description: List all environments - tags: [ envs ] - parameters: - - $ref: "#/components/parameters/apiKeyReq" + tags: [envs] + security: + - AccessTokenAuth: [ ] responses: 200: description: Successfully returned all environments @@ -297,124 +203,62 @@ paths: post: description: Create a new environment tags: [ envs ] - parameters: - - $ref: "#/components/parameters/apiKeyReq" + security: + - AccessTokenAuth: [ ] requestBody: required: true content: - application/json: + multipart/form-data: schema: - $ref: "#/components/schemas/NewEnvironment" + type: object + required: + - buildContext + - dockerfile + properties: + buildContext: + description: Docker build context + type: string + format: binary + dockerfile: + type: string + description: Dockerfile content + envID: + type: string + description: ID of the environment, only present if the environment should be rebuilt + encoding: + buildContext: + contentType: application/octet-stream + responses: - 200: - description: Successfully created an environment + 202: + description: The build has started content: application/json: schema: $ref: "#/components/schemas/Environment" - 400: - $ref: "#/components/responses/400" 401: $ref: "#/components/responses/401" 500: $ref: "#/components/responses/500" - # This method will be replaced by POST /envs - /envs/{codeSnippetID}: - post: - description: Create a new env for a code snippet - tags: [ envs ] - parameters: - - $ref: "#/components/parameters/apiKeyReq" - - $ref: "#/components/parameters/codeSnippetID" - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/NewEnvironment" - responses: - 204: - description: Successfully created an environment - 400: - $ref: "#/components/responses/400" - 401: - $ref: "#/components/responses/401" - 500: - $ref: "#/components/responses/500" - delete: - description: Delete the code snippet environment - tags: [ envs ] + /envs/{envID}: + get: + description: Get environment info + tags: [envs] + security: + - AccessTokenAuth: [ ] parameters: - - $ref: "#/components/parameters/apiKeyReq" - - $ref: "#/components/parameters/codeSnippetID" + - $ref: "#/components/parameters/envID" responses: - 204: - description: Successfully deleted the environment - 400: - description: Cannot delete the environment + 200: + description: Successfully returned the environment content: application/json: schema: - $ref: "#/components/schemas/Error" - 401: - $ref: "#/components/responses/401" - 500: - $ref: "#/components/responses/500" - patch: - description: Update the environment of the code snippet to match the edit environment - tags: [ envs ] - parameters: - - $ref: "#/components/parameters/apiKeyReq" - - $ref: "#/components/parameters/codeSnippetID" - responses: - 204: - description: Updated the edit environment for code snippet - 400: - $ref: "#/components/responses/400" + $ref: "#/components/schemas/Environment" 401: $ref: "#/components/responses/401" + 404: + $ref: "#/components/responses/404" 500: $ref: "#/components/responses/500" - - /envs/{codeSnippetID}/state: - put: - description: Update the state of the environment - tags: [ envs ] - parameters: - - $ref: "#/components/parameters/apiKeyReq" - - $ref: "#/components/parameters/codeSnippetID" - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/EnvironmentStateUpdate" - responses: - 204: - description: Updated the state of environment - 400: - $ref: "#/components/responses/400" - 401: - $ref: "#/components/responses/401" - - /envs/{codeSnippetID}/title: - put: - description: Update the title of the environment - tags: [ envs ] - parameters: - - $ref: "#/components/parameters/apiKeyReq" - - $ref: "#/components/parameters/codeSnippetID" - requestBody: - required: true - content: - application/json: - schema: - $ref: "#/components/schemas/EnvironmentTitleUpdate" - responses: - 204: - description: Updated the title of the code snippet - 400: - $ref: "#/components/responses/400" - 401: - $ref: "#/components/responses/401" \ No newline at end of file