refactor(server): album count (#2746)

* refactor(server): album count

* chore: open api
This commit is contained in:
Jason Rasmussen 2023-06-16 11:48:48 -04:00 committed by GitHub
parent 441ee2ef90
commit 07f7fffae7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 100 additions and 95 deletions

View file

@ -83,7 +83,7 @@ Class | Method | HTTP request | Description
*AlbumApi* | [**createAlbumSharedLink**](doc//AlbumApi.md#createalbumsharedlink) | **POST** /album/create-shared-link |
*AlbumApi* | [**deleteAlbum**](doc//AlbumApi.md#deletealbum) | **DELETE** /album/{id} |
*AlbumApi* | [**downloadArchive**](doc//AlbumApi.md#downloadarchive) | **GET** /album/{id}/download |
*AlbumApi* | [**getAlbumCountByUserId**](doc//AlbumApi.md#getalbumcountbyuserid) | **GET** /album/count-by-user-id |
*AlbumApi* | [**getAlbumCount**](doc//AlbumApi.md#getalbumcount) | **GET** /album/count |
*AlbumApi* | [**getAlbumInfo**](doc//AlbumApi.md#getalbuminfo) | **GET** /album/{id} |
*AlbumApi* | [**getAllAlbums**](doc//AlbumApi.md#getallalbums) | **GET** /album |
*AlbumApi* | [**removeAssetFromAlbum**](doc//AlbumApi.md#removeassetfromalbum) | **DELETE** /album/{id}/assets |

View file

@ -15,7 +15,7 @@ Method | HTTP request | Description
[**createAlbumSharedLink**](AlbumApi.md#createalbumsharedlink) | **POST** /album/create-shared-link |
[**deleteAlbum**](AlbumApi.md#deletealbum) | **DELETE** /album/{id} |
[**downloadArchive**](AlbumApi.md#downloadarchive) | **GET** /album/{id}/download |
[**getAlbumCountByUserId**](AlbumApi.md#getalbumcountbyuserid) | **GET** /album/count-by-user-id |
[**getAlbumCount**](AlbumApi.md#getalbumcount) | **GET** /album/count |
[**getAlbumInfo**](AlbumApi.md#getalbuminfo) | **GET** /album/{id} |
[**getAllAlbums**](AlbumApi.md#getallalbums) | **GET** /album |
[**removeAssetFromAlbum**](AlbumApi.md#removeassetfromalbum) | **DELETE** /album/{id}/assets |
@ -364,8 +364,8 @@ 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)
# **getAlbumCountByUserId**
> AlbumCountResponseDto getAlbumCountByUserId()
# **getAlbumCount**
> AlbumCountResponseDto getAlbumCount()
@ -390,10 +390,10 @@ import 'package:openapi/api.dart';
final api_instance = AlbumApi();
try {
final result = api_instance.getAlbumCountByUserId();
final result = api_instance.getAlbumCount();
print(result);
} catch (e) {
print('Exception when calling AlbumApi->getAlbumCountByUserId: $e\n');
print('Exception when calling AlbumApi->getAlbumCount: $e\n');
}
```

View file

@ -10,7 +10,7 @@ Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**owned** | **int** | |
**shared** | **int** | |
**sharing** | **int** | |
**notShared** | **int** | |
[[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

@ -332,10 +332,10 @@ class AlbumApi {
return null;
}
/// Performs an HTTP 'GET /album/count-by-user-id' operation and returns the [Response].
Future<Response> getAlbumCountByUserIdWithHttpInfo() async {
/// Performs an HTTP 'GET /album/count' operation and returns the [Response].
Future<Response> getAlbumCountWithHttpInfo() async {
// ignore: prefer_const_declarations
final path = r'/album/count-by-user-id';
final path = r'/album/count';
// ignore: prefer_final_locals
Object? postBody;
@ -358,8 +358,8 @@ class AlbumApi {
);
}
Future<AlbumCountResponseDto?> getAlbumCountByUserId() async {
final response = await getAlbumCountByUserIdWithHttpInfo();
Future<AlbumCountResponseDto?> getAlbumCount() async {
final response = await getAlbumCountWithHttpInfo();
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}

View file

@ -15,36 +15,36 @@ class AlbumCountResponseDto {
AlbumCountResponseDto({
required this.owned,
required this.shared,
required this.sharing,
required this.notShared,
});
int owned;
int shared;
int sharing;
int notShared;
@override
bool operator ==(Object other) => identical(this, other) || other is AlbumCountResponseDto &&
other.owned == owned &&
other.shared == shared &&
other.sharing == sharing;
other.notShared == notShared;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(owned.hashCode) +
(shared.hashCode) +
(sharing.hashCode);
(notShared.hashCode);
@override
String toString() => 'AlbumCountResponseDto[owned=$owned, shared=$shared, sharing=$sharing]';
String toString() => 'AlbumCountResponseDto[owned=$owned, shared=$shared, notShared=$notShared]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'owned'] = this.owned;
json[r'shared'] = this.shared;
json[r'sharing'] = this.sharing;
json[r'notShared'] = this.notShared;
return json;
}
@ -69,7 +69,7 @@ class AlbumCountResponseDto {
return AlbumCountResponseDto(
owned: mapValueOfType<int>(json, r'owned')!,
shared: mapValueOfType<int>(json, r'shared')!,
sharing: mapValueOfType<int>(json, r'sharing')!,
notShared: mapValueOfType<int>(json, r'notShared')!,
);
}
return null;
@ -119,7 +119,7 @@ class AlbumCountResponseDto {
static const requiredKeys = <String>{
'owned',
'shared',
'sharing',
'notShared',
};
}

View file

@ -47,8 +47,8 @@ void main() {
// TODO
});
//Future<AlbumCountResponseDto> getAlbumCountByUserId() async
test('test getAlbumCountByUserId', () async {
//Future<AlbumCountResponseDto> getAlbumCount() async
test('test getAlbumCount', () async {
// TODO
});

View file

@ -26,8 +26,8 @@ void main() {
// TODO
});
// int sharing
test('to test the property `sharing`', () async {
// int notShared
test('to test the property `notShared`', () async {
// TODO
});