Skip to content

Commit d99b7a5

Browse files
committed
feat: examples
1 parent 71ccc0f commit d99b7a5

File tree

2 files changed

+25
-0
lines changed

2 files changed

+25
-0
lines changed

examples/basic.ts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
import { createValorantApiClient } from "@tqman/valorant-api-client";
2+
3+
const v = await createValorantApiClient({ initializer: "local" });
4+
const { data: help } = await v.local.request("/help")
5+
console.log(help);

examples/ranked-rating.ts

Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
import { createValorantApiClient } from "@tqman/valorant-api-client";
2+
import { z } from "zod/v4";
3+
4+
const v = await createValorantApiClient({ initializer: "local" });
5+
const { data: updates } = await v.remote.request("pd","/mmr/v1/players/:puuid/competitiveupdates",{
6+
schema: z.object({
7+
Version: z.number(),
8+
Subject: z.string(),
9+
Matches: z.array(
10+
z.object({
11+
MatchID: z.string(),
12+
RankedRatingEarned: z.number(),
13+
}),
14+
),
15+
}),
16+
})
17+
18+
const avg = updates.Matches.reduce((a, b) => a + b.RankedRatingEarned, 0) / updates.Matches.length;
19+
console.log(`Average RankedRatingEarned Per Match: ${avg}`);
20+

0 commit comments

Comments
 (0)