Skip to content

Commit 631522d

Browse files
authored
feat: use v2 template update endpoint with namespaced templates (#1105)
1 parent 4af9b4c commit 631522d

10 files changed

Lines changed: 400 additions & 6 deletions

File tree

.changeset/new-yaks-sneeze.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'e2b': patch
3+
---
4+
5+
Add v2 template update endpoint with TemplateUpdateResponse containing namespaced names

.changeset/nine-lies-show.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
'@e2b/cli': minor
3+
---
4+
5+
Use v2 template update endpoint and display namespaced template name after publishing

packages/cli/src/commands/template/publish.ts

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ import { handleE2BRequestError } from '../../utils/errors'
2525
import { getUserConfig } from 'src/user'
2626

2727
async function publishTemplate(templateID: string, publish: boolean) {
28-
const res = await client.api.PATCH('/templates/{templateID}', {
28+
const res = await client.api.PATCH('/v2/templates/{templateID}', {
2929
params: {
3030
path: {
3131
templateID,
@@ -40,7 +40,8 @@ async function publishTemplate(templateID: string, publish: boolean) {
4040
res,
4141
`Error ${publish ? 'publishing' : 'unpublishing'} sandbox template`
4242
)
43-
return
43+
44+
return res.data?.names ?? []
4445
}
4546

4647
async function templateAction(
@@ -181,7 +182,10 @@ async function templateAction(
181182
e.configPath
182183
)}`
183184
)
184-
await publishTemplate(e.template_id, publish)
185+
const names = await publishTemplate(e.template_id, publish)
186+
if (publish && names.length > 0) {
187+
console.log(` Published as: ${asBold(names.join(', '))}`)
188+
}
185189
})
186190
)
187191
process.stdout.write('\n')

packages/js-sdk/src/api/schema.gen.ts

Lines changed: 65 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/python-sdk/e2b/api/client/api/templates/patch_v_2_templates_template_id.py

Lines changed: 185 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/python-sdk/e2b/api/client/models/__init__.py

Lines changed: 2 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)