mirror of
https://github.com/immich-app/immich
synced 2025-10-17 18:19:27 +00:00
Transfer repository from Gitlab
This commit is contained in:
parent
af2efbdbbd
commit
568cc243f0
177 changed files with 13300 additions and 0 deletions
38
mobile/lib/modules/home/services/asset.service.dart
Normal file
38
mobile/lib/modules/home/services/asset.service.dart
Normal file
|
|
@ -0,0 +1,38 @@
|
|||
import 'dart:convert';
|
||||
|
||||
import 'package:flutter/material.dart';
|
||||
import 'package:immich_mobile/modules/home/models/get_all_asset_respose.model.dart';
|
||||
import 'package:immich_mobile/shared/services/network.service.dart';
|
||||
|
||||
class AssetService {
|
||||
final NetworkService _networkService = NetworkService();
|
||||
|
||||
Future<GetAllAssetResponse?> getAllAsset() async {
|
||||
var res = await _networkService.getRequest(url: "asset/all");
|
||||
try {
|
||||
Map<String, dynamic> decodedData = jsonDecode(res.toString());
|
||||
|
||||
GetAllAssetResponse result = GetAllAssetResponse.fromMap(decodedData);
|
||||
return result;
|
||||
} catch (e) {
|
||||
debugPrint("Error getAllAsset ${e.toString()}");
|
||||
}
|
||||
}
|
||||
|
||||
Future<GetAllAssetResponse?> getMoreAsset(String? nextPageKey) async {
|
||||
try {
|
||||
var res = await _networkService.getRequest(
|
||||
url: "asset/all?nextPageKey=$nextPageKey",
|
||||
);
|
||||
|
||||
Map<String, dynamic> decodedData = jsonDecode(res.toString());
|
||||
|
||||
GetAllAssetResponse result = GetAllAssetResponse.fromMap(decodedData);
|
||||
if (result.count != 0) {
|
||||
return result;
|
||||
}
|
||||
} catch (e) {
|
||||
debugPrint("Error getAllAsset ${e.toString()}");
|
||||
}
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue