Skip to content

Album Response Dto

immichpy.client.generated.models.album_response_dto.AlbumResponseDto pydantic-model

Bases: BaseModel

AlbumResponseDto

Show JSON schema:
{
  "$defs": {
    "AlbumUserResponseDto": {
      "description": "AlbumUserResponseDto",
      "properties": {
        "role": {
          "$ref": "#/$defs/AlbumUserRole"
        },
        "user": {
          "$ref": "#/$defs/UserResponseDto"
        }
      },
      "required": [
        "role",
        "user"
      ],
      "title": "AlbumUserResponseDto",
      "type": "object"
    },
    "AlbumUserRole": {
      "description": "Album user role",
      "enum": [
        "editor",
        "owner",
        "viewer"
      ],
      "title": "AlbumUserRole",
      "type": "string"
    },
    "AssetOrder": {
      "description": "Asset sort order",
      "enum": [
        "asc",
        "desc"
      ],
      "title": "AssetOrder",
      "type": "string"
    },
    "ContributorCountResponseDto": {
      "description": "ContributorCountResponseDto",
      "properties": {
        "assetCount": {
          "description": "Number of assets contributed",
          "maximum": 9007199254740991,
          "minimum": 0,
          "title": "Assetcount",
          "type": "integer"
        },
        "userId": {
          "description": "User ID",
          "format": "uuid",
          "title": "Userid",
          "type": "string"
        }
      },
      "required": [
        "assetCount",
        "userId"
      ],
      "title": "ContributorCountResponseDto",
      "type": "object"
    },
    "UserAvatarColor": {
      "description": "User avatar color",
      "enum": [
        "primary",
        "pink",
        "red",
        "yellow",
        "blue",
        "green",
        "purple",
        "orange",
        "gray",
        "amber"
      ],
      "title": "UserAvatarColor",
      "type": "string"
    },
    "UserResponseDto": {
      "description": "UserResponseDto",
      "properties": {
        "avatarColor": {
          "$ref": "#/$defs/UserAvatarColor"
        },
        "email": {
          "description": "User email",
          "title": "Email",
          "type": "string"
        },
        "id": {
          "description": "User ID",
          "format": "uuid",
          "title": "Id",
          "type": "string"
        },
        "name": {
          "description": "User name",
          "title": "Name",
          "type": "string"
        },
        "profileChangedAt": {
          "description": "Profile change date",
          "format": "date-time",
          "title": "Profilechangedat",
          "type": "string"
        },
        "profileImagePath": {
          "description": "Profile image path",
          "title": "Profileimagepath",
          "type": "string"
        }
      },
      "required": [
        "avatarColor",
        "email",
        "id",
        "name",
        "profileChangedAt",
        "profileImagePath"
      ],
      "title": "UserResponseDto",
      "type": "object"
    }
  },
  "description": "AlbumResponseDto",
  "properties": {
    "albumName": {
      "description": "Album name",
      "title": "Albumname",
      "type": "string"
    },
    "albumThumbnailAssetId": {
      "anyOf": [
        {
          "format": "uuid",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "description": "Thumbnail asset ID",
      "title": "Albumthumbnailassetid"
    },
    "albumUsers": {
      "description": "First entry is always the album owner. Second entry is the auth user, if it differs from the owner. The rest are ordered alphabetically.",
      "items": {
        "$ref": "#/$defs/AlbumUserResponseDto"
      },
      "minItems": 1,
      "title": "Albumusers",
      "type": "array"
    },
    "assetCount": {
      "description": "Number of assets",
      "maximum": 9007199254740991,
      "minimum": 0,
      "title": "Assetcount",
      "type": "integer"
    },
    "contributorCounts": {
      "anyOf": [
        {
          "items": {
            "$ref": "#/$defs/ContributorCountResponseDto"
          },
          "type": "array"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "title": "Contributorcounts"
    },
    "createdAt": {
      "description": "Creation date",
      "format": "date-time",
      "title": "Createdat",
      "type": "string"
    },
    "description": {
      "description": "Album description",
      "title": "Description",
      "type": "string"
    },
    "endDate": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "UTC representation of (local) end date (latest asset)",
      "title": "Enddate"
    },
    "hasSharedLink": {
      "description": "Has shared link",
      "title": "Hassharedlink",
      "type": "boolean"
    },
    "id": {
      "description": "Album ID",
      "format": "uuid",
      "title": "Id",
      "type": "string"
    },
    "isActivityEnabled": {
      "description": "Activity feed enabled",
      "title": "Isactivityenabled",
      "type": "boolean"
    },
    "lastModifiedAssetTimestamp": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "Last modified asset timestamp",
      "title": "Lastmodifiedassettimestamp"
    },
    "order": {
      "anyOf": [
        {
          "$ref": "#/$defs/AssetOrder"
        },
        {
          "type": "null"
        }
      ],
      "default": null
    },
    "shared": {
      "description": "Is shared album",
      "title": "Shared",
      "type": "boolean"
    },
    "startDate": {
      "anyOf": [
        {
          "format": "date-time",
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "default": null,
      "description": "UTC representation of (local) start date (earliest asset)",
      "title": "Startdate"
    },
    "updatedAt": {
      "description": "Last update date",
      "format": "date-time",
      "title": "Updatedat",
      "type": "string"
    }
  },
  "required": [
    "albumName",
    "albumThumbnailAssetId",
    "albumUsers",
    "assetCount",
    "createdAt",
    "description",
    "hasSharedLink",
    "id",
    "isActivityEnabled",
    "shared",
    "updatedAt"
  ],
  "title": "AlbumResponseDto",
  "type": "object"
}

Config:

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

Fields:

album_name pydantic-field

album_name: StrictStr

Album name

album_thumbnail_asset_id pydantic-field

album_thumbnail_asset_id: Optional[UUID]

Thumbnail asset ID

created_at pydantic-field

created_at: datetime

Creation date

description pydantic-field

description: StrictStr

Album description

end_date pydantic-field

end_date: Optional[datetime] = None

UTC representation of (local) end date (latest asset)

has_shared_link: StrictBool

Has shared link

id pydantic-field

id: UUID

Album ID

is_activity_enabled pydantic-field

is_activity_enabled: StrictBool

Activity feed enabled

last_modified_asset_timestamp pydantic-field

last_modified_asset_timestamp: Optional[datetime] = None

Last modified asset timestamp

shared pydantic-field

shared: StrictBool

Is shared album

start_date pydantic-field

start_date: Optional[datetime] = None

UTC representation of (local) start date (earliest asset)

updated_at pydantic-field

updated_at: datetime

Last update date

from_dict classmethod

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

Create an instance of AlbumResponseDto from a dict

Source code in immichpy/client/generated/models/album_response_dto.py
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
@classmethod
def from_dict(cls, obj: Optional[Dict[str, Any]]) -> Optional[Self]:
    """Create an instance of AlbumResponseDto from a dict"""
    if obj is None:
        return None

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

    _obj = cls.model_validate(
        {
            "albumName": obj.get("albumName"),
            "albumThumbnailAssetId": obj.get("albumThumbnailAssetId"),
            "albumUsers": [
                AlbumUserResponseDto.from_dict(_item) for _item in obj["albumUsers"]
            ]
            if obj.get("albumUsers") is not None
            else None,
            "assetCount": obj.get("assetCount"),
            "contributorCounts": [
                ContributorCountResponseDto.from_dict(_item)
                for _item in obj["contributorCounts"]
            ]
            if obj.get("contributorCounts") is not None
            else None,
            "createdAt": obj.get("createdAt"),
            "description": obj.get("description"),
            "endDate": obj.get("endDate"),
            "hasSharedLink": obj.get("hasSharedLink"),
            "id": obj.get("id"),
            "isActivityEnabled": obj.get("isActivityEnabled"),
            "lastModifiedAssetTimestamp": obj.get("lastModifiedAssetTimestamp"),
            "order": obj.get("order"),
            "shared": obj.get("shared"),
            "startDate": obj.get("startDate"),
            "updatedAt": obj.get("updatedAt"),
        }
    )
    return _obj

from_json classmethod

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

Create an instance of AlbumResponseDto from a JSON string

Source code in immichpy/client/generated/models/album_response_dto.py
116
117
118
119
@classmethod
def from_json(cls, json_str: str) -> Optional[Self]:
    """Create an instance of AlbumResponseDto 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/album_response_dto.py
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
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 album_users (list)
    _items = []
    if self.album_users:
        for _item_album_users in self.album_users:
            _items.append(
                _item_album_users.to_dict()
                if _item_album_users is not None
                else None
            )
        _dict["albumUsers"] = _items
    # override the default output from pydantic by calling `to_dict()` of each item in contributor_counts (list)
    _items = []
    if self.contributor_counts:
        for _item_contributor_counts in self.contributor_counts:
            _items.append(
                _item_contributor_counts.to_dict()
                if _item_contributor_counts is not None
                else None
            )
        _dict["contributorCounts"] = _items
    # set to None if album_thumbnail_asset_id (nullable) is None
    # and model_fields_set contains the field
    if (
        self.album_thumbnail_asset_id is None
        and "album_thumbnail_asset_id" in self.model_fields_set
    ):
        _dict["albumThumbnailAssetId"] = None

    return _dict

to_json

to_json() -> str

Returns the JSON representation of the model using alias

Source code in immichpy/client/generated/models/album_response_dto.py
112
113
114
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/album_response_dto.py
108
109
110
def to_str(self) -> str:
    """Returns the string representation of the model using alias"""
    return pprint.pformat(self.model_dump(by_alias=True))