You've already forked immich
mirror of
https://github.com/immich-app/immich.git
synced 2025-08-08 23:07:06 +02:00
feat: version check endpoint (#18572)
This commit is contained in:
1
mobile/openapi/lib/api.dart
generated
1
mobile/openapi/lib/api.dart
generated
@ -320,6 +320,7 @@ part 'model/validate_access_token_response_dto.dart';
|
||||
part 'model/validate_library_dto.dart';
|
||||
part 'model/validate_library_import_path_response_dto.dart';
|
||||
part 'model/validate_library_response_dto.dart';
|
||||
part 'model/version_check_state_response_dto.dart';
|
||||
part 'model/video_codec.dart';
|
||||
part 'model/video_container.dart';
|
||||
|
||||
|
41
mobile/openapi/lib/api/server_api.dart
generated
41
mobile/openapi/lib/api/server_api.dart
generated
@ -418,6 +418,47 @@ class ServerApi {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /server/version-check' operation and returns the [Response].
|
||||
Future<Response> getVersionCheckWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final apiPath = r'/server/version-check';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
apiPath,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
Future<VersionCheckStateResponseDto?> getVersionCheck() async {
|
||||
final response = await getVersionCheckWithHttpInfo();
|
||||
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), 'VersionCheckStateResponseDto',) as VersionCheckStateResponseDto;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /server/version-history' operation and returns the [Response].
|
||||
Future<Response> getVersionHistoryWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
|
41
mobile/openapi/lib/api/system_metadata_api.dart
generated
41
mobile/openapi/lib/api/system_metadata_api.dart
generated
@ -98,6 +98,47 @@ class SystemMetadataApi {
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'GET /system-metadata/version-check-state' operation and returns the [Response].
|
||||
Future<Response> getVersionCheckStateWithHttpInfo() async {
|
||||
// ignore: prefer_const_declarations
|
||||
final apiPath = r'/system-metadata/version-check-state';
|
||||
|
||||
// ignore: prefer_final_locals
|
||||
Object? postBody;
|
||||
|
||||
final queryParams = <QueryParam>[];
|
||||
final headerParams = <String, String>{};
|
||||
final formParams = <String, String>{};
|
||||
|
||||
const contentTypes = <String>[];
|
||||
|
||||
|
||||
return apiClient.invokeAPI(
|
||||
apiPath,
|
||||
'GET',
|
||||
queryParams,
|
||||
postBody,
|
||||
headerParams,
|
||||
formParams,
|
||||
contentTypes.isEmpty ? null : contentTypes.first,
|
||||
);
|
||||
}
|
||||
|
||||
Future<VersionCheckStateResponseDto?> getVersionCheckState() async {
|
||||
final response = await getVersionCheckStateWithHttpInfo();
|
||||
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), 'VersionCheckStateResponseDto',) as VersionCheckStateResponseDto;
|
||||
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
/// Performs an HTTP 'POST /system-metadata/admin-onboarding' operation and returns the [Response].
|
||||
/// Parameters:
|
||||
///
|
||||
|
2
mobile/openapi/lib/api_client.dart
generated
2
mobile/openapi/lib/api_client.dart
generated
@ -696,6 +696,8 @@ class ApiClient {
|
||||
return ValidateLibraryImportPathResponseDto.fromJson(value);
|
||||
case 'ValidateLibraryResponseDto':
|
||||
return ValidateLibraryResponseDto.fromJson(value);
|
||||
case 'VersionCheckStateResponseDto':
|
||||
return VersionCheckStateResponseDto.fromJson(value);
|
||||
case 'VideoCodec':
|
||||
return VideoCodecTypeTransformer().decode(value);
|
||||
case 'VideoContainer':
|
||||
|
115
mobile/openapi/lib/model/version_check_state_response_dto.dart
generated
Normal file
115
mobile/openapi/lib/model/version_check_state_response_dto.dart
generated
Normal file
@ -0,0 +1,115 @@
|
||||
//
|
||||
// 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 VersionCheckStateResponseDto {
|
||||
/// Returns a new [VersionCheckStateResponseDto] instance.
|
||||
VersionCheckStateResponseDto({
|
||||
required this.checkedAt,
|
||||
required this.releaseVersion,
|
||||
});
|
||||
|
||||
String? checkedAt;
|
||||
|
||||
String? releaseVersion;
|
||||
|
||||
@override
|
||||
bool operator ==(Object other) => identical(this, other) || other is VersionCheckStateResponseDto &&
|
||||
other.checkedAt == checkedAt &&
|
||||
other.releaseVersion == releaseVersion;
|
||||
|
||||
@override
|
||||
int get hashCode =>
|
||||
// ignore: unnecessary_parenthesis
|
||||
(checkedAt == null ? 0 : checkedAt!.hashCode) +
|
||||
(releaseVersion == null ? 0 : releaseVersion!.hashCode);
|
||||
|
||||
@override
|
||||
String toString() => 'VersionCheckStateResponseDto[checkedAt=$checkedAt, releaseVersion=$releaseVersion]';
|
||||
|
||||
Map<String, dynamic> toJson() {
|
||||
final json = <String, dynamic>{};
|
||||
if (this.checkedAt != null) {
|
||||
json[r'checkedAt'] = this.checkedAt;
|
||||
} else {
|
||||
// json[r'checkedAt'] = null;
|
||||
}
|
||||
if (this.releaseVersion != null) {
|
||||
json[r'releaseVersion'] = this.releaseVersion;
|
||||
} else {
|
||||
// json[r'releaseVersion'] = null;
|
||||
}
|
||||
return json;
|
||||
}
|
||||
|
||||
/// Returns a new [VersionCheckStateResponseDto] instance and imports its values from
|
||||
/// [value] if it's a [Map], null otherwise.
|
||||
// ignore: prefer_constructors_over_static_methods
|
||||
static VersionCheckStateResponseDto? fromJson(dynamic value) {
|
||||
upgradeDto(value, "VersionCheckStateResponseDto");
|
||||
if (value is Map) {
|
||||
final json = value.cast<String, dynamic>();
|
||||
|
||||
return VersionCheckStateResponseDto(
|
||||
checkedAt: mapValueOfType<String>(json, r'checkedAt'),
|
||||
releaseVersion: mapValueOfType<String>(json, r'releaseVersion'),
|
||||
);
|
||||
}
|
||||
return null;
|
||||
}
|
||||
|
||||
static List<VersionCheckStateResponseDto> listFromJson(dynamic json, {bool growable = false,}) {
|
||||
final result = <VersionCheckStateResponseDto>[];
|
||||
if (json is List && json.isNotEmpty) {
|
||||
for (final row in json) {
|
||||
final value = VersionCheckStateResponseDto.fromJson(row);
|
||||
if (value != null) {
|
||||
result.add(value);
|
||||
}
|
||||
}
|
||||
}
|
||||
return result.toList(growable: growable);
|
||||
}
|
||||
|
||||
static Map<String, VersionCheckStateResponseDto> mapFromJson(dynamic json) {
|
||||
final map = <String, VersionCheckStateResponseDto>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
json = json.cast<String, dynamic>(); // ignore: parameter_assignments
|
||||
for (final entry in json.entries) {
|
||||
final value = VersionCheckStateResponseDto.fromJson(entry.value);
|
||||
if (value != null) {
|
||||
map[entry.key] = value;
|
||||
}
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
// maps a json object with a list of VersionCheckStateResponseDto-objects as value to a dart map
|
||||
static Map<String, List<VersionCheckStateResponseDto>> mapListFromJson(dynamic json, {bool growable = false,}) {
|
||||
final map = <String, List<VersionCheckStateResponseDto>>{};
|
||||
if (json is Map && json.isNotEmpty) {
|
||||
// ignore: parameter_assignments
|
||||
json = json.cast<String, dynamic>();
|
||||
for (final entry in json.entries) {
|
||||
map[entry.key] = VersionCheckStateResponseDto.listFromJson(entry.value, growable: growable,);
|
||||
}
|
||||
}
|
||||
return map;
|
||||
}
|
||||
|
||||
/// The list of required keys that must be present in a JSON.
|
||||
static const requiredKeys = <String>{
|
||||
'checkedAt',
|
||||
'releaseVersion',
|
||||
};
|
||||
}
|
||||
|
Reference in New Issue
Block a user