code_gen.dart 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380
  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<Doc, 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(Doc.fromBuffer(okBytes)),
  206. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  207. ));
  208. }
  209. }
  210. class WorkspaceEventApplyDocDelta {
  211. DocDelta request;
  212. WorkspaceEventApplyDocDelta(this.request);
  213. Future<Either<Doc, 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(Doc.fromBuffer(okBytes)),
  220. (errBytes) => right(WorkspaceError.fromBuffer(errBytes)),
  221. ));
  222. }
  223. }
  224. class UserEventInitUser {
  225. UserEventInitUser();
  226. Future<Either<Unit, UserError>> send() {
  227. final request = FFIRequest.create()
  228. ..event = UserEvent.InitUser.toString();
  229. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  230. (bytes) => left(unit),
  231. (errBytes) => right(UserError.fromBuffer(errBytes)),
  232. ));
  233. }
  234. }
  235. class UserEventSignIn {
  236. SignInRequest request;
  237. UserEventSignIn(this.request);
  238. Future<Either<UserProfile, UserError>> send() {
  239. final request = FFIRequest.create()
  240. ..event = UserEvent.SignIn.toString()
  241. ..payload = requestToBytes(this.request);
  242. return Dispatch.asyncRequest(request)
  243. .then((bytesResult) => bytesResult.fold(
  244. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  245. (errBytes) => right(UserError.fromBuffer(errBytes)),
  246. ));
  247. }
  248. }
  249. class UserEventSignUp {
  250. SignUpRequest request;
  251. UserEventSignUp(this.request);
  252. Future<Either<UserProfile, UserError>> send() {
  253. final request = FFIRequest.create()
  254. ..event = UserEvent.SignUp.toString()
  255. ..payload = requestToBytes(this.request);
  256. return Dispatch.asyncRequest(request)
  257. .then((bytesResult) => bytesResult.fold(
  258. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  259. (errBytes) => right(UserError.fromBuffer(errBytes)),
  260. ));
  261. }
  262. }
  263. class UserEventSignOut {
  264. UserEventSignOut();
  265. Future<Either<Unit, UserError>> send() {
  266. final request = FFIRequest.create()
  267. ..event = UserEvent.SignOut.toString();
  268. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  269. (bytes) => left(unit),
  270. (errBytes) => right(UserError.fromBuffer(errBytes)),
  271. ));
  272. }
  273. }
  274. class UserEventUpdateUser {
  275. UpdateUserRequest request;
  276. UserEventUpdateUser(this.request);
  277. Future<Either<Unit, UserError>> send() {
  278. final request = FFIRequest.create()
  279. ..event = UserEvent.UpdateUser.toString()
  280. ..payload = requestToBytes(this.request);
  281. return Dispatch.asyncRequest(request)
  282. .then((bytesResult) => bytesResult.fold(
  283. (bytes) => left(unit),
  284. (errBytes) => right(UserError.fromBuffer(errBytes)),
  285. ));
  286. }
  287. }
  288. class UserEventGetUserProfile {
  289. UserEventGetUserProfile();
  290. Future<Either<UserProfile, UserError>> send() {
  291. final request = FFIRequest.create()
  292. ..event = UserEvent.GetUserProfile.toString();
  293. return Dispatch.asyncRequest(request).then((bytesResult) => bytesResult.fold(
  294. (okBytes) => left(UserProfile.fromBuffer(okBytes)),
  295. (errBytes) => right(UserError.fromBuffer(errBytes)),
  296. ));
  297. }
  298. }
  299. class UserEventCheckUser {
  300. UserEventCheckUser();
  301. Future<Either<UserProfile, UserError>> send() {
  302. final request = FFIRequest.create()
  303. ..event = UserEvent.CheckUser.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. }