code_gen.dart 8.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267
  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 WorkspaceEventReadView {
  127. QueryViewRequest request;
  128. WorkspaceEventReadView(this.request);
  129. Future<Either<View, WorkspaceError>> send() {
  130. final request = FFIRequest.create()
  131. ..event = WorkspaceEvent.ReadView.toString()
  132. ..payload = requestToBytes(this.request);
  133. return Dispatch.asyncRequest(request)
  134. .then((bytesResult) => bytesResult.fold(
  135. (okBytes) => left(View.fromBuffer(okBytes)),
  136. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  137. ));
  138. }
  139. }
  140. class WorkspaceEventUpdateView {
  141. UpdateViewRequest request;
  142. WorkspaceEventUpdateView(this.request);
  143. Future<Either<Unit, WorkspaceError>> send() {
  144. final request = FFIRequest.create()
  145. ..event = WorkspaceEvent.UpdateView.toString()
  146. ..payload = requestToBytes(this.request);
  147. return Dispatch.asyncRequest(request)
  148. .then((bytesResult) => bytesResult.fold(
  149. (bytes) => left(unit),
  150. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  151. ));
  152. }
  153. }
  154. class UserEventGetStatus {
  155. UserEventGetStatus();
  156. Future<Either<UserDetail, UserError>> send() {
  157. final request = FFIRequest.create()
  158. ..event = UserEvent.GetStatus.toString();
  159. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  160. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  161. (errBytes) => right(UserError.fromBuffer(errBytes)),
  162. ));
  163. }
  164. }
  165. class UserEventSignIn {
  166. SignInRequest request;
  167. UserEventSignIn(this.request);
  168. Future<Either<UserDetail, UserError>> send() {
  169. final request = FFIRequest.create()
  170. ..event = UserEvent.SignIn.toString()
  171. ..payload = requestToBytes(this.request);
  172. return Dispatch.asyncRequest(request)
  173. .then((bytesResult) => bytesResult.fold(
  174. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  175. (errBytes) => right(UserError.fromBuffer(errBytes)),
  176. ));
  177. }
  178. }
  179. class UserEventSignUp {
  180. SignUpRequest request;
  181. UserEventSignUp(this.request);
  182. Future<Either<UserDetail, UserError>> send() {
  183. final request = FFIRequest.create()
  184. ..event = UserEvent.SignUp.toString()
  185. ..payload = requestToBytes(this.request);
  186. return Dispatch.asyncRequest(request)
  187. .then((bytesResult) => bytesResult.fold(
  188. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  189. (errBytes) => right(UserError.fromBuffer(errBytes)),
  190. ));
  191. }
  192. }
  193. class UserEventSignOut {
  194. UserEventSignOut();
  195. Future<Either<Unit, UserError>> send() {
  196. final request = FFIRequest.create()
  197. ..event = UserEvent.SignOut.toString();
  198. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  199. (bytes) => left(unit),
  200. (errBytes) => right(UserError.fromBuffer(errBytes)),
  201. ));
  202. }
  203. }
  204. class UserEventUpdateUser {
  205. UpdateUserRequest request;
  206. UserEventUpdateUser(this.request);
  207. Future<Either<UserDetail, UserError>> send() {
  208. final request = FFIRequest.create()
  209. ..event = UserEvent.UpdateUser.toString()
  210. ..payload = requestToBytes(this.request);
  211. return Dispatch.asyncRequest(request)
  212. .then((bytesResult) => bytesResult.fold(
  213. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  214. (errBytes) => right(UserError.fromBuffer(errBytes)),
  215. ));
  216. }
  217. }