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

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