code_gen.dart 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487
  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<View, 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. (okBytes) => left(View.fromBuffer(okBytes)),
  178. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  179. ));
  180. }
  181. }
  182. class WorkspaceEventDeleteView {
  183. QueryViewRequest 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. QueryViewRequest 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 WorkspaceEventCloseView {
  211. QueryViewRequest request;
  212. WorkspaceEventCloseView(this.request);
  213. Future<Either<Unit, WorkspaceError>> send() {
  214. final request = FFIRequest.create()
  215. ..event = WorkspaceEvent.CloseView.toString()
  216. ..payload = requestToBytes(this.request);
  217. return Dispatch.asyncRequest(request)
  218. .then((bytesResult) => bytesResult.fold(
  219. (bytes) => left(unit),
  220. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  221. ));
  222. }
  223. }
  224. class WorkspaceEventApplyDocDelta {
  225. DocDelta request;
  226. WorkspaceEventApplyDocDelta(this.request);
  227. Future<Either<DocDelta, WorkspaceError>> send() {
  228. final request = FFIRequest.create()
  229. ..event = WorkspaceEvent.ApplyDocDelta.toString()
  230. ..payload = requestToBytes(this.request);
  231. return Dispatch.asyncRequest(request)
  232. .then((bytesResult) => bytesResult.fold(
  233. (okBytes) => left(DocDelta.fromBuffer(okBytes)),
  234. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  235. ));
  236. }
  237. }
  238. class WorkspaceEventReadTrash {
  239. WorkspaceEventReadTrash();
  240. Future<Either<RepeatedTrash, WorkspaceError>> send() {
  241. final request = FFIRequest.create()
  242. ..event = WorkspaceEvent.ReadTrash.toString();
  243. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  244. (okBytes) => left(RepeatedTrash.fromBuffer(okBytes)),
  245. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  246. ));
  247. }
  248. }
  249. class WorkspaceEventPutbackTrash {
  250. TrashIdentifier request;
  251. WorkspaceEventPutbackTrash(this.request);
  252. Future<Either<Unit, WorkspaceError>> send() {
  253. final request = FFIRequest.create()
  254. ..event = WorkspaceEvent.PutbackTrash.toString()
  255. ..payload = requestToBytes(this.request);
  256. return Dispatch.asyncRequest(request)
  257. .then((bytesResult) => bytesResult.fold(
  258. (bytes) => left(unit),
  259. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  260. ));
  261. }
  262. }
  263. class WorkspaceEventDeleteTrash {
  264. TrashIdentifiers request;
  265. WorkspaceEventDeleteTrash(this.request);
  266. Future<Either<Unit, WorkspaceError>> send() {
  267. final request = FFIRequest.create()
  268. ..event = WorkspaceEvent.DeleteTrash.toString()
  269. ..payload = requestToBytes(this.request);
  270. return Dispatch.asyncRequest(request)
  271. .then((bytesResult) => bytesResult.fold(
  272. (bytes) => left(unit),
  273. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  274. ));
  275. }
  276. }
  277. class WorkspaceEventRestoreAll {
  278. WorkspaceEventRestoreAll();
  279. Future<Either<Unit, WorkspaceError>> send() {
  280. final request = FFIRequest.create()
  281. ..event = WorkspaceEvent.RestoreAll.toString();
  282. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  283. (bytes) => left(unit),
  284. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  285. ));
  286. }
  287. }
  288. class WorkspaceEventDeleteAll {
  289. WorkspaceEventDeleteAll();
  290. Future<Either<Unit, WorkspaceError>> send() {
  291. final request = FFIRequest.create()
  292. ..event = WorkspaceEvent.DeleteAll.toString();
  293. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  294. (bytes) => left(unit),
  295. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  296. ));
  297. }
  298. }
  299. class WorkspaceEventInitWorkspace {
  300. WorkspaceEventInitWorkspace();
  301. Future<Either<Unit, WorkspaceError>> send() {
  302. final request = FFIRequest.create()
  303. ..event = WorkspaceEvent.InitWorkspace.toString();
  304. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  305. (bytes) => left(unit),
  306. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  307. ));
  308. }
  309. }
  310. class UserEventInitUser {
  311. UserEventInitUser();
  312. Future<Either<Unit, UserError>> send() {
  313. final request = FFIRequest.create()
  314. ..event = UserEvent.InitUser.toString();
  315. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  316. (bytes) => left(unit),
  317. (errBytes) => right(UserError.fromBuffer(errBytes)),
  318. ));
  319. }
  320. }
  321. class UserEventSignIn {
  322. SignInRequest request;
  323. UserEventSignIn(this.request);
  324. Future<Either<UserProfile, UserError>> send() {
  325. final request = FFIRequest.create()
  326. ..event = UserEvent.SignIn.toString()
  327. ..payload = requestToBytes(this.request);
  328. return Dispatch.asyncRequest(request)
  329. .then((bytesResult) => bytesResult.fold(
  330. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  331. (errBytes) => right(UserError.fromBuffer(errBytes)),
  332. ));
  333. }
  334. }
  335. class UserEventSignUp {
  336. SignUpRequest request;
  337. UserEventSignUp(this.request);
  338. Future<Either<UserProfile, UserError>> send() {
  339. final request = FFIRequest.create()
  340. ..event = UserEvent.SignUp.toString()
  341. ..payload = requestToBytes(this.request);
  342. return Dispatch.asyncRequest(request)
  343. .then((bytesResult) => bytesResult.fold(
  344. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  345. (errBytes) => right(UserError.fromBuffer(errBytes)),
  346. ));
  347. }
  348. }
  349. class UserEventSignOut {
  350. UserEventSignOut();
  351. Future<Either<Unit, UserError>> send() {
  352. final request = FFIRequest.create()
  353. ..event = UserEvent.SignOut.toString();
  354. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  355. (bytes) => left(unit),
  356. (errBytes) => right(UserError.fromBuffer(errBytes)),
  357. ));
  358. }
  359. }
  360. class UserEventUpdateUser {
  361. UpdateUserRequest request;
  362. UserEventUpdateUser(this.request);
  363. Future<Either<Unit, UserError>> send() {
  364. final request = FFIRequest.create()
  365. ..event = UserEvent.UpdateUser.toString()
  366. ..payload = requestToBytes(this.request);
  367. return Dispatch.asyncRequest(request)
  368. .then((bytesResult) => bytesResult.fold(
  369. (bytes) => left(unit),
  370. (errBytes) => right(UserError.fromBuffer(errBytes)),
  371. ));
  372. }
  373. }
  374. class UserEventGetUserProfile {
  375. UserEventGetUserProfile();
  376. Future<Either<UserProfile, UserError>> send() {
  377. final request = FFIRequest.create()
  378. ..event = UserEvent.GetUserProfile.toString();
  379. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  380. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  381. (errBytes) => right(UserError.fromBuffer(errBytes)),
  382. ));
  383. }
  384. }
  385. class UserEventCheckUser {
  386. UserEventCheckUser();
  387. Future<Either<UserProfile, UserError>> send() {
  388. final request = FFIRequest.create()
  389. ..event = UserEvent.CheckUser.toString();
  390. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  391. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  392. (errBytes) => right(UserError.fromBuffer(errBytes)),
  393. ));
  394. }
  395. }