Expand description
Shared API response and pagination helpers for Aster services.
This crate contains small HTTP-facing types that are useful across service boundaries: bounded limit query parsing, limit/offset pagination, cursor-page response shapes, cursor validation helpers, overfetch trimming, and simple sort-order serialization. It deliberately avoids depending on any concrete web framework or product entity so handlers can adapt it to Axum, Actix, OpenAPI generation, or test-only fixtures.
Structs§
- ApiError
- Error type for generic API helper failures.
- Created
AtCursor Query - Cursor query for resources ordered by creation time and numeric id.
- Cursor
Page - Serialized cursor page response.
- Cursor
Slice - Repository page slice returned after fetching one extra row to detect a next page.
- Date
Time IdCursor - Timestamp plus numeric id cursor for resources sorted by time and then id.
- Date
Time String Cursor - Timestamp plus string id cursor for resources sorted by time and then string id.
- Enabled
Priority IdCursor - Enabled flag, priority, and numeric id cursor for prioritized toggle-like resources.
- IdCursor
- Numeric id cursor for resources sorted by id.
- Limit
Offset Query - Query parameters for limit/offset pagination.
- Limit
Query - Query parameters for limit-only cursor pagination.
- Offset
Page - Serialized offset page response.
- Sort
Order Name IdCursor - Sort-order, name, and numeric id cursor for manually ordered named resources.
- String
IdCursor - String value plus numeric id cursor for resources sorted by text and then id.
- Updated
AtCursor Query - Cursor query for resources ordered by update time and numeric id.
Enums§
- Nullable
Patch - Three-state nullable field used by PATCH-style request DTOs.
- Sort
Order - Sort direction used by API query parameters.
Constants§
- DEFAULT_
FILE_ LIMIT - Default page size for file-list style endpoints.
- DEFAULT_
FOLDER_ LIMIT - Default page size for folder-list style endpoints.
- DEFAULT_
PAGE_ LIMIT - Default page size for cursor-based endpoints.
- MAX_
PAGE_ SIZE - Maximum accepted page size for offset and cursor pagination.
Functions§
- deserialize_
nullable_ patch_ option - Deserializes an optional PATCH field while preserving explicit
null. - load_
offset_ page - Loads an offset page by clamping
limit, invokingfetch, and wrapping the result. - parse_
datetime_ id_ cursor - Validates a timestamp plus numeric id cursor pair.
- parse_
datetime_ string_ cursor - Validates a timestamp plus string id cursor pair.
- parse_
enabled_ priority_ id_ cursor - Validates an enabled flag, priority, and numeric id cursor tuple.
- parse_
id_ cursor - Validates an optional positive numeric id cursor.
- parse_
sort_ order_ name_ id_ cursor - Validates a sort-order, name, and numeric id cursor tuple.
- parse_
string_ id_ cursor - Validates a string value plus numeric id cursor pair.
Type Aliases§
- Result
- Result type returned by API helper functions.