room_layout.proto 8.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261
  1. syntax = "proto3";
  2. package chatto.admin.v1;
  3. import "buf/validate/validate.proto";
  4. import "chatto/api/v1/room_directory.proto";
  5. import "chatto/api/v1/rooms.proto";
  6. // One ordered sidebar item in an admin room group layout.
  7. message AdminRoomLayoutItem {
  8. oneof item {
  9. // Channel room entry.
  10. chatto.api.v1.Room room = 1;
  11. // Sidebar link entry.
  12. chatto.api.v1.SidebarLink sidebar_link = 2;
  13. }
  14. }
  15. // Ordered room group returned after admin layout mutations.
  16. message AdminRoomLayoutGroup {
  17. reserved 4;
  18. reserved "rooms";
  19. // Stable room group ID.
  20. string id = 1;
  21. // Display name.
  22. string name = 2;
  23. // Public group description, when set.
  24. string description = 3;
  25. // Mixed room/sidebar-link entries in sidebar order.
  26. repeated AdminRoomLayoutItem items = 5;
  27. // Whether the viewer can create rooms in this group.
  28. bool can_create_room = 6;
  29. }
  30. // Request for the server-admin room group layout.
  31. message ListRoomGroupsRequest {}
  32. // Server-admin room group layout response.
  33. message ListRoomGroupsResponse {
  34. // Ordered room groups, including archived rooms the caller can manage.
  35. repeated AdminRoomLayoutGroup groups = 1;
  36. }
  37. // Sidebar item kind used in reorder requests.
  38. enum AdminRoomLayoutItemKind {
  39. // The item kind was not specified.
  40. ADMIN_ROOM_LAYOUT_ITEM_KIND_UNSPECIFIED = 0;
  41. // Channel room entry.
  42. ADMIN_ROOM_LAYOUT_ITEM_KIND_ROOM = 1;
  43. // Sidebar link entry.
  44. ADMIN_ROOM_LAYOUT_ITEM_KIND_SIDEBAR_LINK = 2;
  45. }
  46. // One item reference in a sidebar order replacement.
  47. message AdminRoomLayoutItemInput {
  48. // Item kind.
  49. AdminRoomLayoutItemKind kind = 1 [(buf.validate.field).enum = {
  50. defined_only: true
  51. not_in: [0]
  52. }];
  53. // Room ID when kind is ROOM, sidebar link ID when kind is SIDEBAR_LINK.
  54. string id = 2 [(buf.validate.field).string.min_len = 1];
  55. }
  56. // Request to create a room group.
  57. message CreateRoomGroupRequest {
  58. // Required group display name.
  59. string name = 1 [(buf.validate.field).string = {
  60. min_len: 1
  61. max_len: 80
  62. }];
  63. // Optional public group description.
  64. string description = 2 [(buf.validate.field).string.max_len = 500];
  65. }
  66. // Result of creating a room group.
  67. message CreateRoomGroupResponse {
  68. // Created room group.
  69. AdminRoomLayoutGroup group = 1;
  70. }
  71. // Request to update a room group.
  72. message UpdateRoomGroupRequest {
  73. // Required room group ID.
  74. string group_id = 1 [(buf.validate.field).string.min_len = 1];
  75. // New group display name, when changing it.
  76. optional string name = 2 [(buf.validate.field).string = {
  77. min_len: 1
  78. max_len: 80
  79. }];
  80. // New public group description, when changing it. Empty clears the
  81. // description.
  82. optional string description = 3 [(buf.validate.field).string.max_len = 500];
  83. }
  84. // Result of updating a room group.
  85. message UpdateRoomGroupResponse {
  86. // Updated room group.
  87. AdminRoomLayoutGroup group = 1;
  88. }
  89. // Request to delete an empty room group.
  90. message DeleteRoomGroupRequest {
  91. // Required room group ID.
  92. string group_id = 1 [(buf.validate.field).string.min_len = 1];
  93. }
  94. // Result of deleting a room group.
  95. message DeleteRoomGroupResponse {
  96. // True when the room group was deleted.
  97. bool deleted = 1;
  98. }
  99. // Request to replace the global room group order.
  100. message ReorderRoomGroupsRequest {
  101. // Ordered room group IDs. The list must include every existing group exactly
  102. // once.
  103. repeated string ordered_group_ids = 1 [(buf.validate.field).repeated = {
  104. min_items: 1
  105. max_items: 1000
  106. items: {
  107. string: {min_len: 1}
  108. }
  109. }];
  110. }
  111. // Result of replacing the global room group order.
  112. message ReorderRoomGroupsResponse {
  113. // Room groups in their new order.
  114. repeated AdminRoomLayoutGroup groups = 1;
  115. }
  116. // Request to move a channel room to another room group.
  117. message MoveRoomToGroupRequest {
  118. // Required channel room ID.
  119. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  120. // Required destination room group ID.
  121. string group_id = 2 [(buf.validate.field).string.min_len = 1];
  122. }
  123. // Result of moving a channel room.
  124. message MoveRoomToGroupResponse {
  125. // Moved room after the operation.
  126. chatto.api.v1.Room room = 1;
  127. }
  128. // Request to replace the mixed sidebar item order in one group.
  129. message ReorderSidebarItemsInGroupRequest {
  130. // Required room group ID.
  131. string group_id = 1 [(buf.validate.field).string.min_len = 1];
  132. // Ordered room/sidebar-link item references.
  133. repeated AdminRoomLayoutItemInput items = 2 [(buf.validate.field).repeated = {max_items: 1000}];
  134. }
  135. // Result of replacing the mixed sidebar item order.
  136. message ReorderSidebarItemsInGroupResponse {
  137. // Updated room group.
  138. AdminRoomLayoutGroup group = 1;
  139. }
  140. // Request to create a sidebar link in one room group.
  141. message CreateSidebarLinkRequest {
  142. // Required destination room group ID.
  143. string group_id = 1 [(buf.validate.field).string.min_len = 1];
  144. // Required display label.
  145. string label = 2 [(buf.validate.field).string = {
  146. min_len: 1
  147. max_len: 80
  148. }];
  149. // Required absolute http(s) URL or server-local path.
  150. string url = 3 [(buf.validate.field).string = {
  151. min_len: 1
  152. max_len: 2048
  153. }];
  154. }
  155. // Result of creating a sidebar link.
  156. message CreateSidebarLinkResponse {
  157. // Created sidebar link.
  158. chatto.api.v1.SidebarLink sidebar_link = 1;
  159. }
  160. // Request to update a sidebar link.
  161. message UpdateSidebarLinkRequest {
  162. // Required sidebar link ID.
  163. string link_id = 1 [(buf.validate.field).string.min_len = 1];
  164. // New display label, when changing it.
  165. optional string label = 2 [(buf.validate.field).string = {
  166. min_len: 1
  167. max_len: 80
  168. }];
  169. // New absolute http(s) URL or server-local path, when changing it.
  170. optional string url = 3 [(buf.validate.field).string = {
  171. min_len: 1
  172. max_len: 2048
  173. }];
  174. }
  175. // Result of updating a sidebar link.
  176. message UpdateSidebarLinkResponse {
  177. // Updated sidebar link.
  178. chatto.api.v1.SidebarLink sidebar_link = 1;
  179. }
  180. // Request to delete a sidebar link.
  181. message DeleteSidebarLinkRequest {
  182. // Required sidebar link ID.
  183. string link_id = 1 [(buf.validate.field).string.min_len = 1];
  184. }
  185. // Result of deleting a sidebar link.
  186. message DeleteSidebarLinkResponse {
  187. // True when the sidebar link was deleted.
  188. bool deleted = 1;
  189. }
  190. // Request to move a sidebar link to another room group.
  191. message MoveSidebarLinkToGroupRequest {
  192. // Required sidebar link ID.
  193. string link_id = 1 [(buf.validate.field).string.min_len = 1];
  194. // Required destination room group ID.
  195. string group_id = 2 [(buf.validate.field).string.min_len = 1];
  196. }
  197. // Result of moving a sidebar link.
  198. message MoveSidebarLinkToGroupResponse {
  199. // Moved sidebar link.
  200. chatto.api.v1.SidebarLink sidebar_link = 1;
  201. }
  202. // Reads and mutates the server-admin room layout.
  203. service AdminRoomLayoutService {
  204. // Lists the editable room group layout. Requires role.manage and returns
  205. // visible room entries, including archived rooms for administrative actions
  206. // such as unarchiving.
  207. rpc ListRoomGroups(ListRoomGroupsRequest) returns (ListRoomGroupsResponse);
  208. // Creates a room group. Requires role.manage.
  209. rpc CreateRoomGroup(CreateRoomGroupRequest) returns (CreateRoomGroupResponse);
  210. // Updates a room group's metadata. Requires role.manage.
  211. rpc UpdateRoomGroup(UpdateRoomGroupRequest) returns (UpdateRoomGroupResponse);
  212. // Deletes an empty room group. Requires role.manage.
  213. rpc DeleteRoomGroup(DeleteRoomGroupRequest) returns (DeleteRoomGroupResponse);
  214. // Replaces the global room group order. Requires role.manage.
  215. rpc ReorderRoomGroups(ReorderRoomGroupsRequest) returns (ReorderRoomGroupsResponse);
  216. // Moves a channel room to another room group. Requires room.manage in both
  217. // source and destination groups.
  218. rpc MoveRoomToGroup(MoveRoomToGroupRequest) returns (MoveRoomToGroupResponse);
  219. // Replaces the mixed room/link sidebar order in one group. Requires
  220. // room.manage in that group.
  221. rpc ReorderSidebarItemsInGroup(ReorderSidebarItemsInGroupRequest) returns (ReorderSidebarItemsInGroupResponse);
  222. // Creates a sidebar link. Requires room.manage in the destination group.
  223. rpc CreateSidebarLink(CreateSidebarLinkRequest) returns (CreateSidebarLinkResponse);
  224. // Updates a sidebar link. Requires room.manage in the link's current group.
  225. rpc UpdateSidebarLink(UpdateSidebarLinkRequest) returns (UpdateSidebarLinkResponse);
  226. // Deletes a sidebar link. Requires room.manage in the link's current group.
  227. rpc DeleteSidebarLink(DeleteSidebarLinkRequest) returns (DeleteSidebarLinkResponse);
  228. // Moves a sidebar link to another group. Requires room.manage in both source
  229. // and destination groups.
  230. rpc MoveSidebarLinkToGroup(MoveSidebarLinkToGroupRequest) returns (MoveSidebarLinkToGroupResponse);
  231. }