Open-source, secure environment with real-world tools for enterprise-grade agents.
Python agentaiai-agentai-agentscode-interpretercopilotdevelopmentdevtoolsgptgpt-4javascriptllmnextjsopenaipythonreactsoftwaretypescript
Rename api endpoints (#298)
Jakub Novák7fe1d3b56902
diff --git a/.changeset/forty-coins-march.md b/.changeset/forty-coins-march.mdnew file mode 100644index 000000000..6ffdffeaa--- /dev/null+++ b/.changeset/forty-coins-march.md@@ -0,0 +1,7 @@+---+"@e2b/python-sdk": minor+"@e2b/sdk": minor+"@e2b/cli": minor+---++Switch to new endpointsdiff --git a/packages/cli/src/commands/build.ts b/packages/cli/src/commands/build.tsindex db668bd99..96c46a6ed 100644--- a/packages/cli/src/commands/build.ts+++ b/packages/cli/src/commands/build.ts@@ -28,7 +28,7 @@ import { estimateContentLength } from '../utils/form'const templateCheckInterval = 1_000 // 1 secconst getTemplate = e2b.withAccessToken(- e2b.api.path('/envs/{envID}/builds/{buildID}').method('get').create(),+ e2b.api.path('/templates/{templateID}/builds/{buildID}').method('get').create(),)export const buildCommand = new commander.Command('build')@@ -67,7 +67,7 @@ export const buildCommand = new commander.Command('build').alias('bd').action(async (- template: string | undefined,+ templateID: string | undefined,opts: {path?: string;dockerfile?: string;@@ -87,7 +87,6 @@ export const buildCommand = new commander.Command('build')process.exit(1)}- let envID = templatelet dockerfile = opts.dockerfilelet startCmd = opts.cmd@@ -104,18 +103,18 @@ export const buildCommand = new commander.Command('build')console.log(`Found sandbox template ${asFormattedSandboxTemplate({- envID: config.template_id,+ templateID: config.template_id,aliases: config.template_name ? [config.template_name] : undefined,},relativeConfigPath,)}`,)- envID = config.template_id+ templateID = config.template_iddockerfile = opts.dockerfile || config.dockerfilestartCmd = opts.cmd || config.start_cmd}- if (config && template && config.template_id !== template) {+ if (config && templateID && config.template_id !== templateID) {// error: you can't specify different ID than the one in configconsole.error("You can't specify different ID than the one in config. If you want to build a new sandbox template remove the config file.")process.exit(1)@@ -187,7 +186,7 @@ export const buildCommand = new commander.Command('build')process.exit(1)}- const build = await buildTemplate(accessToken, body, !!config, configPath, envID)+ const build = await buildTemplate(accessToken, body, !!config, configPath, templateID)console.log(`Started building the sandbox template ${asFormattedSandboxTemplate(@@ -195,12 +194,12 @@ export const buildCommand = new commander.Command('build'))} `,)- await waitForBuildFinish(accessToken, build.envID, build.buildID, name)+ await waitForBuildFinish(accessToken, build.templateID, build.buildID, name)await saveConfig(configPath,{- template_id: build.envID,+ template_id: build.templateID,dockerfile: dockerfileRelativePath,template_name: name,start_cmd: startCmd,@@ -216,7 +215,7 @@ export const buildCommand = new commander.Command('build')async function waitForBuildFinish(accessToken: string,- envID: string,+ templateID: string,buildID: string,name?: string,) {@@ -230,7 +229,7 @@ async function waitForBuildFinish(await wait(templateCheckInterval)try {- template = await getTemplate(accessToken, { envID, logsOffset, buildID })+ template = await getTemplate(accessToken, { templateID, logsOffset, buildID })} catch (e) {if (e instanceof getTemplate.Error) {const error = e.getActualType()@@ -266,7 +265,7 @@ async function waitForBuildFinish(const pythonExample = asPython(`from e2b import Sandbox# Start sandbox-sandbox = Sandbox(template="${aliases?.length ? aliases[0] : template.data.envID}")+sandbox = Sandbox(template="${aliases?.length ? aliases[0] : template.data.templateID}")# Interact with sandbox. Learn more here:# https://e2b.dev/docs/sandbox/overview@@ -277,7 +276,7 @@ sandbox.close()`)const typescriptExample = asTypescript(`import { Sandbox } from '@e2b/sdk'// Start sandbox-const sandbox = await Sandbox.create({ template: '${aliases?.length ? aliases[0] : template.data.envID}' })+const sandbox = await Sandbox.create({ template: '${aliases?.length ? aliases[0] : template.data.templateID}' })// Interact with sandbox. Learn more here:// https://e2b.dev/docs/sandbox/overview@@ -404,14 +403,14 @@ async function buildTemplate(body: FormData,hasConfig: boolean,configPath: string,- envID?: string,+ templateID?: string,): Promise<Omit<- e2b.paths['/envs']['post']['responses']['202']['content']['application/json'],+ e2b.paths['/templates']['post']['responses']['202']['content']['application/json'],'logs'>> {- const res = await fetch(e2b.API_HOST + (envID ? `/envs/${envID}` : '/envs'), {+ const res = await fetch(e2b.API_HOST + (templateID ? `/templates/${templateID}` : '/templates'), {method: 'POST',headers: { Authorization: `Bearer ${accessToken}` },body,@@ -429,8 +428,8 @@ async function buildTemplate(if (!res.ok) {const error:- | e2b.paths['/envs']['post']['responses']['401']['content']['application/json']- | e2b.paths['/envs']['post']['responses']['500']['content']['application/json'] =+ | e2b.paths['/templates']['post']['responses']['401']['content']['application/json']+ | e2b.paths['/templates']['post']['responses']['500']['content']['application/json'] =data as anyif (error.code === 401) {@@ -442,7 +441,7 @@ async function buildTemplate(if (error.code === 404) {throw new Error(- `Sandbox template you want to build ${envID ? `(${envID})` : ''} not found: ${res.statusText}, ${error.message ?? 'no message'+ `Sandbox template you want to build ${templateID ? `(${templateID})` : ''} not found: ${res.statusText}, ${error.message ?? 'no message'}\n${hasConfig ? `This could be caused by ${asLocalRelative(configPath)} belonging to a deleted template or a template that you don't own. If so you can delete the ${asLocalRelative(configPath)} and start building the template again.` : ''}`,)}diff --git a/packages/cli/src/commands/delete.ts b/packages/cli/src/commands/delete.tsindex 16ece0f3e..c2f09a3cb 100644--- a/packages/cli/src/commands/delete.ts+++ b/packages/cli/src/commands/delete.ts@@ -16,15 +16,15 @@ import { pathOption, selectMultipleOption } from 'src/options'import { E2BConfig, configName, deleteConfig, getConfigPath, loadConfig } from 'src/config'import { getRoot } from 'src/utils/filesystem'import { listSandboxTemplates } from './list'-import { getPromptEnvs } from 'src/utils/templatePrompt'+import { getPromptTemplates } from 'src/utils/templatePrompt'import { confirm } from 'src/utils/confirm'-const deleteEnv = e2b.withAccessToken(- e2b.api.path('/envs/{envID}').method('delete').create()+const deleteTemplate = e2b.withAccessToken(+ e2b.api.path('/templates/{templateID}').method('delete').create())export const deleteCommand = new commander.Command('delete')- .description(`Delete sanbdox template and ${asLocal(configName)} config`)+ .description(`Delete sandbox template and ${asLocal(configName)} config`).argument('[template]',`Specify ${asBold(@@ -43,18 +43,18 @@ export const deleteCommand = new commander.Command('delete')const root = getRoot(opts.path)- const envs: (Pick<E2BConfig, 'template_id'> & { configPath?: string })[] = []+ const templates: (Pick<E2BConfig, 'template_id'> & { configPath?: string })[] = []if (template) {- envs.push({+ templates.push({template_id: template,})} else if (opts.select) {- const allEnvs = await listSandboxTemplates({ accessToken })- const selectedEnvs = await getPromptEnvs(allEnvs, 'Select sandbox templates to delete')- envs.push(...selectedEnvs.map(e => ({ template_id: e.envID, ...e })))+ const allTemplates = await listSandboxTemplates({ accessToken })+ const selectedTemplates = await getPromptTemplates(allTemplates, 'Select sandbox templates to delete')+ templates.push(...selectedTemplates.map(e => ({ template_id: e.templateID, ...e })))- if (!envs || envs.length === 0) {+ if (!templates || templates.length === 0) {console.log('No sandbox templates selected')return}@@ -69,24 +69,24 @@ export const deleteCommand = new commander.Command('delete')return}- envs.push({+ templates.push({...config,configPath,})}- if (!envs || envs.length === 0) {+ if (!templates || templates.length === 0) {console.log(`No sandbox templates selected. Specify sandbox template with ${asBold('[template]')} argument or use interactive mode with ${asBold('-s')} flag.`)return}console.log(chalk.default.red(chalk.default.underline('\nSandbox templates to delete')))- envs.forEach(e => console.log(asFormattedSandboxTemplate({ ...e, envID: e.template_id }, e.configPath)))+ templates.forEach(e => console.log(asFormattedSandboxTemplate({ ...e, templateID: e.template_id }, e.configPath)))process.stdout.write('\n')if (!opts.yes) {const confirmed = await confirm(- `Do you really want to delete ${envs.length === 1 ? 'this template' : 'these templates'+ `Do you really want to delete ${templates.length === 1 ? 'this template' : 'these templates'}?`,)@@ -97,9 +97,9 @@ export const deleteCommand = new commander.Command('delete')}await Promise.all(- envs.map(async e => {- console.log(`- Deleting sandbox template ${asFormattedSandboxTemplate({ ...e, envID: e.template_id }, e.configPath)}`)- await deleteEnv(accessToken, { envID: e.template_id })+ templates.map(async e => {+ console.log(`- Deleting sandbox template ${asFormattedSandboxTemplate({ ...e, templateID: e.template_id }, e.configPath)}`)+ await deleteTemplate(accessToken, { templateID: e.template_id })if (e.configPath) {await deleteConfig(e.configPath)}diff --git a/packages/cli/src/commands/list.ts b/packages/cli/src/commands/list.tsindex 677cfce6c..b7f8a344a 100644--- a/packages/cli/src/commands/list.ts+++ b/packages/cli/src/commands/list.ts@@ -4,10 +4,10 @@ import * as e2b from '@e2b/sdk'import { ensureAccessToken } from 'src/api'import { listAliases } from '../utils/format'-import { sortEnvsAliases } from 'src/utils/templateSort'+import { sortTemplatesAliases } from 'src/utils/templateSort'const listTemplates = e2b.withAccessToken(- e2b.api.path('/envs').method('get').create(),+ e2b.api.path('/templates').method('get').create(),)export const listCommand = new commander.Command('list')@@ -21,7 +21,7 @@ export const listCommand = new commander.Command('list')const templates = await listSandboxTemplates({ accessToken })for (const template of templates) {- sortEnvsAliases(template.aliases)+ sortTemplatesAliases(template.aliases)}if (!templates?.length) {@@ -30,7 +30,7 @@ export const listCommand = new commander.Command('list')const table = new tablePrinter.Table({title: 'Sandbox templates',columns: [- { name: 'envID', alignment: 'left', title: 'Template ID' },+ { name: 'templateID', alignment: 'left', title: 'Template ID' },{ name: 'aliases', alignment: 'left', title: 'Template Name', color: 'orange' },],disabledColumns: ['public', 'buildID'],@@ -51,7 +51,7 @@ export const listCommand = new commander.Command('list')export async function listSandboxTemplates({accessToken,-}: { accessToken: string }): Promise<e2b.components['schemas']['Environment'][]> {+}: { accessToken: string }): Promise<e2b.components['schemas']['Template'][]> {const templates = await listTemplates(accessToken, {})return templates.data}diff --git a/packages/cli/src/commands/sandboxes.ts b/packages/cli/src/commands/sandboxes.tsindex 4c07e212c..d913dd3cc 100644--- a/packages/cli/src/commands/sandboxes.ts+++ b/packages/cli/src/commands/sandboxes.ts@@ -5,7 +5,7 @@ import * as e2b from '@e2b/sdk'import { ensureAPIKey } from 'src/api'const listRunningSandboxes = e2b.withAPIKey(- e2b.api.path('/instances').method('get').create(),+ e2b.api.path('/sandboxes').method('get').create(),)export const runningSandboxesCommand = new commander.Command('sandboxes')@@ -22,8 +22,8 @@ export const runningSandboxesCommand = new commander.Command('sandboxes')const table = new tablePrinter.Table({title: 'Running sandboxes',columns: [- { name: 'instanceID', alignment: 'left', title: 'Sandbox ID' },- { name: 'envID', alignment: 'left', title: 'Template ID' },+ { name: 'sandboxID', alignment: 'left', title: 'Sandbox ID' },+ { name: 'templateID', alignment: 'left', title: 'Template ID' },{ name: 'alias', alignment: 'left', title: 'Alias' },{ name: 'startedAt', alignment: 'left', title: 'Started at' },{ name: 'metadata', alignment: 'left', title: 'Metadata'},@@ -46,7 +46,7 @@ export const runningSandboxesCommand = new commander.Command('sandboxes')export async function listSandboxes({apiKey,-}: { apiKey: string }): Promise<e2b.components['schemas']['RunningInstance'][]> {+}: { apiKey: string }): Promise<e2b.components['schemas']['RunningSandboxes'][]> {const response = await listRunningSandboxes(apiKey, {})return response.data}diff --git a/packages/cli/src/commands/shell.ts b/packages/cli/src/commands/shell.tsindex f6c5ad57e..b4778d034 100644--- a/packages/cli/src/commands/shell.ts+++ b/packages/cli/src/commands/shell.ts@@ -21,7 +21,7 @@ export const shellCommand = new commander.Command('shell')}) => {try {const apiKey = ensureAPIKey()- let envID = template+ let templateID = templateconst root = getRoot(opts.path)const configPath = getConfigPath(root)@@ -31,27 +31,27 @@ export const shellCommand = new commander.Command('shell'): undefinedconst relativeConfigPath = path.relative(root, configPath)- if (!envID && config) {+ if (!templateID && config) {console.log(`Found sandbox template ${asFormattedSandboxTemplate({- envID: config.template_id,+ templateID: config.template_id,aliases: config.template_name ? [config.template_name] : undefined,},relativeConfigPath,)}`,)- envID = config.template_id+ templateID = config.template_id}- if (!envID) {+ if (!templateID) {console.error(`You need to specify sandbox template ID or path to sandbox template config`,)process.exit(1)}- await connectSandbox({ apiKey, template: { envID } })+ await connectSandbox({ apiKey, template: { templateID } })// We explicitly call exit because the sandbox is keeping the program alive.// We also don't want to call sandbox.close because that would disconnect other users from the edit session.process.exit(0)@@ -66,11 +66,11 @@ export async function connectSandbox({template,}: {apiKey: string;- template: Pick<e2b.components['schemas']['Environment'], 'envID'>;+ template: Pick<e2b.components['schemas']['Template'], 'templateID'>;}) {const sandbox = await e2b.Sandbox.create({apiKey,- template: template.envID,+ template: template.templateID,})if (sandbox.terminal) {diff --git a/packages/cli/src/config/index.ts b/packages/cli/src/config/index.tsindex 11d1637c9..593f12dde 100644--- a/packages/cli/src/config/index.ts+++ b/packages/cli/src/config/index.ts@@ -98,7 +98,7 @@ export async function saveConfig(throw new Error(`E2B sandbox template config ${asFormattedSandboxTemplate({- envID: config.template_id,+ templateID: config.template_id,},configPath,)} cannot be saved: ${err.message}`,diff --git a/packages/cli/src/utils/format.ts b/packages/cli/src/utils/format.tsindex 44294fe41..82f9cf912 100644--- a/packages/cli/src/utils/format.ts+++ b/packages/cli/src/utils/format.ts@@ -8,7 +8,7 @@ import { cwdRelative } from './filesystem'export const primaryColor = '#FFB766'export function asFormattedSandboxTemplate(- template: Pick<e2b.components['schemas']['Environment'], 'envID' | 'aliases'>,+ template: Pick<e2b.components['schemas']['Template'], 'templateID' | 'aliases'>,configLocalPath?: string,) {const aliases = listAliases(template.aliases)@@ -18,7 +18,7 @@ export function asFormattedSandboxTemplate(? asDim(' <-> ') + asLocalRelative(configLocalPath): ''- const id = `${template.envID} `+ const id = `${template.templateID} `return `${id}${name}${configPath}`.trim()}diff --git a/packages/cli/src/utils/templatePrompt.ts b/packages/cli/src/utils/templatePrompt.tsindex 6469e3870..94b0d24a1 100644--- a/packages/cli/src/utils/templatePrompt.ts+++ b/packages/cli/src/utils/templatePrompt.ts@@ -3,23 +3,23 @@ import * as chalk from 'chalk'import { asFormattedSandboxTemplate } from 'src/utils/format'-export async function getPromptEnvs(- envs: e2b.components['schemas']['Environment'][],+export async function getPromptTemplates(+ templates: e2b.components['schemas']['Template'][],text: string,) {const inquirer = await import('inquirer')- const envsAnwsers = await inquirer.default.prompt([+ const templatesAnwsers = await inquirer.default.prompt([{- name: 'envs',+ name: 'templates',message: chalk.default.underline(text),type: 'checkbox',pageSize: 50,- choices: envs.map(e => ({+ choices: templates.map(e => ({name: asFormattedSandboxTemplate(e),value: e,})),},])- return envsAnwsers['envs'] as e2b.components['schemas']['Environment'][]+ return templatesAnwsers['templates'] as e2b.components['schemas']['Template'][]}diff --git a/packages/cli/src/utils/templateSort.ts b/packages/cli/src/utils/templateSort.tsindex 63a779a1d..c1c9fda45 100644--- a/packages/cli/src/utils/templateSort.ts+++ b/packages/cli/src/utils/templateSort.ts@@ -1,5 +1,5 @@import * as sdk from '@e2b/sdk'-export function sortEnvsAliases<E extends sdk.components['schemas']['Environment']['aliases']>(aliases: E) {+export function sortTemplatesAliases<E extends sdk.components['schemas']['Template']['aliases']>(aliases: E) {aliases?.sort()}diff --git a/packages/js-sdk/src/api/schema.gen.ts b/packages/js-sdk/src/api/schema.gen.tsindex 7a7cc2b70..8bb34c1f5 100644--- a/packages/js-sdk/src/api/schema.gen.ts+++ b/packages/js-sdk/src/api/schema.gen.ts@@ -14,14 +14,14 @@ export interface paths {};};};- "/instances": {- /** List all running instances */+ "/sandboxes": {+ /** List all running sandboxes */get: {responses: {- /** Successfully returned all running instances */+ /** Successfully returned all running sandboxes */200: {content: {- "application/json": components["schemas"]["RunningInstance"][];+ "application/json": components["schemas"]["RunningSandboxes"][];};};400: components["responses"]["400"];@@ -29,13 +29,13 @@ export interface paths {500: components["responses"]["500"];};};- /** Create an instance from the environment */+ /** Create a sandbox from the template */post: {responses: {- /** The instance was created successfully */+ /** The sandbox was created successfully */201: {content: {- "application/json": components["schemas"]["Instance"];+ "application/json": components["schemas"]["Sandbox"];};};400: components["responses"]["400"];@@ -44,21 +44,21 @@ export interface paths {};requestBody: {content: {- "application/json": components["schemas"]["NewInstance"];+ "application/json": components["schemas"]["NewSandbox"];};};};};- "/instances/{instanceID}/refreshes": {- /** Refresh the instance extending its time to live */+ "/sandboxes/{sandboxID}/refreshes": {+ /** Refresh the sandbox extending its time to live */post: {parameters: {path: {- instanceID: components["parameters"]["instanceID"];+ sandboxID: components["parameters"]["sandboxID"];};};responses: {- /** Successfully refreshed the instance */+ /** Successfully refreshed the sandbox */204: never;401: components["responses"]["401"];404: components["responses"]["404"];@@ -66,13 +66,161 @@ export interface paths {requestBody: {content: {"application/json": {- /** @description Duration for which the instance should be kept alive in seconds */+ /** @description Duration for which the sandbox should be kept alive in seconds */duration?: number;};};};};};+ "/templates": {+ /** List all templates */+ get: {+ responses: {+ /** Successfully returned all templates */+ 200: {+ content: {+ "application/json": components["schemas"]["Template"][];+ };+ };+ 401: components["responses"]["401"];+ 500: components["responses"]["500"];+ };+ };+ /** Create a new template */+ post: {+ responses: {+ /** The build has started */+ 202: {+ content: {+ "application/json": components["schemas"]["Template"];+ };+ };+ 401: components["responses"]["401"];+ 500: components["responses"]["500"];+ };+ requestBody: {+ content: {+ "multipart/form-data": {+ /** @description Alias of the template */+ alias?: string;+ /**+ * Format: binary+ * @description Docker build context+ */+ buildContext: string;+ /** @description Dockerfile content */+ dockerfile: string;+ /** @description Start command to execute in the template after the build */+ startCmd?: string;+ };+ };+ };+ };+ };+ "/templates/{templateID}": {+ /** Rebuild an template */+ post: {+ parameters: {+ path: {+ templateID: components["parameters"]["templateID"];+ };+ };+ responses: {+ /** The build has started */+ 202: {+ content: {+ "application/json": components["schemas"]["Template"];+ };+ };+ 401: components["responses"]["401"];+ 500: components["responses"]["500"];+ };+ requestBody: {+ content: {+ "multipart/form-data": {+ /** @description Alias of the template */+ alias?: string;+ /**+ * Format: binary+ * @description Docker build context+ */+ buildContext: string;+ /** @description Dockerfile content */+ dockerfile: string;+ /** @description Start command to execute in the template after the build */+ startCmd?: string;+ };+ };+ };+ };+ /** Delete a template */+ delete: {+ parameters: {+ path: {+ templateID: components["parameters"]["templateID"];+ };+ };+ responses: {+ /** The template was deleted successfully */+ 204: never;+ 401: components["responses"]["401"];+ 500: components["responses"]["500"];+ };+ };+ };+ "/templates/{templateID}/builds/{buildID}": {+ /** Get template build info */+ get: {+ parameters: {+ path: {+ templateID: components["parameters"]["templateID"];+ buildID: components["parameters"]["buildID"];+ };+ query: {+ /** Index of the starting build log that should be returned with the template */+ logsOffset?: number;+ };+ };+ responses: {+ /** Successfully returned the template */+ 200: {+ content: {+ "application/json": components["schemas"]["TemplateBuild"];+ };+ };+ 401: components["responses"]["401"];+ 404: components["responses"]["404"];+ 500: components["responses"]["500"];+ };+ };+ };+ "/templates/{templateID}/builds/{buildID}/logs": {+ /** Add a build log */+ post: {+ parameters: {+ path: {+ templateID: components["parameters"]["templateID"];+ buildID: components["parameters"]["buildID"];+ };+ };+ responses: {+ /** Successfully added log */+ 201: unknown;+ 401: components["responses"]["401"];+ 404: components["responses"]["404"];+ };+ requestBody: {+ content: {+ "application/json": {+ /** @description API secret */+ apiSecret: string;+ logs: string[];+ };+ };+ };+ };+ };"/envs": {/** List all environments */get: {@@ -221,15 +369,137 @@ export interface paths {};};};+ "/instances": {+ /** List all running instances */+ get: {+ responses: {+ /** Successfully returned all running instances */+ 200: {+ content: {+ "application/json": components["schemas"]["RunningInstance"][];+ };+ };+ 400: components["responses"]["400"];+ 401: components["responses"]["401"];+ 500: components["responses"]["500"];+ };+ };+ /** Create an instance from the environment */+ post: {+ responses: {+ /** The instance was created successfully */+ 201: {+ content: {+ "application/json": components["schemas"]["Instance"];+ };+ };+ 400: components["responses"]["400"];+ 401: components["responses"]["401"];+ 500: components["responses"]["500"];+ };+ requestBody: {+ content: {+ "application/json": components["schemas"]["NewInstance"];+ };+ };+ };+ };+ "/instances/{instanceID}/refreshes": {+ /** Refresh the instance extending its time to live */+ post: {+ parameters: {+ path: {+ instanceID: components["parameters"]["instanceID"];+ };+ };+ responses: {+ /** Successfully refreshed the instance */+ 204: never;+ 401: components["responses"]["401"];+ 404: components["responses"]["404"];+ };+ requestBody: {+ content: {+ "application/json": {+ /** @description Duration for which the instance should be kept alive in seconds */+ duration?: number;+ };+ };+ };+ };+ };}export interface components {schemas: {- InstanceMetadata: { [key: string]: string };- NewInstance: {- /** @description Identifier of the required environment */- envID: string;- metadata?: components["schemas"]["InstanceMetadata"];+ SandboxMetadata: { [key: string]: string };+ Sandbox: {+ /** @description Identifier of the template from which is the sandbox created */+ templateID: string;+ /** @description Identifier of the sandbox */+ sandboxID: string;+ /** @description Alias of the template */+ alias?: string;+ /** @description Identifier of the client */+ clientID: string;+ };+ RunningSandboxes: {+ /** @description Identifier of the template from which is the sandbox created */+ templateID: string;+ /** @description Alias of the template */+ alias?: string;+ /** @description Identifier of the sandbox */+ sandboxID: string;+ /** @description Identifier of the client */+ clientID: string;+ /**+ * Format: date-time+ * @description Time when the sandbox was started+ */+ startedAt: string;+ metadata?: components["schemas"]["SandboxMetadata"];+ };+ NewSandbox: {+ /** @description Identifier of the required template */+ templateID: string;+ metadata?: components["schemas"]["SandboxMetadata"];+ };+ Template: {+ /** @description Identifier of the template */+ templateID: string;+ /** @description Identifier of the last successful build for given template */+ buildID: string;+ /** @description Whether the template is public or only accessible by the team */+ public: boolean;+ /** @description Aliases of the template */+ aliases?: string[];+ };+ TemplateBuild: {+ /**+ * @description Build logs+ * @default []+ */+ logs: string[];+ /** @description Identifier of the template */+ templateID: string;+ /** @description Identifier of the build */+ buildID: string;+ /**+ * @description Status of the template+ * @enum {string}+ */+ status?: "building" | "ready" | "error";+ } & {+ finished: unknown;+ };+ Error: {+ /**+ * Format: int32+ * @description Error code+ */+ code: number;+ /** @description Error */+ message: string;};Environment: {/** @description Identifier of the environment */@@ -259,30 +529,23 @@ export interface components {} & {finished: unknown;};+ InstanceMetadata: { [key: string]: string };+ NewInstance: {+ /** @description Identifier of the required environment */+ envID: string;+ metadata?: components["schemas"]["InstanceMetadata"];+ };Instance: {/** @description Identifier of the environment from which is the instance created */envID: string;/** @description Identifier of the instance */instanceID: string;- /** @description Alias of the environment */- alias?: string;/** @description Identifier of the client */clientID: string;};- Error: {- /**- * Format: int32- * @description Error code- */- code: number;- /** @description Error */- message: string;- };RunningInstance: {/** @description Identifier of the environment from which is the instance created */envID: string;- /** @description Alias of the environment */- alias?: string;/** @description Identifier of the instance */instanceID: string;/** @description Identifier of the client */@@ -322,8 +585,10 @@ export interface components {};};parameters: {- envID: string;+ templateID: string;buildID: string;+ sandboxID: string;+ envID: string;instanceID: string;};}diff --git a/packages/js-sdk/src/sandbox/index.ts b/packages/js-sdk/src/sandbox/index.tsindex f41a786a5..7a3d5e882 100644--- a/packages/js-sdk/src/sandbox/index.ts+++ b/packages/js-sdk/src/sandbox/index.ts@@ -534,20 +534,20 @@ export class Sandbox extends SandboxConnection {*/static async reconnect<S extends typeof Sandbox>(this: S, opts: Omit<SandboxOpts, 'id' | 'template'> & { sandboxID: string }): Promise<InstanceType<S>>;static async reconnect<S extends typeof Sandbox>(this: S, sandboxIDorOpts: string | Omit<SandboxOpts, 'id' | 'template'> & { sandboxID: string }): Promise<InstanceType<S>> {- let sandboxID: string+ let id: stringlet opts: SandboxOptsif (typeof sandboxIDorOpts === 'string') {- sandboxID = sandboxIDorOpts+ id = sandboxIDorOptsopts = {}} else {- sandboxID = sandboxIDorOpts.sandboxID+ id = sandboxIDorOpts.sandboxIDopts = sandboxIDorOpts}- const instanceIDAndClientID = sandboxID.split("-")- const instanceID = instanceIDAndClientID[0]- const clientID = instanceIDAndClientID[1]- opts.__sandbox = { instanceID, clientID, envID: 'unknown' }+ const sandboxIDAndClientID = id.split("-")+ const sandboxID = sandboxIDAndClientID[0]+ const clientID = sandboxIDAndClientID[1]+ opts.__sandbox = { sandboxID, clientID, templateID: 'unknown' }const sandbox = new this(opts) as InstanceType<S>await sandbox._open({ timeout: opts?.timeout })diff --git a/packages/js-sdk/src/sandbox/sandboxConnection.ts b/packages/js-sdk/src/sandbox/sandboxConnection.tsindex 324fd0e31..c41162451 100644--- a/packages/js-sdk/src/sandbox/sandboxConnection.ts+++ b/packages/js-sdk/src/sandbox/sandboxConnection.ts@@ -62,7 +62,7 @@ export interface SandboxConnectionOpts {envVars?: EnvVars;metadata?: SandboxMetadata;logger?: Logger;- __sandbox?: components['schemas']['Instance'];+ __sandbox?: components['schemas']['Sandbox'];__debug_hostname?: string;__debug_port?: number;__debug_devEnv?: 'remote' | 'local';@@ -75,13 +75,13 @@ export interface CallOpts {const listSandboxes = withAPIKey(- api.path('/instances').method('get').create(),+ api.path('/sandboxes').method('get').create(),)const createSandbox = withAPIKey(- api.path('/instances').method('post').create(),+ api.path('/sandboxes').method('post').create(),)const refreshSandbox = withAPIKey(- api.path('/instances/{instanceID}/refreshes').method('post').create(),+ api.path('/sandboxes/{sandboxID}/refreshes').method('post').create(),)export class SandboxConnection {@@ -99,7 +99,7 @@ export class SandboxConnection {envVars: EnvVarsprotected readonly logger: Logger- protected sandbox?: components['schemas']['Instance']+ protected sandbox?: components['schemas']['Sandbox']protected isOpen = falseprivate readonly apiKey: string@@ -137,7 +137,11 @@ export class SandboxConnection {* You can use this ID to reconnect to the sandbox later.*/get id() {- return `${this.sandbox?.instanceID}-${this.sandbox?.clientID}`+ return `${this.sandbox?.sandboxID}-${this.sandbox?.clientID}`+ }++ private get templateID(): string {+ return this.opts.template || this.opts.id || 'base'}/**@@ -147,8 +151,7 @@ export class SandboxConnection {static async list(apiKey?: string): Promise<RunningSandbox[]> {apiKey = getApiKey(apiKey)try {- const res = await listSandboxes(apiKey, {})- return res.data.map((instance) => ({ sandboxID: instance.instanceID, alias: instance.alias, templateID: instance.envID, metadata: instance.metadata }))+ return (await listSandboxes(apiKey, {})).data} catch (e) {if (e instanceof listSandboxes.Error) {const error = e.getActualType()@@ -167,10 +170,6 @@ export class SandboxConnection {}}- private get templateID(): string {- return this.opts.template || this.opts.id || 'base'- }-/*** Keep the sandbox alive for the specified duration.*@@ -189,7 +188,7 @@ export class SandboxConnection {throw new Error('Cannot keep alive - sandbox is not initialized')}await refreshSandbox(this.apiKey, {- instanceID: this.sandbox?.instanceID, duration,+ sandboxID: this.sandbox?.sandboxID, duration,})}@@ -217,7 +216,7 @@ export class SandboxConnection {throw new Error('Cannot get sandbox\'s hostname - sandbox is not initialized')}- const hostname = `${this.sandbox.instanceID}-${this.sandbox.clientID}.${SANDBOX_DOMAIN}`+ const hostname = `${this.id}.${SANDBOX_DOMAIN}`if (port) {return `${port}-${hostname}`} else {@@ -242,7 +241,7 @@ export class SandboxConnection {*/async close() {if (this.isOpen) {- this.logger.debug?.(`Closing sandbox "${this.sandbox?.instanceID}"`)+ this.logger.debug?.(`Closing sandbox "${this.id}"`)this.isOpen = false// This is `ws` way of closing connection@@ -365,12 +364,12 @@ export class SandboxConnection {if (!this.sandbox && !this.opts.__debug_hostname) {try {const res = await createSandbox(this.apiKey, {- envID: this.templateID,+ templateID: this.templateID,metadata: this.opts.metadata,})this.sandbox = res.data- this.logger.debug?.(`Acquired sandbox "${this.sandbox.instanceID}"`)+ this.logger.debug?.(`Acquired sandbox "${this.id}"`)} catch (e) {if (e instanceof createSandbox.Error) {const error = e.getActualType()@@ -395,7 +394,7 @@ export class SandboxConnection {}if (this.sandbox && !this.opts.__debug_hostname) {- this.refresh(this.sandbox.instanceID)+ this.refresh(this.sandbox.sandboxID)}await this.connectRpc()@@ -434,21 +433,21 @@ export class SandboxConnection {this.rpc.onOpen(() => {this.logger.debug?.(- `Connected to sandbox "${this.sandbox?.instanceID}"`,+ `Connected to sandbox "${this.id}"`,)resolveOpening?.()})this.rpc.onError(async (err) => {this.logger.debug?.(- `Error in WebSocket of sandbox "${this.sandbox?.instanceID}": ${err.message ?? err.code ?? err.toString()+ `Error in WebSocket of sandbox "${this.id}": ${err.message ?? err.code ?? err.toString()}. Trying to reconnect...`,)if (this.isOpen) {await wait(WS_RECONNECT_INTERVAL)this.logger.debug?.(- `Reconnecting to sandbox "${this.sandbox?.instanceID}"`,+ `Reconnecting to sandbox "${this.id}"`,)try {// When the WS connection closes the subscribers in devbookd are removed.@@ -456,13 +455,13 @@ export class SandboxConnection {this.subscribers = []await this.rpc.connect(sandboxURL)this.logger.debug?.(- `Reconnected to sandbox "${this.sandbox?.instanceID}"`,+ `Reconnected to sandbox "${this.id}"`,)// eslint-disable-next-line @typescript-eslint/no-explicit-any} catch (err: any) {// not warn, because this is somewhat expected behaviour during initializationthis.logger.debug?.(- `Failed reconnecting to sandbox "${this.sandbox?.instanceID}": ${err.message ?? err.code ?? err.toString()+ `Failed reconnecting to sandbox "${this.id}": ${err.message ?? err.code ?? err.toString()}`,)}@@ -473,7 +472,7 @@ export class SandboxConnection {this.rpc.onClose(async () => {this.logger.debug?.(- `WebSocket connection to sandbox "${this.sandbox?.instanceID}" closed`,+ `WebSocket connection to sandbox "${this.id}" closed`,)})@@ -484,14 +483,14 @@ export class SandboxConnection {(async () => {try {this.logger.debug?.(- `Connecting to sandbox "${this.sandbox?.instanceID}"`,+ `Connecting to sandbox "${this.id}"`,)await this.rpc.connect(sandboxURL)// eslint-disable-next-line @typescript-eslint/no-explicit-any} catch (err: any) {// not warn, because this is somewhat expected behaviour during initializationthis.logger.debug?.(- `Error connecting to sandbox "${this.sandbox?.instanceID}": ${err.message ?? err.code ?? err.toString()+ `Error connecting to sandbox "${this.id}": ${err.message ?? err.code ?? err.toString()}`,)}@@ -507,15 +506,15 @@ export class SandboxConnection {.forEach((s) => s.handler(data.params?.result))}- private async refresh(instanceID: string) {- this.logger.debug?.(`Started refreshing sandbox "${instanceID}"`)+ private async refresh(sandboxID: string) {+ this.logger.debug?.(`Started refreshing sandbox "${sandboxID}"`)try {// eslint-disable-next-line no-constant-conditionwhile (true) {if (!this.isOpen) {this.logger.debug?.(- `Cannot refresh sandbox ${this.sandbox?.instanceID} - it was closed`,+ `Cannot refresh sandbox ${this.id} - it was closed`,)return}@@ -523,10 +522,10 @@ export class SandboxConnection {await wait(SANDBOX_REFRESH_PERIOD)try {- this.logger.debug?.(`Refreshed sandbox "${instanceID}"`)+ this.logger.debug?.(`Refreshed sandbox "${sandboxID}"`)await refreshSandbox(this.apiKey, {- instanceID, duration: 0,+ sandboxID, duration: 0,})} catch (e) {if (e instanceof refreshSandbox.Error) {@@ -538,13 +537,13 @@ export class SandboxConnection {return}this.logger.warn?.(- `Refreshing sandbox "${instanceID}" failed - (${error.status})`,+ `Refreshing sandbox "${sandboxID}" failed - (${error.status})`,)}}}} finally {- this.logger.debug?.(`Stopped refreshing sandbox "${instanceID}"`)+ this.logger.debug?.(`Stopped refreshing sandbox "${sandboxID}"`)await this.close()}}diff --git a/packages/python-sdk/Makefile b/packages/python-sdk/Makefileindex a79d8401b..e882a18c1 100644--- a/packages/python-sdk/Makefile+++ b/packages/python-sdk/Makefile@@ -7,7 +7,7 @@ generate-v2:-i ../../spec/openapi.yml \-g python \-o ./e2b/api \- --global-property apis="instances",models,supportingFiles,modelDocs=false \+ --global-property apis="sandboxes",models,supportingFiles,modelDocs=false \--additional-properties=generateSourceCodeOnly=true \--additional-properties=disallowAdditionalPropertiesIfNotPresent=false \--additional-properties=usePydanticV2=true \@@ -29,7 +29,7 @@ generate-v1:-i ../../spec/openapi.yml \-g python-pydantic-v1 \-o ./e2b/api \- --global-property apis="instances",models,supportingFiles,modelDocs=false \+ --global-property apis="sandboxes",models,supportingFiles,modelDocs=false \--additional-properties=generateSourceCodeOnly=true \--additional-properties=disallowAdditionalPropertiesIfNotPresent=false \--additional-properties=packageName=e2b.api.v1.clientdiff --git a/packages/python-sdk/e2b/api/v1/client/__init__.py b/packages/python-sdk/e2b/api/v1/client/__init__.pyindex 25f6a02ec..e076a1163 100644--- a/packages/python-sdk/e2b/api/v1/client/__init__.py+++ b/packages/python-sdk/e2b/api/v1/client/__init__.py@@ -17,7 +17,7 @@__version__ = "1.0.0"# import apis into sdk package-from e2b.api.v1.client.api.instances_api import InstancesApi+from e2b.api.v1.client.api.sandboxes_api import SandboxesApi# import ApiClientfrom e2b.api.v1.client.api_response import ApiResponse@@ -33,13 +33,21 @@ from e2b.api.v1.client.exceptions import ApiException# import models into sdk packagefrom e2b.api.v1.client.models.environment import Environmentfrom e2b.api.v1.client.models.environment_build import EnvironmentBuild-from e2b.api.v1.client.models.envs_env_id_builds_build_id_logs_post_request import (- EnvsEnvIDBuildsBuildIDLogsPostRequest,-)from e2b.api.v1.client.models.error import Errorfrom e2b.api.v1.client.models.instance import Instancefrom e2b.api.v1.client.models.instances_instance_id_refreshes_post_request import (InstancesInstanceIDRefreshesPostRequest,)from e2b.api.v1.client.models.new_instance import NewInstance+from e2b.api.v1.client.models.new_sandbox import NewSandboxfrom e2b.api.v1.client.models.running_instance import RunningInstance+from e2b.api.v1.client.models.running_sandboxes import RunningSandboxes+from e2b.api.v1.client.models.sandbox import Sandbox+from e2b.api.v1.client.models.sandboxes_sandbox_id_refreshes_post_request import (+ SandboxesSandboxIDRefreshesPostRequest,+)+from e2b.api.v1.client.models.template import Template+from e2b.api.v1.client.models.template_build import TemplateBuild+from e2b.api.v1.client.models.templates_template_id_builds_build_id_logs_post_request import (+ TemplatesTemplateIDBuildsBuildIDLogsPostRequest,+)diff --git a/packages/python-sdk/e2b/api/v1/client/api/__init__.py b/packages/python-sdk/e2b/api/v1/client/api/__init__.pyindex 131828c59..0471f665b 100644--- a/packages/python-sdk/e2b/api/v1/client/api/__init__.py+++ b/packages/python-sdk/e2b/api/v1/client/api/__init__.py@@ -1,4 +1,4 @@# flake8: noqa# import apis into api package-from e2b.api.v1.client.api.instances_api import InstancesApi+from e2b.api.v1.client.api.sandboxes_api import SandboxesApidiff --git a/packages/python-sdk/e2b/api/v1/client/api/instances_api.py b/packages/python-sdk/e2b/api/v1/client/api/sandboxes_api.pysimilarity index 77%rename from packages/python-sdk/e2b/api/v1/client/api/instances_api.pyrename to packages/python-sdk/e2b/api/v1/client/api/sandboxes_api.pyindex d31a0bbe6..68482c030 100644--- a/packages/python-sdk/e2b/api/v1/client/api/instances_api.py+++ b/packages/python-sdk/e2b/api/v1/client/api/sandboxes_api.py@@ -22,19 +22,19 @@ from pydantic import StrictStrfrom typing import List, Optional-from e2b.api.v1.client.models.instance import Instance-from e2b.api.v1.client.models.instances_instance_id_refreshes_post_request import (- InstancesInstanceIDRefreshesPostRequest,+from e2b.api.v1.client.models.new_sandbox import NewSandbox+from e2b.api.v1.client.models.running_sandboxes import RunningSandboxes+from e2b.api.v1.client.models.sandbox import Sandbox+from e2b.api.v1.client.models.sandboxes_sandbox_id_refreshes_post_request import (+ SandboxesSandboxIDRefreshesPostRequest,)-from e2b.api.v1.client.models.new_instance import NewInstance-from e2b.api.v1.client.models.running_instance import RunningInstancefrom e2b.api.v1.client.api_client import ApiClientfrom e2b.api.v1.client.api_response import ApiResponsefrom e2b.api.v1.client.exceptions import ApiTypeError, ApiValueError # noqa: F401-class InstancesApi:+class SandboxesApi:"""NOTE: This class is auto generated by OpenAPI GeneratorRef: https://openapi-generator.tech@@ -47,14 +47,14 @@ class InstancesApi:self.api_client = api_client@validate_arguments- def instances_get(self, **kwargs) -> List[RunningInstance]: # noqa: E501- """instances_get # noqa: E501+ def sandboxes_get(self, **kwargs) -> List[RunningSandboxes]: # noqa: E501+ """sandboxes_get # noqa: E501- List all running instances # noqa: E501+ List all running sandboxes # noqa: E501This method makes a synchronous HTTP request by default. To make anasynchronous HTTP request, please pass async_req=True- >>> thread = api.instances_get(async_req=True)+ >>> thread = api.sandboxes_get(async_req=True)>>> result = thread.get():param async_req: Whether to execute the request asynchronously.@@ -66,23 +66,23 @@ class InstancesApi::return: Returns the result object.If the method is called asynchronously,returns the request thread.- :rtype: List[RunningInstance]+ :rtype: List[RunningSandboxes]"""kwargs["_return_http_data_only"] = Trueif "_preload_content" in kwargs:- message = "Error! Please call the instances_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501+ message = "Error! Please call the sandboxes_get_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501raise ValueError(message)- return self.instances_get_with_http_info(**kwargs) # noqa: E501+ return self.sandboxes_get_with_http_info(**kwargs) # noqa: E501@validate_arguments- def instances_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501- """instances_get # noqa: E501+ def sandboxes_get_with_http_info(self, **kwargs) -> ApiResponse: # noqa: E501+ """sandboxes_get # noqa: E501- List all running instances # noqa: E501+ List all running sandboxes # noqa: E501This method makes a synchronous HTTP request by default. To make anasynchronous HTTP request, please pass async_req=True- >>> thread = api.instances_get_with_http_info(async_req=True)+ >>> thread = api.sandboxes_get_with_http_info(async_req=True)>>> result = thread.get():param async_req: Whether to execute the request asynchronously.@@ -107,7 +107,7 @@ class InstancesApi::return: Returns the result object.If the method is called asynchronously,returns the request thread.- :rtype: tuple(List[RunningInstance], status_code(int), headers(HTTPHeaderDict))+ :rtype: tuple(List[RunningSandboxes], status_code(int), headers(HTTPHeaderDict))"""_params = locals()@@ -130,7 +130,7 @@ class InstancesApi:if _key not in _all_params:raise ApiTypeError("Got an unexpected keyword argument '%s'"- " to method instances_get" % _key+ " to method sandboxes_get" % _key)_params[_key] = _valdel _params["kwargs"]@@ -158,14 +158,14 @@ class InstancesApi:_auth_settings = ["ApiKeyAuth"] # noqa: E501_response_types_map = {- "200": "List[RunningInstance]",+ "200": "List[RunningSandboxes]","401": "Error","400": "Error","500": "Error",}return self.api_client.call_api(- "/instances",+ "/sandboxes","GET",_path_params,_query_params,@@ -184,27 +184,20 @@ class InstancesApi:)@validate_arguments- def instances_instance_id_refreshes_post(- self,- instance_id: StrictStr,- instances_instance_id_refreshes_post_request: Optional[- InstancesInstanceIDRefreshesPostRequest- ] = None,- **kwargs- ) -> None: # noqa: E501- """instances_instance_id_refreshes_post # noqa: E501+ def sandboxes_post(+ self, new_sandbox: NewSandbox, **kwargs+ ) -> Sandbox: # noqa: E501+ """sandboxes_post # noqa: E501- Refresh the instance extending its time to live # noqa: E501+ Create a sandbox from the template # noqa: E501This method makes a synchronous HTTP request by default. To make anasynchronous HTTP request, please pass async_req=True- >>> thread = api.instances_instance_id_refreshes_post(instance_id, instances_instance_id_refreshes_post_request, async_req=True)+ >>> thread = api.sandboxes_post(new_sandbox, async_req=True)>>> result = thread.get()- :param instance_id: (required)- :type instance_id: str- :param instances_instance_id_refreshes_post_request:- :type instances_instance_id_refreshes_post_request: InstancesInstanceIDRefreshesPostRequest+ :param new_sandbox: (required)+ :type new_sandbox: NewSandbox:param async_req: Whether to execute the request asynchronously.:type async_req: bool, optional:param _request_timeout: timeout setting for this request.@@ -214,38 +207,29 @@ class InstancesApi::return: Returns the result object.If the method is called asynchronously,returns the request thread.- :rtype: None+ :rtype: Sandbox"""kwargs["_return_http_data_only"] = Trueif "_preload_content" in kwargs:- message = "Error! Please call the instances_instance_id_refreshes_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501+ message = "Error! Please call the sandboxes_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501raise ValueError(message)- return self.instances_instance_id_refreshes_post_with_http_info(- instance_id, instances_instance_id_refreshes_post_request, **kwargs- ) # noqa: E501+ return self.sandboxes_post_with_http_info(new_sandbox, **kwargs) # noqa: E501@validate_arguments- def instances_instance_id_refreshes_post_with_http_info(- self,- instance_id: StrictStr,- instances_instance_id_refreshes_post_request: Optional[- InstancesInstanceIDRefreshesPostRequest- ] = None,- **kwargs+ def sandboxes_post_with_http_info(+ self, new_sandbox: NewSandbox, **kwargs) -> ApiResponse: # noqa: E501- """instances_instance_id_refreshes_post # noqa: E501+ """sandboxes_post # noqa: E501- Refresh the instance extending its time to live # noqa: E501+ Create a sandbox from the template # noqa: E501This method makes a synchronous HTTP request by default. To make anasynchronous HTTP request, please pass async_req=True- >>> thread = api.instances_instance_id_refreshes_post_with_http_info(instance_id, instances_instance_id_refreshes_post_request, async_req=True)+ >>> thread = api.sandboxes_post_with_http_info(new_sandbox, async_req=True)>>> result = thread.get()- :param instance_id: (required)- :type instance_id: str- :param instances_instance_id_refreshes_post_request:- :type instances_instance_id_refreshes_post_request: InstancesInstanceIDRefreshesPostRequest+ :param new_sandbox: (required)+ :type new_sandbox: NewSandbox:param async_req: Whether to execute the request asynchronously.:type async_req: bool, optional:param _preload_content: if False, the ApiResponse.data will@@ -268,12 +252,12 @@ class InstancesApi::return: Returns the result object.If the method is called asynchronously,returns the request thread.- :rtype: None+ :rtype: tuple(Sandbox, status_code(int), headers(HTTPHeaderDict))"""_params = locals()- _all_params = ["instance_id", "instances_instance_id_refreshes_post_request"]+ _all_params = ["new_sandbox"]_all_params.extend(["async_req",@@ -291,7 +275,7 @@ class InstancesApi:if _key not in _all_params:raise ApiTypeError("Got an unexpected keyword argument '%s'"- " to method instances_instance_id_refreshes_post" % _key+ " to method sandboxes_post" % _key)_params[_key] = _valdel _params["kwargs"]@@ -300,8 +284,6 @@ class InstancesApi:# process the path parameters_path_params = {}- if _params["instance_id"] is not None:- _path_params["instanceID"] = _params["instance_id"]# process the query parameters_query_params = []@@ -312,8 +294,8 @@ class InstancesApi:_files = {}# process the body parameter_body_params = None- if _params["instances_instance_id_refreshes_post_request"] is not None:- _body_params = _params["instances_instance_id_refreshes_post_request"]+ if _params["new_sandbox"] is not None:+ _body_params = _params["new_sandbox"]# set the HTTP header `Accept`_header_params["Accept"] = self.api_client.select_header_accept(@@ -331,10 +313,15 @@ class InstancesApi:# authentication setting_auth_settings = ["ApiKeyAuth"] # noqa: E501- _response_types_map = {}+ _response_types_map = {+ "201": "Sandbox",+ "401": "Error",+ "400": "Error",+ "500": "Error",+ }return self.api_client.call_api(- "/instances/{instanceID}/refreshes",+ "/sandboxes","POST",_path_params,_query_params,@@ -353,20 +340,27 @@ class InstancesApi:)@validate_arguments- def instances_post(- self, new_instance: NewInstance, **kwargs- ) -> Instance: # noqa: E501- """instances_post # noqa: E501+ def sandboxes_sandbox_id_refreshes_post(+ self,+ sandbox_id: StrictStr,+ sandboxes_sandbox_id_refreshes_post_request: Optional[+ SandboxesSandboxIDRefreshesPostRequest+ ] = None,+ **kwargs+ ) -> None: # noqa: E501+ """sandboxes_sandbox_id_refreshes_post # noqa: E501- Create an instance from the environment # noqa: E501+ Refresh the sandbox extending its time to live # noqa: E501This method makes a synchronous HTTP request by default. To make anasynchronous HTTP request, please pass async_req=True- >>> thread = api.instances_post(new_instance, async_req=True)+ >>> thread = api.sandboxes_sandbox_id_refreshes_post(sandbox_id, sandboxes_sandbox_id_refreshes_post_request, async_req=True)>>> result = thread.get()- :param new_instance: (required)- :type new_instance: NewInstance+ :param sandbox_id: (required)+ :type sandbox_id: str+ :param sandboxes_sandbox_id_refreshes_post_request:+ :type sandboxes_sandbox_id_refreshes_post_request: SandboxesSandboxIDRefreshesPostRequest:param async_req: Whether to execute the request asynchronously.:type async_req: bool, optional:param _request_timeout: timeout setting for this request.@@ -376,29 +370,38 @@ class InstancesApi::return: Returns the result object.If the method is called asynchronously,returns the request thread.- :rtype: Instance+ :rtype: None"""kwargs["_return_http_data_only"] = Trueif "_preload_content" in kwargs:- message = "Error! Please call the instances_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501+ message = "Error! Please call the sandboxes_sandbox_id_refreshes_post_with_http_info method with `_preload_content` instead and obtain raw data from ApiResponse.raw_data" # noqa: E501raise ValueError(message)- return self.instances_post_with_http_info(new_instance, **kwargs) # noqa: E501+ return self.sandboxes_sandbox_id_refreshes_post_with_http_info(+ sandbox_id, sandboxes_sandbox_id_refreshes_post_request, **kwargs+ ) # noqa: E501@validate_arguments- def instances_post_with_http_info(- self, new_instance: NewInstance, **kwargs+ def sandboxes_sandbox_id_refreshes_post_with_http_info(+ self,+ sandbox_id: StrictStr,+ sandboxes_sandbox_id_refreshes_post_request: Optional[+ SandboxesSandboxIDRefreshesPostRequest+ ] = None,+ **kwargs) -> ApiResponse: # noqa: E501- """instances_post # noqa: E501+ """sandboxes_sandbox_id_refreshes_post # noqa: E501- Create an instance from the environment # noqa: E501+ Refresh the sandbox extending its time to live # noqa: E501This method makes a synchronous HTTP request by default. To make anasynchronous HTTP request, please pass async_req=True- >>> thread = api.instances_post_with_http_info(new_instance, async_req=True)+ >>> thread = api.sandboxes_sandbox_id_refreshes_post_with_http_info(sandbox_id, sandboxes_sandbox_id_refreshes_post_request, async_req=True)>>> result = thread.get()- :param new_instance: (required)- :type new_instance: NewInstance+ :param sandbox_id: (required)+ :type sandbox_id: str+ :param sandboxes_sandbox_id_refreshes_post_request:+ :type sandboxes_sandbox_id_refreshes_post_request: SandboxesSandboxIDRefreshesPostRequest:param async_req: Whether to execute the request asynchronously.:type async_req: bool, optional:param _preload_content: if False, the ApiResponse.data will@@ -421,12 +424,12 @@ class InstancesApi::return: Returns the result object.If the method is called asynchronously,returns the request thread.- :rtype: tuple(Instance, status_code(int), headers(HTTPHeaderDict))+ :rtype: None"""_params = locals()- _all_params = ["new_instance"]+ _all_params = ["sandbox_id", "sandboxes_sandbox_id_refreshes_post_request"]_all_params.extend(["async_req",@@ -444,7 +447,7 @@ class InstancesApi:if _key not in _all_params:raise ApiTypeError("Got an unexpected keyword argument '%s'"- " to method instances_post" % _key+ " to method sandboxes_sandbox_id_refreshes_post" % _key)_params[_key] = _valdel _params["kwargs"]@@ -453,6 +456,8 @@ class InstancesApi:# process the path parameters_path_params = {}+ if _params["sandbox_id"] is not None:+ _path_params["sandboxID"] = _params["sandbox_id"]# process the query parameters_query_params = []@@ -463,8 +468,8 @@ class InstancesApi:_files = {}# process the body parameter_body_params = None- if _params["new_instance"] is not None:- _body_params = _params["new_instance"]+ if _params["sandboxes_sandbox_id_refreshes_post_request"] is not None:+ _body_params = _params["sandboxes_sandbox_id_refreshes_post_request"]# set the HTTP header `Accept`_header_params["Accept"] = self.api_client.select_header_accept(@@ -482,15 +487,10 @@ class InstancesApi:# authentication setting_auth_settings = ["ApiKeyAuth"] # noqa: E501- _response_types_map = {- "201": "Instance",- "401": "Error",- "400": "Error",- "500": "Error",- }+ _response_types_map = {}return self.api_client.call_api(- "/instances",+ "/sandboxes/{sandboxID}/refreshes","POST",_path_params,_query_params,diff --git a/packages/python-sdk/e2b/api/v1/client/models/__init__.py b/packages/python-sdk/e2b/api/v1/client/models/__init__.pyindex 28647c01a..ea14b0760 100644--- a/packages/python-sdk/e2b/api/v1/client/models/__init__.py+++ b/packages/python-sdk/e2b/api/v1/client/models/__init__.py@@ -16,13 +16,21 @@# import models into model packagefrom e2b.api.v1.client.models.environment import Environmentfrom e2b.api.v1.client.models.environment_build import EnvironmentBuild-from e2b.api.v1.client.models.envs_env_id_builds_build_id_logs_post_request import (- EnvsEnvIDBuildsBuildIDLogsPostRequest,-)from e2b.api.v1.client.models.error import Errorfrom e2b.api.v1.client.models.instance import Instancefrom e2b.api.v1.client.models.instances_instance_id_refreshes_post_request import (InstancesInstanceIDRefreshesPostRequest,)from e2b.api.v1.client.models.new_instance import NewInstance+from e2b.api.v1.client.models.new_sandbox import NewSandboxfrom e2b.api.v1.client.models.running_instance import RunningInstance+from e2b.api.v1.client.models.running_sandboxes import RunningSandboxes+from e2b.api.v1.client.models.sandbox import Sandbox+from e2b.api.v1.client.models.sandboxes_sandbox_id_refreshes_post_request import (+ SandboxesSandboxIDRefreshesPostRequest,+)+from e2b.api.v1.client.models.template import Template+from e2b.api.v1.client.models.template_build import TemplateBuild+from e2b.api.v1.client.models.templates_template_id_builds_build_id_logs_post_request import (+ TemplatesTemplateIDBuildsBuildIDLogsPostRequest,+)diff --git a/packages/python-sdk/e2b/api/v1/client/models/new_sandbox.py b/packages/python-sdk/e2b/api/v1/client/models/new_sandbox.pynew file mode 100644index 000000000..d52ead018--- /dev/null+++ b/packages/python-sdk/e2b/api/v1/client/models/new_sandbox.py@@ -0,0 +1,85 @@+# coding: utf-8++"""+ E2B API++ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)++ The version of the OpenAPI document: 0.1.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 Any, Dict, Optional+from pydantic import BaseModel, Field, StrictStr+++class NewSandbox(BaseModel):+ """+ NewSandbox+ """++ template_id: StrictStr = Field(+ ..., alias="templateID", description="Identifier of the required template"+ )+ metadata: Optional[Dict[str, StrictStr]] = None+ additional_properties: Dict[str, Any] = {}+ __properties = ["templateID", "metadata"]++ 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) -> NewSandbox:+ """Create an instance of NewSandbox 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={"additional_properties"}, exclude_none=True+ )+ # puts key-value pairs in additional_properties in the top level+ if self.additional_properties is not None:+ for _key, _value in self.additional_properties.items():+ _dict[_key] = _value++ return _dict++ @classmethod+ def from_dict(cls, obj: dict) -> NewSandbox:+ """Create an instance of NewSandbox from a dict"""+ if obj is None:+ return None++ if not isinstance(obj, dict):+ return NewSandbox.parse_obj(obj)++ _obj = NewSandbox.parse_obj(+ {"template_id": obj.get("templateID"), "metadata": obj.get("metadata")}+ )+ # store additional fields in additional_properties+ for _key in obj.keys():+ if _key not in cls.__properties:+ _obj.additional_properties[_key] = obj.get(_key)++ return _objdiff --git a/packages/python-sdk/e2b/api/v1/client/models/running_sandboxes.py b/packages/python-sdk/e2b/api/v1/client/models/running_sandboxes.pynew file mode 100644index 000000000..3900750b0--- /dev/null+++ b/packages/python-sdk/e2b/api/v1/client/models/running_sandboxes.py@@ -0,0 +1,111 @@+# coding: utf-8++"""+ E2B API++ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)++ The version of the OpenAPI document: 0.1.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 datetime import datetime+from typing import Any, Dict, Optional+from pydantic import BaseModel, Field, StrictStr+++class RunningSandboxes(BaseModel):+ """+ RunningSandboxes+ """++ template_id: StrictStr = Field(+ ...,+ alias="templateID",+ description="Identifier of the template from which is the sandbox created",+ )+ alias: Optional[StrictStr] = Field(None, description="Alias of the template")+ sandbox_id: StrictStr = Field(+ ..., alias="sandboxID", description="Identifier of the sandbox"+ )+ client_id: StrictStr = Field(+ ..., alias="clientID", description="Identifier of the client"+ )+ started_at: datetime = Field(+ ..., alias="startedAt", description="Time when the sandbox was started"+ )+ metadata: Optional[Dict[str, StrictStr]] = None+ additional_properties: Dict[str, Any] = {}+ __properties = [+ "templateID",+ "alias",+ "sandboxID",+ "clientID",+ "startedAt",+ "metadata",+ ]++ 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) -> RunningSandboxes:+ """Create an instance of RunningSandboxes 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={"additional_properties"}, exclude_none=True+ )+ # puts key-value pairs in additional_properties in the top level+ if self.additional_properties is not None:+ for _key, _value in self.additional_properties.items():+ _dict[_key] = _value++ return _dict++ @classmethod+ def from_dict(cls, obj: dict) -> RunningSandboxes:+ """Create an instance of RunningSandboxes from a dict"""+ if obj is None:+ return None++ if not isinstance(obj, dict):+ return RunningSandboxes.parse_obj(obj)++ _obj = RunningSandboxes.parse_obj(+ {+ "template_id": obj.get("templateID"),+ "alias": obj.get("alias"),+ "sandbox_id": obj.get("sandboxID"),+ "client_id": obj.get("clientID"),+ "started_at": obj.get("startedAt"),+ "metadata": obj.get("metadata"),+ }+ )+ # store additional fields in additional_properties+ for _key in obj.keys():+ if _key not in cls.__properties:+ _obj.additional_properties[_key] = obj.get(_key)++ return _objdiff --git a/packages/python-sdk/e2b/api/v1/client/models/sandbox.py b/packages/python-sdk/e2b/api/v1/client/models/sandbox.pynew file mode 100644index 000000000..af50a02c1--- /dev/null+++ b/packages/python-sdk/e2b/api/v1/client/models/sandbox.py@@ -0,0 +1,98 @@+# coding: utf-8++"""+ E2B API++ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)++ The version of the OpenAPI document: 0.1.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 Any, Dict, Optional+from pydantic import BaseModel, Field, StrictStr+++class Sandbox(BaseModel):+ """+ Sandbox+ """++ template_id: StrictStr = Field(+ ...,+ alias="templateID",+ description="Identifier of the template from which is the sandbox created",+ )+ sandbox_id: StrictStr = Field(+ ..., alias="sandboxID", description="Identifier of the sandbox"+ )+ alias: Optional[StrictStr] = Field(None, description="Alias of the template")+ client_id: StrictStr = Field(+ ..., alias="clientID", description="Identifier of the client"+ )+ additional_properties: Dict[str, Any] = {}+ __properties = ["templateID", "sandboxID", "alias", "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) -> Sandbox:+ """Create an instance of Sandbox 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={"additional_properties"}, exclude_none=True+ )+ # puts key-value pairs in additional_properties in the top level+ if self.additional_properties is not None:+ for _key, _value in self.additional_properties.items():+ _dict[_key] = _value++ return _dict++ @classmethod+ def from_dict(cls, obj: dict) -> Sandbox:+ """Create an instance of Sandbox from a dict"""+ if obj is None:+ return None++ if not isinstance(obj, dict):+ return Sandbox.parse_obj(obj)++ _obj = Sandbox.parse_obj(+ {+ "template_id": obj.get("templateID"),+ "sandbox_id": obj.get("sandboxID"),+ "alias": obj.get("alias"),+ "client_id": obj.get("clientID"),+ }+ )+ # store additional fields in additional_properties+ for _key in obj.keys():+ if _key not in cls.__properties:+ _obj.additional_properties[_key] = obj.get(_key)++ return _objdiff --git a/packages/python-sdk/e2b/api/v1/client/models/sandboxes_sandbox_id_refreshes_post_request.py b/packages/python-sdk/e2b/api/v1/client/models/sandboxes_sandbox_id_refreshes_post_request.pynew file mode 100644index 000000000..ecbb657b1--- /dev/null+++ b/packages/python-sdk/e2b/api/v1/client/models/sandboxes_sandbox_id_refreshes_post_request.py@@ -0,0 +1,85 @@+# coding: utf-8++"""+ E2B API++ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)++ The version of the OpenAPI document: 0.1.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 Any, Dict, Optional+from pydantic import BaseModel, Field, conint+++class SandboxesSandboxIDRefreshesPostRequest(BaseModel):+ """+ SandboxesSandboxIDRefreshesPostRequest+ """++ duration: Optional[conint(strict=True, le=3600, ge=0)] = Field(+ None,+ description="Duration for which the sandbox should be kept alive in seconds",+ )+ additional_properties: Dict[str, Any] = {}+ __properties = ["duration"]++ 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) -> SandboxesSandboxIDRefreshesPostRequest:+ """Create an instance of SandboxesSandboxIDRefreshesPostRequest 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={"additional_properties"}, exclude_none=True+ )+ # puts key-value pairs in additional_properties in the top level+ if self.additional_properties is not None:+ for _key, _value in self.additional_properties.items():+ _dict[_key] = _value++ return _dict++ @classmethod+ def from_dict(cls, obj: dict) -> SandboxesSandboxIDRefreshesPostRequest:+ """Create an instance of SandboxesSandboxIDRefreshesPostRequest from a dict"""+ if obj is None:+ return None++ if not isinstance(obj, dict):+ return SandboxesSandboxIDRefreshesPostRequest.parse_obj(obj)++ _obj = SandboxesSandboxIDRefreshesPostRequest.parse_obj(+ {"duration": obj.get("duration")}+ )+ # store additional fields in additional_properties+ for _key in obj.keys():+ if _key not in cls.__properties:+ _obj.additional_properties[_key] = obj.get(_key)++ return _objdiff --git a/packages/python-sdk/e2b/api/v1/client/models/template.py b/packages/python-sdk/e2b/api/v1/client/models/template.pynew file mode 100644index 000000000..38fdd7b70--- /dev/null+++ b/packages/python-sdk/e2b/api/v1/client/models/template.py@@ -0,0 +1,100 @@+# coding: utf-8++"""+ E2B API++ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)++ The version of the OpenAPI document: 0.1.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 Any, Dict, List, Optional+from pydantic import BaseModel, Field, StrictBool, StrictStr, conlist+++class Template(BaseModel):+ """+ Template+ """++ template_id: StrictStr = Field(+ ..., alias="templateID", description="Identifier of the template"+ )+ build_id: StrictStr = Field(+ ...,+ alias="buildID",+ description="Identifier of the last successful build for given template",+ )+ public: StrictBool = Field(+ ..., description="Whether the template is public or only accessible by the team"+ )+ aliases: Optional[conlist(StrictStr)] = Field(+ None, description="Aliases of the template"+ )+ additional_properties: Dict[str, Any] = {}+ __properties = ["templateID", "buildID", "public", "aliases"]++ 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) -> Template:+ """Create an instance of Template 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={"additional_properties"}, exclude_none=True+ )+ # puts key-value pairs in additional_properties in the top level+ if self.additional_properties is not None:+ for _key, _value in self.additional_properties.items():+ _dict[_key] = _value++ return _dict++ @classmethod+ def from_dict(cls, obj: dict) -> Template:+ """Create an instance of Template from a dict"""+ if obj is None:+ return None++ if not isinstance(obj, dict):+ return Template.parse_obj(obj)++ _obj = Template.parse_obj(+ {+ "template_id": obj.get("templateID"),+ "build_id": obj.get("buildID"),+ "public": obj.get("public"),+ "aliases": obj.get("aliases"),+ }+ )+ # store additional fields in additional_properties+ for _key in obj.keys():+ if _key not in cls.__properties:+ _obj.additional_properties[_key] = obj.get(_key)++ return _objdiff --git a/packages/python-sdk/e2b/api/v1/client/models/template_build.py b/packages/python-sdk/e2b/api/v1/client/models/template_build.pynew file mode 100644index 000000000..2ba4a7334--- /dev/null+++ b/packages/python-sdk/e2b/api/v1/client/models/template_build.py@@ -0,0 +1,106 @@+# coding: utf-8++"""+ E2B API++ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)++ The version of the OpenAPI document: 0.1.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 Any, Dict, List, Optional+from pydantic import BaseModel, Field, StrictStr, conlist, validator+++class TemplateBuild(BaseModel):+ """+ TemplateBuild+ """++ logs: conlist(StrictStr) = Field(..., description="Build logs")+ template_id: StrictStr = Field(+ ..., alias="templateID", description="Identifier of the template"+ )+ build_id: StrictStr = Field(+ ..., alias="buildID", description="Identifier of the build"+ )+ status: Optional[StrictStr] = Field(None, description="Status of the template")+ additional_properties: Dict[str, Any] = {}+ __properties = ["logs", "templateID", "buildID", "status"]++ @validator("status")+ def status_validate_enum(cls, value):+ """Validates the enum"""+ if value is None:+ return value++ if value not in ("building", "ready", "error"):+ raise ValueError(+ "must be one of enum values ('building', 'ready', 'error')"+ )+ return value++ 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) -> TemplateBuild:+ """Create an instance of TemplateBuild 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={"additional_properties"}, exclude_none=True+ )+ # puts key-value pairs in additional_properties in the top level+ if self.additional_properties is not None:+ for _key, _value in self.additional_properties.items():+ _dict[_key] = _value++ return _dict++ @classmethod+ def from_dict(cls, obj: dict) -> TemplateBuild:+ """Create an instance of TemplateBuild from a dict"""+ if obj is None:+ return None++ if not isinstance(obj, dict):+ return TemplateBuild.parse_obj(obj)++ _obj = TemplateBuild.parse_obj(+ {+ "logs": obj.get("logs"),+ "template_id": obj.get("templateID"),+ "build_id": obj.get("buildID"),+ "status": obj.get("status"),+ }+ )+ # store additional fields in additional_properties+ for _key in obj.keys():+ if _key not in cls.__properties:+ _obj.additional_properties[_key] = obj.get(_key)++ return _objdiff --git a/packages/python-sdk/e2b/api/v1/client/models/envs_env_id_builds_build_id_logs_post_request.py b/packages/python-sdk/e2b/api/v1/client/models/templates_template_id_builds_build_id_logs_post_request.pysimilarity index 76%rename from packages/python-sdk/e2b/api/v1/client/models/envs_env_id_builds_build_id_logs_post_request.pyrename to packages/python-sdk/e2b/api/v1/client/models/templates_template_id_builds_build_id_logs_post_request.pyindex 1764a1efd..bf4e42044 100644--- a/packages/python-sdk/e2b/api/v1/client/models/envs_env_id_builds_build_id_logs_post_request.py+++ b/packages/python-sdk/e2b/api/v1/client/models/templates_template_id_builds_build_id_logs_post_request.py@@ -22,9 +22,9 @@ from typing import Any, Dict, Listfrom pydantic import BaseModel, Field, StrictStr, conlist-class EnvsEnvIDBuildsBuildIDLogsPostRequest(BaseModel):+class TemplatesTemplateIDBuildsBuildIDLogsPostRequest(BaseModel):"""- EnvsEnvIDBuildsBuildIDLogsPostRequest+ TemplatesTemplateIDBuildsBuildIDLogsPostRequest"""api_secret: StrictStr = Field(..., alias="apiSecret", description="API secret")@@ -47,8 +47,10 @@ class EnvsEnvIDBuildsBuildIDLogsPostRequest(BaseModel):return json.dumps(self.to_dict())@classmethod- def from_json(cls, json_str: str) -> EnvsEnvIDBuildsBuildIDLogsPostRequest:- """Create an instance of EnvsEnvIDBuildsBuildIDLogsPostRequest from a JSON string"""+ def from_json(+ cls, json_str: str+ ) -> TemplatesTemplateIDBuildsBuildIDLogsPostRequest:+ """Create an instance of TemplatesTemplateIDBuildsBuildIDLogsPostRequest from a JSON string"""return cls.from_dict(json.loads(json_str))def to_dict(self):@@ -64,15 +66,15 @@ class EnvsEnvIDBuildsBuildIDLogsPostRequest(BaseModel):return _dict@classmethod- def from_dict(cls, obj: dict) -> EnvsEnvIDBuildsBuildIDLogsPostRequest:- """Create an instance of EnvsEnvIDBuildsBuildIDLogsPostRequest from a dict"""+ def from_dict(cls, obj: dict) -> TemplatesTemplateIDBuildsBuildIDLogsPostRequest:+ """Create an instance of TemplatesTemplateIDBuildsBuildIDLogsPostRequest from a dict"""if obj is None:return Noneif not isinstance(obj, dict):- return EnvsEnvIDBuildsBuildIDLogsPostRequest.parse_obj(obj)+ return TemplatesTemplateIDBuildsBuildIDLogsPostRequest.parse_obj(obj)- _obj = EnvsEnvIDBuildsBuildIDLogsPostRequest.parse_obj(+ _obj = TemplatesTemplateIDBuildsBuildIDLogsPostRequest.parse_obj({"api_secret": obj.get("apiSecret"), "logs": obj.get("logs")})# store additional fields in additional_propertiesdiff --git a/packages/python-sdk/e2b/api/v1/client_README.md b/packages/python-sdk/e2b/api/v1/client_README.mdindex b0cab558c..0aca874e5 100644--- a/packages/python-sdk/e2b/api/v1/client_README.md+++ b/packages/python-sdk/e2b/api/v1/client_README.md@@ -55,14 +55,14 @@ configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]# Enter a context with an instance of the API clientwith e2b.api.v1.client.ApiClient(configuration) as api_client:# Create an instance of the API class- api_instance = e2b.api.v1.client.InstancesApi(api_client)+ api_instance = e2b.api.v1.client.SandboxesApi(api_client)try:- api_response = api_instance.instances_get()- print("The response of InstancesApi->instances_get:\n")+ api_response = api_instance.sandboxes_get()+ print("The response of SandboxesApi->sandboxes_get:\n")pprint(api_response)except ApiException as e:- print("Exception when calling InstancesApi->instances_get: %s\n" % e)+ print("Exception when calling SandboxesApi->sandboxes_get: %s\n" % e)```@@ -72,21 +72,27 @@ All URIs are relative to *https://api.e2b.dev*Class | Method | HTTP request | Description------------ | ------------- | ------------- | --------------*InstancesApi* | [**instances_get**](e2b/api/v1/client/docs/InstancesApi.md#instances_get) | **GET** /instances |-*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 |+*SandboxesApi* | [**sandboxes_get**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_get) | **GET** /sandboxes |+*SandboxesApi* | [**sandboxes_post**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_post) | **POST** /sandboxes |+*SandboxesApi* | [**sandboxes_sandbox_id_refreshes_post**](e2b/api/v1/client/docs/SandboxesApi.md#sandboxes_sandbox_id_refreshes_post) | **POST** /sandboxes/{sandboxID}/refreshes |## Documentation For Models- [Environment](e2b/api/v1/client/docs/Environment.md)- [EnvironmentBuild](e2b/api/v1/client/docs/EnvironmentBuild.md)- - [EnvsEnvIDBuildsBuildIDLogsPostRequest](e2b/api/v1/client/docs/EnvsEnvIDBuildsBuildIDLogsPostRequest.md)- [Error](e2b/api/v1/client/docs/Error.md)- [Instance](e2b/api/v1/client/docs/Instance.md)- [InstancesInstanceIDRefreshesPostRequest](e2b/api/v1/client/docs/InstancesInstanceIDRefreshesPostRequest.md)- [NewInstance](e2b/api/v1/client/docs/NewInstance.md)+ - [NewSandbox](e2b/api/v1/client/docs/NewSandbox.md)- [RunningInstance](e2b/api/v1/client/docs/RunningInstance.md)+ - [RunningSandboxes](e2b/api/v1/client/docs/RunningSandboxes.md)+ - [Sandbox](e2b/api/v1/client/docs/Sandbox.md)+ - [SandboxesSandboxIDRefreshesPostRequest](e2b/api/v1/client/docs/SandboxesSandboxIDRefreshesPostRequest.md)+ - [Template](e2b/api/v1/client/docs/Template.md)+ - [TemplateBuild](e2b/api/v1/client/docs/TemplateBuild.md)+ - [TemplatesTemplateIDBuildsBuildIDLogsPostRequest](e2b/api/v1/client/docs/TemplatesTemplateIDBuildsBuildIDLogsPostRequest.md)<a id="documentation-for-authorization"></a>diff --git a/packages/python-sdk/e2b/api/v2/client/__init__.py b/packages/python-sdk/e2b/api/v2/client/__init__.pyindex 054d0a29c..31403aff1 100644--- a/packages/python-sdk/e2b/api/v2/client/__init__.py+++ b/packages/python-sdk/e2b/api/v2/client/__init__.py@@ -17,7 +17,7 @@__version__ = "1.0.0"# import apis into sdk package-from e2b.api.v2.client.api.instances_api import InstancesApi+from e2b.api.v2.client.api.sandboxes_api import SandboxesApi# import ApiClientfrom e2b.api.v2.client.api_response import ApiResponse@@ -33,13 +33,21 @@ from e2b.api.v2.client.exceptions import ApiException# import models into sdk packagefrom e2b.api.v2.client.models.environment import Environmentfrom e2b.api.v2.client.models.environment_build import EnvironmentBuild-from e2b.api.v2.client.models.envs_env_id_builds_build_id_logs_post_request import (- EnvsEnvIDBuildsBuildIDLogsPostRequest,-)from e2b.api.v2.client.models.error import Errorfrom e2b.api.v2.client.models.instance import Instancefrom e2b.api.v2.client.models.instances_instance_id_refreshes_post_request import (InstancesInstanceIDRefreshesPostRequest,)from e2b.api.v2.client.models.new_instance import NewInstance+from e2b.api.v2.client.models.new_sandbox import NewSandboxfrom e2b.api.v2.client.models.running_instance import RunningInstance+from e2b.api.v2.client.models.running_sandboxes import RunningSandboxes+from e2b.api.v2.client.models.sandbox import Sandbox+from e2b.api.v2.client.models.sandboxes_sandbox_id_refreshes_post_request import (+ SandboxesSandboxIDRefreshesPostRequest,+)+from e2b.api.v2.client.models.template import Template+from e2b.api.v2.client.models.template_build import TemplateBuild+from e2b.api.v2.client.models.templates_template_id_builds_build_id_logs_post_request import (+ TemplatesTemplateIDBuildsBuildIDLogsPostRequest,+)diff --git a/packages/python-sdk/e2b/api/v2/client/api/__init__.py b/packages/python-sdk/e2b/api/v2/client/api/__init__.pyindex e61fa8544..821cd50f1 100644--- a/packages/python-sdk/e2b/api/v2/client/api/__init__.py+++ b/packages/python-sdk/e2b/api/v2/client/api/__init__.py@@ -1,4 +1,4 @@# flake8: noqa# import apis into api package-from e2b.api.v2.client.api.instances_api import InstancesApi+from e2b.api.v2.client.api.sandboxes_api import SandboxesApidiff --git a/packages/python-sdk/e2b/api/v2/client/api/instances_api.py b/packages/python-sdk/e2b/api/v2/client/api/sandboxes_api.pysimilarity index 84%rename from packages/python-sdk/e2b/api/v2/client/api/instances_api.pyrename to packages/python-sdk/e2b/api/v2/client/api/sandboxes_api.pyindex 1470f5ee8..5bb1f690e 100644--- a/packages/python-sdk/e2b/api/v2/client/api/instances_api.py+++ b/packages/python-sdk/e2b/api/v2/client/api/sandboxes_api.py@@ -27,19 +27,19 @@ from pydantic import StrictStrfrom typing import List, Optional-from e2b.api.v2.client.models.instance import Instance-from e2b.api.v2.client.models.instances_instance_id_refreshes_post_request import (- InstancesInstanceIDRefreshesPostRequest,+from e2b.api.v2.client.models.new_sandbox import NewSandbox+from e2b.api.v2.client.models.running_sandboxes import RunningSandboxes+from e2b.api.v2.client.models.sandbox import Sandbox+from e2b.api.v2.client.models.sandboxes_sandbox_id_refreshes_post_request import (+ SandboxesSandboxIDRefreshesPostRequest,)-from e2b.api.v2.client.models.new_instance import NewInstance-from e2b.api.v2.client.models.running_instance import RunningInstancefrom e2b.api.v2.client.api_client import ApiClientfrom e2b.api.v2.client.api_response import ApiResponsefrom e2b.api.v2.client.rest import RESTResponseType-class InstancesApi:+class SandboxesApi:"""NOTE: This class is auto generated by OpenAPI GeneratorRef: https://openapi-generator.tech@@ -52,7 +52,7 @@ class InstancesApi:self.api_client = api_client@validate_call- def instances_get(+ def sandboxes_get(self,_request_timeout: Union[None,@@ -65,10 +65,10 @@ class InstancesApi:_content_type: Optional[StrictStr] = None,_headers: Optional[Dict[StrictStr, Any]] = None,_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,- ) -> List[RunningInstance]:- """instances_get+ ) -> List[RunningSandboxes]:+ """sandboxes_get- List all running instances+ List all running sandboxes:param _request_timeout: timeout setting for this request. If onenumber provided, it will be total request@@ -92,7 +92,7 @@ class InstancesApi::return: Returns the result object.""" # noqa: E501- _param = self._instances_get_serialize(+ _param = self._sandboxes_get_serialize(_request_auth=_request_auth,_content_type=_content_type,_headers=_headers,@@ -100,7 +100,7 @@ class InstancesApi:)_response_types_map: Dict[str, Optional[str]] = {- "200": "List[RunningInstance]",+ "200": "List[RunningSandboxes]","401": "Error","400": "Error","500": "Error",@@ -115,7 +115,7 @@ class InstancesApi:).data@validate_call- def instances_get_with_http_info(+ def sandboxes_get_with_http_info(self,_request_timeout: Union[None,@@ -128,10 +128,10 @@ class InstancesApi:_content_type: Optional[StrictStr] = None,_headers: Optional[Dict[StrictStr, Any]] = None,_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,- ) -> ApiResponse[List[RunningInstance]]:- """instances_get+ ) -> ApiResponse[List[RunningSandboxes]]:+ """sandboxes_get- List all running instances+ List all running sandboxes:param _request_timeout: timeout setting for this request. If onenumber provided, it will be total request@@ -155,7 +155,7 @@ class InstancesApi::return: Returns the result object.""" # noqa: E501- _param = self._instances_get_serialize(+ _param = self._sandboxes_get_serialize(_request_auth=_request_auth,_content_type=_content_type,_headers=_headers,@@ -163,7 +163,7 @@ class InstancesApi:)_response_types_map: Dict[str, Optional[str]] = {- "200": "List[RunningInstance]",+ "200": "List[RunningSandboxes]","401": "Error","400": "Error","500": "Error",@@ -178,7 +178,7 @@ class InstancesApi:)@validate_call- def instances_get_without_preload_content(+ def sandboxes_get_without_preload_content(self,_request_timeout: Union[None,@@ -192,9 +192,9 @@ class InstancesApi:_headers: Optional[Dict[StrictStr, Any]] = None,_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,) -> RESTResponseType:- """instances_get+ """sandboxes_get- List all running instances+ List all running sandboxes:param _request_timeout: timeout setting for this request. If onenumber provided, it will be total request@@ -218,7 +218,7 @@ class InstancesApi::return: Returns the result object.""" # noqa: E501- _param = self._instances_get_serialize(+ _param = self._sandboxes_get_serialize(_request_auth=_request_auth,_content_type=_content_type,_headers=_headers,@@ -226,7 +226,7 @@ class InstancesApi:)_response_types_map: Dict[str, Optional[str]] = {- "200": "List[RunningInstance]",+ "200": "List[RunningSandboxes]","401": "Error","400": "Error","500": "Error",@@ -236,7 +236,7 @@ class InstancesApi:)return response_data.response- def _instances_get_serialize(+ def _sandboxes_get_serialize(self,_request_auth,_content_type,@@ -270,7 +270,7 @@ class InstancesApi:return self.api_client.param_serialize(method="GET",- resource_path="/instances",+ resource_path="/sandboxes",path_params=_path_params,query_params=_query_params,header_params=_header_params,@@ -284,12 +284,9 @@ class InstancesApi:)@validate_call- def instances_instance_id_refreshes_post(+ def sandboxes_post(self,- instance_id: StrictStr,- instances_instance_id_refreshes_post_request: Optional[- InstancesInstanceIDRefreshesPostRequest- ] = None,+ new_sandbox: NewSandbox,_request_timeout: Union[None,Annotated[StrictFloat, Field(gt=0)],@@ -301,15 +298,13 @@ class InstancesApi:_content_type: Optional[StrictStr] = None,_headers: Optional[Dict[StrictStr, Any]] = None,_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,- ) -> None:- """instances_instance_id_refreshes_post+ ) -> Sandbox:+ """sandboxes_post- Refresh the instance extending its time to live+ Create a sandbox from the template- :param instance_id: (required)- :type instance_id: str- :param instances_instance_id_refreshes_post_request:- :type instances_instance_id_refreshes_post_request: InstancesInstanceIDRefreshesPostRequest+ :param new_sandbox: (required)+ :type new_sandbox: NewSandbox:param _request_timeout: timeout setting for this request. If onenumber provided, it will be total requesttimeout. It can also be a pair (tuple) of@@ -332,16 +327,20 @@ class InstancesApi::return: Returns the result object.""" # noqa: E501- _param = self._instances_instance_id_refreshes_post_serialize(- instance_id=instance_id,- instances_instance_id_refreshes_post_request=instances_instance_id_refreshes_post_request,+ _param = self._sandboxes_post_serialize(+ new_sandbox=new_sandbox,_request_auth=_request_auth,_content_type=_content_type,_headers=_headers,_host_index=_host_index,)- _response_types_map: Dict[str, Optional[str]] = {}+ _response_types_map: Dict[str, Optional[str]] = {+ "201": "Sandbox",+ "401": "Error",+ "400": "Error",+ "500": "Error",+ }response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)@@ -352,12 +351,9 @@ class InstancesApi:).data@validate_call- def instances_instance_id_refreshes_post_with_http_info(+ def sandboxes_post_with_http_info(self,- instance_id: StrictStr,- instances_instance_id_refreshes_post_request: Optional[- InstancesInstanceIDRefreshesPostRequest- ] = None,+ new_sandbox: NewSandbox,_request_timeout: Union[None,Annotated[StrictFloat, Field(gt=0)],@@ -369,15 +365,13 @@ class InstancesApi:_content_type: Optional[StrictStr] = None,_headers: Optional[Dict[StrictStr, Any]] = None,_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,- ) -> ApiResponse[None]:- """instances_instance_id_refreshes_post+ ) -> ApiResponse[Sandbox]:+ """sandboxes_post- Refresh the instance extending its time to live+ Create a sandbox from the template- :param instance_id: (required)- :type instance_id: str- :param instances_instance_id_refreshes_post_request:- :type instances_instance_id_refreshes_post_request: InstancesInstanceIDRefreshesPostRequest+ :param new_sandbox: (required)+ :type new_sandbox: NewSandbox:param _request_timeout: timeout setting for this request. If onenumber provided, it will be total requesttimeout. It can also be a pair (tuple) of@@ -400,16 +394,20 @@ class InstancesApi::return: Returns the result object.""" # noqa: E501- _param = self._instances_instance_id_refreshes_post_serialize(- instance_id=instance_id,- instances_instance_id_refreshes_post_request=instances_instance_id_refreshes_post_request,+ _param = self._sandboxes_post_serialize(+ new_sandbox=new_sandbox,_request_auth=_request_auth,_content_type=_content_type,_headers=_headers,_host_index=_host_index,)- _response_types_map: Dict[str, Optional[str]] = {}+ _response_types_map: Dict[str, Optional[str]] = {+ "201": "Sandbox",+ "401": "Error",+ "400": "Error",+ "500": "Error",+ }response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)@@ -420,12 +418,9 @@ class InstancesApi:)@validate_call- def instances_instance_id_refreshes_post_without_preload_content(+ def sandboxes_post_without_preload_content(self,- instance_id: StrictStr,- instances_instance_id_refreshes_post_request: Optional[- InstancesInstanceIDRefreshesPostRequest- ] = None,+ new_sandbox: NewSandbox,_request_timeout: Union[None,Annotated[StrictFloat, Field(gt=0)],@@ -438,14 +433,12 @@ class InstancesApi:_headers: Optional[Dict[StrictStr, Any]] = None,_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,) -> RESTResponseType:- """instances_instance_id_refreshes_post+ """sandboxes_post- Refresh the instance extending its time to live+ Create a sandbox from the template- :param instance_id: (required)- :type instance_id: str- :param instances_instance_id_refreshes_post_request:- :type instances_instance_id_refreshes_post_request: InstancesInstanceIDRefreshesPostRequest+ :param new_sandbox: (required)+ :type new_sandbox: NewSandbox:param _request_timeout: timeout setting for this request. If onenumber provided, it will be total requesttimeout. It can also be a pair (tuple) of@@ -468,25 +461,28 @@ class InstancesApi::return: Returns the result object.""" # noqa: E501- _param = self._instances_instance_id_refreshes_post_serialize(- instance_id=instance_id,- instances_instance_id_refreshes_post_request=instances_instance_id_refreshes_post_request,+ _param = self._sandboxes_post_serialize(+ new_sandbox=new_sandbox,_request_auth=_request_auth,_content_type=_content_type,_headers=_headers,_host_index=_host_index,)- _response_types_map: Dict[str, Optional[str]] = {}+ _response_types_map: Dict[str, Optional[str]] = {+ "201": "Sandbox",+ "401": "Error",+ "400": "Error",+ "500": "Error",+ }response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)return response_data.response- def _instances_instance_id_refreshes_post_serialize(+ def _sandboxes_post_serialize(self,- instance_id,- instances_instance_id_refreshes_post_request,+ new_sandbox,_request_auth,_content_type,_headers,@@ -504,14 +500,12 @@ class InstancesApi:_body_params: Optional[bytes] = None# process the path parameters- if instance_id is not None:- _path_params["instanceID"] = instance_id# process the query parameters# process the header parameters# process the form parameters# process the body parameter- if instances_instance_id_refreshes_post_request is not None:- _body_params = instances_instance_id_refreshes_post_request+ if new_sandbox is not None:+ _body_params = new_sandbox# set the HTTP header `Accept`_header_params["Accept"] = self.api_client.select_header_accept(@@ -533,7 +527,7 @@ class InstancesApi:return self.api_client.param_serialize(method="POST",- resource_path="/instances/{instanceID}/refreshes",+ resource_path="/sandboxes",path_params=_path_params,query_params=_query_params,header_params=_header_params,@@ -547,9 +541,12 @@ class InstancesApi:)@validate_call- def instances_post(+ def sandboxes_sandbox_id_refreshes_post(self,- new_instance: NewInstance,+ sandbox_id: StrictStr,+ sandboxes_sandbox_id_refreshes_post_request: Optional[+ SandboxesSandboxIDRefreshesPostRequest+ ] = None,_request_timeout: Union[None,Annotated[StrictFloat, Field(gt=0)],@@ -561,13 +558,15 @@ class InstancesApi:_content_type: Optional[StrictStr] = None,_headers: Optional[Dict[StrictStr, Any]] = None,_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,- ) -> Instance:- """instances_post+ ) -> None:+ """sandboxes_sandbox_id_refreshes_post- Create an instance from the environment+ Refresh the sandbox extending its time to live- :param new_instance: (required)- :type new_instance: NewInstance+ :param sandbox_id: (required)+ :type sandbox_id: str+ :param sandboxes_sandbox_id_refreshes_post_request:+ :type sandboxes_sandbox_id_refreshes_post_request: SandboxesSandboxIDRefreshesPostRequest:param _request_timeout: timeout setting for this request. If onenumber provided, it will be total requesttimeout. It can also be a pair (tuple) of@@ -590,20 +589,16 @@ class InstancesApi::return: Returns the result object.""" # noqa: E501- _param = self._instances_post_serialize(- new_instance=new_instance,+ _param = self._sandboxes_sandbox_id_refreshes_post_serialize(+ sandbox_id=sandbox_id,+ sandboxes_sandbox_id_refreshes_post_request=sandboxes_sandbox_id_refreshes_post_request,_request_auth=_request_auth,_content_type=_content_type,_headers=_headers,_host_index=_host_index,)- _response_types_map: Dict[str, Optional[str]] = {- "201": "Instance",- "401": "Error",- "400": "Error",- "500": "Error",- }+ _response_types_map: Dict[str, Optional[str]] = {}response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)@@ -614,9 +609,12 @@ class InstancesApi:).data@validate_call- def instances_post_with_http_info(+ def sandboxes_sandbox_id_refreshes_post_with_http_info(self,- new_instance: NewInstance,+ sandbox_id: StrictStr,+ sandboxes_sandbox_id_refreshes_post_request: Optional[+ SandboxesSandboxIDRefreshesPostRequest+ ] = None,_request_timeout: Union[None,Annotated[StrictFloat, Field(gt=0)],@@ -628,13 +626,15 @@ class InstancesApi:_content_type: Optional[StrictStr] = None,_headers: Optional[Dict[StrictStr, Any]] = None,_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,- ) -> ApiResponse[Instance]:- """instances_post+ ) -> ApiResponse[None]:+ """sandboxes_sandbox_id_refreshes_post- Create an instance from the environment+ Refresh the sandbox extending its time to live- :param new_instance: (required)- :type new_instance: NewInstance+ :param sandbox_id: (required)+ :type sandbox_id: str+ :param sandboxes_sandbox_id_refreshes_post_request:+ :type sandboxes_sandbox_id_refreshes_post_request: SandboxesSandboxIDRefreshesPostRequest:param _request_timeout: timeout setting for this request. If onenumber provided, it will be total requesttimeout. It can also be a pair (tuple) of@@ -657,20 +657,16 @@ class InstancesApi::return: Returns the result object.""" # noqa: E501- _param = self._instances_post_serialize(- new_instance=new_instance,+ _param = self._sandboxes_sandbox_id_refreshes_post_serialize(+ sandbox_id=sandbox_id,+ sandboxes_sandbox_id_refreshes_post_request=sandboxes_sandbox_id_refreshes_post_request,_request_auth=_request_auth,_content_type=_content_type,_headers=_headers,_host_index=_host_index,)- _response_types_map: Dict[str, Optional[str]] = {- "201": "Instance",- "401": "Error",- "400": "Error",- "500": "Error",- }+ _response_types_map: Dict[str, Optional[str]] = {}response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)@@ -681,9 +677,12 @@ class InstancesApi:)@validate_call- def instances_post_without_preload_content(+ def sandboxes_sandbox_id_refreshes_post_without_preload_content(self,- new_instance: NewInstance,+ sandbox_id: StrictStr,+ sandboxes_sandbox_id_refreshes_post_request: Optional[+ SandboxesSandboxIDRefreshesPostRequest+ ] = None,_request_timeout: Union[None,Annotated[StrictFloat, Field(gt=0)],@@ -696,12 +695,14 @@ class InstancesApi:_headers: Optional[Dict[StrictStr, Any]] = None,_host_index: Annotated[StrictInt, Field(ge=0, le=0)] = 0,) -> RESTResponseType:- """instances_post+ """sandboxes_sandbox_id_refreshes_post- Create an instance from the environment+ Refresh the sandbox extending its time to live- :param new_instance: (required)- :type new_instance: NewInstance+ :param sandbox_id: (required)+ :type sandbox_id: str+ :param sandboxes_sandbox_id_refreshes_post_request:+ :type sandboxes_sandbox_id_refreshes_post_request: SandboxesSandboxIDRefreshesPostRequest:param _request_timeout: timeout setting for this request. If onenumber provided, it will be total requesttimeout. It can also be a pair (tuple) of@@ -724,28 +725,25 @@ class InstancesApi::return: Returns the result object.""" # noqa: E501- _param = self._instances_post_serialize(- new_instance=new_instance,+ _param = self._sandboxes_sandbox_id_refreshes_post_serialize(+ sandbox_id=sandbox_id,+ sandboxes_sandbox_id_refreshes_post_request=sandboxes_sandbox_id_refreshes_post_request,_request_auth=_request_auth,_content_type=_content_type,_headers=_headers,_host_index=_host_index,)- _response_types_map: Dict[str, Optional[str]] = {- "201": "Instance",- "401": "Error",- "400": "Error",- "500": "Error",- }+ _response_types_map: Dict[str, Optional[str]] = {}response_data = self.api_client.call_api(*_param, _request_timeout=_request_timeout)return response_data.response- def _instances_post_serialize(+ def _sandboxes_sandbox_id_refreshes_post_serialize(self,- new_instance,+ sandbox_id,+ sandboxes_sandbox_id_refreshes_post_request,_request_auth,_content_type,_headers,@@ -763,12 +761,14 @@ class InstancesApi:_body_params: Optional[bytes] = None# process the path parameters+ if sandbox_id is not None:+ _path_params["sandboxID"] = sandbox_id# process the query parameters# process the header parameters# process the form parameters# process the body parameter- if new_instance is not None:- _body_params = new_instance+ if sandboxes_sandbox_id_refreshes_post_request is not None:+ _body_params = sandboxes_sandbox_id_refreshes_post_request# set the HTTP header `Accept`_header_params["Accept"] = self.api_client.select_header_accept(@@ -790,7 +790,7 @@ class InstancesApi:return self.api_client.param_serialize(method="POST",- resource_path="/instances",+ resource_path="/sandboxes/{sandboxID}/refreshes",path_params=_path_params,query_params=_query_params,header_params=_header_params,diff --git a/packages/python-sdk/e2b/api/v2/client/models/__init__.py b/packages/python-sdk/e2b/api/v2/client/models/__init__.pyindex 7caebbf31..0b0cbf222 100644--- a/packages/python-sdk/e2b/api/v2/client/models/__init__.py+++ b/packages/python-sdk/e2b/api/v2/client/models/__init__.py@@ -16,13 +16,21 @@# import models into model packagefrom e2b.api.v2.client.models.environment import Environmentfrom e2b.api.v2.client.models.environment_build import EnvironmentBuild-from e2b.api.v2.client.models.envs_env_id_builds_build_id_logs_post_request import (- EnvsEnvIDBuildsBuildIDLogsPostRequest,-)from e2b.api.v2.client.models.error import Errorfrom e2b.api.v2.client.models.instance import Instancefrom e2b.api.v2.client.models.instances_instance_id_refreshes_post_request import (InstancesInstanceIDRefreshesPostRequest,)from e2b.api.v2.client.models.new_instance import NewInstance+from e2b.api.v2.client.models.new_sandbox import NewSandboxfrom e2b.api.v2.client.models.running_instance import RunningInstance+from e2b.api.v2.client.models.running_sandboxes import RunningSandboxes+from e2b.api.v2.client.models.sandbox import Sandbox+from e2b.api.v2.client.models.sandboxes_sandbox_id_refreshes_post_request import (+ SandboxesSandboxIDRefreshesPostRequest,+)+from e2b.api.v2.client.models.template import Template+from e2b.api.v2.client.models.template_build import TemplateBuild+from e2b.api.v2.client.models.templates_template_id_builds_build_id_logs_post_request import (+ TemplatesTemplateIDBuildsBuildIDLogsPostRequest,+)diff --git a/packages/python-sdk/e2b/api/v2/client/models/new_sandbox.py b/packages/python-sdk/e2b/api/v2/client/models/new_sandbox.pynew file mode 100644index 000000000..3c5d642b8--- /dev/null+++ b/packages/python-sdk/e2b/api/v2/client/models/new_sandbox.py@@ -0,0 +1,101 @@+# coding: utf-8++"""+ E2B API++ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)++ The version of the OpenAPI document: 0.1.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 Any, ClassVar, Dict, List, Optional+from pydantic import BaseModel, StrictStr+from pydantic import Field++try:+ from typing import Self+except ImportError:+ from typing_extensions import Self+++class NewSandbox(BaseModel):+ """+ NewSandbox+ """ # noqa: E501++ template_id: StrictStr = Field(+ description="Identifier of the required template", alias="templateID"+ )+ metadata: Optional[Dict[str, StrictStr]] = None+ additional_properties: Dict[str, Any] = {}+ __properties: ClassVar[List[str]] = ["templateID", "metadata"]++ 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"""+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead+ return json.dumps(self.to_dict())++ @classmethod+ def from_json(cls, json_str: str) -> Self:+ """Create an instance of NewSandbox from a JSON string"""+ return cls.from_dict(json.loads(json_str))++ def to_dict(self) -> Dict[str, Any]:+ """Return the dictionary representation of the model using alias.++ This has the following differences from calling pydantic's+ `self.model_dump(by_alias=True)`:++ * `None` is only added to the output dict for nullable fields that+ were set at model initialization. Other fields with value `None`+ are ignored.+ * Fields in `self.additional_properties` are added to the output dict.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={+ "additional_properties",+ },+ exclude_none=True,+ )+ # puts key-value pairs in additional_properties in the top level+ if self.additional_properties is not None:+ for _key, _value in self.additional_properties.items():+ _dict[_key] = _value++ return _dict++ @classmethod+ def from_dict(cls, obj: Dict) -> Self:+ """Create an instance of NewSandbox from a dict"""+ if obj is None:+ return None++ if not isinstance(obj, dict):+ return cls.model_validate(obj)++ _obj = cls.model_validate(+ {"templateID": obj.get("templateID"), "metadata": obj.get("metadata")}+ )+ # store additional fields in additional_properties+ for _key in obj.keys():+ if _key not in cls.__properties:+ _obj.additional_properties[_key] = obj.get(_key)++ return _objdiff --git a/packages/python-sdk/e2b/api/v2/client/models/running_sandboxes.py b/packages/python-sdk/e2b/api/v2/client/models/running_sandboxes.pynew file mode 100644index 000000000..73cff5e76--- /dev/null+++ b/packages/python-sdk/e2b/api/v2/client/models/running_sandboxes.py@@ -0,0 +1,128 @@+# coding: utf-8++"""+ E2B API++ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)++ The version of the OpenAPI document: 0.1.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 datetime import datetime+from typing import Any, ClassVar, Dict, List, Optional+from pydantic import BaseModel, StrictStr+from pydantic import Field++try:+ from typing import Self+except ImportError:+ from typing_extensions import Self+++class RunningSandboxes(BaseModel):+ """+ RunningSandboxes+ """ # noqa: E501++ template_id: StrictStr = Field(+ description="Identifier of the template from which is the sandbox created",+ alias="templateID",+ )+ alias: Optional[StrictStr] = Field(+ default=None, description="Alias of the template"+ )+ sandbox_id: StrictStr = Field(+ description="Identifier of the sandbox", alias="sandboxID"+ )+ client_id: StrictStr = Field(+ description="Identifier of the client", alias="clientID"+ )+ started_at: datetime = Field(+ description="Time when the sandbox was started", alias="startedAt"+ )+ metadata: Optional[Dict[str, StrictStr]] = None+ additional_properties: Dict[str, Any] = {}+ __properties: ClassVar[List[str]] = [+ "templateID",+ "alias",+ "sandboxID",+ "clientID",+ "startedAt",+ "metadata",+ ]++ 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"""+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead+ return json.dumps(self.to_dict())++ @classmethod+ def from_json(cls, json_str: str) -> Self:+ """Create an instance of RunningSandboxes from a JSON string"""+ return cls.from_dict(json.loads(json_str))++ def to_dict(self) -> Dict[str, Any]:+ """Return the dictionary representation of the model using alias.++ This has the following differences from calling pydantic's+ `self.model_dump(by_alias=True)`:++ * `None` is only added to the output dict for nullable fields that+ were set at model initialization. Other fields with value `None`+ are ignored.+ * Fields in `self.additional_properties` are added to the output dict.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={+ "additional_properties",+ },+ exclude_none=True,+ )+ # puts key-value pairs in additional_properties in the top level+ if self.additional_properties is not None:+ for _key, _value in self.additional_properties.items():+ _dict[_key] = _value++ return _dict++ @classmethod+ def from_dict(cls, obj: Dict) -> Self:+ """Create an instance of RunningSandboxes from a dict"""+ if obj is None:+ return None++ if not isinstance(obj, dict):+ return cls.model_validate(obj)++ _obj = cls.model_validate(+ {+ "templateID": obj.get("templateID"),+ "alias": obj.get("alias"),+ "sandboxID": obj.get("sandboxID"),+ "clientID": obj.get("clientID"),+ "startedAt": obj.get("startedAt"),+ "metadata": obj.get("metadata"),+ }+ )+ # store additional fields in additional_properties+ for _key in obj.keys():+ if _key not in cls.__properties:+ _obj.additional_properties[_key] = obj.get(_key)++ return _objdiff --git a/packages/python-sdk/e2b/api/v2/client/models/sandbox.py b/packages/python-sdk/e2b/api/v2/client/models/sandbox.pynew file mode 100644index 000000000..4f9f82e3d--- /dev/null+++ b/packages/python-sdk/e2b/api/v2/client/models/sandbox.py@@ -0,0 +1,115 @@+# coding: utf-8++"""+ E2B API++ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)++ The version of the OpenAPI document: 0.1.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 Any, ClassVar, Dict, List, Optional+from pydantic import BaseModel, StrictStr+from pydantic import Field++try:+ from typing import Self+except ImportError:+ from typing_extensions import Self+++class Sandbox(BaseModel):+ """+ Sandbox+ """ # noqa: E501++ template_id: StrictStr = Field(+ description="Identifier of the template from which is the sandbox created",+ alias="templateID",+ )+ sandbox_id: StrictStr = Field(+ description="Identifier of the sandbox", alias="sandboxID"+ )+ alias: Optional[StrictStr] = Field(+ default=None, description="Alias of the template"+ )+ client_id: StrictStr = Field(+ description="Identifier of the client", alias="clientID"+ )+ additional_properties: Dict[str, Any] = {}+ __properties: ClassVar[List[str]] = ["templateID", "sandboxID", "alias", "clientID"]++ 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"""+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead+ return json.dumps(self.to_dict())++ @classmethod+ def from_json(cls, json_str: str) -> Self:+ """Create an instance of Sandbox from a JSON string"""+ return cls.from_dict(json.loads(json_str))++ def to_dict(self) -> Dict[str, Any]:+ """Return the dictionary representation of the model using alias.++ This has the following differences from calling pydantic's+ `self.model_dump(by_alias=True)`:++ * `None` is only added to the output dict for nullable fields that+ were set at model initialization. Other fields with value `None`+ are ignored.+ * Fields in `self.additional_properties` are added to the output dict.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={+ "additional_properties",+ },+ exclude_none=True,+ )+ # puts key-value pairs in additional_properties in the top level+ if self.additional_properties is not None:+ for _key, _value in self.additional_properties.items():+ _dict[_key] = _value++ return _dict++ @classmethod+ def from_dict(cls, obj: Dict) -> Self:+ """Create an instance of Sandbox from a dict"""+ if obj is None:+ return None++ if not isinstance(obj, dict):+ return cls.model_validate(obj)++ _obj = cls.model_validate(+ {+ "templateID": obj.get("templateID"),+ "sandboxID": obj.get("sandboxID"),+ "alias": obj.get("alias"),+ "clientID": obj.get("clientID"),+ }+ )+ # store additional fields in additional_properties+ for _key in obj.keys():+ if _key not in cls.__properties:+ _obj.additional_properties[_key] = obj.get(_key)++ return _objdiff --git a/packages/python-sdk/e2b/api/v2/client/models/sandboxes_sandbox_id_refreshes_post_request.py b/packages/python-sdk/e2b/api/v2/client/models/sandboxes_sandbox_id_refreshes_post_request.pynew file mode 100644index 000000000..0f16bd8f9--- /dev/null+++ b/packages/python-sdk/e2b/api/v2/client/models/sandboxes_sandbox_id_refreshes_post_request.py@@ -0,0 +1,100 @@+# coding: utf-8++"""+ E2B API++ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)++ The version of the OpenAPI document: 0.1.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 Any, ClassVar, Dict, List, Optional+from pydantic import BaseModel+from pydantic import Field+from typing_extensions import Annotated++try:+ from typing import Self+except ImportError:+ from typing_extensions import Self+++class SandboxesSandboxIDRefreshesPostRequest(BaseModel):+ """+ SandboxesSandboxIDRefreshesPostRequest+ """ # noqa: E501++ duration: Optional[Annotated[int, Field(le=3600, strict=True, ge=0)]] = Field(+ default=None,+ description="Duration for which the sandbox should be kept alive in seconds",+ )+ additional_properties: Dict[str, Any] = {}+ __properties: ClassVar[List[str]] = ["duration"]++ 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"""+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead+ return json.dumps(self.to_dict())++ @classmethod+ def from_json(cls, json_str: str) -> Self:+ """Create an instance of SandboxesSandboxIDRefreshesPostRequest from a JSON string"""+ return cls.from_dict(json.loads(json_str))++ def to_dict(self) -> Dict[str, Any]:+ """Return the dictionary representation of the model using alias.++ This has the following differences from calling pydantic's+ `self.model_dump(by_alias=True)`:++ * `None` is only added to the output dict for nullable fields that+ were set at model initialization. Other fields with value `None`+ are ignored.+ * Fields in `self.additional_properties` are added to the output dict.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={+ "additional_properties",+ },+ exclude_none=True,+ )+ # puts key-value pairs in additional_properties in the top level+ if self.additional_properties is not None:+ for _key, _value in self.additional_properties.items():+ _dict[_key] = _value++ return _dict++ @classmethod+ def from_dict(cls, obj: Dict) -> Self:+ """Create an instance of SandboxesSandboxIDRefreshesPostRequest from a dict"""+ if obj is None:+ return None++ if not isinstance(obj, dict):+ return cls.model_validate(obj)++ _obj = cls.model_validate({"duration": obj.get("duration")})+ # store additional fields in additional_properties+ for _key in obj.keys():+ if _key not in cls.__properties:+ _obj.additional_properties[_key] = obj.get(_key)++ return _objdiff --git a/packages/python-sdk/e2b/api/v2/client/models/template.py b/packages/python-sdk/e2b/api/v2/client/models/template.pynew file mode 100644index 000000000..e941b8c9d--- /dev/null+++ b/packages/python-sdk/e2b/api/v2/client/models/template.py@@ -0,0 +1,115 @@+# coding: utf-8++"""+ E2B API++ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)++ The version of the OpenAPI document: 0.1.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 Any, ClassVar, Dict, List, Optional+from pydantic import BaseModel, StrictBool, StrictStr+from pydantic import Field++try:+ from typing import Self+except ImportError:+ from typing_extensions import Self+++class Template(BaseModel):+ """+ Template+ """ # noqa: E501++ template_id: StrictStr = Field(+ description="Identifier of the template", alias="templateID"+ )+ build_id: StrictStr = Field(+ description="Identifier of the last successful build for given template",+ alias="buildID",+ )+ public: StrictBool = Field(+ description="Whether the template is public or only accessible by the team"+ )+ aliases: Optional[List[StrictStr]] = Field(+ default=None, description="Aliases of the template"+ )+ additional_properties: Dict[str, Any] = {}+ __properties: ClassVar[List[str]] = ["templateID", "buildID", "public", "aliases"]++ 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"""+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead+ return json.dumps(self.to_dict())++ @classmethod+ def from_json(cls, json_str: str) -> Self:+ """Create an instance of Template from a JSON string"""+ return cls.from_dict(json.loads(json_str))++ def to_dict(self) -> Dict[str, Any]:+ """Return the dictionary representation of the model using alias.++ This has the following differences from calling pydantic's+ `self.model_dump(by_alias=True)`:++ * `None` is only added to the output dict for nullable fields that+ were set at model initialization. Other fields with value `None`+ are ignored.+ * Fields in `self.additional_properties` are added to the output dict.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={+ "additional_properties",+ },+ exclude_none=True,+ )+ # puts key-value pairs in additional_properties in the top level+ if self.additional_properties is not None:+ for _key, _value in self.additional_properties.items():+ _dict[_key] = _value++ return _dict++ @classmethod+ def from_dict(cls, obj: Dict) -> Self:+ """Create an instance of Template from a dict"""+ if obj is None:+ return None++ if not isinstance(obj, dict):+ return cls.model_validate(obj)++ _obj = cls.model_validate(+ {+ "templateID": obj.get("templateID"),+ "buildID": obj.get("buildID"),+ "public": obj.get("public"),+ "aliases": obj.get("aliases"),+ }+ )+ # store additional fields in additional_properties+ for _key in obj.keys():+ if _key not in cls.__properties:+ _obj.additional_properties[_key] = obj.get(_key)++ return _objdiff --git a/packages/python-sdk/e2b/api/v2/client/models/template_build.py b/packages/python-sdk/e2b/api/v2/client/models/template_build.pynew file mode 100644index 000000000..aa86ffdf8--- /dev/null+++ b/packages/python-sdk/e2b/api/v2/client/models/template_build.py@@ -0,0 +1,122 @@+# coding: utf-8++"""+ E2B API++ No description provided (generated by Openapi Generator https://github.com/openapitools/openapi-generator)++ The version of the OpenAPI document: 0.1.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 Any, ClassVar, Dict, List, Optional+from pydantic import BaseModel, StrictStr, field_validator+from pydantic import Field++try:+ from typing import Self+except ImportError:+ from typing_extensions import Self+++class TemplateBuild(BaseModel):+ """+ TemplateBuild+ """ # noqa: E501++ logs: List[StrictStr] = Field(description="Build logs")+ template_id: StrictStr = Field(+ description="Identifier of the template", alias="templateID"+ )+ build_id: StrictStr = Field(description="Identifier of the build", alias="buildID")+ status: Optional[StrictStr] = Field(+ default=None, description="Status of the template"+ )+ additional_properties: Dict[str, Any] = {}+ __properties: ClassVar[List[str]] = ["logs", "templateID", "buildID", "status"]++ @field_validator("status")+ def status_validate_enum(cls, value):+ """Validates the enum"""+ if value is None:+ return value++ if value not in ("building", "ready", "error"):+ raise ValueError(+ "must be one of enum values ('building', 'ready', 'error')"+ )+ return value++ 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"""+ # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead+ return json.dumps(self.to_dict())++ @classmethod+ def from_json(cls, json_str: str) -> Self:+ """Create an instance of TemplateBuild from a JSON string"""+ return cls.from_dict(json.loads(json_str))++ def to_dict(self) -> Dict[str, Any]:+ """Return the dictionary representation of the model using alias.++ This has the following differences from calling pydantic's+ `self.model_dump(by_alias=True)`:++ * `None` is only added to the output dict for nullable fields that+ were set at model initialization. Other fields with value `None`+ are ignored.+ * Fields in `self.additional_properties` are added to the output dict.+ """+ _dict = self.model_dump(+ by_alias=True,+ exclude={+ "additional_properties",+ },+ exclude_none=True,+ )+ # puts key-value pairs in additional_properties in the top level+ if self.additional_properties is not None:+ for _key, _value in self.additional_properties.items():+ _dict[_key] = _value++ return _dict++ @classmethod+ def from_dict(cls, obj: Dict) -> Self:+ """Create an instance of TemplateBuild from a dict"""+ if obj is None:+ return None++ if not isinstance(obj, dict):+ return cls.model_validate(obj)++ _obj = cls.model_validate(+ {+ "logs": obj.get("logs"),+ "templateID": obj.get("templateID"),+ "buildID": obj.get("buildID"),+ "status": obj.get("status"),+ }+ )+ # store additional fields in additional_properties+ for _key in obj.keys():+ if _key not in cls.__properties:+ _obj.additional_properties[_key] = obj.get(_key)++ return _objdiff --git a/packages/python-sdk/e2b/api/v2/client/models/envs_env_id_builds_build_id_logs_post_request.py b/packages/python-sdk/e2b/api/v2/client/models/templates_template_id_builds_build_id_logs_post_request.pysimilarity index 90%rename from packages/python-sdk/e2b/api/v2/client/models/envs_env_id_builds_build_id_logs_post_request.pyrename to packages/python-sdk/e2b/api/v2/client/models/templates_template_id_builds_build_id_logs_post_request.pyindex 3be836c7e..4f1e96d2b 100644--- a/packages/python-sdk/e2b/api/v2/client/models/envs_env_id_builds_build_id_logs_post_request.py+++ b/packages/python-sdk/e2b/api/v2/client/models/templates_template_id_builds_build_id_logs_post_request.py@@ -28,9 +28,9 @@ except ImportError:from typing_extensions import Self-class EnvsEnvIDBuildsBuildIDLogsPostRequest(BaseModel):+class TemplatesTemplateIDBuildsBuildIDLogsPostRequest(BaseModel):"""- EnvsEnvIDBuildsBuildIDLogsPostRequest+ TemplatesTemplateIDBuildsBuildIDLogsPostRequest""" # noqa: E501api_secret: StrictStr = Field(description="API secret", alias="apiSecret")@@ -51,7 +51,7 @@ class EnvsEnvIDBuildsBuildIDLogsPostRequest(BaseModel):@classmethoddef from_json(cls, json_str: str) -> Self:- """Create an instance of EnvsEnvIDBuildsBuildIDLogsPostRequest from a JSON string"""+ """Create an instance of TemplatesTemplateIDBuildsBuildIDLogsPostRequest from a JSON string"""return cls.from_dict(json.loads(json_str))def to_dict(self) -> Dict[str, Any]:@@ -81,7 +81,7 @@ class EnvsEnvIDBuildsBuildIDLogsPostRequest(BaseModel):@classmethoddef from_dict(cls, obj: Dict) -> Self:- """Create an instance of EnvsEnvIDBuildsBuildIDLogsPostRequest from a dict"""+ """Create an instance of TemplatesTemplateIDBuildsBuildIDLogsPostRequest from a dict"""if obj is None:return Nonediff --git a/packages/python-sdk/e2b/api/v2/client_README.md b/packages/python-sdk/e2b/api/v2/client_README.mdindex a082b2e0f..be411f76b 100644--- a/packages/python-sdk/e2b/api/v2/client_README.md+++ b/packages/python-sdk/e2b/api/v2/client_README.md@@ -54,14 +54,14 @@ configuration.api_key['ApiKeyAuth'] = os.environ["API_KEY"]# Enter a context with an instance of the API clientwith e2b.api.v2.client.ApiClient(configuration) as api_client:# Create an instance of the API class- api_instance = e2b.api.v2.client.InstancesApi(api_client)+ api_instance = e2b.api.v2.client.SandboxesApi(api_client)try:- api_response = api_instance.instances_get()- print("The response of InstancesApi->instances_get:\n")+ api_response = api_instance.sandboxes_get()+ print("The response of SandboxesApi->sandboxes_get:\n")pprint(api_response)except ApiException as e:- print("Exception when calling InstancesApi->instances_get: %s\n" % e)+ print("Exception when calling SandboxesApi->sandboxes_get: %s\n" % e)```@@ -71,21 +71,27 @@ All URIs are relative to *https://api.e2b.dev*Class | Method | HTTP request | Description------------ | ------------- | ------------- | --------------*InstancesApi* | [**instances_get**](e2b/api/v2/client/docs/InstancesApi.md#instances_get) | **GET** /instances |-*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 |+*SandboxesApi* | [**sandboxes_get**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_get) | **GET** /sandboxes |+*SandboxesApi* | [**sandboxes_post**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_post) | **POST** /sandboxes |+*SandboxesApi* | [**sandboxes_sandbox_id_refreshes_post**](e2b/api/v2/client/docs/SandboxesApi.md#sandboxes_sandbox_id_refreshes_post) | **POST** /sandboxes/{sandboxID}/refreshes |## Documentation For Models- [Environment](e2b/api/v2/client/docs/Environment.md)- [EnvironmentBuild](e2b/api/v2/client/docs/EnvironmentBuild.md)- - [EnvsEnvIDBuildsBuildIDLogsPostRequest](e2b/api/v2/client/docs/EnvsEnvIDBuildsBuildIDLogsPostRequest.md)- [Error](e2b/api/v2/client/docs/Error.md)- [Instance](e2b/api/v2/client/docs/Instance.md)- [InstancesInstanceIDRefreshesPostRequest](e2b/api/v2/client/docs/InstancesInstanceIDRefreshesPostRequest.md)- [NewInstance](e2b/api/v2/client/docs/NewInstance.md)+ - [NewSandbox](e2b/api/v2/client/docs/NewSandbox.md)- [RunningInstance](e2b/api/v2/client/docs/RunningInstance.md)+ - [RunningSandboxes](e2b/api/v2/client/docs/RunningSandboxes.md)+ - [Sandbox](e2b/api/v2/client/docs/Sandbox.md)+ - [SandboxesSandboxIDRefreshesPostRequest](e2b/api/v2/client/docs/SandboxesSandboxIDRefreshesPostRequest.md)+ - [Template](e2b/api/v2/client/docs/Template.md)+ - [TemplateBuild](e2b/api/v2/client/docs/TemplateBuild.md)+ - [TemplatesTemplateIDBuildsBuildIDLogsPostRequest](e2b/api/v2/client/docs/TemplatesTemplateIDBuildsBuildIDLogsPostRequest.md)<a id="documentation-for-authorization"></a>diff --git a/packages/python-sdk/e2b/sandbox/main.py b/packages/python-sdk/e2b/sandbox/main.pyindex 551782abf..d3b0ec83b 100644--- a/packages/python-sdk/e2b/sandbox/main.py+++ b/packages/python-sdk/e2b/sandbox/main.py@@ -77,7 +77,7 @@ class Sandbox(SandboxConnection):on_exit: Optional[Union[Callable[[int], Any], Callable[[], Any]]] = None,metadata: Optional[Dict[str, str]] = None,timeout: Optional[float] = TIMEOUT,- _sandbox: Optional[models.Instance] = None,+ _sandbox: Optional[models.Sandbox] = None,_debug_hostname: Optional[str] = None,_debug_port: Optional[int] = None,_debug_dev_env: Optional[Literal["remote", "local"]] = None,@@ -280,7 +280,7 @@ class Sandbox(SandboxConnection):"""logger.info(f"Reconnecting to sandbox {sandbox_id}")- instance_id, client_id = sandbox_id.split("-")+ sandbox_id, client_id = sandbox_id.split("-")return cls(cwd=cwd,env_vars=env_vars,@@ -289,10 +289,10 @@ class Sandbox(SandboxConnection):on_stderr=on_stderr,on_exit=on_exit,timeout=timeout,- _sandbox=models.Instance(- instance_id=instance_id,+ _sandbox=models.Sandbox(+ sandbox_id=sandbox_id,client_id=client_id,- env_id=getattr(cls, "sandbox_template_id", "unknown"),+ template_id=getattr(cls, "sandbox_template_id", "unknown"),),**kwargs,)diff --git a/packages/python-sdk/e2b/sandbox/run_code.py b/packages/python-sdk/e2b/sandbox/run_code.pyindex 3b5905dd9..55846a77b 100644--- a/packages/python-sdk/e2b/sandbox/run_code.py+++ b/packages/python-sdk/e2b/sandbox/run_code.py@@ -35,19 +35,19 @@ def run_code(api_key = getenv("E2B_API_KEY")if runtime == "Node16":- env_id = "base"+ template_id = "base"binary = "node"filepath = "/index.js"elif runtime == "Python3":- env_id = "base"+ template_id = "base"binary = "python3"filepath = "/index.py"elif runtime == "Python3-DataAnalysis":- env_id = "Python3-DataAnalysis"+ template_id = "Python3-DataAnalysis"binary = "python3"filepath = "/index.py"elif runtime == "Bash":- env_id = "base"+ template_id = "base"binary = "bash"filepath = "/main.sh"else:@@ -55,7 +55,7 @@ def run_code(f'Invalid runtime "{runtime}". Please contact us ([email protected]) if you need support for this runtime')- sandbox = Sandbox(template=env_id, api_key=api_key)+ sandbox = Sandbox(template=template_id, api_key=api_key)sandbox.filesystem.write(filepath, code)output = sandbox.process.start_and_wait(cmd=f"{binary} {filepath}")diff --git a/packages/python-sdk/e2b/sandbox/sandbox_connection.py b/packages/python-sdk/e2b/sandbox/sandbox_connection.pyindex fd30edf12..b85149bbf 100644--- a/packages/python-sdk/e2b/sandbox/sandbox_connection.py+++ b/packages/python-sdk/e2b/sandbox/sandbox_connection.py@@ -68,7 +68,7 @@ class SandboxConnection:"""if not self._sandbox:raise SandboxException("Sandbox is not running.")- return f"{self._sandbox.instance_id}-{self._sandbox.client_id}"+ return f"{self._sandbox.sandbox_id}-{self._sandbox.client_id}"@propertydef finished(self):@@ -92,7 +92,7 @@ class SandboxConnection:env_vars: Optional[EnvVars] = None,metadata: Optional[Dict[str, str]] = None,timeout: Optional[float] = TIMEOUT,- _sandbox: Optional[models.Instance] = None,+ _sandbox: Optional[models.Sandbox] = None,_debug_hostname: Optional[str] = None,_debug_port: Optional[int] = None,_debug_dev_env: Optional[Literal["remote", "local"]] = None,@@ -182,11 +182,11 @@ class SandboxConnection:raise ValueError("Duration must be between 0 and 3600 seconds")with E2BApiClient(api_key=self._api_key) as api_client:- api = client.InstancesApi(api_client)+ api = client.SandboxesApi(api_client)try:- api.instances_instance_id_refreshes_post(- self._sandbox.instance_id,- client.InstancesInstanceIDRefreshesPostRequest(duration=duration),+ api.sandboxes_sandbox_id_refreshes_post(+ self._sandbox.sandbox_id,+ client.SandboxesSandboxIDRefreshesPostRequest(duration=duration),)logger.debug(f"Sandbox will be kept alive without connection for next {duration} seconds."@@ -194,7 +194,7 @@ class SandboxConnection:except exceptions.ApiException as e:if e.status == 404:raise SandboxException(- f"Sandbox {self._sandbox.instance_id} failed because it cannot be found"+ f"Sandbox {self.id} failed because it cannot be found") from eelse:raise e@@ -208,9 +208,7 @@ class SandboxConnection:def _close(self):if self._is_open and self._sandbox:- logger.info(- f"Closing sandbox {self._sandbox.env_id} (id: {self._sandbox.instance_id})"- )+ logger.info(f"Closing sandbox {self._sandbox.template_id} (id: {self.id})")self._is_open = Falseif self._rpc:self._rpc.close()@@ -240,14 +238,14 @@ class SandboxConnection:if not self._sandbox and not self._debug_hostname:try:with E2BApiClient(api_key=self._api_key) as api_client:- api = client.InstancesApi(api_client)+ api = client.SandboxesApi(api_client)- self._sandbox = api.instances_post(- models.NewInstance(envID=self._template, metadata=metadata),+ self._sandbox = api.sandboxes_post(+ models.NewSandbox(templateID=self._template, metadata=metadata),_request_timeout=timeout,)logger.info(- f"Sandbox {self._sandbox.env_id} created (id:{self._sandbox.instance_id})"+ f"Sandbox {self._sandbox.template_id} created (id:{self.id})")except ReadTimeoutError as e:logger.error(f"Failed to acquire sandbox")@@ -290,7 +288,7 @@ class SandboxConnection:def _start_refreshing(self):threading.Thread(target=self._refresh,- args=(self._sandbox.instance_id,),+ args=(self._sandbox.sandbox_id,),daemon=True,name="e2b-sandbox-refresh",).start()@@ -408,74 +406,65 @@ class SandboxConnection:if id == data.params["subscription"]:sub.handler(data.params["result"])- def _refresh(self, instance_id: str):+ def _refresh(self, sandbox_id: str):if not self._sandbox:logger.info("No sandbox to refresh. Sandbox was not created")returntry:logger.info(- f"Started refreshing sandbox {self._sandbox.env_id} (id: {instance_id})"+ f"Started refreshing sandbox {self._sandbox.template_id} (id: {self.id})")current_retry = 0with E2BApiClient(api_key=self._api_key) as api_client:- api = client.InstancesApi(api_client)+ api = client.SandboxesApi(api_client)while True:if not self._is_open:logger.debug(- f"Cannot refresh sandbox - it was closed. {self._sandbox.instance_id}"+ f"Cannot refresh sandbox - it was closed. {self.id}")returnsleep(SANDBOX_REFRESH_PERIOD)try:- api.instances_instance_id_refreshes_post(- instance_id,- client.InstancesInstanceIDRefreshesPostRequest(duration=0),+ api.sandboxes_sandbox_id_refreshes_post(+ sandbox_id,+ client.SandboxesSandboxIDRefreshesPostRequest(duration=0),)- logger.debug(f"Refreshed sandbox {instance_id}")+ logger.debug(f"Refreshed sandbox {self.id}")except exceptions.ApiException as e:if e.status == 404:raise SandboxException(- f"Sandbox {instance_id} failed because it cannot be found"+ f"Sandbox {self.id} failed because it cannot be found") from eelse:if current_retry < self._refresh_retries:logger.error(- f"Refreshing sandbox {instance_id} failed. Retrying..."+ f"Refreshing sandbox {self.id} failed. Retrying...")current_retry += 1else:logger.error(- f"Refreshing sandbox {instance_id} failed. Max retries exceeded"+ f"Refreshing sandbox {self.id} failed. Max retries exceeded")raise efinally:if self._sandbox:- logger.info(f"Stopped refreshing sandbox (id: {instance_id})")+ logger.info(f"Stopped refreshing sandbox (id: {self.id})")else:logger.info("No sandbox to stop refreshing. Sandbox was not created")self._close()@staticmethod- def list(api_key: Optional[str] = None) -> List[RunningSandbox]:+ def list(api_key: Optional[str] = None) -> List[models.RunningSandboxes]:"""List all running sandboxes.- :param api_key: API key to use for authentication. If not provided, the `E2B_API_KEY` environment variable will be used.+ :param api_key: API key to use for authentication.+ If not provided, the `E2B_API_KEY` environment variable will be used."""api_key = get_api_key(api_key)with E2BApiClient(api_key=api_key) as api_client:- running_sandboxes = client.InstancesApi(api_client).instances_get()-- return [- RunningSandbox(- sandbox_id=s.instance_id,- template_id=s.env_id,- alias=s.alias,- metadata=s.metadata or {},- )- for s in running_sandboxes- ]+ return client.SandboxesApi(api_client).sandboxes_get()diff --git a/packages/python-sdk/tests/test_list_sandboxes.py b/packages/python-sdk/tests/test_list_sandboxes.pyindex ac0e802dc..a1c1f66b2 100644--- a/packages/python-sdk/tests/test_list_sandboxes.py+++ b/packages/python-sdk/tests/test_list_sandboxes.py@@ -8,7 +8,7 @@ def test_list_running_sandboxes():running_sandboxes = list(filter(- lambda s: s.metadata.get("n", "").startswith("py"),+ lambda s: s.metadata and s.metadata.get("n", "").startswith("py"),Sandbox.list(),))diff --git a/spec/openapi.yml b/spec/openapi.ymlindex dc4d72e1e..b72a9cf26 100644--- a/spec/openapi.yml+++ b/spec/openapi.yml@@ -18,8 +18,8 @@ components:bearerFormat: access_tokenparameters:- envID:- name: envID+ templateID:+ name: templateIDin: pathrequired: trueschema:@@ -30,12 +30,26 @@ components:required: trueschema:type: string+ sandboxID:+ name: sandboxID+ in: path+ required: true+ schema:+ type: string+# ------ Deprecated --------+ envID:+ name: envID+ in: path+ required: true+ schema:+ type: stringinstanceID:name: instanceIDin: pathrequired: trueschema:type: string+# ----------------------responses:400:@@ -65,21 +79,127 @@ components:$ref: "#/components/schemas/Error"schemas:- InstanceMetadata:+ SandboxMetadata:additionalProperties:type: string- description: Metadata of the instance+ description: Metadata of the sandbox- NewInstance:+ Sandbox:required:- - envID+ - templateID+ - sandboxID+ - clientIDproperties:- envID:+ templateID:type: string- description: Identifier of the required environment+ description: Identifier of the template from which is the sandbox created+ sandboxID:+ type: string+ description: Identifier of the sandbox+ alias:+ type: string+ description: Alias of the template+ clientID:+ type: string+ description: Identifier of the client++ RunningSandboxes:+ required:+ - templateID+ - sandboxID+ - clientID+ - startedAt+ properties:+ templateID:+ type: string+ description: Identifier of the template from which is the sandbox created+ alias:+ type: string+ description: Alias of the template+ sandboxID:+ type: string+ description: Identifier of the sandbox+ clientID:+ type: string+ description: Identifier of the client+ startedAt:+ type: string+ format: date-time+ description: Time when the sandbox was startedmetadata:- $ref: "#/components/schemas/InstanceMetadata"+ $ref: "#/components/schemas/SandboxMetadata"++ NewSandbox:+ required:+ - templateID+ properties:+ templateID:+ type: string+ description: Identifier of the required template+ metadata:+ $ref: "#/components/schemas/SandboxMetadata"++ Template:+ required:+ - templateID+ - buildID+ - public+ properties:+ templateID:+ type: string+ description: Identifier of the template+ buildID:+ type: string+ description: Identifier of the last successful build for given template+ public:+ type: boolean+ description: Whether the template is public or only accessible by the team+ aliases:+ type: array+ description: Aliases of the template+ items:+ type: string+ TemplateBuild:+ required:+ - templateID+ - buildID+ - finished+ - logs+ properties:+ logs:+ default: []+ description: Build logs+ type: array+ items:+ type: string+ templateID:+ type: string+ description: Identifier of the template+ buildID:+ type: string+ description: Identifier of the build+ status:+ type: string+ description: Status of the template+ enum:+ - building+ - ready+ - error++ Error:+ required:+ - code+ - message+ properties:+ code:+ type: integer+ format: int32+ description: Error code+ message:+ type: string+ description: Error+# ------ Deprecated --------Environment:required:- envID@@ -128,6 +248,21 @@ components:- ready- error+ InstanceMetadata:+ additionalProperties:+ type: string+ description: Metadata of the instance++ NewInstance:+ required:+ - envID+ properties:+ envID:+ type: string+ description: Identifier of the required environment+ metadata:+ $ref: "#/components/schemas/InstanceMetadata"+Instance:required:- envID@@ -140,26 +275,10 @@ components:instanceID:type: stringdescription: Identifier of the instance- alias:- type: string- description: Alias of the environmentclientID:type: stringdescription: Identifier of the client- Error:- required:- - code- - message- properties:- code:- type: integer- format: int32- description: Error code- message:- type: string- description: Error-RunningInstance:required:- envID@@ -170,9 +289,6 @@ components:envID:type: stringdescription: Identifier of the environment from which is the instance created- alias:- type: string- description: Alias of the environmentinstanceID:type: stringdescription: Identifier of the instance@@ -185,10 +301,15 @@ components:description: Time when the instance was startedmetadata:$ref: "#/components/schemas/InstanceMetadata"+# ---------------------tags:+ - name: templates+ - name: sandboxes+# ------ Deprecated --------- name: instances- name: envs+# ---------------------------paths:/health:@@ -200,22 +321,22 @@ paths:401:$ref: "#/components/responses/401"- /instances:+ /sandboxes:get:- description: List all running instances- tags: [instances]+ description: List all running sandboxes+ tags: [sandboxes]security:- ApiKeyAuth: [ ]responses:200:- description: Successfully returned all running instances+ description: Successfully returned all running sandboxescontent:application/json:schema:type: arrayitems:allOf:- - $ref: "#/components/schemas/RunningInstance"+ - $ref: "#/components/schemas/RunningSandboxes"401:$ref: "#/components/responses/401"400:@@ -223,8 +344,8 @@ paths:500:$ref: "#/components/responses/500"post:- description: Create an instance from the environment- tags: [instances]+ description: Create a sandbox from the template+ tags: [sandboxes]security:- ApiKeyAuth: []requestBody:@@ -232,14 +353,14 @@ paths:content:application/json:schema:- $ref: "#/components/schemas/NewInstance"+ $ref: "#/components/schemas/NewSandbox"responses:201:- description: The instance was created successfully+ description: The sandbox was created successfullycontent:application/json:schema:- $ref: "#/components/schemas/Instance"+ $ref: "#/components/schemas/Sandbox"401:$ref: "#/components/responses/401"400:@@ -247,12 +368,12 @@ paths:500:$ref: "#/components/responses/500"- /instances/{instanceID}/refreshes:+ /sandboxes/{sandboxID}/refreshes:post:- description: Refresh the instance extending its time to live+ description: Refresh the sandbox extending its time to livesecurity:- ApiKeyAuth: []- tags: [instances]+ tags: [sandboxes]requestBody:required: falsecontent:@@ -261,19 +382,207 @@ paths:type: objectproperties:duration:- description: Duration for which the instance should be kept alive in seconds+ description: Duration for which the sandbox should be kept alive in secondstype: integermaximum: 3600 # 1 hourminimum: 0parameters:- - $ref: "#/components/parameters/instanceID"+ - $ref: "#/components/parameters/sandboxID"responses:204:- description: Successfully refreshed the instance+ description: Successfully refreshed the sandbox401:$ref: "#/components/responses/401"404:$ref: "#/components/responses/404"++ /templates:+ get:+ description: List all templates+ tags: [templates]+ security:+ - AccessTokenAuth: []+ responses:+ 200:+ description: Successfully returned all templates+ content:+ application/json:+ schema:+ type: array+ items:+ allOf:+ - $ref: "#/components/schemas/Template"+ 401:+ $ref: "#/components/responses/401"+ 500:+ $ref: "#/components/responses/500"+ post:+ description: Create a new template+ tags: [templates]+ security:+ - AccessTokenAuth: []+ requestBody:+ required: true+ content:+ multipart/form-data:+ schema:+ type: object+ required:+ - buildContext+ - dockerfile+ properties:+ alias:+ description: Alias of the template+ type: string+ buildContext:+ description: Docker build context+ type: string+ format: binary+ dockerfile:+ type: string+ description: Dockerfile content+ startCmd:+ description: Start command to execute in the template after the build+ type: string+ encoding:+ buildContext:+ contentType: application/octet-stream++ responses:+ 202:+ description: The build has started+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/Template"+ 401:+ $ref: "#/components/responses/401"+ 500:+ $ref: "#/components/responses/500"++ /templates/{templateID}:+ post:+ description: Rebuild an template+ tags: [templates]+ security:+ - AccessTokenAuth: []+ parameters:+ - $ref: "#/components/parameters/templateID"+ requestBody:+ required: true+ content:+ multipart/form-data:+ schema:+ type: object+ required:+ - buildContext+ - dockerfile+ properties:+ alias:+ description: Alias of the template+ type: string+ buildContext:+ description: Docker build context+ type: string+ format: binary+ dockerfile:+ type: string+ description: Dockerfile content+ startCmd:+ description: Start command to execute in the template after the build+ type: string+ encoding:+ buildContext:+ contentType: application/octet-stream++ responses:+ 202:+ description: The build has started+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/Template"+ 401:+ $ref: "#/components/responses/401"+ 500:+ $ref: "#/components/responses/500"+ delete:+ description: Delete a template+ tags: [templates]+ security:+ - AccessTokenAuth: []+ parameters:+ - $ref: "#/components/parameters/templateID"+ responses:+ 204:+ description: The template was deleted successfully+ 401:+ $ref: "#/components/responses/401"+ 500:+ $ref: "#/components/responses/500"++ /templates/{templateID}/builds/{buildID}:+ get:+ description: Get template build info+ tags: [templates]+ security:+ - AccessTokenAuth: []+ parameters:+ - $ref: "#/components/parameters/templateID"+ - $ref: "#/components/parameters/buildID"+ - in: query+ name: logsOffset+ schema:+ default: 0+ type: integer+ description: Index of the starting build log that should be returned with the template+ responses:+ 200:+ description: Successfully returned the template+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/TemplateBuild"+ 401:+ $ref: "#/components/responses/401"+ 404:+ $ref: "#/components/responses/404"+ 500:+ $ref: "#/components/responses/500"++ /templates/{templateID}/builds/{buildID}/logs:+ post:+ description: Add a build log+ tags: [templates]+ parameters:+ - $ref: "#/components/parameters/templateID"+ - $ref: "#/components/parameters/buildID"+ requestBody:+ required: true+ content:+ application/json:+ schema:+ type: object+ required:+ - apiSecret+ - logs+ properties:+ apiSecret:+ description: API secret+ type: string+ logs:+ type: array+ items:+ type: string+ responses:+ 201:+ description: Successfully added log+ 401:+ $ref: "#/components/responses/401"+ 404:+ $ref: "#/components/responses/404"++ # ------ Deprecated --------/envs:get:description: List all environments@@ -459,3 +768,79 @@ paths:$ref: "#/components/responses/401"404:$ref: "#/components/responses/404"++ /instances:+ get:+ description: List all running instances+ tags: [instances]+ security:+ - ApiKeyAuth: [ ]+ responses:+ 200:+ description: Successfully returned all running instances+ content:+ application/json:+ schema:+ type: array+ items:+ allOf:+ - $ref: "#/components/schemas/RunningInstance"+ 401:+ $ref: "#/components/responses/401"+ 400:+ $ref: "#/components/responses/400"+ 500:+ $ref: "#/components/responses/500"+ post:+ description: Create an instance from the environment+ tags: [instances]+ security:+ - ApiKeyAuth: []+ requestBody:+ required: true+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/NewInstance"+ responses:+ 201:+ description: The instance was created successfully+ content:+ application/json:+ schema:+ $ref: "#/components/schemas/Instance"+ 401:+ $ref: "#/components/responses/401"+ 400:+ $ref: "#/components/responses/400"+ 500:+ $ref: "#/components/responses/500"++ /instances/{instanceID}/refreshes:+ post:+ description: Refresh the instance extending its time to live+ security:+ - ApiKeyAuth: []+ tags: [instances]+ requestBody:+ required: false+ content:+ application/json:+ schema:+ type: object+ properties:+ duration:+ description: Duration for which the instance should be kept alive in seconds+ type: integer+ maximum: 3600 # 1 hour+ minimum: 0+ parameters:+ - $ref: "#/components/parameters/instanceID"+ responses:+ 204:+ description: Successfully refreshed the instance+ 401:+ $ref: "#/components/responses/401"+ 404:+ $ref: "#/components/responses/404"+# ---------------------