class documentation
class PayloadConverter(ABC): (source)
Known subclasses: temporalio.converter.CompositePayloadConverter
Base payload converter to/from multiple payloads/values.
Method | from |
Convert a single payload to a value. |
Method | from |
Decode payloads into values. |
Method | from |
from_payloads for the temporalio.api.common.v1.Payloads wrapper. |
Method | to |
Convert a single value to a payload. |
Method | to |
Encode values into payloads. |
Method | to |
to_payloads for the temporalio.api.common.v1.Payloads wrapper. |
Class Variable | default |
Default payload converter. |
@overload
@overload
@overload
def from_payload(self, payload:
(source)
¶
temporalio.api.common.v1.Payload
, type_hint: Type[ temporalio.types.AnyType]
) -> temporalio.types.AnyType
:Convert a single payload to a value.
This is a shortcut for from_payloads
with a single-item list
and result.
Parameters | |
payload:temporalio.api.common.v1.Payload | Payload to convert to value. |
typeOptional[ | Optional type hint to say which type to convert to. |
Returns | |
Any | Single converted value. |
@abstractmethod
def from_payloads(self, payloads:
def from_payloads(self, payloads:
Sequence[ temporalio.api.common.v1.Payload]
, type_hints: Optional[ List[ Type]]
= None) -> List[ Any]
:
(source)
¶
overridden in
temporalio.converter.CompositePayloadConverter
Decode payloads into values.
Implementers are expected to treat a type hint of
temporalio.common.RawValue
as just the raw value.
Parameters | |
payloads:Sequence[ | Payloads to convert to Python values. |
typeOptional[ | Types that are expected if any. This may not have any types if there are no annotations on the target. If this is present, it must have the exact same length as payloads even if the values are just "object". |
Returns | |
List[ | Collection of Python values. Note, this does not have to be the same number as values given, but at least one must be present. |
Raises | |
Exception | Any issue during conversion. |
def from_payloads_wrapper(self, payloads:
Optional[ temporalio.api.common.v1.Payloads]
) -> List[ Any]
:
(source)
¶
from_payloads
for the
temporalio.api.common.v1.Payloads
wrapper.
Convert a single value to a payload.
This is a shortcut for to_payloads
with a single-item list
and result.
Parameters | |
value:Any | Value to convert to a single payload. |
Returns | |
temporalio.api.common.v1.Payload | Single converted payload. |
@abstractmethod
def to_payloads(self, values:
def to_payloads(self, values:
Sequence[ Any]
) -> List[ temporalio.api.common.v1.Payload]
:
(source)
¶
overridden in
temporalio.converter.CompositePayloadConverter
Encode values into payloads.
Implementers are expected to just return the payload for
temporalio.common.RawValue
.
Parameters | |
values:Sequence[ | Values to be converted. |
Returns | |
List[ | Converted payloads. Note, this does not have to be the same number as values given, but must be at least one and cannot be more than was given. |
Raises | |
Exception | Any issue during conversion. |
def to_payloads_wrapper(self, values:
Sequence[ Any]
) -> temporalio.api.common.v1.Payloads
:
(source)
¶
to_payloads
for the
temporalio.api.common.v1.Payloads
wrapper.