feat(server/web): download entire album as zip archive (#897)

* feat(server/web): download entire album as zip archive

* fix: remove duplicate API call

* disable ZIP compression (images are already compressed)
This commit is contained in:
Fynn Petersen-Frey
2022-10-30 18:38:04 +01:00
committed by GitHub
parent b7f1a1ad4b
commit dc2c92e721
12 changed files with 695 additions and 14 deletions

View File

@@ -207,6 +207,54 @@ class AlbumApi {
}
}
/// Performs an HTTP 'GET /album/{albumId}/download' operation and returns the [Response].
/// Parameters:
///
/// * [String] albumId (required):
Future<Response> downloadArchiveWithHttpInfo(String albumId,) async {
// ignore: prefer_const_declarations
final path = r'/album/{albumId}/download'
.replaceAll('{albumId}', albumId);
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [String] albumId (required):
Future<Object?> downloadArchive(String albumId,) async {
final response = await downloadArchiveWithHttpInfo(albumId,);
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) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'Object',) as Object;
}
return null;
}
/// Performs an HTTP 'GET /album/count-by-user-id' operation and returns the [Response].
Future<Response> getAlbumCountByUserIdWithHttpInfo() async {
// ignore: prefer_const_declarations