listScheduledTasksPage method
GET /accounts/projects/{project_id}/scheduled-tasks?room_id=&task_id=&active=&limit=&offset=
Returns { "tasks": ... }
Implementation
Future<ScheduledTasksPage> listScheduledTasksPage({
required String projectId,
String? roomId,
String? taskId,
bool? active,
int limit = 100,
int offset = 0,
String? filter,
}) async {
final qp = <String, String>{'limit': '$limit', 'offset': '$offset'};
if (roomId != null) qp['room_id'] = roomId;
if (taskId != null) qp['task_id'] = taskId;
if (active != null) qp['active'] = active ? 'true' : 'false';
if (filter != null && filter.trim().isNotEmpty) qp['filter'] = filter;
final encodedProjectId = Uri.encodeComponent(projectId);
final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/scheduled-tasks').replace(queryParameters: qp);
final resp = await httpClient.get(uri);
if (resp.statusCode >= 400) {
throw MeshagentException('Failed to list scheduled tasks. Status code: ${resp.statusCode}, body: ${resp.body}');
}
final decoded = jsonDecode(resp.body) as Map<String, dynamic>;
final tasksRaw = decoded['tasks'];
if (tasksRaw is! List) {
throw MeshagentException("Invalid scheduled-tasks payload: expected 'tasks' to be a list");
}
return ScheduledTasksPage.fromJson(decoded);
}