Skip to content

iresourcestrategy

Resource Strategy Interface

IResourceStrategy dataclass

Bases: Protocol

Resource Strategy Interface.

Source code in oteapi/interfaces/iresourcestrategy.py
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
@dataclass  # type: ignore[misc]
class IResourceStrategy(Protocol):
    """Resource Strategy Interface."""

    resource_config: "ResourceConfig"

    def get(self, session: "Optional[Dict[str, Any]]" = None) -> "SessionUpdate":
        """Execute the strategy.

        Parameters:
            session: A session-specific dictionary context.

        Returns:
            An update model of key/value-pairs to be stored in the
            session-specific context from services.

        """

    def initialize(self, session: "Optional[Dict[str, Any]]" = None) -> "SessionUpdate":
        """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:
            An update model of key/value-pairs to be stored in the
            session-specific context from services.

        """

get(session=None)

Execute the strategy.

Parameters:

Name Type Description Default
session Optional[Dict[str, Any]]

A session-specific dictionary context.

None

Returns:

Type Description
SessionUpdate

An update model of key/value-pairs to be stored in the

SessionUpdate

session-specific context from services.

Source code in oteapi/interfaces/iresourcestrategy.py
17
18
19
20
21
22
23
24
25
26
27
def get(self, session: "Optional[Dict[str, Any]]" = None) -> "SessionUpdate":
    """Execute the strategy.

    Parameters:
        session: A session-specific dictionary context.

    Returns:
        An update model of key/value-pairs to be stored in the
        session-specific context from services.

    """

initialize(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
SessionUpdate

An update model of key/value-pairs to be stored in the

SessionUpdate

session-specific context from services.

Source code in oteapi/interfaces/iresourcestrategy.py
29
30
31
32
33
34
35
36
37
38
39
40
41
42
def initialize(self, session: "Optional[Dict[str, Any]]" = None) -> "SessionUpdate":
    """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:
        An update model of key/value-pairs to be stored in the
        session-specific context from services.

    """