diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index 28fa63ba84..6a27009cf9 100644 --- a/mobile/openapi/README.md +++ b/mobile/openapi/README.md @@ -89,6 +89,7 @@ Class | Method | HTTP request | Description *AlbumsApi* | [**getAlbumInfo**](doc//AlbumsApi.md#getalbuminfo) | **GET** /albums/{id} | *AlbumsApi* | [**getAlbumStatistics**](doc//AlbumsApi.md#getalbumstatistics) | **GET** /albums/statistics | *AlbumsApi* | [**getAllAlbums**](doc//AlbumsApi.md#getallalbums) | **GET** /albums | +*AlbumsApi* | [**getAllAlbumsSlim**](doc//AlbumsApi.md#getallalbumsslim) | **GET** /albums/slim | *AlbumsApi* | [**removeAssetFromAlbum**](doc//AlbumsApi.md#removeassetfromalbum) | **DELETE** /albums/{id}/assets | *AlbumsApi* | [**removeUserFromAlbum**](doc//AlbumsApi.md#removeuserfromalbum) | **DELETE** /albums/{id}/user/{userId} | *AlbumsApi* | [**updateAlbumInfo**](doc//AlbumsApi.md#updatealbuminfo) | **PATCH** /albums/{id} | diff --git a/mobile/openapi/lib/api/albums_api.dart b/mobile/openapi/lib/api/albums_api.dart index a8c518ace2..d8fa550db2 100644 --- a/mobile/openapi/lib/api/albums_api.dart +++ b/mobile/openapi/lib/api/albums_api.dart @@ -385,6 +385,69 @@ class AlbumsApi { return null; } + /// Performs an HTTP 'GET /albums/slim' operation and returns the [Response]. + /// Parameters: + /// + /// * [String] assetId: + /// Only returns albums that contain the asset Ignores the shared parameter undefined: get all albums + /// + /// * [bool] shared: + Future getAllAlbumsSlimWithHttpInfo({ String? assetId, bool? shared, }) async { + // ignore: prefer_const_declarations + final apiPath = r'/albums/slim'; + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + if (assetId != null) { + queryParams.addAll(_queryParams('', 'assetId', assetId)); + } + if (shared != null) { + queryParams.addAll(_queryParams('', 'shared', shared)); + } + + const contentTypes = []; + + + return apiClient.invokeAPI( + apiPath, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Parameters: + /// + /// * [String] assetId: + /// Only returns albums that contain the asset Ignores the shared parameter undefined: get all albums + /// + /// * [bool] shared: + Future?> getAllAlbumsSlim({ String? assetId, bool? shared, }) async { + final response = await getAllAlbumsSlimWithHttpInfo( assetId: assetId, shared: shared, ); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + // When a remote server returns no body with a status of 204, we shall not decode it. + // At the time of writing this, `dart:convert` will throw an "Unexpected end of input" + // FormatException when trying to decode an empty string. + if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) { + final responseBody = await _decodeBodyBytes(response); + return (await apiClient.deserializeAsync(responseBody, 'List') as List) + .cast() + .toList(growable: false); + + } + return null; + } + /// Performs an HTTP 'DELETE /albums/{id}/assets' operation and returns the [Response]. /// Parameters: /// diff --git a/server/src/controllers/album.controller.ts b/server/src/controllers/album.controller.ts index 691c1305dc..e21d28af0c 100644 --- a/server/src/controllers/album.controller.ts +++ b/server/src/controllers/album.controller.ts @@ -32,7 +32,6 @@ export class AlbumController { @Authenticated({ permission: Permission.ALBUM_READ }) getAllAlbumsSlim(@Auth() auth: AuthDto, @Query() query: GetAlbumsDto): Promise { return this.service.getAll(auth, query, true); - //asdf } @Post()