Specs API
Specs API
import { CodeBoltClient } from '@codebolt/clientsdk';
const client = new CodeBoltClient();
Quick Reference
| Method | Description |
|---|---|
create | Creates a new specification document. |
ensureFolder | Ensures the specs folder exists in the workspace. |
get | Retrieves a specific specification document. |
list | Lists all specification documents. |
update | Updates an existing specification document. |
Methods
create
client.specs.create(data: CreateSpecRequest): Promise<Spec>
Creates a new specification document.
Registers a new spec with the system using the provided content. The spec can include technical details, API definitions, architecture descriptions, and other structured specification information.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | CreateSpecRequest | Yes | Request containing the spec details |
Returns: Promise<Spec> — A promise that resolves to the created Spec object
ensureFolder
client.specs.ensureFolder(data?: EnsureSpecFolderRequest): Promise<unknown>
Ensures the specs folder exists in the workspace.
Creates the specification directory if it doesn't already exist, establishing a location for storing spec files and related documentation. This operation is idempotent and safe to call multiple times.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | EnsureSpecFolderRequest | No | Optional parameters for folder creation |
Returns: Promise<unknown> — A promise that resolves when the folder is ensured
get
client.specs.get(params?: GetSpecParams): Promise<Spec>
Retrieves a specific specification document.
Returns the spec matching the provided query parameters, typically by spec ID or project. The document includes all sections, metadata, and version information.
| Parameter | Type | Required | Description |
|---|---|---|---|
params | GetSpecParams | No | Query parameters to identify the spec |
Returns: Promise<Spec> — A promise that resolves to the Spec object
list
client.specs.list(params?: ListSpecsParams): Promise<Spec[]>
Lists all specification documents.
Returns every spec document in the system, optionally filtered by project, type, or other criteria. Use this for browsing specs or populating specification management UIs.
| Parameter | Type | Required | Description |
|---|---|---|---|
params | ListSpecsParams | No | Optional query parameters for filtering specs |
Returns: Promise<Spec[]> — A promise that resolves to an array of Spec objects
update
client.specs.update(data: UpdateSpecRequest): Promise<Spec>
Updates an existing specification document.
Modifies the content, metadata, or structure of a spec. Use this to add new sections, update information, change versions, or make other modifications as specifications evolve.
| Parameter | Type | Required | Description |
|---|---|---|---|
data | UpdateSpecRequest | Yes | Request containing the spec updates |
Returns: Promise<Spec> — A promise that resolves to the updated Spec object