iresourcestrategy¶
Resource Strategy Interface
IResourceStrategy (Protocol)
dataclass
¶
Resource Strategy Interface.
Source code in oteapi/interfaces/iresourcestrategy.py
@dataclass # type: ignore[misc]
@runtime_checkable
class IResourceStrategy(Protocol):
"""Resource Strategy Interface."""
resource_config: "ResourceConfig"
def get(self, session: "Optional[Dict[str, Any]]" = None) -> "Dict[str, Any]":
"""Execute the strategy.
Parameters:
session: A session-specific dictionary context.
Returns:
Dictionary of key/value-pairs to be stored in the sessions-specific
dictionary context.
"""
def initialize(
self, session: "Optional[Dict[str, Any]]" = None
) -> "Dict[str, Any]":
"""Initialize data class.
This method will be called through the `/initialize` endpoint of the OTE-API
Services.
Parameters:
session: A session-specific dictionary context.
Returns:
Dictionary of key/value-pairs to be stored in the sessions-specific
dictionary context.
"""
get(self, session=None)
¶
Execute the strategy.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
Optional[Dict[str, Any]] |
A session-specific dictionary context. |
None |
Returns:
Type | Description |
---|---|
Dict[str, Any] |
Dictionary of key/value-pairs to be stored in the sessions-specific dictionary context. |
Source code in oteapi/interfaces/iresourcestrategy.py
def get(self, session: "Optional[Dict[str, Any]]" = None) -> "Dict[str, Any]":
"""Execute the strategy.
Parameters:
session: A session-specific dictionary context.
Returns:
Dictionary of key/value-pairs to be stored in the sessions-specific
dictionary context.
"""
initialize(self, session=None)
¶
Initialize data class.
This method will be called through the /initialize
endpoint of the OTE-API
Services.
Parameters:
Name | Type | Description | Default |
---|---|---|---|
session |
Optional[Dict[str, Any]] |
A session-specific dictionary context. |
None |
Returns:
Type | Description |
---|---|
Dict[str, Any] |
Dictionary of key/value-pairs to be stored in the sessions-specific dictionary context. |
Source code in oteapi/interfaces/iresourcestrategy.py
def initialize(
self, session: "Optional[Dict[str, Any]]" = None
) -> "Dict[str, Any]":
"""Initialize data class.
This method will be called through the `/initialize` endpoint of the OTE-API
Services.
Parameters:
session: A session-specific dictionary context.
Returns:
Dictionary of key/value-pairs to be stored in the sessions-specific
dictionary context.
"""