ani-client 1.4.1 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +14 -2
- package/dist/index.d.mts +411 -358
- package/dist/index.d.ts +411 -358
- package/dist/index.js +118 -59
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +118 -59
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -6,6 +6,8 @@
|
|
|
6
6
|
|
|
7
7
|
> A simple, typed client to fetch anime, manga, character, staff and user data from [AniList](https://anilist.co).
|
|
8
8
|
|
|
9
|
+
✨ **Showcase**: [Check here](SHOWCASE.md) to see which projects use this package!
|
|
10
|
+
|
|
9
11
|
- **Zero dependencies** — uses the native `fetch` API
|
|
10
12
|
- **Universal** — Node.js ≥ 20, Bun, Deno and modern browsers
|
|
11
13
|
- **Dual format** — ships ESM + CJS with full TypeScript declarations
|
|
@@ -265,12 +267,21 @@ const result = await client.searchCharacters({ query: "Luffy", voiceActors: true
|
|
|
265
267
|
|
|
266
268
|
| Method | Description |
|
|
267
269
|
| --- | --- |
|
|
268
|
-
| `getStaff(id)` | Fetch a staff member by ID |
|
|
270
|
+
| `getStaff(id, include?)` | Fetch a staff member by ID (optionally with media) |
|
|
269
271
|
| `searchStaff(options?)` | Search for staff members |
|
|
270
272
|
|
|
271
273
|
```ts
|
|
272
274
|
const staff = await client.getStaff(95001);
|
|
273
275
|
const results = await client.searchStaff({ query: "Miyazaki" });
|
|
276
|
+
|
|
277
|
+
// With media the staff member worked on
|
|
278
|
+
const staffWithMedia = await client.getStaff(95001, { media: true });
|
|
279
|
+
staffWithMedia.staffMedia?.nodes.forEach((m) => {
|
|
280
|
+
console.log(m.title.romaji, m.format, m.averageScore);
|
|
281
|
+
});
|
|
282
|
+
|
|
283
|
+
// Customize the number of media returned
|
|
284
|
+
const staffWith5Media = await client.getStaff(95001, { media: { perPage: 5 } });
|
|
274
285
|
```
|
|
275
286
|
|
|
276
287
|
### Users
|
|
@@ -470,7 +481,7 @@ class MyCache implements CacheAdapter {
|
|
|
470
481
|
set<T>(key: string, data: T): void | Promise<void> { /* ... */ }
|
|
471
482
|
delete(key: string): boolean | Promise<boolean> { /* ... */ }
|
|
472
483
|
clear(): void | Promise<void> { /* ... */ }
|
|
473
|
-
get size(): number { return -1; } // return -1 if unknown
|
|
484
|
+
get size(): number | Promise<number> { return -1; } // return -1 if unknown
|
|
474
485
|
keys(): string[] | Promise<string[]> { /* ... */ }
|
|
475
486
|
// Optional — the client provides a fallback if omitted
|
|
476
487
|
invalidate?(pattern: string | RegExp): number | Promise<number> { /* ... */ }
|
|
@@ -566,6 +577,7 @@ import type {
|
|
|
566
577
|
MediaEdge, MediaConnection, MediaCharacterEdge, MediaCharacterConnection,
|
|
567
578
|
CharacterMediaEdge, CharacterIncludeOptions,
|
|
568
579
|
MediaStaffEdge, MediaStaffConnection, MediaIncludeOptions,
|
|
580
|
+
StaffMediaNode, StaffIncludeOptions,
|
|
569
581
|
StreamingEpisode, ExternalLink, MediaStats, MediaRecommendationNode,
|
|
570
582
|
PageInfo, PagedResult,
|
|
571
583
|
CacheAdapter, AniListHooks, AniListClientOptions,
|