24 lines
730 B
Dart
Raw Normal View History

2021-10-12 22:31:38 +08:00
import 'dart:async';
import 'package:dartz/dartz.dart';
2022-01-13 11:16:26 +08:00
import 'package:flowy_sdk/protobuf/flowy-core-data-model/trash.pb.dart';
2021-12-14 18:04:51 +08:00
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
2021-10-12 22:31:38 +08:00
abstract class ITrash {
2021-12-14 18:04:51 +08:00
Future<Either<List<Trash>, FlowyError>> readTrash();
2021-10-14 22:58:20 +08:00
2021-12-14 18:04:51 +08:00
Future<Either<Unit, FlowyError>> putback(String trashId);
2021-10-14 22:58:20 +08:00
2021-12-14 18:04:51 +08:00
Future<Either<Unit, FlowyError>> deleteViews(List<Tuple2<String, TrashType>> trashList);
2021-12-14 18:04:51 +08:00
Future<Either<Unit, FlowyError>> restoreAll();
2021-12-14 18:04:51 +08:00
Future<Either<Unit, FlowyError>> deleteAll();
2021-10-12 22:31:38 +08:00
}
2021-12-14 18:04:51 +08:00
typedef TrashUpdatedCallback = void Function(Either<List<Trash>, FlowyError> trashOrFailed);
2021-10-12 22:31:38 +08:00
abstract class ITrashListener {
2021-10-14 14:34:22 +08:00
void start(TrashUpdatedCallback updateCallback);
2021-10-12 22:31:38 +08:00
Future<void> stop();
}