class documentation

Base payload converter to/from multiple payloads/values.

Method from_payload Convert a single payload to a value.
Method from_payloads Decode payloads into values.
Method from_payloads_wrapper from_payloads for the temporalio.api.common.v1.Payloads wrapper.
Method to_payload Convert a single value to a payload.
Method to_payloads Encode values into payloads.
Method to_payloads_wrapper to_payloads for the temporalio.api.common.v1.Payloads wrapper.
Class Variable default Default payload converter.

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.PayloadPayload to convert to value.
type_hint:Optional[Type]Optional type hint to say which type to convert to.
Returns
AnySingle converted value.
@abstractmethod
def from_payloads(self, payloads: Sequence[temporalio.api.common.v1.Payload], type_hints: Optional[List[Type]] = None) -> List[Any]: (source)

Decode payloads into values.

Implementers are expected to treat a type hint of temporalio.common.RawValue as just the raw value.

Parameters
payloads:Sequence[temporalio.api.common.v1.Payload]Payloads to convert to Python values.
type_hints:Optional[List[Type]]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[Any]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
ExceptionAny issue during conversion.
def to_payload(self, value: Any) -> temporalio.api.common.v1.Payload: (source)

Convert a single value to a payload.

This is a shortcut for to_payloads with a single-item list and result.

Parameters
value:AnyValue to convert to a single payload.
Returns
temporalio.api.common.v1.PayloadSingle converted payload.

Encode values into payloads.

Implementers are expected to just return the payload for temporalio.common.RawValue.

Parameters
values:Sequence[Any]Values to be converted.
Returns
List[temporalio.api.common.v1.Payload]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
ExceptionAny issue during conversion.

Default payload converter.