updateAgentRoomGrant method
Future<void>
updateAgentRoomGrant({
- required String projectId,
- required String agentId,
- required String roomId,
- AgentRoomGrant? permissions,
Implementation
Future<void> updateAgentRoomGrant({
required String projectId,
required String agentId,
required String roomId,
AgentRoomGrant? permissions,
}) async {
final encodedProjectId = Uri.encodeComponent(projectId);
final encodedAgentId = Uri.encodeComponent(agentId);
final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/agent-room-grants/$encodedAgentId');
final body = {'agent_id': agentId, 'room_id': roomId, 'permissions': (permissions ?? AgentRoomGrant()).toJson()};
final response = await httpClient.put(uri, body: jsonEncode(body));
if (response.statusCode >= 400) {
throw MeshagentException(
'Failed to update agent room grant. '
'Status code: ${response.statusCode}, body: ${response.body}',
);
}
}