code_gen.dart 11 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366
  1. /// Auto gen code from rust ast, do not edit
  2. part of 'dispatch.dart';
  3. class WorkspaceEventCreateWorkspace {
  4. CreateWorkspaceRequest request;
  5. WorkspaceEventCreateWorkspace(this.request);
  6. Future<Either<Workspace, WorkspaceError>> send() {
  7. final request = FFIRequest.create()
  8. ..event = WorkspaceEvent.CreateWorkspace.toString()
  9. ..payload = requestToBytes(this.request);
  10. return Dispatch.asyncRequest(request)
  11. .then((bytesResult) => bytesResult.fold(
  12. (okBytes) => left(Workspace.fromBuffer(okBytes)),
  13. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  14. ));
  15. }
  16. }
  17. class WorkspaceEventReadCurWorkspace {
  18. WorkspaceEventReadCurWorkspace();
  19. Future<Either<Workspace, WorkspaceError>> send() {
  20. final request = FFIRequest.create()
  21. ..event = WorkspaceEvent.ReadCurWorkspace.toString();
  22. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  23. (okBytes) => left(Workspace.fromBuffer(okBytes)),
  24. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  25. ));
  26. }
  27. }
  28. class WorkspaceEventReadWorkspace {
  29. QueryWorkspaceRequest request;
  30. WorkspaceEventReadWorkspace(this.request);
  31. Future<Either<Workspace, WorkspaceError>> send() {
  32. final request = FFIRequest.create()
  33. ..event = WorkspaceEvent.ReadWorkspace.toString()
  34. ..payload = requestToBytes(this.request);
  35. return Dispatch.asyncRequest(request)
  36. .then((bytesResult) => bytesResult.fold(
  37. (okBytes) => left(Workspace.fromBuffer(okBytes)),
  38. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  39. ));
  40. }
  41. }
  42. class WorkspaceEventDeleteWorkspace {
  43. DeleteWorkspaceRequest request;
  44. WorkspaceEventDeleteWorkspace(this.request);
  45. Future<Either<Unit, WorkspaceError>> send() {
  46. final request = FFIRequest.create()
  47. ..event = WorkspaceEvent.DeleteWorkspace.toString()
  48. ..payload = requestToBytes(this.request);
  49. return Dispatch.asyncRequest(request)
  50. .then((bytesResult) => bytesResult.fold(
  51. (bytes) => left(unit),
  52. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  53. ));
  54. }
  55. }
  56. class WorkspaceEventReadAllWorkspace {
  57. WorkspaceEventReadAllWorkspace();
  58. Future<Either<Workspaces, WorkspaceError>> send() {
  59. final request = FFIRequest.create()
  60. ..event = WorkspaceEvent.ReadAllWorkspace.toString();
  61. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  62. (okBytes) => left(Workspaces.fromBuffer(okBytes)),
  63. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  64. ));
  65. }
  66. }
  67. class WorkspaceEventCreateApp {
  68. CreateAppRequest request;
  69. WorkspaceEventCreateApp(this.request);
  70. Future<Either<App, WorkspaceError>> send() {
  71. final request = FFIRequest.create()
  72. ..event = WorkspaceEvent.CreateApp.toString()
  73. ..payload = requestToBytes(this.request);
  74. return Dispatch.asyncRequest(request)
  75. .then((bytesResult) => bytesResult.fold(
  76. (okBytes) => left(App.fromBuffer(okBytes)),
  77. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  78. ));
  79. }
  80. }
  81. class WorkspaceEventDeleteApp {
  82. DeleteAppRequest request;
  83. WorkspaceEventDeleteApp(this.request);
  84. Future<Either<Unit, WorkspaceError>> send() {
  85. final request = FFIRequest.create()
  86. ..event = WorkspaceEvent.DeleteApp.toString()
  87. ..payload = requestToBytes(this.request);
  88. return Dispatch.asyncRequest(request)
  89. .then((bytesResult) => bytesResult.fold(
  90. (bytes) => left(unit),
  91. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  92. ));
  93. }
  94. }
  95. class WorkspaceEventReadApp {
  96. QueryAppRequest request;
  97. WorkspaceEventReadApp(this.request);
  98. Future<Either<App, WorkspaceError>> send() {
  99. final request = FFIRequest.create()
  100. ..event = WorkspaceEvent.ReadApp.toString()
  101. ..payload = requestToBytes(this.request);
  102. return Dispatch.asyncRequest(request)
  103. .then((bytesResult) => bytesResult.fold(
  104. (okBytes) => left(App.fromBuffer(okBytes)),
  105. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  106. ));
  107. }
  108. }
  109. class WorkspaceEventUpdateApp {
  110. UpdateAppRequest request;
  111. WorkspaceEventUpdateApp(this.request);
  112. Future<Either<Unit, WorkspaceError>> send() {
  113. final request = FFIRequest.create()
  114. ..event = WorkspaceEvent.UpdateApp.toString()
  115. ..payload = requestToBytes(this.request);
  116. return Dispatch.asyncRequest(request)
  117. .then((bytesResult) => bytesResult.fold(
  118. (bytes) => left(unit),
  119. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  120. ));
  121. }
  122. }
  123. class WorkspaceEventCreateView {
  124. CreateViewRequest request;
  125. WorkspaceEventCreateView(this.request);
  126. Future<Either<View, WorkspaceError>> send() {
  127. final request = FFIRequest.create()
  128. ..event = WorkspaceEvent.CreateView.toString()
  129. ..payload = requestToBytes(this.request);
  130. return Dispatch.asyncRequest(request)
  131. .then((bytesResult) => bytesResult.fold(
  132. (okBytes) => left(View.fromBuffer(okBytes)),
  133. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  134. ));
  135. }
  136. }
  137. class WorkspaceEventReadView {
  138. QueryViewRequest request;
  139. WorkspaceEventReadView(this.request);
  140. Future<Either<View, WorkspaceError>> send() {
  141. final request = FFIRequest.create()
  142. ..event = WorkspaceEvent.ReadView.toString()
  143. ..payload = requestToBytes(this.request);
  144. return Dispatch.asyncRequest(request)
  145. .then((bytesResult) => bytesResult.fold(
  146. (okBytes) => left(View.fromBuffer(okBytes)),
  147. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  148. ));
  149. }
  150. }
  151. class WorkspaceEventUpdateView {
  152. UpdateViewRequest request;
  153. WorkspaceEventUpdateView(this.request);
  154. Future<Either<Unit, WorkspaceError>> send() {
  155. final request = FFIRequest.create()
  156. ..event = WorkspaceEvent.UpdateView.toString()
  157. ..payload = requestToBytes(this.request);
  158. return Dispatch.asyncRequest(request)
  159. .then((bytesResult) => bytesResult.fold(
  160. (bytes) => left(unit),
  161. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  162. ));
  163. }
  164. }
  165. class WorkspaceEventDeleteView {
  166. DeleteViewRequest request;
  167. WorkspaceEventDeleteView(this.request);
  168. Future<Either<Unit, WorkspaceError>> send() {
  169. final request = FFIRequest.create()
  170. ..event = WorkspaceEvent.DeleteView.toString()
  171. ..payload = requestToBytes(this.request);
  172. return Dispatch.asyncRequest(request)
  173. .then((bytesResult) => bytesResult.fold(
  174. (bytes) => left(unit),
  175. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  176. ));
  177. }
  178. }
  179. class EditorEventCreateDoc {
  180. CreateDocRequest request;
  181. EditorEventCreateDoc(this.request);
  182. Future<Either<DocInfo, DocError>> send() {
  183. final request = FFIRequest.create()
  184. ..event = EditorEvent.CreateDoc.toString()
  185. ..payload = requestToBytes(this.request);
  186. return Dispatch.asyncRequest(request)
  187. .then((bytesResult) => bytesResult.fold(
  188. (okBytes) => left(DocInfo.fromBuffer(okBytes)),
  189. (errBytes) => right(DocError.fromBuffer(errBytes)),
  190. ));
  191. }
  192. }
  193. class EditorEventUpdateDoc {
  194. UpdateDocRequest request;
  195. EditorEventUpdateDoc(this.request);
  196. Future<Either<Unit, DocError>> send() {
  197. final request = FFIRequest.create()
  198. ..event = EditorEvent.UpdateDoc.toString()
  199. ..payload = requestToBytes(this.request);
  200. return Dispatch.asyncRequest(request)
  201. .then((bytesResult) => bytesResult.fold(
  202. (bytes) => left(unit),
  203. (errBytes) => right(DocError.fromBuffer(errBytes)),
  204. ));
  205. }
  206. }
  207. class EditorEventReadDocInfo {
  208. QueryDocRequest request;
  209. EditorEventReadDocInfo(this.request);
  210. Future<Either<DocInfo, DocError>> send() {
  211. final request = FFIRequest.create()
  212. ..event = EditorEvent.ReadDocInfo.toString()
  213. ..payload = requestToBytes(this.request);
  214. return Dispatch.asyncRequest(request)
  215. .then((bytesResult) => bytesResult.fold(
  216. (okBytes) => left(DocInfo.fromBuffer(okBytes)),
  217. (errBytes) => right(DocError.fromBuffer(errBytes)),
  218. ));
  219. }
  220. }
  221. class EditorEventReadDocData {
  222. QueryDocDataRequest request;
  223. EditorEventReadDocData(this.request);
  224. Future<Either<DocData, DocError>> send() {
  225. final request = FFIRequest.create()
  226. ..event = EditorEvent.ReadDocData.toString()
  227. ..payload = requestToBytes(this.request);
  228. return Dispatch.asyncRequest(request)
  229. .then((bytesResult) => bytesResult.fold(
  230. (okBytes) => left(DocData.fromBuffer(okBytes)),
  231. (errBytes) => right(DocError.fromBuffer(errBytes)),
  232. ));
  233. }
  234. }
  235. class UserEventGetStatus {
  236. UserEventGetStatus();
  237. Future<Either<UserDetail, UserError>> send() {
  238. final request = FFIRequest.create()
  239. ..event = UserEvent.GetStatus.toString();
  240. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  241. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  242. (errBytes) => right(UserError.fromBuffer(errBytes)),
  243. ));
  244. }
  245. }
  246. class UserEventSignIn {
  247. SignInRequest request;
  248. UserEventSignIn(this.request);
  249. Future<Either<UserDetail, UserError>> send() {
  250. final request = FFIRequest.create()
  251. ..event = UserEvent.SignIn.toString()
  252. ..payload = requestToBytes(this.request);
  253. return Dispatch.asyncRequest(request)
  254. .then((bytesResult) => bytesResult.fold(
  255. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  256. (errBytes) => right(UserError.fromBuffer(errBytes)),
  257. ));
  258. }
  259. }
  260. class UserEventSignUp {
  261. SignUpRequest request;
  262. UserEventSignUp(this.request);
  263. Future<Either<UserDetail, UserError>> send() {
  264. final request = FFIRequest.create()
  265. ..event = UserEvent.SignUp.toString()
  266. ..payload = requestToBytes(this.request);
  267. return Dispatch.asyncRequest(request)
  268. .then((bytesResult) => bytesResult.fold(
  269. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  270. (errBytes) => right(UserError.fromBuffer(errBytes)),
  271. ));
  272. }
  273. }
  274. class UserEventSignOut {
  275. UserEventSignOut();
  276. Future<Either<Unit, UserError>> send() {
  277. final request = FFIRequest.create()
  278. ..event = UserEvent.SignOut.toString();
  279. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  280. (bytes) => left(unit),
  281. (errBytes) => right(UserError.fromBuffer(errBytes)),
  282. ));
  283. }
  284. }
  285. class UserEventUpdateUser {
  286. UpdateUserRequest request;
  287. UserEventUpdateUser(this.request);
  288. Future<Either<UserDetail, UserError>> send() {
  289. final request = FFIRequest.create()
  290. ..event = UserEvent.UpdateUser.toString()
  291. ..payload = requestToBytes(this.request);
  292. return Dispatch.asyncRequest(request)
  293. .then((bytesResult) => bytesResult.fold(
  294. (okBytes) => left(UserDetail.fromBuffer(okBytes)),
  295. (errBytes) => right(UserError.fromBuffer(errBytes)),
  296. ));
  297. }
  298. }