Skip to content

Update Asset Dto

immichpy.client.generated.models.update_asset_dto.UpdateAssetDto pydantic-model

Bases: BaseModel

UpdateAssetDto

Show JSON schema:
{
  "$defs": {
    "AssetVisibility": {
      "description": "Asset visibility",
      "enum": [
        "archive",
        "timeline",
        "hidden",
        "locked"
      ],
      "title": "AssetVisibility",
      "type": "string"
    }
  },
  "description": "UpdateAssetDto",
  "properties": {
    "dateTimeOriginal": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Original date and time",
      "title": "Datetimeoriginal"
    },
    "description": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Asset description",
      "title": "Description"
    },
    "isFavorite": {
      "anyOf": [
        {
          "type": "boolean"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Mark as favorite",
      "title": "Isfavorite"
    },
    "latitude": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Latitude coordinate",
      "title": "Latitude"
    },
    "livePhotoVideoId": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Live photo video ID",
      "title": "Livephotovideoid"
    },
    "longitude": {
      "anyOf": [
        {
          "type": "number"
        },
        {
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Longitude coordinate",
      "title": "Longitude"
    },
    "rating": {
      "anyOf": [
        {
          "maximum": 5,
          "minimum": -1,
          "type": "number"
        },
        {
          "maximum": 5,
          "minimum": -1,
          "type": "integer"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Rating in range [1-5], or null for unrated",
      "title": "Rating"
    },
    "visibility": {
      "anyOf": [
        {
          "$ref": "#/$defs/AssetVisibility"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Asset visibility"
    }
  },
  "title": "UpdateAssetDto",
  "type": "object"
}

Config:

  • populate_by_name: True
  • validate_assignment: True
  • protected_namespaces: ()

Fields:

date_time_original pydantic-field

date_time_original: Optional[StrictStr] = None

Original date and time

description pydantic-field

description: Optional[StrictStr] = None

Asset description

is_favorite pydantic-field

is_favorite: Optional[StrictBool] = None

Mark as favorite

latitude pydantic-field

latitude: Optional[Union[StrictFloat, StrictInt]] = None

Latitude coordinate

live_photo_video_id pydantic-field

live_photo_video_id: Optional[UUID] = None

Live photo video ID

longitude pydantic-field

longitude: Optional[Union[StrictFloat, StrictInt]] = None

Longitude coordinate

rating pydantic-field

rating: Optional[Union[Annotated[float, Field(le=5, strict=True, ge=-1)], Annotated[int, Field(le=5, strict=True, ge=-1)]]] = None

Rating in range [1-5], or null for unrated

visibility pydantic-field

visibility: Optional[AssetVisibility] = None

Asset visibility

from_dict classmethod

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

Create an instance of UpdateAssetDto from a dict

Source code in immichpy/client/generated/models/update_asset_dto.py
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
    """Create an instance of UpdateAssetDto from a dict"""
    if obj is None:
        return None

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

    _obj = cls.model_validate(
        {
            "dateTimeOriginal": obj.get("dateTimeOriginal"),
            "description": obj.get("description"),
            "isFavorite": obj.get("isFavorite"),
            "latitude": obj.get("latitude"),
            "livePhotoVideoId": obj.get("livePhotoVideoId"),
            "longitude": obj.get("longitude"),
            "rating": obj.get("rating"),
            "visibility": obj.get("visibility"),
        }
    )
    return _obj

from_json classmethod

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

Create an instance of UpdateAssetDto from a JSON string

Source code in immichpy/client/generated/models/update_asset_dto.py
94
95
96
97
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
    """Create an instance of UpdateAssetDto 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/update_asset_dto.py
 99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
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,
    )
    # set to None if live_photo_video_id (nullable) is None
    # and model_fields_set contains the field
    if (
        self.live_photo_video_id is None
        and "live_photo_video_id" in self.model_fields_set
    ):
        _dict["livePhotoVideoId"] = None

    # set to None if rating (nullable) is None
    # and model_fields_set contains the field
    if self.rating is None and "rating" in self.model_fields_set:
        _dict["rating"] = None

    return _dict

to_json

to_json() -> str

Returns the JSON representation of the model using alias

Source code in immichpy/client/generated/models/update_asset_dto.py
89
90
91
92
def to_json(self) -> str:
    """Returns the JSON representation of the model using alias"""
    # TODO: pydantic v2: use .model_dump_json(by_alias=True, exclude_unset=True) instead
    return json.dumps(self.to_dict())

to_str

to_str() -> str

Returns the string representation of the model using alias

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