2022-07-13 07:23:48 -05:00
|
|
|
//
|
|
|
|
// AUTO-GENERATED FILE, DO NOT MODIFY!
|
|
|
|
//
|
2024-05-15 17:52:52 -04:00
|
|
|
// @dart=2.18
|
2022-07-13 07:23:48 -05:00
|
|
|
|
|
|
|
// 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;
|
|
|
|
|
|
|
|
|
2024-05-30 00:26:57 +02:00
|
|
|
class AssetsApi {
|
|
|
|
AssetsApi([ApiClient? apiClient]) : apiClient = apiClient ?? defaultApiClient;
|
2022-07-13 07:23:48 -05:00
|
|
|
|
|
|
|
final ApiClient apiClient;
|
|
|
|
|
2025-01-29 08:58:10 -08:00
|
|
|
/// checkBulkUpload
|
|
|
|
///
|
2023-05-24 23:08:21 +02:00
|
|
|
/// Checks if assets exist by checksums
|
|
|
|
///
|
|
|
|
/// Note: This method returns the HTTP [Response].
|
|
|
|
///
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [AssetBulkUploadCheckDto] assetBulkUploadCheckDto (required):
|
2023-11-03 21:33:15 -04:00
|
|
|
Future<Response> checkBulkUploadWithHttpInfo(AssetBulkUploadCheckDto assetBulkUploadCheckDto,) async {
|
2023-05-24 23:08:21 +02:00
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets/bulk-upload-check';
|
2023-05-24 23:08:21 +02:00
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody = assetBulkUploadCheckDto;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
|
|
|
const contentTypes = <String>['application/json'];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2023-05-24 23:08:21 +02:00
|
|
|
'POST',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2025-01-29 08:58:10 -08:00
|
|
|
/// checkBulkUpload
|
|
|
|
///
|
2023-05-24 23:08:21 +02:00
|
|
|
/// Checks if assets exist by checksums
|
|
|
|
///
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [AssetBulkUploadCheckDto] assetBulkUploadCheckDto (required):
|
2023-11-03 21:33:15 -04:00
|
|
|
Future<AssetBulkUploadCheckResponseDto?> checkBulkUpload(AssetBulkUploadCheckDto assetBulkUploadCheckDto,) async {
|
|
|
|
final response = await checkBulkUploadWithHttpInfo(assetBulkUploadCheckDto,);
|
2023-05-24 23:08:21 +02:00
|
|
|
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), 'AssetBulkUploadCheckResponseDto',) as AssetBulkUploadCheckResponseDto;
|
2023-02-15 15:21:22 -06:00
|
|
|
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2025-01-29 08:58:10 -08:00
|
|
|
/// checkExistingAssets
|
|
|
|
///
|
2022-10-25 09:51:03 -05:00
|
|
|
/// Checks if multiple assets exist on the server and returns all existing - used by background backup
|
|
|
|
///
|
|
|
|
/// Note: This method returns the HTTP [Response].
|
|
|
|
///
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [CheckExistingAssetsDto] checkExistingAssetsDto (required):
|
|
|
|
Future<Response> checkExistingAssetsWithHttpInfo(CheckExistingAssetsDto checkExistingAssetsDto,) async {
|
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets/exist';
|
2022-10-25 09:51:03 -05:00
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody = checkExistingAssetsDto;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
|
|
|
const contentTypes = <String>['application/json'];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2022-10-25 09:51:03 -05:00
|
|
|
'POST',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2025-01-29 08:58:10 -08:00
|
|
|
/// checkExistingAssets
|
|
|
|
///
|
2022-10-25 09:51:03 -05:00
|
|
|
/// Checks if multiple assets exist on the server and returns all existing - used by background backup
|
|
|
|
///
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [CheckExistingAssetsDto] checkExistingAssetsDto (required):
|
|
|
|
Future<CheckExistingAssetsResponseDto?> checkExistingAssets(CheckExistingAssetsDto checkExistingAssetsDto,) async {
|
|
|
|
final response = await checkExistingAssetsWithHttpInfo(checkExistingAssetsDto,);
|
|
|
|
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), 'CheckExistingAssetsResponseDto',) as CheckExistingAssetsResponseDto;
|
|
|
|
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-05-31 13:44:04 -04:00
|
|
|
/// Performs an HTTP 'DELETE /assets' operation and returns the [Response].
|
2022-07-13 07:23:48 -05:00
|
|
|
/// Parameters:
|
|
|
|
///
|
2023-10-06 07:01:14 +00:00
|
|
|
/// * [AssetBulkDeleteDto] assetBulkDeleteDto (required):
|
|
|
|
Future<Response> deleteAssetsWithHttpInfo(AssetBulkDeleteDto assetBulkDeleteDto,) async {
|
2022-07-13 07:23:48 -05:00
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets';
|
2022-07-13 07:23:48 -05:00
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
2023-10-06 07:01:14 +00:00
|
|
|
Object? postBody = assetBulkDeleteDto;
|
2022-07-13 07:23:48 -05:00
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
|
|
|
const contentTypes = <String>['application/json'];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2022-07-13 07:23:48 -05:00
|
|
|
'DELETE',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Parameters:
|
|
|
|
///
|
2023-10-06 07:01:14 +00:00
|
|
|
/// * [AssetBulkDeleteDto] assetBulkDeleteDto (required):
|
|
|
|
Future<void> deleteAssets(AssetBulkDeleteDto assetBulkDeleteDto,) async {
|
|
|
|
final response = await deleteAssetsWithHttpInfo(assetBulkDeleteDto,);
|
2022-07-13 07:23:48 -05:00
|
|
|
if (response.statusCode >= HttpStatus.badRequest) {
|
|
|
|
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-31 13:44:04 -04:00
|
|
|
/// Performs an HTTP 'GET /assets/{id}/original' operation and returns the [Response].
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [String] id (required):
|
|
|
|
///
|
|
|
|
/// * [String] key:
|
|
|
|
Future<Response> downloadAssetWithHttpInfo(String id, { String? key, }) async {
|
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets/{id}/original'
|
2024-05-31 13:44:04 -04:00
|
|
|
.replaceAll('{id}', id);
|
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
|
|
|
if (key != null) {
|
|
|
|
queryParams.addAll(_queryParams('', 'key', key));
|
|
|
|
}
|
|
|
|
|
|
|
|
const contentTypes = <String>[];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2024-05-31 13:44:04 -04:00
|
|
|
'GET',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [String] id (required):
|
|
|
|
///
|
|
|
|
/// * [String] key:
|
|
|
|
Future<MultipartFile?> downloadAsset(String id, { String? key, }) async {
|
|
|
|
final response = await downloadAssetWithHttpInfo(id, 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;
|
|
|
|
}
|
|
|
|
|
2025-01-29 08:58:10 -08:00
|
|
|
/// getAllUserAssetsByDeviceId
|
|
|
|
///
|
2023-11-25 15:46:20 +00:00
|
|
|
/// Get all asset of a device that are in the database, ID only.
|
|
|
|
///
|
|
|
|
/// Note: This method returns the HTTP [Response].
|
|
|
|
///
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [String] deviceId (required):
|
|
|
|
Future<Response> getAllUserAssetsByDeviceIdWithHttpInfo(String deviceId,) async {
|
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets/device/{deviceId}'
|
2023-11-25 15:46:20 +00:00
|
|
|
.replaceAll('{deviceId}', deviceId);
|
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
|
|
|
const contentTypes = <String>[];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2023-11-25 15:46:20 +00:00
|
|
|
'GET',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2025-01-29 08:58:10 -08:00
|
|
|
/// getAllUserAssetsByDeviceId
|
|
|
|
///
|
2023-11-25 15:46:20 +00:00
|
|
|
/// Get all asset of a device that are in the database, ID only.
|
|
|
|
///
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [String] deviceId (required):
|
|
|
|
Future<List<String>?> getAllUserAssetsByDeviceId(String deviceId,) async {
|
|
|
|
final response = await getAllUserAssetsByDeviceIdWithHttpInfo(deviceId,);
|
|
|
|
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<String>') as List)
|
|
|
|
.cast<String>()
|
2024-01-26 11:40:28 -05:00
|
|
|
.toList(growable: false);
|
2023-11-25 15:46:20 +00:00
|
|
|
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-05-31 13:44:04 -04:00
|
|
|
/// Performs an HTTP 'GET /assets/{id}' operation and returns the [Response].
|
2024-01-25 12:52:21 -05:00
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [String] id (required):
|
|
|
|
///
|
|
|
|
/// * [String] key:
|
|
|
|
Future<Response> getAssetInfoWithHttpInfo(String id, { String? key, }) async {
|
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets/{id}'
|
2024-01-25 12:52:21 -05:00
|
|
|
.replaceAll('{id}', id);
|
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
|
|
|
if (key != null) {
|
|
|
|
queryParams.addAll(_queryParams('', 'key', key));
|
|
|
|
}
|
|
|
|
|
|
|
|
const contentTypes = <String>[];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2024-01-25 12:52:21 -05:00
|
|
|
'GET',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [String] id (required):
|
|
|
|
///
|
|
|
|
/// * [String] key:
|
|
|
|
Future<AssetResponseDto?> getAssetInfo(String id, { String? key, }) async {
|
|
|
|
final response = await getAssetInfoWithHttpInfo(id, 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), 'AssetResponseDto',) as AssetResponseDto;
|
|
|
|
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-05-31 13:44:04 -04:00
|
|
|
/// Performs an HTTP 'GET /assets/statistics' operation and returns the [Response].
|
2023-07-14 09:30:17 -04:00
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [bool] isFavorite:
|
2023-10-06 07:01:14 +00:00
|
|
|
///
|
|
|
|
/// * [bool] isTrashed:
|
2025-05-06 12:12:48 -05:00
|
|
|
///
|
|
|
|
/// * [AssetVisibility] visibility:
|
|
|
|
Future<Response> getAssetStatisticsWithHttpInfo({ bool? isFavorite, bool? isTrashed, AssetVisibility? visibility, }) async {
|
2022-07-13 07:23:48 -05:00
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets/statistics';
|
2022-07-13 07:23:48 -05:00
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
2023-07-14 09:30:17 -04:00
|
|
|
if (isFavorite != null) {
|
|
|
|
queryParams.addAll(_queryParams('', 'isFavorite', isFavorite));
|
|
|
|
}
|
2023-10-06 07:01:14 +00:00
|
|
|
if (isTrashed != null) {
|
|
|
|
queryParams.addAll(_queryParams('', 'isTrashed', isTrashed));
|
|
|
|
}
|
2025-05-06 12:12:48 -05:00
|
|
|
if (visibility != null) {
|
|
|
|
queryParams.addAll(_queryParams('', 'visibility', visibility));
|
|
|
|
}
|
2023-07-14 09:30:17 -04:00
|
|
|
|
2022-07-13 07:23:48 -05:00
|
|
|
const contentTypes = <String>[];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2022-07-13 07:23:48 -05:00
|
|
|
'GET',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2023-07-14 09:30:17 -04:00
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [bool] isFavorite:
|
2023-10-06 07:01:14 +00:00
|
|
|
///
|
|
|
|
/// * [bool] isTrashed:
|
2025-05-06 12:12:48 -05:00
|
|
|
///
|
|
|
|
/// * [AssetVisibility] visibility:
|
|
|
|
Future<AssetStatsResponseDto?> getAssetStatistics({ bool? isFavorite, bool? isTrashed, AssetVisibility? visibility, }) async {
|
|
|
|
final response = await getAssetStatisticsWithHttpInfo( isFavorite: isFavorite, isTrashed: isTrashed, visibility: visibility, );
|
2022-07-13 07:23:48 -05:00
|
|
|
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) {
|
2023-07-14 09:30:17 -04:00
|
|
|
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetStatsResponseDto',) as AssetStatsResponseDto;
|
|
|
|
|
2022-07-13 07:23:48 -05:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-09-23 12:09:26 -04:00
|
|
|
/// This property was deprecated in v1.116.0
|
|
|
|
///
|
|
|
|
/// Note: This method returns the HTTP [Response].
|
|
|
|
///
|
2023-06-14 20:47:18 -05:00
|
|
|
/// Parameters:
|
|
|
|
///
|
2024-05-31 13:44:04 -04:00
|
|
|
/// * [num] count:
|
|
|
|
Future<Response> getRandomWithHttpInfo({ num? count, }) async {
|
2023-06-14 20:47:18 -05:00
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets/random';
|
2023-06-14 20:47:18 -05:00
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
2024-05-31 13:44:04 -04:00
|
|
|
if (count != null) {
|
|
|
|
queryParams.addAll(_queryParams('', 'count', count));
|
|
|
|
}
|
2023-06-14 20:47:18 -05:00
|
|
|
|
|
|
|
const contentTypes = <String>[];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2023-06-14 20:47:18 -05:00
|
|
|
'GET',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2024-09-23 12:09:26 -04:00
|
|
|
/// This property was deprecated in v1.116.0
|
|
|
|
///
|
2023-06-14 20:47:18 -05:00
|
|
|
/// Parameters:
|
|
|
|
///
|
2024-05-31 13:44:04 -04:00
|
|
|
/// * [num] count:
|
|
|
|
Future<List<AssetResponseDto>?> getRandom({ num? count, }) async {
|
|
|
|
final response = await getRandomWithHttpInfo( count: count, );
|
2023-06-14 20:47:18 -05:00
|
|
|
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);
|
2024-05-31 13:44:04 -04:00
|
|
|
return (await apiClient.deserializeAsync(responseBody, 'List<AssetResponseDto>') as List)
|
|
|
|
.cast<AssetResponseDto>()
|
2024-01-26 11:40:28 -05:00
|
|
|
.toList(growable: false);
|
2023-06-14 20:47:18 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-05-31 13:44:04 -04:00
|
|
|
/// Performs an HTTP 'GET /assets/{id}/video/playback' operation and returns the [Response].
|
2023-09-23 17:28:55 +02:00
|
|
|
/// Parameters:
|
|
|
|
///
|
2024-05-31 13:44:04 -04:00
|
|
|
/// * [String] id (required):
|
|
|
|
///
|
|
|
|
/// * [String] key:
|
|
|
|
Future<Response> playAssetVideoWithHttpInfo(String id, { String? key, }) async {
|
2023-09-23 17:28:55 +02:00
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets/{id}/video/playback'
|
2024-05-31 13:44:04 -04:00
|
|
|
.replaceAll('{id}', id);
|
2023-09-23 17:28:55 +02:00
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
2024-05-31 13:44:04 -04:00
|
|
|
if (key != null) {
|
|
|
|
queryParams.addAll(_queryParams('', 'key', key));
|
2023-09-23 17:28:55 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
const contentTypes = <String>[];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2023-09-23 17:28:55 +02:00
|
|
|
'GET',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Parameters:
|
|
|
|
///
|
2024-05-31 13:44:04 -04:00
|
|
|
/// * [String] id (required):
|
|
|
|
///
|
|
|
|
/// * [String] key:
|
|
|
|
Future<MultipartFile?> playAssetVideo(String id, { String? key, }) async {
|
|
|
|
final response = await playAssetVideoWithHttpInfo(id, key: key, );
|
2023-09-23 17:28:55 +02:00
|
|
|
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) {
|
2024-05-31 13:44:04 -04:00
|
|
|
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'MultipartFile',) as MultipartFile;
|
|
|
|
|
2023-09-23 17:28:55 +02:00
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2025-01-29 08:58:10 -08:00
|
|
|
/// replaceAsset
|
|
|
|
///
|
2024-05-23 20:26:22 -04:00
|
|
|
/// Replace the asset with new file, without changing its id
|
|
|
|
///
|
|
|
|
/// Note: This method returns the HTTP [Response].
|
|
|
|
///
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [String] id (required):
|
|
|
|
///
|
|
|
|
/// * [MultipartFile] assetData (required):
|
|
|
|
///
|
|
|
|
/// * [String] deviceAssetId (required):
|
|
|
|
///
|
|
|
|
/// * [String] deviceId (required):
|
|
|
|
///
|
|
|
|
/// * [DateTime] fileCreatedAt (required):
|
|
|
|
///
|
|
|
|
/// * [DateTime] fileModifiedAt (required):
|
|
|
|
///
|
|
|
|
/// * [String] key:
|
|
|
|
///
|
|
|
|
/// * [String] duration:
|
|
|
|
Future<Response> replaceAssetWithHttpInfo(String id, MultipartFile assetData, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, { String? key, String? duration, }) async {
|
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets/{id}/original'
|
2024-05-23 20:26:22 -04:00
|
|
|
.replaceAll('{id}', id);
|
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
|
|
|
if (key != null) {
|
|
|
|
queryParams.addAll(_queryParams('', 'key', key));
|
|
|
|
}
|
|
|
|
|
|
|
|
const contentTypes = <String>['multipart/form-data'];
|
|
|
|
|
|
|
|
bool hasFields = false;
|
2025-03-06 18:27:43 +01:00
|
|
|
final mp = MultipartRequest('PUT', Uri.parse(apiPath));
|
2024-05-23 20:26:22 -04:00
|
|
|
if (assetData != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'assetData'] = assetData.field;
|
|
|
|
mp.files.add(assetData);
|
|
|
|
}
|
|
|
|
if (deviceAssetId != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'deviceAssetId'] = parameterToString(deviceAssetId);
|
|
|
|
}
|
|
|
|
if (deviceId != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'deviceId'] = parameterToString(deviceId);
|
|
|
|
}
|
|
|
|
if (duration != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'duration'] = parameterToString(duration);
|
|
|
|
}
|
|
|
|
if (fileCreatedAt != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'fileCreatedAt'] = parameterToString(fileCreatedAt);
|
|
|
|
}
|
|
|
|
if (fileModifiedAt != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'fileModifiedAt'] = parameterToString(fileModifiedAt);
|
|
|
|
}
|
|
|
|
if (hasFields) {
|
|
|
|
postBody = mp;
|
|
|
|
}
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2024-05-23 20:26:22 -04:00
|
|
|
'PUT',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
2025-01-29 08:58:10 -08:00
|
|
|
/// replaceAsset
|
|
|
|
///
|
2024-05-23 20:26:22 -04:00
|
|
|
/// Replace the asset with new file, without changing its id
|
|
|
|
///
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [String] id (required):
|
|
|
|
///
|
|
|
|
/// * [MultipartFile] assetData (required):
|
|
|
|
///
|
|
|
|
/// * [String] deviceAssetId (required):
|
|
|
|
///
|
|
|
|
/// * [String] deviceId (required):
|
|
|
|
///
|
|
|
|
/// * [DateTime] fileCreatedAt (required):
|
|
|
|
///
|
|
|
|
/// * [DateTime] fileModifiedAt (required):
|
|
|
|
///
|
|
|
|
/// * [String] key:
|
|
|
|
///
|
|
|
|
/// * [String] duration:
|
|
|
|
Future<AssetMediaResponseDto?> replaceAsset(String id, MultipartFile assetData, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, { String? key, String? duration, }) async {
|
|
|
|
final response = await replaceAssetWithHttpInfo(id, assetData, deviceAssetId, deviceId, fileCreatedAt, fileModifiedAt, key: key, duration: duration, );
|
|
|
|
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), 'AssetMediaResponseDto',) as AssetMediaResponseDto;
|
|
|
|
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-05-31 13:44:04 -04:00
|
|
|
/// Performs an HTTP 'POST /assets/jobs' operation and returns the [Response].
|
2023-08-18 10:31:48 -04:00
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [AssetJobsDto] assetJobsDto (required):
|
|
|
|
Future<Response> runAssetJobsWithHttpInfo(AssetJobsDto assetJobsDto,) async {
|
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets/jobs';
|
2023-08-18 10:31:48 -04:00
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody = assetJobsDto;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
|
|
|
const contentTypes = <String>['application/json'];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2023-08-18 10:31:48 -04:00
|
|
|
'POST',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [AssetJobsDto] assetJobsDto (required):
|
|
|
|
Future<void> runAssetJobs(AssetJobsDto assetJobsDto,) async {
|
|
|
|
final response = await runAssetJobsWithHttpInfo(assetJobsDto,);
|
|
|
|
if (response.statusCode >= HttpStatus.badRequest) {
|
|
|
|
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-31 13:44:04 -04:00
|
|
|
/// Performs an HTTP 'PUT /assets/{id}' operation and returns the [Response].
|
2022-11-08 11:20:36 -05:00
|
|
|
/// Parameters:
|
|
|
|
///
|
2023-06-01 22:19:25 -04:00
|
|
|
/// * [String] id (required):
|
2022-11-08 11:20:36 -05:00
|
|
|
///
|
|
|
|
/// * [UpdateAssetDto] updateAssetDto (required):
|
2023-06-01 22:19:25 -04:00
|
|
|
Future<Response> updateAssetWithHttpInfo(String id, UpdateAssetDto updateAssetDto,) async {
|
2022-11-08 11:20:36 -05:00
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets/{id}'
|
2023-06-01 22:19:25 -04:00
|
|
|
.replaceAll('{id}', id);
|
2022-11-08 11:20:36 -05:00
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody = updateAssetDto;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
|
|
|
const contentTypes = <String>['application/json'];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2022-11-08 11:20:36 -05:00
|
|
|
'PUT',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Parameters:
|
|
|
|
///
|
2023-06-01 22:19:25 -04:00
|
|
|
/// * [String] id (required):
|
2022-11-08 11:20:36 -05:00
|
|
|
///
|
|
|
|
/// * [UpdateAssetDto] updateAssetDto (required):
|
2023-06-01 22:19:25 -04:00
|
|
|
Future<AssetResponseDto?> updateAsset(String id, UpdateAssetDto updateAssetDto,) async {
|
|
|
|
final response = await updateAssetWithHttpInfo(id, updateAssetDto,);
|
2022-11-08 11:20:36 -05:00
|
|
|
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), 'AssetResponseDto',) as AssetResponseDto;
|
|
|
|
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
2024-05-31 13:44:04 -04:00
|
|
|
/// Performs an HTTP 'PUT /assets' operation and returns the [Response].
|
2023-08-16 16:04:55 -04:00
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [AssetBulkUpdateDto] assetBulkUpdateDto (required):
|
|
|
|
Future<Response> updateAssetsWithHttpInfo(AssetBulkUpdateDto assetBulkUpdateDto,) async {
|
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets';
|
2023-08-16 16:04:55 -04:00
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody = assetBulkUpdateDto;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
|
|
|
const contentTypes = <String>['application/json'];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2023-08-16 16:04:55 -04:00
|
|
|
'PUT',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [AssetBulkUpdateDto] assetBulkUpdateDto (required):
|
|
|
|
Future<void> updateAssets(AssetBulkUpdateDto assetBulkUpdateDto,) async {
|
|
|
|
final response = await updateAssetsWithHttpInfo(assetBulkUpdateDto,);
|
|
|
|
if (response.statusCode >= HttpStatus.badRequest) {
|
|
|
|
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2024-05-31 13:44:04 -04:00
|
|
|
/// Performs an HTTP 'POST /assets' operation and returns the [Response].
|
2022-07-13 07:23:48 -05:00
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [MultipartFile] assetData (required):
|
2023-02-12 06:54:07 +01:00
|
|
|
///
|
|
|
|
/// * [String] deviceAssetId (required):
|
|
|
|
///
|
|
|
|
/// * [String] deviceId (required):
|
|
|
|
///
|
2023-05-29 16:05:14 +02:00
|
|
|
/// * [DateTime] fileCreatedAt (required):
|
2023-02-12 06:54:07 +01:00
|
|
|
///
|
2023-05-29 16:05:14 +02:00
|
|
|
/// * [DateTime] fileModifiedAt (required):
|
2023-02-12 06:54:07 +01:00
|
|
|
///
|
2023-02-24 17:01:10 +01:00
|
|
|
/// * [String] key:
|
|
|
|
///
|
2024-05-02 15:42:26 -04:00
|
|
|
/// * [String] xImmichChecksum:
|
|
|
|
/// sha1 checksum that can be used for duplicate detection before the file is uploaded
|
|
|
|
///
|
2023-08-01 12:49:18 -04:00
|
|
|
/// * [String] duration:
|
2023-02-12 06:54:07 +01:00
|
|
|
///
|
2023-11-06 09:04:39 -05:00
|
|
|
/// * [bool] isFavorite:
|
|
|
|
///
|
2024-05-31 13:44:04 -04:00
|
|
|
/// * [String] livePhotoVideoId:
|
2023-08-01 12:49:18 -04:00
|
|
|
///
|
|
|
|
/// * [MultipartFile] sidecarData:
|
2025-05-06 12:12:48 -05:00
|
|
|
///
|
|
|
|
/// * [AssetVisibility] visibility:
|
|
|
|
Future<Response> uploadAssetWithHttpInfo(MultipartFile assetData, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, { String? key, String? xImmichChecksum, String? duration, bool? isFavorite, String? livePhotoVideoId, MultipartFile? sidecarData, AssetVisibility? visibility, }) async {
|
2022-07-13 07:23:48 -05:00
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets';
|
2022-07-13 07:23:48 -05:00
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
2023-02-24 17:01:10 +01:00
|
|
|
if (key != null) {
|
|
|
|
queryParams.addAll(_queryParams('', 'key', key));
|
|
|
|
}
|
|
|
|
|
2024-05-02 15:42:26 -04:00
|
|
|
if (xImmichChecksum != null) {
|
|
|
|
headerParams[r'x-immich-checksum'] = parameterToString(xImmichChecksum);
|
|
|
|
}
|
|
|
|
|
2022-07-13 07:23:48 -05:00
|
|
|
const contentTypes = <String>['multipart/form-data'];
|
|
|
|
|
|
|
|
bool hasFields = false;
|
2025-03-06 18:27:43 +01:00
|
|
|
final mp = MultipartRequest('POST', Uri.parse(apiPath));
|
2022-07-13 07:23:48 -05:00
|
|
|
if (assetData != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'assetData'] = assetData.field;
|
|
|
|
mp.files.add(assetData);
|
|
|
|
}
|
2023-02-12 06:54:07 +01:00
|
|
|
if (deviceAssetId != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'deviceAssetId'] = parameterToString(deviceAssetId);
|
|
|
|
}
|
|
|
|
if (deviceId != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'deviceId'] = parameterToString(deviceId);
|
|
|
|
}
|
2023-08-01 12:49:18 -04:00
|
|
|
if (duration != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'duration'] = parameterToString(duration);
|
|
|
|
}
|
2023-02-19 16:44:53 +00:00
|
|
|
if (fileCreatedAt != null) {
|
2023-02-12 06:54:07 +01:00
|
|
|
hasFields = true;
|
2023-02-19 16:44:53 +00:00
|
|
|
mp.fields[r'fileCreatedAt'] = parameterToString(fileCreatedAt);
|
2023-02-12 06:54:07 +01:00
|
|
|
}
|
2023-02-19 16:44:53 +00:00
|
|
|
if (fileModifiedAt != null) {
|
2023-02-12 06:54:07 +01:00
|
|
|
hasFields = true;
|
2023-02-19 16:44:53 +00:00
|
|
|
mp.fields[r'fileModifiedAt'] = parameterToString(fileModifiedAt);
|
2023-02-12 06:54:07 +01:00
|
|
|
}
|
|
|
|
if (isFavorite != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'isFavorite'] = parameterToString(isFavorite);
|
|
|
|
}
|
2024-05-31 13:44:04 -04:00
|
|
|
if (livePhotoVideoId != null) {
|
2023-02-12 06:54:07 +01:00
|
|
|
hasFields = true;
|
2024-05-31 13:44:04 -04:00
|
|
|
mp.fields[r'livePhotoVideoId'] = parameterToString(livePhotoVideoId);
|
2023-08-01 12:49:18 -04:00
|
|
|
}
|
|
|
|
if (sidecarData != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'sidecarData'] = sidecarData.field;
|
|
|
|
mp.files.add(sidecarData);
|
2023-02-12 06:54:07 +01:00
|
|
|
}
|
2025-05-06 12:12:48 -05:00
|
|
|
if (visibility != null) {
|
|
|
|
hasFields = true;
|
|
|
|
mp.fields[r'visibility'] = parameterToString(visibility);
|
|
|
|
}
|
2022-07-13 07:23:48 -05:00
|
|
|
if (hasFields) {
|
|
|
|
postBody = mp;
|
|
|
|
}
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2022-07-13 07:23:48 -05:00
|
|
|
'POST',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [MultipartFile] assetData (required):
|
2023-02-12 06:54:07 +01:00
|
|
|
///
|
|
|
|
/// * [String] deviceAssetId (required):
|
|
|
|
///
|
|
|
|
/// * [String] deviceId (required):
|
|
|
|
///
|
2023-05-29 16:05:14 +02:00
|
|
|
/// * [DateTime] fileCreatedAt (required):
|
2023-02-12 06:54:07 +01:00
|
|
|
///
|
2023-05-29 16:05:14 +02:00
|
|
|
/// * [DateTime] fileModifiedAt (required):
|
2023-02-12 06:54:07 +01:00
|
|
|
///
|
2023-02-24 17:01:10 +01:00
|
|
|
/// * [String] key:
|
|
|
|
///
|
2024-05-02 15:42:26 -04:00
|
|
|
/// * [String] xImmichChecksum:
|
|
|
|
/// sha1 checksum that can be used for duplicate detection before the file is uploaded
|
|
|
|
///
|
2023-08-01 12:49:18 -04:00
|
|
|
/// * [String] duration:
|
2023-02-12 06:54:07 +01:00
|
|
|
///
|
2023-11-06 09:04:39 -05:00
|
|
|
/// * [bool] isFavorite:
|
|
|
|
///
|
2024-05-31 13:44:04 -04:00
|
|
|
/// * [String] livePhotoVideoId:
|
2023-08-01 12:49:18 -04:00
|
|
|
///
|
|
|
|
/// * [MultipartFile] sidecarData:
|
2025-05-06 12:12:48 -05:00
|
|
|
///
|
|
|
|
/// * [AssetVisibility] visibility:
|
|
|
|
Future<AssetMediaResponseDto?> uploadAsset(MultipartFile assetData, String deviceAssetId, String deviceId, DateTime fileCreatedAt, DateTime fileModifiedAt, { String? key, String? xImmichChecksum, String? duration, bool? isFavorite, String? livePhotoVideoId, MultipartFile? sidecarData, AssetVisibility? visibility, }) async {
|
|
|
|
final response = await uploadAssetWithHttpInfo(assetData, deviceAssetId, deviceId, fileCreatedAt, fileModifiedAt, key: key, xImmichChecksum: xImmichChecksum, duration: duration, isFavorite: isFavorite, livePhotoVideoId: livePhotoVideoId, sidecarData: sidecarData, visibility: visibility, );
|
2022-07-13 07:23:48 -05:00
|
|
|
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) {
|
2024-05-31 13:44:04 -04:00
|
|
|
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'AssetMediaResponseDto',) as AssetMediaResponseDto;
|
|
|
|
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Performs an HTTP 'GET /assets/{id}/thumbnail' operation and returns the [Response].
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [String] id (required):
|
|
|
|
///
|
|
|
|
/// * [String] key:
|
|
|
|
///
|
|
|
|
/// * [AssetMediaSize] size:
|
|
|
|
Future<Response> viewAssetWithHttpInfo(String id, { String? key, AssetMediaSize? size, }) async {
|
|
|
|
// ignore: prefer_const_declarations
|
2025-03-06 18:27:43 +01:00
|
|
|
final apiPath = r'/assets/{id}/thumbnail'
|
2024-05-31 13:44:04 -04:00
|
|
|
.replaceAll('{id}', id);
|
|
|
|
|
|
|
|
// ignore: prefer_final_locals
|
|
|
|
Object? postBody;
|
|
|
|
|
|
|
|
final queryParams = <QueryParam>[];
|
|
|
|
final headerParams = <String, String>{};
|
|
|
|
final formParams = <String, String>{};
|
|
|
|
|
|
|
|
if (key != null) {
|
|
|
|
queryParams.addAll(_queryParams('', 'key', key));
|
|
|
|
}
|
|
|
|
if (size != null) {
|
|
|
|
queryParams.addAll(_queryParams('', 'size', size));
|
|
|
|
}
|
|
|
|
|
|
|
|
const contentTypes = <String>[];
|
|
|
|
|
|
|
|
|
|
|
|
return apiClient.invokeAPI(
|
2025-03-06 18:27:43 +01:00
|
|
|
apiPath,
|
2024-05-31 13:44:04 -04:00
|
|
|
'GET',
|
|
|
|
queryParams,
|
|
|
|
postBody,
|
|
|
|
headerParams,
|
|
|
|
formParams,
|
|
|
|
contentTypes.isEmpty ? null : contentTypes.first,
|
|
|
|
);
|
|
|
|
}
|
|
|
|
|
|
|
|
/// Parameters:
|
|
|
|
///
|
|
|
|
/// * [String] id (required):
|
|
|
|
///
|
|
|
|
/// * [String] key:
|
|
|
|
///
|
|
|
|
/// * [AssetMediaSize] size:
|
|
|
|
Future<MultipartFile?> viewAsset(String id, { String? key, AssetMediaSize? size, }) async {
|
|
|
|
final response = await viewAssetWithHttpInfo(id, key: key, size: size, );
|
|
|
|
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;
|
2022-07-13 07:23:48 -05:00
|
|
|
|
|
|
|
}
|
|
|
|
return null;
|
|
|
|
}
|
|
|
|
}
|