code_gen.dart 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394
  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 WorkspaceEventReadWorkspaces {
  29. QueryWorkspaceRequest request;
  30. WorkspaceEventReadWorkspaces(this.request);
  31. Future<Either<RepeatedWorkspace, WorkspaceError>> send() {
  32. final request = FFIRequest.create()
  33. ..event = WorkspaceEvent.ReadWorkspaces.toString()
  34. ..payload = requestToBytes(this.request);
  35. return Dispatch.asyncRequest(request)
  36. .then((bytesResult) => bytesResult.fold(
  37. (okBytes) => left(RepeatedWorkspace.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 WorkspaceEventOpenWorkspace {
  57. QueryWorkspaceRequest request;
  58. WorkspaceEventOpenWorkspace(this.request);
  59. Future<Either<Workspace, WorkspaceError>> send() {
  60. final request = FFIRequest.create()
  61. ..event = WorkspaceEvent.OpenWorkspace.toString()
  62. ..payload = requestToBytes(this.request);
  63. return Dispatch.asyncRequest(request)
  64. .then((bytesResult) => bytesResult.fold(
  65. (okBytes) => left(Workspace.fromBuffer(okBytes)),
  66. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  67. ));
  68. }
  69. }
  70. class WorkspaceEventReadWorkspaceApps {
  71. QueryWorkspaceRequest request;
  72. WorkspaceEventReadWorkspaceApps(this.request);
  73. Future<Either<RepeatedApp, WorkspaceError>> send() {
  74. final request = FFIRequest.create()
  75. ..event = WorkspaceEvent.ReadWorkspaceApps.toString()
  76. ..payload = requestToBytes(this.request);
  77. return Dispatch.asyncRequest(request)
  78. .then((bytesResult) => bytesResult.fold(
  79. (okBytes) => left(RepeatedApp.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 WorkspaceEventDeleteApp {
  99. DeleteAppRequest request;
  100. WorkspaceEventDeleteApp(this.request);
  101. Future<Either<Unit, WorkspaceError>> send() {
  102. final request = FFIRequest.create()
  103. ..event = WorkspaceEvent.DeleteApp.toString()
  104. ..payload = requestToBytes(this.request);
  105. return Dispatch.asyncRequest(request)
  106. .then((bytesResult) => bytesResult.fold(
  107. (bytes) => left(unit),
  108. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  109. ));
  110. }
  111. }
  112. class WorkspaceEventReadApp {
  113. QueryAppRequest request;
  114. WorkspaceEventReadApp(this.request);
  115. Future<Either<App, WorkspaceError>> send() {
  116. final request = FFIRequest.create()
  117. ..event = WorkspaceEvent.ReadApp.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 WorkspaceEventUpdateApp {
  127. UpdateAppRequest request;
  128. WorkspaceEventUpdateApp(this.request);
  129. Future<Either<Unit, WorkspaceError>> send() {
  130. final request = FFIRequest.create()
  131. ..event = WorkspaceEvent.UpdateApp.toString()
  132. ..payload = requestToBytes(this.request);
  133. return Dispatch.asyncRequest(request)
  134. .then((bytesResult) => bytesResult.fold(
  135. (bytes) => left(unit),
  136. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  137. ));
  138. }
  139. }
  140. class WorkspaceEventCreateView {
  141. CreateViewRequest request;
  142. WorkspaceEventCreateView(this.request);
  143. Future<Either<View, WorkspaceError>> send() {
  144. final request = FFIRequest.create()
  145. ..event = WorkspaceEvent.CreateView.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 WorkspaceEventReadView {
  155. QueryViewRequest request;
  156. WorkspaceEventReadView(this.request);
  157. Future<Either<View, WorkspaceError>> send() {
  158. final request = FFIRequest.create()
  159. ..event = WorkspaceEvent.ReadView.toString()
  160. ..payload = requestToBytes(this.request);
  161. return Dispatch.asyncRequest(request)
  162. .then((bytesResult) => bytesResult.fold(
  163. (okBytes) => left(View.fromBuffer(okBytes)),
  164. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  165. ));
  166. }
  167. }
  168. class WorkspaceEventUpdateView {
  169. UpdateViewRequest request;
  170. WorkspaceEventUpdateView(this.request);
  171. Future<Either<Unit, WorkspaceError>> send() {
  172. final request = FFIRequest.create()
  173. ..event = WorkspaceEvent.UpdateView.toString()
  174. ..payload = requestToBytes(this.request);
  175. return Dispatch.asyncRequest(request)
  176. .then((bytesResult) => bytesResult.fold(
  177. (bytes) => left(unit),
  178. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  179. ));
  180. }
  181. }
  182. class WorkspaceEventDeleteView {
  183. DeleteViewRequest request;
  184. WorkspaceEventDeleteView(this.request);
  185. Future<Either<Unit, WorkspaceError>> send() {
  186. final request = FFIRequest.create()
  187. ..event = WorkspaceEvent.DeleteView.toString()
  188. ..payload = requestToBytes(this.request);
  189. return Dispatch.asyncRequest(request)
  190. .then((bytesResult) => bytesResult.fold(
  191. (bytes) => left(unit),
  192. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  193. ));
  194. }
  195. }
  196. class WorkspaceEventOpenView {
  197. OpenViewRequest request;
  198. WorkspaceEventOpenView(this.request);
  199. Future<Either<DocDelta, WorkspaceError>> send() {
  200. final request = FFIRequest.create()
  201. ..event = WorkspaceEvent.OpenView.toString()
  202. ..payload = requestToBytes(this.request);
  203. return Dispatch.asyncRequest(request)
  204. .then((bytesResult) => bytesResult.fold(
  205. (okBytes) => left(DocDelta.fromBuffer(okBytes)),
  206. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  207. ));
  208. }
  209. }
  210. class WorkspaceEventApplyDocDelta {
  211. DocDelta request;
  212. WorkspaceEventApplyDocDelta(this.request);
  213. Future<Either<DocDelta, WorkspaceError>> send() {
  214. final request = FFIRequest.create()
  215. ..event = WorkspaceEvent.ApplyDocDelta.toString()
  216. ..payload = requestToBytes(this.request);
  217. return Dispatch.asyncRequest(request)
  218. .then((bytesResult) => bytesResult.fold(
  219. (okBytes) => left(DocDelta.fromBuffer(okBytes)),
  220. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  221. ));
  222. }
  223. }
  224. class WorkspaceEventInitWorkspace {
  225. WorkspaceEventInitWorkspace();
  226. Future<Either<Unit, WorkspaceError>> send() {
  227. final request = FFIRequest.create()
  228. ..event = WorkspaceEvent.InitWorkspace.toString();
  229. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  230. (bytes) => left(unit),
  231. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  232. ));
  233. }
  234. }
  235. class UserEventInitUser {
  236. UserEventInitUser();
  237. Future<Either<Unit, UserError>> send() {
  238. final request = FFIRequest.create()
  239. ..event = UserEvent.InitUser.toString();
  240. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  241. (bytes) => left(unit),
  242. (errBytes) => right(UserError.fromBuffer(errBytes)),
  243. ));
  244. }
  245. }
  246. class UserEventSignIn {
  247. SignInRequest request;
  248. UserEventSignIn(this.request);
  249. Future<Either<UserProfile, 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(UserProfile.fromBuffer(okBytes)),
  256. (errBytes) => right(UserError.fromBuffer(errBytes)),
  257. ));
  258. }
  259. }
  260. class UserEventSignUp {
  261. SignUpRequest request;
  262. UserEventSignUp(this.request);
  263. Future<Either<UserProfile, 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(UserProfile.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<Unit, 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. (bytes) => left(unit),
  295. (errBytes) => right(UserError.fromBuffer(errBytes)),
  296. ));
  297. }
  298. }
  299. class UserEventGetUserProfile {
  300. UserEventGetUserProfile();
  301. Future<Either<UserProfile, UserError>> send() {
  302. final request = FFIRequest.create()
  303. ..event = UserEvent.GetUserProfile.toString();
  304. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  305. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  306. (errBytes) => right(UserError.fromBuffer(errBytes)),
  307. ));
  308. }
  309. }
  310. class UserEventCheckUser {
  311. UserEventCheckUser();
  312. Future<Either<UserProfile, UserError>> send() {
  313. final request = FFIRequest.create()
  314. ..event = UserEvent.CheckUser.toString();
  315. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  316. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  317. (errBytes) => right(UserError.fromBuffer(errBytes)),
  318. ));
  319. }
  320. }