GitHub

ReplyWithContext

API reference for ReplyWithContext.

A reply with the services its schemas need and its RPC.

Attributes

AttributeTypeDescription
replyReply[A_co, E_co]
contextContext[Any] = field(default_factory=(Context.empty))
rpcAnyRpc = _never_rpc

Functions

__init__

__init__(reply, context=Context.empty(), rpc=_never_rpc) -> None
ParameterTypeDescription
replyReply[A_co, E_co]
contextContext[Any] = Context.empty()
rpcAnyRpc = _never_rpc

from_defect

from_defect(*, id, request_id, defect) -> ReplyWithContext

A reply ending request_id with defect, kept as what a defect schema reads back, so it always encodes. A str is stored as a JSON string, as Effect stores a string defect.

ParameterTypeDescription
idSnowflake
request_idSnowflake
defectBaseException | str

Returns ReplyWithContext

@staticmethod
def from_defect(
    *, id: Snowflake, request_id: Snowflake, defect: BaseException | str
) -> ReplyWithContext:
    """A reply ending ``request_id`` with ``defect``, kept as what a
    defect schema reads back, so it always encodes. A ``str`` is stored
    as a JSON string, as Effect stores a string defect."""
    return ReplyWithContext(
        WithExit(request_id=request_id, id=id, exit=exit_.die(_portable_defect(defect))),
    )

interrupt

interrupt(*, id, request_id) -> ReplyWithContext
ParameterTypeDescription
idSnowflake
request_idSnowflake

Returns ReplyWithContext

@staticmethod
def interrupt(*, id: Snowflake, request_id: Snowflake) -> ReplyWithContext:
    return ReplyWithContext(
        WithExit(request_id=request_id, id=id, exit=exit_.interrupt(None)),
    )