Skip to main content

addItem

client.projectStructure.addItem(packageId: string, section: string, data: AddSectionItemRequest): Promise<void>

Adds an item to a specific section within a package.

Registers a new item (e.g., a file, class, or endpoint reference) under the specified section of a package, enriching the structural metadata.

Parameters​

ParameterTypeRequiredDescription
packageIdstringYesThe unique identifier of the package
sectionstringYesThe name of the section to add the item to (e.g., 'routes', 'models')
dataAddSectionItemRequestYesThe item definition to add

Returns​

Promise<void> — A promise that resolves when the item has been added

Example​

import { CodeBoltClient } from '@codebolt/clientsdk';

const client = new CodeBoltClient();

const result = await client.projectStructure.addItem('packageId', 'section', /* AddSectionItemRequest */);
console.log(result);