1
0
mirror of https://github.com/immich-app/immich.git synced 2025-08-09 23:17:29 +02:00

refactor(server): download assets (#3032)

* refactor: download assets

* chore: open api

* chore: finish tests, make size configurable

* chore: defualt to 4GiB

* chore: open api

* fix: optional archive size

* fix: bugs

* chore: cleanup
This commit is contained in:
Jason Rasmussen
2023-06-30 12:24:28 -04:00
committed by GitHub
parent df9c05bef3
commit ad343b7b32
53 changed files with 1455 additions and 1403 deletions

View File

@@ -45,7 +45,8 @@ doc/CuratedObjectsResponseDto.md
doc/DeleteAssetDto.md
doc/DeleteAssetResponseDto.md
doc/DeleteAssetStatus.md
doc/DownloadFilesDto.md
doc/DownloadArchiveInfo.md
doc/DownloadResponseDto.md
doc/ExifResponseDto.md
doc/GetAssetByTimeBucketDto.md
doc/GetAssetCountByTimeBucketDto.md
@@ -178,7 +179,8 @@ lib/model/curated_objects_response_dto.dart
lib/model/delete_asset_dto.dart
lib/model/delete_asset_response_dto.dart
lib/model/delete_asset_status.dart
lib/model/download_files_dto.dart
lib/model/download_archive_info.dart
lib/model/download_response_dto.dart
lib/model/exif_response_dto.dart
lib/model/get_asset_by_time_bucket_dto.dart
lib/model/get_asset_count_by_time_bucket_dto.dart
@@ -282,7 +284,8 @@ test/curated_objects_response_dto_test.dart
test/delete_asset_dto_test.dart
test/delete_asset_response_dto_test.dart
test/delete_asset_status_test.dart
test/download_files_dto_test.dart
test/download_archive_info_test.dart
test/download_response_dto_test.dart
test/exif_response_dto_test.dart
test/get_asset_by_time_bucket_dto_test.dart
test/get_asset_count_by_time_bucket_dto_test.dart

View File

@@ -81,7 +81,6 @@ Class | Method | HTTP request | Description
*AlbumApi* | [**addUsersToAlbum**](doc//AlbumApi.md#adduserstoalbum) | **PUT** /album/{id}/users |
*AlbumApi* | [**createAlbum**](doc//AlbumApi.md#createalbum) | **POST** /album |
*AlbumApi* | [**deleteAlbum**](doc//AlbumApi.md#deletealbum) | **DELETE** /album/{id} |
*AlbumApi* | [**downloadArchive**](doc//AlbumApi.md#downloadarchive) | **GET** /album/{id}/download |
*AlbumApi* | [**getAlbumCount**](doc//AlbumApi.md#getalbumcount) | **GET** /album/count |
*AlbumApi* | [**getAlbumInfo**](doc//AlbumApi.md#getalbuminfo) | **GET** /album/{id} |
*AlbumApi* | [**getAllAlbums**](doc//AlbumApi.md#getallalbums) | **GET** /album |
@@ -92,9 +91,8 @@ Class | Method | HTTP request | Description
*AssetApi* | [**checkDuplicateAsset**](doc//AssetApi.md#checkduplicateasset) | **POST** /asset/check |
*AssetApi* | [**checkExistingAssets**](doc//AssetApi.md#checkexistingassets) | **POST** /asset/exist |
*AssetApi* | [**deleteAsset**](doc//AssetApi.md#deleteasset) | **DELETE** /asset |
*AssetApi* | [**downloadFile**](doc//AssetApi.md#downloadfile) | **GET** /asset/download/{id} |
*AssetApi* | [**downloadFiles**](doc//AssetApi.md#downloadfiles) | **POST** /asset/download-files |
*AssetApi* | [**downloadLibrary**](doc//AssetApi.md#downloadlibrary) | **GET** /asset/download-library |
*AssetApi* | [**downloadArchive**](doc//AssetApi.md#downloadarchive) | **POST** /asset/download |
*AssetApi* | [**downloadFile**](doc//AssetApi.md#downloadfile) | **POST** /asset/download/{id} |
*AssetApi* | [**getAllAssets**](doc//AssetApi.md#getallassets) | **GET** /asset |
*AssetApi* | [**getArchivedAssetCountByUserId**](doc//AssetApi.md#getarchivedassetcountbyuserid) | **GET** /asset/stat/archive |
*AssetApi* | [**getAssetById**](doc//AssetApi.md#getassetbyid) | **GET** /asset/assetById/{id} |
@@ -105,6 +103,7 @@ Class | Method | HTTP request | Description
*AssetApi* | [**getAssetThumbnail**](doc//AssetApi.md#getassetthumbnail) | **GET** /asset/thumbnail/{id} |
*AssetApi* | [**getCuratedLocations**](doc//AssetApi.md#getcuratedlocations) | **GET** /asset/curated-locations |
*AssetApi* | [**getCuratedObjects**](doc//AssetApi.md#getcuratedobjects) | **GET** /asset/curated-objects |
*AssetApi* | [**getDownloadInfo**](doc//AssetApi.md#getdownloadinfo) | **GET** /asset/download |
*AssetApi* | [**getMapMarkers**](doc//AssetApi.md#getmapmarkers) | **GET** /asset/map-marker |
*AssetApi* | [**getMemoryLane**](doc//AssetApi.md#getmemorylane) | **GET** /asset/memory-lane |
*AssetApi* | [**getUserAssetsByDeviceId**](doc//AssetApi.md#getuserassetsbydeviceid) | **GET** /asset/{deviceId} |
@@ -215,7 +214,8 @@ Class | Method | HTTP request | Description
- [DeleteAssetDto](doc//DeleteAssetDto.md)
- [DeleteAssetResponseDto](doc//DeleteAssetResponseDto.md)
- [DeleteAssetStatus](doc//DeleteAssetStatus.md)
- [DownloadFilesDto](doc//DownloadFilesDto.md)
- [DownloadArchiveInfo](doc//DownloadArchiveInfo.md)
- [DownloadResponseDto](doc//DownloadResponseDto.md)
- [ExifResponseDto](doc//ExifResponseDto.md)
- [GetAssetByTimeBucketDto](doc//GetAssetByTimeBucketDto.md)
- [GetAssetCountByTimeBucketDto](doc//GetAssetCountByTimeBucketDto.md)

View File

@@ -13,7 +13,6 @@ Method | HTTP request | Description
[**addUsersToAlbum**](AlbumApi.md#adduserstoalbum) | **PUT** /album/{id}/users |
[**createAlbum**](AlbumApi.md#createalbum) | **POST** /album |
[**deleteAlbum**](AlbumApi.md#deletealbum) | **DELETE** /album/{id} |
[**downloadArchive**](AlbumApi.md#downloadarchive) | **GET** /album/{id}/download |
[**getAlbumCount**](AlbumApi.md#getalbumcount) | **GET** /album/count |
[**getAlbumInfo**](AlbumApi.md#getalbuminfo) | **GET** /album/{id} |
[**getAllAlbums**](AlbumApi.md#getallalbums) | **GET** /album |
@@ -247,67 +246,6 @@ void (empty response body)
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **downloadArchive**
> MultipartFile downloadArchive(id, name, skip, key)
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = AlbumApi();
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final name = name_example; // String |
final skip = 8.14; // num |
final key = key_example; // String |
try {
final result = api_instance.downloadArchive(id, name, skip, key);
print(result);
} catch (e) {
print('Exception when calling AlbumApi->downloadArchive: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**id** | **String**| |
**name** | **String**| | [optional]
**skip** | **num**| | [optional]
**key** | **String**| | [optional]
### Return type
[**MultipartFile**](MultipartFile.md)
### Authorization
[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/zip
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getAlbumCount**
> AlbumCountResponseDto getAlbumCount()

View File

@@ -13,9 +13,8 @@ Method | HTTP request | Description
[**checkDuplicateAsset**](AssetApi.md#checkduplicateasset) | **POST** /asset/check |
[**checkExistingAssets**](AssetApi.md#checkexistingassets) | **POST** /asset/exist |
[**deleteAsset**](AssetApi.md#deleteasset) | **DELETE** /asset |
[**downloadFile**](AssetApi.md#downloadfile) | **GET** /asset/download/{id} |
[**downloadFiles**](AssetApi.md#downloadfiles) | **POST** /asset/download-files |
[**downloadLibrary**](AssetApi.md#downloadlibrary) | **GET** /asset/download-library |
[**downloadArchive**](AssetApi.md#downloadarchive) | **POST** /asset/download |
[**downloadFile**](AssetApi.md#downloadfile) | **POST** /asset/download/{id} |
[**getAllAssets**](AssetApi.md#getallassets) | **GET** /asset |
[**getArchivedAssetCountByUserId**](AssetApi.md#getarchivedassetcountbyuserid) | **GET** /asset/stat/archive |
[**getAssetById**](AssetApi.md#getassetbyid) | **GET** /asset/assetById/{id} |
@@ -26,6 +25,7 @@ Method | HTTP request | Description
[**getAssetThumbnail**](AssetApi.md#getassetthumbnail) | **GET** /asset/thumbnail/{id} |
[**getCuratedLocations**](AssetApi.md#getcuratedlocations) | **GET** /asset/curated-locations |
[**getCuratedObjects**](AssetApi.md#getcuratedobjects) | **GET** /asset/curated-objects |
[**getDownloadInfo**](AssetApi.md#getdownloadinfo) | **GET** /asset/download |
[**getMapMarkers**](AssetApi.md#getmapmarkers) | **GET** /asset/map-marker |
[**getMemoryLane**](AssetApi.md#getmemorylane) | **GET** /asset/memory-lane |
[**getUserAssetsByDeviceId**](AssetApi.md#getuserassetsbydeviceid) | **GET** /asset/{deviceId} |
@@ -264,6 +264,63 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **downloadArchive**
> MultipartFile downloadArchive(assetIdsDto, key)
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = AssetApi();
final assetIdsDto = AssetIdsDto(); // AssetIdsDto |
final key = key_example; // String |
try {
final result = api_instance.downloadArchive(assetIdsDto, key);
print(result);
} catch (e) {
print('Exception when calling AssetApi->downloadArchive: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**assetIdsDto** | [**AssetIdsDto**](AssetIdsDto.md)| |
**key** | **String**| | [optional]
### Return type
[**MultipartFile**](MultipartFile.md)
### Authorization
[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/octet-stream
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **downloadFile**
> MultipartFile downloadFile(id, key)
@@ -321,124 +378,6 @@ Name | Type | Description | Notes
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **downloadFiles**
> MultipartFile downloadFiles(downloadFilesDto, key)
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = AssetApi();
final downloadFilesDto = DownloadFilesDto(); // DownloadFilesDto |
final key = key_example; // String |
try {
final result = api_instance.downloadFiles(downloadFilesDto, key);
print(result);
} catch (e) {
print('Exception when calling AssetApi->downloadFiles: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**downloadFilesDto** | [**DownloadFilesDto**](DownloadFilesDto.md)| |
**key** | **String**| | [optional]
### Return type
[**MultipartFile**](MultipartFile.md)
### Authorization
[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: application/json
- **Accept**: application/octet-stream
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **downloadLibrary**
> MultipartFile downloadLibrary(name, skip, key)
Current this is not used in any UI element
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = AssetApi();
final name = name_example; // String |
final skip = 8.14; // num |
final key = key_example; // String |
try {
final result = api_instance.downloadLibrary(name, skip, key);
print(result);
} catch (e) {
print('Exception when calling AssetApi->downloadLibrary: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**name** | **String**| | [optional]
**skip** | **num**| | [optional]
**key** | **String**| | [optional]
### Return type
[**MultipartFile**](MultipartFile.md)
### Authorization
[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/octet-stream
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getAllAssets**
> List<AssetResponseDto> getAllAssets(userId, isFavorite, isArchived, withoutThumbs, skip, ifNoneMatch)
@@ -989,6 +928,69 @@ This endpoint does not need any parameter.
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getDownloadInfo**
> DownloadResponseDto getDownloadInfo(assetIds, albumId, userId, archiveSize, key)
### Example
```dart
import 'package:openapi/api.dart';
// TODO Configure API key authorization: cookie
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = AssetApi();
final assetIds = []; // List<String> |
final albumId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final userId = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
final archiveSize = 8.14; // num |
final key = key_example; // String |
try {
final result = api_instance.getDownloadInfo(assetIds, albumId, userId, archiveSize, key);
print(result);
} catch (e) {
print('Exception when calling AssetApi->getDownloadInfo: $e\n');
}
```
### Parameters
Name | Type | Description | Notes
------------- | ------------- | ------------- | -------------
**assetIds** | [**List<String>**](String.md)| | [optional] [default to const []]
**albumId** | **String**| | [optional]
**userId** | **String**| | [optional]
**archiveSize** | **num**| | [optional]
**key** | **String**| | [optional]
### Return type
[**DownloadResponseDto**](DownloadResponseDto.md)
### Authorization
[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer)
### HTTP request headers
- **Content-Type**: Not defined
- **Accept**: application/json
[[Back to top]](#) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to Model list]](../README.md#documentation-for-models) [[Back to README]](../README.md)
# **getMapMarkers**
> List<MapMarkerResponseDto> getMapMarkers(isFavorite, fileCreatedAfter, fileCreatedBefore)

View File

@@ -1,4 +1,4 @@
# openapi.model.DownloadFilesDto
# openapi.model.DownloadArchiveInfo
## Load the model package
```dart
@@ -8,6 +8,7 @@ import 'package:openapi/api.dart';
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**size** | **int** | |
**assetIds** | **List<String>** | | [default to const []]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -0,0 +1,16 @@
# openapi.model.DownloadResponseDto
## Load the model package
```dart
import 'package:openapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**totalSize** | **int** | |
**archives** | [**List<DownloadArchiveInfo>**](DownloadArchiveInfo.md) | | [default to const []]
[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md)

View File

@@ -81,7 +81,8 @@ part 'model/curated_objects_response_dto.dart';
part 'model/delete_asset_dto.dart';
part 'model/delete_asset_response_dto.dart';
part 'model/delete_asset_status.dart';
part 'model/download_files_dto.dart';
part 'model/download_archive_info.dart';
part 'model/download_response_dto.dart';
part 'model/exif_response_dto.dart';
part 'model/get_asset_by_time_bucket_dto.dart';
part 'model/get_asset_count_by_time_bucket_dto.dart';

View File

@@ -215,76 +215,6 @@ class AlbumApi {
}
}
/// Performs an HTTP 'GET /album/{id}/download' operation and returns the [Response].
/// Parameters:
///
/// * [String] id (required):
///
/// * [String] name:
///
/// * [num] skip:
///
/// * [String] key:
Future<Response> downloadArchiveWithHttpInfo(String id, { String? name, num? skip, String? key, }) async {
// ignore: prefer_const_declarations
final path = r'/album/{id}/download'
.replaceAll('{id}', id);
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (name != null) {
queryParams.addAll(_queryParams('', 'name', name));
}
if (skip != null) {
queryParams.addAll(_queryParams('', 'skip', skip));
}
if (key != null) {
queryParams.addAll(_queryParams('', 'key', key));
}
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [String] id (required):
///
/// * [String] name:
///
/// * [num] skip:
///
/// * [String] key:
Future<MultipartFile?> downloadArchive(String id, { String? name, num? skip, String? key, }) async {
final response = await downloadArchiveWithHttpInfo(id, name: name, skip: skip, key: key, );
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), 'MultipartFile',) as MultipartFile;
}
return null;
}
/// Performs an HTTP 'GET /album/count' operation and returns the [Response].
Future<Response> getAlbumCountWithHttpInfo() async {
// ignore: prefer_const_declarations

View File

@@ -230,7 +230,62 @@ class AssetApi {
return null;
}
/// Performs an HTTP 'GET /asset/download/{id}' operation and returns the [Response].
/// Performs an HTTP 'POST /asset/download' operation and returns the [Response].
/// Parameters:
///
/// * [AssetIdsDto] assetIdsDto (required):
///
/// * [String] key:
Future<Response> downloadArchiveWithHttpInfo(AssetIdsDto assetIdsDto, { String? key, }) async {
// ignore: prefer_const_declarations
final path = r'/asset/download';
// ignore: prefer_final_locals
Object? postBody = assetIdsDto;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (key != null) {
queryParams.addAll(_queryParams('', 'key', key));
}
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [AssetIdsDto] assetIdsDto (required):
///
/// * [String] key:
Future<MultipartFile?> downloadArchive(AssetIdsDto assetIdsDto, { String? key, }) async {
final response = await downloadArchiveWithHttpInfo(assetIdsDto, key: key, );
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), 'MultipartFile',) as MultipartFile;
}
return null;
}
/// Performs an HTTP 'POST /asset/download/{id}' operation and returns the [Response].
/// Parameters:
///
/// * [String] id (required):
@@ -257,7 +312,7 @@ class AssetApi {
return apiClient.invokeAPI(
path,
'GET',
'POST',
queryParams,
postBody,
headerParams,
@@ -286,131 +341,6 @@ class AssetApi {
return null;
}
/// Performs an HTTP 'POST /asset/download-files' operation and returns the [Response].
/// Parameters:
///
/// * [DownloadFilesDto] downloadFilesDto (required):
///
/// * [String] key:
Future<Response> downloadFilesWithHttpInfo(DownloadFilesDto downloadFilesDto, { String? key, }) async {
// ignore: prefer_const_declarations
final path = r'/asset/download-files';
// ignore: prefer_final_locals
Object? postBody = downloadFilesDto;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (key != null) {
queryParams.addAll(_queryParams('', 'key', key));
}
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [DownloadFilesDto] downloadFilesDto (required):
///
/// * [String] key:
Future<MultipartFile?> downloadFiles(DownloadFilesDto downloadFilesDto, { String? key, }) async {
final response = await downloadFilesWithHttpInfo(downloadFilesDto, key: key, );
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), 'MultipartFile',) as MultipartFile;
}
return null;
}
/// Current this is not used in any UI element
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [String] name:
///
/// * [num] skip:
///
/// * [String] key:
Future<Response> downloadLibraryWithHttpInfo({ String? name, num? skip, String? key, }) 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 (name != null) {
queryParams.addAll(_queryParams('', 'name', name));
}
if (skip != null) {
queryParams.addAll(_queryParams('', 'skip', skip));
}
if (key != null) {
queryParams.addAll(_queryParams('', 'key', key));
}
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Current this is not used in any UI element
///
/// Parameters:
///
/// * [String] name:
///
/// * [num] skip:
///
/// * [String] key:
Future<MultipartFile?> downloadLibrary({ String? name, num? skip, String? key, }) async {
final response = await downloadLibraryWithHttpInfo( name: name, skip: skip, key: key, );
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), 'MultipartFile',) as MultipartFile;
}
return null;
}
/// Get all AssetEntity belong to the user
///
/// Note: This method returns the HTTP [Response].
@@ -945,6 +875,85 @@ class AssetApi {
return null;
}
/// Performs an HTTP 'GET /asset/download' operation and returns the [Response].
/// Parameters:
///
/// * [List<String>] assetIds:
///
/// * [String] albumId:
///
/// * [String] userId:
///
/// * [num] archiveSize:
///
/// * [String] key:
Future<Response> getDownloadInfoWithHttpInfo({ List<String>? assetIds, String? albumId, String? userId, num? archiveSize, String? key, }) async {
// ignore: prefer_const_declarations
final path = r'/asset/download';
// ignore: prefer_final_locals
Object? postBody;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
if (assetIds != null) {
queryParams.addAll(_queryParams('multi', 'assetIds', assetIds));
}
if (albumId != null) {
queryParams.addAll(_queryParams('', 'albumId', albumId));
}
if (userId != null) {
queryParams.addAll(_queryParams('', 'userId', userId));
}
if (archiveSize != null) {
queryParams.addAll(_queryParams('', 'archiveSize', archiveSize));
}
if (key != null) {
queryParams.addAll(_queryParams('', 'key', key));
}
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [List<String>] assetIds:
///
/// * [String] albumId:
///
/// * [String] userId:
///
/// * [num] archiveSize:
///
/// * [String] key:
Future<DownloadResponseDto?> getDownloadInfo({ List<String>? assetIds, String? albumId, String? userId, num? archiveSize, String? key, }) async {
final response = await getDownloadInfoWithHttpInfo( assetIds: assetIds, albumId: albumId, userId: userId, archiveSize: archiveSize, key: key, );
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), 'DownloadResponseDto',) as DownloadResponseDto;
}
return null;
}
/// Performs an HTTP 'GET /asset/map-marker' operation and returns the [Response].
/// Parameters:
///

View File

@@ -257,8 +257,10 @@ class ApiClient {
return DeleteAssetResponseDto.fromJson(value);
case 'DeleteAssetStatus':
return DeleteAssetStatusTypeTransformer().decode(value);
case 'DownloadFilesDto':
return DownloadFilesDto.fromJson(value);
case 'DownloadArchiveInfo':
return DownloadArchiveInfo.fromJson(value);
case 'DownloadResponseDto':
return DownloadResponseDto.fromJson(value);
case 'ExifResponseDto':
return ExifResponseDto.fromJson(value);
case 'GetAssetByTimeBucketDto':

View File

@@ -10,40 +10,47 @@
part of openapi.api;
class DownloadFilesDto {
/// Returns a new [DownloadFilesDto] instance.
DownloadFilesDto({
class DownloadArchiveInfo {
/// Returns a new [DownloadArchiveInfo] instance.
DownloadArchiveInfo({
required this.size,
this.assetIds = const [],
});
int size;
List<String> assetIds;
@override
bool operator ==(Object other) => identical(this, other) || other is DownloadFilesDto &&
bool operator ==(Object other) => identical(this, other) || other is DownloadArchiveInfo &&
other.size == size &&
other.assetIds == assetIds;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(size.hashCode) +
(assetIds.hashCode);
@override
String toString() => 'DownloadFilesDto[assetIds=$assetIds]';
String toString() => 'DownloadArchiveInfo[size=$size, assetIds=$assetIds]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'size'] = this.size;
json[r'assetIds'] = this.assetIds;
return json;
}
/// Returns a new [DownloadFilesDto] instance and imports its values from
/// Returns a new [DownloadArchiveInfo] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static DownloadFilesDto? fromJson(dynamic value) {
static DownloadArchiveInfo? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return DownloadFilesDto(
return DownloadArchiveInfo(
size: mapValueOfType<int>(json, r'size')!,
assetIds: json[r'assetIds'] is Iterable
? (json[r'assetIds'] as Iterable).cast<String>().toList(growable: false)
: const [],
@@ -52,11 +59,11 @@ class DownloadFilesDto {
return null;
}
static List<DownloadFilesDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <DownloadFilesDto>[];
static List<DownloadArchiveInfo> listFromJson(dynamic json, {bool growable = false,}) {
final result = <DownloadArchiveInfo>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = DownloadFilesDto.fromJson(row);
final value = DownloadArchiveInfo.fromJson(row);
if (value != null) {
result.add(value);
}
@@ -65,12 +72,12 @@ class DownloadFilesDto {
return result.toList(growable: growable);
}
static Map<String, DownloadFilesDto> mapFromJson(dynamic json) {
final map = <String, DownloadFilesDto>{};
static Map<String, DownloadArchiveInfo> mapFromJson(dynamic json) {
final map = <String, DownloadArchiveInfo>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = DownloadFilesDto.fromJson(entry.value);
final value = DownloadArchiveInfo.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
@@ -79,14 +86,14 @@ class DownloadFilesDto {
return map;
}
// maps a json object with a list of DownloadFilesDto-objects as value to a dart map
static Map<String, List<DownloadFilesDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<DownloadFilesDto>>{};
// maps a json object with a list of DownloadArchiveInfo-objects as value to a dart map
static Map<String, List<DownloadArchiveInfo>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<DownloadArchiveInfo>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = DownloadFilesDto.listFromJson(entry.value, growable: growable,);
map[entry.key] = DownloadArchiveInfo.listFromJson(entry.value, growable: growable,);
}
}
return map;
@@ -94,6 +101,7 @@ class DownloadFilesDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'size',
'assetIds',
};
}

View File

@@ -0,0 +1,106 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class DownloadResponseDto {
/// Returns a new [DownloadResponseDto] instance.
DownloadResponseDto({
required this.totalSize,
this.archives = const [],
});
int totalSize;
List<DownloadArchiveInfo> archives;
@override
bool operator ==(Object other) => identical(this, other) || other is DownloadResponseDto &&
other.totalSize == totalSize &&
other.archives == archives;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(totalSize.hashCode) +
(archives.hashCode);
@override
String toString() => 'DownloadResponseDto[totalSize=$totalSize, archives=$archives]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'totalSize'] = this.totalSize;
json[r'archives'] = this.archives;
return json;
}
/// Returns a new [DownloadResponseDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static DownloadResponseDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return DownloadResponseDto(
totalSize: mapValueOfType<int>(json, r'totalSize')!,
archives: DownloadArchiveInfo.listFromJson(json[r'archives']),
);
}
return null;
}
static List<DownloadResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <DownloadResponseDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = DownloadResponseDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, DownloadResponseDto> mapFromJson(dynamic json) {
final map = <String, DownloadResponseDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = DownloadResponseDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of DownloadResponseDto-objects as value to a dart map
static Map<String, List<DownloadResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<DownloadResponseDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = DownloadResponseDto.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'totalSize',
'archives',
};
}

View File

@@ -37,11 +37,6 @@ void main() {
// TODO
});
//Future<MultipartFile> downloadArchive(String id, { String name, num skip, String key }) async
test('test downloadArchive', () async {
// TODO
});
//Future<AlbumCountResponseDto> getAlbumCount() async
test('test getAlbumCount', () async {
// TODO

View File

@@ -43,23 +43,16 @@ void main() {
// TODO
});
//Future<MultipartFile> downloadArchive(AssetIdsDto assetIdsDto, { String key }) async
test('test downloadArchive', () async {
// TODO
});
//Future<MultipartFile> downloadFile(String id, { String key }) async
test('test downloadFile', () async {
// TODO
});
//Future<MultipartFile> downloadFiles(DownloadFilesDto downloadFilesDto, { String key }) async
test('test downloadFiles', () async {
// TODO
});
// Current this is not used in any UI element
//
//Future<MultipartFile> downloadLibrary({ String name, num skip, String key }) async
test('test downloadLibrary', () async {
// TODO
});
// Get all AssetEntity belong to the user
//
//Future<List<AssetResponseDto>> getAllAssets({ String userId, bool isFavorite, bool isArchived, bool withoutThumbs, num skip, String ifNoneMatch }) async
@@ -114,6 +107,11 @@ void main() {
// TODO
});
//Future<DownloadResponseDto> getDownloadInfo({ List<String> assetIds, String albumId, String userId, num archiveSize, String key }) async
test('test getDownloadInfo', () async {
// TODO
});
//Future<List<MapMarkerResponseDto>> getMapMarkers({ bool isFavorite, DateTime fileCreatedAfter, DateTime fileCreatedBefore }) async
test('test getMapMarkers', () async {
// TODO

View File

@@ -11,11 +11,16 @@
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for DownloadFilesDto
// tests for DownloadArchiveInfo
void main() {
// final instance = DownloadFilesDto();
// final instance = DownloadArchiveInfo();
group('test DownloadArchiveInfo', () {
// int size
test('to test the property `size`', () async {
// TODO
});
group('test DownloadFilesDto', () {
// List<String> assetIds (default value: const [])
test('to test the property `assetIds`', () async {
// TODO

View File

@@ -0,0 +1,32 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for DownloadResponseDto
void main() {
// final instance = DownloadResponseDto();
group('test DownloadResponseDto', () {
// int totalSize
test('to test the property `totalSize`', () async {
// TODO
});
// List<DownloadArchiveInfo> archives (default value: const [])
test('to test the property `archives`', () async {
// TODO
});
});
}