Skip to content

base

konigle.managers.base

Base manager classes for the Konigle SDK.

This module provides the foundation for all resource managers, implementing common CRUD operations, pagination, filtering, and file upload handling.

BaseAsyncManager

Bases: BaseManager

Asynchronous manager providing CRUD operations.

All async resource managers inherit from this class to get standard functionality for listing, creating, updating, and deleting resources.

__init_subclass__(**kwargs)

Ensure subclasses define required class attributes.

create(data) async

Create a new resource.

PARAMETER DESCRIPTION
data

Resource data model instance or dict

TYPE: Union[CreateModel, Dict[str, Any]]

RETURNS DESCRIPTION
BaseResource

Created resource instance

delete(id_) async

Delete a resource.

PARAMETER DESCRIPTION
id_

Unique identifier for the resource

TYPE: str

RETURNS DESCRIPTION
bool

True if deletion was successful

get(id_) async

Get a specific resource by ID.

PARAMETER DESCRIPTION
id_

Unique identifier for the resource

TYPE: str

RETURNS DESCRIPTION
BaseResource

Resource instance with full detail data

iter_all(page_size=100, filters=None, **filter_kwargs) async

Memory-efficient iteration over all matching resources.

PARAMETER DESCRIPTION
page_size

Number of items to fetch per page

TYPE: int DEFAULT: 100

filters

Filter object for type-safe filtering

TYPE: Optional[BaseFilters] DEFAULT: None

**filter_kwargs

Filter arguments as keyword arguments

DEFAULT: {}

YIELDS DESCRIPTION

Resource instances one by one

list(page=1, page_size=20, filters=None, **filter_kwargs) async

List resources with pagination and filtering.

PARAMETER DESCRIPTION
page

Page number (1-based)

TYPE: int DEFAULT: 1

page_size

Number of items per page

TYPE: int DEFAULT: 20

filters

Filter object for type-safe filtering

TYPE: Optional[BaseFilters] DEFAULT: None

**filter_kwargs

Filter arguments as keyword arguments

DEFAULT: {}

RETURNS DESCRIPTION
PaginatedResponse[BaseResource]

Paginated response containing list of resources

update(id_, data) async

Update an existing resource.

PARAMETER DESCRIPTION
id_

Unique identifier for the resource

TYPE: str

data

Updated resource data model instance

TYPE: Union[UpdateModel, Dict[str, Any]]

RETURNS DESCRIPTION
BaseResource

Updated resource instance

BaseManager

Base manager class providing common functionality for both sync and async managers.

Contains shared methods for URL construction, resource creation, filtering, and file handling that are identical between sync and async implementations.

base_path instance-attribute

The API base path for this resource type (e.g., '/media-assets').

filter_class = None class-attribute instance-attribute

The filter model class for this resource type (optional).

resource_class instance-attribute

The resource model class this manager handles.

resource_update_class = None class-attribute instance-attribute

The update model class for this resource type.

create_resource(data, is_partial=False)

Create resource instance with Active Record capabilities.

PARAMETER DESCRIPTION
data

Resource data from API response

TYPE: Dict[str, Any]

is_partial

Whether this resource was loaded from a list endpoint (may be missing detail-only fields)

TYPE: bool DEFAULT: False

RETURNS DESCRIPTION
BaseResource

Resource instance with manager attached

BaseSyncManager

Bases: BaseManager

Synchronous manager providing CRUD operations.

All sync resource managers inherit from this class to get standard functionality for listing, creating, updating, and deleting resources.

__init_subclass__(**kwargs)

Ensure subclasses define required class attributes.

create(data)

Create a new resource.

PARAMETER DESCRIPTION
data

Resource data model instance or dict

TYPE: Union[CreateModel, Dict[str, Any]]

RETURNS DESCRIPTION
BaseResource

Created resource instance

delete(id_)

Delete a resource.

PARAMETER DESCRIPTION
id_

Unique identifier for the resource

TYPE: str

RETURNS DESCRIPTION
bool

True if deletion was successful

get(id_)

Get a specific resource by ID.

PARAMETER DESCRIPTION
id_

Unique identifier for the resource

TYPE: str

RETURNS DESCRIPTION
BaseResource

Resource instance with full detail data

iter_all(page_size=100, filters=None, **filter_kwargs)

Memory-efficient iteration over all matching resources.

PARAMETER DESCRIPTION
page_size

Number of items to fetch per page

TYPE: int DEFAULT: 100

filters

Filter object for type-safe filtering

TYPE: Optional[BaseFilters] DEFAULT: None

**filter_kwargs

Filter arguments as keyword arguments

DEFAULT: {}

YIELDS DESCRIPTION

Resource instances one by one

list(page=1, page_size=20, filters=None, **filter_kwargs)

List resources with pagination and filtering.

PARAMETER DESCRIPTION
page

Page number (1-based)

TYPE: int DEFAULT: 1

page_size

Number of items per page

TYPE: int DEFAULT: 20

filters

Filter object for type-safe filtering

TYPE: Optional[BaseFilters] DEFAULT: None

**filter_kwargs

Filter arguments as keyword arguments

DEFAULT: {}

RETURNS DESCRIPTION
PaginatedResponse[BaseResource]

Paginated response containing list of resources

update(id_, data)

Update an existing resource.

PARAMETER DESCRIPTION
id_

Unique identifier for the resource

TYPE: str

data

Updated resource data model instance or dict

TYPE: Union[UpdateModel, Dict[str, Any]]

RETURNS DESCRIPTION
BaseResource

Updated resource instance