Client
WynnClient is the entry point. Methods are grouped by domain — player, guild, item, and so on. Prefer those over the low-level request() helper.
ts
import { WynnClient } from "@wynnjs/api";
const client = new WynnClient({
// baseUrl?: string
// auth?: WynnAuth
// http?: AxiosInstance
});Options
| Option | Type | Description |
|---|---|---|
baseUrl | string | Override API_BASE_URL (https://api.wynncraft.com/v3) |
auth | WynnAuth | Credentials for authenticated endpoints |
http | AxiosInstance | Custom Axios instance (useful for tests and mocks) |
Modules
| Module | Property | Docs |
|---|---|---|
| Player | client.player | API |
| Guild | client.guild | API |
| Item | client.item | API |
| Ability | client.ability | API |
| Classes | client.classes | API |
| Map | client.map | API |
| Leaderboards | client.leaderboards | API |
| News | client.news | API |
| Search | client.search | API |
| OAuth | client.oauth | API |
Calling conventions
- Path parameters come first, options second:
client.player.getPlayer(username, options?) - Presence-only Wynncraft flags (
fullResult,static, …) are booleans in options — see Responses - Path segments are URL-encoded for you
- Every method returns
Promise<WynnResponse<T>>
Low-level request()
For routes the modules do not cover yet:
ts
const { data, rateLimit } = await client.request<{ ok: boolean }>({
path: "/some/route",
method: "GET",
params: { page: 0 },
presenceParams: ["fullResult"],
});| Field | Description |
|---|---|
path | Path under the API base (leading / optional) |
method | HTTP method (default GET) |
params | Normal query params |
presenceParams | Query flags sent without values |
data | Request body |
headers | Extra headers |
Helpers
ts
client.getAuth(); // WynnAuth | undefined