UNPKG

@cranberry-money/shared-types

Version:

Shared TypeScript type definitions for Blueberry platform

158 lines 4.03 kB
export interface FormErrors { [key: string]: string[]; } export interface PaginatedResponse<T> { count: number; next: string | null; previous: string | null; results: T[]; } export interface BaseOperationResponse { uuid: string; message?: string; } /** * Page-based pagination parameters. * Use for list endpoints that return paginated results. */ export interface PaginationParams { page?: number; page_size?: number; } /** * Limit-based pagination parameters. * Use for time-series data, snapshots, or when you need offset-based access. */ export interface LimitParams { limit?: number; offset?: number; } /** * Ordering parameters for sortable endpoints. */ export interface OrderingParams { order_by?: string; } /** * Date range filtering parameters. */ export interface DateRangeParams { start_date?: string; end_date?: string; } /** * Search/filter parameters. */ export interface SearchParams { search?: string; } /** * Base query parameters for paginated list endpoints. * Combines page-based pagination with ordering. */ export type BaseQueryParams = PaginationParams & OrderingParams; /** * Query parameters for time-series/snapshot endpoints. * Combines limit-based pagination with ordering and date range. */ export type TimeSeriesQueryParams = LimitParams & OrderingParams & DateRangeParams & { max_points?: number; }; /** * Flexible query params that allow any additional properties. */ export type FlexibleQueryParams = BaseQueryParams & { [key: string]: string | number | boolean | undefined; }; /** * Generic type for numeric range filtering (e.g., min_price, max_price). */ export type WithNumericRange<T extends string> = { [K in `min_${T}` | `max_${T}`]?: number; }; /** * Generic type for UUID reference filtering. */ export type WithUuidReference<T extends string> = { [K in `${T}_uuid` | `${T}`]?: string; }; /** * Generic type for status filtering. */ export interface WithStatusFilter<T extends string = string> { status?: T; } /** * User-friendly error interface for displaying clean error messages to users * while preserving the original error for debugging. */ export interface UserFriendlyError extends Error { isUserFriendly: true; originalError?: unknown; } /** * Account export data structure returned by the export-data endpoint. * Contains all user data for GDPR compliance / data portability. */ export interface AccountExportData { exportedAt: string; user: { email: string; dateJoined: string | null; isEmailVerified: boolean; }; profile: { firstName: string; middleName: string; lastName: string; dateOfBirth: string | null; phoneNumber: string; citizenshipCountry: string | null; createdAt: string | null; } | null; preferences: { selectedPortfolio: string | null; selectedAccount: string | null; } | null; financialProfile: { employmentStatus: string; annualIncome: string | null; sourceOfFunds: string; investmentExperience: string; riskTolerance: string; investmentObjective: string; } | null; accounts: Array<{ uuid: string; accountNumber: string; accountType: string; createdAt: string | null; }>; wallets: Array<{ uuid: string; name: string; chain: string; address: string; balance: string; isVerified: boolean; createdAt: string | null; }>; transactions: Array<{ uuid: string; txHash: string; type: string; status: string; amount: string; fee: string; fromAddress: string; toAddress: string; createdAt: string | null; }>; portfolios: Array<{ uuid: string; name: string; description: string; createdAt: string | null; }>; } //# sourceMappingURL=api.d.ts.map