imednet.core.endpoint.operations package
- class imednet.core.endpoint.operations.FilterGetOperation[source]
Bases:
Generic[T]Operation for executing get requests via filtering.
Encapsulates the logic for making the list request, and validating that the target item exists in the result set.
- __init__(study_key, item_id, filters, validate_func, list_sync_func=None, list_async_func=None)[source]
Initialize the filter get operation.
- Parameters:
study_key (
Optional[str]) – The study key.item_id (
Any) – The ID of the item to fetch.filters (
Dict[str,Any]) – The filters to apply.validate_func (
Callable[[List[TypeVar(T)],Optional[str],Any],TypeVar(T)]) – A function to validate and extract the result.list_sync_func (
Optional[Callable[...,List[TypeVar(T)]]]) – The synchronous list function.list_async_func (
Optional[Callable[...,Awaitable[List[TypeVar(T)]]]]) – The asynchronous list function.
- Return type:
None
- async execute_async(client, paginator_cls)[source]
Execute asynchronous get request.
- Parameters:
client (
AsyncRequestorProtocol) – The asynchronous HTTP client.paginator_cls (
type[AsyncPaginator]) – The async paginator class to use.
- Return type:
TypeVar(T)- Returns:
The parsed item.
- execute_sync(client, paginator_cls)[source]
Execute synchronous get request.
- Parameters:
client (
RequestorProtocol) – The synchronous HTTP client.paginator_cls (
type[Paginator]) – The paginator class to use.
- Return type:
TypeVar(T)- Returns:
The parsed item.
- class imednet.core.endpoint.operations.ListOperation[source]
Bases:
Generic[T]Operation for executing list requests.
Encapsulates the logic for setting up a paginator, iterating through pages, and parsing the results.
- __init__(path, params, page_size, parse_func)[source]
Initialize the list operation.
- Parameters:
path (
str) – The API endpoint path.params (
Dict[str,Any]) – Query parameters for the request.page_size (
int) – The number of items per page.parse_func (
Callable[[Any],TypeVar(T)]) – A function to parse a raw JSON item into the model T.
- Return type:
None
- async execute_async(client, paginator_cls)[source]
Execute asynchronous list request.
- Parameters:
client (
AsyncRequestorProtocol) – The asynchronous HTTP client.paginator_cls (
type[AsyncPaginator]) – The async paginator class to use.
- Return type:
List[TypeVar(T)]- Returns:
A list of parsed items.
- execute_sync(client, paginator_cls)[source]
Execute synchronous list request.
- Parameters:
client (
RequestorProtocol) – The synchronous HTTP client.paginator_cls (
type[Paginator]) – The paginator class to use.
- Return type:
List[TypeVar(T)]- Returns:
A list of parsed items.
- class imednet.core.endpoint.operations.PathGetOperation[source]
Bases:
Generic[T]Operation for executing get requests via direct path.
Encapsulates the logic for making the HTTP request, handling empty responses (not found), and parsing the result.
- __init__(path, parse_func, not_found_func)[source]
Initialize the path get operation.
- Parameters:
path (
str) – The API endpoint path.parse_func (
Callable[[Any],TypeVar(T)]) – A function to parse a raw JSON item into the model T.not_found_func (
Callable[[],None]) – A callback to raise the appropriate not found error.
- Return type:
None
- async execute_async(client)[source]
Execute asynchronous get request.
- Parameters:
client (
AsyncRequestorProtocol) – The asynchronous HTTP client.- Return type:
TypeVar(T)- Returns:
The parsed item.
- execute_sync(client)[source]
Execute synchronous get request.
- Parameters:
client (
RequestorProtocol) – The synchronous HTTP client.- Return type:
TypeVar(T)- Returns:
The parsed item.
- class imednet.core.endpoint.operations.RecordCreateOperation[source]
Bases:
Generic[T]Operation for creating records.
Handles validation against schema and security checks for headers before executing the creation request.
- __init__(path, records_data, email_notify=None, schema=None)[source]
Initialize the record creation operation.
- Parameters:
path (
str) – The full API path for the request.records_data (
List[Dict[str,Any]]) – List of record data objects to create.email_notify (
Union[bool,str,None]) – Email notification setting.schema (
Optional[BaseSchemaCache[Any]]) – Optional schema cache for validation.
- Raises:
ValidationError – If record data is invalid against the schema.
ClientError – If email_notify contains invalid characters.
- Return type:
None
- async execute_async(client, parse_func)[source]
Execute asynchronous creation request.
- Parameters:
client (
AsyncRequestorProtocol) – The asynchronous HTTP client.parse_func (
Callable[[Any],TypeVar(T)]) – Function to parse the response.
- Return type:
TypeVar(T)- Returns:
The parsed response object.
- execute_sync(client, parse_func)[source]
Execute synchronous creation request.
- Parameters:
client (
RequestorProtocol) – The synchronous HTTP client.parse_func (
Callable[[Any],TypeVar(T)]) – Function to parse the response.
- Return type:
TypeVar(T)- Returns:
The parsed response object.
Submodules
imednet.core.endpoint.operations.filter_get module
Operation for executing get requests via filtering.
This module encapsulates the logic for fetching a list of resources with a filter, and then parsing and validating that a single item was found.
- class imednet.core.endpoint.operations.filter_get.FilterGetOperation[source]
Bases:
Generic[T]Operation for executing get requests via filtering.
Encapsulates the logic for making the list request, and validating that the target item exists in the result set.
- __init__(study_key, item_id, filters, validate_func, list_sync_func=None, list_async_func=None)[source]
Initialize the filter get operation.
- Parameters:
study_key (
Optional[str]) – The study key.item_id (
Any) – The ID of the item to fetch.filters (
Dict[str,Any]) – The filters to apply.validate_func (
Callable[[List[TypeVar(T)],Optional[str],Any],TypeVar(T)]) – A function to validate and extract the result.list_sync_func (
Optional[Callable[...,List[TypeVar(T)]]]) – The synchronous list function.list_async_func (
Optional[Callable[...,Awaitable[List[TypeVar(T)]]]]) – The asynchronous list function.
- Return type:
None
- async execute_async(client, paginator_cls)[source]
Execute asynchronous get request.
- Parameters:
client (
AsyncRequestorProtocol) – The asynchronous HTTP client.paginator_cls (
type[AsyncPaginator]) – The async paginator class to use.
- Return type:
TypeVar(T)- Returns:
The parsed item.
- execute_sync(client, paginator_cls)[source]
Execute synchronous get request.
- Parameters:
client (
RequestorProtocol) – The synchronous HTTP client.paginator_cls (
type[Paginator]) – The paginator class to use.
- Return type:
TypeVar(T)- Returns:
The parsed item.
imednet.core.endpoint.operations.get module
Operation for executing get requests via direct path.
This module encapsulates the logic for fetching and parsing a single resource from the API using its ID.
- class imednet.core.endpoint.operations.get.PathGetOperation[source]
Bases:
Generic[T]Operation for executing get requests via direct path.
Encapsulates the logic for making the HTTP request, handling empty responses (not found), and parsing the result.
- __init__(path, parse_func, not_found_func)[source]
Initialize the path get operation.
- Parameters:
path (
str) – The API endpoint path.parse_func (
Callable[[Any],TypeVar(T)]) – A function to parse a raw JSON item into the model T.not_found_func (
Callable[[],None]) – A callback to raise the appropriate not found error.
- Return type:
None
- async execute_async(client)[source]
Execute asynchronous get request.
- Parameters:
client (
AsyncRequestorProtocol) – The asynchronous HTTP client.- Return type:
TypeVar(T)- Returns:
The parsed item.
- execute_sync(client)[source]
Execute synchronous get request.
- Parameters:
client (
RequestorProtocol) – The synchronous HTTP client.- Return type:
TypeVar(T)- Returns:
The parsed item.
imednet.core.endpoint.operations.list module
Operation for executing list requests.
This module encapsulates the logic for fetching and parsing a list of resources from the API, handling pagination seamlessly.
- class imednet.core.endpoint.operations.list.ListOperation[source]
Bases:
Generic[T]Operation for executing list requests.
Encapsulates the logic for setting up a paginator, iterating through pages, and parsing the results.
- __init__(path, params, page_size, parse_func)[source]
Initialize the list operation.
- Parameters:
path (
str) – The API endpoint path.params (
Dict[str,Any]) – Query parameters for the request.page_size (
int) – The number of items per page.parse_func (
Callable[[Any],TypeVar(T)]) – A function to parse a raw JSON item into the model T.
- Return type:
None
- async execute_async(client, paginator_cls)[source]
Execute asynchronous list request.
- Parameters:
client (
AsyncRequestorProtocol) – The asynchronous HTTP client.paginator_cls (
type[AsyncPaginator]) – The async paginator class to use.
- Return type:
List[TypeVar(T)]- Returns:
A list of parsed items.
- execute_sync(client, paginator_cls)[source]
Execute synchronous list request.
- Parameters:
client (
RequestorProtocol) – The synchronous HTTP client.paginator_cls (
type[Paginator]) – The paginator class to use.
- Return type:
List[TypeVar(T)]- Returns:
A list of parsed items.
imednet.core.endpoint.operations.record_create module
Operation for creating records.
Encapsulates validation, header construction, and execution logic for record creation.
- class imednet.core.endpoint.operations.record_create.RecordCreateOperation[source]
Bases:
Generic[T]Operation for creating records.
Handles validation against schema and security checks for headers before executing the creation request.
- __init__(path, records_data, email_notify=None, schema=None)[source]
Initialize the record creation operation.
- Parameters:
path (
str) – The full API path for the request.records_data (
List[Dict[str,Any]]) – List of record data objects to create.email_notify (
Union[bool,str,None]) – Email notification setting.schema (
Optional[BaseSchemaCache[Any]]) – Optional schema cache for validation.
- Raises:
ValidationError – If record data is invalid against the schema.
ClientError – If email_notify contains invalid characters.
- Return type:
None
- async execute_async(client, parse_func)[source]
Execute asynchronous creation request.
- Parameters:
client (
AsyncRequestorProtocol) – The asynchronous HTTP client.parse_func (
Callable[[Any],TypeVar(T)]) – Function to parse the response.
- Return type:
TypeVar(T)- Returns:
The parsed response object.
- execute_sync(client, parse_func)[source]
Execute synchronous creation request.
- Parameters:
client (
RequestorProtocol) – The synchronous HTTP client.parse_func (
Callable[[Any],TypeVar(T)]) – Function to parse the response.
- Return type:
TypeVar(T)- Returns:
The parsed response object.