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.
111 lines
3.0 KiB
TypeScript
111 lines
3.0 KiB
TypeScript
/**
|
|
* Cherry Studio Data API - Barrel Exports
|
|
*
|
|
* Exports common infrastructure types for the Data API system.
|
|
* Domain-specific DTOs should be imported directly from their schema files.
|
|
*
|
|
* @example
|
|
* ```typescript
|
|
* // Infrastructure types from barrel export
|
|
* import { DataRequest, DataResponse, ErrorCode, DataApiError } from '@shared/data/api'
|
|
*
|
|
* // Domain DTOs from schema files directly
|
|
* import type { Topic, CreateTopicDto } from '@shared/data/api/schemas/topic'
|
|
* ```
|
|
*/
|
|
|
|
// ============================================================================
|
|
// Core Request/Response Types
|
|
// ============================================================================
|
|
|
|
export type {
|
|
CursorPaginationParams,
|
|
CursorPaginationResponse,
|
|
DataRequest,
|
|
DataResponse,
|
|
HttpMethod,
|
|
OffsetPaginationParams,
|
|
OffsetPaginationResponse,
|
|
PaginationResponse,
|
|
SearchParams,
|
|
SortParams
|
|
} from './apiTypes'
|
|
export { isCursorPaginationResponse, isOffsetPaginationResponse } from './apiTypes'
|
|
|
|
// ============================================================================
|
|
// API Schema Type Utilities
|
|
// ============================================================================
|
|
|
|
export type {
|
|
ApiBody,
|
|
ApiClient,
|
|
ApiHandler,
|
|
ApiImplementation,
|
|
ApiMethods,
|
|
ApiParams,
|
|
ApiPaths,
|
|
ApiQuery,
|
|
ApiResponse,
|
|
ApiSchemas,
|
|
ConcreteApiPaths
|
|
} from './apiTypes'
|
|
|
|
// ============================================================================
|
|
// Path Resolution Utilities
|
|
// ============================================================================
|
|
|
|
export type {
|
|
BodyForPath,
|
|
MatchApiPath,
|
|
QueryParamsForPath,
|
|
ResolvedPath,
|
|
ResponseForPath
|
|
} from './apiPaths'
|
|
|
|
// ============================================================================
|
|
// Error Handling (from apiErrors.ts)
|
|
// ============================================================================
|
|
|
|
// Error code enum and mappings
|
|
export {
|
|
ERROR_MESSAGES,
|
|
ERROR_STATUS_MAP,
|
|
ErrorCode,
|
|
isRetryableErrorCode,
|
|
RETRYABLE_ERROR_CODES
|
|
} from './apiErrors'
|
|
|
|
// DataApiError class and factory
|
|
export {
|
|
DataApiError,
|
|
DataApiErrorFactory,
|
|
isDataApiError,
|
|
isSerializedDataApiError,
|
|
toDataApiError
|
|
} from './apiErrors'
|
|
|
|
// Error-related types
|
|
export type {
|
|
ConcurrentModificationErrorDetails,
|
|
DatabaseErrorDetails,
|
|
DataInconsistentErrorDetails,
|
|
DetailsForCode,
|
|
ErrorDetailsMap,
|
|
InternalErrorDetails,
|
|
InvalidOperationErrorDetails,
|
|
NotFoundErrorDetails,
|
|
PermissionDeniedErrorDetails,
|
|
RequestContext,
|
|
ResourceLockedErrorDetails,
|
|
SerializedDataApiError,
|
|
TimeoutErrorDetails,
|
|
ValidationErrorDetails
|
|
} from './apiErrors'
|
|
|
|
// ============================================================================
|
|
// Subscription & Middleware (for advanced usage)
|
|
// ============================================================================
|
|
|
|
export type { Middleware, ServiceOptions, SubscriptionCallback, SubscriptionOptions } from './apiTypes'
|
|
export { SubscriptionEvent } from './apiTypes'
|