nut.proto 19 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783
  1. syntax = "proto3";
  2. option java_multiple_files = true;
  3. option java_package = "com.github.saturn_xiv.palm.plugins.nut.v1";
  4. package palm.nut.v1;
  5. import "google/protobuf/empty.proto";
  6. import "google/protobuf/timestamp.proto";
  7. import "google/protobuf/duration.proto";
  8. message IdRequest {
  9. int32 id = 1;
  10. }
  11. message Pager {
  12. int64 page = 1;
  13. int64 size = 2;
  14. }
  15. message Pagination {
  16. int64 page = 1;
  17. int64 size = 2;
  18. int64 total = 3;
  19. bool has_next = 11;
  20. bool has_previous = 12;
  21. }
  22. message MediaContent {
  23. enum Editor {
  24. TEXTAREA = 0;
  25. QUILL = 1;
  26. }
  27. enum Status {
  28. Published = 0;
  29. Draft = 1;
  30. Pending = 2;
  31. Private = 3;
  32. Future = 4;
  33. Trash = 99;
  34. }
  35. Editor editor = 1;
  36. string body = 2;
  37. Status status = 3;
  38. optional google.protobuf.Timestamp published_at = 11;
  39. }
  40. message UserDetail {
  41. int32 id = 1;
  42. string uid = 2;
  43. string nickname = 3;
  44. string real_name = 4;
  45. string email = 5;
  46. }
  47. message Resource {
  48. string type = 1;
  49. optional int32 id = 2;
  50. }
  51. message Permission {
  52. oneof subject {
  53. int32 user = 1;
  54. int32 role = 2;
  55. }
  56. string operation = 11;
  57. Resource resource = 12;
  58. }
  59. // ----------------------------------------------------------------------------
  60. service User {
  61. rpc SignIn(UserSignInRequest) returns (UserSignInResponse) {}
  62. rpc SignUp(UserSignUpRequest) returns (google.protobuf.Empty) {}
  63. rpc ConfirmByEmail(UserQueryRequest) returns (google.protobuf.Empty) {}
  64. rpc ConfirmByToken(UserTokenRequest) returns (google.protobuf.Empty) {}
  65. rpc UnlockByEmail(UserQueryRequest) returns (google.protobuf.Empty) {}
  66. rpc UnlockByToken(UserTokenRequest) returns (google.protobuf.Empty) {}
  67. rpc ForgotPassword(UserQueryRequest) returns (google.protobuf.Empty) {}
  68. rpc ResetPassword(UserResetPasswordRequest) returns (google.protobuf.Empty) {}
  69. rpc Refresh(google.protobuf.Duration) returns (UserSignInResponse) {}
  70. rpc Logs(Pager) returns (UserLogsResponse) {}
  71. rpc SetProfile(UserSetProfileRequest) returns (google.protobuf.Empty) {}
  72. rpc ChangePassword(UserChangePasswordRequest)
  73. returns (google.protobuf.Empty) {}
  74. rpc SignOut(google.protobuf.Empty) returns (google.protobuf.Empty) {}
  75. rpc Index(Pager) returns (UserIndexResponse) {}
  76. rpc Show(IdRequest) returns (UserIndexResponse.Item) {}
  77. rpc Disable(IdRequest) returns (google.protobuf.Empty) {}
  78. rpc Enable(IdRequest) returns (google.protobuf.Empty) {}
  79. rpc Lock(IdRequest) returns (google.protobuf.Empty) {}
  80. rpc Unlock(IdRequest) returns (google.protobuf.Empty) {}
  81. rpc Confirm(IdRequest) returns (google.protobuf.Empty) {}
  82. rpc SetPassword(UserSetPasswordRequest) returns (google.protobuf.Empty) {}
  83. }
  84. message UserSignInRequest {
  85. UserQueryRequest query = 1;
  86. string password = 2;
  87. google.protobuf.Duration ttl = 11;
  88. }
  89. message UserQueryRequest {
  90. oneof user {
  91. string nickname = 1;
  92. string email = 2;
  93. }
  94. string home = 9;
  95. }
  96. message UserSignInResponse {
  97. message Payload {
  98. string nickname = 1;
  99. string email = 2;
  100. string real_name = 11;
  101. string lang = 12;
  102. string time_zone = 13;
  103. string avatar = 99;
  104. }
  105. string token = 1;
  106. Payload payload = 2;
  107. repeated string roles = 11;
  108. repeated Permission permissions = 12;
  109. }
  110. message UserSignUpRequest {
  111. string real_name = 1;
  112. string nickname = 2;
  113. string email = 3;
  114. string password = 4;
  115. string lang = 11;
  116. string time_zone = 12;
  117. string home = 21;
  118. }
  119. message UserTokenRequest {
  120. string payload = 1;
  121. }
  122. message UserResetPasswordRequest {
  123. string token = 1;
  124. string password = 2;
  125. }
  126. message UserSetPasswordRequest {
  127. int32 id = 1;
  128. string password = 2;
  129. }
  130. message UserSetProfileRequest {
  131. string real_name = 1;
  132. string avatar = 2;
  133. string time_zone = 8;
  134. string lang = 9;
  135. string wechat = 11;
  136. string phone = 12;
  137. }
  138. message UserGetProfileResponse {
  139. string real_name = 1;
  140. string avatar = 2;
  141. string nickname = 3;
  142. string email = 4;
  143. string time_zone = 8;
  144. string lang = 9;
  145. string wechat = 11;
  146. string phone = 12;
  147. }
  148. message UserLogsResponse {
  149. message Item {
  150. enum Level {
  151. DEBUG = 0;
  152. INFO = 1;
  153. WARNING = 2;
  154. ERROR = 3;
  155. PANIC = 4;
  156. }
  157. int32 id = 1;
  158. int32 user_id = 2;
  159. string ip = 3;
  160. Level level = 4;
  161. string message = 5;
  162. Resource resource = 6;
  163. google.protobuf.Timestamp created_at = 11;
  164. }
  165. Pagination pagination = 1;
  166. repeated Item items = 11;
  167. }
  168. message UserChangePasswordRequest {
  169. string current_password = 1;
  170. string new_password = 2;
  171. }
  172. message UserProvider {
  173. enum Type {
  174. EMAIL = 0;
  175. GMAIL = 1;
  176. WECHAT = 2;
  177. FACEBOOK = 3;
  178. GITHUB = 4;
  179. }
  180. Type type = 1;
  181. string id = 2;
  182. }
  183. message UserIndexResponse {
  184. message Item {
  185. int32 id = 1;
  186. string uid = 2;
  187. string email = 3;
  188. string nickname = 4;
  189. string real_name = 5;
  190. UserProvider.Type provider_type = 6;
  191. google.protobuf.Timestamp updated_at = 9;
  192. optional google.protobuf.Timestamp last_sign_in_at = 11;
  193. optional string last_sign_in_ip = 12;
  194. optional google.protobuf.Timestamp current_sign_in_at = 13;
  195. optional string current_sign_in_ip = 14;
  196. int32 sign_in_count = 19;
  197. string lang = 21;
  198. string time_zone = 22;
  199. string avatar = 23;
  200. optional google.protobuf.Timestamp confirmed_at = 27;
  201. optional google.protobuf.Timestamp locked_at = 28;
  202. optional google.protobuf.Timestamp deleted_at = 29;
  203. }
  204. Pagination pagination = 1;
  205. repeated Item items = 11;
  206. }
  207. // ----------------------------------------------------------------------------
  208. service Attachment {
  209. rpc Index(Pager) returns (AttachmentIndexResponse) {}
  210. rpc Destroy(IdRequest) returns (google.protobuf.Empty) {}
  211. rpc Show(AttachmentShowRequest) returns (AttachmentShowResponse) {}
  212. }
  213. message AttachmentShowRequest {
  214. int32 id = 1;
  215. google.protobuf.Duration ttl = 2;
  216. }
  217. message AttachmentShowResponse {
  218. AttachmentIndexResponse.Item item = 1;
  219. string url = 2;
  220. }
  221. message AttachmentIndexResponse {
  222. message Item {
  223. int32 id = 1;
  224. string bucket = 2;
  225. string name = 3;
  226. string title = 4;
  227. int64 size = 5;
  228. string content_type = 6;
  229. MediaContent.Status status = 7;
  230. google.protobuf.Timestamp updated_at = 11;
  231. }
  232. Pagination pagination = 1;
  233. repeated Item items = 11;
  234. }
  235. // ----------------------------------------------------------------------------
  236. service Policy {
  237. rpc AddRole(PolicyAddRoleRequest) returns (google.protobuf.Empty) {}
  238. rpc GetAllRoles(google.protobuf.Empty) returns (PolicyRoleListResponse) {}
  239. rpc DeleteRole(IdRequest) returns (google.protobuf.Empty) {}
  240. rpc GetRolesForUser(IdRequest) returns (PolicyRolesForUserResponse) {}
  241. rpc GetUsersForRole(IdRequest) returns (PolicyUsersForRoleResponse) {}
  242. rpc AddRolesForUser(PolicyAddRolesForUserRequest)
  243. returns (google.protobuf.Empty) {}
  244. rpc DeleteRolesForUser(PolicyDeleteRolesForUserRequest)
  245. returns (google.protobuf.Empty) {}
  246. rpc GetImplicitRolesForUser(IdRequest)
  247. returns (PolicyImplicitRolesForUserResponse) {}
  248. rpc GetImplicitUsersForRole(IdRequest)
  249. returns (PolicyImplicitUsersForRoleResponse) {}
  250. rpc GetPermissionsForUser(IdRequest) returns (PolicyPermissionList) {}
  251. rpc GetPermissionsForRole(IdRequest) returns (PolicyPermissionList) {}
  252. rpc GetImplicitPermissionsForUser(IdRequest) returns (PolicyPermissionList) {}
  253. rpc GetImplicitPermissionsForRole(IdRequest) returns (PolicyPermissionList) {}
  254. rpc AddPermissions(PolicyPermissionList) returns (google.protobuf.Empty) {}
  255. rpc DeletePermissions(PolicyPermissionList) returns (google.protobuf.Empty) {}
  256. }
  257. message PolicyAddRoleRequest {
  258. string code = 1;
  259. oneof nested {
  260. int32 left = 2;
  261. int32 parent = 3;
  262. }
  263. }
  264. message PolicyUsersForRoleResponse {
  265. message Item {
  266. UserDetail user = 1;
  267. google.protobuf.Timestamp not_before = 11;
  268. google.protobuf.Timestamp expired_at = 12;
  269. }
  270. repeated Item items = 1;
  271. }
  272. message PolicyImplicitUsersForRoleResponse {
  273. repeated UserDetail items = 1;
  274. }
  275. message PolicyRolesForUserResponse {
  276. message Item {
  277. int32 id = 1;
  278. string code = 2;
  279. google.protobuf.Timestamp not_before = 11;
  280. google.protobuf.Timestamp expired_at = 12;
  281. }
  282. repeated Item items = 1;
  283. }
  284. message PolicyImplicitRolesForUserResponse {
  285. repeated string items = 1;
  286. }
  287. message PolicyRoleListResponse {
  288. message Item {
  289. int32 id = 1;
  290. string code = 2;
  291. int32 left = 3;
  292. int32 right = 4;
  293. google.protobuf.Timestamp updated_at = 9;
  294. }
  295. repeated Item items = 1;
  296. }
  297. message PolicyAddRolesForUserRequest {
  298. int32 user = 1;
  299. repeated int32 roles = 2;
  300. google.protobuf.Timestamp not_before = 11;
  301. google.protobuf.Timestamp expired_at = 12;
  302. }
  303. message PolicyDeleteRolesForUserRequest {
  304. int32 user = 1;
  305. repeated int32 roles = 2;
  306. }
  307. message PolicyPermissionList {
  308. repeated Permission items = 1;
  309. }
  310. // ----------------------------------------------------------------------------
  311. service Locale {
  312. rpc Set(LocaleSetRequest) returns (google.protobuf.Empty) {}
  313. rpc Get(LocaleGetRequest) returns (LocaleIndexResponse.Item) {}
  314. rpc ByLang(LocaleByLangRequest) returns (LocaleByLangResponse) {}
  315. rpc Index(Pager) returns (LocaleIndexResponse) {}
  316. rpc Destroy(IdRequest) returns (google.protobuf.Empty) {}
  317. }
  318. message LocaleByLangRequest {
  319. string lang = 1;
  320. }
  321. message LocaleByLangResponse {
  322. repeated LocaleIndexResponse.Item items = 1;
  323. }
  324. message LocaleIndexResponse {
  325. message Item {
  326. int32 id = 1;
  327. string lang = 2;
  328. string code = 3;
  329. string message = 4;
  330. google.protobuf.Timestamp updated_at = 9;
  331. }
  332. repeated Item items = 1;
  333. Pagination pagination = 9;
  334. }
  335. message LocaleGetRequest {
  336. string lang = 1;
  337. string code = 2;
  338. }
  339. message LocaleSetRequest {
  340. string lang = 1;
  341. string code = 2;
  342. string message = 3;
  343. }
  344. // ----------------------------------------------------------------------------
  345. service Notification {
  346. rpc Index(Pager) returns (IndexNotificationResponse) {}
  347. }
  348. message IndexNotificationResponse {
  349. message Item {
  350. oneof message {
  351. EmailTask email = 1;
  352. SmsTask sms = 2;
  353. }
  354. google.protobuf.Timestamp created_at = 19;
  355. }
  356. repeated Item items = 1;
  357. Pagination pagination = 9;
  358. }
  359. // ----------------------------------------------------------------------------
  360. service LeaveWord {
  361. rpc Create(MediaContent) returns (google.protobuf.Empty) {}
  362. rpc Index(Pager) returns (LeaveWordIndexResponse) {}
  363. rpc Destroy(IdRequest) returns (google.protobuf.Empty) {}
  364. }
  365. message LeaveWordIndexResponse {
  366. message Item {
  367. int32 id = 1;
  368. string lang = 2;
  369. string ip = 3;
  370. MediaContent content = 8;
  371. google.protobuf.Timestamp updated_at = 11;
  372. google.protobuf.Timestamp created_at = 12;
  373. }
  374. repeated Item items = 1;
  375. Pagination pagination = 9;
  376. }
  377. // ----------------------------------------------------------------------------
  378. service Site {
  379. rpc SetMaintenanceMode(SiteMaintenanceModeRequest)
  380. returns (google.protobuf.Empty) {}
  381. rpc Install(SiteInstallRequest) returns (google.protobuf.Empty) {}
  382. rpc ClearCache(google.protobuf.Empty) returns (google.protobuf.Empty) {}
  383. rpc Layout(google.protobuf.Empty) returns (SiteLayoutResponse) {}
  384. rpc SetAuthor(SiteLayoutResponse.Author) returns (google.protobuf.Empty) {}
  385. rpc SetCopyright(SiteSetCopyrightRequest) returns (google.protobuf.Empty) {}
  386. rpc SetKeywords(SiteSetKeywordsRequest) returns (google.protobuf.Empty) {}
  387. rpc SetInfo(SiteSetInfoRequest) returns (google.protobuf.Empty) {}
  388. rpc SetLogo(SiteSetLogoRequest) returns (google.protobuf.Empty) {}
  389. rpc SetMinio(MinioProfile) returns (google.protobuf.Empty) {}
  390. rpc GetMinio(google.protobuf.Empty) returns (MinioProfile) {}
  391. rpc TestMinio(MinioProfile) returns (SiteMinioTestResponse) {}
  392. rpc SetTwilio(TwilioProfile) returns (google.protobuf.Empty) {}
  393. rpc GetTwilio(google.protobuf.Empty) returns (TwilioProfile) {}
  394. rpc TestTwilio(SiteTwilioTestRequest) returns (google.protobuf.Empty) {}
  395. rpc SetSmtp(SmtpProfile) returns (google.protobuf.Empty) {}
  396. rpc GetSmtp(google.protobuf.Empty) returns (SmtpProfile) {}
  397. rpc TestSmtp(SiteSmtpTestRequest) returns (google.protobuf.Empty) {}
  398. rpc SetBing(BingProfile) returns (google.protobuf.Empty) {}
  399. rpc GetBing(google.protobuf.Empty) returns (BingProfile) {}
  400. rpc SetIndexNow(IndexNowProfile) returns (google.protobuf.Empty) {}
  401. rpc GetIndexNow(google.protobuf.Empty) returns (IndexNowProfile) {}
  402. rpc PingIndexNow(IndexNowPingRequest) returns (google.protobuf.Empty) {}
  403. rpc SetGoogle(GoogleProfile) returns (google.protobuf.Empty) {}
  404. rpc GetGoogle(google.protobuf.Empty) returns (GoogleProfile) {}
  405. rpc PingGoogle(SitemapPingRequest) returns (google.protobuf.Empty) {}
  406. rpc SetBaidu(BaiduProfile) returns (google.protobuf.Empty) {}
  407. rpc GetBaidu(google.protobuf.Empty) returns (BaiduProfile) {}
  408. rpc PingBaidu(SitemapPingRequest) returns (google.protobuf.Empty) {}
  409. rpc Status(google.protobuf.Empty) returns (SiteStatusResponse) {}
  410. }
  411. message IndexNowProfile {
  412. string key = 1;
  413. }
  414. message IndexNowPingRequest {
  415. string key = 1;
  416. string home = 9;
  417. }
  418. message SitemapPingRequest {
  419. string home = 1;
  420. }
  421. message SiteMaintenanceModeRequest {
  422. message Item {
  423. google.protobuf.Duration duration = 1;
  424. string reason = 2;
  425. }
  426. optional Item item = 1;
  427. }
  428. message SiteInstallRequest {
  429. UserSignUpRequest user = 1;
  430. }
  431. message MinioProfile {
  432. optional string region = 1;
  433. string host = 2;
  434. int32 port = 3;
  435. bool https = 4;
  436. string access_key = 8;
  437. string secret_key = 9;
  438. }
  439. message SiteMinioTestResponse {
  440. repeated string buckets = 1;
  441. }
  442. message TwilioProfile {
  443. string from = 1;
  444. string account_sid = 2;
  445. string auth_token = 3;
  446. optional string sms_status_callback = 9;
  447. }
  448. message SmtpProfile {
  449. // https://github.com/karastojko/mailio/blob/master/include/mailio/smtp.hpp#L229
  450. enum AuthMethod {
  451. None = 0;
  452. Login = 1;
  453. StartTls = 2;
  454. }
  455. string host = 1;
  456. uint32 port = 2;
  457. AuthMethod auth_method = 3;
  458. repeated EmailTask.Address cc = 8;
  459. repeated EmailTask.Address bcc = 9;
  460. EmailTask.Address user = 11;
  461. string password = 12;
  462. }
  463. message EmailTask {
  464. message Address {
  465. string name = 1;
  466. string email = 2;
  467. }
  468. enum ContentType {
  469. Plain = 0;
  470. Html = 1;
  471. }
  472. message Attachment {
  473. string name = 1;
  474. string content_type = 2;
  475. bytes payload = 3;
  476. }
  477. string subject = 1;
  478. string content = 2;
  479. ContentType content_type = 3;
  480. Address to = 11;
  481. repeated Address cc = 12;
  482. repeated Address bcc = 13;
  483. repeated Attachment attachments = 21;
  484. }
  485. message SiteTwilioTestRequest {
  486. string to = 1;
  487. string message = 2;
  488. TwilioProfile profile = 9;
  489. }
  490. message SiteSmtpTestRequest {
  491. EmailTask.Address to = 1;
  492. string subject = 2;
  493. string content = 3;
  494. SmtpProfile profile = 9;
  495. }
  496. message SiteSetLogoRequest {
  497. string url = 1;
  498. }
  499. message SiteSetCopyrightRequest {
  500. string payload = 1;
  501. }
  502. message SiteSetKeywordsRequest {
  503. repeated string items = 1;
  504. }
  505. message SiteSetInfoRequest {
  506. string lang = 1;
  507. string title = 11;
  508. string subhead = 12;
  509. string description = 13;
  510. }
  511. message SiteLayoutResponse {
  512. message Author {
  513. string name = 1;
  514. string email = 2;
  515. }
  516. string title = 1;
  517. string subhead = 2;
  518. repeated string keywords = 3;
  519. string description = 4;
  520. Author author = 5;
  521. string copyright = 6;
  522. string logo = 7;
  523. repeated string languages = 9;
  524. }
  525. message GoogleProfile {
  526. // https://developers.google.com/recaptcha/intro
  527. message ReCaptcha {
  528. string site_key = 1;
  529. string secret = 2;
  530. }
  531. optional string site_verify_id = 1;
  532. optional ReCaptcha re_captcha = 2;
  533. }
  534. message BaiduProfile {
  535. message SiteVerify {
  536. string id = 1;
  537. string content = 2;
  538. }
  539. optional SiteVerify site_verify = 1;
  540. }
  541. message BingProfile {
  542. optional string site_verify_id = 1;
  543. }
  544. message SmsTask {
  545. string from = 1;
  546. repeated string to = 2;
  547. string body = 3;
  548. }
  549. message SiteStatusResponse {
  550. message Database {
  551. string name = 1;
  552. string size = 2;
  553. }
  554. message PostgreSql {
  555. string version = 1;
  556. google.protobuf.Timestamp now = 2;
  557. repeated Database databases = 9;
  558. }
  559. message MySql {
  560. uint64 size = 1;
  561. string version = 2;
  562. }
  563. message Redis {
  564. message Item {
  565. string key = 1;
  566. int64 ttl = 2;
  567. };
  568. string info = 1;
  569. repeated Item items = 2;
  570. }
  571. message RabbitMq {
  572. string protocol = 1;
  573. }
  574. message OpenSearch {
  575. string url = 1;
  576. string info = 2;
  577. }
  578. message Health {
  579. string name = 1;
  580. string status = 2;
  581. }
  582. message System {
  583. string version = 1;
  584. string cpu = 2;
  585. string memory = 3;
  586. string boot = 4;
  587. string disk = 5;
  588. string load = 6;
  589. string fs = 7;
  590. string swap = 8;
  591. string uptime = 9;
  592. string network = 10;
  593. }
  594. PostgreSql postgresql = 1;
  595. MySql mysql = 2;
  596. Redis redis = 3;
  597. RabbitMq rabbitmq = 4;
  598. OpenSearch opensearch = 5;
  599. System system = 11;
  600. repeated Health healthes = 21;
  601. }
  602. // ----------------------------------------------------------------------------
  603. service ShorterLink {
  604. rpc Create(ShorterLinkCreateRequest) returns (google.protobuf.Empty) {}
  605. rpc Update(ShorterLinkUpdateRequest) returns (google.protobuf.Empty) {}
  606. rpc Destroy(IdRequest) returns (google.protobuf.Empty) {}
  607. rpc Index(Pager) returns (ShorterLinkIndexResponse) {}
  608. }
  609. message ShorterLinkIndexResponse {
  610. message Item {
  611. int32 id = 1;
  612. string url = 2;
  613. string details = 3;
  614. string code = 9;
  615. google.protobuf.Timestamp updated_at = 11;
  616. }
  617. Pagination pagination = 1;
  618. repeated Item items = 11;
  619. }
  620. message ShorterLinkCreateRequest {
  621. string url = 1;
  622. string details = 2;
  623. }
  624. message ShorterLinkUpdateRequest {
  625. int32 id = 1;
  626. string url = 2;
  627. string details = 3;
  628. }
  629. // ----------------------------------------------------------------------------
  630. service Tag {
  631. rpc Create(TagCreateRequest) returns (google.protobuf.Empty) {}
  632. rpc Update(TagUpdateRequest) returns (google.protobuf.Empty) {}
  633. rpc Destroy(IdRequest) returns (google.protobuf.Empty) {}
  634. rpc Index(google.protobuf.Empty) returns (TagIndexResponse) {}
  635. }
  636. message TagIndexResponse {
  637. message Item {
  638. int32 id = 1;
  639. string code = 2;
  640. int32 priority = 3;
  641. google.protobuf.Timestamp updated_at = 11;
  642. }
  643. repeated Item items = 1;
  644. }
  645. message TagCreateRequest {
  646. string code = 1;
  647. int32 priority = 11;
  648. }
  649. message TagUpdateRequest {
  650. int32 id = 1;
  651. string code = 2;
  652. int32 priority = 11;
  653. }
  654. // ----------------------------------------------------------------------------
  655. service Category {
  656. rpc Create(CategoryCreateRequest) returns (google.protobuf.Empty) {}
  657. rpc Update(CategoryUpdateRequest) returns (google.protobuf.Empty) {}
  658. rpc Destroy(IdRequest) returns (google.protobuf.Empty) {}
  659. rpc Index(google.protobuf.Empty) returns (CategoryIndexResponse) {}
  660. }
  661. message CategoryIndexResponse {
  662. message Item {
  663. int32 id = 1;
  664. string code = 2;
  665. int32 left = 3;
  666. int32 right = 4;
  667. google.protobuf.Timestamp updated_at = 11;
  668. }
  669. repeated Item items = 1;
  670. }
  671. message CategoryCreateRequest {
  672. string code = 1;
  673. oneof by {
  674. int32 left = 2;
  675. int32 parent = 3;
  676. }
  677. }
  678. message CategoryUpdateRequest {
  679. int32 id = 1;
  680. string code = 2;
  681. }
  682. // ----------------------------------------------------------------------------