mirror of
https://github.com/CherryHQ/cherry-studio.git
synced 2026-01-12 00:49:14 +08:00
- Introduced `OffsetPaginationParams`, `CursorPaginationParams`, and their corresponding response types to standardize pagination handling across the API. - Updated existing API types and hooks to support both offset and cursor-based pagination, improving data fetching capabilities. - Enhanced documentation with detailed usage examples for pagination, including request parameters and response structures, to aid developers in implementing pagination effectively. - Refactored related components to utilize the new pagination types, ensuring consistency and clarity in data management. |
||
|---|---|---|
| .. | ||
| api | ||
| cache | ||
| migration/v2 | ||
| preference | ||
| types | ||
| README.md | ||
Shared Data Types
This directory contains shared type definitions for Cherry Studio's data layer.
Documentation
For comprehensive documentation, see:
- Overview: docs/en/references/data/README.md
- Cache Types: cache-overview.md
- Preference Types: preference-overview.md
- API Types: api-types.md
Directory Structure
packages/shared/data/
├── api/ # Data API type system
│ ├── index.ts # Barrel exports
│ ├── apiTypes.ts # Core request/response types
│ ├── apiPaths.ts # Path template utilities
│ ├── apiErrors.ts # Error handling
│ └── schemas/ # Domain-specific API schemas
├── cache/ # Cache system type definitions
│ ├── cacheTypes.ts # Core cache types
│ ├── cacheSchemas.ts # Cache key schemas
│ └── cacheValueTypes.ts # Cache value types
├── preference/ # Preference system type definitions
│ ├── preferenceTypes.ts # Core preference types
│ └── preferenceSchemas.ts # Preference schemas
└── types/ # Shared data types
Quick Reference
Import Conventions
// API infrastructure types (from barrel)
import type { DataRequest, DataResponse, ApiClient } from '@shared/data/api'
import { ErrorCode, DataApiError, DataApiErrorFactory } from '@shared/data/api'
// Domain DTOs (from schema files)
import type { Topic, CreateTopicDto } from '@shared/data/api/schemas/topic'
// Cache types
import type { UseCacheKey, UseSharedCacheKey } from '@shared/data/cache'
// Preference types
import type { PreferenceKeyType } from '@shared/data/preference'