fix(web/server) uploaded asset in shared link not loaded (#1766)

* fix(web/server): Uploaded asset to shared link does not get added to the shared link/album

* remove unused code

* Add endpoints for each remove and add assets to shared link

* Update api

* Added deletion logic

* Convert callback to async/await

* Fix linter

* Fix test

* Fix server test

* added test

* Test coverage

* modify DTO

* Add notification

* fix test
This commit is contained in:
Alex 2023-02-15 15:21:22 -06:00 committed by GitHub
parent 125ec1e85f
commit b660240059
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
25 changed files with 583 additions and 526 deletions

View file

@ -16,6 +16,58 @@ class AssetApi {
final ApiClient apiClient;
///
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [AddAssetsDto] addAssetsDto (required):
Future<Response> addAssetsToSharedLinkWithHttpInfo(AddAssetsDto addAssetsDto,) async {
// ignore: prefer_const_declarations
final path = r'/asset/shared-link/add';
// ignore: prefer_final_locals
Object? postBody = addAssetsDto;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'PATCH',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
///
///
/// Parameters:
///
/// * [AddAssetsDto] addAssetsDto (required):
Future<SharedLinkResponseDto?> addAssetsToSharedLink(AddAssetsDto addAssetsDto,) async {
final response = await addAssetsToSharedLinkWithHttpInfo(addAssetsDto,);
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), 'SharedLinkResponseDto',) as SharedLinkResponseDto;
}
return null;
}
/// Check duplicated asset before uploading - for Web upload used
///
/// Note: This method returns the HTTP [Response].
@ -926,6 +978,58 @@ class AssetApi {
return null;
}
///
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [RemoveAssetsDto] removeAssetsDto (required):
Future<Response> removeAssetsFromSharedLinkWithHttpInfo(RemoveAssetsDto removeAssetsDto,) async {
// ignore: prefer_const_declarations
final path = r'/asset/shared-link/remove';
// ignore: prefer_final_locals
Object? postBody = removeAssetsDto;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'PATCH',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
///
///
/// Parameters:
///
/// * [RemoveAssetsDto] removeAssetsDto (required):
Future<SharedLinkResponseDto?> removeAssetsFromSharedLink(RemoveAssetsDto removeAssetsDto,) async {
final response = await removeAssetsFromSharedLinkWithHttpInfo(removeAssetsDto,);
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), 'SharedLinkResponseDto',) as SharedLinkResponseDto;
}
return null;
}
///
///
/// Note: This method returns the HTTP [Response].
@ -1106,58 +1210,6 @@ class AssetApi {
return null;
}
///
///
/// Note: This method returns the HTTP [Response].
///
/// Parameters:
///
/// * [UpdateAssetsToSharedLinkDto] updateAssetsToSharedLinkDto (required):
Future<Response> updateAssetsInSharedLinkWithHttpInfo(UpdateAssetsToSharedLinkDto updateAssetsToSharedLinkDto,) async {
// ignore: prefer_const_declarations
final path = r'/asset/shared-link';
// ignore: prefer_final_locals
Object? postBody = updateAssetsToSharedLinkDto;
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'PATCH',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
///
///
/// Parameters:
///
/// * [UpdateAssetsToSharedLinkDto] updateAssetsToSharedLinkDto (required):
Future<SharedLinkResponseDto?> updateAssetsInSharedLink(UpdateAssetsToSharedLinkDto updateAssetsToSharedLinkDto,) async {
final response = await updateAssetsInSharedLinkWithHttpInfo(updateAssetsToSharedLinkDto,);
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), 'SharedLinkResponseDto',) as SharedLinkResponseDto;
}
return null;
}
///
///
/// Note: This method returns the HTTP [Response].