generate openapi

This commit is contained in:
mgabor
2024-04-12 13:49:06 +02:00
parent 06028a283b
commit 44a086c2f9
12 changed files with 227 additions and 20 deletions

View File

@@ -15,6 +15,7 @@ doc/ActivityStatisticsResponseDto.md
doc/AddUsersDto.md
doc/AlbumApi.md
doc/AlbumCountResponseDto.md
doc/AlbumPermissionResponseDto.md
doc/AlbumResponseDto.md
doc/AllJobStatusResponseDto.md
doc/AssetApi.md
@@ -236,6 +237,7 @@ lib/model/activity_response_dto.dart
lib/model/activity_statistics_response_dto.dart
lib/model/add_users_dto.dart
lib/model/album_count_response_dto.dart
lib/model/album_permission_response_dto.dart
lib/model/album_response_dto.dart
lib/model/all_job_status_response_dto.dart
lib/model/api_key_create_dto.dart
@@ -413,6 +415,7 @@ test/activity_statistics_response_dto_test.dart
test/add_users_dto_test.dart
test/album_api_test.dart
test/album_count_response_dto_test.dart
test/album_permission_response_dto_test.dart
test/album_response_dto_test.dart
test/all_job_status_response_dto_test.dart
test/api_key_api_test.dart

View File

@@ -232,6 +232,7 @@ Class | Method | HTTP request | Description
- [ActivityStatisticsResponseDto](doc//ActivityStatisticsResponseDto.md)
- [AddUsersDto](doc//AddUsersDto.md)
- [AlbumCountResponseDto](doc//AlbumCountResponseDto.md)
- [AlbumPermissionResponseDto](doc//AlbumPermissionResponseDto.md)
- [AlbumResponseDto](doc//AlbumResponseDto.md)
- [AllJobStatusResponseDto](doc//AllJobStatusResponseDto.md)
- [AssetBulkDeleteDto](doc//AssetBulkDeleteDto.md)

View File

@@ -0,0 +1,16 @@
# openapi.model.AlbumPermissionResponseDto
## Load the model package
```dart
import 'package:openapi/api.dart';
```
## Properties
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**readonly** | **bool** | |
**user** | [**UserResponseDto**](UserResponseDto.md) | |
[[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

@@ -9,6 +9,7 @@ import 'package:openapi/api.dart';
Name | Type | Description | Notes
------------ | ------------- | ------------- | -------------
**albumName** | **String** | |
**albumPermissions** | [**List<AlbumPermissionResponseDto>**](AlbumPermissionResponseDto.md) | | [default to const []]
**albumThumbnailAssetId** | **String** | |
**assetCount** | **int** | |
**assets** | [**List<AssetResponseDto>**](AssetResponseDto.md) | | [default to const []]
@@ -23,7 +24,7 @@ Name | Type | Description | Notes
**owner** | [**UserResponseDto**](UserResponseDto.md) | |
**ownerId** | **String** | |
**shared** | **bool** | |
**sharedUsers** | [**List<UserResponseDto>**](UserResponseDto.md) | | [default to const []]
**sharedUsers** | [**List<UserResponseDto>**](UserResponseDto.md) | Deprecated in favor of albumPermissions | [default to const []]
**startDate** | [**DateTime**](DateTime.md) | | [optional]
**updatedAt** | [**DateTime**](DateTime.md) | |

View File

@@ -61,6 +61,7 @@ part 'model/activity_response_dto.dart';
part 'model/activity_statistics_response_dto.dart';
part 'model/add_users_dto.dart';
part 'model/album_count_response_dto.dart';
part 'model/album_permission_response_dto.dart';
part 'model/album_response_dto.dart';
part 'model/all_job_status_response_dto.dart';
part 'model/asset_bulk_delete_dto.dart';

View File

@@ -200,6 +200,8 @@ class ApiClient {
return AddUsersDto.fromJson(value);
case 'AlbumCountResponseDto':
return AlbumCountResponseDto.fromJson(value);
case 'AlbumPermissionResponseDto':
return AlbumPermissionResponseDto.fromJson(value);
case 'AlbumResponseDto':
return AlbumResponseDto.fromJson(value);
case 'AllJobStatusResponseDto':

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 AlbumPermissionResponseDto {
/// Returns a new [AlbumPermissionResponseDto] instance.
AlbumPermissionResponseDto({
required this.readonly,
required this.user,
});
bool readonly;
UserResponseDto user;
@override
bool operator ==(Object other) => identical(this, other) || other is AlbumPermissionResponseDto &&
other.readonly == readonly &&
other.user == user;
@override
int get hashCode =>
// ignore: unnecessary_parenthesis
(readonly.hashCode) +
(user.hashCode);
@override
String toString() => 'AlbumPermissionResponseDto[readonly=$readonly, user=$user]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'readonly'] = this.readonly;
json[r'user'] = this.user;
return json;
}
/// Returns a new [AlbumPermissionResponseDto] instance and imports its values from
/// [value] if it's a [Map], null otherwise.
// ignore: prefer_constructors_over_static_methods
static AlbumPermissionResponseDto? fromJson(dynamic value) {
if (value is Map) {
final json = value.cast<String, dynamic>();
return AlbumPermissionResponseDto(
readonly: mapValueOfType<bool>(json, r'readonly')!,
user: UserResponseDto.fromJson(json[r'user'])!,
);
}
return null;
}
static List<AlbumPermissionResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
final result = <AlbumPermissionResponseDto>[];
if (json is List && json.isNotEmpty) {
for (final row in json) {
final value = AlbumPermissionResponseDto.fromJson(row);
if (value != null) {
result.add(value);
}
}
}
return result.toList(growable: growable);
}
static Map<String, AlbumPermissionResponseDto> mapFromJson(dynamic json) {
final map = <String, AlbumPermissionResponseDto>{};
if (json is Map && json.isNotEmpty) {
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
for (final entry in json.entries) {
final value = AlbumPermissionResponseDto.fromJson(entry.value);
if (value != null) {
map[entry.key] = value;
}
}
}
return map;
}
// maps a json object with a list of AlbumPermissionResponseDto-objects as value to a dart map
static Map<String, List<AlbumPermissionResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
final map = <String, List<AlbumPermissionResponseDto>>{};
if (json is Map && json.isNotEmpty) {
// ignore: parameter_assignments
json = json.cast<String, dynamic>();
for (final entry in json.entries) {
map[entry.key] = AlbumPermissionResponseDto.listFromJson(entry.value, growable: growable,);
}
}
return map;
}
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'readonly',
'user',
};
}

View File

@@ -14,6 +14,7 @@ class AlbumResponseDto {
/// Returns a new [AlbumResponseDto] instance.
AlbumResponseDto({
required this.albumName,
this.albumPermissions = const [],
required this.albumThumbnailAssetId,
required this.assetCount,
this.assets = const [],
@@ -35,6 +36,8 @@ class AlbumResponseDto {
String albumName;
List<AlbumPermissionResponseDto> albumPermissions;
String? albumThumbnailAssetId;
int assetCount;
@@ -81,6 +84,7 @@ class AlbumResponseDto {
bool shared;
/// Deprecated in favor of albumPermissions
List<UserResponseDto> sharedUsers;
///
@@ -96,6 +100,7 @@ class AlbumResponseDto {
@override
bool operator ==(Object other) => identical(this, other) || other is AlbumResponseDto &&
other.albumName == albumName &&
_deepEquality.equals(other.albumPermissions, albumPermissions) &&
other.albumThumbnailAssetId == albumThumbnailAssetId &&
other.assetCount == assetCount &&
_deepEquality.equals(other.assets, assets) &&
@@ -118,6 +123,7 @@ class AlbumResponseDto {
int get hashCode =>
// ignore: unnecessary_parenthesis
(albumName.hashCode) +
(albumPermissions.hashCode) +
(albumThumbnailAssetId == null ? 0 : albumThumbnailAssetId!.hashCode) +
(assetCount.hashCode) +
(assets.hashCode) +
@@ -137,11 +143,12 @@ class AlbumResponseDto {
(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, albumPermissions=$albumPermissions, 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]';
Map<String, dynamic> toJson() {
final json = <String, dynamic>{};
json[r'albumName'] = this.albumName;
json[r'albumPermissions'] = this.albumPermissions;
if (this.albumThumbnailAssetId != null) {
json[r'albumThumbnailAssetId'] = this.albumThumbnailAssetId;
} else {
@@ -191,6 +198,7 @@ class AlbumResponseDto {
return AlbumResponseDto(
albumName: mapValueOfType<String>(json, r'albumName')!,
albumPermissions: AlbumPermissionResponseDto.listFromJson(json[r'albumPermissions']),
albumThumbnailAssetId: mapValueOfType<String>(json, r'albumThumbnailAssetId'),
assetCount: mapValueOfType<int>(json, r'assetCount')!,
assets: AssetResponseDto.listFromJson(json[r'assets']),
@@ -256,6 +264,7 @@ class AlbumResponseDto {
/// The list of required keys that must be present in a JSON.
static const requiredKeys = <String>{
'albumName',
'albumPermissions',
'albumThumbnailAssetId',
'assetCount',
'assets',

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 AlbumPermissionResponseDto
void main() {
// final instance = AlbumPermissionResponseDto();
group('test AlbumPermissionResponseDto', () {
// bool readonly
test('to test the property `readonly`', () async {
// TODO
});
// UserResponseDto user
test('to test the property `user`', () async {
// TODO
});
});
}

View File

@@ -21,6 +21,11 @@ void main() {
// TODO
});
// List<AlbumPermissionResponseDto> albumPermissions (default value: const [])
test('to test the property `albumPermissions`', () async {
// TODO
});
// String albumThumbnailAssetId
test('to test the property `albumThumbnailAssetId`', () async {
// TODO
@@ -91,6 +96,7 @@ void main() {
// TODO
});
// Deprecated in favor of albumPermissions
// List<UserResponseDto> sharedUsers (default value: const [])
test('to test the property `sharedUsers`', () async {
// TODO

View File

@@ -7065,11 +7065,32 @@
],
"type": "object"
},
"AlbumPermissionResponseDto": {
"properties": {
"readonly": {
"type": "boolean"
},
"user": {
"$ref": "#/components/schemas/UserResponseDto"
}
},
"required": [
"readonly",
"user"
],
"type": "object"
},
"AlbumResponseDto": {
"properties": {
"albumName": {
"type": "string"
},
"albumPermissions": {
"items": {
"$ref": "#/components/schemas/AlbumPermissionResponseDto"
},
"type": "array"
},
"albumThumbnailAssetId": {
"nullable": true,
"type": "string"
@@ -7120,6 +7141,8 @@
"type": "boolean"
},
"sharedUsers": {
"deprecated": true,
"description": "Deprecated in favor of albumPermissions",
"items": {
"$ref": "#/components/schemas/UserResponseDto"
},
@@ -7136,6 +7159,7 @@
},
"required": [
"albumName",
"albumPermissions",
"albumThumbnailAssetId",
"assetCount",
"assets",

View File

@@ -38,6 +38,28 @@ export type ActivityCreateDto = {
export type ActivityStatisticsResponseDto = {
comments: number;
};
export type UserResponseDto = {
avatarColor: UserAvatarColor;
createdAt: string;
deletedAt: string | null;
email: string;
id: string;
isAdmin: boolean;
memoriesEnabled?: boolean;
name: string;
oauthId: string;
profileImagePath: string;
quotaSizeInBytes: number | null;
quotaUsageInBytes: number | null;
shouldChangePassword: boolean;
status: UserStatus;
storageLabel: string | null;
updatedAt: string;
};
export type AlbumPermissionResponseDto = {
"readonly": boolean;
user: UserResponseDto;
};
export type ExifResponseDto = {
city?: string | null;
country?: string | null;
@@ -61,24 +83,6 @@ export type ExifResponseDto = {
state?: string | null;
timeZone?: string | null;
};
export type UserResponseDto = {
avatarColor: UserAvatarColor;
createdAt: string;
deletedAt: string | null;
email: string;
id: string;
isAdmin: boolean;
memoriesEnabled?: boolean;
name: string;
oauthId: string;
profileImagePath: string;
quotaSizeInBytes: number | null;
quotaUsageInBytes: number | null;
shouldChangePassword: boolean;
status: UserStatus;
storageLabel: string | null;
updatedAt: string;
};
export type AssetFaceWithoutPersonResponseDto = {
boundingBoxX1: number;
boundingBoxX2: number;
@@ -143,6 +147,7 @@ export type AssetResponseDto = {
};
export type AlbumResponseDto = {
albumName: string;
albumPermissions: AlbumPermissionResponseDto[];
albumThumbnailAssetId: string | null;
assetCount: number;
assets: AssetResponseDto[];
@@ -157,6 +162,7 @@ export type AlbumResponseDto = {
owner: UserResponseDto;
ownerId: string;
shared: boolean;
/** Deprecated in favor of albumPermissions */
sharedUsers: UserResponseDto[];
startDate?: string;
updatedAt: string;