diff --git a/mobile/openapi/README.md b/mobile/openapi/README.md index 04600250b1..903679033f 100644 --- a/mobile/openapi/README.md +++ b/mobile/openapi/README.md @@ -394,6 +394,7 @@ Class | Method | HTTP request | Description - [MemoryUpdateDto](doc//MemoryUpdateDto.md) - [MergePersonDto](doc//MergePersonDto.md) - [MetadataSearchDto](doc//MetadataSearchDto.md) + - [MobileDeviceDto](doc//MobileDeviceDto.md) - [NotificationCreateDto](doc//NotificationCreateDto.md) - [NotificationDeleteAllDto](doc//NotificationDeleteAllDto.md) - [NotificationDto](doc//NotificationDto.md) diff --git a/mobile/openapi/lib/api.dart b/mobile/openapi/lib/api.dart index f5f353c968..49f6cb30ba 100644 --- a/mobile/openapi/lib/api.dart +++ b/mobile/openapi/lib/api.dart @@ -172,6 +172,7 @@ part 'model/memory_type.dart'; part 'model/memory_update_dto.dart'; part 'model/merge_person_dto.dart'; part 'model/metadata_search_dto.dart'; +part 'model/mobile_device_dto.dart'; part 'model/notification_create_dto.dart'; part 'model/notification_delete_all_dto.dart'; part 'model/notification_dto.dart'; diff --git a/mobile/openapi/lib/api_client.dart b/mobile/openapi/lib/api_client.dart index 3f31d4ed90..d35c3b1cc4 100644 --- a/mobile/openapi/lib/api_client.dart +++ b/mobile/openapi/lib/api_client.dart @@ -398,6 +398,8 @@ class ApiClient { return MergePersonDto.fromJson(value); case 'MetadataSearchDto': return MetadataSearchDto.fromJson(value); + case 'MobileDeviceDto': + return MobileDeviceDto.fromJson(value); case 'NotificationCreateDto': return NotificationCreateDto.fromJson(value); case 'NotificationDeleteAllDto': diff --git a/mobile/openapi/lib/model/mobile_device_dto.dart b/mobile/openapi/lib/model/mobile_device_dto.dart new file mode 100644 index 0000000000..5c3c9fcd3b --- /dev/null +++ b/mobile/openapi/lib/model/mobile_device_dto.dart @@ -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 toJson() { + final json = {}; + 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(); + + return MobileDeviceDto( + appVersion: mapValueOfType(json, r'appVersion')!, + deviceOS: mapValueOfType(json, r'deviceOS')!, + deviceType: mapValueOfType(json, r'deviceType')!, + lastSeen: mapDateTime(json, r'lastSeen', r'')!, + ); + } + return null; + } + + static List listFromJson(dynamic json, {bool growable = false,}) { + final result = []; + 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 mapFromJson(dynamic json) { + final map = {}; + if (json is Map && json.isNotEmpty) { + json = json.cast(); // 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> mapListFromJson(dynamic json, {bool growable = false,}) { + final map = >{}; + if (json is Map && json.isNotEmpty) { + // ignore: parameter_assignments + json = json.cast(); + 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 = { + 'appVersion', + 'deviceOS', + 'deviceType', + 'lastSeen', + }; +} + diff --git a/mobile/openapi/lib/model/user_admin_response_dto.dart b/mobile/openapi/lib/model/user_admin_response_dto.dart index 6bb1f9b6a2..bbd777b230 100644 --- a/mobile/openapi/lib/model/user_admin_response_dto.dart +++ b/mobile/openapi/lib/model/user_admin_response_dto.dart @@ -20,6 +20,7 @@ class UserAdminResponseDto { required this.id, required this.isAdmin, required this.license, + this.mobileDevices = const [], required this.name, required this.oauthId, required this.profileChangedAt, @@ -30,27 +31,8 @@ class UserAdminResponseDto { required this.status, required this.storageLabel, required this.updatedAt, - required this.mobileDevices, }); - List 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; DateTime createdAt; @@ -65,6 +47,8 @@ class MobileDeviceDto { UserLicense? license; + List mobileDevices; + String name; String oauthId; @@ -94,6 +78,7 @@ class MobileDeviceDto { other.id == id && other.isAdmin == isAdmin && other.license == license && + _deepEquality.equals(other.mobileDevices, mobileDevices) && other.name == name && other.oauthId == oauthId && other.profileChangedAt == profileChangedAt && @@ -115,6 +100,7 @@ class MobileDeviceDto { (id.hashCode) + (isAdmin.hashCode) + (license == null ? 0 : license!.hashCode) + + (mobileDevices.hashCode) + (name.hashCode) + (oauthId.hashCode) + (profileChangedAt.hashCode) + @@ -127,7 +113,7 @@ class MobileDeviceDto { (updatedAt.hashCode); @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 toJson() { final json = {}; @@ -146,6 +132,7 @@ class MobileDeviceDto { } else { // json[r'license'] = null; } + json[r'mobileDevices'] = this.mobileDevices; json[r'name'] = this.name; json[r'oauthId'] = this.oauthId; json[r'profileChangedAt'] = this.profileChangedAt.toUtc().toIso8601String(); @@ -187,6 +174,7 @@ class MobileDeviceDto { id: mapValueOfType(json, r'id')!, isAdmin: mapValueOfType(json, r'isAdmin')!, license: UserLicense.fromJson(json[r'license']), + mobileDevices: MobileDeviceDto.listFromJson(json[r'mobileDevices']), name: mapValueOfType(json, r'name')!, oauthId: mapValueOfType(json, r'oauthId')!, profileChangedAt: mapDateTime(json, r'profileChangedAt', r'')!, @@ -251,6 +239,7 @@ class MobileDeviceDto { 'id', 'isAdmin', 'license', + 'mobileDevices', 'name', 'oauthId', 'profileChangedAt', diff --git a/open-api/typescript-sdk/src/fetch-client.ts b/open-api/typescript-sdk/src/fetch-client.ts index 08fa714823..8c355d2128 100644 --- a/open-api/typescript-sdk/src/fetch-client.ts +++ b/open-api/typescript-sdk/src/fetch-client.ts @@ -87,6 +87,12 @@ export type UserLicense = { activationKey: string; licenseKey: string; }; +export type MobileDeviceDto = { + appVersion: string; + deviceOS: string; + deviceType: string; + lastSeen: string; +}; export type UserAdminResponseDto = { avatarColor: UserAvatarColor; createdAt: string; @@ -95,6 +101,7 @@ export type UserAdminResponseDto = { id: string; isAdmin: boolean; license: (UserLicense) | null; + mobileDevices: MobileDeviceDto[]; name: string; oauthId: string; profileChangedAt: string;