From 600ed79ad708ed40412bfd84f45b932b50d62db8 Mon Sep 17 00:00:00 2001 From: ilovelinux Date: Mon, 11 Sep 2023 22:48:49 +0200 Subject: [PATCH] Update test code --- README.md | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 4edc81c..7a25b3e 100644 --- a/README.md +++ b/README.md @@ -21,13 +21,14 @@ For refresh token, see [ASK Smapi SDK Documentation](https://github.com/alexa/al ## Edxample ```typescript +// test.ts import { RefreshTokenConfig, createClient, AggregationPeriod, Metrics, - Stat, MetricsV2RequestOptions, + ListMetricsV2RequestOptions, } from "ask-metrics-v2"; // Skill ID to fetch metrics for @@ -45,6 +46,18 @@ void main() { // Setup client const client = createClient(refreshTokenConfig); + // Create request options + const requestListOptions: ListMetricsV2RequestOptions = { + metricNamespace: Metrics.Custom.namespace, + }; + + // Get list metrics + const listMetrics = await client.getListMetricsV2(requestListOptions); + + // Print list metrics + console.log('List Metrics:'); + console.log(JSON.stringify(listMetrics, null, 2)); + // Create request options const requestOptions: MetricsV2RequestOptions = { startTime: Date.now()-1000*60*60*24*30, // 30 days before