Skip to content

Asset Edits Response Dto

immichpy.client.generated.models.asset_edits_response_dto.AssetEditsResponseDto pydantic-model

Bases: BaseModel

AssetEditsResponseDto

Show JSON schema:
{
  "$defs": {
    "AssetEditAction": {
      "description": "Type of edit action to perform",
      "enum": [
        "crop",
        "rotate",
        "mirror"
      ],
      "title": "AssetEditAction",
      "type": "string"
    },
    "AssetEditActionItemDtoParameters": {
      "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"
    },
    "AssetEditActionItemResponseDto": {
      "description": "AssetEditActionItemResponseDto",
      "properties": {
        "action": {
          "$ref": "#/$defs/AssetEditAction"
        },
        "id": {
          "description": "Asset edit ID",
          "format": "uuid",
          "title": "Id",
          "type": "string"
        },
        "parameters": {
          "$ref": "#/$defs/AssetEditActionItemDtoParameters"
        }
      },
      "required": [
        "action",
        "id",
        "parameters"
      ],
      "title": "AssetEditActionItemResponseDto",
      "type": "object"
    },
    "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": "AssetEditsResponseDto",
  "properties": {
    "assetId": {
      "description": "Asset ID these edits belong to",
      "format": "uuid",
      "title": "Assetid",
      "type": "string"
    },
    "edits": {
      "description": "List of edit actions applied to the asset",
      "items": {
        "$ref": "#/$defs/AssetEditActionItemResponseDto"
      },
      "title": "Edits",
      "type": "array"
    }
  },
  "required": [
    "assetId",
    "edits"
  ],
  "title": "AssetEditsResponseDto",
  "type": "object"
}

Config:

  • validate_by_name: True
  • validate_by_alias: True
  • validate_assignment: True
  • protected_namespaces: ()

Fields:

Validators:

asset_id pydantic-field

asset_id: UUID

Asset ID these edits belong to

edits pydantic-field

edits: List[AssetEditActionItemResponseDto]

List of edit actions applied to the asset

asset_id_validate_regular_expression pydantic-validator

asset_id_validate_regular_expression(value)

Validates the regular expression

Source code in immichpy/client/generated/models/asset_edits_response_dto.py
43
44
45
46
47
48
49
50
51
52
53
@field_validator("asset_id", mode="before")
def asset_id_validate_regular_expression(cls, value):
    """Validates the regular expression"""
    if isinstance(value, str) and not re.match(
        r"^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$",
        value,
    ):
        raise ValueError(
            r"must validate the regular expression /^([0-9a-fA-F]{8}-[0-9a-fA-F]{4}-4[0-9a-fA-F]{3}-[89abAB][0-9a-fA-F]{3}-[0-9a-fA-F]{12})$/"
        )
    return value

from_dict classmethod

from_dict(obj: Optional[Dict[str, Any]]) -> Optional[Self]

Create an instance of AssetEditsResponseDto from a dict

Source code in immichpy/client/generated/models/asset_edits_response_dto.py
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
    """Create an instance of AssetEditsResponseDto from a dict"""
    if obj is None:
        return None

    if not isinstance(obj, dict):
        return cls.model_validate(obj)

    _obj = cls.model_validate(
        {
            "assetId": obj.get("assetId"),
            "edits": [
                AssetEditActionItemResponseDto.from_dict(_item)
                for _item in obj["edits"]
            ]
            if obj.get("edits") is not None
            else None,
        }
    )
    return _obj

from_json classmethod

from_json(json_str: str) -> Optional[Self]

Create an instance of AssetEditsResponseDto from a JSON string

Source code in immichpy/client/generated/models/asset_edits_response_dto.py
70
71
72
73
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
    """Create an instance of AssetEditsResponseDto from a JSON string"""
    return cls.from_dict(json.loads(json_str))

to_dict

to_dict() -> Dict[str, Any]

Return the dictionary representation of the model using alias.

This has the following differences from calling pydantic's self.model_dump(by_alias=True):

  • None is only added to the output dict for nullable fields that were set at model initialization. Other fields with value None are ignored.
Source code in immichpy/client/generated/models/asset_edits_response_dto.py
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
def to_dict(self) -> Dict[str, Any]:
    """Return the dictionary representation of the model using alias.

    This has the following differences from calling pydantic's
    `self.model_dump(by_alias=True)`:

    * `None` is only added to the output dict for nullable fields that
      were set at model initialization. Other fields with value `None`
      are ignored.
    """
    excluded_fields: Set[str] = set([])

    _dict = self.model_dump(
        by_alias=True,
        exclude=excluded_fields,
        exclude_none=True,
    )
    # override the default output from pydantic by calling `to_dict()` of each item in edits (list)
    _items = []
    if self.edits:
        for _item_edits in self.edits:
            _items.append(
                _item_edits.to_dict() if _item_edits is not None else None
            )
        _dict["edits"] = _items
    return _dict

to_json

to_json() -> str

Returns the JSON representation of the model using alias

Source code in immichpy/client/generated/models/asset_edits_response_dto.py
66
67
68
def to_json(self) -> str:
    """Returns the JSON representation of the model using alias"""
    return json.dumps(to_jsonable_python(self.to_dict()))

to_str

to_str() -> str

Returns the string representation of the model using alias

Source code in immichpy/client/generated/models/asset_edits_response_dto.py
62
63
64
def to_str(self) -> str:
    """Returns the string representation of the model using alias"""
    return pprint.pformat(self.model_dump(by_alias=True))