2021-07-08 21:23:44 +08:00
|
|
|
|
|
|
|
|
2021-07-07 22:24:26 +08:00
|
|
|
/// Auto gen code from rust ast, do not edit
|
|
|
|
part of 'dispatch.dart';
|
2021-07-23 16:45:29 +08:00
|
|
|
class EditorEventCreateDoc {
|
|
|
|
CreateDocRequest request;
|
|
|
|
EditorEventCreateDoc(this.request);
|
|
|
|
|
2021-07-24 14:05:49 +08:00
|
|
|
Future<Either<DocInfo, EditorError>> send() {
|
2021-07-23 16:45:29 +08:00
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = EditorEvent.CreateDoc.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
2021-07-24 14:05:49 +08:00
|
|
|
(okBytes) => left(DocInfo.fromBuffer(okBytes)),
|
2021-07-23 16:45:29 +08:00
|
|
|
(errBytes) => right(EditorError.fromBuffer(errBytes)),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class EditorEventUpdateDoc {
|
|
|
|
UpdateDocRequest request;
|
|
|
|
EditorEventUpdateDoc(this.request);
|
|
|
|
|
|
|
|
Future<Either<Unit, EditorError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = EditorEvent.UpdateDoc.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
|
|
|
(bytes) => left(unit),
|
|
|
|
(errBytes) => right(EditorError.fromBuffer(errBytes)),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-24 14:05:49 +08:00
|
|
|
class EditorEventReadDocInfo {
|
2021-07-23 16:45:29 +08:00
|
|
|
QueryDocRequest request;
|
2021-07-24 14:05:49 +08:00
|
|
|
EditorEventReadDocInfo(this.request);
|
2021-07-23 16:45:29 +08:00
|
|
|
|
2021-07-24 14:05:49 +08:00
|
|
|
Future<Either<DocInfo, EditorError>> send() {
|
2021-07-23 16:45:29 +08:00
|
|
|
final request = FFIRequest.create()
|
2021-07-24 14:05:49 +08:00
|
|
|
..event = EditorEvent.ReadDocInfo.toString()
|
2021-07-23 16:45:29 +08:00
|
|
|
..payload = requestToBytes(this.request);
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
2021-07-24 14:05:49 +08:00
|
|
|
(okBytes) => left(DocInfo.fromBuffer(okBytes)),
|
|
|
|
(errBytes) => right(EditorError.fromBuffer(errBytes)),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class EditorEventReadDocData {
|
|
|
|
QueryDocDataRequest request;
|
|
|
|
EditorEventReadDocData(this.request);
|
|
|
|
|
|
|
|
Future<Either<DocData, EditorError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = EditorEvent.ReadDocData.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
|
|
|
(okBytes) => left(DocData.fromBuffer(okBytes)),
|
2021-07-23 16:45:29 +08:00
|
|
|
(errBytes) => right(EditorError.fromBuffer(errBytes)),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-20 23:51:08 +08:00
|
|
|
class WorkspaceEventCreateWorkspace {
|
|
|
|
CreateWorkspaceRequest request;
|
|
|
|
WorkspaceEventCreateWorkspace(this.request);
|
|
|
|
|
|
|
|
Future<Either<Workspace, WorkspaceError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = WorkspaceEvent.CreateWorkspace.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
2021-07-23 16:45:29 +08:00
|
|
|
(okBytes) => left(Workspace.fromBuffer(okBytes)),
|
|
|
|
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
|
2021-07-20 23:51:08 +08:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class WorkspaceEventGetCurWorkspace {
|
|
|
|
WorkspaceEventGetCurWorkspace();
|
|
|
|
|
|
|
|
Future<Either<Workspace, WorkspaceError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = WorkspaceEvent.GetCurWorkspace.toString();
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
|
|
|
|
(okBytes) => left(Workspace.fromBuffer(okBytes)),
|
|
|
|
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class WorkspaceEventGetWorkspace {
|
|
|
|
QueryWorkspaceRequest request;
|
|
|
|
WorkspaceEventGetWorkspace(this.request);
|
|
|
|
|
|
|
|
Future<Either<Workspace, WorkspaceError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = WorkspaceEvent.GetWorkspace.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
2021-07-23 16:45:29 +08:00
|
|
|
(okBytes) => left(Workspace.fromBuffer(okBytes)),
|
|
|
|
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
|
2021-07-20 23:51:08 +08:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class WorkspaceEventCreateApp {
|
|
|
|
CreateAppRequest request;
|
|
|
|
WorkspaceEventCreateApp(this.request);
|
|
|
|
|
|
|
|
Future<Either<App, WorkspaceError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = WorkspaceEvent.CreateApp.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
2021-07-23 16:45:29 +08:00
|
|
|
(okBytes) => left(App.fromBuffer(okBytes)),
|
|
|
|
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
|
2021-07-20 23:51:08 +08:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class WorkspaceEventGetApp {
|
|
|
|
QueryAppRequest request;
|
|
|
|
WorkspaceEventGetApp(this.request);
|
|
|
|
|
|
|
|
Future<Either<App, WorkspaceError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = WorkspaceEvent.GetApp.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
2021-07-23 16:45:29 +08:00
|
|
|
(okBytes) => left(App.fromBuffer(okBytes)),
|
|
|
|
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
|
2021-07-20 23:51:08 +08:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class WorkspaceEventCreateView {
|
|
|
|
CreateViewRequest request;
|
|
|
|
WorkspaceEventCreateView(this.request);
|
|
|
|
|
|
|
|
Future<Either<View, WorkspaceError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = WorkspaceEvent.CreateView.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
2021-07-23 16:45:29 +08:00
|
|
|
(okBytes) => left(View.fromBuffer(okBytes)),
|
|
|
|
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
|
2021-07-20 23:51:08 +08:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-23 23:56:59 +08:00
|
|
|
class WorkspaceEventReadView {
|
|
|
|
QueryViewRequest request;
|
|
|
|
WorkspaceEventReadView(this.request);
|
|
|
|
|
|
|
|
Future<Either<View, WorkspaceError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = WorkspaceEvent.ReadView.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
|
|
|
(okBytes) => left(View.fromBuffer(okBytes)),
|
|
|
|
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class WorkspaceEventUpdateView {
|
|
|
|
UpdateViewRequest request;
|
|
|
|
WorkspaceEventUpdateView(this.request);
|
|
|
|
|
|
|
|
Future<Either<Unit, WorkspaceError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = WorkspaceEvent.UpdateView.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
|
|
|
(bytes) => left(unit),
|
|
|
|
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
|
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-11 22:38:49 +08:00
|
|
|
class UserEventGetStatus {
|
|
|
|
UserEventGetStatus();
|
|
|
|
|
2021-07-12 13:53:32 +08:00
|
|
|
Future<Either<UserDetail, UserError>> send() {
|
2021-07-11 22:38:49 +08:00
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = UserEvent.GetStatus.toString();
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
|
2021-07-12 13:53:32 +08:00
|
|
|
(okBytes) => left(UserDetail.fromBuffer(okBytes)),
|
|
|
|
(errBytes) => right(UserError.fromBuffer(errBytes)),
|
2021-07-11 22:38:49 +08:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
2021-07-09 14:02:42 +08:00
|
|
|
class UserEventSignIn {
|
2021-07-11 22:38:49 +08:00
|
|
|
SignInRequest request;
|
|
|
|
UserEventSignIn(this.request);
|
2021-07-08 13:47:11 +08:00
|
|
|
|
2021-07-12 13:53:32 +08:00
|
|
|
Future<Either<UserDetail, UserError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = UserEvent.SignIn.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
2021-07-11 22:38:49 +08:00
|
|
|
|
2021-07-12 13:53:32 +08:00
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
2021-07-23 16:45:29 +08:00
|
|
|
(okBytes) => left(UserDetail.fromBuffer(okBytes)),
|
|
|
|
(errBytes) => right(UserError.fromBuffer(errBytes)),
|
2021-07-12 13:53:32 +08:00
|
|
|
));
|
2021-07-08 21:23:44 +08:00
|
|
|
}
|
2021-07-08 13:47:11 +08:00
|
|
|
}
|
|
|
|
|
2021-07-09 14:02:42 +08:00
|
|
|
class UserEventSignUp {
|
2021-07-11 22:38:49 +08:00
|
|
|
SignUpRequest request;
|
|
|
|
UserEventSignUp(this.request);
|
2021-07-07 22:24:26 +08:00
|
|
|
|
2021-07-12 13:53:32 +08:00
|
|
|
Future<Either<UserDetail, UserError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = UserEvent.SignUp.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
2021-07-11 22:38:49 +08:00
|
|
|
|
2021-07-12 13:53:32 +08:00
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
2021-07-23 16:45:29 +08:00
|
|
|
(okBytes) => left(UserDetail.fromBuffer(okBytes)),
|
|
|
|
(errBytes) => right(UserError.fromBuffer(errBytes)),
|
2021-07-12 13:53:32 +08:00
|
|
|
));
|
2021-07-11 22:38:49 +08:00
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
class UserEventSignOut {
|
|
|
|
UserEventSignOut();
|
|
|
|
|
2021-07-13 13:23:03 +08:00
|
|
|
Future<Either<Unit, UserError>> send() {
|
2021-07-11 22:38:49 +08:00
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = UserEvent.SignOut.toString();
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
|
2021-07-13 13:23:03 +08:00
|
|
|
(bytes) => left(unit),
|
2021-07-12 13:53:32 +08:00
|
|
|
(errBytes) => right(UserError.fromBuffer(errBytes)),
|
2021-07-11 22:38:49 +08:00
|
|
|
));
|
2021-07-08 21:23:44 +08:00
|
|
|
}
|
2021-07-07 22:24:26 +08:00
|
|
|
}
|
2021-07-08 21:23:44 +08:00
|
|
|
|
2021-07-20 23:51:08 +08:00
|
|
|
class UserEventUpdateUser {
|
|
|
|
UpdateUserRequest request;
|
|
|
|
UserEventUpdateUser(this.request);
|
|
|
|
|
|
|
|
Future<Either<UserDetail, UserError>> send() {
|
|
|
|
final request = FFIRequest.create()
|
|
|
|
..event = UserEvent.UpdateUser.toString()
|
|
|
|
..payload = requestToBytes(this.request);
|
|
|
|
|
|
|
|
return Dispatch.asyncRequest(request)
|
|
|
|
.then((bytesResult) => bytesResult.fold(
|
2021-07-23 16:45:29 +08:00
|
|
|
(okBytes) => left(UserDetail.fromBuffer(okBytes)),
|
|
|
|
(errBytes) => right(UserError.fromBuffer(errBytes)),
|
2021-07-20 23:51:08 +08:00
|
|
|
));
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|