diff --git a/mobile/openapi/lib/api/albums_api.dart b/mobile/openapi/lib/api/albums_api.dart index d08d1cba9d..c18cb10647 100644 --- a/mobile/openapi/lib/api/albums_api.dart +++ b/mobile/openapi/lib/api/albums_api.dart @@ -508,9 +508,12 @@ class AlbumsApi { /// * [String] assetId: /// Filter albums containing this asset ID (ignores shared parameter) /// + /// * [bool] favorite: + /// Filter to only albums favorited by the authenticated user + /// /// * [bool] shared: /// Filter by shared status: true = only shared, false = not shared, undefined = all owned albums - Future getAllAlbumsWithHttpInfo({ String? assetId, bool? shared, }) async { + Future getAllAlbumsWithHttpInfo({ String? assetId, bool? favorite, bool? shared, }) async { // ignore: prefer_const_declarations final apiPath = r'/albums'; @@ -524,6 +527,9 @@ class AlbumsApi { if (assetId != null) { queryParams.addAll(_queryParams('', 'assetId', assetId)); } + if (favorite != null) { + queryParams.addAll(_queryParams('', 'favorite', favorite)); + } if (shared != null) { queryParams.addAll(_queryParams('', 'shared', shared)); } @@ -551,10 +557,13 @@ class AlbumsApi { /// * [String] assetId: /// Filter albums containing this asset ID (ignores shared parameter) /// + /// * [bool] favorite: + /// Filter to only albums favorited by the authenticated user + /// /// * [bool] shared: /// Filter by shared status: true = only shared, false = not shared, undefined = all owned albums - Future?> getAllAlbums({ String? assetId, bool? shared, }) async { - final response = await getAllAlbumsWithHttpInfo( assetId: assetId, shared: shared, ); + Future?> getAllAlbums({ String? assetId, bool? favorite, bool? shared, }) async { + final response = await getAllAlbumsWithHttpInfo( assetId: assetId, favorite: favorite, shared: shared, ); if (response.statusCode >= HttpStatus.badRequest) { throw ApiException(response.statusCode, await _decodeBodyBytes(response)); } diff --git a/mobile/openapi/lib/model/album_response_dto.dart b/mobile/openapi/lib/model/album_response_dto.dart index fd90f23e3a..e44fd76598 100644 --- a/mobile/openapi/lib/model/album_response_dto.dart +++ b/mobile/openapi/lib/model/album_response_dto.dart @@ -24,6 +24,7 @@ class AlbumResponseDto { required this.hasSharedLink, required this.id, required this.isActivityEnabled, + required this.isFavorite, this.lastModifiedAssetTimestamp, this.order, required this.shared, @@ -72,6 +73,9 @@ class AlbumResponseDto { /// Activity feed enabled bool isActivityEnabled; + /// Whether the authenticated user has favorited this album + bool isFavorite; + /// Last modified asset timestamp /// /// Please note: This property should have been non-nullable! Since the specification file @@ -117,6 +121,7 @@ class AlbumResponseDto { other.hasSharedLink == hasSharedLink && other.id == id && other.isActivityEnabled == isActivityEnabled && + other.isFavorite == isFavorite && other.lastModifiedAssetTimestamp == lastModifiedAssetTimestamp && other.order == order && other.shared == shared && @@ -137,6 +142,7 @@ class AlbumResponseDto { (hasSharedLink.hashCode) + (id.hashCode) + (isActivityEnabled.hashCode) + + (isFavorite.hashCode) + (lastModifiedAssetTimestamp == null ? 0 : lastModifiedAssetTimestamp!.hashCode) + (order == null ? 0 : order!.hashCode) + (shared.hashCode) + @@ -144,7 +150,7 @@ class AlbumResponseDto { (updatedAt.hashCode); @override - String toString() => 'AlbumResponseDto[albumName=$albumName, albumThumbnailAssetId=$albumThumbnailAssetId, albumUsers=$albumUsers, assetCount=$assetCount, contributorCounts=$contributorCounts, createdAt=$createdAt, description=$description, endDate=$endDate, hasSharedLink=$hasSharedLink, id=$id, isActivityEnabled=$isActivityEnabled, lastModifiedAssetTimestamp=$lastModifiedAssetTimestamp, order=$order, shared=$shared, startDate=$startDate, updatedAt=$updatedAt]'; + String toString() => 'AlbumResponseDto[albumName=$albumName, albumThumbnailAssetId=$albumThumbnailAssetId, albumUsers=$albumUsers, assetCount=$assetCount, contributorCounts=$contributorCounts, createdAt=$createdAt, description=$description, endDate=$endDate, hasSharedLink=$hasSharedLink, id=$id, isActivityEnabled=$isActivityEnabled, isFavorite=$isFavorite, lastModifiedAssetTimestamp=$lastModifiedAssetTimestamp, order=$order, shared=$shared, startDate=$startDate, updatedAt=$updatedAt]'; Map toJson() { final json = {}; @@ -167,6 +173,7 @@ class AlbumResponseDto { json[r'hasSharedLink'] = this.hasSharedLink; json[r'id'] = this.id; json[r'isActivityEnabled'] = this.isActivityEnabled; + json[r'isFavorite'] = this.isFavorite; if (this.lastModifiedAssetTimestamp != null) { json[r'lastModifiedAssetTimestamp'] = this.lastModifiedAssetTimestamp!.toUtc().toIso8601String(); } else { @@ -207,6 +214,7 @@ class AlbumResponseDto { hasSharedLink: mapValueOfType(json, r'hasSharedLink')!, id: mapValueOfType(json, r'id')!, isActivityEnabled: mapValueOfType(json, r'isActivityEnabled')!, + isFavorite: mapValueOfType(json, r'isFavorite')!, lastModifiedAssetTimestamp: mapDateTime(json, r'lastModifiedAssetTimestamp', r''), order: AssetOrder.fromJson(json[r'order']), shared: mapValueOfType(json, r'shared')!, @@ -268,6 +276,7 @@ class AlbumResponseDto { 'hasSharedLink', 'id', 'isActivityEnabled', + 'isFavorite', 'shared', 'updatedAt', }; diff --git a/mobile/openapi/lib/model/sync_album_user_v1.dart b/mobile/openapi/lib/model/sync_album_user_v1.dart index 1efe7da029..7bd58ea950 100644 --- a/mobile/openapi/lib/model/sync_album_user_v1.dart +++ b/mobile/openapi/lib/model/sync_album_user_v1.dart @@ -14,6 +14,7 @@ class SyncAlbumUserV1 { /// Returns a new [SyncAlbumUserV1] instance. SyncAlbumUserV1({ required this.albumId, + required this.isFavorite, required this.role, required this.userId, }); @@ -21,6 +22,9 @@ class SyncAlbumUserV1 { /// Album ID String albumId; + /// Favorite flag + bool isFavorite; + AlbumUserRole role; /// User ID @@ -29,6 +33,7 @@ class SyncAlbumUserV1 { @override bool operator ==(Object other) => identical(this, other) || other is SyncAlbumUserV1 && other.albumId == albumId && + other.isFavorite == isFavorite && other.role == role && other.userId == userId; @@ -36,15 +41,17 @@ class SyncAlbumUserV1 { int get hashCode => // ignore: unnecessary_parenthesis (albumId.hashCode) + + (isFavorite.hashCode) + (role.hashCode) + (userId.hashCode); @override - String toString() => 'SyncAlbumUserV1[albumId=$albumId, role=$role, userId=$userId]'; + String toString() => 'SyncAlbumUserV1[albumId=$albumId, isFavorite=$isFavorite, role=$role, userId=$userId]'; Map toJson() { final json = {}; json[r'albumId'] = this.albumId; + json[r'isFavorite'] = this.isFavorite; json[r'role'] = this.role; json[r'userId'] = this.userId; return json; @@ -60,6 +67,7 @@ class SyncAlbumUserV1 { return SyncAlbumUserV1( albumId: mapValueOfType(json, r'albumId')!, + isFavorite: mapValueOfType(json, r'isFavorite')!, role: AlbumUserRole.fromJson(json[r'role'])!, userId: mapValueOfType(json, r'userId')!, ); @@ -110,6 +118,7 @@ class SyncAlbumUserV1 { /// The list of required keys that must be present in a JSON. static const requiredKeys = { 'albumId', + 'isFavorite', 'role', 'userId', }; diff --git a/mobile/openapi/lib/model/update_album_user_dto.dart b/mobile/openapi/lib/model/update_album_user_dto.dart index 43218cae6e..a0e7cc97eb 100644 --- a/mobile/openapi/lib/model/update_album_user_dto.dart +++ b/mobile/openapi/lib/model/update_album_user_dto.dart @@ -13,26 +13,53 @@ part of openapi.api; class UpdateAlbumUserDto { /// Returns a new [UpdateAlbumUserDto] instance. UpdateAlbumUserDto({ - required this.role, + this.isFavorite, + this.role, }); - AlbumUserRole role; + /// Mark album as favorite for the user (only the user themselves can update) + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + bool? isFavorite; + + /// + /// Please note: This property should have been non-nullable! Since the specification file + /// does not include a default value (using the "default:" property), however, the generated + /// source code must fall back to having a nullable type. + /// Consider adding a "default:" property in the specification file to hide this note. + /// + AlbumUserRole? role; @override bool operator ==(Object other) => identical(this, other) || other is UpdateAlbumUserDto && + other.isFavorite == isFavorite && other.role == role; @override int get hashCode => // ignore: unnecessary_parenthesis - (role.hashCode); + (isFavorite == null ? 0 : isFavorite!.hashCode) + + (role == null ? 0 : role!.hashCode); @override - String toString() => 'UpdateAlbumUserDto[role=$role]'; + String toString() => 'UpdateAlbumUserDto[isFavorite=$isFavorite, role=$role]'; Map toJson() { final json = {}; + if (this.isFavorite != null) { + json[r'isFavorite'] = this.isFavorite; + } else { + // json[r'isFavorite'] = null; + } + if (this.role != null) { json[r'role'] = this.role; + } else { + // json[r'role'] = null; + } return json; } @@ -45,7 +72,8 @@ class UpdateAlbumUserDto { final json = value.cast(); return UpdateAlbumUserDto( - role: AlbumUserRole.fromJson(json[r'role'])!, + isFavorite: mapValueOfType(json, r'isFavorite'), + role: AlbumUserRole.fromJson(json[r'role']), ); } return null; @@ -93,7 +121,6 @@ class UpdateAlbumUserDto { /// The list of required keys that must be present in a JSON. static const requiredKeys = { - 'role', }; }