1
0
forked from Cutlery/immich

album tree

This commit is contained in:
Alex Tran 2024-04-02 22:41:02 -05:00
parent 7aa98162af
commit 569d579743
20 changed files with 901 additions and 1 deletions

View File

@ -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

View File

@ -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)

View File

@ -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<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = AlbumApi();
final 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<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = AlbumApi();
final id = 38400000-8cf0-11bd-b23e-10b96e4ef00d; // String |
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<AlbumResponseDto> 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<ApiKeyAuth>('cookie').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('cookie').apiKeyPrefix = 'Bearer';
// TODO Configure API key authorization: api_key
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKey = 'YOUR_API_KEY';
// uncomment below to setup prefix (e.g. Bearer) for API key, if needed
//defaultApiClient.getAuthentication<ApiKeyAuth>('api_key').apiKeyPrefix = 'Bearer';
// TODO Configure HTTP Bearer authorization: bearer
// Case 1. Use String Token
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken('YOUR_ACCESS_TOKEN');
// Case 2. Use Function which generate token.
// String yourTokenGeneratorFunction() { ... }
//defaultApiClient.getAuthentication<HttpBearerAuth>('bearer').setAccessToken(yourTokenGeneratorFunction);
final api_instance = AlbumApi();
final 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)

View File

@ -12,6 +12,7 @@ Name | Type | Description | Notes
**albumThumbnailAssetId** | **String** | |
**assetCount** | **int** | |
**assets** | [**List<AssetResponseDto>**](AssetResponseDto.md) | | [default to const []]
**childAlbums** | [**List<SubAlbumResponseDto>**](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>**](SubAlbumResponseDto.md) | | [optional] [default to const []]
**shared** | **bool** | |
**sharedUsers** | [**List<UserResponseDto>**](UserResponseDto.md) | | [default to const []]
**startDate** | [**DateTime**](DateTime.md) | | [optional]

16
mobile/openapi/doc/CreateSubAlbumDto.md generated Normal file
View File

@ -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)

View File

@ -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)

View File

@ -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';

View File

@ -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<Response> createSubAlbumWithHttpInfo(CreateSubAlbumDto createSubAlbumDto,) async {
// ignore: prefer_const_declarations
final path = r'/album/sub-album';
// ignore: prefer_final_locals
Object? postBody = createSubAlbumDto;
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:
///
/// * [CreateSubAlbumDto] createSubAlbumDto (required):
Future<void> 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<Response> 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 = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [String] id (required):
Future<void> 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<Response> 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 = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'DELETE',
queryParams,
postBody,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
/// Parameters:
///
/// * [String] childAlbumId (required):
///
/// * [String] id (required):
Future<void> 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:
///

View File

@ -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':

View File

@ -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<AssetResponseDto> assets;
List<SubAlbumResponseDto> childAlbums;
DateTime createdAt;
String description;
@ -79,6 +83,8 @@ class AlbumResponseDto {
String ownerId;
List<SubAlbumResponseDto> parentAlbums;
bool shared;
List<UserResponseDto> 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<String, dynamic> toJson() {
final json = <String, dynamic>{};
@ -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<String>(json, r'albumThumbnailAssetId'),
assetCount: mapValueOfType<int>(json, r'assetCount')!,
assets: AssetResponseDto.listFromJson(json[r'assets']),
childAlbums: SubAlbumResponseDto.listFromJson(json[r'childAlbums']),
createdAt: mapDateTime(json, r'createdAt', r'')!,
description: mapValueOfType<String>(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<String>(json, r'ownerId')!,
parentAlbums: SubAlbumResponseDto.listFromJson(json[r'parentAlbums']),
shared: mapValueOfType<bool>(json, r'shared')!,
sharedUsers: UserResponseDto.listFromJson(json[r'sharedUsers']),
startDate: mapDateTime(json, r'startDate', r''),

View File

@ -0,0 +1,106 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class 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<String, dynamic> toJson() {
final json = <String, dynamic>{};
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<String, dynamic>();
return CreateSubAlbumDto(
childrenId: mapValueOfType<String>(json, r'childrenId')!,
parentId: mapValueOfType<String>(json, r'parentId')!,
);
}
return null;
}
static List<CreateSubAlbumDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <CreateSubAlbumDto>[];
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<String, CreateSubAlbumDto> mapFromJson(dynamic json) {
final map = <String, CreateSubAlbumDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // 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<String, List<CreateSubAlbumDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<CreateSubAlbumDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
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 = <String>{
'childrenId',
'parentId',
};
}

View File

@ -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<String, dynamic> toJson() {
final json = <String, dynamic>{};
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<String, dynamic>();
return SubAlbumResponseDto(
albumName: mapValueOfType<String>(json, r'albumName')!,
albumThumbnailAssetId: mapValueOfType<String>(json, r'albumThumbnailAssetId'),
id: mapValueOfType<String>(json, r'id')!,
);
}
return null;
}
static List<SubAlbumResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <SubAlbumResponseDto>[];
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<String, SubAlbumResponseDto> mapFromJson(dynamic json) {
final map = <String, SubAlbumResponseDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // 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<String, List<SubAlbumResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<SubAlbumResponseDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
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 = <String>{
'albumName',
'albumThumbnailAssetId',
'id',
};
}

View File

@ -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<List<AlbumResponseDto>> 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

View File

@ -36,6 +36,11 @@ void main() {
// TODO
});
// List<SubAlbumResponseDto> 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<SubAlbumResponseDto> parentAlbums (default value: const [])
test('to test the property `parentAlbums`', () async {
// TODO
});
// bool shared
test('to test the property `shared`', () async {
// TODO

View File

@ -0,0 +1,32 @@
//
// AUTO-GENERATED FILE, DO NOT MODIFY!
//
// @dart=2.12
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
import 'package:openapi/api.dart';
import 'package:test/test.dart';
// tests for 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
});
});
}

View File

@ -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
});
});
}

View File

@ -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": {

View File

@ -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;

View File

@ -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
}
}

View File

@ -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[] = [];