What problem does it solve?
It eliminates the friction and repetition of calling raw generated OpenAPI client endpoints by providing a consistent, ergonomic helper API for domain operations, complete with reliable test scaffolding.
Core Features & Use Cases
- Thin ergonomic wrappers: Adds an
async helper method in stocktrim_public_api_client/helpers/<domain>.py that delegates to the corresponding generated generated/ client call.
- Transport-layer mocking in tests: Ensures tests mock
httpx.MockTransport so authentication and retry middleware execute as in production, not by mocking the helper directly.
- StockTrim 404 handling convention: Converts the API’s collection-style “not found” behavior (404) into
[] (or None where appropriate, e.g., single-entity “find by code”), matching documented quirks.
- Quality gate compliance: Enforces checks via linting/formatting and unit tests without suppressing issues using
# noqa or # type: ignore.
Quick Start
Ask your AI assistant to add a new helper for a specific domain operation in helpers/<domain>.py by wrapping the existing generated endpoint, then create a test that uses httpx.MockTransport to verify success and the 404-to-empty (or None) behavior.