History Module (History)
The History module reuses the Cloud backend interfaces to provide list query and management functionality.
API List
| Method | Return Value | Description |
|---|---|---|
sdk.history.getList(options?) | Promise<HistoryListResult> | Get history record list (paginated) |
sdk.history.getDetail(id) | Promise<CloudRecord> | Get single record details (including full snapshot) |
sdk.history.delete(id) | Promise<void> | Delete history record |
Detailed Usage
Get List
typescript
const list = await sdk.history.getList({
page: 1, // Default 1
pageSize: 20, // Default 20, Max 50
})
console.log('Total:', list.total)
list.items.forEach(item => {
console.log(item.id, item.title, item.cover, item.createdAt)
})TIP
The current backend interface returns an array directly without a pagination total field. The SDK uses the array length as total.
Get Details
typescript
const detail = await sdk.history.getDetail(123)
// Returns CloudRecord, same structure as sdk.cloud.restore()Delete
typescript
await sdk.history.delete(123)Difference between HistoryItem and CloudRecord
| Field | HistoryItem (List Item) | CloudRecord (Details) |
|---|---|---|
| id | ✅ | ✅ |
| title | ✅ | ✅ |
| cover | ✅ | ✅ |
| createdAt | ✅ | ✅ |
| updatedAt | ✅ | ✅ |
| snapshot | ❌ | ✅ |
| originImageUrl | ❌ | ✅ |
The list interface only returns metadata (excluding snapshot) to reduce network transfer. Call getDetail() when full data is needed.