code_gen.dart 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532
  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 WorkspaceEventCreateDefaultWorkspace {
  85. WorkspaceEventCreateDefaultWorkspace();
  86. Future<Either<WorkspaceIdentifier, WorkspaceError>> send() {
  87. final request = FFIRequest.create()
  88. ..event = WorkspaceEvent.CreateDefaultWorkspace.toString();
  89. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  90. (okBytes) => left(WorkspaceIdentifier.fromBuffer(okBytes)),
  91. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  92. ));
  93. }
  94. }
  95. class WorkspaceEventCreateApp {
  96. CreateAppRequest request;
  97. WorkspaceEventCreateApp(this.request);
  98. Future<Either<App, WorkspaceError>> send() {
  99. final request = FFIRequest.create()
  100. ..event = WorkspaceEvent.CreateApp.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 WorkspaceEventDeleteApp {
  110. QueryAppRequest request;
  111. WorkspaceEventDeleteApp(this.request);
  112. Future<Either<Unit, WorkspaceError>> send() {
  113. final request = FFIRequest.create()
  114. ..event = WorkspaceEvent.DeleteApp.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 WorkspaceEventReadApp {
  124. QueryAppRequest request;
  125. WorkspaceEventReadApp(this.request);
  126. Future<Either<App, WorkspaceError>> send() {
  127. final request = FFIRequest.create()
  128. ..event = WorkspaceEvent.ReadApp.toString()
  129. ..payload = requestToBytes(this.request);
  130. return Dispatch.asyncRequest(request)
  131. .then((bytesResult) => bytesResult.fold(
  132. (okBytes) => left(App.fromBuffer(okBytes)),
  133. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  134. ));
  135. }
  136. }
  137. class WorkspaceEventUpdateApp {
  138. UpdateAppRequest request;
  139. WorkspaceEventUpdateApp(this.request);
  140. Future<Either<Unit, WorkspaceError>> send() {
  141. final request = FFIRequest.create()
  142. ..event = WorkspaceEvent.UpdateApp.toString()
  143. ..payload = requestToBytes(this.request);
  144. return Dispatch.asyncRequest(request)
  145. .then((bytesResult) => bytesResult.fold(
  146. (bytes) => left(unit),
  147. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  148. ));
  149. }
  150. }
  151. class WorkspaceEventCreateView {
  152. CreateViewRequest request;
  153. WorkspaceEventCreateView(this.request);
  154. Future<Either<View, WorkspaceError>> send() {
  155. final request = FFIRequest.create()
  156. ..event = WorkspaceEvent.CreateView.toString()
  157. ..payload = requestToBytes(this.request);
  158. return Dispatch.asyncRequest(request)
  159. .then((bytesResult) => bytesResult.fold(
  160. (okBytes) => left(View.fromBuffer(okBytes)),
  161. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  162. ));
  163. }
  164. }
  165. class WorkspaceEventReadView {
  166. QueryViewRequest request;
  167. WorkspaceEventReadView(this.request);
  168. Future<Either<View, WorkspaceError>> send() {
  169. final request = FFIRequest.create()
  170. ..event = WorkspaceEvent.ReadView.toString()
  171. ..payload = requestToBytes(this.request);
  172. return Dispatch.asyncRequest(request)
  173. .then((bytesResult) => bytesResult.fold(
  174. (okBytes) => left(View.fromBuffer(okBytes)),
  175. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  176. ));
  177. }
  178. }
  179. class WorkspaceEventUpdateView {
  180. UpdateViewRequest request;
  181. WorkspaceEventUpdateView(this.request);
  182. Future<Either<View, WorkspaceError>> send() {
  183. final request = FFIRequest.create()
  184. ..event = WorkspaceEvent.UpdateView.toString()
  185. ..payload = requestToBytes(this.request);
  186. return Dispatch.asyncRequest(request)
  187. .then((bytesResult) => bytesResult.fold(
  188. (okBytes) => left(View.fromBuffer(okBytes)),
  189. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  190. ));
  191. }
  192. }
  193. class WorkspaceEventDeleteView {
  194. QueryViewRequest request;
  195. WorkspaceEventDeleteView(this.request);
  196. Future<Either<Unit, WorkspaceError>> send() {
  197. final request = FFIRequest.create()
  198. ..event = WorkspaceEvent.DeleteView.toString()
  199. ..payload = requestToBytes(this.request);
  200. return Dispatch.asyncRequest(request)
  201. .then((bytesResult) => bytesResult.fold(
  202. (bytes) => left(unit),
  203. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  204. ));
  205. }
  206. }
  207. class WorkspaceEventDuplicateView {
  208. QueryViewRequest request;
  209. WorkspaceEventDuplicateView(this.request);
  210. Future<Either<Unit, WorkspaceError>> send() {
  211. final request = FFIRequest.create()
  212. ..event = WorkspaceEvent.DuplicateView.toString()
  213. ..payload = requestToBytes(this.request);
  214. return Dispatch.asyncRequest(request)
  215. .then((bytesResult) => bytesResult.fold(
  216. (bytes) => left(unit),
  217. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  218. ));
  219. }
  220. }
  221. class WorkspaceEventCopyLink {
  222. WorkspaceEventCopyLink();
  223. Future<Either<Unit, WorkspaceError>> send() {
  224. final request = FFIRequest.create()
  225. ..event = WorkspaceEvent.CopyLink.toString();
  226. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  227. (bytes) => left(unit),
  228. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  229. ));
  230. }
  231. }
  232. class WorkspaceEventOpenView {
  233. QueryViewRequest request;
  234. WorkspaceEventOpenView(this.request);
  235. Future<Either<DocDelta, WorkspaceError>> send() {
  236. final request = FFIRequest.create()
  237. ..event = WorkspaceEvent.OpenView.toString()
  238. ..payload = requestToBytes(this.request);
  239. return Dispatch.asyncRequest(request)
  240. .then((bytesResult) => bytesResult.fold(
  241. (okBytes) => left(DocDelta.fromBuffer(okBytes)),
  242. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  243. ));
  244. }
  245. }
  246. class WorkspaceEventCloseView {
  247. QueryViewRequest request;
  248. WorkspaceEventCloseView(this.request);
  249. Future<Either<Unit, WorkspaceError>> send() {
  250. final request = FFIRequest.create()
  251. ..event = WorkspaceEvent.CloseView.toString()
  252. ..payload = requestToBytes(this.request);
  253. return Dispatch.asyncRequest(request)
  254. .then((bytesResult) => bytesResult.fold(
  255. (bytes) => left(unit),
  256. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  257. ));
  258. }
  259. }
  260. class WorkspaceEventReadTrash {
  261. WorkspaceEventReadTrash();
  262. Future<Either<RepeatedTrash, WorkspaceError>> send() {
  263. final request = FFIRequest.create()
  264. ..event = WorkspaceEvent.ReadTrash.toString();
  265. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  266. (okBytes) => left(RepeatedTrash.fromBuffer(okBytes)),
  267. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  268. ));
  269. }
  270. }
  271. class WorkspaceEventPutbackTrash {
  272. TrashIdentifier request;
  273. WorkspaceEventPutbackTrash(this.request);
  274. Future<Either<Unit, WorkspaceError>> send() {
  275. final request = FFIRequest.create()
  276. ..event = WorkspaceEvent.PutbackTrash.toString()
  277. ..payload = requestToBytes(this.request);
  278. return Dispatch.asyncRequest(request)
  279. .then((bytesResult) => bytesResult.fold(
  280. (bytes) => left(unit),
  281. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  282. ));
  283. }
  284. }
  285. class WorkspaceEventDeleteTrash {
  286. TrashIdentifiers request;
  287. WorkspaceEventDeleteTrash(this.request);
  288. Future<Either<Unit, WorkspaceError>> send() {
  289. final request = FFIRequest.create()
  290. ..event = WorkspaceEvent.DeleteTrash.toString()
  291. ..payload = requestToBytes(this.request);
  292. return Dispatch.asyncRequest(request)
  293. .then((bytesResult) => bytesResult.fold(
  294. (bytes) => left(unit),
  295. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  296. ));
  297. }
  298. }
  299. class WorkspaceEventRestoreAll {
  300. WorkspaceEventRestoreAll();
  301. Future<Either<Unit, WorkspaceError>> send() {
  302. final request = FFIRequest.create()
  303. ..event = WorkspaceEvent.RestoreAll.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 WorkspaceEventDeleteAll {
  311. WorkspaceEventDeleteAll();
  312. Future<Either<Unit, WorkspaceError>> send() {
  313. final request = FFIRequest.create()
  314. ..event = WorkspaceEvent.DeleteAll.toString();
  315. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  316. (bytes) => left(unit),
  317. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  318. ));
  319. }
  320. }
  321. class WorkspaceEventApplyDocDelta {
  322. DocDelta request;
  323. WorkspaceEventApplyDocDelta(this.request);
  324. Future<Either<DocDelta, WorkspaceError>> send() {
  325. final request = FFIRequest.create()
  326. ..event = WorkspaceEvent.ApplyDocDelta.toString()
  327. ..payload = requestToBytes(this.request);
  328. return Dispatch.asyncRequest(request)
  329. .then((bytesResult) => bytesResult.fold(
  330. (okBytes) => left(DocDelta.fromBuffer(okBytes)),
  331. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  332. ));
  333. }
  334. }
  335. class WorkspaceEventInitWorkspace {
  336. WorkspaceEventInitWorkspace();
  337. Future<Either<Unit, WorkspaceError>> send() {
  338. final request = FFIRequest.create()
  339. ..event = WorkspaceEvent.InitWorkspace.toString();
  340. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  341. (bytes) => left(unit),
  342. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  343. ));
  344. }
  345. }
  346. class UserEventInitUser {
  347. UserEventInitUser();
  348. Future<Either<Unit, UserError>> send() {
  349. final request = FFIRequest.create()
  350. ..event = UserEvent.InitUser.toString();
  351. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  352. (bytes) => left(unit),
  353. (errBytes) => right(UserError.fromBuffer(errBytes)),
  354. ));
  355. }
  356. }
  357. class UserEventSignIn {
  358. SignInRequest request;
  359. UserEventSignIn(this.request);
  360. Future<Either<UserProfile, UserError>> send() {
  361. final request = FFIRequest.create()
  362. ..event = UserEvent.SignIn.toString()
  363. ..payload = requestToBytes(this.request);
  364. return Dispatch.asyncRequest(request)
  365. .then((bytesResult) => bytesResult.fold(
  366. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  367. (errBytes) => right(UserError.fromBuffer(errBytes)),
  368. ));
  369. }
  370. }
  371. class UserEventSignUp {
  372. SignUpRequest request;
  373. UserEventSignUp(this.request);
  374. Future<Either<UserProfile, UserError>> send() {
  375. final request = FFIRequest.create()
  376. ..event = UserEvent.SignUp.toString()
  377. ..payload = requestToBytes(this.request);
  378. return Dispatch.asyncRequest(request)
  379. .then((bytesResult) => bytesResult.fold(
  380. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  381. (errBytes) => right(UserError.fromBuffer(errBytes)),
  382. ));
  383. }
  384. }
  385. class UserEventSignOut {
  386. UserEventSignOut();
  387. Future<Either<Unit, UserError>> send() {
  388. final request = FFIRequest.create()
  389. ..event = UserEvent.SignOut.toString();
  390. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  391. (bytes) => left(unit),
  392. (errBytes) => right(UserError.fromBuffer(errBytes)),
  393. ));
  394. }
  395. }
  396. class UserEventUpdateUser {
  397. UpdateUserRequest request;
  398. UserEventUpdateUser(this.request);
  399. Future<Either<Unit, UserError>> send() {
  400. final request = FFIRequest.create()
  401. ..event = UserEvent.UpdateUser.toString()
  402. ..payload = requestToBytes(this.request);
  403. return Dispatch.asyncRequest(request)
  404. .then((bytesResult) => bytesResult.fold(
  405. (bytes) => left(unit),
  406. (errBytes) => right(UserError.fromBuffer(errBytes)),
  407. ));
  408. }
  409. }
  410. class UserEventGetUserProfile {
  411. UserEventGetUserProfile();
  412. Future<Either<UserProfile, UserError>> send() {
  413. final request = FFIRequest.create()
  414. ..event = UserEvent.GetUserProfile.toString();
  415. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  416. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  417. (errBytes) => right(UserError.fromBuffer(errBytes)),
  418. ));
  419. }
  420. }
  421. class UserEventCheckUser {
  422. UserEventCheckUser();
  423. Future<Either<UserProfile, UserError>> send() {
  424. final request = FFIRequest.create()
  425. ..event = UserEvent.CheckUser.toString();
  426. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  427. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  428. (errBytes) => right(UserError.fromBuffer(errBytes)),
  429. ));
  430. }
  431. }