getApplicationDateRangeKpi method

Future<GetApplicationDateRangeKpiResponse> getApplicationDateRangeKpi({
  1. required String applicationId,
  2. required String kpiName,
  3. DateTime? endTime,
  4. String? nextToken,
  5. String? pageSize,
  6. DateTime? startTime,
})

Retrieves (queries) pre-aggregated data for a standard metric that applies to an application.

May throw BadRequestException. May throw InternalServerErrorException. May throw PayloadTooLargeException. May throw ForbiddenException. May throw NotFoundException. May throw MethodNotAllowedException. May throw TooManyRequestsException.

Parameter applicationId : The unique identifier for the application. This identifier is displayed as the Project ID on the Amazon Pinpoint console.

Parameter kpiName : The name of the metric, also referred to as a key performance indicator (KPI), to retrieve data for. This value describes the associated metric and consists of two or more terms, which are comprised of lowercase alphanumeric characters, separated by a hyphen. Examples are email-open-rate and successful-delivery-rate. For a list of valid values, see the Amazon Pinpoint Developer Guide.

Parameter endTime : The last date and time to retrieve data for, as part of an inclusive date range that filters the query results. This value should be in extended ISO 8601 format and use Coordinated Universal Time (UTC), for example: 2019-07-26T20:00:00Z for 8:00 PM UTC July 26, 2019.

Parameter nextToken : The string that specifies which page of results to return in a paginated response. This parameter is not supported for application, campaign, and journey metrics.

Parameter pageSize : The maximum number of items to include in each page of a paginated response. This parameter is not supported for application, campaign, and journey metrics.

Parameter startTime : The first date and time to retrieve data for, as part of an inclusive date range that filters the query results. This value should be in extended ISO 8601 format and use Coordinated Universal Time (UTC), for example: 2019-07-19T20:00:00Z for 8:00 PM UTC July 19, 2019. This value should also be fewer than 90 days from the current day.

Implementation

Future<GetApplicationDateRangeKpiResponse> getApplicationDateRangeKpi({
  required String applicationId,
  required String kpiName,
  DateTime? endTime,
  String? nextToken,
  String? pageSize,
  DateTime? startTime,
}) async {
  ArgumentError.checkNotNull(applicationId, 'applicationId');
  ArgumentError.checkNotNull(kpiName, 'kpiName');
  final $query = <String, List<String>>{
    if (endTime != null) 'end-time': [_s.iso8601ToJson(endTime).toString()],
    if (nextToken != null) 'next-token': [nextToken],
    if (pageSize != null) 'page-size': [pageSize],
    if (startTime != null)
      'start-time': [_s.iso8601ToJson(startTime).toString()],
  };
  final response = await _protocol.sendRaw(
    payload: null,
    method: 'GET',
    requestUri:
        '/v1/apps/${Uri.encodeComponent(applicationId)}/kpis/daterange/${Uri.encodeComponent(kpiName)}',
    queryParams: $query,
    exceptionFnMap: _exceptionFns,
  );
  final $json = await _s.jsonFromResponse(response);
  return GetApplicationDateRangeKpiResponse(
    applicationDateRangeKpiResponse:
        ApplicationDateRangeKpiResponse.fromJson($json),
  );
}