Skip to main content

Crate aster_forge_api

Crate aster_forge_api 

Source
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.
CreatedAtCursorQuery
Cursor query for resources ordered by creation time and numeric id.
CursorPage
Serialized cursor page response.
CursorSlice
Repository page slice returned after fetching one extra row to detect a next page.
DateTimeIdCursor
Timestamp plus numeric id cursor for resources sorted by time and then id.
DateTimeStringCursor
Timestamp plus string id cursor for resources sorted by time and then string id.
EnabledPriorityIdCursor
Enabled flag, priority, and numeric id cursor for prioritized toggle-like resources.
IdCursor
Numeric id cursor for resources sorted by id.
LimitOffsetQuery
Query parameters for limit/offset pagination.
LimitQuery
Query parameters for limit-only cursor pagination.
OffsetPage
Serialized offset page response.
SortOrderNameIdCursor
Sort-order, name, and numeric id cursor for manually ordered named resources.
StringIdCursor
String value plus numeric id cursor for resources sorted by text and then id.
UpdatedAtCursorQuery
Cursor query for resources ordered by update time and numeric id.

Enums§

NullablePatch
Three-state nullable field used by PATCH-style request DTOs.
SortOrder
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, invoking fetch, 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.