anilink-api-wrapper 1.0.0
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/.eslintignore +1 -0
- package/.github/workflows/code_quality.yml +32 -0
- package/.github/workflows/codeql.yml +33 -0
- package/.github/workflows/test.yml +30 -0
- package/LICENSE +21 -0
- package/README.md +1 -0
- package/__tests__/anilist.test.ts +268 -0
- package/babel.config.js +6 -0
- package/dist/AniLink.js +40 -0
- package/dist/apis/anilist/interfaces/ActivityHistory.js +2 -0
- package/dist/apis/anilist/interfaces/CoverImage.js +2 -0
- package/dist/apis/anilist/interfaces/Distribution.js +2 -0
- package/dist/apis/anilist/interfaces/ExternalLink.js +2 -0
- package/dist/apis/anilist/interfaces/Favoured.js +2 -0
- package/dist/apis/anilist/interfaces/FuzzyDate.js +2 -0
- package/dist/apis/anilist/interfaces/Image.js +2 -0
- package/dist/apis/anilist/interfaces/ListScores.js +2 -0
- package/dist/apis/anilist/interfaces/Media.js +2 -0
- package/dist/apis/anilist/interfaces/MediaListEntry.js +2 -0
- package/dist/apis/anilist/interfaces/MediaStatistics.js +2 -0
- package/dist/apis/anilist/interfaces/MediaStats.js +2 -0
- package/dist/apis/anilist/interfaces/Name.js +2 -0
- package/dist/apis/anilist/interfaces/NextAiringEpisode.js +2 -0
- package/dist/apis/anilist/interfaces/Ranking.js +2 -0
- package/dist/apis/anilist/interfaces/ScoreDistribution.js +2 -0
- package/dist/apis/anilist/interfaces/Staff.js +2 -0
- package/dist/apis/anilist/interfaces/Stat.js +2 -0
- package/dist/apis/anilist/interfaces/Statistics.js +2 -0
- package/dist/apis/anilist/interfaces/Stats.js +2 -0
- package/dist/apis/anilist/interfaces/StatusDistribution.js +2 -0
- package/dist/apis/anilist/interfaces/StreamingEpisode.js +2 -0
- package/dist/apis/anilist/interfaces/Studio.js +2 -0
- package/dist/apis/anilist/interfaces/Tag.js +2 -0
- package/dist/apis/anilist/interfaces/Title.js +2 -0
- package/dist/apis/anilist/interfaces/Trailer.js +2 -0
- package/dist/apis/anilist/interfaces/UserStats.js +2 -0
- package/dist/apis/anilist/interfaces/responses/AiringSchedule.js +2 -0
- package/dist/apis/anilist/interfaces/responses/Character.js +2 -0
- package/dist/apis/anilist/interfaces/responses/Media.js +2 -0
- package/dist/apis/anilist/interfaces/responses/MediaList.js +2 -0
- package/dist/apis/anilist/interfaces/responses/MediaListCollectionResponse.js +2 -0
- package/dist/apis/anilist/interfaces/responses/MediaTrend.js +2 -0
- package/dist/apis/anilist/interfaces/responses/Staff.js +2 -0
- package/dist/apis/anilist/interfaces/responses/User.js +2 -0
- package/dist/apis/anilist/mutation/UpdateUser.js +82 -0
- package/dist/apis/anilist/query/AiringSchedule.js +147 -0
- package/dist/apis/anilist/query/Character.js +69 -0
- package/dist/apis/anilist/query/Media.js +232 -0
- package/dist/apis/anilist/query/MediaList.js +170 -0
- package/dist/apis/anilist/query/MediaListCollection.js +650 -0
- package/dist/apis/anilist/query/MediaTrend.js +149 -0
- package/dist/apis/anilist/query/Staff.js +108 -0
- package/dist/apis/anilist/query/User.js +573 -0
- package/dist/base/APIWrapper.js +9 -0
- package/dist/base/RequestHandler.js +33 -0
- package/jest.config.js +11 -0
- package/package.json +31 -0
- package/src/AniLink.ts +80 -0
- package/src/apis/anilist/interfaces/ActivityHistory.ts +5 -0
- package/src/apis/anilist/interfaces/CoverImage.ts +6 -0
- package/src/apis/anilist/interfaces/Distribution.ts +4 -0
- package/src/apis/anilist/interfaces/ExternalLink.ts +5 -0
- package/src/apis/anilist/interfaces/Favoured.ts +15 -0
- package/src/apis/anilist/interfaces/FuzzyDate.ts +5 -0
- package/src/apis/anilist/interfaces/Image.ts +4 -0
- package/src/apis/anilist/interfaces/ListScores.ts +4 -0
- package/src/apis/anilist/interfaces/Media.ts +59 -0
- package/src/apis/anilist/interfaces/MediaListEntry.ts +4 -0
- package/src/apis/anilist/interfaces/MediaStatistics.ts +23 -0
- package/src/apis/anilist/interfaces/MediaStats.ts +7 -0
- package/src/apis/anilist/interfaces/Name.ts +8 -0
- package/src/apis/anilist/interfaces/NextAiringEpisode.ts +5 -0
- package/src/apis/anilist/interfaces/Ranking.ts +10 -0
- package/src/apis/anilist/interfaces/ScoreDistribution.ts +4 -0
- package/src/apis/anilist/interfaces/Staff.ts +6 -0
- package/src/apis/anilist/interfaces/Stat.ts +24 -0
- package/src/apis/anilist/interfaces/Statistics.ts +6 -0
- package/src/apis/anilist/interfaces/StatusDistribution.ts +4 -0
- package/src/apis/anilist/interfaces/StreamingEpisode.ts +6 -0
- package/src/apis/anilist/interfaces/Studio.ts +4 -0
- package/src/apis/anilist/interfaces/Tag.ts +10 -0
- package/src/apis/anilist/interfaces/Title.ts +6 -0
- package/src/apis/anilist/interfaces/Trailer.ts +5 -0
- package/src/apis/anilist/interfaces/UserStats.ts +25 -0
- package/src/apis/anilist/interfaces/responses/AiringSchedule.ts +10 -0
- package/src/apis/anilist/interfaces/responses/Character.ts +26 -0
- package/src/apis/anilist/interfaces/responses/Media.ts +118 -0
- package/src/apis/anilist/interfaces/responses/MediaList.ts +24 -0
- package/src/apis/anilist/interfaces/responses/MediaListCollectionResponse.ts +37 -0
- package/src/apis/anilist/interfaces/responses/MediaTrend.ts +13 -0
- package/src/apis/anilist/interfaces/responses/Staff.ts +53 -0
- package/src/apis/anilist/interfaces/responses/User.ts +72 -0
- package/src/apis/anilist/mutation/UpdateUser.ts +162 -0
- package/src/apis/anilist/query/AiringSchedule.ts +160 -0
- package/src/apis/anilist/query/Character.ts +75 -0
- package/src/apis/anilist/query/Media.ts +295 -0
- package/src/apis/anilist/query/MediaList.ts +192 -0
- package/src/apis/anilist/query/MediaListCollection.ts +673 -0
- package/src/apis/anilist/query/MediaTrend.ts +169 -0
- package/src/apis/anilist/query/Staff.ts +122 -0
- package/src/apis/anilist/query/User.ts +567 -0
- package/src/base/APIWrapper.ts +7 -0
- package/src/base/RequestHandler.ts +21 -0
- package/tsconfig.json +15 -0
|
@@ -0,0 +1,169 @@
|
|
|
1
|
+
import { APIWrapper } from '../../../base/APIWrapper'
|
|
2
|
+
import { sendRequest } from '../../../base/RequestHandler'
|
|
3
|
+
import { MediaTrendResponse } from '../interfaces/responses/MediaTrend'
|
|
4
|
+
|
|
5
|
+
interface MediaTrendVariables {
|
|
6
|
+
mediaId?: number
|
|
7
|
+
date?: number
|
|
8
|
+
trending?: number
|
|
9
|
+
averageScore?: number
|
|
10
|
+
popularity?: number
|
|
11
|
+
episode?: number
|
|
12
|
+
releasing?: boolean
|
|
13
|
+
mediaId_not?: number
|
|
14
|
+
mediaId_in?: number[]
|
|
15
|
+
mediaId_not_in?: number[]
|
|
16
|
+
date_greater?: number
|
|
17
|
+
date_lesser?: number
|
|
18
|
+
trending_greater?: number
|
|
19
|
+
trending_lesser?: number
|
|
20
|
+
trending_not?: number
|
|
21
|
+
averageScore_greater?: number
|
|
22
|
+
averageScore_lesser?: number
|
|
23
|
+
averageScore_not?: number
|
|
24
|
+
popularity_greater?: number
|
|
25
|
+
popularity_lesser?: number
|
|
26
|
+
popularity_not?: number
|
|
27
|
+
episode_greater?: number
|
|
28
|
+
episode_lesser?: number
|
|
29
|
+
episode_not?: number
|
|
30
|
+
sort?: string[]
|
|
31
|
+
type?: 'ANIME' | 'MANGA'
|
|
32
|
+
}
|
|
33
|
+
|
|
34
|
+
export class MediaTrendQuery extends APIWrapper {
|
|
35
|
+
private readonly authToken: string
|
|
36
|
+
|
|
37
|
+
constructor (authToken: string) {
|
|
38
|
+
super('https://graphql.anilist.co')
|
|
39
|
+
this.authToken = authToken
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
async mediaTrend (variables?: MediaTrendVariables): Promise<MediaTrendResponse> {
|
|
43
|
+
const query = `
|
|
44
|
+
query ($mediaId: Int, $date: Int, $trending: Int, $averageScore: Int, $popularity: Int, $episode: Int, $releasing: Boolean, $mediaId_not: Int, $mediaId_in: [Int], $mediaId_not_in: [Int], $date_greater: Int, $date_lesser: Int, $trending_greater: Int, $trending_lesser: Int, $trending_not: Int, $averageScore_greater: Int, $averageScore_lesser: Int, $averageScore_not: Int, $popularity_greater: Int, $popularity_lesser: Int, $popularity_not: Int, $episode_greater: Int, $episode_lesser: Int, $episode_not: Int, $sort: [MediaTrendSort]) {
|
|
45
|
+
MediaTrend (mediaId: $mediaId, date: $date, trending: $trending, averageScore: $averageScore, popularity: $popularity, episode: $episode, releasing: $releasing, mediaId_not: $mediaId_not, mediaId_in: $mediaId_in, mediaId_not_in: $mediaId_not_in, date_greater: $date_greater, date_lesser: $date_lesser, trending_greater: $trending_greater, trending_lesser: $trending_lesser, trending_not: $trending_not, averageScore_greater: $averageScore_greater, averageScore_lesser: $averageScore_lesser, averageScore_not: $averageScore_not, popularity_greater: $popularity_greater, popularity_lesser: $popularity_lesser, popularity_not: $popularity_not, episode_greater: $episode_greater, episode_lesser: $episode_lesser, episode_not: $episode_not, sort: $sort) {
|
|
46
|
+
mediaId
|
|
47
|
+
date
|
|
48
|
+
trending
|
|
49
|
+
averageScore
|
|
50
|
+
popularity
|
|
51
|
+
inProgress
|
|
52
|
+
releasing
|
|
53
|
+
episode
|
|
54
|
+
media {
|
|
55
|
+
id
|
|
56
|
+
idMal
|
|
57
|
+
title {
|
|
58
|
+
romaji
|
|
59
|
+
english
|
|
60
|
+
native
|
|
61
|
+
userPreferred
|
|
62
|
+
}
|
|
63
|
+
type
|
|
64
|
+
format
|
|
65
|
+
status
|
|
66
|
+
description
|
|
67
|
+
startDate {
|
|
68
|
+
year
|
|
69
|
+
month
|
|
70
|
+
day
|
|
71
|
+
}
|
|
72
|
+
endDate {
|
|
73
|
+
year
|
|
74
|
+
month
|
|
75
|
+
day
|
|
76
|
+
}
|
|
77
|
+
season
|
|
78
|
+
seasonYear
|
|
79
|
+
seasonInt
|
|
80
|
+
${variables?.type === 'ANIME' ? 'episodes\nduration' : 'chapters\nvolumes'}
|
|
81
|
+
countryOfOrigin
|
|
82
|
+
isLicensed
|
|
83
|
+
source
|
|
84
|
+
hashtag
|
|
85
|
+
trailer {
|
|
86
|
+
id
|
|
87
|
+
site
|
|
88
|
+
thumbnail
|
|
89
|
+
}
|
|
90
|
+
updatedAt
|
|
91
|
+
coverImage {
|
|
92
|
+
extraLarge
|
|
93
|
+
large
|
|
94
|
+
medium
|
|
95
|
+
color
|
|
96
|
+
}
|
|
97
|
+
bannerImage
|
|
98
|
+
genres
|
|
99
|
+
synonyms
|
|
100
|
+
averageScore
|
|
101
|
+
meanScore
|
|
102
|
+
popularity
|
|
103
|
+
isLocked
|
|
104
|
+
trending
|
|
105
|
+
favourites
|
|
106
|
+
tags {
|
|
107
|
+
id
|
|
108
|
+
name
|
|
109
|
+
description
|
|
110
|
+
rank
|
|
111
|
+
isGeneralSpoiler
|
|
112
|
+
isMediaSpoiler
|
|
113
|
+
isAdult
|
|
114
|
+
}
|
|
115
|
+
isFavourite
|
|
116
|
+
isAdult
|
|
117
|
+
nextAiringEpisode {
|
|
118
|
+
airingAt
|
|
119
|
+
timeUntilAiring
|
|
120
|
+
episode
|
|
121
|
+
}
|
|
122
|
+
externalLinks {
|
|
123
|
+
id
|
|
124
|
+
url
|
|
125
|
+
site
|
|
126
|
+
}
|
|
127
|
+
streamingEpisodes {
|
|
128
|
+
title
|
|
129
|
+
thumbnail
|
|
130
|
+
url
|
|
131
|
+
site
|
|
132
|
+
}
|
|
133
|
+
rankings {
|
|
134
|
+
id
|
|
135
|
+
rank
|
|
136
|
+
type
|
|
137
|
+
format
|
|
138
|
+
year
|
|
139
|
+
season
|
|
140
|
+
allTime
|
|
141
|
+
context
|
|
142
|
+
}
|
|
143
|
+
mediaListEntry {
|
|
144
|
+
id
|
|
145
|
+
status
|
|
146
|
+
}
|
|
147
|
+
stats {
|
|
148
|
+
scoreDistribution {
|
|
149
|
+
score
|
|
150
|
+
amount
|
|
151
|
+
}
|
|
152
|
+
statusDistribution {
|
|
153
|
+
status
|
|
154
|
+
amount
|
|
155
|
+
}
|
|
156
|
+
}
|
|
157
|
+
siteUrl
|
|
158
|
+
autoCreateForumThread
|
|
159
|
+
isRecommendationBlocked
|
|
160
|
+
modNotes
|
|
161
|
+
}
|
|
162
|
+
}
|
|
163
|
+
}
|
|
164
|
+
`
|
|
165
|
+
|
|
166
|
+
const data = { query, variables }
|
|
167
|
+
return await sendRequest(this.baseURL, 'POST', data, this.authToken)
|
|
168
|
+
}
|
|
169
|
+
}
|
|
@@ -0,0 +1,122 @@
|
|
|
1
|
+
import { APIWrapper } from '../../../base/APIWrapper'
|
|
2
|
+
import { sendRequest } from '../../../base/RequestHandler'
|
|
3
|
+
import { StaffResponse } from '../interfaces/responses/Staff'
|
|
4
|
+
|
|
5
|
+
interface StaffVariables {
|
|
6
|
+
id?: number
|
|
7
|
+
isBirthday?: boolean
|
|
8
|
+
search?: string
|
|
9
|
+
id_not?: number
|
|
10
|
+
id_in?: number[]
|
|
11
|
+
id_not_in?: number[]
|
|
12
|
+
sort?: string[]
|
|
13
|
+
asHtml?: boolean
|
|
14
|
+
staffMediaSort?: string[]
|
|
15
|
+
staffMediaType?: string
|
|
16
|
+
staffMediaOnList?: boolean
|
|
17
|
+
staffMediaPage?: number
|
|
18
|
+
staffMediaPerPage?: number
|
|
19
|
+
charactersSort?: string[]
|
|
20
|
+
charactersPage?: number
|
|
21
|
+
charactersPerPage?: number
|
|
22
|
+
characterMediaSort?: string[]
|
|
23
|
+
characterMediaOnList?: boolean
|
|
24
|
+
characterMediaPage?: number
|
|
25
|
+
characterMediaPerPage?: number
|
|
26
|
+
}
|
|
27
|
+
|
|
28
|
+
export class StaffQuery extends APIWrapper {
|
|
29
|
+
private readonly authToken: string
|
|
30
|
+
|
|
31
|
+
constructor (authToken: string) {
|
|
32
|
+
super('https://graphql.anilist.co')
|
|
33
|
+
this.authToken = authToken
|
|
34
|
+
}
|
|
35
|
+
|
|
36
|
+
async staff (variables?: StaffVariables): Promise<StaffResponse> {
|
|
37
|
+
const query = `
|
|
38
|
+
query ($id: Int, $isBirthday: Boolean, $search: String, $id_not: Int, $id_in: [Int], $id_not_in: [Int], $sort: [StaffSort], $asHtml: Boolean, $staffMediaSort: [MediaSort], $staffMediaType: MediaType, $staffMediaOnList: Boolean, $staffMediaPage: Int, $staffMediaPerPage: Int, $charactersSort: [CharacterSort], $charactersPage: Int, $charactersPerPage: Int, $characterMediaSort: [MediaSort], $characterMediaOnList: Boolean, $characterMediaPage: Int, $characterMediaPerPage: Int) {
|
|
39
|
+
Staff (id: $id, isBirthday: $isBirthday, search: $search, id_not: $id_not, id_in: $id_in, id_not_in: $id_not_in, sort: $sort) {
|
|
40
|
+
id
|
|
41
|
+
name {
|
|
42
|
+
first
|
|
43
|
+
last
|
|
44
|
+
full
|
|
45
|
+
native
|
|
46
|
+
alternative
|
|
47
|
+
userPreferred
|
|
48
|
+
}
|
|
49
|
+
languageV2
|
|
50
|
+
image {
|
|
51
|
+
large
|
|
52
|
+
medium
|
|
53
|
+
}
|
|
54
|
+
description(asHtml: $asHtml)
|
|
55
|
+
primaryOccupations
|
|
56
|
+
gender
|
|
57
|
+
dateOfBirth {
|
|
58
|
+
year
|
|
59
|
+
month
|
|
60
|
+
day
|
|
61
|
+
}
|
|
62
|
+
dateOfDeath {
|
|
63
|
+
year
|
|
64
|
+
month
|
|
65
|
+
day
|
|
66
|
+
}
|
|
67
|
+
age
|
|
68
|
+
yearsActive
|
|
69
|
+
homeTown
|
|
70
|
+
bloodType
|
|
71
|
+
isFavourite
|
|
72
|
+
isFavouriteBlocked
|
|
73
|
+
siteUrl
|
|
74
|
+
staffMedia (sort: $staffMediaSort, type: $staffMediaType, onList: $staffMediaOnList, page: $staffMediaPage, perPage: $staffMediaPerPage) {
|
|
75
|
+
nodes {
|
|
76
|
+
id
|
|
77
|
+
title {
|
|
78
|
+
romaji
|
|
79
|
+
english
|
|
80
|
+
native
|
|
81
|
+
userPreferred
|
|
82
|
+
}
|
|
83
|
+
}
|
|
84
|
+
}
|
|
85
|
+
characters (sort: $charactersSort, page: $charactersPage, perPage: $charactersPerPage) {
|
|
86
|
+
nodes {
|
|
87
|
+
id
|
|
88
|
+
name {
|
|
89
|
+
first
|
|
90
|
+
last
|
|
91
|
+
full
|
|
92
|
+
native
|
|
93
|
+
}
|
|
94
|
+
}
|
|
95
|
+
}
|
|
96
|
+
characterMedia (sort: $characterMediaSort, onList: $characterMediaOnList, page: $characterMediaPage, perPage: $characterMediaPerPage) {
|
|
97
|
+
nodes {
|
|
98
|
+
id
|
|
99
|
+
title {
|
|
100
|
+
romaji
|
|
101
|
+
english
|
|
102
|
+
native
|
|
103
|
+
userPreferred
|
|
104
|
+
}
|
|
105
|
+
}
|
|
106
|
+
}
|
|
107
|
+
submitter {
|
|
108
|
+
id
|
|
109
|
+
name
|
|
110
|
+
}
|
|
111
|
+
submissionStatus
|
|
112
|
+
submissionNotes
|
|
113
|
+
favourites
|
|
114
|
+
modNotes
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
`
|
|
118
|
+
|
|
119
|
+
const data = { query, variables }
|
|
120
|
+
return await sendRequest(this.baseURL, 'POST', data, this.authToken)
|
|
121
|
+
}
|
|
122
|
+
}
|