367 lines
11 KiB
Dart
Raw Normal View History

2021-07-08 21:23:44 +08:00
/// Auto gen code from rust ast, do not edit
part of 'dispatch.dart';
class EditorEventCreateDoc {
CreateDocRequest request;
EditorEventCreateDoc(this.request);
2021-07-24 14:05:49 +08:00
Future<Either<DocInfo, EditorError>> send() {
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)),
(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 {
QueryDocRequest request;
2021-07-24 14:05:49 +08:00
EditorEventReadDocInfo(this.request);
2021-07-24 14:05:49 +08:00
Future<Either<DocInfo, EditorError>> send() {
final request = FFIRequest.create()
2021-07-24 14:05:49 +08:00
..event = EditorEvent.ReadDocInfo.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)),
(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)),
(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(
(okBytes) => left(Workspace.fromBuffer(okBytes)),
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
2021-07-20 23:51:08 +08:00
));
}
}
2021-07-29 17:46:20 +08:00
class WorkspaceEventReadCurWorkspace {
WorkspaceEventReadCurWorkspace();
2021-07-20 23:51:08 +08:00
Future<Either<Workspace, WorkspaceError>> send() {
final request = FFIRequest.create()
2021-07-29 17:46:20 +08:00
..event = WorkspaceEvent.ReadCurWorkspace.toString();
2021-07-20 23:51:08 +08:00
return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
(okBytes) => left(Workspace.fromBuffer(okBytes)),
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
));
}
}
2021-07-29 17:46:20 +08:00
class WorkspaceEventReadWorkspace {
2021-07-20 23:51:08 +08:00
QueryWorkspaceRequest request;
2021-07-29 17:46:20 +08:00
WorkspaceEventReadWorkspace(this.request);
2021-07-20 23:51:08 +08:00
Future<Either<Workspace, WorkspaceError>> send() {
final request = FFIRequest.create()
2021-07-29 17:46:20 +08:00
..event = WorkspaceEvent.ReadWorkspace.toString()
2021-07-20 23:51:08 +08:00
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(okBytes) => left(Workspace.fromBuffer(okBytes)),
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
2021-07-20 23:51:08 +08:00
));
}
}
2021-07-29 17:46:20 +08:00
class WorkspaceEventDeleteWorkspace {
DeleteWorkspaceRequest request;
WorkspaceEventDeleteWorkspace(this.request);
Future<Either<Unit, WorkspaceError>> send() {
final request = FFIRequest.create()
..event = WorkspaceEvent.DeleteWorkspace.toString()
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(bytes) => left(unit),
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
));
}
}
2021-07-26 13:51:41 +08:00
class WorkspaceEventReadAllWorkspace {
WorkspaceEventReadAllWorkspace();
Future<Either<Workspaces, WorkspaceError>> send() {
final request = FFIRequest.create()
..event = WorkspaceEvent.ReadAllWorkspace.toString();
return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
(okBytes) => left(Workspaces.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(
(okBytes) => left(App.fromBuffer(okBytes)),
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
2021-07-20 23:51:08 +08:00
));
}
}
2021-07-29 17:46:20 +08:00
class WorkspaceEventDeleteApp {
DeleteAppRequest request;
WorkspaceEventDeleteApp(this.request);
Future<Either<Unit, WorkspaceError>> send() {
final request = FFIRequest.create()
..event = WorkspaceEvent.DeleteApp.toString()
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(bytes) => left(unit),
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
));
}
}
class WorkspaceEventReadApp {
2021-07-20 23:51:08 +08:00
QueryAppRequest request;
2021-07-29 17:46:20 +08:00
WorkspaceEventReadApp(this.request);
2021-07-20 23:51:08 +08:00
Future<Either<App, WorkspaceError>> send() {
final request = FFIRequest.create()
2021-07-29 17:46:20 +08:00
..event = WorkspaceEvent.ReadApp.toString()
2021-07-20 23:51:08 +08:00
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(okBytes) => left(App.fromBuffer(okBytes)),
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
2021-07-20 23:51:08 +08:00
));
}
}
2021-07-29 17:46:20 +08:00
class WorkspaceEventUpdateApp {
UpdateAppRequest request;
WorkspaceEventUpdateApp(this.request);
Future<Either<Unit, WorkspaceError>> send() {
final request = FFIRequest.create()
..event = WorkspaceEvent.UpdateApp.toString()
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(bytes) => left(unit),
(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(
(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-29 17:46:20 +08:00
class WorkspaceEventDeleteView {
DeleteViewRequest request;
WorkspaceEventDeleteView(this.request);
Future<Either<Unit, WorkspaceError>> send() {
final request = FFIRequest.create()
..event = WorkspaceEvent.DeleteView.toString()
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(bytes) => left(unit),
(errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
));
}
}
class UserEventGetStatus {
UserEventGetStatus();
Future<Either<UserDetail, UserError>> send() {
final request = FFIRequest.create()
..event = UserEvent.GetStatus.toString();
return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
(okBytes) => left(UserDetail.fromBuffer(okBytes)),
(errBytes) => right(UserError.fromBuffer(errBytes)),
));
}
}
class UserEventSignIn {
SignInRequest request;
UserEventSignIn(this.request);
Future<Either<UserDetail, UserError>> send() {
final request = FFIRequest.create()
..event = UserEvent.SignIn.toString()
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(okBytes) => left(UserDetail.fromBuffer(okBytes)),
(errBytes) => right(UserError.fromBuffer(errBytes)),
));
2021-07-08 21:23:44 +08:00
}
}
class UserEventSignUp {
SignUpRequest request;
UserEventSignUp(this.request);
Future<Either<UserDetail, UserError>> send() {
final request = FFIRequest.create()
..event = UserEvent.SignUp.toString()
..payload = requestToBytes(this.request);
return Dispatch.asyncRequest(request)
.then((bytesResult) => bytesResult.fold(
(okBytes) => left(UserDetail.fromBuffer(okBytes)),
(errBytes) => right(UserError.fromBuffer(errBytes)),
));
}
}
class UserEventSignOut {
UserEventSignOut();
Future<Either<Unit, UserError>> send() {
final request = FFIRequest.create()
..event = UserEvent.SignOut.toString();
return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
(bytes) => left(unit),
(errBytes) => right(UserError.fromBuffer(errBytes)),
));
2021-07-08 21:23:44 +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(
(okBytes) => left(UserDetail.fromBuffer(okBytes)),
(errBytes) => right(UserError.fromBuffer(errBytes)),
2021-07-20 23:51:08 +08:00
));
}
}