code_gen.dart 11 KB

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