listScheduledTaskRunsPage method
Implementation
Future<ScheduledTaskRunsPage> listScheduledTaskRunsPage({
required String projectId,
required String taskId,
int limit = 100,
int offset = 0,
}) async {
final qp = <String, String>{'limit': '$limit', 'offset': '$offset'};
final encodedProjectId = Uri.encodeComponent(projectId);
final encodedTaskId = Uri.encodeComponent(taskId);
final uri = Uri.parse('$baseUrl/accounts/projects/$encodedProjectId/scheduled-tasks/$encodedTaskId/runs').replace(queryParameters: qp);
final resp = await httpClient.get(uri);
if (resp.statusCode >= 400) {
throw MeshagentException('Failed to list scheduled task runs. Status code: ${resp.statusCode}, body: ${resp.body}');
}
final decoded = jsonDecode(resp.body) as Map<String, dynamic>;
final runsRaw = decoded['runs'];
if (runsRaw is! List) {
throw MeshagentException("Invalid scheduled-task-runs payload: expected 'runs' to be a list");
}
return ScheduledTaskRunsPage.fromJson(decoded);
}