Skip to content

Asset Edit Action Item Dto Parameters

immichpy.client.generated.models.asset_edit_action_item_dto_parameters.AssetEditActionItemDtoParameters pydantic-model

AssetEditActionItemDtoParameters(*args, **kwargs)

Bases: BaseModel

List of edit actions to apply (crop, rotate, or mirror)

Show JSON schema:
{
  "$defs": {
    "CropParameters": {
      "description": "CropParameters",
      "properties": {
        "height": {
          "anyOf": [
            {
              "minimum": 1,
              "type": "number"
            },
            {
              "minimum": 1,
              "type": "integer"
            }
          ],
          "description": "Height of the crop",
          "title": "Height"
        },
        "width": {
          "anyOf": [
            {
              "minimum": 1,
              "type": "number"
            },
            {
              "minimum": 1,
              "type": "integer"
            }
          ],
          "description": "Width of the crop",
          "title": "Width"
        },
        "x": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "number"
            },
            {
              "minimum": 0,
              "type": "integer"
            }
          ],
          "description": "Top-Left X coordinate of crop",
          "title": "X"
        },
        "y": {
          "anyOf": [
            {
              "minimum": 0,
              "type": "number"
            },
            {
              "minimum": 0,
              "type": "integer"
            }
          ],
          "description": "Top-Left Y coordinate of crop",
          "title": "Y"
        }
      },
      "required": [
        "height",
        "width",
        "x",
        "y"
      ],
      "title": "CropParameters",
      "type": "object"
    },
    "MirrorAxis": {
      "description": "Axis to mirror along",
      "enum": [
        "horizontal",
        "vertical"
      ],
      "title": "MirrorAxis",
      "type": "string"
    },
    "MirrorParameters": {
      "description": "MirrorParameters",
      "properties": {
        "axis": {
          "$ref": "#/$defs/MirrorAxis"
        }
      },
      "required": [
        "axis"
      ],
      "title": "MirrorParameters",
      "type": "object"
    },
    "RotateParameters": {
      "description": "RotateParameters",
      "properties": {
        "angle": {
          "anyOf": [
            {
              "type": "number"
            },
            {
              "type": "integer"
            }
          ],
          "description": "Rotation angle in degrees",
          "title": "Angle"
        }
      },
      "required": [
        "angle"
      ],
      "title": "RotateParameters",
      "type": "object"
    }
  },
  "description": "List of edit actions to apply (crop, rotate, or mirror)",
  "properties": {
    "anyof_schema_1_validator": {
      "anyOf": [
        {
          "$ref": "#/$defs/CropParameters"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "anyof_schema_2_validator": {
      "anyOf": [
        {
          "$ref": "#/$defs/RotateParameters"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "anyof_schema_3_validator": {
      "anyOf": [
        {
          "$ref": "#/$defs/MirrorParameters"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "actual_instance": {
      "default": null,
      "title": "Actual Instance"
    },
    "any_of_schemas": {
      "default": [
        "CropParameters",
        "MirrorParameters",
        "RotateParameters"
      ],
      "items": {
        "type": "string"
      },
      "title": "Any Of Schemas",
      "type": "array",
      "uniqueItems": true
    }
  },
  "title": "AssetEditActionItemDtoParameters",
  "type": "object"
}

Config:

  • default: {'validate_assignment': True, 'protected_namespaces': ()}

Fields:

Validators:

  • actual_instance_must_validate_anyofactual_instance
Source code in immichpy/client/generated/models/asset_edit_action_item_dto_parameters.py
61
62
63
64
65
66
67
68
69
70
71
72
73
def __init__(self, *args, **kwargs) -> None:
    if args:
        if len(args) > 1:
            raise ValueError(
                "If a position argument is used, only 1 is allowed to set `actual_instance`"
            )
        if kwargs:
            raise ValueError(
                "If a position argument is used, keyword arguments cannot be used."
            )
        super().__init__(actual_instance=args[0])
    else:
        super().__init__(**kwargs)

from_json classmethod

from_json(json_str: str) -> Self

Returns the object represented by the json string

Source code in immichpy/client/generated/models/asset_edit_action_item_dto_parameters.py
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
@classmethod
def from_json(cls, json_str: str) -> Self:
    """Returns the object represented by the json string"""
    instance = cls.model_construct()
    error_messages = []
    # anyof_schema_1_validator: Optional[CropParameters] = None
    try:
        instance.actual_instance = CropParameters.from_json(json_str)
        return instance
    except (ValidationError, ValueError) as e:
        error_messages.append(str(e))
    # anyof_schema_2_validator: Optional[RotateParameters] = None
    try:
        instance.actual_instance = RotateParameters.from_json(json_str)
        return instance
    except (ValidationError, ValueError) as e:
        error_messages.append(str(e))
    # anyof_schema_3_validator: Optional[MirrorParameters] = None
    try:
        instance.actual_instance = MirrorParameters.from_json(json_str)
        return instance
    except (ValidationError, ValueError) as e:
        error_messages.append(str(e))

    if error_messages:
        # no match
        raise ValueError(
            "No match found when deserializing the JSON string into AssetEditActionItemDtoParameters with anyOf schemas: CropParameters, MirrorParameters, RotateParameters. Details: "
            + ", ".join(error_messages)
        )
    else:
        return instance

to_dict

to_dict() -> Optional[Union[Dict[str, Any], CropParameters, MirrorParameters, RotateParameters]]

Returns the dict representation of the actual instance

Source code in immichpy/client/generated/models/asset_edit_action_item_dto_parameters.py
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
def to_dict(
    self,
) -> Optional[
    Union[Dict[str, Any], CropParameters, MirrorParameters, RotateParameters]
]:
    """Returns the dict representation of the actual instance"""
    if self.actual_instance is None:
        return None

    if hasattr(self.actual_instance, "to_dict") and callable(
        self.actual_instance.to_dict
    ):
        return self.actual_instance.to_dict()
    else:
        return self.actual_instance

to_json

to_json() -> str

Returns the JSON representation of the actual instance

Source code in immichpy/client/generated/models/asset_edit_action_item_dto_parameters.py
149
150
151
152
153
154
155
156
157
158
159
def to_json(self) -> str:
    """Returns the JSON representation of the actual instance"""
    if self.actual_instance is None:
        return "null"

    if hasattr(self.actual_instance, "to_json") and callable(
        self.actual_instance.to_json
    ):
        return self.actual_instance.to_json()
    else:
        return json.dumps(self.actual_instance)

to_str

to_str() -> str

Returns the string representation of the actual instance

Source code in immichpy/client/generated/models/asset_edit_action_item_dto_parameters.py
177
178
179
def to_str(self) -> str:
    """Returns the string representation of the actual instance"""
    return pprint.pformat(self.model_dump())