Spaces & Projects
client.spaces and client.projects — list, create, update, and delete workspaces and projects.
On this page4
client.spaces
Maps to /api/workspaces (the product calls these spaces / workspaces).
| Method | Returns | Description |
|---|---|---|
list(options?) | AsyncGenerator<Space> | All spaces, auto-paginated |
listPage(options?) | PaginatedResponse<Space> | One page |
get(id, options?) | Promise<Space> | Single space |
create(data, options?) | Promise<Space> | { name, description? } |
update(id, data, options?) | Promise<Space> | Partial update |
delete(id, options?) | Promise<void> | Delete space |
for await (const space of client.spaces.list()) {
console.log(space.name, space.id)
}
const space = await client.spaces.create({
name: 'Red Team',
description: 'Offensive workflows',
})
const full = await client.spaces.get(space.id)
await client.spaces.update(space.id, { description: 'Updated' })client.projects
Projects live inside a space. Every method takes spaceId first.
| Method | Description |
|---|---|
list(spaceId, options?) | Auto-paginated projects |
get(spaceId, id, options?) | One project |
create(spaceId, data, options?) | { name, description? } |
update(spaceId, id, data, options?) | Update metadata |
delete(spaceId, id, options?) | Delete project |
const projects = []
for await (const p of client.projects.list(spaceId)) {
projects.push(p)
}
const project = await client.projects.create(spaceId, {
name: 'Recon',
description: 'Recon pipelines',
})Recipe: resolve space then list workflows
let spaceId: string | undefined
for await (const s of client.spaces.list()) {
if (s.name === 'Solutions') spaceId = s.id
}
if (!spaceId) throw new Error('space not found')
for await (const wf of client.workflows.list(spaceId)) {
console.log(wf.name)
}