ani-client 1.5.0 → 1.5.1
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 +1 -1
- package/dist/index.d.mts +144 -371
- package/dist/index.d.ts +144 -371
- package/dist/index.js +654 -714
- package/dist/index.js.map +1 -1
- package/dist/index.mjs +653 -715
- package/dist/index.mjs.map +1 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -11,7 +11,7 @@
|
|
|
11
11
|
- **Zero dependencies** — uses the native `fetch` API
|
|
12
12
|
- **Universal** — Node.js ≥ 20, Bun, Deno and modern browsers
|
|
13
13
|
- **Dual format** — ships ESM + CJS with full TypeScript declarations
|
|
14
|
-
- **Reliable** — Built-in caching, Rate-limit protections, automatic retries & request deduplication!
|
|
14
|
+
- **Reliable** — Built-in caching, Rate-limit protections with exponential backoff, automatic retries & request deduplication!
|
|
15
15
|
|
|
16
16
|
## 📖 Documentation
|
|
17
17
|
|
package/dist/index.d.mts
CHANGED
|
@@ -357,10 +357,6 @@ interface Studio {
|
|
|
357
357
|
interface StudioConnection {
|
|
358
358
|
nodes: Studio[];
|
|
359
359
|
}
|
|
360
|
-
/**
|
|
361
|
-
* @deprecated Use `Studio` instead. `StudioDetail` is an alias kept for backward compatibility.
|
|
362
|
-
*/
|
|
363
|
-
type StudioDetail = Studio;
|
|
364
360
|
interface SearchStudioOptions {
|
|
365
361
|
query?: string;
|
|
366
362
|
page?: number;
|
|
@@ -766,6 +762,96 @@ interface AiringSchedule {
|
|
|
766
762
|
mediaId: number;
|
|
767
763
|
media: Media;
|
|
768
764
|
}
|
|
765
|
+
type DayOfWeek = "Monday" | "Tuesday" | "Wednesday" | "Thursday" | "Friday" | "Saturday" | "Sunday";
|
|
766
|
+
type WeeklySchedule = Record<DayOfWeek, AiringSchedule[]>;
|
|
767
|
+
|
|
768
|
+
/** Represents a forum thread on AniList. */
|
|
769
|
+
interface Thread {
|
|
770
|
+
id: number;
|
|
771
|
+
title: string;
|
|
772
|
+
body: string | null;
|
|
773
|
+
userId: number;
|
|
774
|
+
replyUserId: number | null;
|
|
775
|
+
replyCommentId: number | null;
|
|
776
|
+
replyCount: number;
|
|
777
|
+
viewCount: number;
|
|
778
|
+
isLocked: boolean;
|
|
779
|
+
isSticky: boolean;
|
|
780
|
+
isSubscribed: boolean;
|
|
781
|
+
repliedAt: number | null;
|
|
782
|
+
createdAt: number;
|
|
783
|
+
updatedAt: number;
|
|
784
|
+
siteUrl: string | null;
|
|
785
|
+
user: {
|
|
786
|
+
id: number;
|
|
787
|
+
name: string;
|
|
788
|
+
avatar: UserAvatar;
|
|
789
|
+
} | null;
|
|
790
|
+
replyUser: {
|
|
791
|
+
id: number;
|
|
792
|
+
name: string;
|
|
793
|
+
avatar: UserAvatar;
|
|
794
|
+
} | null;
|
|
795
|
+
categories: ThreadCategory[] | null;
|
|
796
|
+
mediaCategories: ThreadMediaCategory[] | null;
|
|
797
|
+
likes: {
|
|
798
|
+
id: number;
|
|
799
|
+
name: string;
|
|
800
|
+
}[] | null;
|
|
801
|
+
}
|
|
802
|
+
interface ThreadCategory {
|
|
803
|
+
id: number;
|
|
804
|
+
name: string;
|
|
805
|
+
}
|
|
806
|
+
interface ThreadMediaCategory {
|
|
807
|
+
id: number;
|
|
808
|
+
title: {
|
|
809
|
+
romaji: string | null;
|
|
810
|
+
english: string | null;
|
|
811
|
+
native: string | null;
|
|
812
|
+
userPreferred: string | null;
|
|
813
|
+
};
|
|
814
|
+
type: string;
|
|
815
|
+
coverImage: {
|
|
816
|
+
large: string | null;
|
|
817
|
+
medium: string | null;
|
|
818
|
+
} | null;
|
|
819
|
+
siteUrl: string | null;
|
|
820
|
+
}
|
|
821
|
+
/** Sort options for thread queries. */
|
|
822
|
+
declare enum ThreadSort {
|
|
823
|
+
ID = "ID",
|
|
824
|
+
ID_DESC = "ID_DESC",
|
|
825
|
+
TITLE = "TITLE",
|
|
826
|
+
TITLE_DESC = "TITLE_DESC",
|
|
827
|
+
CREATED_AT = "CREATED_AT",
|
|
828
|
+
CREATED_AT_DESC = "CREATED_AT_DESC",
|
|
829
|
+
UPDATED_AT = "UPDATED_AT",
|
|
830
|
+
UPDATED_AT_DESC = "UPDATED_AT_DESC",
|
|
831
|
+
REPLIED_AT = "REPLIED_AT",
|
|
832
|
+
REPLIED_AT_DESC = "REPLIED_AT_DESC",
|
|
833
|
+
REPLY_COUNT = "REPLY_COUNT",
|
|
834
|
+
REPLY_COUNT_DESC = "REPLY_COUNT_DESC",
|
|
835
|
+
VIEW_COUNT = "VIEW_COUNT",
|
|
836
|
+
VIEW_COUNT_DESC = "VIEW_COUNT_DESC",
|
|
837
|
+
IS_STICKY = "IS_STICKY",
|
|
838
|
+
SEARCH_MATCH = "SEARCH_MATCH"
|
|
839
|
+
}
|
|
840
|
+
/** Options for searching/listing threads. */
|
|
841
|
+
interface SearchThreadOptions {
|
|
842
|
+
/** Search query */
|
|
843
|
+
query?: string;
|
|
844
|
+
/** Filter by media ID */
|
|
845
|
+
mediaId?: number;
|
|
846
|
+
/** Filter by category ID */
|
|
847
|
+
categoryId?: number;
|
|
848
|
+
/** Sort order */
|
|
849
|
+
sort?: ThreadSort[];
|
|
850
|
+
/** Page number */
|
|
851
|
+
page?: number;
|
|
852
|
+
/** Results per page (max 50) */
|
|
853
|
+
perPage?: number;
|
|
854
|
+
}
|
|
769
855
|
|
|
770
856
|
/**
|
|
771
857
|
* Lightweight AniList GraphQL client with built-in caching and rate limiting.
|
|
@@ -775,7 +861,7 @@ interface AiringSchedule {
|
|
|
775
861
|
* import { AniListClient } from "ani-client";
|
|
776
862
|
*
|
|
777
863
|
* const client = new AniListClient();
|
|
778
|
-
* const anime = await client.getMedia(1);
|
|
864
|
+
* const anime = await client.getMedia(1);
|
|
779
865
|
* console.log(anime.title.romaji);
|
|
780
866
|
*
|
|
781
867
|
* // Custom cache & rate limit options
|
|
@@ -793,17 +879,12 @@ declare class AniListClient {
|
|
|
793
879
|
private readonly hooks;
|
|
794
880
|
private readonly inFlight;
|
|
795
881
|
constructor(options?: AniListClientOptions);
|
|
796
|
-
/**
|
|
797
|
-
|
|
798
|
-
*/
|
|
799
|
-
private request;
|
|
882
|
+
/** @internal */
|
|
883
|
+
request<T>(query: string, variables?: Record<string, unknown>): Promise<T>;
|
|
800
884
|
/** @internal */
|
|
801
885
|
private executeRequest;
|
|
802
|
-
/**
|
|
803
|
-
|
|
804
|
-
* Shorthand for paginated queries that follow the `Page { pageInfo, <field>[] }` pattern.
|
|
805
|
-
*/
|
|
806
|
-
private pagedRequest;
|
|
886
|
+
/** @internal */
|
|
887
|
+
pagedRequest<T>(query: string, variables: Record<string, unknown>, field: string): Promise<PagedResult<T>>;
|
|
807
888
|
/**
|
|
808
889
|
* Fetch a single media entry by its AniList ID.
|
|
809
890
|
*
|
|
@@ -811,33 +892,6 @@ declare class AniListClient {
|
|
|
811
892
|
*
|
|
812
893
|
* @param id - The AniList media ID
|
|
813
894
|
* @param include - Optional related data to include
|
|
814
|
-
* @returns The media object
|
|
815
|
-
*
|
|
816
|
-
* @example
|
|
817
|
-
* ```ts
|
|
818
|
-
* // Basic usage — same as before (includes relations by default)
|
|
819
|
-
* const anime = await client.getMedia(1);
|
|
820
|
-
*
|
|
821
|
-
* // Include characters sorted by role, 25 results
|
|
822
|
-
* const anime = await client.getMedia(1, { characters: true });
|
|
823
|
-
*
|
|
824
|
-
* // Include characters with voice actors
|
|
825
|
-
* const anime = await client.getMedia(1, { characters: { voiceActors: true } });
|
|
826
|
-
*
|
|
827
|
-
* // Full control
|
|
828
|
-
* const anime = await client.getMedia(1, {
|
|
829
|
-
* characters: { perPage: 50, sort: true },
|
|
830
|
-
* staff: true,
|
|
831
|
-
* relations: true,
|
|
832
|
-
* streamingEpisodes: true,
|
|
833
|
-
* externalLinks: true,
|
|
834
|
-
* stats: true,
|
|
835
|
-
* recommendations: { perPage: 5 },
|
|
836
|
-
* });
|
|
837
|
-
*
|
|
838
|
-
* // Exclude relations for a lighter response
|
|
839
|
-
* const anime = await client.getMedia(1, { characters: true, relations: false });
|
|
840
|
-
* ```
|
|
841
895
|
*/
|
|
842
896
|
getMedia(id: number, include?: MediaIncludeOptions): Promise<Media>;
|
|
843
897
|
/**
|
|
@@ -845,370 +899,80 @@ declare class AniListClient {
|
|
|
845
899
|
*
|
|
846
900
|
* @param options - Search / filter parameters
|
|
847
901
|
* @returns Paginated results with matching media
|
|
848
|
-
*
|
|
849
|
-
* @example
|
|
850
|
-
* ```ts
|
|
851
|
-
* const results = await client.searchMedia({
|
|
852
|
-
* query: "Naruto",
|
|
853
|
-
* type: MediaType.ANIME,
|
|
854
|
-
* perPage: 5,
|
|
855
|
-
* });
|
|
856
|
-
* ```
|
|
857
902
|
*/
|
|
858
903
|
searchMedia(options?: SearchMediaOptions): Promise<PagedResult<Media>>;
|
|
859
|
-
/**
|
|
860
|
-
* Get currently trending anime or manga.
|
|
861
|
-
*
|
|
862
|
-
* @param type - `MediaType.ANIME` or `MediaType.MANGA` (defaults to ANIME)
|
|
863
|
-
* @param page - Page number (default 1)
|
|
864
|
-
* @param perPage - Results per page (default 20, max 50)
|
|
865
|
-
*/
|
|
904
|
+
/** Get currently trending anime or manga. */
|
|
866
905
|
getTrending(type?: MediaType, page?: number, perPage?: number): Promise<PagedResult<Media>>;
|
|
867
|
-
/**
|
|
868
|
-
* Get the most popular anime or manga.
|
|
869
|
-
*
|
|
870
|
-
* Convenience wrapper around `searchMedia` with `sort: POPULARITY_DESC`.
|
|
871
|
-
*
|
|
872
|
-
* @param type - `MediaType.ANIME` or `MediaType.MANGA` (defaults to ANIME)
|
|
873
|
-
* @param page - Page number (default 1)
|
|
874
|
-
* @param perPage - Results per page (default 20, max 50)
|
|
875
|
-
*/
|
|
906
|
+
/** Get the most popular anime or manga. */
|
|
876
907
|
getPopular(type?: MediaType, page?: number, perPage?: number): Promise<PagedResult<Media>>;
|
|
877
|
-
/**
|
|
878
|
-
* Get the highest-rated anime or manga.
|
|
879
|
-
*
|
|
880
|
-
* Convenience wrapper around `searchMedia` with `sort: SCORE_DESC`.
|
|
881
|
-
*
|
|
882
|
-
* @param type - `MediaType.ANIME` or `MediaType.MANGA` (defaults to ANIME)
|
|
883
|
-
* @param page - Page number (default 1)
|
|
884
|
-
* @param perPage - Results per page (default 20, max 50)
|
|
885
|
-
*/
|
|
908
|
+
/** Get the highest-rated anime or manga. */
|
|
886
909
|
getTopRated(type?: MediaType, page?: number, perPage?: number): Promise<PagedResult<Media>>;
|
|
887
|
-
/**
|
|
888
|
-
|
|
889
|
-
|
|
890
|
-
|
|
891
|
-
|
|
892
|
-
|
|
893
|
-
|
|
894
|
-
|
|
895
|
-
|
|
896
|
-
|
|
897
|
-
|
|
898
|
-
|
|
899
|
-
|
|
900
|
-
* const spike = await client.getCharacter(1, { voiceActors: true });
|
|
901
|
-
* spike.media?.edges?.forEach((e) => {
|
|
902
|
-
* console.log(e.node.title.romaji);
|
|
903
|
-
* e.voiceActors?.forEach((va) => console.log(` VA: ${va.name.full}`));
|
|
904
|
-
* });
|
|
905
|
-
* ```
|
|
906
|
-
*/
|
|
910
|
+
/** Get recently aired anime episodes. */
|
|
911
|
+
getAiredEpisodes(options?: GetAiringOptions): Promise<PagedResult<AiringSchedule>>;
|
|
912
|
+
/** Get currently releasing manga. */
|
|
913
|
+
getAiredChapters(options?: GetRecentChaptersOptions): Promise<PagedResult<Media>>;
|
|
914
|
+
/** Get the detailed schedule for the current week, sorted by day. */
|
|
915
|
+
getWeeklySchedule(date?: Date): Promise<WeeklySchedule>;
|
|
916
|
+
/** Get upcoming (not yet released) media. */
|
|
917
|
+
getPlanning(options?: GetPlanningOptions): Promise<PagedResult<Media>>;
|
|
918
|
+
/** Get recommendations for a specific media. */
|
|
919
|
+
getRecommendations(mediaId: number, options?: Omit<GetRecommendationsOptions, "mediaId">): Promise<PagedResult<Recommendation>>;
|
|
920
|
+
/** Get anime (or manga) for a specific season and year. */
|
|
921
|
+
getMediaBySeason(options: GetSeasonOptions): Promise<PagedResult<Media>>;
|
|
922
|
+
/** Fetch a character by AniList ID. Pass `{ voiceActors: true }` to include VA data. */
|
|
907
923
|
getCharacter(id: number, include?: CharacterIncludeOptions): Promise<Character>;
|
|
908
|
-
/**
|
|
909
|
-
* Search for characters by name.
|
|
910
|
-
*
|
|
911
|
-
* @param options - Search / pagination parameters (includes optional `voiceActors`)
|
|
912
|
-
* @returns Paginated results with matching characters
|
|
913
|
-
*
|
|
914
|
-
* @example
|
|
915
|
-
* ```ts
|
|
916
|
-
* const result = await client.searchCharacters({ query: "Luffy", perPage: 5 });
|
|
917
|
-
*
|
|
918
|
-
* // With voice actors
|
|
919
|
-
* const result = await client.searchCharacters({ query: "Luffy", voiceActors: true });
|
|
920
|
-
* ```
|
|
921
|
-
*/
|
|
924
|
+
/** Search for characters by name. */
|
|
922
925
|
searchCharacters(options?: SearchCharacterOptions): Promise<PagedResult<Character>>;
|
|
923
|
-
/**
|
|
924
|
-
* Fetch a staff member by AniList ID.
|
|
925
|
-
*
|
|
926
|
-
* @param id - The AniList staff ID
|
|
927
|
-
* @param include - Optional include options to fetch related data (e.g. media)
|
|
928
|
-
* @returns The staff object
|
|
929
|
-
*
|
|
930
|
-
* @example
|
|
931
|
-
* ```ts
|
|
932
|
-
* const staff = await client.getStaff(95001);
|
|
933
|
-
* console.log(staff.name.full);
|
|
934
|
-
*
|
|
935
|
-
* // With media the staff worked on
|
|
936
|
-
* const staff = await client.getStaff(95001, { media: true });
|
|
937
|
-
* staff.staffMedia?.nodes.forEach((m) => console.log(m.title.romaji));
|
|
938
|
-
* ```
|
|
939
|
-
*/
|
|
926
|
+
/** Fetch a staff member by AniList ID. Pass `{ media: true }` or `{ media: { perPage } }` for media credits. */
|
|
940
927
|
getStaff(id: number, include?: StaffIncludeOptions): Promise<Staff>;
|
|
941
|
-
/**
|
|
942
|
-
* Search for staff (voice actors, directors, etc.).
|
|
943
|
-
*
|
|
944
|
-
* @param options - Search / pagination parameters
|
|
945
|
-
* @returns Paginated results with matching staff
|
|
946
|
-
*
|
|
947
|
-
* @example
|
|
948
|
-
* ```ts
|
|
949
|
-
* const result = await client.searchStaff({ query: "Miyazaki", perPage: 5 });
|
|
950
|
-
* ```
|
|
951
|
-
*/
|
|
928
|
+
/** Search for staff (voice actors, directors, etc.). */
|
|
952
929
|
searchStaff(options?: SearchStaffOptions): Promise<PagedResult<Staff>>;
|
|
953
930
|
/**
|
|
954
931
|
* Fetch a user by AniList ID or username.
|
|
955
932
|
*
|
|
956
933
|
* @param idOrName - The AniList user ID (number) or username (string)
|
|
957
|
-
* @returns The user object
|
|
958
|
-
*
|
|
959
|
-
* @example
|
|
960
|
-
* ```ts
|
|
961
|
-
* const user = await client.getUser(1);
|
|
962
|
-
* const user2 = await client.getUser("AniList");
|
|
963
|
-
* console.log(user.name);
|
|
964
|
-
* ```
|
|
965
934
|
*/
|
|
966
935
|
getUser(idOrName: number | string): Promise<User>;
|
|
967
|
-
/**
|
|
968
|
-
* Fetch a user by username.
|
|
969
|
-
*
|
|
970
|
-
* @deprecated Use `getUser(name)` instead.
|
|
971
|
-
* @param name - The AniList username
|
|
972
|
-
* @returns The user object
|
|
973
|
-
*/
|
|
974
|
-
getUserByName(name: string): Promise<User>;
|
|
975
|
-
/**
|
|
976
|
-
* Search for users by name.
|
|
977
|
-
*
|
|
978
|
-
* @param options - Search / pagination parameters
|
|
979
|
-
* @returns Paginated results with matching users
|
|
980
|
-
*
|
|
981
|
-
* @example
|
|
982
|
-
* ```ts
|
|
983
|
-
* const result = await client.searchUsers({ query: "AniList", perPage: 5 });
|
|
984
|
-
* ```
|
|
985
|
-
*/
|
|
936
|
+
/** Search for users by name. */
|
|
986
937
|
searchUsers(options?: SearchUserOptions): Promise<PagedResult<User>>;
|
|
987
|
-
/**
|
|
988
|
-
* Execute an arbitrary GraphQL query against the AniList API.
|
|
989
|
-
* Useful for advanced use-cases not covered by the built-in methods.
|
|
990
|
-
*
|
|
991
|
-
* @param query - A valid GraphQL query string
|
|
992
|
-
* @param variables - Optional variables object
|
|
993
|
-
*/
|
|
994
|
-
raw<T = unknown>(query: string, variables?: Record<string, unknown>): Promise<T>;
|
|
995
|
-
/**
|
|
996
|
-
* Get recently aired anime episodes.
|
|
997
|
-
*
|
|
998
|
-
* By default returns episodes that aired in the last 24 hours.
|
|
999
|
-
*
|
|
1000
|
-
* @param options - Filter / pagination parameters
|
|
1001
|
-
* @returns Paginated list of airing schedule entries
|
|
1002
|
-
*
|
|
1003
|
-
* @example
|
|
1004
|
-
* ```ts
|
|
1005
|
-
* // Episodes that aired in the last 48h
|
|
1006
|
-
* const recent = await client.getAiredEpisodes({
|
|
1007
|
-
* airingAtGreater: Math.floor(Date.now() / 1000) - 48 * 3600,
|
|
1008
|
-
* });
|
|
1009
|
-
* ```
|
|
1010
|
-
*/
|
|
1011
|
-
getAiredEpisodes(options?: GetAiringOptions): Promise<PagedResult<AiringSchedule>>;
|
|
1012
|
-
/**
|
|
1013
|
-
* Get manga that are currently releasing, sorted by most recently updated.
|
|
1014
|
-
*
|
|
1015
|
-
* This is the closest equivalent to "recently released chapters" on AniList,
|
|
1016
|
-
* since the API does not expose per-chapter airing schedules for manga.
|
|
1017
|
-
*
|
|
1018
|
-
* @param options - Pagination parameters
|
|
1019
|
-
* @returns Paginated list of currently releasing manga
|
|
1020
|
-
*
|
|
1021
|
-
* @example
|
|
1022
|
-
* ```ts
|
|
1023
|
-
* const chapters = await client.getAiredChapters({ perPage: 10 });
|
|
1024
|
-
* ```
|
|
1025
|
-
*/
|
|
1026
|
-
getAiredChapters(options?: GetRecentChaptersOptions): Promise<PagedResult<Media>>;
|
|
1027
|
-
/**
|
|
1028
|
-
* Get upcoming (not yet released) anime and/or manga, sorted by popularity.
|
|
1029
|
-
*
|
|
1030
|
-
* @param options - Filter / pagination parameters
|
|
1031
|
-
* @returns Paginated list of planned media
|
|
1032
|
-
*
|
|
1033
|
-
* @example
|
|
1034
|
-
* ```ts
|
|
1035
|
-
* import { MediaType } from "ani-client";
|
|
1036
|
-
*
|
|
1037
|
-
* // Most anticipated upcoming anime
|
|
1038
|
-
* const planning = await client.getPlanning({ type: MediaType.ANIME, perPage: 10 });
|
|
1039
|
-
* ```
|
|
1040
|
-
*/
|
|
1041
|
-
getPlanning(options?: GetPlanningOptions): Promise<PagedResult<Media>>;
|
|
1042
|
-
/**
|
|
1043
|
-
* Get recommendations for a specific media.
|
|
1044
|
-
*
|
|
1045
|
-
* Returns other anime/manga that users have recommended based on the given media.
|
|
1046
|
-
*
|
|
1047
|
-
* @param mediaId - The AniList media ID
|
|
1048
|
-
* @param options - Optional sort / pagination parameters
|
|
1049
|
-
* @returns Paginated list of recommendations
|
|
1050
|
-
*
|
|
1051
|
-
* @example
|
|
1052
|
-
* ```ts
|
|
1053
|
-
* // Get recommendations for Cowboy Bebop
|
|
1054
|
-
* const recs = await client.getRecommendations(1);
|
|
1055
|
-
* recs.results.forEach((r) =>
|
|
1056
|
-
* console.log(`${r.mediaRecommendation.title.romaji} (rating: ${r.rating})`)
|
|
1057
|
-
* );
|
|
1058
|
-
* ```
|
|
1059
|
-
*/
|
|
1060
|
-
getRecommendations(mediaId: number, options?: Omit<GetRecommendationsOptions, "mediaId">): Promise<PagedResult<Recommendation>>;
|
|
1061
|
-
/**
|
|
1062
|
-
* Get anime (or manga) for a specific season and year.
|
|
1063
|
-
*
|
|
1064
|
-
* @param options - Season, year and optional filter / pagination parameters
|
|
1065
|
-
* @returns Paginated list of media for the given season
|
|
1066
|
-
*
|
|
1067
|
-
* @example
|
|
1068
|
-
* ```ts
|
|
1069
|
-
* import { MediaSeason } from "ani-client";
|
|
1070
|
-
*
|
|
1071
|
-
* const winter2026 = await client.getMediaBySeason({
|
|
1072
|
-
* season: MediaSeason.WINTER,
|
|
1073
|
-
* seasonYear: 2026,
|
|
1074
|
-
* perPage: 10,
|
|
1075
|
-
* });
|
|
1076
|
-
* ```
|
|
1077
|
-
*/
|
|
1078
|
-
getMediaBySeason(options: GetSeasonOptions): Promise<PagedResult<Media>>;
|
|
1079
|
-
/**
|
|
1080
|
-
* Get a user's anime or manga list.
|
|
1081
|
-
*
|
|
1082
|
-
* Provide either `userId` or `userName` to identify the user.
|
|
1083
|
-
* Requires `type` (ANIME or MANGA). Optionally filter by list status.
|
|
1084
|
-
*
|
|
1085
|
-
* @param options - User identifier, media type, and optional filters
|
|
1086
|
-
* @returns Paginated list of media list entries
|
|
1087
|
-
*
|
|
1088
|
-
* @example
|
|
1089
|
-
* ```ts
|
|
1090
|
-
* import { MediaType, MediaListStatus } from "ani-client";
|
|
1091
|
-
*
|
|
1092
|
-
* // Get a user's completed anime list
|
|
1093
|
-
* const list = await client.getUserMediaList({
|
|
1094
|
-
* userName: "AniList",
|
|
1095
|
-
* type: MediaType.ANIME,
|
|
1096
|
-
* status: MediaListStatus.COMPLETED,
|
|
1097
|
-
* });
|
|
1098
|
-
* list.results.forEach((entry) =>
|
|
1099
|
-
* console.log(`${entry.media.title.romaji} — ${entry.score}/100`)
|
|
1100
|
-
* );
|
|
1101
|
-
* ```
|
|
1102
|
-
*/
|
|
938
|
+
/** Get a user's anime or manga list. */
|
|
1103
939
|
getUserMediaList(options: GetUserMediaListOptions): Promise<PagedResult<MediaListEntry>>;
|
|
1104
|
-
/**
|
|
1105
|
-
* Fetch a studio by its AniList ID.
|
|
1106
|
-
*
|
|
1107
|
-
* Returns studio details along with its most popular productions.
|
|
1108
|
-
*
|
|
1109
|
-
* @param id - The AniList studio ID
|
|
1110
|
-
*/
|
|
940
|
+
/** Fetch a studio by its AniList ID. */
|
|
1111
941
|
getStudio(id: number): Promise<Studio>;
|
|
1112
|
-
/**
|
|
1113
|
-
* Search for studios by name.
|
|
1114
|
-
*
|
|
1115
|
-
* @param options - Search / pagination parameters
|
|
1116
|
-
* @returns Paginated list of studios
|
|
1117
|
-
*
|
|
1118
|
-
* @example
|
|
1119
|
-
* ```ts
|
|
1120
|
-
* const studios = await client.searchStudios({ query: "MAPPA" });
|
|
1121
|
-
* ```
|
|
1122
|
-
*/
|
|
942
|
+
/** Search for studios by name. */
|
|
1123
943
|
searchStudios(options?: SearchStudioOptions): Promise<PagedResult<Studio>>;
|
|
1124
|
-
/**
|
|
1125
|
-
|
|
1126
|
-
|
|
1127
|
-
|
|
1128
|
-
|
|
944
|
+
/** Fetch a forum thread by its AniList ID. */
|
|
945
|
+
getThread(id: number): Promise<Thread>;
|
|
946
|
+
/** Get recent forum threads, optionally filtered by search, media, or category. */
|
|
947
|
+
getRecentThreads(options?: SearchThreadOptions): Promise<PagedResult<Thread>>;
|
|
948
|
+
/** Get all available genres on AniList. */
|
|
1129
949
|
getGenres(): Promise<string[]>;
|
|
1130
|
-
/**
|
|
1131
|
-
* Get all available media tags on AniList.
|
|
1132
|
-
*
|
|
1133
|
-
* @returns Array of tag objects with id, name, description, category, isAdult
|
|
1134
|
-
*/
|
|
950
|
+
/** Get all available media tags on AniList. */
|
|
1135
951
|
getTags(): Promise<MediaTag[]>;
|
|
952
|
+
/** Execute an arbitrary GraphQL query against the AniList API. */
|
|
953
|
+
raw<T>(query: string, variables?: Record<string, unknown>): Promise<T>;
|
|
1136
954
|
/**
|
|
1137
|
-
* Auto-paginating async iterator.
|
|
1138
|
-
*
|
|
1139
|
-
* Wraps any paginated method and yields individual items across all pages.
|
|
1140
|
-
* Stops when `hasNextPage` is `false` or `maxPages` is reached.
|
|
955
|
+
* Auto-paginating async iterator. Yields individual items across all pages.
|
|
1141
956
|
*
|
|
1142
957
|
* @param fetchPage - A function that takes a page number and returns a `PagedResult<T>`
|
|
1143
958
|
* @param maxPages - Maximum number of pages to fetch (default: Infinity)
|
|
1144
|
-
* @returns An async iterable iterator of individual items
|
|
1145
|
-
*
|
|
1146
|
-
* @example
|
|
1147
|
-
* ```ts
|
|
1148
|
-
* // Iterate over all search results
|
|
1149
|
-
* for await (const anime of client.paginate((page) =>
|
|
1150
|
-
* client.searchMedia({ query: "Naruto", page, perPage: 10 })
|
|
1151
|
-
* )) {
|
|
1152
|
-
* console.log(anime.title.romaji);
|
|
1153
|
-
* }
|
|
1154
|
-
*
|
|
1155
|
-
* // Limit to 3 pages
|
|
1156
|
-
* for await (const anime of client.paginate(
|
|
1157
|
-
* (page) => client.getTrending(MediaType.ANIME, page, 20),
|
|
1158
|
-
* 3,
|
|
1159
|
-
* )) {
|
|
1160
|
-
* console.log(anime.title.romaji);
|
|
1161
|
-
* }
|
|
1162
|
-
* ```
|
|
1163
959
|
*/
|
|
1164
960
|
paginate<T>(fetchPage: (page: number) => Promise<PagedResult<T>>, maxPages?: number): AsyncGenerator<T, void, undefined>;
|
|
1165
|
-
/**
|
|
1166
|
-
* Fetch multiple media entries in a single API request.
|
|
1167
|
-
* Uses GraphQL aliases to batch up to 50 IDs per call.
|
|
1168
|
-
*
|
|
1169
|
-
* @param ids - Array of AniList media IDs
|
|
1170
|
-
* @returns Array of media objects (same order as input IDs)
|
|
1171
|
-
*/
|
|
961
|
+
/** Fetch multiple media entries in a single API request. */
|
|
1172
962
|
getMediaBatch(ids: number[]): Promise<Media[]>;
|
|
1173
|
-
/**
|
|
1174
|
-
* Fetch multiple characters in a single API request.
|
|
1175
|
-
*
|
|
1176
|
-
* @param ids - Array of AniList character IDs
|
|
1177
|
-
* @returns Array of character objects (same order as input IDs)
|
|
1178
|
-
*/
|
|
963
|
+
/** Fetch multiple characters in a single API request. */
|
|
1179
964
|
getCharacterBatch(ids: number[]): Promise<Character[]>;
|
|
1180
|
-
/**
|
|
1181
|
-
* Fetch multiple staff members in a single API request.
|
|
1182
|
-
*
|
|
1183
|
-
* @param ids - Array of AniList staff IDs
|
|
1184
|
-
* @returns Array of staff objects (same order as input IDs)
|
|
1185
|
-
*/
|
|
965
|
+
/** Fetch multiple staff members in a single API request. */
|
|
1186
966
|
getStaffBatch(ids: number[]): Promise<Staff[]>;
|
|
1187
967
|
/** @internal */
|
|
1188
968
|
private executeBatch;
|
|
1189
|
-
/**
|
|
1190
|
-
* Clear the entire response cache.
|
|
1191
|
-
*/
|
|
969
|
+
/** Clear the entire response cache. */
|
|
1192
970
|
clearCache(): Promise<void>;
|
|
1193
|
-
/**
|
|
1194
|
-
* Number of entries currently in the cache.
|
|
1195
|
-
* For async adapters like Redis, this may return a Promise.
|
|
1196
|
-
*/
|
|
971
|
+
/** Number of entries currently in the cache. */
|
|
1197
972
|
get cacheSize(): number | Promise<number>;
|
|
1198
|
-
/**
|
|
1199
|
-
* Remove cache entries whose key matches the given pattern.
|
|
1200
|
-
*
|
|
1201
|
-
* @param pattern — A string (converted to RegExp) or RegExp
|
|
1202
|
-
* @returns Number of entries removed
|
|
1203
|
-
*/
|
|
973
|
+
/** Remove cache entries whose key matches the given pattern. */
|
|
1204
974
|
invalidateCache(pattern: string | RegExp): Promise<number>;
|
|
1205
|
-
/**
|
|
1206
|
-
* Clean up resources held by the client.
|
|
1207
|
-
*
|
|
1208
|
-
* Clears the in-memory cache and aborts any pending in-flight requests.
|
|
1209
|
-
* If using a custom cache adapter (e.g. Redis), call its close/disconnect
|
|
1210
|
-
* method separately.
|
|
1211
|
-
*/
|
|
975
|
+
/** Clean up resources held by the client. */
|
|
1212
976
|
destroy(): Promise<void>;
|
|
1213
977
|
}
|
|
1214
978
|
|
|
@@ -1366,4 +1130,13 @@ declare class RateLimiter {
|
|
|
1366
1130
|
private sleep;
|
|
1367
1131
|
}
|
|
1368
1132
|
|
|
1369
|
-
|
|
1133
|
+
/**
|
|
1134
|
+
* Parses AniList specific markdown into standard HTML.
|
|
1135
|
+
* Includes formatting for spoilers, images, videos (youtube/webm), and standard markdown elements.
|
|
1136
|
+
*
|
|
1137
|
+
* @param text The AniList markdown text to parse
|
|
1138
|
+
* @returns The parsed HTML string
|
|
1139
|
+
*/
|
|
1140
|
+
declare function parseAniListMarkdown(text: string): string;
|
|
1141
|
+
|
|
1142
|
+
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 DayOfWeek, 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, MediaSource, type MediaStaffConnection, type MediaStaffEdge, type MediaStats, MediaStatus, type MediaTag, type MediaTitle, type MediaTrailer, MediaType, MemoryCache, type NextAiringEpisode, 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 SearchThreadOptions, type SearchUserOptions, type Staff, type StaffImage, type StaffIncludeOptions, type StaffMediaNode, type StaffName, StaffSort, type StatusDistribution, type StreamingEpisode, type Studio, type StudioConnection, type Thread, type ThreadCategory, type ThreadMediaCategory, ThreadSort, type User, type UserAvatar, UserSort, type UserStatistics, type VoiceActor, type WeeklySchedule, parseAniListMarkdown };
|