diff --git a/src/apis/anilist/interfaces/ActivityHistory.ts b/src/apis/anilist/interfaces/ActivityHistory.ts new file mode 100644 index 00000000..59325def --- /dev/null +++ b/src/apis/anilist/interfaces/ActivityHistory.ts @@ -0,0 +1,5 @@ +export interface ActivityHistory { + date: number; + amount: number; + level: number; +} \ No newline at end of file diff --git a/src/apis/anilist/interfaces/Distribution.ts b/src/apis/anilist/interfaces/Distribution.ts new file mode 100644 index 00000000..8318c487 --- /dev/null +++ b/src/apis/anilist/interfaces/Distribution.ts @@ -0,0 +1,4 @@ +export interface Distribution { + status: string; + amount: number; +} \ No newline at end of file diff --git a/src/apis/anilist/interfaces/Favoured.ts b/src/apis/anilist/interfaces/Favoured.ts new file mode 100644 index 00000000..0f482f70 --- /dev/null +++ b/src/apis/anilist/interfaces/Favoured.ts @@ -0,0 +1,15 @@ +import {Tag} from "./Tag"; +import {Staff} from "./Staff"; +import {Studio} from "./Studio"; + +export interface Favoured { + genre?: string; + amount: number; + meanScore: number; + timeWatched: number; + tag?: Tag; + staff?: Staff; + studio?: Studio; + year?: number; + format?: string; +} \ No newline at end of file diff --git a/src/apis/anilist/interfaces/ListScores.ts b/src/apis/anilist/interfaces/ListScores.ts new file mode 100644 index 00000000..678d6ecf --- /dev/null +++ b/src/apis/anilist/interfaces/ListScores.ts @@ -0,0 +1,4 @@ +export interface ListScores { + meanScore: number; + standardDeviation: number; +} \ No newline at end of file diff --git a/src/apis/anilist/interfaces/Media.ts b/src/apis/anilist/interfaces/Media.ts index e01896a3..1dbb71b6 100644 --- a/src/apis/anilist/interfaces/Media.ts +++ b/src/apis/anilist/interfaces/Media.ts @@ -7,7 +7,7 @@ import { NextAiringEpisode } from './NextAiringEpisode' import { ExternalLink } from './ExternalLink' import { StreamingEpisode } from './StreamingEpisode' import { Ranking } from './Ranking' -import { Stats } from './Stats' +import { MediaStats } from './MediaStats' import { MediaListEntry } from './MediaListEntry' export interface Media { @@ -51,7 +51,7 @@ export interface Media { streamingEpisodes: StreamingEpisode[] rankings: Ranking[] mediaListEntry: MediaListEntry - stats: Stats + stats: MediaStats siteUrl: string autoCreateForumThread: boolean isRecommendationBlocked: boolean diff --git a/src/apis/anilist/interfaces/MediaStatistics.ts b/src/apis/anilist/interfaces/MediaStatistics.ts new file mode 100644 index 00000000..ea9e17b0 --- /dev/null +++ b/src/apis/anilist/interfaces/MediaStatistics.ts @@ -0,0 +1,23 @@ +import {Stat} from "./Stat"; + +export interface MediaStatistics { + count: number; + meanScore: number; + standardDeviation: number; + minutesWatched?: number; + episodesWatched?: number; + chaptersRead?: number; + volumesRead?: number; + formats: Stat[]; + statuses: Stat[]; + scores: Stat[]; + lengths: Stat[]; + releaseYears: Stat[]; + startYears: Stat[]; + genres: Stat[]; + tags: Stat[]; + countries: Stat[]; + voiceActors?: Stat[]; + staff: Stat[]; + studios: Stat[]; +} \ No newline at end of file diff --git a/src/apis/anilist/interfaces/Stats.ts b/src/apis/anilist/interfaces/MediaStats.ts similarity index 87% rename from src/apis/anilist/interfaces/Stats.ts rename to src/apis/anilist/interfaces/MediaStats.ts index 86a5bfda..522bbb8a 100644 --- a/src/apis/anilist/interfaces/Stats.ts +++ b/src/apis/anilist/interfaces/MediaStats.ts @@ -1,7 +1,7 @@ import { ScoreDistribution } from './ScoreDistribution' import { StatusDistribution } from './StatusDistribution' -export interface Stats { +export interface MediaStats { scoreDistribution: ScoreDistribution[] statusDistribution: StatusDistribution[] } diff --git a/src/apis/anilist/interfaces/Name.ts b/src/apis/anilist/interfaces/Name.ts index 9bf61490..ee8054dd 100644 --- a/src/apis/anilist/interfaces/Name.ts +++ b/src/apis/anilist/interfaces/Name.ts @@ -3,4 +3,6 @@ export interface Name { last: string full: string native: string + alternative: string + userPreferred: string } diff --git a/src/apis/anilist/interfaces/Staff.ts b/src/apis/anilist/interfaces/Staff.ts new file mode 100644 index 00000000..015b1263 --- /dev/null +++ b/src/apis/anilist/interfaces/Staff.ts @@ -0,0 +1,6 @@ +import {Name} from "./Name"; + +export interface Staff { + id: number; + name: Name; +} \ No newline at end of file diff --git a/src/apis/anilist/interfaces/Stat.ts b/src/apis/anilist/interfaces/Stat.ts new file mode 100644 index 00000000..bfb09403 --- /dev/null +++ b/src/apis/anilist/interfaces/Stat.ts @@ -0,0 +1,24 @@ +import {Tag} from "./Tag"; +import {Staff} from "./Staff"; +import {Studio} from "./Studio"; + +export interface Stat { + count: number; + meanScore: number; + minutesWatched?: number; + chaptersRead?: number; + mediaIds: number[]; + format?: string; + status?: string; + score?: number; + length?: number; + releaseYear?: number; + startYear?: number; + genre?: string; + tag?: Tag; + country?: string; + voiceActor?: Staff; + characterIds?: number[]; + staff?: Staff; + studio?: Studio; +} \ No newline at end of file diff --git a/src/apis/anilist/interfaces/Statistics.ts b/src/apis/anilist/interfaces/Statistics.ts new file mode 100644 index 00000000..b42f3f81 --- /dev/null +++ b/src/apis/anilist/interfaces/Statistics.ts @@ -0,0 +1,6 @@ +import {MediaStatistics} from "./MediaStatistics"; + +export interface Statistics { + anime: MediaStatistics; + manga: MediaStatistics; +} \ No newline at end of file diff --git a/src/apis/anilist/interfaces/Studio.ts b/src/apis/anilist/interfaces/Studio.ts new file mode 100644 index 00000000..9d973fea --- /dev/null +++ b/src/apis/anilist/interfaces/Studio.ts @@ -0,0 +1,4 @@ +export interface Studio { + id: number; + name: string; +} \ No newline at end of file diff --git a/src/apis/anilist/interfaces/Tag.ts b/src/apis/anilist/interfaces/Tag.ts index ab2cc70a..138e829d 100644 --- a/src/apis/anilist/interfaces/Tag.ts +++ b/src/apis/anilist/interfaces/Tag.ts @@ -2,6 +2,7 @@ export interface Tag { id: number name: string description: string + category: string rank: number isGeneralSpoiler: boolean isMediaSpoiler: boolean diff --git a/src/apis/anilist/interfaces/UserStats.ts b/src/apis/anilist/interfaces/UserStats.ts new file mode 100644 index 00000000..fe9bc538 --- /dev/null +++ b/src/apis/anilist/interfaces/UserStats.ts @@ -0,0 +1,25 @@ +import {ActivityHistory} from "./ActivityHistory"; +import {Distribution} from "./Distribution"; +import {ScoreDistribution} from "./ScoreDistribution"; +import {ListScores} from "./ListScores"; +import {Favoured} from "./Favoured"; + +export interface UserStats { + watchedTime: number; + chaptersRead: number; + activityHistory: ActivityHistory[]; + animeStatusDistribution: Distribution[]; + mangaStatusDistribution: Distribution[]; + animeScoreDistribution: ScoreDistribution[]; + mangaScoreDistribution: ScoreDistribution[]; + animeListScores: ListScores; + mangaListScores: ListScores; + favouredGenresOverview: Favoured[]; + favouredGenres: Favoured[]; + favouredTags: Favoured[]; + favouredActors: Favoured[]; + favouredStaff: Favoured[]; + favouredStudios: Favoured[]; + favouredYears: Favoured[]; + favouredFormats: Favoured[]; +} \ No newline at end of file diff --git a/src/apis/anilist/interfaces/responses/Media.ts b/src/apis/anilist/interfaces/responses/Media.ts index 6b6de1ae..3548d6a6 100644 --- a/src/apis/anilist/interfaces/responses/Media.ts +++ b/src/apis/anilist/interfaces/responses/Media.ts @@ -7,7 +7,7 @@ import { NextAiringEpisode } from '../NextAiringEpisode' import { ExternalLink } from '../ExternalLink' import { StreamingEpisode } from '../StreamingEpisode' import { Ranking } from '../Ranking' -import { Stats } from '../Stats' +import { MediaStats } from '../MediaStats' import { MediaListEntry } from '../MediaListEntry' import { Name } from '../Name' import { Image } from '../Image' @@ -110,7 +110,7 @@ export interface MediaResponse { streamingEpisodes: StreamingEpisode[] rankings: Ranking[] mediaListEntry: MediaListEntry - stats: Stats + stats: MediaStats siteUrl: string autoCreateForumThread: boolean isRecommendationBlocked: boolean diff --git a/src/apis/anilist/interfaces/responses/User.ts b/src/apis/anilist/interfaces/responses/User.ts index a8c49b07..60585faa 100644 --- a/src/apis/anilist/interfaces/responses/User.ts +++ b/src/apis/anilist/interfaces/responses/User.ts @@ -1,4 +1,6 @@ import { Image } from '../Image' +import {Statistics} from "../Statistics"; +import {UserStats} from "../UserStats"; export interface UserResponse { id: number @@ -53,10 +55,8 @@ export interface UserResponse { staff: any[] studios: any[] } - statistics: { - anime: any - manga: any - } + statistics: Statistics + stats: UserStats unreadNotificationCount: number siteUrl: string donatorTier: number diff --git a/src/apis/anilist/query/User.ts b/src/apis/anilist/query/User.ts index 5f1f9d3a..8eefde6c 100644 --- a/src/apis/anilist/query/User.ts +++ b/src/apis/anilist/query/User.ts @@ -9,6 +9,10 @@ interface UserVariables { search?: string sort?: string[] isHTML?: boolean + animeStatLimit?: number + mangaStatLimit?: number + animeStatSort?: string[] + mangaStatSort?: string[] } export class UserQuery extends APIWrapper { @@ -21,7 +25,7 @@ export class UserQuery extends APIWrapper { const { isHTML = true, ...rest } = variables != null ? variables : {} const query = ` - query ($id: Int, $name: String, $isModerator: Boolean, $search: String, $sort: [UserSort], $isHTML: Boolean) { + query ($id: Int, $name: String, $isModerator: Boolean, $search: String, $sort: [UserSort], $isHTML: Boolean, $animeStatLimit: Int, $mangaStatLimit: Int, $animeStatSort: [UserStatisticsSort], $mangaStatSort: [UserStatisticsSort]) { User (id: $id, name: $name, isModerator: $isModerator, search: $search, sort: $sort) { id name @@ -203,56 +207,56 @@ export class UserQuery extends APIWrapper { standardDeviation minutesWatched episodesWatched - formats { + formats (limit: $animeStatLimit, sort: $animeStatSort) { count meanScore minutesWatched mediaIds format } - statuses { + statuses (limit: $animeStatLimit, sort: $animeStatSort) { count meanScore minutesWatched mediaIds status } - scores { + scores (limit: $animeStatLimit, sort: $animeStatSort) { count meanScore minutesWatched mediaIds score } - lengths { + lengths (limit: $animeStatLimit, sort: $animeStatSort) { count meanScore minutesWatched mediaIds length } - releaseYears { + releaseYears (limit: $animeStatLimit, sort: $animeStatSort) { count meanScore minutesWatched mediaIds releaseYear } - startYears { + startYears (limit: $animeStatLimit, sort: $animeStatSort) { count meanScore minutesWatched mediaIds startYear } - genres { + genres (limit: $animeStatLimit, sort: $animeStatSort) { count meanScore minutesWatched mediaIds genre } - tags { + tags (limit: $animeStatLimit, sort: $animeStatSort) { count meanScore minutesWatched @@ -268,14 +272,14 @@ export class UserQuery extends APIWrapper { isAdult } } - countries { + countries (limit: $animeStatLimit, sort: $animeStatSort) { count meanScore minutesWatched mediaIds country } - voiceActors { + voiceActors (limit: $animeStatLimit, sort: $animeStatSort) { count meanScore minutesWatched @@ -293,7 +297,7 @@ export class UserQuery extends APIWrapper { } characterIds } - staff { + staff (limit: $animeStatLimit, sort: $animeStatSort) { count meanScore minutesWatched @@ -310,7 +314,7 @@ export class UserQuery extends APIWrapper { } } } - studios { + studios (limit: $animeStatLimit, sort: $animeStatSort) { count meanScore minutesWatched @@ -327,56 +331,56 @@ export class UserQuery extends APIWrapper { standardDeviation chaptersRead volumesRead - formats { + formats (limit: $mangaStatLimit, sort: $mangaStatSort) { count meanScore chaptersRead mediaIds format } - statuses { + statuses (limit: $mangaStatLimit, sort: $mangaStatSort) { count meanScore chaptersRead mediaIds status } - scores { + scores (limit: $mangaStatLimit, sort: $mangaStatSort) { count meanScore chaptersRead mediaIds score } - lengths { + lengths (limit: $mangaStatLimit, sort: $mangaStatSort) { count meanScore chaptersRead mediaIds length } - releaseYears { + releaseYears (limit: $mangaStatLimit, sort: $mangaStatSort) { count meanScore chaptersRead mediaIds releaseYear } - startYears { + startYears (limit: $mangaStatLimit, sort: $mangaStatSort) { count meanScore chaptersRead mediaIds startYear } - genres { + genres (limit: $mangaStatLimit, sort: $mangaStatSort) { count meanScore chaptersRead mediaIds genre } - tags { + tags (limit: $mangaStatLimit, sort: $mangaStatSort) { count meanScore chaptersRead @@ -392,14 +396,14 @@ export class UserQuery extends APIWrapper { isAdult } } - countries { + countries (limit: $mangaStatLimit, sort: $mangaStatSort) { count meanScore chaptersRead mediaIds country } - staff { + staff (limit: $mangaStatLimit, sort: $mangaStatSort) { count meanScore chaptersRead @@ -416,7 +420,7 @@ export class UserQuery extends APIWrapper { } } } - studios { + studios (limit: $mangaStatLimit, sort: $mangaStatSort) { count meanScore chaptersRead @@ -428,6 +432,116 @@ export class UserQuery extends APIWrapper { } } } + stats { + watchedTime + chaptersRead + activityHistory { + date + amount + level + } + animeStatusDistribution { + status + amount + } + mangaStatusDistribution { + status + amount + } + animeScoreDistribution { + score + amount + } + mangaScoreDistribution { + score + amount + } + animeListScores { + meanScore + standardDeviation + } + mangaListScores { + meanScore + standardDeviation + } + favouredGenresOverview { + genre + amount + meanScore + timeWatched + } + favouredGenres { + genre + amount + meanScore + timeWatched + } + favouredTags { + tag { + id + name + description + category + rank + isGeneralSpoiler + isMediaSpoiler + isAdult + } + amount + meanScore + timeWatched + } + favouredActors { + staff { + id + name { + first + last + full + native + alternative + userPreferred + } + } + amount + meanScore + timeWatched + } + favouredStaff { + staff { + id + name { + first + last + full + native + alternative + userPreferred + } + } + amount + meanScore + timeWatched + } + favouredStudios { + studio { + id + name + } + amount + meanScore + timeWatched + } + favouredYears { + year + amount + meanScore + } + favouredFormats { + format + amount + } + } unreadNotificationCount siteUrl donatorTier