room_layout.proto 12 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339
  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 management-authorized channel room metadata.
  31. message GetRoomRequest {
  32. // Required channel room ID.
  33. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  34. }
  35. // Channel room metadata and the caller's management capabilities.
  36. message GetRoomResponse {
  37. // Requested channel room. This read does not require ordinary directory
  38. // visibility when the caller can configure the room's role permissions.
  39. chatto.api.v1.Room room = 1;
  40. // Whether the caller can update the room's general settings.
  41. bool viewer_can_manage_room = 2;
  42. // Whether the caller can configure role permissions for the room.
  43. bool viewer_can_manage_permissions = 3;
  44. }
  45. // Request for management-authorized room group metadata.
  46. message GetRoomGroupRequest {
  47. // Required room group ID.
  48. string group_id = 1 [(buf.validate.field).string.min_len = 1];
  49. }
  50. // Room group metadata and the caller's management capabilities.
  51. message GetRoomGroupResponse {
  52. // Requested room group metadata. Ordered room and link entries are omitted so
  53. // role permission managers do not gain visibility into private room names.
  54. AdminRoomLayoutGroup group = 1;
  55. // Whether the caller can update the room group's general settings.
  56. bool viewer_can_manage_group = 2;
  57. // Whether the caller can configure role permissions for the room group.
  58. bool viewer_can_manage_permissions = 3;
  59. }
  60. // Request for the server-admin room group layout.
  61. message ListRoomGroupsRequest {}
  62. // Server-admin room group layout response.
  63. message ListRoomGroupsResponse {
  64. // Ordered room groups, including archived rooms the caller can manage.
  65. repeated AdminRoomLayoutGroup groups = 1;
  66. }
  67. // Sidebar item kind used in reorder requests.
  68. enum AdminRoomLayoutItemKind {
  69. // The item kind was not specified.
  70. ADMIN_ROOM_LAYOUT_ITEM_KIND_UNSPECIFIED = 0;
  71. // Channel room entry.
  72. ADMIN_ROOM_LAYOUT_ITEM_KIND_ROOM = 1;
  73. // Sidebar link entry.
  74. ADMIN_ROOM_LAYOUT_ITEM_KIND_SIDEBAR_LINK = 2;
  75. }
  76. // One item reference in a sidebar order replacement.
  77. message AdminRoomLayoutItemInput {
  78. // Item kind.
  79. AdminRoomLayoutItemKind kind = 1 [(buf.validate.field).enum = {
  80. defined_only: true
  81. not_in: [0]
  82. }];
  83. // Room ID when kind is ROOM, sidebar link ID when kind is SIDEBAR_LINK.
  84. string id = 2 [(buf.validate.field).string.min_len = 1];
  85. }
  86. // Request to create a room group.
  87. message CreateRoomGroupRequest {
  88. // Required group display name.
  89. string name = 1 [(buf.validate.field).string = {
  90. min_len: 1
  91. max_len: 80
  92. }];
  93. // Optional public group description.
  94. string description = 2 [(buf.validate.field).string.max_len = 500];
  95. }
  96. // Result of creating a room group.
  97. message CreateRoomGroupResponse {
  98. // Created room group.
  99. AdminRoomLayoutGroup group = 1;
  100. }
  101. // Request to update a room group.
  102. message UpdateRoomGroupRequest {
  103. // Required room group ID.
  104. string group_id = 1 [(buf.validate.field).string.min_len = 1];
  105. // New group display name, when changing it.
  106. optional string name = 2 [(buf.validate.field).string = {
  107. min_len: 1
  108. max_len: 80
  109. }];
  110. // New public group description, when changing it. Empty clears the
  111. // description.
  112. optional string description = 3 [(buf.validate.field).string.max_len = 500];
  113. }
  114. // Result of updating a room group.
  115. message UpdateRoomGroupResponse {
  116. // Updated room group.
  117. AdminRoomLayoutGroup group = 1;
  118. }
  119. // Request to delete an empty room group.
  120. message DeleteRoomGroupRequest {
  121. // Required room group ID.
  122. string group_id = 1 [(buf.validate.field).string.min_len = 1];
  123. }
  124. // Result of deleting a room group.
  125. message DeleteRoomGroupResponse {
  126. // True when the room group was deleted.
  127. bool deleted = 1;
  128. }
  129. // Request to replace the global room group order.
  130. message ReorderRoomGroupsRequest {
  131. // Ordered room group IDs. The list must include every existing group exactly
  132. // once.
  133. repeated string ordered_group_ids = 1 [(buf.validate.field).repeated = {
  134. min_items: 1
  135. max_items: 1000
  136. items: {
  137. string: {min_len: 1}
  138. }
  139. }];
  140. }
  141. // Result of replacing the global room group order.
  142. message ReorderRoomGroupsResponse {
  143. // Room groups in their new order.
  144. repeated AdminRoomLayoutGroup groups = 1;
  145. }
  146. // Request to place one room group immediately before another group. When
  147. // before_group_id is absent, the group moves to the end of the sidebar.
  148. message MoveRoomGroupRequest {
  149. // Required room group to move.
  150. string group_id = 1 [(buf.validate.field).string.min_len = 1];
  151. // Group that follows the moved group. Omit to place the group last.
  152. optional string before_group_id = 2 [(buf.validate.field).string.min_len = 1];
  153. }
  154. // Result of moving one room group.
  155. message MoveRoomGroupResponse {
  156. // Room groups in their authoritative order after the move.
  157. repeated AdminRoomLayoutGroup groups = 1;
  158. }
  159. // Request to move a channel room to another room group.
  160. message MoveRoomToGroupRequest {
  161. // Required channel room ID.
  162. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  163. // Required destination room group ID.
  164. string group_id = 2 [(buf.validate.field).string.min_len = 1];
  165. }
  166. // Result of moving a channel room.
  167. message MoveRoomToGroupResponse {
  168. // Moved room after the operation.
  169. chatto.api.v1.Room room = 1;
  170. }
  171. // Request to replace the mixed sidebar item order in one group.
  172. message ReorderSidebarItemsInGroupRequest {
  173. // Required room group ID.
  174. string group_id = 1 [(buf.validate.field).string.min_len = 1];
  175. // Ordered room/sidebar-link item references.
  176. repeated AdminRoomLayoutItemInput items = 2 [(buf.validate.field).repeated = {max_items: 1000}];
  177. }
  178. // Result of replacing the mixed sidebar item order.
  179. message ReorderSidebarItemsInGroupResponse {
  180. // Updated room group.
  181. AdminRoomLayoutGroup group = 1;
  182. }
  183. // Request to move one room or sidebar link to an exact sidebar position.
  184. // The server resolves the complete current layout, including entries that the
  185. // caller's ordinary room directory does not show.
  186. message MoveSidebarItemRequest {
  187. // Required room or sidebar link to move.
  188. AdminRoomLayoutItemInput item = 1 [(buf.validate.field).required = true];
  189. // Required destination room group.
  190. string group_id = 2 [(buf.validate.field).string.min_len = 1];
  191. // Item that follows the moved item. Omit to place the item last.
  192. AdminRoomLayoutItemInput before = 3;
  193. }
  194. // Result of moving one sidebar item.
  195. message MoveSidebarItemResponse {
  196. // Destination room group after the move.
  197. AdminRoomLayoutGroup group = 1;
  198. }
  199. // Request to create a sidebar link in one room group.
  200. message CreateSidebarLinkRequest {
  201. // Required destination room group ID.
  202. string group_id = 1 [(buf.validate.field).string.min_len = 1];
  203. // Required display label.
  204. string label = 2 [(buf.validate.field).string = {
  205. min_len: 1
  206. max_len: 80
  207. }];
  208. // Required absolute http(s) URL or server-local path.
  209. string url = 3 [(buf.validate.field).string = {
  210. min_len: 1
  211. max_len: 2048
  212. }];
  213. }
  214. // Result of creating a sidebar link.
  215. message CreateSidebarLinkResponse {
  216. // Created sidebar link.
  217. chatto.api.v1.SidebarLink sidebar_link = 1;
  218. }
  219. // Request to update a sidebar link.
  220. message UpdateSidebarLinkRequest {
  221. // Required sidebar link ID.
  222. string link_id = 1 [(buf.validate.field).string.min_len = 1];
  223. // New display label, when changing it.
  224. optional string label = 2 [(buf.validate.field).string = {
  225. min_len: 1
  226. max_len: 80
  227. }];
  228. // New absolute http(s) URL or server-local path, when changing it.
  229. optional string url = 3 [(buf.validate.field).string = {
  230. min_len: 1
  231. max_len: 2048
  232. }];
  233. }
  234. // Result of updating a sidebar link.
  235. message UpdateSidebarLinkResponse {
  236. // Updated sidebar link.
  237. chatto.api.v1.SidebarLink sidebar_link = 1;
  238. }
  239. // Request to delete a sidebar link.
  240. message DeleteSidebarLinkRequest {
  241. // Required sidebar link ID.
  242. string link_id = 1 [(buf.validate.field).string.min_len = 1];
  243. }
  244. // Result of deleting a sidebar link.
  245. message DeleteSidebarLinkResponse {
  246. // True when the sidebar link was deleted.
  247. bool deleted = 1;
  248. }
  249. // Request to move a sidebar link to another room group.
  250. message MoveSidebarLinkToGroupRequest {
  251. // Required sidebar link ID.
  252. string link_id = 1 [(buf.validate.field).string.min_len = 1];
  253. // Required destination room group ID.
  254. string group_id = 2 [(buf.validate.field).string.min_len = 1];
  255. }
  256. // Result of moving a sidebar link.
  257. message MoveSidebarLinkToGroupResponse {
  258. // Moved sidebar link.
  259. chatto.api.v1.SidebarLink sidebar_link = 1;
  260. }
  261. // Reads and mutates the server-admin room layout.
  262. service AdminRoomLayoutService {
  263. // Gets management-authorized channel room metadata. Requires role.manage or
  264. // effective room.manage for the room.
  265. rpc GetRoom(GetRoomRequest) returns (GetRoomResponse);
  266. // Gets management-authorized room group metadata. Requires role.manage or
  267. // effective room.manage for the group.
  268. rpc GetRoomGroup(GetRoomGroupRequest) returns (GetRoomGroupResponse);
  269. // Lists the editable room group layout. Requires server-scope room.manage
  270. // and includes archived rooms for administrative actions such as unarchiving.
  271. rpc ListRoomGroups(ListRoomGroupsRequest) returns (ListRoomGroupsResponse);
  272. // Creates a room group. Requires server-scope room.manage.
  273. rpc CreateRoomGroup(CreateRoomGroupRequest) returns (CreateRoomGroupResponse);
  274. // Updates a room group's metadata. Requires effective room.manage for the group.
  275. rpc UpdateRoomGroup(UpdateRoomGroupRequest) returns (UpdateRoomGroupResponse);
  276. // Deletes an empty room group. Requires effective room.manage for the group.
  277. rpc DeleteRoomGroup(DeleteRoomGroupRequest) returns (DeleteRoomGroupResponse);
  278. // Replaces the global room group order. Requires server-scope room.manage.
  279. rpc ReorderRoomGroups(ReorderRoomGroupsRequest) returns (ReorderRoomGroupsResponse);
  280. // Moves one room group before another group, or to the end. Requires
  281. // server-scope room.manage.
  282. rpc MoveRoomGroup(MoveRoomGroupRequest) returns (MoveRoomGroupResponse);
  283. // Moves a channel room to another room group. Requires room.manage in both
  284. // source and destination groups.
  285. rpc MoveRoomToGroup(MoveRoomToGroupRequest) returns (MoveRoomToGroupResponse);
  286. // Replaces the mixed room/link sidebar order in one group. Requires
  287. // room.manage in that group.
  288. rpc ReorderSidebarItemsInGroup(ReorderSidebarItemsInGroupRequest) returns (ReorderSidebarItemsInGroupResponse);
  289. // Moves one room or sidebar link to a position in a room group. Requires
  290. // room.manage in the source and destination groups.
  291. rpc MoveSidebarItem(MoveSidebarItemRequest) returns (MoveSidebarItemResponse);
  292. // Creates a sidebar link. Requires room.manage in the destination group.
  293. rpc CreateSidebarLink(CreateSidebarLinkRequest) returns (CreateSidebarLinkResponse);
  294. // Updates a sidebar link. Requires room.manage in the link's current group.
  295. rpc UpdateSidebarLink(UpdateSidebarLinkRequest) returns (UpdateSidebarLinkResponse);
  296. // Deletes a sidebar link. Requires room.manage in the link's current group.
  297. rpc DeleteSidebarLink(DeleteSidebarLinkRequest) returns (DeleteSidebarLinkResponse);
  298. // Moves a sidebar link to another group. Requires room.manage in both source
  299. // and destination groups.
  300. rpc MoveSidebarLinkToGroup(MoveSidebarLinkToGroupRequest) returns (MoveSidebarLinkToGroupResponse);
  301. }