94 lines
2.6 KiB
Dart

// @dart=2.18
// ignore_for_file: unused_element, unused_import
// ignore_for_file: always_put_required_named_parameters_first
// ignore_for_file: constant_identifier_names
// ignore_for_file: lines_longer_than_80_chars
part of openapi.api;
class StatsApi {
StatsApi([ApiClient? apiClient])
: apiClient = apiClient ?? defaultApiClient;
final ApiClient apiClient;
/// Track a single visit event (anonymous)
Future<Response> statsTrackEventWithHttpInfo(VisitEventDTO visitEventDTO) async {
const path = r'/api/Stats/event';
final queryParams = <QueryParam>[];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>['application/json'];
return apiClient.invokeAPI(
path,
'POST',
queryParams,
visitEventDTO,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
Future<void> statsTrackEvent(VisitEventDTO visitEventDTO) async {
final response = await statsTrackEventWithHttpInfo(visitEventDTO);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
}
/// Get aggregated statistics for an instance
Future<Response> statsGetSummaryWithHttpInfo(
String instanceId, {
DateTime? from,
DateTime? to,
String? appType,
}) async {
const path = r'/api/Stats/summary';
final queryParams = <QueryParam>[
QueryParam(r'instanceId', instanceId),
if (from != null) QueryParam(r'from', parameterToString(from)),
if (to != null) QueryParam(r'to', parameterToString(to)),
if (appType != null) QueryParam(r'appType', appType),
];
final headerParams = <String, String>{};
final formParams = <String, String>{};
const contentTypes = <String>[];
return apiClient.invokeAPI(
path,
'GET',
queryParams,
null,
headerParams,
formParams,
contentTypes.isEmpty ? null : contentTypes.first,
);
}
Future<StatsSummaryDTO?> statsGetSummary(
String instanceId, {
DateTime? from,
DateTime? to,
String? appType,
}) async {
final response = await statsGetSummaryWithHttpInfo(instanceId, from: from, to: to, appType: appType);
if (response.statusCode >= HttpStatus.badRequest) {
throw ApiException(response.statusCode, await _decodeBodyBytes(response));
}
if (response.body.isNotEmpty && response.statusCode != HttpStatus.noContent) {
return await apiClient.deserializeAsync(
await _decodeBodyBytes(response),
'StatsSummaryDTO',
) as StatsSummaryDTO;
}
return null;
}
}