You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-07 23:03:36 +02:00
feat: pending sync reset flag (#19861)
This commit is contained in:
2
mobile/openapi/README.md
generated
2
mobile/openapi/README.md
generated
@ -208,6 +208,7 @@ Class | Method | HTTP request | Description
|
||||
*SessionsApi* | [**deleteSession**](doc//SessionsApi.md#deletesession) | **DELETE** /sessions/{id} |
|
||||
*SessionsApi* | [**getSessions**](doc//SessionsApi.md#getsessions) | **GET** /sessions |
|
||||
*SessionsApi* | [**lockSession**](doc//SessionsApi.md#locksession) | **POST** /sessions/{id}/lock |
|
||||
*SessionsApi* | [**updateSession**](doc//SessionsApi.md#updatesession) | **PUT** /sessions/{id} |
|
||||
*SharedLinksApi* | [**addSharedLinkAssets**](doc//SharedLinksApi.md#addsharedlinkassets) | **PUT** /shared-links/{id}/assets |
|
||||
*SharedLinksApi* | [**createSharedLink**](doc//SharedLinksApi.md#createsharedlink) | **POST** /shared-links |
|
||||
*SharedLinksApi* | [**getAllSharedLinks**](doc//SharedLinksApi.md#getallsharedlinks) | **GET** /shared-links |
|
||||
@ -449,6 +450,7 @@ Class | Method | HTTP request | Description
|
||||
- [SessionCreateResponseDto](doc//SessionCreateResponseDto.md)
|
||||
- [SessionResponseDto](doc//SessionResponseDto.md)
|
||||
- [SessionUnlockDto](doc//SessionUnlockDto.md)
|
||||
- [SessionUpdateDto](doc//SessionUpdateDto.md)
|
||||
- [SharedLinkCreateDto](doc//SharedLinkCreateDto.md)
|
||||
- [SharedLinkEditDto](doc//SharedLinkEditDto.md)
|
||||
- [SharedLinkResponseDto](doc//SharedLinkResponseDto.md)
|
||||
|
1
mobile/openapi/lib/api.dart
generated
1
mobile/openapi/lib/api.dart
generated
@ -232,6 +232,7 @@ part 'model/session_create_dto.dart';
|
||||
part 'model/session_create_response_dto.dart';
|
||||
part 'model/session_response_dto.dart';
|
||||
part 'model/session_unlock_dto.dart';
|
||||
part 'model/session_update_dto.dart';
|
||||
part 'model/shared_link_create_dto.dart';
|
||||
part 'model/shared_link_edit_dto.dart';
|
||||
part 'model/shared_link_response_dto.dart';
|
||||
|
52
mobile/openapi/lib/api/sessions_api.dart
generated
52
mobile/openapi/lib/api/sessions_api.dart
generated
@ -219,4 +219,56 @@ class SessionsApi {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'PUT /sessions/{id}' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
///
|
||||
/// * [SessionUpdateDto] sessionUpdateDto (required):
|
||||
Future<Response> updateSessionWithHttpInfo(String id, SessionUpdateDto sessionUpdateDto,) async {
|
||||
// ignore: prefer_const_declarations
|
||||
final apiPath = r'/sessions/{id}'
|
||||
.replaceAll('{id}', id);
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody = sessionUpdateDto;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>['application/json'];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
apiPath,
|
||||
'PUT',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
/// Parameters:
|
||||
///
|
||||
/// * [String] id (required):
|
||||
///
|
||||
/// * [SessionUpdateDto] sessionUpdateDto (required):
|
||||
Future<SessionResponseDto?> updateSession(String id, SessionUpdateDto sessionUpdateDto,) async {
|
||||
final response = await updateSessionWithHttpInfo(id, sessionUpdateDto,);
|
||||
if (response.statusCode >= HttpStatus.badRequest) {
|
||||
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
|
||||
}
|
||||
// When a remote server returns no body with a status of 204, we shall not decode it.
|
||||
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
|
||||
// FormatException when trying to decode an empty string.
|
||||
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
|
||||
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'SessionResponseDto',) as SessionResponseDto;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
2
mobile/openapi/lib/api_client.dart
generated
2
mobile/openapi/lib/api_client.dart
generated
@ -520,6 +520,8 @@ class ApiClient {
|
||||
return SessionResponseDto.fromJson(value);
|
||||
case 'SessionUnlockDto':
|
||||
return SessionUnlockDto.fromJson(value);
|
||||
case 'SessionUpdateDto':
|
||||
return SessionUpdateDto.fromJson(value);
|
||||
case 'SharedLinkCreateDto':
|
||||
return SharedLinkCreateDto.fromJson(value);
|
||||
case 'SharedLinkEditDto':
|
||||
|
@ -19,6 +19,7 @@ class SessionCreateResponseDto {
|
||||
required this.deviceType,
|
||||
this.expiresAt,
|
||||
required this.id,
|
||||
required this.isPendingSyncReset,
|
||||
required this.token,
|
||||
required this.updatedAt,
|
||||
});
|
||||
@ -41,6 +42,8 @@ class SessionCreateResponseDto {
|
||||
|
||||
String id;
|
||||
|
||||
bool isPendingSyncReset;
|
||||
|
||||
String token;
|
||||
|
||||
String updatedAt;
|
||||
@ -53,6 +56,7 @@ class SessionCreateResponseDto {
|
||||
other.deviceType == deviceType &&
|
||||
other.expiresAt == expiresAt &&
|
||||
other.id == id &&
|
||||
other.isPendingSyncReset == isPendingSyncReset &&
|
||||
other.token == token &&
|
||||
other.updatedAt == updatedAt;
|
||||
|
||||
@ -65,11 +69,12 @@ class SessionCreateResponseDto {
|
||||
(deviceType.hashCode) +
|
||||
(expiresAt == null ? 0 : expiresAt!.hashCode) +
|
||||
(id.hashCode) +
|
||||
(isPendingSyncReset.hashCode) +
|
||||
(token.hashCode) +
|
||||
(updatedAt.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SessionCreateResponseDto[createdAt=$createdAt, current=$current, deviceOS=$deviceOS, deviceType=$deviceType, expiresAt=$expiresAt, id=$id, token=$token, updatedAt=$updatedAt]';
|
||||
String toString() => 'SessionCreateResponseDto[createdAt=$createdAt, current=$current, deviceOS=$deviceOS, deviceType=$deviceType, expiresAt=$expiresAt, id=$id, isPendingSyncReset=$isPendingSyncReset, token=$token, updatedAt=$updatedAt]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -83,6 +88,7 @@ class SessionCreateResponseDto {
|
||||
// json[r'expiresAt'] = null;
|
||||
}
|
||||
json[r'id'] = this.id;
|
||||
json[r'isPendingSyncReset'] = this.isPendingSyncReset;
|
||||
json[r'token'] = this.token;
|
||||
json[r'updatedAt'] = this.updatedAt;
|
||||
return json;
|
||||
@ -103,6 +109,7 @@ class SessionCreateResponseDto {
|
||||
deviceType: mapValueOfType<String>(json, r'deviceType')!,
|
||||
expiresAt: mapValueOfType<String>(json, r'expiresAt'),
|
||||
id: mapValueOfType<String>(json, r'id')!,
|
||||
isPendingSyncReset: mapValueOfType<bool>(json, r'isPendingSyncReset')!,
|
||||
token: mapValueOfType<String>(json, r'token')!,
|
||||
updatedAt: mapValueOfType<String>(json, r'updatedAt')!,
|
||||
);
|
||||
@ -157,6 +164,7 @@ class SessionCreateResponseDto {
|
||||
'deviceOS',
|
||||
'deviceType',
|
||||
'id',
|
||||
'isPendingSyncReset',
|
||||
'token',
|
||||
'updatedAt',
|
||||
};
|
||||
|
10
mobile/openapi/lib/model/session_response_dto.dart
generated
10
mobile/openapi/lib/model/session_response_dto.dart
generated
@ -19,6 +19,7 @@ class SessionResponseDto {
|
||||
required this.deviceType,
|
||||
this.expiresAt,
|
||||
required this.id,
|
||||
required this.isPendingSyncReset,
|
||||
required this.updatedAt,
|
||||
});
|
||||
|
||||
@ -40,6 +41,8 @@ class SessionResponseDto {
|
||||
|
||||
String id;
|
||||
|
||||
bool isPendingSyncReset;
|
||||
|
||||
String updatedAt;
|
||||
|
||||
@override
|
||||
@ -50,6 +53,7 @@ class SessionResponseDto {
|
||||
other.deviceType == deviceType &&
|
||||
other.expiresAt == expiresAt &&
|
||||
other.id == id &&
|
||||
other.isPendingSyncReset == isPendingSyncReset &&
|
||||
other.updatedAt == updatedAt;
|
||||
|
||||
@override
|
||||
@ -61,10 +65,11 @@ class SessionResponseDto {
|
||||
(deviceType.hashCode) +
|
||||
(expiresAt == null ? 0 : expiresAt!.hashCode) +
|
||||
(id.hashCode) +
|
||||
(isPendingSyncReset.hashCode) +
|
||||
(updatedAt.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SessionResponseDto[createdAt=$createdAt, current=$current, deviceOS=$deviceOS, deviceType=$deviceType, expiresAt=$expiresAt, id=$id, updatedAt=$updatedAt]';
|
||||
String toString() => 'SessionResponseDto[createdAt=$createdAt, current=$current, deviceOS=$deviceOS, deviceType=$deviceType, expiresAt=$expiresAt, id=$id, isPendingSyncReset=$isPendingSyncReset, updatedAt=$updatedAt]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
@ -78,6 +83,7 @@ class SessionResponseDto {
|
||||
// json[r'expiresAt'] = null;
|
||||
}
|
||||
json[r'id'] = this.id;
|
||||
json[r'isPendingSyncReset'] = this.isPendingSyncReset;
|
||||
json[r'updatedAt'] = this.updatedAt;
|
||||
return json;
|
||||
}
|
||||
@ -97,6 +103,7 @@ class SessionResponseDto {
|
||||
deviceType: mapValueOfType<String>(json, r'deviceType')!,
|
||||
expiresAt: mapValueOfType<String>(json, r'expiresAt'),
|
||||
id: mapValueOfType<String>(json, r'id')!,
|
||||
isPendingSyncReset: mapValueOfType<bool>(json, r'isPendingSyncReset')!,
|
||||
updatedAt: mapValueOfType<String>(json, r'updatedAt')!,
|
||||
);
|
||||
}
|
||||
@ -150,6 +157,7 @@ class SessionResponseDto {
|
||||
'deviceOS',
|
||||
'deviceType',
|
||||
'id',
|
||||
'isPendingSyncReset',
|
||||
'updatedAt',
|
||||
};
|
||||
}
|
||||
|
108
mobile/openapi/lib/model/session_update_dto.dart
generated
Normal file
108
mobile/openapi/lib/model/session_update_dto.dart
generated
Normal file
@ -0,0 +1,108 @@
|
||||
//
|
||||
// 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 SessionUpdateDto {
|
||||
/// Returns a new [SessionUpdateDto] instance.
|
||||
SessionUpdateDto({
|
||||
this.isPendingSyncReset,
|
||||
});
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
bool? isPendingSyncReset;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SessionUpdateDto &&
|
||||
other.isPendingSyncReset == isPendingSyncReset;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(isPendingSyncReset == null ? 0 : isPendingSyncReset!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SessionUpdateDto[isPendingSyncReset=$isPendingSyncReset]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.isPendingSyncReset != null) {
|
||||
json[r'isPendingSyncReset'] = this.isPendingSyncReset;
|
||||
} else {
|
||||
// json[r'isPendingSyncReset'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [SessionUpdateDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static SessionUpdateDto? fromJson(dynamic value) {
|
||||
upgradeDto(value, "SessionUpdateDto");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return SessionUpdateDto(
|
||||
isPendingSyncReset: mapValueOfType<bool>(json, r'isPendingSyncReset'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<SessionUpdateDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <SessionUpdateDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = SessionUpdateDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, SessionUpdateDto> mapFromJson(dynamic json) {
|
||||
final map = <String, SessionUpdateDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = SessionUpdateDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of SessionUpdateDto-objects as value to a dart map
|
||||
static Map<String, List<SessionUpdateDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<SessionUpdateDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = SessionUpdateDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
};
|
||||
}
|
||||
|
3
mobile/openapi/lib/model/sync_entity_type.dart
generated
3
mobile/openapi/lib/model/sync_entity_type.dart
generated
@ -59,6 +59,7 @@ class SyncEntityType {
|
||||
static const personV1 = SyncEntityType._(r'PersonV1');
|
||||
static const personDeleteV1 = SyncEntityType._(r'PersonDeleteV1');
|
||||
static const syncAckV1 = SyncEntityType._(r'SyncAckV1');
|
||||
static const syncResetV1 = SyncEntityType._(r'SyncResetV1');
|
||||
|
||||
/// List of all possible values in this [enum][SyncEntityType].
|
||||
static const values = <SyncEntityType>[
|
||||
@ -98,6 +99,7 @@ class SyncEntityType {
|
||||
personV1,
|
||||
personDeleteV1,
|
||||
syncAckV1,
|
||||
syncResetV1,
|
||||
];
|
||||
|
||||
static SyncEntityType? fromJson(dynamic value) => SyncEntityTypeTypeTransformer().decode(value);
|
||||
@ -172,6 +174,7 @@ class SyncEntityTypeTypeTransformer {
|
||||
case r'PersonV1': return SyncEntityType.personV1;
|
||||
case r'PersonDeleteV1': return SyncEntityType.personDeleteV1;
|
||||
case r'SyncAckV1': return SyncEntityType.syncAckV1;
|
||||
case r'SyncResetV1': return SyncEntityType.syncResetV1;
|
||||
default:
|
||||
if (!allowNull) {
|
||||
throw ArgumentError('Unknown enum value to decode: $data');
|
||||
|
19
mobile/openapi/lib/model/sync_stream_dto.dart
generated
19
mobile/openapi/lib/model/sync_stream_dto.dart
generated
@ -13,25 +13,41 @@ part of openapi.api;
|
||||
class SyncStreamDto {
|
||||
/// Returns a new [SyncStreamDto] instance.
|
||||
SyncStreamDto({
|
||||
this.reset,
|
||||
this.types = const [],
|
||||
});
|
||||
|
||||
///
|
||||
/// Please note: This property should have been non-nullable! Since the specification file
|
||||
/// does not include a default value (using the "default:" property), however, the generated
|
||||
/// source code must fall back to having a nullable type.
|
||||
/// Consider adding a "default:" property in the specification file to hide this note.
|
||||
///
|
||||
bool? reset;
|
||||
|
||||
List<SyncRequestType> types;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is SyncStreamDto &&
|
||||
other.reset == reset &&
|
||||
_deepEquality.equals(other.types, types);
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(reset == null ? 0 : reset!.hashCode) +
|
||||
(types.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'SyncStreamDto[types=$types]';
|
||||
String toString() => 'SyncStreamDto[reset=$reset, types=$types]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.reset != null) {
|
||||
json[r'reset'] = this.reset;
|
||||
} else {
|
||||
// json[r'reset'] = null;
|
||||
}
|
||||
json[r'types'] = this.types;
|
||||
return json;
|
||||
}
|
||||
@ -45,6 +61,7 @@ class SyncStreamDto {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return SyncStreamDto(
|
||||
reset: mapValueOfType<bool>(json, r'reset'),
|
||||
types: SyncRequestType.listFromJson(json[r'types']),
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user