DTO Module

Contains the DTOMixin class.

class arrowhead_client.dto.DTOMixin(**data)

Mixin to create data-transfer objects from class.

This class is a customized version of pydantic.BaseModel, which gives it some quirks:

  • When subclassing DTOMixin, you should not specify __init__, instead you use the attribute syntax(?).

  • A subclass of DTOMixin must be instantiated with keyword arguments.

  • A subclass of DTOMixin can alternatively be instantiated with keyword arguments in camelCase form.

For a more detailed explanation of how to use DTOMixin, check the data transfer object user guide.

Create a new model by parsing and validating input data from keyword arguments.

Raises ValidationError if the input data cannot be parsed to form a valid model.

Return type

None

json(exclude_defaults=True, exclude_none=True, by_alias=True, **kwargs)

Generate a JSON representation of the model, include and exclude arguments as per dict().

encoder is an optional function to supply as default to json.dumps(), other arguments as per json.dumps().

Return type

str

arrowhead_client.dto.to_camel_case(variable_name)

Turns snake_case string into camelCase.

Parameters

variable_name (str) – variable name in snake_case_form.

Return type

str

Returns

variable_name in camelCaseForm.

arrowhead_client.dto.to_snake_case(variable_name)

Turns camelCase string into snake_case.

Parameters

variable_name (str) – Variable name in camelCaseForm.

Return type

str

Returns

variable_name in snake_case_form.