code_gen.dart 7.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233
  1. /// Auto gen code from rust ast, do not edit
  2. part of 'dispatch.dart';
  3. class EditorEventCreateDoc {
  4. CreateDocRequest request;
  5. EditorEventCreateDoc(this.request);
  6. Future<Either<DocDescription, EditorError>> send() {
  7. final request = FFIRequest.create()
  8. ..event = EditorEvent.CreateDoc.toString()
  9. ..payload = requestToBytes(this.request);
  10. return Dispatch.asyncRequest(request)
  11. .then((bytesResult) => bytesResult.fold(
  12. (okBytes) => left(DocDescription.fromBuffer(okBytes)),
  13. (errBytes) => right(EditorError.fromBuffer(errBytes)),
  14. ));
  15. }
  16. }
  17. class EditorEventUpdateDoc {
  18. UpdateDocRequest request;
  19. EditorEventUpdateDoc(this.request);
  20. Future<Either<Unit, EditorError>> send() {
  21. final request = FFIRequest.create()
  22. ..event = EditorEvent.UpdateDoc.toString()
  23. ..payload = requestToBytes(this.request);
  24. return Dispatch.asyncRequest(request)
  25. .then((bytesResult) => bytesResult.fold(
  26. (bytes) => left(unit),
  27. (errBytes) => right(EditorError.fromBuffer(errBytes)),
  28. ));
  29. }
  30. }
  31. class EditorEventReadDoc {
  32. QueryDocRequest request;
  33. EditorEventReadDoc(this.request);
  34. Future<Either<Doc, EditorError>> send() {
  35. final request = FFIRequest.create()
  36. ..event = EditorEvent.ReadDoc.toString()
  37. ..payload = requestToBytes(this.request);
  38. return Dispatch.asyncRequest(request)
  39. .then((bytesResult) => bytesResult.fold(
  40. (okBytes) => left(Doc.fromBuffer(okBytes)),
  41. (errBytes) => right(EditorError.fromBuffer(errBytes)),
  42. ));
  43. }
  44. }
  45. class WorkspaceEventCreateWorkspace {
  46. CreateWorkspaceRequest request;
  47. WorkspaceEventCreateWorkspace(this.request);
  48. Future<Either<Workspace, WorkspaceError>> send() {
  49. final request = FFIRequest.create()
  50. ..event = WorkspaceEvent.CreateWorkspace.toString()
  51. ..payload = requestToBytes(this.request);
  52. return Dispatch.asyncRequest(request)
  53. .then((bytesResult) => bytesResult.fold(
  54. (okBytes) => left(Workspace.fromBuffer(okBytes)),
  55. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  56. ));
  57. }
  58. }
  59. class WorkspaceEventGetCurWorkspace {
  60. WorkspaceEventGetCurWorkspace();
  61. Future<Either<Workspace, WorkspaceError>> send() {
  62. final request = FFIRequest.create()
  63. ..event = WorkspaceEvent.GetCurWorkspace.toString();
  64. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  65. (okBytes) => left(Workspace.fromBuffer(okBytes)),
  66. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  67. ));
  68. }
  69. }
  70. class WorkspaceEventGetWorkspace {
  71. QueryWorkspaceRequest request;
  72. WorkspaceEventGetWorkspace(this.request);
  73. Future<Either<Workspace, WorkspaceError>> send() {
  74. final request = FFIRequest.create()
  75. ..event = WorkspaceEvent.GetWorkspace.toString()
  76. ..payload = requestToBytes(this.request);
  77. return Dispatch.asyncRequest(request)
  78. .then((bytesResult) => bytesResult.fold(
  79. (okBytes) => left(Workspace.fromBuffer(okBytes)),
  80. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  81. ));
  82. }
  83. }
  84. class WorkspaceEventCreateApp {
  85. CreateAppRequest request;
  86. WorkspaceEventCreateApp(this.request);
  87. Future<Either<App, WorkspaceError>> send() {
  88. final request = FFIRequest.create()
  89. ..event = WorkspaceEvent.CreateApp.toString()
  90. ..payload = requestToBytes(this.request);
  91. return Dispatch.asyncRequest(request)
  92. .then((bytesResult) => bytesResult.fold(
  93. (okBytes) => left(App.fromBuffer(okBytes)),
  94. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  95. ));
  96. }
  97. }
  98. class WorkspaceEventGetApp {
  99. QueryAppRequest request;
  100. WorkspaceEventGetApp(this.request);
  101. Future<Either<App, WorkspaceError>> send() {
  102. final request = FFIRequest.create()
  103. ..event = WorkspaceEvent.GetApp.toString()
  104. ..payload = requestToBytes(this.request);
  105. return Dispatch.asyncRequest(request)
  106. .then((bytesResult) => bytesResult.fold(
  107. (okBytes) => left(App.fromBuffer(okBytes)),
  108. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  109. ));
  110. }
  111. }
  112. class WorkspaceEventCreateView {
  113. CreateViewRequest request;
  114. WorkspaceEventCreateView(this.request);
  115. Future<Either<View, WorkspaceError>> send() {
  116. final request = FFIRequest.create()
  117. ..event = WorkspaceEvent.CreateView.toString()
  118. ..payload = requestToBytes(this.request);
  119. return Dispatch.asyncRequest(request)
  120. .then((bytesResult) => bytesResult.fold(
  121. (okBytes) => left(View.fromBuffer(okBytes)),
  122. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  123. ));
  124. }
  125. }
  126. class UserEventGetStatus {
  127. UserEventGetStatus();
  128. Future<Either<UserDetail, UserError>> send() {
  129. final request = FFIRequest.create()
  130. ..event = UserEvent.GetStatus.toString();
  131. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  132. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  133. (errBytes) => right(UserError.fromBuffer(errBytes)),
  134. ));
  135. }
  136. }
  137. class UserEventSignIn {
  138. SignInRequest request;
  139. UserEventSignIn(this.request);
  140. Future<Either<UserDetail, UserError>> send() {
  141. final request = FFIRequest.create()
  142. ..event = UserEvent.SignIn.toString()
  143. ..payload = requestToBytes(this.request);
  144. return Dispatch.asyncRequest(request)
  145. .then((bytesResult) => bytesResult.fold(
  146. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  147. (errBytes) => right(UserError.fromBuffer(errBytes)),
  148. ));
  149. }
  150. }
  151. class UserEventSignUp {
  152. SignUpRequest request;
  153. UserEventSignUp(this.request);
  154. Future<Either<UserDetail, UserError>> send() {
  155. final request = FFIRequest.create()
  156. ..event = UserEvent.SignUp.toString()
  157. ..payload = requestToBytes(this.request);
  158. return Dispatch.asyncRequest(request)
  159. .then((bytesResult) => bytesResult.fold(
  160. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  161. (errBytes) => right(UserError.fromBuffer(errBytes)),
  162. ));
  163. }
  164. }
  165. class UserEventSignOut {
  166. UserEventSignOut();
  167. Future<Either<Unit, UserError>> send() {
  168. final request = FFIRequest.create()
  169. ..event = UserEvent.SignOut.toString();
  170. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  171. (bytes) => left(unit),
  172. (errBytes) => right(UserError.fromBuffer(errBytes)),
  173. ));
  174. }
  175. }
  176. class UserEventUpdateUser {
  177. UpdateUserRequest request;
  178. UserEventUpdateUser(this.request);
  179. Future<Either<UserDetail, UserError>> send() {
  180. final request = FFIRequest.create()
  181. ..event = UserEvent.UpdateUser.toString()
  182. ..payload = requestToBytes(this.request);
  183. return Dispatch.asyncRequest(request)
  184. .then((bytesResult) => bytesResult.fold(
  185. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  186. (errBytes) => right(UserError.fromBuffer(errBytes)),
  187. ));
  188. }
  189. }