ani-client 1.4.0 → 1.4.2
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 +39 -5
- package/dist/index.d.mts +106 -5
- package/dist/index.d.ts +106 -5
- package/dist/index.js +149 -12
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +149 -12
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -182,7 +182,7 @@ The second parameter of `getMedia()` lets you opt-in to additional data. By defa
|
|
|
182
182
|
|
|
183
183
|
| Option | Type | Default | Description |
|
|
184
184
|
| --- | --- | --- | --- |
|
|
185
|
-
| `characters` | `boolean \| { perPage?, sort? }` | — | Characters with their roles (MAIN, SUPPORTING, BACKGROUND) |
|
|
185
|
+
| `characters` | `boolean \| { perPage?, sort?, voiceActors? }` | — | Characters with their roles (MAIN, SUPPORTING, BACKGROUND). Set `voiceActors: true` to include VA data. |
|
|
186
186
|
| `staff` | `boolean \| { perPage?, sort? }` | — | Staff members with their roles |
|
|
187
187
|
| `relations` | `boolean` | `true` | Sequels, prequels, adaptations, etc. Set `false` to exclude |
|
|
188
188
|
| `streamingEpisodes` | `boolean` | — | Streaming links (Crunchyroll, Funimation, etc.) |
|
|
@@ -202,6 +202,17 @@ const anime = await client.getMedia(1, {
|
|
|
202
202
|
characters: { perPage: 50, sort: false },
|
|
203
203
|
});
|
|
204
204
|
|
|
205
|
+
// Include voice actors alongside characters
|
|
206
|
+
const anime = await client.getMedia(1, {
|
|
207
|
+
characters: { voiceActors: true },
|
|
208
|
+
});
|
|
209
|
+
anime.characters?.edges.forEach((e) => {
|
|
210
|
+
console.log(e.node.name.full);
|
|
211
|
+
e.voiceActors?.forEach((va) =>
|
|
212
|
+
console.log(` VA: ${va.name.full} (${va.languageV2})`)
|
|
213
|
+
);
|
|
214
|
+
});
|
|
215
|
+
|
|
205
216
|
// Staff members
|
|
206
217
|
const anime = await client.getMedia(1, { staff: true });
|
|
207
218
|
anime.staff?.edges.forEach((e) =>
|
|
@@ -230,24 +241,45 @@ const anime = await client.getMedia(1, {
|
|
|
230
241
|
|
|
231
242
|
| Method | Description |
|
|
232
243
|
| --- | --- |
|
|
233
|
-
| `getCharacter(id)` | Fetch a character by ID |
|
|
234
|
-
| `searchCharacters(options?)` | Search characters by name |
|
|
244
|
+
| `getCharacter(id, include?)` | Fetch a character by ID, optionally with voice actors |
|
|
245
|
+
| `searchCharacters(options?)` | Search characters by name, optionally with voice actors |
|
|
235
246
|
|
|
236
247
|
```ts
|
|
237
248
|
const spike = await client.getCharacter(1);
|
|
238
249
|
const results = await client.searchCharacters({ query: "Luffy", perPage: 5 });
|
|
250
|
+
|
|
251
|
+
// With voice actors
|
|
252
|
+
const spike = await client.getCharacter(1, { voiceActors: true });
|
|
253
|
+
spike.media?.edges?.forEach((e) => {
|
|
254
|
+
console.log(e.node.title.romaji);
|
|
255
|
+
e.voiceActors?.forEach((va) =>
|
|
256
|
+
console.log(` VA: ${va.name.full} (${va.languageV2})`)
|
|
257
|
+
);
|
|
258
|
+
});
|
|
259
|
+
|
|
260
|
+
// Search with voice actors
|
|
261
|
+
const result = await client.searchCharacters({ query: "Luffy", voiceActors: true });
|
|
239
262
|
```
|
|
240
263
|
|
|
241
264
|
### Staff
|
|
242
265
|
|
|
243
266
|
| Method | Description |
|
|
244
267
|
| --- | --- |
|
|
245
|
-
| `getStaff(id)` | Fetch a staff member by ID |
|
|
268
|
+
| `getStaff(id, include?)` | Fetch a staff member by ID (optionally with media) |
|
|
246
269
|
| `searchStaff(options?)` | Search for staff members |
|
|
247
270
|
|
|
248
271
|
```ts
|
|
249
272
|
const staff = await client.getStaff(95001);
|
|
250
273
|
const results = await client.searchStaff({ query: "Miyazaki" });
|
|
274
|
+
|
|
275
|
+
// With media the staff member worked on
|
|
276
|
+
const staffWithMedia = await client.getStaff(95001, { media: true });
|
|
277
|
+
staffWithMedia.staffMedia?.nodes.forEach((m) => {
|
|
278
|
+
console.log(m.title.romaji, m.format, m.averageScore);
|
|
279
|
+
});
|
|
280
|
+
|
|
281
|
+
// Customize the number of media returned
|
|
282
|
+
const staffWith5Media = await client.getStaff(95001, { media: { perPage: 5 } });
|
|
251
283
|
```
|
|
252
284
|
|
|
253
285
|
### Users
|
|
@@ -538,10 +570,12 @@ All types and enums are exported:
|
|
|
538
570
|
|
|
539
571
|
```ts
|
|
540
572
|
import type {
|
|
541
|
-
Media, Character, Staff, User,
|
|
573
|
+
Media, Character, Staff, User, VoiceActor,
|
|
542
574
|
AiringSchedule, MediaListEntry, Recommendation, StudioDetail,
|
|
543
575
|
MediaEdge, MediaConnection, MediaCharacterEdge, MediaCharacterConnection,
|
|
576
|
+
CharacterMediaEdge, CharacterIncludeOptions,
|
|
544
577
|
MediaStaffEdge, MediaStaffConnection, MediaIncludeOptions,
|
|
578
|
+
StaffMediaNode, StaffIncludeOptions,
|
|
545
579
|
StreamingEpisode, ExternalLink, MediaStats, MediaRecommendationNode,
|
|
546
580
|
PageInfo, PagedResult,
|
|
547
581
|
CacheAdapter, AniListHooks, AniListClientOptions,
|
package/dist/index.d.mts
CHANGED
|
@@ -159,9 +159,27 @@ interface CharacterImage {
|
|
|
159
159
|
large: string | null;
|
|
160
160
|
medium: string | null;
|
|
161
161
|
}
|
|
162
|
+
/** Compact voice actor data returned inside character edges. */
|
|
163
|
+
interface VoiceActor {
|
|
164
|
+
id: number;
|
|
165
|
+
name: {
|
|
166
|
+
first: string | null;
|
|
167
|
+
middle: string | null;
|
|
168
|
+
last: string | null;
|
|
169
|
+
full: string | null;
|
|
170
|
+
native: string | null;
|
|
171
|
+
userPreferred: string | null;
|
|
172
|
+
};
|
|
173
|
+
languageV2: string | null;
|
|
174
|
+
image: StaffImage;
|
|
175
|
+
gender: string | null;
|
|
176
|
+
primaryOccupations: string[];
|
|
177
|
+
siteUrl: string | null;
|
|
178
|
+
}
|
|
162
179
|
interface MediaCharacterEdge {
|
|
163
180
|
role: CharacterRole;
|
|
164
181
|
node: Omit<Character, "media">;
|
|
182
|
+
voiceActors?: VoiceActor[];
|
|
165
183
|
}
|
|
166
184
|
interface MediaCharacterConnection {
|
|
167
185
|
edges: MediaCharacterEdge[];
|
|
@@ -248,6 +266,11 @@ interface Media {
|
|
|
248
266
|
isAdult: boolean | null;
|
|
249
267
|
siteUrl: string | null;
|
|
250
268
|
}
|
|
269
|
+
type CharacterMediaNode = Pick<Media, "id" | "title" | "type" | "coverImage" | "siteUrl">;
|
|
270
|
+
interface CharacterMediaEdge {
|
|
271
|
+
node: CharacterMediaNode;
|
|
272
|
+
voiceActors?: VoiceActor[];
|
|
273
|
+
}
|
|
251
274
|
interface Character {
|
|
252
275
|
id: number;
|
|
253
276
|
name: CharacterName;
|
|
@@ -260,9 +283,15 @@ interface Character {
|
|
|
260
283
|
favourites: number | null;
|
|
261
284
|
siteUrl: string | null;
|
|
262
285
|
media: {
|
|
263
|
-
nodes
|
|
286
|
+
nodes?: CharacterMediaNode[];
|
|
287
|
+
edges?: CharacterMediaEdge[];
|
|
264
288
|
} | null;
|
|
265
289
|
}
|
|
290
|
+
/** Options for including extra data when fetching a character. */
|
|
291
|
+
interface CharacterIncludeOptions {
|
|
292
|
+
/** Include voice actors for each media the character appears in. */
|
|
293
|
+
voiceActors?: boolean;
|
|
294
|
+
}
|
|
266
295
|
interface StaffName {
|
|
267
296
|
first: string | null;
|
|
268
297
|
middle: string | null;
|
|
@@ -274,6 +303,43 @@ interface StaffImage {
|
|
|
274
303
|
large: string | null;
|
|
275
304
|
medium: string | null;
|
|
276
305
|
}
|
|
306
|
+
/** A media node returned inside `Staff.staffMedia`. */
|
|
307
|
+
interface StaffMediaNode {
|
|
308
|
+
id: number;
|
|
309
|
+
title: MediaTitle;
|
|
310
|
+
type: MediaType;
|
|
311
|
+
format: MediaFormat | null;
|
|
312
|
+
status: MediaStatus | null;
|
|
313
|
+
coverImage: MediaCoverImage;
|
|
314
|
+
bannerImage: string | null;
|
|
315
|
+
genres: string[];
|
|
316
|
+
averageScore: number | null;
|
|
317
|
+
meanScore: number | null;
|
|
318
|
+
popularity: number | null;
|
|
319
|
+
favourites: number | null;
|
|
320
|
+
episodes: number | null;
|
|
321
|
+
trending: number | null;
|
|
322
|
+
hashtag: string | null;
|
|
323
|
+
season: MediaSeason | null;
|
|
324
|
+
seasonYear: number | null;
|
|
325
|
+
startDate: FuzzyDate | null;
|
|
326
|
+
endDate: FuzzyDate | null;
|
|
327
|
+
nextAiringEpisode: {
|
|
328
|
+
id: number;
|
|
329
|
+
airingAt: number;
|
|
330
|
+
episode: number;
|
|
331
|
+
mediaId: number;
|
|
332
|
+
timeUntilAiring: number;
|
|
333
|
+
} | null;
|
|
334
|
+
studios: {
|
|
335
|
+
edges: {
|
|
336
|
+
node: {
|
|
337
|
+
name: string;
|
|
338
|
+
};
|
|
339
|
+
}[];
|
|
340
|
+
} | null;
|
|
341
|
+
siteUrl: string | null;
|
|
342
|
+
}
|
|
277
343
|
interface Staff {
|
|
278
344
|
id: number;
|
|
279
345
|
name: StaffName;
|
|
@@ -290,6 +356,19 @@ interface Staff {
|
|
|
290
356
|
bloodType: string | null;
|
|
291
357
|
favourites: number | null;
|
|
292
358
|
siteUrl: string | null;
|
|
359
|
+
/** Media the staff member has worked on — only present when requested via include options. */
|
|
360
|
+
staffMedia?: {
|
|
361
|
+
nodes: StaffMediaNode[];
|
|
362
|
+
} | null;
|
|
363
|
+
}
|
|
364
|
+
/** Options to include additional related data when fetching a staff member by ID. */
|
|
365
|
+
interface StaffIncludeOptions {
|
|
366
|
+
/** Include media the staff member has worked on.
|
|
367
|
+
* `true` = 25 results sorted by popularity. Object form to customize. */
|
|
368
|
+
media?: boolean | {
|
|
369
|
+
perPage?: number;
|
|
370
|
+
sort?: boolean;
|
|
371
|
+
};
|
|
293
372
|
}
|
|
294
373
|
interface UserAvatar {
|
|
295
374
|
large: string | null;
|
|
@@ -354,6 +433,8 @@ interface SearchCharacterOptions {
|
|
|
354
433
|
sort?: CharacterSort[];
|
|
355
434
|
page?: number;
|
|
356
435
|
perPage?: number;
|
|
436
|
+
/** Include voice actors for each media the character appears in. */
|
|
437
|
+
voiceActors?: boolean;
|
|
357
438
|
}
|
|
358
439
|
interface SearchStaffOptions {
|
|
359
440
|
query?: string;
|
|
@@ -523,6 +604,7 @@ interface MediaIncludeOptions {
|
|
|
523
604
|
characters?: boolean | {
|
|
524
605
|
perPage?: number;
|
|
525
606
|
sort?: boolean;
|
|
607
|
+
voiceActors?: boolean;
|
|
526
608
|
};
|
|
527
609
|
/** Include staff members with their roles.
|
|
528
610
|
* `true` = 25 results sorted by relevance. Object form to customize. */
|
|
@@ -676,6 +758,9 @@ declare class AniListClient {
|
|
|
676
758
|
* // Include characters sorted by role, 25 results
|
|
677
759
|
* const anime = await client.getMedia(1, { characters: true });
|
|
678
760
|
*
|
|
761
|
+
* // Include characters with voice actors
|
|
762
|
+
* const anime = await client.getMedia(1, { characters: { voiceActors: true } });
|
|
763
|
+
*
|
|
679
764
|
* // Full control
|
|
680
765
|
* const anime = await client.getMedia(1, {
|
|
681
766
|
* characters: { perPage: 50, sort: true },
|
|
@@ -720,24 +805,35 @@ declare class AniListClient {
|
|
|
720
805
|
* Fetch a character by AniList ID.
|
|
721
806
|
*
|
|
722
807
|
* @param id - The AniList character ID
|
|
808
|
+
* @param include - Optional include options (e.g. voice actors)
|
|
723
809
|
* @returns The character object
|
|
724
810
|
*
|
|
725
811
|
* @example
|
|
726
812
|
* ```ts
|
|
727
813
|
* const spike = await client.getCharacter(1);
|
|
728
814
|
* console.log(spike.name.full); // "Spike Spiegel"
|
|
815
|
+
*
|
|
816
|
+
* // With voice actors
|
|
817
|
+
* const spike = await client.getCharacter(1, { voiceActors: true });
|
|
818
|
+
* spike.media?.edges?.forEach((e) => {
|
|
819
|
+
* console.log(e.node.title.romaji);
|
|
820
|
+
* e.voiceActors?.forEach((va) => console.log(` VA: ${va.name.full}`));
|
|
821
|
+
* });
|
|
729
822
|
* ```
|
|
730
823
|
*/
|
|
731
|
-
getCharacter(id: number): Promise<Character>;
|
|
824
|
+
getCharacter(id: number, include?: CharacterIncludeOptions): Promise<Character>;
|
|
732
825
|
/**
|
|
733
826
|
* Search for characters by name.
|
|
734
827
|
*
|
|
735
|
-
* @param options - Search / pagination parameters
|
|
828
|
+
* @param options - Search / pagination parameters (includes optional `voiceActors`)
|
|
736
829
|
* @returns Paginated results with matching characters
|
|
737
830
|
*
|
|
738
831
|
* @example
|
|
739
832
|
* ```ts
|
|
740
833
|
* const result = await client.searchCharacters({ query: "Luffy", perPage: 5 });
|
|
834
|
+
*
|
|
835
|
+
* // With voice actors
|
|
836
|
+
* const result = await client.searchCharacters({ query: "Luffy", voiceActors: true });
|
|
741
837
|
* ```
|
|
742
838
|
*/
|
|
743
839
|
searchCharacters(options?: SearchCharacterOptions): Promise<PagedResult<Character>>;
|
|
@@ -745,15 +841,20 @@ declare class AniListClient {
|
|
|
745
841
|
* Fetch a staff member by AniList ID.
|
|
746
842
|
*
|
|
747
843
|
* @param id - The AniList staff ID
|
|
844
|
+
* @param include - Optional include options to fetch related data (e.g. media)
|
|
748
845
|
* @returns The staff object
|
|
749
846
|
*
|
|
750
847
|
* @example
|
|
751
848
|
* ```ts
|
|
752
849
|
* const staff = await client.getStaff(95001);
|
|
753
850
|
* console.log(staff.name.full);
|
|
851
|
+
*
|
|
852
|
+
* // With media the staff worked on
|
|
853
|
+
* const staff = await client.getStaff(95001, { media: true });
|
|
854
|
+
* staff.staffMedia?.nodes.forEach((m) => console.log(m.title.romaji));
|
|
754
855
|
* ```
|
|
755
856
|
*/
|
|
756
|
-
getStaff(id: number): Promise<Staff>;
|
|
857
|
+
getStaff(id: number, include?: StaffIncludeOptions): Promise<Staff>;
|
|
757
858
|
/**
|
|
758
859
|
* Search for staff (voice actors, directors, etc.).
|
|
759
860
|
*
|
|
@@ -1161,4 +1262,4 @@ declare class RateLimiter {
|
|
|
1161
1262
|
private sleep;
|
|
1162
1263
|
}
|
|
1163
1264
|
|
|
1164
|
-
export { type AiringSchedule, AiringSort, AniListClient, type AniListClientOptions, AniListError, type AniListHooks, type CacheAdapter, type CacheOptions, type Character, type CharacterImage, type CharacterName, CharacterRole, CharacterSort, type ExternalLink, type FuzzyDate, type GetAiringOptions, type GetPlanningOptions, type GetRecentChaptersOptions, type GetRecommendationsOptions, type GetSeasonOptions, type GetUserMediaListOptions, type Media, type MediaCharacterConnection, type MediaCharacterEdge, type MediaConnection, type MediaCoverImage, type MediaEdge, MediaFormat, type MediaIncludeOptions, type MediaListEntry, MediaListSort, MediaListStatus, type MediaRecommendationNode, MediaRelationType, MediaSeason, MediaSort, type MediaStaffConnection, type MediaStaffEdge, type MediaStats, MediaStatus, type MediaTag, type MediaTitle, type MediaTrailer, MediaType, MemoryCache, type PageInfo, type PagedResult, type RateLimitOptions, RateLimiter, type Recommendation, RecommendationSort, RedisCache, type RedisCacheOptions, type RedisLikeClient, type ScoreDistribution, type SearchCharacterOptions, type SearchMediaOptions, type SearchStaffOptions, type SearchStudioOptions, type Staff, type StaffImage, type StaffName, type StatusDistribution, type StreamingEpisode, type Studio, type StudioConnection, type StudioDetail, type User, type UserAvatar, type UserStatistics };
|
|
1265
|
+
export { type AiringSchedule, AiringSort, AniListClient, type AniListClientOptions, AniListError, type AniListHooks, type CacheAdapter, type CacheOptions, type Character, type CharacterImage, type CharacterIncludeOptions, type CharacterMediaEdge, type CharacterName, CharacterRole, CharacterSort, type ExternalLink, type FuzzyDate, type GetAiringOptions, type GetPlanningOptions, type GetRecentChaptersOptions, type GetRecommendationsOptions, type GetSeasonOptions, type GetUserMediaListOptions, type Media, type MediaCharacterConnection, type MediaCharacterEdge, type MediaConnection, type MediaCoverImage, type MediaEdge, MediaFormat, type MediaIncludeOptions, type MediaListEntry, MediaListSort, MediaListStatus, type MediaRecommendationNode, MediaRelationType, MediaSeason, MediaSort, type MediaStaffConnection, type MediaStaffEdge, type MediaStats, MediaStatus, type MediaTag, type MediaTitle, type MediaTrailer, MediaType, MemoryCache, type PageInfo, type PagedResult, type RateLimitOptions, RateLimiter, type Recommendation, RecommendationSort, RedisCache, type RedisCacheOptions, type RedisLikeClient, type ScoreDistribution, type SearchCharacterOptions, type SearchMediaOptions, type SearchStaffOptions, type SearchStudioOptions, type Staff, type StaffImage, type StaffIncludeOptions, type StaffMediaNode, type StaffName, type StatusDistribution, type StreamingEpisode, type Studio, type StudioConnection, type StudioDetail, type User, type UserAvatar, type UserStatistics, type VoiceActor };
|
package/dist/index.d.ts
CHANGED
|
@@ -159,9 +159,27 @@ interface CharacterImage {
|
|
|
159
159
|
large: string | null;
|
|
160
160
|
medium: string | null;
|
|
161
161
|
}
|
|
162
|
+
/** Compact voice actor data returned inside character edges. */
|
|
163
|
+
interface VoiceActor {
|
|
164
|
+
id: number;
|
|
165
|
+
name: {
|
|
166
|
+
first: string | null;
|
|
167
|
+
middle: string | null;
|
|
168
|
+
last: string | null;
|
|
169
|
+
full: string | null;
|
|
170
|
+
native: string | null;
|
|
171
|
+
userPreferred: string | null;
|
|
172
|
+
};
|
|
173
|
+
languageV2: string | null;
|
|
174
|
+
image: StaffImage;
|
|
175
|
+
gender: string | null;
|
|
176
|
+
primaryOccupations: string[];
|
|
177
|
+
siteUrl: string | null;
|
|
178
|
+
}
|
|
162
179
|
interface MediaCharacterEdge {
|
|
163
180
|
role: CharacterRole;
|
|
164
181
|
node: Omit<Character, "media">;
|
|
182
|
+
voiceActors?: VoiceActor[];
|
|
165
183
|
}
|
|
166
184
|
interface MediaCharacterConnection {
|
|
167
185
|
edges: MediaCharacterEdge[];
|
|
@@ -248,6 +266,11 @@ interface Media {
|
|
|
248
266
|
isAdult: boolean | null;
|
|
249
267
|
siteUrl: string | null;
|
|
250
268
|
}
|
|
269
|
+
type CharacterMediaNode = Pick<Media, "id" | "title" | "type" | "coverImage" | "siteUrl">;
|
|
270
|
+
interface CharacterMediaEdge {
|
|
271
|
+
node: CharacterMediaNode;
|
|
272
|
+
voiceActors?: VoiceActor[];
|
|
273
|
+
}
|
|
251
274
|
interface Character {
|
|
252
275
|
id: number;
|
|
253
276
|
name: CharacterName;
|
|
@@ -260,9 +283,15 @@ interface Character {
|
|
|
260
283
|
favourites: number | null;
|
|
261
284
|
siteUrl: string | null;
|
|
262
285
|
media: {
|
|
263
|
-
nodes
|
|
286
|
+
nodes?: CharacterMediaNode[];
|
|
287
|
+
edges?: CharacterMediaEdge[];
|
|
264
288
|
} | null;
|
|
265
289
|
}
|
|
290
|
+
/** Options for including extra data when fetching a character. */
|
|
291
|
+
interface CharacterIncludeOptions {
|
|
292
|
+
/** Include voice actors for each media the character appears in. */
|
|
293
|
+
voiceActors?: boolean;
|
|
294
|
+
}
|
|
266
295
|
interface StaffName {
|
|
267
296
|
first: string | null;
|
|
268
297
|
middle: string | null;
|
|
@@ -274,6 +303,43 @@ interface StaffImage {
|
|
|
274
303
|
large: string | null;
|
|
275
304
|
medium: string | null;
|
|
276
305
|
}
|
|
306
|
+
/** A media node returned inside `Staff.staffMedia`. */
|
|
307
|
+
interface StaffMediaNode {
|
|
308
|
+
id: number;
|
|
309
|
+
title: MediaTitle;
|
|
310
|
+
type: MediaType;
|
|
311
|
+
format: MediaFormat | null;
|
|
312
|
+
status: MediaStatus | null;
|
|
313
|
+
coverImage: MediaCoverImage;
|
|
314
|
+
bannerImage: string | null;
|
|
315
|
+
genres: string[];
|
|
316
|
+
averageScore: number | null;
|
|
317
|
+
meanScore: number | null;
|
|
318
|
+
popularity: number | null;
|
|
319
|
+
favourites: number | null;
|
|
320
|
+
episodes: number | null;
|
|
321
|
+
trending: number | null;
|
|
322
|
+
hashtag: string | null;
|
|
323
|
+
season: MediaSeason | null;
|
|
324
|
+
seasonYear: number | null;
|
|
325
|
+
startDate: FuzzyDate | null;
|
|
326
|
+
endDate: FuzzyDate | null;
|
|
327
|
+
nextAiringEpisode: {
|
|
328
|
+
id: number;
|
|
329
|
+
airingAt: number;
|
|
330
|
+
episode: number;
|
|
331
|
+
mediaId: number;
|
|
332
|
+
timeUntilAiring: number;
|
|
333
|
+
} | null;
|
|
334
|
+
studios: {
|
|
335
|
+
edges: {
|
|
336
|
+
node: {
|
|
337
|
+
name: string;
|
|
338
|
+
};
|
|
339
|
+
}[];
|
|
340
|
+
} | null;
|
|
341
|
+
siteUrl: string | null;
|
|
342
|
+
}
|
|
277
343
|
interface Staff {
|
|
278
344
|
id: number;
|
|
279
345
|
name: StaffName;
|
|
@@ -290,6 +356,19 @@ interface Staff {
|
|
|
290
356
|
bloodType: string | null;
|
|
291
357
|
favourites: number | null;
|
|
292
358
|
siteUrl: string | null;
|
|
359
|
+
/** Media the staff member has worked on — only present when requested via include options. */
|
|
360
|
+
staffMedia?: {
|
|
361
|
+
nodes: StaffMediaNode[];
|
|
362
|
+
} | null;
|
|
363
|
+
}
|
|
364
|
+
/** Options to include additional related data when fetching a staff member by ID. */
|
|
365
|
+
interface StaffIncludeOptions {
|
|
366
|
+
/** Include media the staff member has worked on.
|
|
367
|
+
* `true` = 25 results sorted by popularity. Object form to customize. */
|
|
368
|
+
media?: boolean | {
|
|
369
|
+
perPage?: number;
|
|
370
|
+
sort?: boolean;
|
|
371
|
+
};
|
|
293
372
|
}
|
|
294
373
|
interface UserAvatar {
|
|
295
374
|
large: string | null;
|
|
@@ -354,6 +433,8 @@ interface SearchCharacterOptions {
|
|
|
354
433
|
sort?: CharacterSort[];
|
|
355
434
|
page?: number;
|
|
356
435
|
perPage?: number;
|
|
436
|
+
/** Include voice actors for each media the character appears in. */
|
|
437
|
+
voiceActors?: boolean;
|
|
357
438
|
}
|
|
358
439
|
interface SearchStaffOptions {
|
|
359
440
|
query?: string;
|
|
@@ -523,6 +604,7 @@ interface MediaIncludeOptions {
|
|
|
523
604
|
characters?: boolean | {
|
|
524
605
|
perPage?: number;
|
|
525
606
|
sort?: boolean;
|
|
607
|
+
voiceActors?: boolean;
|
|
526
608
|
};
|
|
527
609
|
/** Include staff members with their roles.
|
|
528
610
|
* `true` = 25 results sorted by relevance. Object form to customize. */
|
|
@@ -676,6 +758,9 @@ declare class AniListClient {
|
|
|
676
758
|
* // Include characters sorted by role, 25 results
|
|
677
759
|
* const anime = await client.getMedia(1, { characters: true });
|
|
678
760
|
*
|
|
761
|
+
* // Include characters with voice actors
|
|
762
|
+
* const anime = await client.getMedia(1, { characters: { voiceActors: true } });
|
|
763
|
+
*
|
|
679
764
|
* // Full control
|
|
680
765
|
* const anime = await client.getMedia(1, {
|
|
681
766
|
* characters: { perPage: 50, sort: true },
|
|
@@ -720,24 +805,35 @@ declare class AniListClient {
|
|
|
720
805
|
* Fetch a character by AniList ID.
|
|
721
806
|
*
|
|
722
807
|
* @param id - The AniList character ID
|
|
808
|
+
* @param include - Optional include options (e.g. voice actors)
|
|
723
809
|
* @returns The character object
|
|
724
810
|
*
|
|
725
811
|
* @example
|
|
726
812
|
* ```ts
|
|
727
813
|
* const spike = await client.getCharacter(1);
|
|
728
814
|
* console.log(spike.name.full); // "Spike Spiegel"
|
|
815
|
+
*
|
|
816
|
+
* // With voice actors
|
|
817
|
+
* const spike = await client.getCharacter(1, { voiceActors: true });
|
|
818
|
+
* spike.media?.edges?.forEach((e) => {
|
|
819
|
+
* console.log(e.node.title.romaji);
|
|
820
|
+
* e.voiceActors?.forEach((va) => console.log(` VA: ${va.name.full}`));
|
|
821
|
+
* });
|
|
729
822
|
* ```
|
|
730
823
|
*/
|
|
731
|
-
getCharacter(id: number): Promise<Character>;
|
|
824
|
+
getCharacter(id: number, include?: CharacterIncludeOptions): Promise<Character>;
|
|
732
825
|
/**
|
|
733
826
|
* Search for characters by name.
|
|
734
827
|
*
|
|
735
|
-
* @param options - Search / pagination parameters
|
|
828
|
+
* @param options - Search / pagination parameters (includes optional `voiceActors`)
|
|
736
829
|
* @returns Paginated results with matching characters
|
|
737
830
|
*
|
|
738
831
|
* @example
|
|
739
832
|
* ```ts
|
|
740
833
|
* const result = await client.searchCharacters({ query: "Luffy", perPage: 5 });
|
|
834
|
+
*
|
|
835
|
+
* // With voice actors
|
|
836
|
+
* const result = await client.searchCharacters({ query: "Luffy", voiceActors: true });
|
|
741
837
|
* ```
|
|
742
838
|
*/
|
|
743
839
|
searchCharacters(options?: SearchCharacterOptions): Promise<PagedResult<Character>>;
|
|
@@ -745,15 +841,20 @@ declare class AniListClient {
|
|
|
745
841
|
* Fetch a staff member by AniList ID.
|
|
746
842
|
*
|
|
747
843
|
* @param id - The AniList staff ID
|
|
844
|
+
* @param include - Optional include options to fetch related data (e.g. media)
|
|
748
845
|
* @returns The staff object
|
|
749
846
|
*
|
|
750
847
|
* @example
|
|
751
848
|
* ```ts
|
|
752
849
|
* const staff = await client.getStaff(95001);
|
|
753
850
|
* console.log(staff.name.full);
|
|
851
|
+
*
|
|
852
|
+
* // With media the staff worked on
|
|
853
|
+
* const staff = await client.getStaff(95001, { media: true });
|
|
854
|
+
* staff.staffMedia?.nodes.forEach((m) => console.log(m.title.romaji));
|
|
754
855
|
* ```
|
|
755
856
|
*/
|
|
756
|
-
getStaff(id: number): Promise<Staff>;
|
|
857
|
+
getStaff(id: number, include?: StaffIncludeOptions): Promise<Staff>;
|
|
757
858
|
/**
|
|
758
859
|
* Search for staff (voice actors, directors, etc.).
|
|
759
860
|
*
|
|
@@ -1161,4 +1262,4 @@ declare class RateLimiter {
|
|
|
1161
1262
|
private sleep;
|
|
1162
1263
|
}
|
|
1163
1264
|
|
|
1164
|
-
export { type AiringSchedule, AiringSort, AniListClient, type AniListClientOptions, AniListError, type AniListHooks, type CacheAdapter, type CacheOptions, type Character, type CharacterImage, type CharacterName, CharacterRole, CharacterSort, type ExternalLink, type FuzzyDate, type GetAiringOptions, type GetPlanningOptions, type GetRecentChaptersOptions, type GetRecommendationsOptions, type GetSeasonOptions, type GetUserMediaListOptions, type Media, type MediaCharacterConnection, type MediaCharacterEdge, type MediaConnection, type MediaCoverImage, type MediaEdge, MediaFormat, type MediaIncludeOptions, type MediaListEntry, MediaListSort, MediaListStatus, type MediaRecommendationNode, MediaRelationType, MediaSeason, MediaSort, type MediaStaffConnection, type MediaStaffEdge, type MediaStats, MediaStatus, type MediaTag, type MediaTitle, type MediaTrailer, MediaType, MemoryCache, type PageInfo, type PagedResult, type RateLimitOptions, RateLimiter, type Recommendation, RecommendationSort, RedisCache, type RedisCacheOptions, type RedisLikeClient, type ScoreDistribution, type SearchCharacterOptions, type SearchMediaOptions, type SearchStaffOptions, type SearchStudioOptions, type Staff, type StaffImage, type StaffName, type StatusDistribution, type StreamingEpisode, type Studio, type StudioConnection, type StudioDetail, type User, type UserAvatar, type UserStatistics };
|
|
1265
|
+
export { type AiringSchedule, AiringSort, AniListClient, type AniListClientOptions, AniListError, type AniListHooks, type CacheAdapter, type CacheOptions, type Character, type CharacterImage, type CharacterIncludeOptions, type CharacterMediaEdge, type CharacterName, CharacterRole, CharacterSort, type ExternalLink, type FuzzyDate, type GetAiringOptions, type GetPlanningOptions, type GetRecentChaptersOptions, type GetRecommendationsOptions, type GetSeasonOptions, type GetUserMediaListOptions, type Media, type MediaCharacterConnection, type MediaCharacterEdge, type MediaConnection, type MediaCoverImage, type MediaEdge, MediaFormat, type MediaIncludeOptions, type MediaListEntry, MediaListSort, MediaListStatus, type MediaRecommendationNode, MediaRelationType, MediaSeason, MediaSort, type MediaStaffConnection, type MediaStaffEdge, type MediaStats, MediaStatus, type MediaTag, type MediaTitle, type MediaTrailer, MediaType, MemoryCache, type PageInfo, type PagedResult, type RateLimitOptions, RateLimiter, type Recommendation, RecommendationSort, RedisCache, type RedisCacheOptions, type RedisLikeClient, type ScoreDistribution, type SearchCharacterOptions, type SearchMediaOptions, type SearchStaffOptions, type SearchStudioOptions, type Staff, type StaffImage, type StaffIncludeOptions, type StaffMediaNode, type StaffName, type StatusDistribution, type StreamingEpisode, type Studio, type StudioConnection, type StudioDetail, type User, type UserAvatar, type UserStatistics, type VoiceActor };
|