What every RPC has (Effect's Rpc.AnyWithProps).
Attributes#
| Attribute | Type | Description |
|---|---|---|
tag | str | |
payload_schema | Top | |
success_schema | Top | |
error_schema | Top | |
defect_schema | Top | |
annotations | Context[Any] = field(default_factory=(Context.empty)) | |
middlewares | tuple[AnyMiddleware, ...] = () | |
key | str | |
is_stream | bool |
Functions#
__init__#
__init__(tag, payload_schema, success_schema, error_schema, defect_schema, annotations=Context.empty(), middlewares=()) -> None| Parameter | Type | Description |
|---|---|---|
tag | str | |
payload_schema | Top | |
success_schema | Top | |
error_schema | Top | |
defect_schema | Top | |
annotations | Context[Any] = Context.empty() | |
middlewares | tuple[AnyMiddleware, ...] = () |
annotate#
annotate[A, T](tag, value) -> Self| Parameter | Type | Description |
|---|---|---|
tag | TagLike[A, T] | |
value | A |
Returns Self
def annotate[A, T](self, tag: TagLike[A, T], value: A) -> Self:
return replace(self, annotations=self.annotations.add(tag, value))annotate_merge#
annotate_merge(annotations) -> Self| Parameter | Type | Description |
|---|---|---|
annotations | Context[Any] |
Returns Self
def annotate_merge(self, annotations: Context[Any]) -> Self:
return replace(self, annotations=self.annotations.merge(annotations))prefix#
prefix(prefix) -> SelfThis RPC with prefix before its tag.
| Parameter | Type | Description |
|---|---|---|
prefix | str |
Returns Self
def prefix(self, prefix: str) -> Self:
"""This RPC with ``prefix`` before its tag."""
return replace(self, tag=prefix + self.tag)with_middleware#
with_middleware(middleware) -> SelfThis RPC wrapped by middleware (untyped: middleware types it).
| Parameter | Type | Description |
|---|---|---|
middleware | AnyMiddleware |
Returns Self
def with_middleware(self, middleware: AnyMiddleware) -> Self:
"""This RPC wrapped by ``middleware`` (untyped: ``middleware`` types it)."""
if middleware in self.middlewares:
return self
return replace(self, middlewares=(*self.middlewares, middleware))pipe#
pipe[B](f) -> B| Parameter | Type | Description |
|---|---|---|
f | Callable[[Self], B] |
Returns B
def pipe[B](self, f: Callable[[Self], B], /) -> B:
return f(self)