mirror of
				https://github.com/KevinMidboe/immich.git
				synced 2025-10-29 17:40:28 +00:00 
			
		
		
		
	feat(web) Individual assets shared mechanism (#1317)
* Create shared link modal for individual asset * Added API to create asset shared link * Added viewer for individual shared link * Added multiselection app bar * Refactor gallery viewer to its own component * Refactor * Refactor * Add and remove asset from shared link * Fixed test * Fixed notification card doesn't wrap * Add check asset access when created asset shared link * pr feedback
This commit is contained in:
		
							
								
								
									
										194
									
								
								mobile/openapi/lib/api/asset_api.dart
									
									
									
										generated
									
									
									
								
							
							
						
						
									
										194
									
								
								mobile/openapi/lib/api/asset_api.dart
									
									
									
										generated
									
									
									
								
							@@ -120,7 +120,62 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'DELETE /asset' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [CreateAssetsShareLinkDto] createAssetsShareLinkDto (required):
 | 
			
		||||
  Future<Response> createAssetsSharedLinkWithHttpInfo(CreateAssetsShareLinkDto createAssetsShareLinkDto,) async {
 | 
			
		||||
    // ignore: prefer_const_declarations
 | 
			
		||||
    final path = r'/asset/shared-link';
 | 
			
		||||
 | 
			
		||||
    // ignore: prefer_final_locals
 | 
			
		||||
    Object? postBody = createAssetsShareLinkDto;
 | 
			
		||||
 | 
			
		||||
    final queryParams = <QueryParam>[];
 | 
			
		||||
    final headerParams = <String, String>{};
 | 
			
		||||
    final formParams = <String, String>{};
 | 
			
		||||
 | 
			
		||||
    const contentTypes = <String>['application/json'];
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    return apiClient.invokeAPI(
 | 
			
		||||
      path,
 | 
			
		||||
      'POST',
 | 
			
		||||
      queryParams,
 | 
			
		||||
      postBody,
 | 
			
		||||
      headerParams,
 | 
			
		||||
      formParams,
 | 
			
		||||
      contentTypes.isEmpty ? null : contentTypes.first,
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [CreateAssetsShareLinkDto] createAssetsShareLinkDto (required):
 | 
			
		||||
  Future<SharedLinkResponseDto?> createAssetsSharedLink(CreateAssetsShareLinkDto createAssetsShareLinkDto,) async {
 | 
			
		||||
    final response = await createAssetsSharedLinkWithHttpInfo(createAssetsShareLinkDto,);
 | 
			
		||||
    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].
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [DeleteAssetDto] deleteAssetDto (required):
 | 
			
		||||
@@ -149,6 +204,8 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [DeleteAssetDto] deleteAssetDto (required):
 | 
			
		||||
@@ -170,7 +227,10 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'GET /asset/download/{assetId}' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [String] assetId (required):
 | 
			
		||||
@@ -211,6 +271,8 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [String] assetId (required):
 | 
			
		||||
@@ -233,7 +295,10 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'POST /asset/download-files' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [DownloadFilesDto] downloadFilesDto (required):
 | 
			
		||||
@@ -262,6 +327,8 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [DownloadFilesDto] downloadFilesDto (required):
 | 
			
		||||
@@ -280,7 +347,10 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'GET /asset/download-library' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [num] skip:
 | 
			
		||||
@@ -313,6 +383,8 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [num] skip:
 | 
			
		||||
@@ -445,7 +517,10 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'POST /asset/time-bucket' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [GetAssetByTimeBucketDto] getAssetByTimeBucketDto (required):
 | 
			
		||||
@@ -474,6 +549,8 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [GetAssetByTimeBucketDto] getAssetByTimeBucketDto (required):
 | 
			
		||||
@@ -495,7 +572,10 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'POST /asset/count-by-time-bucket' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [GetAssetCountByTimeBucketDto] getAssetCountByTimeBucketDto (required):
 | 
			
		||||
@@ -524,6 +604,8 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [GetAssetCountByTimeBucketDto] getAssetCountByTimeBucketDto (required):
 | 
			
		||||
@@ -542,7 +624,9 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'GET /asset/count-by-user-id' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  Future<Response> getAssetCountByUserIdWithHttpInfo() async {
 | 
			
		||||
    // ignore: prefer_const_declarations
 | 
			
		||||
    final path = r'/asset/count-by-user-id';
 | 
			
		||||
@@ -568,6 +652,7 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  Future<AssetCountByUserIdResponseDto?> getAssetCountByUserId() async {
 | 
			
		||||
    final response = await getAssetCountByUserIdWithHttpInfo();
 | 
			
		||||
    if (response.statusCode >= HttpStatus.badRequest) {
 | 
			
		||||
@@ -583,7 +668,9 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'GET /asset/search-terms' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  Future<Response> getAssetSearchTermsWithHttpInfo() async {
 | 
			
		||||
    // ignore: prefer_const_declarations
 | 
			
		||||
    final path = r'/asset/search-terms';
 | 
			
		||||
@@ -609,6 +696,7 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  Future<List<String>?> getAssetSearchTerms() async {
 | 
			
		||||
    final response = await getAssetSearchTermsWithHttpInfo();
 | 
			
		||||
    if (response.statusCode >= HttpStatus.badRequest) {
 | 
			
		||||
@@ -627,7 +715,10 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'GET /asset/thumbnail/{assetId}' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [String] assetId (required):
 | 
			
		||||
@@ -663,6 +754,8 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [String] assetId (required):
 | 
			
		||||
@@ -683,7 +776,9 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'GET /asset/curated-locations' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  Future<Response> getCuratedLocationsWithHttpInfo() async {
 | 
			
		||||
    // ignore: prefer_const_declarations
 | 
			
		||||
    final path = r'/asset/curated-locations';
 | 
			
		||||
@@ -709,6 +804,7 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  Future<List<CuratedLocationsResponseDto>?> getCuratedLocations() async {
 | 
			
		||||
    final response = await getCuratedLocationsWithHttpInfo();
 | 
			
		||||
    if (response.statusCode >= HttpStatus.badRequest) {
 | 
			
		||||
@@ -727,7 +823,9 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'GET /asset/curated-objects' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  Future<Response> getCuratedObjectsWithHttpInfo() async {
 | 
			
		||||
    // ignore: prefer_const_declarations
 | 
			
		||||
    final path = r'/asset/curated-objects';
 | 
			
		||||
@@ -753,6 +851,7 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  Future<List<CuratedObjectsResponseDto>?> getCuratedObjects() async {
 | 
			
		||||
    final response = await getCuratedObjectsWithHttpInfo();
 | 
			
		||||
    if (response.statusCode >= HttpStatus.badRequest) {
 | 
			
		||||
@@ -827,7 +926,10 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'POST /asset/search' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [SearchAssetDto] searchAssetDto (required):
 | 
			
		||||
@@ -856,6 +958,8 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [SearchAssetDto] searchAssetDto (required):
 | 
			
		||||
@@ -877,7 +981,10 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'GET /asset/file/{assetId}' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Note: This method returns the HTTP [Response].
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [String] assetId (required):
 | 
			
		||||
@@ -918,6 +1025,8 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [String] assetId (required):
 | 
			
		||||
@@ -997,7 +1106,62 @@ class AssetApi {
 | 
			
		||||
    return null;
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// Performs an HTTP 'POST /asset/upload' operation and returns the [Response].
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// 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].
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [MultipartFile] assetData (required):
 | 
			
		||||
@@ -1036,6 +1200,8 @@ class AssetApi {
 | 
			
		||||
    );
 | 
			
		||||
  }
 | 
			
		||||
 | 
			
		||||
  /// 
 | 
			
		||||
  ///
 | 
			
		||||
  /// Parameters:
 | 
			
		||||
  ///
 | 
			
		||||
  /// * [MultipartFile] assetData (required):
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user