AssetsResource
API reference for the Assets resource.
Methods
list
List all assets with optional filtering and pagination.
typescript
async list(options?: ListOptions): Promise<ListResponse<Asset>>Parameters:
| Name | Type | Description |
|---|---|---|
options.page.number | number | Page number |
options.page.size | number | Items per page |
options.sort | string | Sort field |
options.filter | Record<string, any> | Filter criteria |
Returns: ListResponse<Asset>
Example:
typescript
const response = await client.assets.list({
filter: { status: 'Active' }
});get
Get a single asset by ID.
typescript
async get(id: string, options?: { include?: string[] }): Promise<Asset>create
Create a new asset.
typescript
async create(data: CreateAssetInput): Promise<Asset>Parameters:
typescript
interface CreateAssetInput {
assetDesc: string;
assetCat: string;
assetOwner?: string;
assetCriticality?: string;
assetRisk?: string;
nextReviewDate?: Date;
}update
Update an existing asset.
typescript
async update(id: string, data: UpdateAssetInput): Promise<Asset>Parameters:
typescript
interface UpdateAssetInput extends Partial<CreateAssetInput> {
status?: 'Active' | 'Decommissioned';
}delete
Delete an asset.
typescript
async delete(id: string): Promise<void>review
Mark an asset as reviewed.
typescript
async review(id: string, reviewNotes?: string): Promise<Asset>Types
Asset
typescript
interface Asset {
id: string;
type: 'asset';
assetDesc: string;
assetCat: string;
assetOwner?: string;
assetCriticality?: string;
assetRisk?: string;
status: 'Active' | 'Decommissioned' | 'Deleted';
nextReviewDate?: Date;
lastReviewDate?: Date;
createdAt: Date;
updatedAt: Date;
metadata?: Record<string, unknown>;
}