Skip to content

idownloadstrategy

Download Strategy Interface

IDownloadStrategy (Protocol) dataclass

Download Strategy Interface.

Source code in oteapi/interfaces/idownloadstrategy.py
@dataclass  # type: ignore[misc]
@runtime_checkable
class IDownloadStrategy(Protocol):
    """Download 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/idownloadstrategy.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/idownloadstrategy.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.

    """
Back to top