fbmobile/lib/core/services/file_service.dart

35 lines
1,005 B
Dart
Raw Permalink Normal View History

2021-02-02 14:33:23 +00:00
import 'dart:async';
import 'dart:io';
import '../../core/repositories/file_repository.dart';
import '../../locator.dart';
import '../models/rest/config.dart';
import '../models/rest/history.dart';
import '../models/rest/uploaded_multi_response.dart';
import '../models/rest/uploaded_response.dart';
2021-02-02 14:33:23 +00:00
class FileService {
final FileRepository _fileRepository = locator<FileRepository>();
Future<Config> getConfig(String url) async {
2021-02-02 14:33:23 +00:00
return await _fileRepository.getConfig(url);
}
FutureOr<History> getHistory() async {
2021-02-02 14:33:23 +00:00
return await _fileRepository.getHistory();
}
Future deletePaste(String id) async {
return await _fileRepository.postDelete(id);
2021-02-02 14:33:23 +00:00
}
2023-01-16 00:44:34 +00:00
Future<UploadedResponse> uploadPaste(
List<File>? files, Map<String, String>? additionalFiles) async {
return await _fileRepository.postUpload(files, additionalFiles);
2021-02-02 14:33:23 +00:00
}
Future<UploadedMultiResponse> uploadMultiPaste(List<String> ids) async {
return await _fileRepository.postCreateMultiPaste(ids);
2021-02-02 14:33:23 +00:00
}
}