diff --git a/mobile/openapi/.openapi-generator/FILES b/mobile/openapi/.openapi-generator/FILES index 263687549..395e5c167 100644 --- a/mobile/openapi/.openapi-generator/FILES +++ b/mobile/openapi/.openapi-generator/FILES @@ -54,6 +54,7 @@ doc/Colorspace.md doc/CreateAlbumDto.md doc/CreateLibraryDto.md doc/CreateProfileImageResponseDto.md +doc/CreateSubAlbumDto.md doc/CreateTagDto.md doc/CreateUserDto.md doc/CuratedLocationsResponseDto.md @@ -149,6 +150,7 @@ doc/SharedLinkType.md doc/SignUpDto.md doc/SmartInfoResponseDto.md doc/SmartSearchDto.md +doc/SubAlbumResponseDto.md doc/SystemConfigApi.md doc/SystemConfigDto.md doc/SystemConfigFFmpegDto.md @@ -276,6 +278,7 @@ lib/model/cq_mode.dart lib/model/create_album_dto.dart lib/model/create_library_dto.dart lib/model/create_profile_image_response_dto.dart +lib/model/create_sub_album_dto.dart lib/model/create_tag_dto.dart lib/model/create_user_dto.dart lib/model/curated_locations_response_dto.dart @@ -360,6 +363,7 @@ lib/model/shared_link_type.dart lib/model/sign_up_dto.dart lib/model/smart_info_response_dto.dart lib/model/smart_search_dto.dart +lib/model/sub_album_response_dto.dart lib/model/system_config_dto.dart lib/model/system_config_f_fmpeg_dto.dart lib/model/system_config_image_dto.dart @@ -457,6 +461,7 @@ test/cq_mode_test.dart test/create_album_dto_test.dart test/create_library_dto_test.dart test/create_profile_image_response_dto_test.dart +test/create_sub_album_dto_test.dart test/create_tag_dto_test.dart test/create_user_dto_test.dart test/curated_locations_response_dto_test.dart @@ -552,6 +557,7 @@ test/shared_link_type_test.dart test/sign_up_dto_test.dart test/smart_info_response_dto_test.dart test/smart_search_dto_test.dart +test/sub_album_response_dto_test.dart test/system_config_api_test.dart test/system_config_dto_test.dart test/system_config_f_fmpeg_dto_test.dart diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index a64183077..e2d238327 100644 --- a/mobile/openapi/README.md +++ b/mobile/openapi/README.md @@ -84,11 +84,14 @@ Class | Method | HTTP request | Description *AlbumApi* | [**addAssetsToAlbum**](doc//AlbumApi.md#addassetstoalbum) | **PUT** /album/{id}/assets | *AlbumApi* | [**addUsersToAlbum**](doc//AlbumApi.md#adduserstoalbum) | **PUT** /album/{id}/users | *AlbumApi* | [**createAlbum**](doc//AlbumApi.md#createalbum) | **POST** /album | +*AlbumApi* | [**createSubAlbum**](doc//AlbumApi.md#createsubalbum) | **POST** /album/sub-album | *AlbumApi* | [**deleteAlbum**](doc//AlbumApi.md#deletealbum) | **DELETE** /album/{id} | *AlbumApi* | [**getAlbumCount**](doc//AlbumApi.md#getalbumcount) | **GET** /album/count | *AlbumApi* | [**getAlbumInfo**](doc//AlbumApi.md#getalbuminfo) | **GET** /album/{id} | +*AlbumApi* | [**getAlbumTree**](doc//AlbumApi.md#getalbumtree) | **GET** /album/{id}/sub-album | *AlbumApi* | [**getAllAlbums**](doc//AlbumApi.md#getallalbums) | **GET** /album | *AlbumApi* | [**removeAssetFromAlbum**](doc//AlbumApi.md#removeassetfromalbum) | **DELETE** /album/{id}/assets | +*AlbumApi* | [**removeSubAlbum**](doc//AlbumApi.md#removesubalbum) | **DELETE** /album/{id}/sub-album/{childAlbumId} | *AlbumApi* | [**removeUserFromAlbum**](doc//AlbumApi.md#removeuserfromalbum) | **DELETE** /album/{id}/user/{userId} | *AlbumApi* | [**updateAlbumInfo**](doc//AlbumApi.md#updatealbuminfo) | **PATCH** /album/{id} | *AssetApi* | [**checkBulkUpload**](doc//AssetApi.md#checkbulkupload) | **POST** /asset/bulk-upload-check | @@ -268,6 +271,7 @@ Class | Method | HTTP request | Description - [CreateAlbumDto](doc//CreateAlbumDto.md) - [CreateLibraryDto](doc//CreateLibraryDto.md) - [CreateProfileImageResponseDto](doc//CreateProfileImageResponseDto.md) + - [CreateSubAlbumDto](doc//CreateSubAlbumDto.md) - [CreateTagDto](doc//CreateTagDto.md) - [CreateUserDto](doc//CreateUserDto.md) - [CuratedLocationsResponseDto](doc//CuratedLocationsResponseDto.md) @@ -352,6 +356,7 @@ Class | Method | HTTP request | Description - [SignUpDto](doc//SignUpDto.md) - [SmartInfoResponseDto](doc//SmartInfoResponseDto.md) - [SmartSearchDto](doc//SmartSearchDto.md) + - [SubAlbumResponseDto](doc//SubAlbumResponseDto.md) - [SystemConfigDto](doc//SystemConfigDto.md) - [SystemConfigFFmpegDto](doc//SystemConfigFFmpegDto.md) - [SystemConfigImageDto](doc//SystemConfigImageDto.md) diff --git a/mobile/openapi/doc/AlbumApi.md b/mobile/openapi/doc/AlbumApi.md index 427181880..45f45de5a 100644 --- a/mobile/openapi/doc/AlbumApi.md +++ b/mobile/openapi/doc/AlbumApi.md @@ -12,11 +12,14 @@ Method | HTTP request | Description [**addAssetsToAlbum**](AlbumApi.md#addassetstoalbum) | **PUT** /album/{id}/assets | [**addUsersToAlbum**](AlbumApi.md#adduserstoalbum) | **PUT** /album/{id}/users | [**createAlbum**](AlbumApi.md#createalbum) | **POST** /album | +[**createSubAlbum**](AlbumApi.md#createsubalbum) | **POST** /album/sub-album | [**deleteAlbum**](AlbumApi.md#deletealbum) | **DELETE** /album/{id} | [**getAlbumCount**](AlbumApi.md#getalbumcount) | **GET** /album/count | [**getAlbumInfo**](AlbumApi.md#getalbuminfo) | **GET** /album/{id} | +[**getAlbumTree**](AlbumApi.md#getalbumtree) | **GET** /album/{id}/sub-album | [**getAllAlbums**](AlbumApi.md#getallalbums) | **GET** /album | [**removeAssetFromAlbum**](AlbumApi.md#removeassetfromalbum) | **DELETE** /album/{id}/assets | +[**removeSubAlbum**](AlbumApi.md#removesubalbum) | **DELETE** /album/{id}/sub-album/{childAlbumId} | [**removeUserFromAlbum**](AlbumApi.md#removeuserfromalbum) | **DELETE** /album/{id}/user/{userId} | [**updateAlbumInfo**](AlbumApi.md#updatealbuminfo) | **PATCH** /album/{id} | @@ -192,6 +195,60 @@ 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) +# **createSubAlbum** +> createSubAlbum(createSubAlbumDto) + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: cookie +//defaultApiClient.getAuthentication('cookie').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('cookie').apiKeyPrefix = 'Bearer'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; +// TODO Configure HTTP Bearer authorization: bearer +// Case 1. Use String Token +//defaultApiClient.getAuthentication('bearer').setAccessToken('YOUR_ACCESS_TOKEN'); +// Case 2. Use Function which generate token. +// String yourTokenGeneratorFunction() { ... } +//defaultApiClient.getAuthentication('bearer').setAccessToken(yourTokenGeneratorFunction); + +final api_instance = AlbumApi(); +final createSubAlbumDto = CreateSubAlbumDto(); // CreateSubAlbumDto | + +try { + api_instance.createSubAlbum(createSubAlbumDto); +} catch (e) { + print('Exception when calling AlbumApi->createSubAlbum: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **createSubAlbumDto** | [**CreateSubAlbumDto**](CreateSubAlbumDto.md)| | + +### Return type + +void (empty response body) + +### Authorization + +[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: application/json + - **Accept**: Not defined + +[[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) + # **deleteAlbum** > deleteAlbum(id) @@ -356,6 +413,60 @@ 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) +# **getAlbumTree** +> getAlbumTree(id) + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: cookie +//defaultApiClient.getAuthentication('cookie').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('cookie').apiKeyPrefix = 'Bearer'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; +// TODO Configure HTTP Bearer authorization: bearer +// Case 1. Use String Token +//defaultApiClient.getAuthentication('bearer').setAccessToken('YOUR_ACCESS_TOKEN'); +// Case 2. Use Function which generate token. +// String yourTokenGeneratorFunction() { ... } +//defaultApiClient.getAuthentication('bearer').setAccessToken(yourTokenGeneratorFunction); + +final api_instance = AlbumApi(); +final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | + +try { + api_instance.getAlbumTree(id); +} catch (e) { + print('Exception when calling AlbumApi->getAlbumTree: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **id** | **String**| | + +### Return type + +void (empty response body) + +### Authorization + +[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[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) + # **getAllAlbums** > List getAllAlbums(assetId, shared) @@ -470,6 +581,62 @@ 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) +# **removeSubAlbum** +> removeSubAlbum(childAlbumId, id) + + + +### Example +```dart +import 'package:openapi/api.dart'; +// TODO Configure API key authorization: cookie +//defaultApiClient.getAuthentication('cookie').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('cookie').apiKeyPrefix = 'Bearer'; +// TODO Configure API key authorization: api_key +//defaultApiClient.getAuthentication('api_key').apiKey = 'YOUR_API_KEY'; +// uncomment below to setup prefix (e.g. Bearer) for API key, if needed +//defaultApiClient.getAuthentication('api_key').apiKeyPrefix = 'Bearer'; +// TODO Configure HTTP Bearer authorization: bearer +// Case 1. Use String Token +//defaultApiClient.getAuthentication('bearer').setAccessToken('YOUR_ACCESS_TOKEN'); +// Case 2. Use Function which generate token. +// String yourTokenGeneratorFunction() { ... } +//defaultApiClient.getAuthentication('bearer').setAccessToken(yourTokenGeneratorFunction); + +final api_instance = AlbumApi(); +final childAlbumId = childAlbumId_example; // String | +final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String | + +try { + api_instance.removeSubAlbum(childAlbumId, id); +} catch (e) { + print('Exception when calling AlbumApi->removeSubAlbum: $e\n'); +} +``` + +### Parameters + +Name | Type | Description | Notes +------------- | ------------- | ------------- | ------------- + **childAlbumId** | **String**| | + **id** | **String**| | + +### Return type + +void (empty response body) + +### Authorization + +[cookie](../README.md#cookie), [api_key](../README.md#api_key), [bearer](../README.md#bearer) + +### HTTP request headers + + - **Content-Type**: Not defined + - **Accept**: Not defined + +[[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) + # **removeUserFromAlbum** > removeUserFromAlbum(id, userId) diff --git a/mobile/openapi/doc/AlbumResponseDto.md b/mobile/openapi/doc/AlbumResponseDto.md index dd4a94e88..31d635f77 100644 --- a/mobile/openapi/doc/AlbumResponseDto.md +++ b/mobile/openapi/doc/AlbumResponseDto.md @@ -12,6 +12,7 @@ Name | Type | Description | Notes **albumThumbnailAssetId** | **String** | | **assetCount** | **int** | | **assets** | [**List**](AssetResponseDto.md) | | [default to const []] +**childAlbums** | [**List**](SubAlbumResponseDto.md) | | [optional] [default to const []] **createdAt** | [**DateTime**](DateTime.md) | | **description** | **String** | | **endDate** | [**DateTime**](DateTime.md) | | [optional] @@ -22,6 +23,7 @@ Name | Type | Description | Notes **order** | [**AssetOrder**](AssetOrder.md) | | [optional] **owner** | [**UserResponseDto**](UserResponseDto.md) | | **ownerId** | **String** | | +**parentAlbums** | [**List**](SubAlbumResponseDto.md) | | [optional] [default to const []] **shared** | **bool** | | **sharedUsers** | [**List**](UserResponseDto.md) | | [default to const []] **startDate** | [**DateTime**](DateTime.md) | | [optional] diff --git a/mobile/openapi/doc/CreateSubAlbumDto.md b/mobile/openapi/doc/CreateSubAlbumDto.md new file mode 100644 index 000000000..fac5b7c61 --- /dev/null +++ b/mobile/openapi/doc/CreateSubAlbumDto.md @@ -0,0 +1,16 @@ +# openapi.model.CreateSubAlbumDto + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**childrenId** | **String** | | +**parentId** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mobile/openapi/doc/SubAlbumResponseDto.md b/mobile/openapi/doc/SubAlbumResponseDto.md new file mode 100644 index 000000000..0e72fd7b3 --- /dev/null +++ b/mobile/openapi/doc/SubAlbumResponseDto.md @@ -0,0 +1,17 @@ +# openapi.model.SubAlbumResponseDto + +## Load the model package +```dart +import 'package:openapi/api.dart'; +``` + +## Properties +Name | Type | Description | Notes +------------ | ------------- | ------------- | ------------- +**albumName** | **String** | | +**albumThumbnailAssetId** | **String** | | +**id** | **String** | | + +[[Back to Model list]](../README.md#documentation-for-models) [[Back to API list]](../README.md#documentation-for-api-endpoints) [[Back to README]](../README.md) + + diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart index ae458f5de..08c127961 100644 --- a/mobile/openapi/lib/api.dart +++ b/mobile/openapi/lib/api.dart @@ -97,6 +97,7 @@ part 'model/colorspace.dart'; part 'model/create_album_dto.dart'; part 'model/create_library_dto.dart'; part 'model/create_profile_image_response_dto.dart'; +part 'model/create_sub_album_dto.dart'; part 'model/create_tag_dto.dart'; part 'model/create_user_dto.dart'; part 'model/curated_locations_response_dto.dart'; @@ -181,6 +182,7 @@ part 'model/shared_link_type.dart'; part 'model/sign_up_dto.dart'; part 'model/smart_info_response_dto.dart'; part 'model/smart_search_dto.dart'; +part 'model/sub_album_response_dto.dart'; part 'model/system_config_dto.dart'; part 'model/system_config_f_fmpeg_dto.dart'; part 'model/system_config_image_dto.dart'; diff --git a/mobile/openapi/lib/api/album_api.dart b/mobile/openapi/lib/api/album_api.dart index f5fe2e3c1..962dd431a 100644 --- a/mobile/openapi/lib/api/album_api.dart +++ b/mobile/openapi/lib/api/album_api.dart @@ -178,6 +178,45 @@ class AlbumApi { return null; } + /// Performs an HTTP 'POST /album/sub-album' operation and returns the [Response]. + /// Parameters: + /// + /// * [CreateSubAlbumDto] createSubAlbumDto (required): + Future createSubAlbumWithHttpInfo(CreateSubAlbumDto createSubAlbumDto,) async { + // ignore: prefer_const_declarations + final path = r'/album/sub-album'; + + // ignore: prefer_final_locals + Object? postBody = createSubAlbumDto; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = ['application/json']; + + + return apiClient.invokeAPI( + path, + 'POST', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Parameters: + /// + /// * [CreateSubAlbumDto] createSubAlbumDto (required): + Future createSubAlbum(CreateSubAlbumDto createSubAlbumDto,) async { + final response = await createSubAlbumWithHttpInfo(createSubAlbumDto,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + /// Performs an HTTP 'DELETE /album/{id}' operation and returns the [Response]. /// Parameters: /// @@ -322,6 +361,46 @@ class AlbumApi { return null; } + /// Performs an HTTP 'GET /album/{id}/sub-album' operation and returns the [Response]. + /// Parameters: + /// + /// * [String] id (required): + Future getAlbumTreeWithHttpInfo(String id,) async { + // ignore: prefer_const_declarations + final path = r'/album/{id}/sub-album' + .replaceAll('{id}', id); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'GET', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Parameters: + /// + /// * [String] id (required): + Future getAlbumTree(String id,) async { + final response = await getAlbumTreeWithHttpInfo(id,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + /// Performs an HTTP 'GET /album' operation and returns the [Response]. /// Parameters: /// @@ -440,6 +519,51 @@ class AlbumApi { return null; } + /// Performs an HTTP 'DELETE /album/{id}/sub-album/{childAlbumId}' operation and returns the [Response]. + /// Parameters: + /// + /// * [String] childAlbumId (required): + /// + /// * [String] id (required): + Future removeSubAlbumWithHttpInfo(String childAlbumId, String id,) async { + // ignore: prefer_const_declarations + final path = r'/album/{id}/sub-album/{childAlbumId}' + .replaceAll('{childAlbumId}', childAlbumId) + .replaceAll('{id}', id); + + // ignore: prefer_final_locals + Object? postBody; + + final queryParams = []; + final headerParams = {}; + final formParams = {}; + + const contentTypes = []; + + + return apiClient.invokeAPI( + path, + 'DELETE', + queryParams, + postBody, + headerParams, + formParams, + contentTypes.isEmpty ? null : contentTypes.first, + ); + } + + /// Parameters: + /// + /// * [String] childAlbumId (required): + /// + /// * [String] id (required): + Future removeSubAlbum(String childAlbumId, String id,) async { + final response = await removeSubAlbumWithHttpInfo(childAlbumId, id,); + if (response.statusCode >= HttpStatus.badRequest) { + throw ApiException(response.statusCode, await _decodeBodyBytes(response)); + } + } + /// Performs an HTTP 'DELETE /album/{id}/user/{userId}' operation and returns the [Response]. /// Parameters: /// diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart index 757f47568..7073fab82 100644 --- a/mobile/openapi/lib/api_client.dart +++ b/mobile/openapi/lib/api_client.dart @@ -272,6 +272,8 @@ class ApiClient { return CreateLibraryDto.fromJson(value); case 'CreateProfileImageResponseDto': return CreateProfileImageResponseDto.fromJson(value); + case 'CreateSubAlbumDto': + return CreateSubAlbumDto.fromJson(value); case 'CreateTagDto': return CreateTagDto.fromJson(value); case 'CreateUserDto': @@ -440,6 +442,8 @@ class ApiClient { return SmartInfoResponseDto.fromJson(value); case 'SmartSearchDto': return SmartSearchDto.fromJson(value); + case 'SubAlbumResponseDto': + return SubAlbumResponseDto.fromJson(value); case 'SystemConfigDto': return SystemConfigDto.fromJson(value); case 'SystemConfigFFmpegDto': diff --git a/mobile/openapi/lib/model/album_response_dto.dart b/mobile/openapi/lib/model/album_response_dto.dart index d76402855..51cad24fe 100644 --- a/mobile/openapi/lib/model/album_response_dto.dart +++ b/mobile/openapi/lib/model/album_response_dto.dart @@ -17,6 +17,7 @@ class AlbumResponseDto { required this.albumThumbnailAssetId, required this.assetCount, this.assets = const [], + this.childAlbums = const [], required this.createdAt, required this.description, this.endDate, @@ -27,6 +28,7 @@ class AlbumResponseDto { this.order, required this.owner, required this.ownerId, + this.parentAlbums = const [], required this.shared, this.sharedUsers = const [], this.startDate, @@ -41,6 +43,8 @@ class AlbumResponseDto { List assets; + List childAlbums; + DateTime createdAt; String description; @@ -79,6 +83,8 @@ class AlbumResponseDto { String ownerId; + List parentAlbums; + bool shared; List sharedUsers; @@ -99,6 +105,7 @@ class AlbumResponseDto { other.albumThumbnailAssetId == albumThumbnailAssetId && other.assetCount == assetCount && _deepEquality.equals(other.assets, assets) && + _deepEquality.equals(other.childAlbums, childAlbums) && other.createdAt == createdAt && other.description == description && other.endDate == endDate && @@ -109,6 +116,7 @@ class AlbumResponseDto { other.order == order && other.owner == owner && other.ownerId == ownerId && + _deepEquality.equals(other.parentAlbums, parentAlbums) && other.shared == shared && _deepEquality.equals(other.sharedUsers, sharedUsers) && other.startDate == startDate && @@ -121,6 +129,7 @@ class AlbumResponseDto { (albumThumbnailAssetId == null ? 0 : albumThumbnailAssetId!.hashCode) + (assetCount.hashCode) + (assets.hashCode) + + (childAlbums.hashCode) + (createdAt.hashCode) + (description.hashCode) + (endDate == null ? 0 : endDate!.hashCode) + @@ -131,13 +140,14 @@ class AlbumResponseDto { (order == null ? 0 : order!.hashCode) + (owner.hashCode) + (ownerId.hashCode) + + (parentAlbums.hashCode) + (shared.hashCode) + (sharedUsers.hashCode) + (startDate == null ? 0 : startDate!.hashCode) + (updatedAt.hashCode); @override - String toString() => 'AlbumResponseDto[albumName=$albumName, albumThumbnailAssetId=$albumThumbnailAssetId, assetCount=$assetCount, assets=$assets, createdAt=$createdAt, description=$description, endDate=$endDate, hasSharedLink=$hasSharedLink, id=$id, isActivityEnabled=$isActivityEnabled, lastModifiedAssetTimestamp=$lastModifiedAssetTimestamp, order=$order, owner=$owner, ownerId=$ownerId, shared=$shared, sharedUsers=$sharedUsers, startDate=$startDate, updatedAt=$updatedAt]'; + String toString() => 'AlbumResponseDto[albumName=$albumName, albumThumbnailAssetId=$albumThumbnailAssetId, assetCount=$assetCount, assets=$assets, childAlbums=$childAlbums, createdAt=$createdAt, description=$description, endDate=$endDate, hasSharedLink=$hasSharedLink, id=$id, isActivityEnabled=$isActivityEnabled, lastModifiedAssetTimestamp=$lastModifiedAssetTimestamp, order=$order, owner=$owner, ownerId=$ownerId, parentAlbums=$parentAlbums, shared=$shared, sharedUsers=$sharedUsers, startDate=$startDate, updatedAt=$updatedAt]'; Map toJson() { final json = {}; @@ -149,6 +159,7 @@ class AlbumResponseDto { } json[r'assetCount'] = this.assetCount; json[r'assets'] = this.assets; + json[r'childAlbums'] = this.childAlbums; json[r'createdAt'] = this.createdAt.toUtc().toIso8601String(); json[r'description'] = this.description; if (this.endDate != null) { @@ -171,6 +182,7 @@ class AlbumResponseDto { } json[r'owner'] = this.owner; json[r'ownerId'] = this.ownerId; + json[r'parentAlbums'] = this.parentAlbums; json[r'shared'] = this.shared; json[r'sharedUsers'] = this.sharedUsers; if (this.startDate != null) { @@ -194,6 +206,7 @@ class AlbumResponseDto { albumThumbnailAssetId: mapValueOfType(json, r'albumThumbnailAssetId'), assetCount: mapValueOfType(json, r'assetCount')!, assets: AssetResponseDto.listFromJson(json[r'assets']), + childAlbums: SubAlbumResponseDto.listFromJson(json[r'childAlbums']), createdAt: mapDateTime(json, r'createdAt', r'')!, description: mapValueOfType(json, r'description')!, endDate: mapDateTime(json, r'endDate', r''), @@ -204,6 +217,7 @@ class AlbumResponseDto { order: AssetOrder.fromJson(json[r'order']), owner: UserResponseDto.fromJson(json[r'owner'])!, ownerId: mapValueOfType(json, r'ownerId')!, + parentAlbums: SubAlbumResponseDto.listFromJson(json[r'parentAlbums']), shared: mapValueOfType(json, r'shared')!, sharedUsers: UserResponseDto.listFromJson(json[r'sharedUsers']), startDate: mapDateTime(json, r'startDate', r''), diff --git a/mobile/openapi/lib/model/create_sub_album_dto.dart b/mobile/openapi/lib/model/create_sub_album_dto.dart new file mode 100644 index 000000000..1823bf5b2 --- /dev/null +++ b/mobile/openapi/lib/model/create_sub_album_dto.dart @@ -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 CreateSubAlbumDto { + /// Returns a new [CreateSubAlbumDto] instance. + CreateSubAlbumDto({ + required this.childrenId, + required this.parentId, + }); + + String childrenId; + + String parentId; + + @override + bool operator ==(Object other) => identical(this, other) || other is CreateSubAlbumDto && + other.childrenId == childrenId && + other.parentId == parentId; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (childrenId.hashCode) + + (parentId.hashCode); + + @override + String toString() => 'CreateSubAlbumDto[childrenId=$childrenId, parentId=$parentId]'; + + Map toJson() { + final json = {}; + json[r'childrenId'] = this.childrenId; + json[r'parentId'] = this.parentId; + return json; + } + + /// Returns a new [CreateSubAlbumDto] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static CreateSubAlbumDto? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + return CreateSubAlbumDto( + childrenId: mapValueOfType(json, r'childrenId')!, + parentId: mapValueOfType(json, r'parentId')!, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = CreateSubAlbumDto.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = CreateSubAlbumDto.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of CreateSubAlbumDto-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = CreateSubAlbumDto.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'childrenId', + 'parentId', + }; +} + diff --git a/mobile/openapi/lib/model/sub_album_response_dto.dart b/mobile/openapi/lib/model/sub_album_response_dto.dart new file mode 100644 index 000000000..110dce524 --- /dev/null +++ b/mobile/openapi/lib/model/sub_album_response_dto.dart @@ -0,0 +1,118 @@ +// +// 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 SubAlbumResponseDto { + /// Returns a new [SubAlbumResponseDto] instance. + SubAlbumResponseDto({ + required this.albumName, + required this.albumThumbnailAssetId, + required this.id, + }); + + String albumName; + + String? albumThumbnailAssetId; + + String id; + + @override + bool operator ==(Object other) => identical(this, other) || other is SubAlbumResponseDto && + other.albumName == albumName && + other.albumThumbnailAssetId == albumThumbnailAssetId && + other.id == id; + + @override + int get hashCode => + // ignore: unnecessary_parenthesis + (albumName.hashCode) + + (albumThumbnailAssetId == null ? 0 : albumThumbnailAssetId!.hashCode) + + (id.hashCode); + + @override + String toString() => 'SubAlbumResponseDto[albumName=$albumName, albumThumbnailAssetId=$albumThumbnailAssetId, id=$id]'; + + Map toJson() { + final json = {}; + json[r'albumName'] = this.albumName; + if (this.albumThumbnailAssetId != null) { + json[r'albumThumbnailAssetId'] = this.albumThumbnailAssetId; + } else { + // json[r'albumThumbnailAssetId'] = null; + } + json[r'id'] = this.id; + return json; + } + + /// Returns a new [SubAlbumResponseDto] instance and imports its values from + /// [value] if it's a [Map], null otherwise. + // ignore: prefer_constructors_over_static_methods + static SubAlbumResponseDto? fromJson(dynamic value) { + if (value is Map) { + final json = value.cast(); + + return SubAlbumResponseDto( + albumName: mapValueOfType(json, r'albumName')!, + albumThumbnailAssetId: mapValueOfType(json, r'albumThumbnailAssetId'), + id: mapValueOfType(json, r'id')!, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + if (json is List && json.isNotEmpty) { + for (final row in json) { + final value = SubAlbumResponseDto.fromJson(row); + if (value != null) { + result.add(value); + } + } + } + return result.toList(growable: growable); + } + + static Map mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // ignore: parameter_assignments + for (final entry in json.entries) { + final value = SubAlbumResponseDto.fromJson(entry.value); + if (value != null) { + map[entry.key] = value; + } + } + } + return map; + } + + // maps a json object with a list of SubAlbumResponseDto-objects as value to a dart map + static Map> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + for (final entry in json.entries) { + map[entry.key] = SubAlbumResponseDto.listFromJson(entry.value, growable: growable,); + } + } + return map; + } + + /// The list of required keys that must be present in a JSON. + static const requiredKeys = { + 'albumName', + 'albumThumbnailAssetId', + 'id', + }; +} + diff --git a/mobile/openapi/test/album_api_test.dart b/mobile/openapi/test/album_api_test.dart index aee26e095..06f3765ac 100644 --- a/mobile/openapi/test/album_api_test.dart +++ b/mobile/openapi/test/album_api_test.dart @@ -32,6 +32,11 @@ void main() { // TODO }); + //Future createSubAlbum(CreateSubAlbumDto createSubAlbumDto) async + test('test createSubAlbum', () async { + // TODO + }); + //Future deleteAlbum(String id) async test('test deleteAlbum', () async { // TODO @@ -47,6 +52,11 @@ void main() { // TODO }); + //Future getAlbumTree(String id) async + test('test getAlbumTree', () async { + // TODO + }); + //Future> getAllAlbums({ String assetId, bool shared }) async test('test getAllAlbums', () async { // TODO @@ -57,6 +67,11 @@ void main() { // TODO }); + //Future removeSubAlbum(String childAlbumId, String id) async + test('test removeSubAlbum', () async { + // TODO + }); + //Future removeUserFromAlbum(String id, String userId) async test('test removeUserFromAlbum', () async { // TODO diff --git a/mobile/openapi/test/album_response_dto_test.dart b/mobile/openapi/test/album_response_dto_test.dart index 5c79e5d2f..be1d1e983 100644 --- a/mobile/openapi/test/album_response_dto_test.dart +++ b/mobile/openapi/test/album_response_dto_test.dart @@ -36,6 +36,11 @@ void main() { // TODO }); + // List childAlbums (default value: const []) + test('to test the property `childAlbums`', () async { + // TODO + }); + // DateTime createdAt test('to test the property `createdAt`', () async { // TODO @@ -86,6 +91,11 @@ void main() { // TODO }); + // List parentAlbums (default value: const []) + test('to test the property `parentAlbums`', () async { + // TODO + }); + // bool shared test('to test the property `shared`', () async { // TODO diff --git a/mobile/openapi/test/create_sub_album_dto_test.dart b/mobile/openapi/test/create_sub_album_dto_test.dart new file mode 100644 index 000000000..6f24f9bf6 --- /dev/null +++ b/mobile/openapi/test/create_sub_album_dto_test.dart @@ -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 CreateSubAlbumDto +void main() { + // final instance = CreateSubAlbumDto(); + + group('test CreateSubAlbumDto', () { + // String childrenId + test('to test the property `childrenId`', () async { + // TODO + }); + + // String parentId + test('to test the property `parentId`', () async { + // TODO + }); + + + }); + +} diff --git a/mobile/openapi/test/sub_album_response_dto_test.dart b/mobile/openapi/test/sub_album_response_dto_test.dart new file mode 100644 index 000000000..7fe2f99df --- /dev/null +++ b/mobile/openapi/test/sub_album_response_dto_test.dart @@ -0,0 +1,37 @@ +// +// 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 SubAlbumResponseDto +void main() { + // final instance = SubAlbumResponseDto(); + + group('test SubAlbumResponseDto', () { + // String albumName + test('to test the property `albumName`', () async { + // TODO + }); + + // String albumThumbnailAssetId + test('to test the property `albumThumbnailAssetId`', () async { + // TODO + }); + + // String id + test('to test the property `id`', () async { + // TODO + }); + + + }); + +} diff --git a/open-api/immich-openapi-specs.json b/open-api/immich-openapi-specs.json index 70e797f52..f3c5165f5 100644 --- a/open-api/immich-openapi-specs.json +++ b/open-api/immich-openapi-specs.json @@ -332,6 +332,41 @@ ] } }, + "/album/sub-album": { + "post": { + "operationId": "createSubAlbum", + "parameters": [], + "requestBody": { + "content": { + "application/json": { + "schema": { + "$ref": "#/components/schemas/CreateSubAlbumDto" + } + } + }, + "required": true + }, + "responses": { + "201": { + "description": "" + } + }, + "security": [ + { + "bearer": [] + }, + { + "cookie": [] + }, + { + "api_key": [] + } + ], + "tags": [ + "Album" + ] + } + }, "/album/{id}": { "delete": { "operationId": "deleteAlbum", @@ -589,6 +624,84 @@ ] } }, + "/album/{id}/sub-album": { + "get": { + "operationId": "getAlbumTree", + "parameters": [ + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "format": "uuid", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "security": [ + { + "bearer": [] + }, + { + "cookie": [] + }, + { + "api_key": [] + } + ], + "tags": [ + "Album" + ] + } + }, + "/album/{id}/sub-album/{childAlbumId}": { + "delete": { + "operationId": "removeSubAlbum", + "parameters": [ + { + "name": "childAlbumId", + "required": true, + "in": "path", + "schema": { + "type": "string" + } + }, + { + "name": "id", + "required": true, + "in": "path", + "schema": { + "format": "uuid", + "type": "string" + } + } + ], + "responses": { + "200": { + "description": "" + } + }, + "security": [ + { + "bearer": [] + }, + { + "cookie": [] + }, + { + "api_key": [] + } + ], + "tags": [ + "Album" + ] + } + }, "/album/{id}/user/{userId}": { "delete": { "operationId": "removeUserFromAlbum", @@ -7083,6 +7196,12 @@ }, "type": "array" }, + "childAlbums": { + "items": { + "$ref": "#/components/schemas/SubAlbumResponseDto" + }, + "type": "array" + }, "createdAt": { "format": "date-time", "type": "string" @@ -7116,6 +7235,12 @@ "ownerId": { "type": "string" }, + "parentAlbums": { + "items": { + "$ref": "#/components/schemas/SubAlbumResponseDto" + }, + "type": "array" + }, "shared": { "type": "boolean" }, @@ -8047,6 +8172,22 @@ ], "type": "object" }, + "CreateSubAlbumDto": { + "properties": { + "childrenId": { + "format": "uuid", + "type": "string" + }, + "parentId": { + "type": "string" + } + }, + "required": [ + "childrenId", + "parentId" + ], + "type": "object" + }, "CreateTagDto": { "properties": { "name": { @@ -10206,6 +10347,26 @@ ], "type": "object" }, + "SubAlbumResponseDto": { + "properties": { + "albumName": { + "type": "string" + }, + "albumThumbnailAssetId": { + "nullable": true, + "type": "string" + }, + "id": { + "type": "string" + } + }, + "required": [ + "albumName", + "albumThumbnailAssetId", + "id" + ], + "type": "object" + }, "SystemConfigDto": { "properties": { "ffmpeg": { diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index bed1380d9..acbd7ce0f 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -141,11 +141,17 @@ export type AssetResponseDto = { "type": AssetTypeEnum; updatedAt: string; }; +export type SubAlbumResponseDto = { + albumName: string; + albumThumbnailAssetId: string | null; + id: string; +}; export type AlbumResponseDto = { albumName: string; albumThumbnailAssetId: string | null; assetCount: number; assets: AssetResponseDto[]; + childAlbums?: SubAlbumResponseDto[]; createdAt: string; description: string; endDate?: string; @@ -156,6 +162,7 @@ export type AlbumResponseDto = { order?: AssetOrder; owner: UserResponseDto; ownerId: string; + parentAlbums?: SubAlbumResponseDto[]; shared: boolean; sharedUsers: UserResponseDto[]; startDate?: string; @@ -172,6 +179,10 @@ export type AlbumCountResponseDto = { owned: number; shared: number; }; +export type CreateSubAlbumDto = { + childrenId: string; + parentId: string; +}; export type UpdateAlbumDto = { albumName?: string; albumThumbnailAssetId?: string; @@ -1123,6 +1134,15 @@ export function getAlbumCount(opts?: Oazapfts.RequestOpts) { ...opts })); } +export function createSubAlbum({ createSubAlbumDto }: { + createSubAlbumDto: CreateSubAlbumDto; +}, opts?: Oazapfts.RequestOpts) { + return oazapfts.ok(oazapfts.fetchText("/album/sub-album", oazapfts.json({ + ...opts, + method: "POST", + body: createSubAlbumDto + }))); +} export function deleteAlbum({ id }: { id: string; }, opts?: Oazapfts.RequestOpts) { @@ -1188,6 +1208,22 @@ export function addAssetsToAlbum({ id, key, bulkIdsDto }: { body: bulkIdsDto }))); } +export function getAlbumTree({ id }: { + id: string; +}, opts?: Oazapfts.RequestOpts) { + return oazapfts.ok(oazapfts.fetchText(`/album/${encodeURIComponent(id)}/sub-album`, { + ...opts + })); +} +export function removeSubAlbum({ childAlbumId, id }: { + childAlbumId: string; + id: string; +}, opts?: Oazapfts.RequestOpts) { + return oazapfts.ok(oazapfts.fetchText(`/album/${encodeURIComponent(id)}/sub-album/${encodeURIComponent(childAlbumId)}`, { + ...opts, + method: "DELETE" + })); +} export function removeUserFromAlbum({ id, userId }: { id: string; userId: string; diff --git a/server/src/controllers/album.controller.ts b/server/src/controllers/album.controller.ts index c4b11fbb4..dcf78f4c8 100644 --- a/server/src/controllers/album.controller.ts +++ b/server/src/controllers/album.controller.ts @@ -6,6 +6,7 @@ import { AlbumInfoDto, AlbumResponseDto, CreateAlbumDto, + CreateSubAlbumDto, GetAlbumsDto, UpdateAlbumDto, } from 'src/dtos/album.dto'; @@ -96,4 +97,23 @@ export class AlbumController { ) { return this.service.removeUser(auth, id, userId); } + + @Post('sub-album') + createSubAlbum(@Auth() auth: AuthDto, @Body() dto: CreateSubAlbumDto) { + // TODO + } + + @Delete(':id/sub-album/:childAlbumId') + removeSubAlbum( + @Auth() auth: AuthDto, + @Param() { id }: UUIDParamDto, + @Param('childAlbumId', new ParseMeUUIDPipe({ version: '4' })) childAlbumId: string, + ) { + // TODO + } + + @Get(':id/sub-album') + getAlbumTree(@Auth() auth: AuthDto, @Param() { id }: UUIDParamDto) { + // TODO + } } diff --git a/server/src/dtos/album.dto.ts b/server/src/dtos/album.dto.ts index ee328359a..4c1e02062 100644 --- a/server/src/dtos/album.dto.ts +++ b/server/src/dtos/album.dto.ts @@ -116,6 +116,14 @@ export class AlbumResponseDto { childAlbums?: SubAlbumResponseDto[]; } +export class CreateSubAlbumDto { + @IsString() + parentId!: string; + + @ValidateUUID() + childrenId!: string; +} + export const mapAlbum = (entity: AlbumEntity, withAssets: boolean, auth?: AuthDto): AlbumResponseDto => { const sharedUsers: UserResponseDto[] = [];