23 lines
772 B
Dart
Raw Normal View History

2021-12-19 21:29:33 +08:00
import 'package:flowy_sdk/protobuf/flowy-core-data-model/protobuf.dart';
2021-07-21 15:43:05 +08:00
import 'package:dartz/dartz.dart';
2021-12-14 18:04:51 +08:00
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
2021-07-21 15:43:05 +08:00
typedef AppUpdatedCallback = void Function(App app);
2021-12-14 18:04:51 +08:00
typedef AppViewsChangeCallback = void Function(Either<List<View>, FlowyError> viewsOrFailed);
2021-07-21 22:41:44 +08:00
2021-07-21 15:43:05 +08:00
abstract class IApp {
2021-12-14 18:04:51 +08:00
Future<Either<List<View>, FlowyError>> getViews();
2021-07-21 15:43:05 +08:00
2021-12-14 18:04:51 +08:00
Future<Either<View, FlowyError>> createView({required String name, String? desc, required ViewType viewType});
2021-10-30 17:19:50 +08:00
2021-12-14 18:04:51 +08:00
Future<Either<Unit, FlowyError>> delete();
2021-10-30 17:19:50 +08:00
2021-12-14 18:04:51 +08:00
Future<Either<Unit, FlowyError>> rename(String newName);
}
2021-07-21 22:41:44 +08:00
2021-10-11 13:15:41 +08:00
abstract class IAppListenr {
2021-10-13 23:11:45 +08:00
void start({AppViewsChangeCallback? viewsChangeCallback, AppUpdatedCallback? updatedCallback});
2021-07-21 22:41:44 +08:00
2021-10-11 13:15:41 +08:00
Future<void> stop();
2021-07-21 15:43:05 +08:00
}