code_gen.dart 8.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284
  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<DocInfo, 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(DocInfo.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 EditorEventReadDocInfo {
  32. QueryDocRequest request;
  33. EditorEventReadDocInfo(this.request);
  34. Future<Either<DocInfo, EditorError>> send() {
  35. final request = FFIRequest.create()
  36. ..event = EditorEvent.ReadDocInfo.toString()
  37. ..payload = requestToBytes(this.request);
  38. return Dispatch.asyncRequest(request)
  39. .then((bytesResult) => bytesResult.fold(
  40. (okBytes) => left(DocInfo.fromBuffer(okBytes)),
  41. (errBytes) => right(EditorError.fromBuffer(errBytes)),
  42. ));
  43. }
  44. }
  45. class EditorEventReadDocData {
  46. QueryDocDataRequest request;
  47. EditorEventReadDocData(this.request);
  48. Future<Either<DocData, EditorError>> send() {
  49. final request = FFIRequest.create()
  50. ..event = EditorEvent.ReadDocData.toString()
  51. ..payload = requestToBytes(this.request);
  52. return Dispatch.asyncRequest(request)
  53. .then((bytesResult) => bytesResult.fold(
  54. (okBytes) => left(DocData.fromBuffer(okBytes)),
  55. (errBytes) => right(EditorError.fromBuffer(errBytes)),
  56. ));
  57. }
  58. }
  59. class WorkspaceEventCreateWorkspace {
  60. CreateWorkspaceRequest request;
  61. WorkspaceEventCreateWorkspace(this.request);
  62. Future<Either<Workspace, WorkspaceError>> send() {
  63. final request = FFIRequest.create()
  64. ..event = WorkspaceEvent.CreateWorkspace.toString()
  65. ..payload = requestToBytes(this.request);
  66. return Dispatch.asyncRequest(request)
  67. .then((bytesResult) => bytesResult.fold(
  68. (okBytes) => left(Workspace.fromBuffer(okBytes)),
  69. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  70. ));
  71. }
  72. }
  73. class WorkspaceEventGetCurWorkspace {
  74. WorkspaceEventGetCurWorkspace();
  75. Future<Either<Workspace, WorkspaceError>> send() {
  76. final request = FFIRequest.create()
  77. ..event = WorkspaceEvent.GetCurWorkspace.toString();
  78. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  79. (okBytes) => left(Workspace.fromBuffer(okBytes)),
  80. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  81. ));
  82. }
  83. }
  84. class WorkspaceEventGetWorkspace {
  85. QueryWorkspaceRequest request;
  86. WorkspaceEventGetWorkspace(this.request);
  87. Future<Either<Workspace, WorkspaceError>> send() {
  88. final request = FFIRequest.create()
  89. ..event = WorkspaceEvent.GetWorkspace.toString()
  90. ..payload = requestToBytes(this.request);
  91. return Dispatch.asyncRequest(request)
  92. .then((bytesResult) => bytesResult.fold(
  93. (okBytes) => left(Workspace.fromBuffer(okBytes)),
  94. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  95. ));
  96. }
  97. }
  98. class WorkspaceEventCreateApp {
  99. CreateAppRequest request;
  100. WorkspaceEventCreateApp(this.request);
  101. Future<Either<App, WorkspaceError>> send() {
  102. final request = FFIRequest.create()
  103. ..event = WorkspaceEvent.CreateApp.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 WorkspaceEventGetApp {
  113. QueryAppRequest request;
  114. WorkspaceEventGetApp(this.request);
  115. Future<Either<App, WorkspaceError>> send() {
  116. final request = FFIRequest.create()
  117. ..event = WorkspaceEvent.GetApp.toString()
  118. ..payload = requestToBytes(this.request);
  119. return Dispatch.asyncRequest(request)
  120. .then((bytesResult) => bytesResult.fold(
  121. (okBytes) => left(App.fromBuffer(okBytes)),
  122. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  123. ));
  124. }
  125. }
  126. class WorkspaceEventCreateView {
  127. CreateViewRequest request;
  128. WorkspaceEventCreateView(this.request);
  129. Future<Either<View, WorkspaceError>> send() {
  130. final request = FFIRequest.create()
  131. ..event = WorkspaceEvent.CreateView.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 WorkspaceEventReadView {
  141. QueryViewRequest request;
  142. WorkspaceEventReadView(this.request);
  143. Future<Either<View, WorkspaceError>> send() {
  144. final request = FFIRequest.create()
  145. ..event = WorkspaceEvent.ReadView.toString()
  146. ..payload = requestToBytes(this.request);
  147. return Dispatch.asyncRequest(request)
  148. .then((bytesResult) => bytesResult.fold(
  149. (okBytes) => left(View.fromBuffer(okBytes)),
  150. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  151. ));
  152. }
  153. }
  154. class WorkspaceEventUpdateView {
  155. UpdateViewRequest request;
  156. WorkspaceEventUpdateView(this.request);
  157. Future<Either<Unit, WorkspaceError>> send() {
  158. final request = FFIRequest.create()
  159. ..event = WorkspaceEvent.UpdateView.toString()
  160. ..payload = requestToBytes(this.request);
  161. return Dispatch.asyncRequest(request)
  162. .then((bytesResult) => bytesResult.fold(
  163. (bytes) => left(unit),
  164. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  165. ));
  166. }
  167. }
  168. class UserEventGetStatus {
  169. UserEventGetStatus();
  170. Future<Either<UserDetail, UserError>> send() {
  171. final request = FFIRequest.create()
  172. ..event = UserEvent.GetStatus.toString();
  173. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  174. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  175. (errBytes) => right(UserError.fromBuffer(errBytes)),
  176. ));
  177. }
  178. }
  179. class UserEventSignIn {
  180. SignInRequest request;
  181. UserEventSignIn(this.request);
  182. Future<Either<UserDetail, UserError>> send() {
  183. final request = FFIRequest.create()
  184. ..event = UserEvent.SignIn.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 UserEventSignUp {
  194. SignUpRequest request;
  195. UserEventSignUp(this.request);
  196. Future<Either<UserDetail, UserError>> send() {
  197. final request = FFIRequest.create()
  198. ..event = UserEvent.SignUp.toString()
  199. ..payload = requestToBytes(this.request);
  200. return Dispatch.asyncRequest(request)
  201. .then((bytesResult) => bytesResult.fold(
  202. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  203. (errBytes) => right(UserError.fromBuffer(errBytes)),
  204. ));
  205. }
  206. }
  207. class UserEventSignOut {
  208. UserEventSignOut();
  209. Future<Either<Unit, UserError>> send() {
  210. final request = FFIRequest.create()
  211. ..event = UserEvent.SignOut.toString();
  212. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  213. (bytes) => left(unit),
  214. (errBytes) => right(UserError.fromBuffer(errBytes)),
  215. ));
  216. }
  217. }
  218. class UserEventUpdateUser {
  219. UpdateUserRequest request;
  220. UserEventUpdateUser(this.request);
  221. Future<Either<UserDetail, UserError>> send() {
  222. final request = FFIRequest.create()
  223. ..event = UserEvent.UpdateUser.toString()
  224. ..payload = requestToBytes(this.request);
  225. return Dispatch.asyncRequest(request)
  226. .then((bytesResult) => bytesResult.fold(
  227. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  228. (errBytes) => right(UserError.fromBuffer(errBytes)),
  229. ));
  230. }
  231. }