code_gen.dart 16 KB

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