Skip to content

Commit

Permalink
Update test code
Browse files Browse the repository at this point in the history
  • Loading branch information
ilovelinux committed Sep 11, 2023
1 parent cd82e9f commit 600ed79
Showing 1 changed file with 14 additions and 1 deletion.
15 changes: 14 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand Down

0 comments on commit 600ed79

Please sign in to comment.