TriangleInterface and ModelInterface classes

class ledger_analytics.interface.CashflowInterface(model_class: str, host: str, requester: Requester, asynchronous: bool = False)

The CashflowInterface class allows basic CRUD operations on for Cashflow endpoints and objects.

class ledger_analytics.interface.ModelInterface(model_class: str, host: str, requester: Requester, asynchronous: bool = False)

The ModelInterface class allows basic CRUD operations on for model endpoints and objects.

check_config_consistency(dict1, dict2)

Recursively checks items present in dict1 are consistent with items in dict2, meaning that the non-dictionary values are equal.

get_or_create(triangle: str | Triangle, name: str, model_type: str, config: JSONDict | None = None, timeout: int = 300)

Gets a model if it exists with the same configuration, errors if it exists with an inconsistent configuration. Creates a new model if none with the same name exists.

get_or_update(triangle: str | Triangle, name: str, model_type: str, config: JSONDict | None = None, timeout: int = 300)

Model Upsert. Gets a model if it exists with the same config, otherwise creates a new one, overwriting the existing model.

class ledger_analytics.interface.TriangleInterface(host: str, requester: Requester, asynchronous: bool = False)

The TriangleInterface class handles the basic CRUD operations on triangles, managed through AnalyticsClient.

get_or_create(name: str, data: dict[str, Any] | Triangle)

Gets a triangle if it exists with the same data, otherwise creates a new one. Will not overwrite an existing triangle with different data.

get_or_update(name: str, data: dict[str, Any] | Triangle)

Gets a triangle if it exists with the same data, otherwise creates a new one. Will overwrite an existing triangle with different data.