mirror of
https://github.com/immich-app/immich
synced 2025-11-14 17:36:12 +00:00
make open-api
This commit is contained in:
parent
61aea7cac7
commit
eea4c43dd9
6 changed files with 143 additions and 20 deletions
1
mobile/openapi/README.md
generated
1
mobile/openapi/README.md
generated
|
|
@ -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)
|
||||
|
|
|
|||
1
mobile/openapi/lib/api.dart
generated
1
mobile/openapi/lib/api.dart
generated
|
|
@ -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';
|
||||
|
|
|
|||
2
mobile/openapi/lib/api_client.dart
generated
2
mobile/openapi/lib/api_client.dart
generated
|
|
@ -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':
|
||||
|
|
|
|||
123
mobile/openapi/lib/model/mobile_device_dto.dart
generated
Normal file
123
mobile/openapi/lib/model/mobile_device_dto.dart
generated
Normal 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',
|
||||
};
|
||||
}
|
||||
|
||||
|
|
@ -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<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;
|
||||
|
||||
DateTime createdAt;
|
||||
|
|
@ -65,6 +47,8 @@ class MobileDeviceDto {
|
|||
|
||||
UserLicense? license;
|
||||
|
||||
List<MobileDeviceDto> 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<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
|
|
@ -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<String>(json, r'id')!,
|
||||
isAdmin: mapValueOfType<bool>(json, r'isAdmin')!,
|
||||
license: UserLicense.fromJson(json[r'license']),
|
||||
mobileDevices: MobileDeviceDto.listFromJson(json[r'mobileDevices']),
|
||||
name: mapValueOfType<String>(json, r'name')!,
|
||||
oauthId: mapValueOfType<String>(json, r'oauthId')!,
|
||||
profileChangedAt: mapDateTime(json, r'profileChangedAt', r'')!,
|
||||
|
|
@ -251,6 +239,7 @@ class MobileDeviceDto {
|
|||
'id',
|
||||
'isAdmin',
|
||||
'license',
|
||||
'mobileDevices',
|
||||
'name',
|
||||
'oauthId',
|
||||
'profileChangedAt',
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue