benchling_sdk.helpers.serialization_helpers module

class DeserializableModel

Bases: dataclasses_json.api.DataClassJsonMixin

Provide an interface for deserialization to a custom model.

For deserializing models when using raw API calls (e.g., Benchling.api) Override deserialize() for customized behavior.

__init__() None
classmethod deserialize(source_dict: Dict[str, Any]) benchling_sdk.helpers.serialization_helpers.D

Deserialize the input dictionary into the model.

class DeserializableModelNoContent

Bases: benchling_sdk.helpers.serialization_helpers.DeserializableModel

Provide an interface deserialization to a custom model when the response may be empty.

__init__() None
class SerializableModel

Bases: dataclasses_json.api.DataClassJsonMixin

Provide an interface for serialization of a custom model.

For serializing models when using raw API calls (e.g., Benchling.api). Override serialize() for customized behavior.

__init__() None
serialize() Dict[str, Any]

Serialize the class attributes into a dict.

array_query_param(inputs: Iterable[str]) str

Collapse an Iterable to a comma-separated string.

custom_fields(source: Dict[str, Any]) CustomFields

Marshal a dictionary into a CustomFields object.

fields(source: Dict[str, Dict[str, Any]]) Fields

Marshal a dictionary into a Fields object.

none_as_unset(val: Optional[benchling_sdk.helpers.serialization_helpers.T]) Union[benchling_sdk.helpers.serialization_helpers.T, benchling_api_client.v2.types.Unset]

Convert a value to UNSET if None safely.

optional_array_query_param(inputs: Optional[Iterable[str]]) Optional[str]

Collapse an Iterable to a comma-separated string if present.

schema_fields_query_param(schema_fields: Optional[Dict[str, Any]]) Optional[SchemaFieldsQueryParam]

Prefix keys with ‘schemaField’ for querying fields in list endpoints.

unset_as_none(source: Union[benchling_api_client.v2.types.Unset, None, benchling_sdk.helpers.serialization_helpers.T]) Optional[benchling_sdk.helpers.serialization_helpers.T]

Given a value that may be UNSET, produces an Optional[] where UNSET will be treated as None.