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": {
          "description": "Height of the crop",
          "maximum": 9007199254740991,
          "minimum": 1,
          "title": "Height",
          "type": "integer"
        },
        "width": {
          "description": "Width of the crop",
          "maximum": 9007199254740991,
          "minimum": 1,
          "title": "Width",
          "type": "integer"
        },
        "x": {
          "description": "Top-Left X coordinate of crop",
          "maximum": 9007199254740991,
          "minimum": 0,
          "title": "X",
          "type": "integer"
        },
        "y": {
          "description": "Top-Left Y coordinate of crop",
          "maximum": 9007199254740991,
          "minimum": 0,
          "title": "Y",
          "type": "integer"
        }
      },
      "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": {
          "description": "Rotation angle in degrees",
          "maximum": 270,
          "minimum": 0,
          "title": "Angle",
          "type": "integer"
        }
      },
      "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_anyof → actual_instance
Source code in immichpy/client/generated/models/asset_edit_action_item_dto_parameters.py
70
71
72
73
74
75
76
77
78
79
80
81
82
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
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
@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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
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
158
159
160
161
162
163
164
165
166
167
168
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
186
187
188
def to_str(self) -> str:
    """Returns the string representation of the actual instance"""
    return pprint.pformat(self.model_dump())