make open-api

This commit is contained in:
aviv 2025-08-28 04:25:39 +03:00
parent 61aea7cac7
commit eea4c43dd9
6 changed files with 143 additions and 20 deletions

View file

@ -394,6 +394,7 @@ Class | Method | HTTP request | Description
- [MemoryUpdateDto](doc//MemoryUpdateDto.md) - [MemoryUpdateDto](doc//MemoryUpdateDto.md)
- [MergePersonDto](doc//MergePersonDto.md) - [MergePersonDto](doc//MergePersonDto.md)
- [MetadataSearchDto](doc//MetadataSearchDto.md) - [MetadataSearchDto](doc//MetadataSearchDto.md)
- [MobileDeviceDto](doc//MobileDeviceDto.md)
- [NotificationCreateDto](doc//NotificationCreateDto.md) - [NotificationCreateDto](doc//NotificationCreateDto.md)
- [NotificationDeleteAllDto](doc//NotificationDeleteAllDto.md) - [NotificationDeleteAllDto](doc//NotificationDeleteAllDto.md)
- [NotificationDto](doc//NotificationDto.md) - [NotificationDto](doc//NotificationDto.md)

View file

@ -172,6 +172,7 @@ part 'model/memory_type.dart';
part 'model/memory_update_dto.dart'; part 'model/memory_update_dto.dart';
part 'model/merge_person_dto.dart'; part 'model/merge_person_dto.dart';
part 'model/metadata_search_dto.dart'; part 'model/metadata_search_dto.dart';
part 'model/mobile_device_dto.dart';
part 'model/notification_create_dto.dart'; part 'model/notification_create_dto.dart';
part 'model/notification_delete_all_dto.dart'; part 'model/notification_delete_all_dto.dart';
part 'model/notification_dto.dart'; part 'model/notification_dto.dart';

View file

@ -398,6 +398,8 @@ class ApiClient {
return MergePersonDto.fromJson(value); return MergePersonDto.fromJson(value);
case 'MetadataSearchDto': case 'MetadataSearchDto':
return MetadataSearchDto.fromJson(value); return MetadataSearchDto.fromJson(value);
case 'MobileDeviceDto':
return MobileDeviceDto.fromJson(value);
case 'NotificationCreateDto': case 'NotificationCreateDto':
return NotificationCreateDto.fromJson(value); return NotificationCreateDto.fromJson(value);
case 'NotificationDeleteAllDto': case 'NotificationDeleteAllDto':

View file

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

View file

@ -20,6 +20,7 @@ class UserAdminResponseDto {
required this.id, required this.id,
required this.isAdmin, required this.isAdmin,
required this.license, required this.license,
this.mobileDevices = const [],
required this.name, required this.name,
required this.oauthId, required this.oauthId,
required this.profileChangedAt, required this.profileChangedAt,
@ -30,27 +31,8 @@ class UserAdminResponseDto {
required this.status, required this.status,
required this.storageLabel, required this.storageLabel,
required this.updatedAt, required this.updatedAt,
required this.mobileDevices,
}); });
List<MobileDeviceDto> mobileDevices;
}
class MobileDeviceDto {
MobileDeviceDto({
required this.deviceType,
required this.deviceOS,
required this.appVersion,
required this.lastSeen,
});
String deviceType;
String deviceOS;
String appVersion;
DateTime lastSeen;
}
UserAvatarColor avatarColor; UserAvatarColor avatarColor;
DateTime createdAt; DateTime createdAt;
@ -65,6 +47,8 @@ class MobileDeviceDto {
UserLicense? license; UserLicense? license;
List<MobileDeviceDto> mobileDevices;
String name; String name;
String oauthId; String oauthId;
@ -94,6 +78,7 @@ class MobileDeviceDto {
other.id == id && other.id == id &&
other.isAdmin == isAdmin && other.isAdmin == isAdmin &&
other.license == license && other.license == license &&
_deepEquality.equals(other.mobileDevices, mobileDevices) &&
other.name == name && other.name == name &&
other.oauthId == oauthId && other.oauthId == oauthId &&
other.profileChangedAt == profileChangedAt && other.profileChangedAt == profileChangedAt &&
@ -115,6 +100,7 @@ class MobileDeviceDto {
(id.hashCode) + (id.hashCode) +
(isAdmin.hashCode) + (isAdmin.hashCode) +
(license == null ? 0 : license!.hashCode) + (license == null ? 0 : license!.hashCode) +
(mobileDevices.hashCode) +
(name.hashCode) + (name.hashCode) +
(oauthId.hashCode) + (oauthId.hashCode) +
(profileChangedAt.hashCode) + (profileChangedAt.hashCode) +
@ -127,7 +113,7 @@ class MobileDeviceDto {
(updatedAt.hashCode); (updatedAt.hashCode);
@override @override
String toString() => 'UserAdminResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, id=$id, isAdmin=$isAdmin, license=$license, name=$name, oauthId=$oauthId, profileChangedAt=$profileChangedAt, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, status=$status, storageLabel=$storageLabel, updatedAt=$updatedAt]'; String toString() => 'UserAdminResponseDto[avatarColor=$avatarColor, createdAt=$createdAt, deletedAt=$deletedAt, email=$email, id=$id, isAdmin=$isAdmin, license=$license, mobileDevices=$mobileDevices, name=$name, oauthId=$oauthId, profileChangedAt=$profileChangedAt, profileImagePath=$profileImagePath, quotaSizeInBytes=$quotaSizeInBytes, quotaUsageInBytes=$quotaUsageInBytes, shouldChangePassword=$shouldChangePassword, status=$status, storageLabel=$storageLabel, updatedAt=$updatedAt]';
Map<String, dynamic> toJson() { Map<String, dynamic> toJson() {
final json = <String, dynamic>{}; final json = <String, dynamic>{};
@ -146,6 +132,7 @@ class MobileDeviceDto {
} else { } else {
// json[r'license'] = null; // json[r'license'] = null;
} }
json[r'mobileDevices'] = this.mobileDevices;
json[r'name'] = this.name; json[r'name'] = this.name;
json[r'oauthId'] = this.oauthId; json[r'oauthId'] = this.oauthId;
json[r'profileChangedAt'] = this.profileChangedAt.toUtc().toIso8601String(); json[r'profileChangedAt'] = this.profileChangedAt.toUtc().toIso8601String();
@ -187,6 +174,7 @@ class MobileDeviceDto {
id: mapValueOfType<String>(json, r'id')!, id: mapValueOfType<String>(json, r'id')!,
isAdmin: mapValueOfType<bool>(json, r'isAdmin')!, isAdmin: mapValueOfType<bool>(json, r'isAdmin')!,
license: UserLicense.fromJson(json[r'license']), license: UserLicense.fromJson(json[r'license']),
mobileDevices: MobileDeviceDto.listFromJson(json[r'mobileDevices']),
name: mapValueOfType<String>(json, r'name')!, name: mapValueOfType<String>(json, r'name')!,
oauthId: mapValueOfType<String>(json, r'oauthId')!, oauthId: mapValueOfType<String>(json, r'oauthId')!,
profileChangedAt: mapDateTime(json, r'profileChangedAt', r'')!, profileChangedAt: mapDateTime(json, r'profileChangedAt', r'')!,
@ -251,6 +239,7 @@ class MobileDeviceDto {
'id', 'id',
'isAdmin', 'isAdmin',
'license', 'license',
'mobileDevices',
'name', 'name',
'oauthId', 'oauthId',
'profileChangedAt', 'profileChangedAt',

View file

@ -87,6 +87,12 @@ export type UserLicense = {
activationKey: string; activationKey: string;
licenseKey: string; licenseKey: string;
}; };
export type MobileDeviceDto = {
appVersion: string;
deviceOS: string;
deviceType: string;
lastSeen: string;
};
export type UserAdminResponseDto = { export type UserAdminResponseDto = {
avatarColor: UserAvatarColor; avatarColor: UserAvatarColor;
createdAt: string; createdAt: string;
@ -95,6 +101,7 @@ export type UserAdminResponseDto = {
id: string; id: string;
isAdmin: boolean; isAdmin: boolean;
license: (UserLicense) | null; license: (UserLicense) | null;
mobileDevices: MobileDeviceDto[];
name: string; name: string;
oauthId: string; oauthId: string;
profileChangedAt: string; profileChangedAt: string;