2022-02-03 18:06:44 +02:00
|
|
|
import 'package:dio/dio.dart';
|
2022-06-11 23:12:06 +02:00
|
|
|
import 'package:flutter/material.dart';
|
2022-06-22 07:23:35 +02:00
|
|
|
import 'package:immich_mobile/shared/models/server_info.model.dart';
|
2022-03-22 08:22:04 +02:00
|
|
|
import 'package:immich_mobile/shared/models/server_version.model.dart';
|
2022-02-03 18:06:44 +02:00
|
|
|
import 'package:immich_mobile/shared/services/network.service.dart';
|
|
|
|
|
|
|
|
class ServerInfoService {
|
|
|
|
final NetworkService _networkService = NetworkService();
|
|
|
|
|
|
|
|
Future<ServerInfo> getServerInfo() async {
|
|
|
|
Response response = await _networkService.getRequest(url: 'server-info');
|
|
|
|
|
|
|
|
return ServerInfo.fromJson(response.toString());
|
|
|
|
}
|
2022-03-11 00:09:03 +02:00
|
|
|
|
2022-03-22 08:22:04 +02:00
|
|
|
Future<ServerVersion?> getServerVersion() async {
|
2022-06-11 23:12:06 +02:00
|
|
|
try {
|
|
|
|
Response response =
|
|
|
|
await _networkService.getRequest(url: 'server-info/version');
|
|
|
|
|
|
|
|
return ServerVersion.fromJson(response.toString());
|
|
|
|
} catch (e) {
|
|
|
|
debugPrint("Error getting server info");
|
|
|
|
}
|
2022-03-22 08:22:04 +02:00
|
|
|
|
2022-06-11 23:12:06 +02:00
|
|
|
return null;
|
2022-03-22 08:22:04 +02:00
|
|
|
}
|
2022-02-03 18:06:44 +02:00
|
|
|
}
|