Skip to content

common

konigle.types.common

Common type definitions for the Konigle SDK.

This module defines common types, type aliases, and generic types used throughout the SDK.

IDMixin

Bases: BaseModel

Mixin for models that include an ID field.

Provides the standard ID field that most resources include. Default type is string to handle UUIDs and large integers from API. Resource models can override the type if needed.

id = Field(..., title='ID', description='Unique identifier.') class-attribute instance-attribute

Unique identifier.

PaginatedResponse

Bases: BaseModel, Generic[T]

Standardized pagination response wrapper.

This generic class wraps paginated API responses with metadata about the pagination state and navigation.

count = Field(..., ge=0, title='Count', description='Total number of resources.') class-attribute instance-attribute

Total number of resources.

current_page = Field(..., ge=1, title='Current Page', description='Current page number.') class-attribute instance-attribute

Current page number.

is_first_page property

Check if this is the first page.

is_last_page property

Check if this is the last page.

next = Field(None, title='Next', description='URL for next page.') class-attribute instance-attribute

URL for next page.

num_pages = Field(..., ge=0, title='Number of Pages', description='Total number of pages.') class-attribute instance-attribute

Total number of pages.

page_size = Field(..., gt=0, title='Page Size', description='Number of items per page.') class-attribute instance-attribute

Number of items per page.

payload = Field(..., title='Payload', description='List of resources in this page.') class-attribute instance-attribute

List of resources in this page.

previous = Field(None, title='Previous', description='URL for previous page.') class-attribute instance-attribute

URL for previous page.

has_next()

Check if there is a next page.

has_previous()

Check if there is a previous page.

PaginationParams

Bases: BaseModel

Pagination parameter validation and defaults.

Used to validate and normalize pagination parameters across all list operations.

page = Field(1, ge=1, title='Page', description='Page number.') class-attribute instance-attribute

Page number.

page_size = Field(20, ge=1, le=200, title='Page Size', description='Items per page.') class-attribute instance-attribute

Items per page.

TimestampMixin

Bases: BaseModel

Mixin for models that include timestamp fields.

Provides common timestamp fields that many resources include.

created_at = Field(..., title='Created At', description='Creation timestamp.') class-attribute instance-attribute

Creation timestamp.

updated_at = Field(..., title='Updated At', description='Last update timestamp.') class-attribute instance-attribute

Last update timestamp.