imednet.core.endpoint.operations package

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(study_key, item_id, filters, validate_func, list_sync_func=None, list_async_func=None)[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.

Parameters:
  • study_key (Optional[str]) –

  • item_id (Any) –

  • filters (Dict[str, Any]) –

  • validate_func (Callable[[List[T], Optional[str], Any], T]) –

  • list_sync_func (Optional[Callable[..., List[T]]]) –

  • list_async_func (Optional[Callable[..., Awaitable[List[T]]]]) –

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(path, parse_func, not_found_func)[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.

Parameters:
  • path (str) –

  • parse_func (Callable[[Any], T]) –

  • not_found_func (Callable[[], 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(path, params, page_size, parse_func)[source]

Bases: Generic[T]

Operation for executing list requests.

Encapsulates the logic for setting up a paginator, iterating through pages, and parsing the results.

Parameters:
  • path (str) –

  • params (Dict[str, Any]) –

  • page_size (int) –

  • parse_func (Callable[[Any], T]) –

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(path, records_data, email_notify=None, schema=None)[source]

Bases: Generic[T]

Operation for creating records.

Handles validation against schema and security checks for headers before executing the creation request.

Parameters:
  • path (str) –

  • records_data (List[Dict[str, Any]]) –

  • email_notify (Union[bool, str, None]) –

  • schema (Optional[BaseSchemaCache[Any]]) –

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.

Module contents

class imednet.core.endpoint.operations.FilterGetOperation(study_key, item_id, filters, validate_func, list_sync_func=None, list_async_func=None)[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.

Parameters:
  • study_key (Optional[str]) –

  • item_id (Any) –

  • filters (Dict[str, Any]) –

  • validate_func (Callable[[List[T], Optional[str], Any], T]) –

  • list_sync_func (Optional[Callable[..., List[T]]]) –

  • list_async_func (Optional[Callable[..., Awaitable[List[T]]]]) –

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(path, params, page_size, parse_func)[source]

Bases: Generic[T]

Operation for executing list requests.

Encapsulates the logic for setting up a paginator, iterating through pages, and parsing the results.

Parameters:
  • path (str) –

  • params (Dict[str, Any]) –

  • page_size (int) –

  • parse_func (Callable[[Any], T]) –

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(path, parse_func, not_found_func)[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.

Parameters:
  • path (str) –

  • parse_func (Callable[[Any], T]) –

  • not_found_func (Callable[[], 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(path, records_data, email_notify=None, schema=None)[source]

Bases: Generic[T]

Operation for creating records.

Handles validation against schema and security checks for headers before executing the creation request.

Parameters:
  • path (str) –

  • records_data (List[Dict[str, Any]]) –

  • email_notify (Union[bool, str, None]) –

  • schema (Optional[BaseSchemaCache[Any]]) –

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.