mirror of
https://github.com/KevinMidboe/immich.git
synced 2025-10-29 17:40:28 +00:00
feat(server): multi archive downloads (#956)
This commit is contained in:
@@ -211,7 +211,9 @@ class AlbumApi {
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] albumId (required):
|
||||
Future<Response> downloadArchiveWithHttpInfo(String albumId,) async {
|
||||
///
|
||||
/// * [num] skip:
|
||||
Future<Response> downloadArchiveWithHttpInfo(String albumId, { num? skip, }) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/album/{albumId}/download'
|
||||
.replaceAll('{albumId}', albumId);
|
||||
@@ -223,6 +225,10 @@ class AlbumApi {
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
if (skip != null) {
|
||||
queryParams.addAll(_queryParams('', 'skip', skip));
|
||||
}
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
@@ -240,8 +246,10 @@ class AlbumApi {
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] albumId (required):
|
||||
Future<Object?> downloadArchive(String albumId,) async {
|
||||
final response = await downloadArchiveWithHttpInfo(albumId,);
|
||||
///
|
||||
/// * [num] skip:
|
||||
Future<Object?> downloadArchive(String albumId, { num? skip, }) async {
|
||||
final response = await downloadArchiveWithHttpInfo(albumId, skip: skip, );
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
|
||||
@@ -246,6 +246,57 @@ class AssetApi {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /asset/download-library' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [num] skip:
|
||||
Future<Response> downloadLibraryWithHttpInfo({ num? skip, }) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final path = r'/asset/download-library';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
if (skip != null) {
|
||||
queryParams.addAll(_queryParams('', 'skip', skip));
|
||||
}
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
path,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [num] skip:
|
||||
Future<Object?> downloadLibrary({ num? skip, }) async {
|
||||
final response = await downloadLibraryWithHttpInfo( skip: skip, );
|
||||
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;
|
||||
}
|
||||
|
||||
///
|
||||
///
|
||||
/// Get all AssetEntity belong to the user
|
||||
|
||||
@@ -13,32 +13,50 @@ part of openapi.api;
|
||||
class AssetCountByUserIdResponseDto {
|
||||
/// Returns a new [AssetCountByUserIdResponseDto] instance.
|
||||
AssetCountByUserIdResponseDto({
|
||||
required this.photos,
|
||||
required this.videos,
|
||||
this.audio = 0,
|
||||
this.photos = 0,
|
||||
this.videos = 0,
|
||||
this.other = 0,
|
||||
this.total = 0,
|
||||
});
|
||||
|
||||
int audio;
|
||||
|
||||
int photos;
|
||||
|
||||
int videos;
|
||||
|
||||
int other;
|
||||
|
||||
int total;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is AssetCountByUserIdResponseDto &&
|
||||
other.audio == audio &&
|
||||
other.photos == photos &&
|
||||
other.videos == videos;
|
||||
other.videos == videos &&
|
||||
other.other == other &&
|
||||
other.total == total;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(audio.hashCode) +
|
||||
(photos.hashCode) +
|
||||
(videos.hashCode);
|
||||
(videos.hashCode) +
|
||||
(other.hashCode) +
|
||||
(total.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'AssetCountByUserIdResponseDto[photos=$photos, videos=$videos]';
|
||||
String toString() => 'AssetCountByUserIdResponseDto[audio=$audio, photos=$photos, videos=$videos, other=$other, total=$total]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final _json = <String, dynamic>{};
|
||||
_json[r'audio'] = audio;
|
||||
_json[r'photos'] = photos;
|
||||
_json[r'videos'] = videos;
|
||||
_json[r'other'] = other;
|
||||
_json[r'total'] = total;
|
||||
return _json;
|
||||
}
|
||||
|
||||
@@ -61,8 +79,11 @@ class AssetCountByUserIdResponseDto {
|
||||
}());
|
||||
|
||||
return AssetCountByUserIdResponseDto(
|
||||
audio: mapValueOfType<int>(json, r'audio')!,
|
||||
photos: mapValueOfType<int>(json, r'photos')!,
|
||||
videos: mapValueOfType<int>(json, r'videos')!,
|
||||
other: mapValueOfType<int>(json, r'other')!,
|
||||
total: mapValueOfType<int>(json, r'total')!,
|
||||
);
|
||||
}
|
||||
return null;
|
||||
@@ -112,8 +133,11 @@ class AssetCountByUserIdResponseDto {
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'audio',
|
||||
'photos',
|
||||
'videos',
|
||||
'other',
|
||||
'total',
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user