2021-02-02 14:33:23 +00:00
|
|
|
import 'dart:async';
|
|
|
|
import 'dart:io';
|
|
|
|
|
|
|
|
import '../../core/repositories/file_repository.dart';
|
|
|
|
import '../../locator.dart';
|
2021-05-09 08:59:14 +00:00
|
|
|
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>();
|
|
|
|
|
2021-05-09 08:59:14 +00:00
|
|
|
Future<Config> getConfig(String url) async {
|
2021-02-02 14:33:23 +00:00
|
|
|
return await _fileRepository.getConfig(url);
|
|
|
|
}
|
|
|
|
|
2021-05-09 08:59:14 +00:00
|
|
|
Future<History> getHistory() async {
|
2021-02-02 14:33:23 +00:00
|
|
|
return await _fileRepository.getHistory();
|
|
|
|
}
|
|
|
|
|
2021-05-09 08:59:14 +00:00
|
|
|
Future<void> deletePaste(String id) async {
|
|
|
|
return await _fileRepository.postDelete(id);
|
2021-02-02 14:33:23 +00:00
|
|
|
}
|
|
|
|
|
2021-05-09 08:59:14 +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
|
|
|
}
|
|
|
|
|
2021-05-09 08:59:14 +00:00
|
|
|
Future<UploadedMultiResponse> uploadMultiPaste(List<String> ids) async {
|
|
|
|
return await _fileRepository.postCreateMultiPaste(ids);
|
2021-02-02 14:33:23 +00:00
|
|
|
}
|
|
|
|
}
|