room_layout.proto 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300
  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 move a channel room to another room group.
  147. message MoveRoomToGroupRequest {
  148. // Required channel room ID.
  149. string room_id = 1 [(buf.validate.field).string.min_len = 1];
  150. // Required destination room group ID.
  151. string group_id = 2 [(buf.validate.field).string.min_len = 1];
  152. }
  153. // Result of moving a channel room.
  154. message MoveRoomToGroupResponse {
  155. // Moved room after the operation.
  156. chatto.api.v1.Room room = 1;
  157. }
  158. // Request to replace the mixed sidebar item order in one group.
  159. message ReorderSidebarItemsInGroupRequest {
  160. // Required room group ID.
  161. string group_id = 1 [(buf.validate.field).string.min_len = 1];
  162. // Ordered room/sidebar-link item references.
  163. repeated AdminRoomLayoutItemInput items = 2 [(buf.validate.field).repeated = {max_items: 1000}];
  164. }
  165. // Result of replacing the mixed sidebar item order.
  166. message ReorderSidebarItemsInGroupResponse {
  167. // Updated room group.
  168. AdminRoomLayoutGroup group = 1;
  169. }
  170. // Request to create a sidebar link in one room group.
  171. message CreateSidebarLinkRequest {
  172. // Required destination room group ID.
  173. string group_id = 1 [(buf.validate.field).string.min_len = 1];
  174. // Required display label.
  175. string label = 2 [(buf.validate.field).string = {
  176. min_len: 1
  177. max_len: 80
  178. }];
  179. // Required absolute http(s) URL or server-local path.
  180. string url = 3 [(buf.validate.field).string = {
  181. min_len: 1
  182. max_len: 2048
  183. }];
  184. }
  185. // Result of creating a sidebar link.
  186. message CreateSidebarLinkResponse {
  187. // Created sidebar link.
  188. chatto.api.v1.SidebarLink sidebar_link = 1;
  189. }
  190. // Request to update a sidebar link.
  191. message UpdateSidebarLinkRequest {
  192. // Required sidebar link ID.
  193. string link_id = 1 [(buf.validate.field).string.min_len = 1];
  194. // New display label, when changing it.
  195. optional string label = 2 [(buf.validate.field).string = {
  196. min_len: 1
  197. max_len: 80
  198. }];
  199. // New absolute http(s) URL or server-local path, when changing it.
  200. optional string url = 3 [(buf.validate.field).string = {
  201. min_len: 1
  202. max_len: 2048
  203. }];
  204. }
  205. // Result of updating a sidebar link.
  206. message UpdateSidebarLinkResponse {
  207. // Updated sidebar link.
  208. chatto.api.v1.SidebarLink sidebar_link = 1;
  209. }
  210. // Request to delete a sidebar link.
  211. message DeleteSidebarLinkRequest {
  212. // Required sidebar link ID.
  213. string link_id = 1 [(buf.validate.field).string.min_len = 1];
  214. }
  215. // Result of deleting a sidebar link.
  216. message DeleteSidebarLinkResponse {
  217. // True when the sidebar link was deleted.
  218. bool deleted = 1;
  219. }
  220. // Request to move a sidebar link to another room group.
  221. message MoveSidebarLinkToGroupRequest {
  222. // Required sidebar link ID.
  223. string link_id = 1 [(buf.validate.field).string.min_len = 1];
  224. // Required destination room group ID.
  225. string group_id = 2 [(buf.validate.field).string.min_len = 1];
  226. }
  227. // Result of moving a sidebar link.
  228. message MoveSidebarLinkToGroupResponse {
  229. // Moved sidebar link.
  230. chatto.api.v1.SidebarLink sidebar_link = 1;
  231. }
  232. // Reads and mutates the server-admin room layout.
  233. service AdminRoomLayoutService {
  234. // Gets management-authorized channel room metadata. Requires role.manage or
  235. // effective room.manage for the room.
  236. rpc GetRoom(GetRoomRequest) returns (GetRoomResponse);
  237. // Gets management-authorized room group metadata. Requires role.manage or
  238. // effective room.manage for the group.
  239. rpc GetRoomGroup(GetRoomGroupRequest) returns (GetRoomGroupResponse);
  240. // Lists the editable room group layout. Requires server-scope room.manage
  241. // and includes archived rooms for administrative actions such as unarchiving.
  242. rpc ListRoomGroups(ListRoomGroupsRequest) returns (ListRoomGroupsResponse);
  243. // Creates a room group. Requires server-scope room.manage.
  244. rpc CreateRoomGroup(CreateRoomGroupRequest) returns (CreateRoomGroupResponse);
  245. // Updates a room group's metadata. Requires effective room.manage for the group.
  246. rpc UpdateRoomGroup(UpdateRoomGroupRequest) returns (UpdateRoomGroupResponse);
  247. // Deletes an empty room group. Requires effective room.manage for the group.
  248. rpc DeleteRoomGroup(DeleteRoomGroupRequest) returns (DeleteRoomGroupResponse);
  249. // Replaces the global room group order. Requires server-scope room.manage.
  250. rpc ReorderRoomGroups(ReorderRoomGroupsRequest) returns (ReorderRoomGroupsResponse);
  251. // Moves a channel room to another room group. Requires room.manage in both
  252. // source and destination groups.
  253. rpc MoveRoomToGroup(MoveRoomToGroupRequest) returns (MoveRoomToGroupResponse);
  254. // Replaces the mixed room/link sidebar order in one group. Requires
  255. // room.manage in that group.
  256. rpc ReorderSidebarItemsInGroup(ReorderSidebarItemsInGroupRequest) returns (ReorderSidebarItemsInGroupResponse);
  257. // Creates a sidebar link. Requires room.manage in the destination group.
  258. rpc CreateSidebarLink(CreateSidebarLinkRequest) returns (CreateSidebarLinkResponse);
  259. // Updates a sidebar link. Requires room.manage in the link's current group.
  260. rpc UpdateSidebarLink(UpdateSidebarLinkRequest) returns (UpdateSidebarLinkResponse);
  261. // Deletes a sidebar link. Requires room.manage in the link's current group.
  262. rpc DeleteSidebarLink(DeleteSidebarLinkRequest) returns (DeleteSidebarLinkResponse);
  263. // Moves a sidebar link to another group. Requires room.manage in both source
  264. // and destination groups.
  265. rpc MoveSidebarLinkToGroup(MoveSidebarLinkToGroupRequest) returns (MoveSidebarLinkToGroupResponse);
  266. }