sinch.core.models package

sinch.core.models.model_dump_for_query_params(model, exclude_none=True, by_alias=True, exclude=None)[source]

Serializes a Pydantic model for use as query parameters. Converts list values to comma-separated strings for APIs that expect this format. Filters out empty values (empty strings and empty lists).

Parameters:
  • model (BaseModel) – A Pydantic BaseModel instance

  • exclude_none (bool) – Whether to exclude None values (default: True)

  • by_alias (bool) – Whether to use field aliases (default: True)

  • exclude (set[str] | None) – Field names to omit (e.g. URL path params), passed to model_dump

Returns:

Serialized model data with lists converted to comma-separated strings

Return type:

dict

sinch.core.models.serialize_datetime_in_dict(
value: Dict[str, Any] | None,
) Dict[str, Any] | None[source]

Serialize datetime/date objects in a dictionary to ISO 8601 date strings.

Parameters:

value (Optional[Dict[str, Any]]) – Optional dictionary that may contain datetime/date objects

Returns:

Dictionary with datetime/date objects converted to ISO 8601 date strings, or None if input is None

Return type:

Optional[Dict[str, Any]]