katana_public_api_client.api_wrapper¶
katana_public_api_client.api_wrapper
¶
Thin CRUD wrappers for all Katana API resources.
Usage::
async with KatanaClient() as client:
products = await client.api.products.list(is_sellable=True)
product = await client.api.products.get(123)
await client.api.products.delete(123)
Classes¶
ApiNamespace(client)
¶
Dynamic namespace providing client.api.<resource> access.
Resources are created lazily on first attribute access and cached on the
instance for subsequent calls. Tab-completion is supported via
:meth:__dir__.
Source code in katana_public_api_client/api_wrapper/_namespace.py
Resource(client, config)
¶
Thin async CRUD wrapper around a single Katana API resource.
Each method delegates to the corresponding generated asyncio_detailed
function, unwraps the response, and returns the raw attrs model.
Generated modules are imported lazily on first call and cached for reuse.
Source code in katana_public_api_client/api_wrapper/_resource.py
Functions¶
create(body, **kwargs)
async
¶
Create a new resource.
Source code in katana_public_api_client/api_wrapper/_resource.py
delete(resource_id, **kwargs)
async
¶
Delete a resource by ID. Raises on error, returns None.
Source code in katana_public_api_client/api_wrapper/_resource.py
get(resource_id, **kwargs)
async
¶
Fetch a single resource by ID.
Source code in katana_public_api_client/api_wrapper/_resource.py
list(**kwargs)
async
¶
Fetch all resources (with optional filters).
Source code in katana_public_api_client/api_wrapper/_resource.py
update(resource_id, body, **kwargs)
async
¶
Update an existing resource by ID.
Source code in katana_public_api_client/api_wrapper/_resource.py
ResourceConfig(module, get_one=None, get_all=None, create=None, update=None, delete=None)
dataclass
¶
Maps a logical resource to its generated API module functions.
Attributes:
-
module(str) –Directory name under
api/(e.g."product"). -
get_one(str | None) –Module name for single-resource GET, or
None. -
get_all(str | None) –Module name for list GET, or
None. -
create(str | None) –Module name for POST, or
None. -
update(str | None) –Module name for PATCH/PUT, or
None. -
delete(str | None) –Module name for DELETE, or
None.