30 lines
1.2 KiB
Dart
Raw Normal View History

2021-07-26 11:51:39 +08:00
import 'package:dartz/dartz.dart';
2021-11-08 23:15:29 +08:00
import 'package:flowy_infra/notifier.dart';
2021-12-14 18:04:51 +08:00
import 'package:flowy_sdk/protobuf/flowy-error/errors.pb.dart';
2021-12-19 21:29:33 +08:00
import 'package:flowy_sdk/protobuf/flowy-user-data-model/protobuf.dart' show UserProfile;
2022-01-13 11:16:26 +08:00
import 'package:flowy_sdk/protobuf/flowy-core-data-model/workspace.pb.dart';
2021-12-19 21:29:33 +08:00
export 'package:flowy_sdk/protobuf/flowy-user-data-model/protobuf.dart' show UserProfile;
2021-07-26 11:51:39 +08:00
abstract class IUser {
2021-09-04 16:53:58 +08:00
UserProfile get user;
2021-12-14 18:04:51 +08:00
Future<Either<UserProfile, FlowyError>> fetchUserProfile(String userId);
Future<Either<List<Workspace>, FlowyError>> fetchWorkspaces();
Future<Either<Unit, FlowyError>> deleteWorkspace(String workspaceId);
Future<Either<Unit, FlowyError>> signOut();
Future<Either<Unit, FlowyError>> initUser();
2021-07-26 11:51:39 +08:00
}
2021-07-30 08:43:10 +08:00
2021-12-14 18:04:51 +08:00
typedef UserProfileUpdatedNotifierValue = Either<UserProfile, FlowyError>;
typedef AuthNotifierValue = Either<Unit, FlowyError>;
typedef WorkspaceUpdatedNotifierValue = Either<List<Workspace>, FlowyError>;
2021-10-11 13:15:41 +08:00
abstract class IUserListener {
void start();
2021-11-08 23:15:29 +08:00
PublishNotifier<UserProfileUpdatedNotifierValue> get profileUpdatedNotifier;
PublishNotifier<AuthNotifierValue> get authDidChangedNotifier;
PublishNotifier<WorkspaceUpdatedNotifierValue> get workspaceUpdatedNotifier;
2021-07-30 08:43:10 +08:00
2021-10-11 13:15:41 +08:00
Future<void> stop();
2021-07-30 08:43:10 +08:00
}