listAnomalies method
Anomalies in the download counter (change stream)
Cost: 15 credits, flat. Every row is a model whose downloads-per-window has crossed a threshold: 2× jump = spike, 0.5× fall = drop. Sorted by absolute delta so biggest movers surface first. Consumers get "what is happening in the field right now" without re-implementing the ETL over download_history.
Parameters:
-
int windowDays: Baseline distance in days. Default 7, min 1, max 365.
-
int minBaseline: Only rows where baseline downloads >= this. Filters
0→10noise. Default 1000. -
String kind: Filter to one class. Omit for both.
-
int limit: Rows to return, 1 to 1000. Values outside the range are clamped, not rejected.
-
int offset: Rows to skip. Negative and non-numeric values are treated as 0.
Implementation
Future<ListAnomalies200Response?> listAnomalies({ int? windowDays, int? minBaseline, String? kind, int? limit, int? offset, Future<void>? abortTrigger, }) async {
final response = await listAnomaliesWithHttpInfo(windowDays: windowDays, minBaseline: minBaseline, kind: kind, limit: limit, offset: offset, abortTrigger: abortTrigger,);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
// When a remote server returns no body with a status of 204, we shall not decode it.
// At the time of writing this, `dart:convert` will throw an "Unexpected end of input"
// FormatException when trying to decode an empty string.
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(await _decodeBodyBytes(response), 'ListAnomalies200Response',) as ListAnomalies200Response;
}
return null;
}