room_layout.proto 12 KB

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