remove "with" prefix for fields
This commit is contained in:
parent
b4777671d7
commit
abb8894bab
10
README.md
10
README.md
|
@ -95,11 +95,11 @@ you want.
|
|||
|
||||
```js
|
||||
const query = Client().query.MediaList({ userName: "Josh" }, (fields) => {
|
||||
fields.withId()
|
||||
fields.withUserId()
|
||||
.withPrivate()
|
||||
.withStartedAt((fields) => fields.withYear().withMonth().withDay())
|
||||
.withCompletedAt((fields) => fields.withYear().withMonth().withDay())
|
||||
fields.id()
|
||||
fields.userId()
|
||||
.private()
|
||||
.startedAt((fields) => fields.year().month().day())
|
||||
.completedAt((fields) => fields.year().month().day())
|
||||
})
|
||||
|
||||
await query.fetch()
|
||||
|
|
|
@ -2,67 +2,67 @@ import { Client } from "../mod.ts"
|
|||
|
||||
const query = Client().query.Media({ id: 1 }, (media) =>
|
||||
media
|
||||
.withId()
|
||||
.withIdMal()
|
||||
.withTitle((title) => title.userPreferred())
|
||||
.withType()
|
||||
.withFormat()
|
||||
.withStatus()
|
||||
.withDescription()
|
||||
.withStartDate((start) => start.withYear().withMonth().withDay())
|
||||
.withEndDate((end) => end.withYear().withMonth().withDay())
|
||||
.withSeason()
|
||||
.withSeasonYear()
|
||||
.withSeasonInt()
|
||||
.withEpisodes()
|
||||
.withDuration()
|
||||
.withChapters()
|
||||
.withVolumes()
|
||||
.withCountryOfOrigin()
|
||||
.withIsLicensed()
|
||||
.withSource()
|
||||
.withHashtag()
|
||||
.withTrailer((trailer) => trailer.withId())
|
||||
.withUpdatedAt()
|
||||
.withCoverImage((cover) => cover.withMedium())
|
||||
.withBannerImage()
|
||||
.withGenres()
|
||||
.withSynonyms()
|
||||
.withAverageScore()
|
||||
.withMeanScore()
|
||||
.withPopularity()
|
||||
.withIsLocked()
|
||||
.withTrending()
|
||||
.withFavourites()
|
||||
.withTags((tags) => tags.withId())
|
||||
.withRelations((relations) =>
|
||||
.id()
|
||||
.idMal()
|
||||
.title((title) => title.userPreferred())
|
||||
.type()
|
||||
.format()
|
||||
.status()
|
||||
.description()
|
||||
.startDate((start) => start.year().month().day())
|
||||
.endDate((end) => end.year().month().day())
|
||||
.season()
|
||||
.seasonYear()
|
||||
.seasonInt()
|
||||
.episodes()
|
||||
.duration()
|
||||
.chapters()
|
||||
.volumes()
|
||||
.countryOfOrigin()
|
||||
.isLicensed()
|
||||
.source()
|
||||
.hashtag()
|
||||
.trailer((trailer) => trailer.id())
|
||||
.updatedAt()
|
||||
.coverImage((cover) => cover.medium())
|
||||
.bannerImage()
|
||||
.genres()
|
||||
.synonyms()
|
||||
.averageScore()
|
||||
.meanScore()
|
||||
.popularity()
|
||||
.isLocked()
|
||||
.trending()
|
||||
.favourites()
|
||||
.tags((tags) => tags.id())
|
||||
.relations((relations) =>
|
||||
relations
|
||||
.withEdges((e) => e.withNode((n) => n.withId()))
|
||||
.withNodes((n) => n.withId())
|
||||
.withPageInfo((p) => p.withTotal())
|
||||
.edges((e) => e.node((n) => n.id()))
|
||||
.nodes((n) => n.id())
|
||||
.pageInfo((p) => p.total())
|
||||
)
|
||||
.withCharacters(undefined, (character) =>
|
||||
.characters(undefined, (character) =>
|
||||
character
|
||||
.withEdges((e) => e.withNode((n) => n.withId()))
|
||||
.withNodes((n) => n.withId())
|
||||
.withPageInfo((p) => p.withTotal()))
|
||||
.withStaff(undefined, (staff) =>
|
||||
.edges((e) => e.node((n) => n.id()))
|
||||
.nodes((n) => n.id())
|
||||
.pageInfo((p) => p.total()))
|
||||
.staff(undefined, (staff) =>
|
||||
staff
|
||||
.withEdges((e) => e.withNode((n) => n.withId()))
|
||||
.withNodes((n) => n.withId())
|
||||
.withPageInfo((p) => p.withTotal()))
|
||||
.withStudios(undefined, (studio) =>
|
||||
.edges((e) => e.node((n) => n.id()))
|
||||
.nodes((n) => n.id())
|
||||
.pageInfo((p) => p.total()))
|
||||
.studios(undefined, (studio) =>
|
||||
studio
|
||||
.withEdges((e) => e.withNode((n) => n.withId()))
|
||||
.withNodes((n) => n.withId())
|
||||
.withPageInfo((p) => p.withTotal()))
|
||||
.withIsFavourite()
|
||||
.withIsFavouriteBlocked()
|
||||
.withIsAdult()
|
||||
.withNextAiringEpisode((ep) => ep.withAiringAt())
|
||||
.withExternalLinks((links) => links.withId())
|
||||
.withStreamingEpisodes((ep) => ep.withSite())
|
||||
.withRankings((rank) => rank.withRank())
|
||||
.withMediaListEntry((entry) => entry.withId()))
|
||||
.edges((e) => e.node((n) => n.id()))
|
||||
.nodes((n) => n.id())
|
||||
.pageInfo((p) => p.total()))
|
||||
.isFavourite()
|
||||
.isFavouriteBlocked()
|
||||
.isAdult()
|
||||
.nextAiringEpisode((ep) => ep.airingAt())
|
||||
.externalLinks((links) => links.id())
|
||||
.streamingEpisodes((ep) => ep.site())
|
||||
.rankings((rank) => rank.rank())
|
||||
.mediaListEntry((entry) => entry.id()))
|
||||
|
||||
console.log(await query.fetch())
|
||||
|
|
|
@ -3,10 +3,10 @@ import { Client } from "../mod.ts"
|
|||
const page = Client().query.Page(
|
||||
{ perPage: 1 },
|
||||
(page) =>
|
||||
page.withMedia(
|
||||
page.media(
|
||||
{ search: "Kamisama Ni Natta" },
|
||||
(media) =>
|
||||
media.withTitle(
|
||||
media.title(
|
||||
(title) => title.userPreferred(),
|
||||
),
|
||||
),
|
||||
|
|
|
@ -4,12 +4,12 @@ import { MediaType } from "../src/types/generated/graphql.ts"
|
|||
const query = Client().query.Page(
|
||||
{ perPage: 1 },
|
||||
(page) =>
|
||||
page.withMedia(
|
||||
page.media(
|
||||
{ type: MediaType.Anime },
|
||||
(media) =>
|
||||
media.withTitle(
|
||||
media.title(
|
||||
(title) => title.userPreferred(),
|
||||
).withId().withDescription(),
|
||||
).id().description(),
|
||||
),
|
||||
)
|
||||
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import { Client } from "../mod.ts"
|
||||
import { MediaType } from "../src/types/generated/graphql.ts"
|
||||
|
||||
// const query = anilist.query.media("Kamisama Ni Natta Hi").withId().withTitles().withGenres();
|
||||
// const query = anilist.query.media("Kamisama Ni Natta Hi").id().titles().genres();
|
||||
const query = Client().query.Media(
|
||||
{ type: MediaType.Anime, search: "Kamisama Ni Natta Hi" },
|
||||
(media) =>
|
||||
media
|
||||
.withId()
|
||||
.withTitle((title) => title.userPreferred())
|
||||
.withGenres(),
|
||||
.id()
|
||||
.title((title) => title.userPreferred())
|
||||
.genres(),
|
||||
)
|
||||
console.log(query.raw.get()) /*
|
||||
query {
|
||||
|
|
102
src/anilist.ts
102
src/anilist.ts
|
@ -197,15 +197,15 @@ const fetch: Fetch = async (init) => {
|
|||
}
|
||||
|
||||
export const FuzzyDate = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withDay(op?: { alias?: string }) {
|
||||
day(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "day", level })
|
||||
return this
|
||||
},
|
||||
withMonth(op?: { alias?: string }) {
|
||||
month(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "month", level })
|
||||
return this
|
||||
},
|
||||
withYear(op?: { alias?: string }) {
|
||||
year(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "year", level })
|
||||
return this
|
||||
},
|
||||
|
@ -213,7 +213,7 @@ export const FuzzyDate = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
export const Deleted = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** If an item has been successfully deleted */
|
||||
withDeleted(op?: { alias?: string }) {
|
||||
deleted(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "deleted", level })
|
||||
console.log("asd")
|
||||
return this
|
||||
|
@ -271,7 +271,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Media({ operation, level: 2 }))
|
||||
else Media({ operation, level: 2 }).withId()
|
||||
else Media({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Media Trend query */
|
||||
|
@ -286,7 +286,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(MediaTrend({ operation, level: 2 }))
|
||||
else MediaTrend({ operation, level: 2 }).withMediaId()
|
||||
else MediaTrend({ operation, level: 2 }).mediaId()
|
||||
return this
|
||||
},
|
||||
/** Airing schedule query */
|
||||
|
@ -305,7 +305,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(AiringSchedule({ operation, level: 2 }))
|
||||
else AiringSchedule({ operation, level: 2 }).withId()
|
||||
else AiringSchedule({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Character query */
|
||||
|
@ -320,7 +320,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Character({ operation, level: 2 }))
|
||||
else Character({ operation, level: 2 }).withId()
|
||||
else Character({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Staff query */
|
||||
|
@ -333,7 +333,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Staff({ operation, level: 2 }))
|
||||
else Staff({ operation, level: 2 }).withId()
|
||||
else Staff({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Media list query */
|
||||
|
@ -348,7 +348,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(MediaList({ operation, level: 2 }))
|
||||
else MediaList({ operation, level: 2 }).withId()
|
||||
else MediaList({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Media list collection query, provides list pre-grouped by status & custom lists. User ID and Media Type arguments required. */
|
||||
|
@ -367,7 +367,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(MediaListCollection({ operation, level: 2 }))
|
||||
else MediaListCollection({ operation, level: 2 }).withUser()
|
||||
else MediaListCollection({ operation, level: 2 }).user()
|
||||
return this
|
||||
},
|
||||
/** Collection of all the possible media genres */
|
||||
|
@ -387,7 +387,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op?.fn) op.fn(MediaTag({ operation, level: 2 }))
|
||||
else MediaTag({ operation, level: 2 }).withId()
|
||||
else MediaTag({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** User query */
|
||||
|
@ -400,7 +400,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
else User({ operation, level: 2 }).withId()
|
||||
else User({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Get the currently authenticated user */
|
||||
|
@ -412,7 +412,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
else User({ operation, level: 2 }).withId()
|
||||
else User({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Notification query */
|
||||
|
@ -443,7 +443,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Studio({ operation, level: 2 }))
|
||||
else Studio({ operation, level: 2 }).withId()
|
||||
else Studio({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Review query */
|
||||
|
@ -456,7 +456,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Review({ operation, level: 2 }))
|
||||
else Review({ operation, level: 2 }).withId()
|
||||
else Review({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Activity query */
|
||||
|
@ -477,9 +477,9 @@ export const Client = function (auth?: { token: string }) {
|
|||
if (op.fn) op.fn(ActivityUnion({ operation, level: 2 }))
|
||||
else {
|
||||
ActivityUnion({ operation, level: 2 })
|
||||
.withListActivity()
|
||||
.withMessageActivity()
|
||||
.withTextActivity()
|
||||
.listActivity()
|
||||
.messageActivity()
|
||||
.textActivity()
|
||||
}
|
||||
return this
|
||||
},
|
||||
|
@ -499,7 +499,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(ActivityReply({ operation, level: 2 }))
|
||||
else ActivityReply({ operation, level: 2 }).withId()
|
||||
else ActivityReply({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Follow query */
|
||||
|
@ -514,7 +514,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
else User({ operation, level: 2 }).withId()
|
||||
else User({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Follow query */
|
||||
|
@ -529,7 +529,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
else User({ operation, level: 2 }).withId()
|
||||
else User({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Thread query */
|
||||
|
@ -542,7 +542,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Thread({ operation, level: 2 }))
|
||||
else Thread({ operation, level: 2 }).withId()
|
||||
else Thread({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Comment query */
|
||||
|
@ -561,7 +561,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(ThreadComment({ operation, level: 2 }))
|
||||
else ThreadComment({ operation, level: 2 }).withId()
|
||||
else ThreadComment({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Recommendation query */
|
||||
|
@ -580,7 +580,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Recommendation({ operation, level: 2 }))
|
||||
else Recommendation({ operation, level: 2 }).withId()
|
||||
else Recommendation({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Like query */
|
||||
|
@ -593,7 +593,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
else User({ operation, level: 2 }).withId()
|
||||
else User({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Provide AniList markdown to be converted to html (Requires auth) */
|
||||
|
@ -606,13 +606,13 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Markdown({ operation, level: 2 }))
|
||||
else Markdown({ operation, level: 2 }).withHtml()
|
||||
else Markdown({ operation, level: 2 }).html()
|
||||
return this
|
||||
},
|
||||
AniChartUser(op?: { alias?: string; fn?: Fn<typeof AniChartUser> }) {
|
||||
operation.set({ alias: op?.alias, subField: "AniChartUser", hasSubField: true, level: 1 })
|
||||
if (op?.fn) op.fn(AniChartUser({ operation, level: 2 }))
|
||||
else AniChartUser({ operation, level: 2 }).withUser()
|
||||
else AniChartUser({ operation, level: 2 }).user()
|
||||
return this
|
||||
},
|
||||
/** Site statistics query */
|
||||
|
@ -642,7 +642,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(ExternalLinkSourceCollection({ operation, level: 2 }))
|
||||
else ExternalLinkSourceCollection({ operation, level: 2 }).withId()
|
||||
else ExternalLinkSourceCollection({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
}
|
||||
|
@ -676,7 +676,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
else User({ operation, level: 2 }).withId()
|
||||
else User({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Create or update a media list entry */
|
||||
|
@ -691,7 +691,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(MediaList({ operation, level: 2 }))
|
||||
else MediaList({ operation, level: 2 }).withId()
|
||||
else MediaList({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Update multiple media list entries to the same values */
|
||||
|
@ -710,7 +710,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(MediaList({ operation, level: 2 }))
|
||||
else MediaList({ operation, level: 2 }).withId()
|
||||
else MediaList({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Delete a media list entry */
|
||||
|
@ -722,7 +722,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
Deleted({ operation, level: 2 }).deleted()
|
||||
return this
|
||||
},
|
||||
/** Delete a custom list and remove the list entries from it */
|
||||
|
@ -734,7 +734,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
Deleted({ operation, level: 2 }).deleted()
|
||||
return this
|
||||
},
|
||||
/** Create or update text activity for the currently authenticated user */
|
||||
|
@ -749,7 +749,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(TextActivity({ operation, level: 2 }))
|
||||
else TextActivity({ operation, level: 2 }).withId()
|
||||
else TextActivity({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Create or update message activity for the currently authenticated user */
|
||||
|
@ -768,7 +768,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(MessageActivity({ operation, level: 2 }))
|
||||
else MessageActivity({ operation, level: 2 }).withId()
|
||||
else MessageActivity({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Update list activity (Mod Only) */
|
||||
|
@ -783,7 +783,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(ListActivity({ operation, level: 2 }))
|
||||
else ListActivity({ operation, level: 2 }).withId()
|
||||
else ListActivity({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Delete an activity item of the authenticated users */
|
||||
|
@ -795,7 +795,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
Deleted({ operation, level: 2 }).deleted()
|
||||
return this
|
||||
},
|
||||
/** Toggle activity to be pinned to the top of the user's activity feed */
|
||||
|
@ -846,7 +846,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(ActivityReply({ operation, level: 2 }))
|
||||
else ActivityReply({ operation, level: 2 }).withId()
|
||||
else ActivityReply({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Delete an activity reply of the authenticated users */
|
||||
|
@ -858,7 +858,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
Deleted({ operation, level: 2 }).deleted()
|
||||
return this
|
||||
},
|
||||
/** Add or remove a like from a likeable type. Returns all the users who liked the same model */
|
||||
|
@ -871,7 +871,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
else User({ operation, level: 2 }).withId()
|
||||
else User({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Add or remove a like from a likeable type. */
|
||||
|
@ -898,7 +898,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
else User({ operation, level: 2 }).withId()
|
||||
else User({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Favourite or unfavourite an anime, manga, character, staff member, or studio */
|
||||
|
@ -939,7 +939,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(Review({ operation, level: 2 }))
|
||||
else Review({ operation, level: 2 }).withId()
|
||||
else Review({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Delete a review */
|
||||
|
@ -951,7 +951,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
Deleted({ operation, level: 2 }).deleted()
|
||||
return this
|
||||
},
|
||||
/** Rate a review */
|
||||
|
@ -964,7 +964,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(Review({ operation, level: 2 }))
|
||||
else Review({ operation, level: 2 }).withId()
|
||||
else Review({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Recommendation a media */
|
||||
|
@ -983,7 +983,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(Recommendation({ operation, level: 2 }))
|
||||
else Recommendation({ operation, level: 2 }).withId()
|
||||
else Recommendation({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Create or update a forum thread */
|
||||
|
@ -996,7 +996,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(Thread({ operation, level: 2 }))
|
||||
else Thread({ operation, level: 2 }).withId()
|
||||
else Thread({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Delete a thread */
|
||||
|
@ -1008,7 +1008,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
Deleted({ operation, level: 2 }).deleted()
|
||||
return this
|
||||
},
|
||||
/** Toggle the subscription of a forum thread */
|
||||
|
@ -1027,7 +1027,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(Thread({ operation, level: 2 }))
|
||||
else Thread({ operation, level: 2 }).withId()
|
||||
else Thread({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Create or update a thread comment */
|
||||
|
@ -1046,7 +1046,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(ThreadComment({ operation, level: 2 }))
|
||||
else ThreadComment({ operation, level: 2 }).withId()
|
||||
else ThreadComment({ operation, level: 2 }).id()
|
||||
return this
|
||||
},
|
||||
/** Delete a thread comment */
|
||||
|
@ -1058,7 +1058,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
Deleted({ operation, level: 2 }).deleted()
|
||||
return this
|
||||
},
|
||||
UpdateAniChartSettings() {
|
||||
|
|
|
@ -4,52 +4,52 @@ import { User } from "./User.ts"
|
|||
|
||||
export const ActivityReply = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the reply */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the replies creator */
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the parent activity */
|
||||
withActivityId(op?: { alias?: string }) {
|
||||
activityId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "activityId", level })
|
||||
return this
|
||||
},
|
||||
/** The reply text */
|
||||
withText(op?: { alias?: string; args?: ActivityReplyTextArgs }) {
|
||||
text(op?: { alias?: string; args?: ActivityReplyTextArgs }) {
|
||||
operation.set({ alias: op?.alias, subField: "text", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the reply has */
|
||||
withLikeCount(op?: { alias?: string }) {
|
||||
likeCount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the reply */
|
||||
withIsLiked(op?: { alias?: string }) {
|
||||
isLiked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLiked", level })
|
||||
return this
|
||||
},
|
||||
/** The time the reply was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The user who created reply */
|
||||
withUser(op: { alias?: string; fn: Fn<typeof User> }) {
|
||||
user(op: { alias?: string; fn: Fn<typeof User> }) {
|
||||
operation.set({ alias: op.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The users who liked the reply */
|
||||
withLikes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
likes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "likes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -9,282 +9,282 @@ import { User } from "./User.ts"
|
|||
|
||||
export const TextActivity = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the activity */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the activity's creator */
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of activity */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The number of activity replies */
|
||||
withReplyCount(op?: { alias?: string }) {
|
||||
replyCount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "replyCount", level })
|
||||
return this
|
||||
},
|
||||
/** The status text (Markdown) */
|
||||
withText(op?: { alias?: string; args?: TextActivityTextArgs }) {
|
||||
text(op?: { alias?: string; args?: TextActivityTextArgs }) {
|
||||
operation.set({ alias: op?.alias, subField: "text", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** The url for the activity page on the AniList website */
|
||||
withSiteUrl(op?: { alias?: string }) {
|
||||
siteUrl(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** If the activity is locked and can receive replies */
|
||||
withIsLocked(op?: { alias?: string }) {
|
||||
isLocked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user is subscribed to the activity */
|
||||
withIsSubscribed(op?: { alias?: string }) {
|
||||
isSubscribed(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isSubscribed", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the activity has */
|
||||
withLikeCount(op?: { alias?: string }) {
|
||||
likeCount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the activity */
|
||||
withIsLiked(op?: { alias?: string }) {
|
||||
isLiked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLiked", level })
|
||||
return this
|
||||
},
|
||||
/** If the activity is pinned to the top of the users activity feed */
|
||||
withIsPinned(op?: { alias?: string }) {
|
||||
isPinned(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isPinned", level })
|
||||
return this
|
||||
},
|
||||
/** The time the activity was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The user who created the activity */
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The written replies to the activity */
|
||||
withReplies(op?: { alias?: string; fn?: Fn<typeof ActivityReply> }) {
|
||||
replies(op?: { alias?: string; fn?: Fn<typeof ActivityReply> }) {
|
||||
operation.set({ alias: op?.alias, subField: "replies", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(ActivityReply({ operation, level: level + 1 }))
|
||||
else ActivityReply({ operation, level: level + 1 }).withId()
|
||||
else ActivityReply({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The users who liked the activity */
|
||||
withLikes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
likes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "likes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const ListActivity = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the activity */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the activity's creator */
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of activity */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The number of activity replies */
|
||||
withReplyCount(op?: { alias?: string }) {
|
||||
replyCount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "replyCount", level })
|
||||
return this
|
||||
},
|
||||
/** The list item's textual status */
|
||||
withStatus(op?: { alias?: string }) {
|
||||
status(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "status", level })
|
||||
return this
|
||||
},
|
||||
/** The list progress made */
|
||||
withProgress(op?: { alias?: string }) {
|
||||
progress(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "progress", level })
|
||||
return this
|
||||
},
|
||||
/** If the activity is locked and can receive replies */
|
||||
withIsLocked(op?: { alias?: string }) {
|
||||
isLocked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user is subscribed to the activity */
|
||||
withIsSubscribed(op?: { alias?: string }) {
|
||||
isSubscribed(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isSubscribed", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the activity has */
|
||||
withLikeCount(op?: { alias?: string }) {
|
||||
likeCount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the activity */
|
||||
withIsLiked(op?: { alias?: string }) {
|
||||
isLiked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLiked", level })
|
||||
return this
|
||||
},
|
||||
/** If the activity is pinned to the top of the users activity feed */
|
||||
withIsPinned(op?: { alias?: string }) {
|
||||
isPinned(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isPinned", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the activity page on the AniList website */
|
||||
withSiteUrl(op?: { alias?: string }) {
|
||||
siteUrl(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** The time the activity was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The owner of the activity */
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The associated media to the activity update */
|
||||
withMedia(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
media(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "media", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The written replies to the activity */
|
||||
withReplies(op?: { alias?: string; fn?: Fn<typeof ActivityReply> }) {
|
||||
replies(op?: { alias?: string; fn?: Fn<typeof ActivityReply> }) {
|
||||
operation.set({ alias: op?.alias, subField: "replies", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(ActivityReply({ operation, level: level + 1 }))
|
||||
else ActivityReply({ operation, level: level + 1 }).withId()
|
||||
else ActivityReply({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The users who liked the activity */
|
||||
withLikes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
likes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "likes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const MessageActivity = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the activity */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the activity's recipient */
|
||||
withRecipientId(op?: { alias?: string }) {
|
||||
recipientId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "recipientId", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the activity's sender */
|
||||
withMessengerId(op?: { alias?: string }) {
|
||||
messengerId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "messengerId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of the activity */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The number of activity replies */
|
||||
withReplyCount(op?: { alias?: string }) {
|
||||
replyCount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "replyCount", level })
|
||||
return this
|
||||
},
|
||||
/** The message text (Markdown) */
|
||||
withMessage(op?: { alias?: string; args?: MessageActivityMessageArgs }) {
|
||||
message(op?: { alias?: string; args?: MessageActivityMessageArgs }) {
|
||||
operation.set({ alias: op?.alias, subField: "message", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** If the activity is locked and can receive replies */
|
||||
withIsLocked(op?: { alias?: string }) {
|
||||
isLocked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user is subscribed to the activity */
|
||||
withIsSubscribed(op?: { alias?: string }) {
|
||||
isSubscribed(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isSubscribed", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the activity has */
|
||||
withLikeCount(op?: { alias?: string }) {
|
||||
likeCount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the activity */
|
||||
withIsLiked(op?: { alias?: string }) {
|
||||
isLiked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLiked", level })
|
||||
return this
|
||||
},
|
||||
/** If the message is private and only viewable to the sender and recipients */
|
||||
withIsPrivate(op?: { alias?: string }) {
|
||||
isPrivate(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isPrivate", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the activity page on the AniList website */
|
||||
withSiteUrl(op?: { alias?: string }) {
|
||||
siteUrl(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** The time the activity was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The user who the activity message was sent to */
|
||||
withRecipient(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
recipient(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "recipient", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The user who sent the activity message */
|
||||
withMessenger(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
messenger(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "messenger", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The written replies to the activity */
|
||||
withReplies(op?: { alias?: string; fn?: Fn<typeof ActivityReply> }) {
|
||||
replies(op?: { alias?: string; fn?: Fn<typeof ActivityReply> }) {
|
||||
operation.set({ alias: op?.alias, subField: "replies", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(ActivityReply({ operation, level: level + 1 }))
|
||||
else ActivityReply({ operation, level: level + 1 }).withId()
|
||||
else ActivityReply({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The users who liked the activity */
|
||||
withLikes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
likes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "likes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const ActivityUnion = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withTextActivity(op?: { alias?: string; fn?: Fn<typeof TextActivity> }) {
|
||||
textActivity(op?: { alias?: string; fn?: Fn<typeof TextActivity> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "TextActivity",
|
||||
|
@ -293,10 +293,10 @@ export const ActivityUnion = ({ operation, level }: Fields<OperationParser>) =>
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(TextActivity({ operation, level: level + 1 }))
|
||||
else TextActivity({ operation, level: level + 1 }).withId()
|
||||
else TextActivity({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withListActivity(op?: { alias?: string; fn?: Fn<typeof ListActivity> }) {
|
||||
listActivity(op?: { alias?: string; fn?: Fn<typeof ListActivity> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ListActivity",
|
||||
|
@ -305,10 +305,10 @@ export const ActivityUnion = ({ operation, level }: Fields<OperationParser>) =>
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ListActivity({ operation, level: level + 1 }))
|
||||
else ListActivity({ operation, level: level + 1 }).withId()
|
||||
else ListActivity({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withMessageActivity(op?: { alias?: string; fn?: Fn<typeof MessageActivity> }) {
|
||||
messageActivity(op?: { alias?: string; fn?: Fn<typeof MessageActivity> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "MessageActivity",
|
||||
|
@ -317,7 +317,7 @@ export const ActivityUnion = ({ operation, level }: Fields<OperationParser>) =>
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(MessageActivity({ operation, level: level + 1 }))
|
||||
else MessageActivity({ operation, level: level + 1 }).withId()
|
||||
else MessageActivity({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -3,31 +3,31 @@ import { Media } from "./Media.ts"
|
|||
import { PageInfo } from "./Page.ts"
|
||||
|
||||
const AiringScheduleEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op: { alias?: string; fn: Fn<typeof AiringSchedule> }) {
|
||||
node(op: { alias?: string; fn: Fn<typeof AiringSchedule> }) {
|
||||
operation.set({ alias: op.alias, subField: "node", level, hasSubField: true })
|
||||
op.fn(AiringSchedule({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The id of the connection */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const AiringScheduleConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op: { alias?: string; fn: Fn<typeof AiringScheduleEdge> }) {
|
||||
edges(op: { alias?: string; fn: Fn<typeof AiringScheduleEdge> }) {
|
||||
operation.set({ alias: op.alias, subField: "edges", level, hasSubField: true })
|
||||
op.fn(AiringScheduleEdge({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withNodes(op: { alias?: string; fn: Fn<typeof AiringSchedule> }) {
|
||||
nodes(op: { alias?: string; fn: Fn<typeof AiringSchedule> }) {
|
||||
operation.set({ alias: op.alias, subField: "nodes", level, hasSubField: true })
|
||||
op.fn(AiringSchedule({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
pageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ alias: op.alias, subField: "pageInfo", level, hasSubField: true })
|
||||
op.fn(PageInfo({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
@ -36,35 +36,35 @@ export const AiringScheduleConnection = ({ operation, level }: Fields<OperationP
|
|||
|
||||
export const AiringSchedule = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the airing schedule item */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The time the episode airs at */
|
||||
withAiringAt(op?: { alias?: string }) {
|
||||
airingAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "airingAt", level })
|
||||
return this
|
||||
},
|
||||
/** Seconds until episode starts airing */
|
||||
withTimeUntilAiring(op?: { alias?: string }) {
|
||||
timeUntilAiring(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "timeUntilAiring", level })
|
||||
return this
|
||||
},
|
||||
/** The airing episode number */
|
||||
withEpisode(op?: { alias?: string }) {
|
||||
episode(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "episode", level })
|
||||
return this
|
||||
},
|
||||
/** The associate media id of the airing episode */
|
||||
withMediaId(op?: { alias?: string }) {
|
||||
mediaId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The associate media of the airing episode */
|
||||
withMedia(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
media(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "media", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -2,17 +2,17 @@ import { Fields, Fn, OperationParser } from "../types/Anilist.ts"
|
|||
import { User } from "./User.ts"
|
||||
|
||||
export const AniChartUser = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withSettings(op?: { alias?: string }) {
|
||||
settings(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "settings", level })
|
||||
return this
|
||||
},
|
||||
withHighlights(op?: { alias?: string }) {
|
||||
highlights(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "highlights", level })
|
||||
return this
|
||||
},
|
||||
|
|
|
@ -13,37 +13,37 @@ import { AtLeastOne } from "../types/AtLeastOne.ts"
|
|||
|
||||
const CharacterName = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The person's given name */
|
||||
withFirst(op?: { alias?: string }) {
|
||||
first(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "first", level })
|
||||
return this
|
||||
},
|
||||
/** The person's middle name */
|
||||
withMiddle(op?: { alias?: string }) {
|
||||
middle(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "middle", level })
|
||||
return this
|
||||
},
|
||||
/** The person's surname */
|
||||
withLast(op?: { alias?: string }) {
|
||||
last(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "last", level })
|
||||
return this
|
||||
},
|
||||
/** The person's first and last name */
|
||||
withFull(op?: { alias?: string }) {
|
||||
full(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "full", level })
|
||||
return this
|
||||
},
|
||||
/** The person's full name in their native language */
|
||||
withNative(op?: { alias?: string }) {
|
||||
native(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "native", level })
|
||||
return this
|
||||
},
|
||||
/** Other names the staff member might be referred to as (pen names) */
|
||||
withAlternative(op?: { alias?: string }) {
|
||||
alternative(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "alternative", level })
|
||||
return this
|
||||
},
|
||||
/** The currently authenticated users preferred name language. Default romaji for non-authenticated */
|
||||
withUserPreferred(op?: { alias?: string }) {
|
||||
userPreferred(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userPreferred", level })
|
||||
return this
|
||||
},
|
||||
|
@ -51,41 +51,41 @@ const CharacterName = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
const CharacterImage = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The person's image of media at its largest size */
|
||||
withLarge(op?: { alias?: string }) {
|
||||
large(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "large", level })
|
||||
return this
|
||||
},
|
||||
/** The person's image of media at medium size */
|
||||
withMedium(op?: { alias?: string }) {
|
||||
medium(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "medium", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const CharacterEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op: { alias?: string; fn: Fn<typeof Character> }) {
|
||||
node(op: { alias?: string; fn: Fn<typeof Character> }) {
|
||||
operation.set({ alias: op.alias, subField: "node", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Character({ operation, level: level + 1 }))
|
||||
else Character({ operation, level: level + 1 }).withId()
|
||||
else Character({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The id of the connection */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The characters role in the media */
|
||||
withRole(op?: { alias?: string }) {
|
||||
role(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "role", level })
|
||||
return this
|
||||
},
|
||||
/** Media specific character name */
|
||||
withName(op?: { alias?: string }) {
|
||||
name(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
/** The voice actors of the character */
|
||||
withVoiceActors(
|
||||
voiceActors(
|
||||
op?: { alias?: string; args?: AtLeastOne<CharacterEdgeVoiceActorsArgs>; fn?: Fn<typeof Staff> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -96,11 +96,11 @@ const CharacterEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
hasSubField: true,
|
||||
})
|
||||
if (op?.fn) op.fn(Staff({ operation, level: level + 1 }))
|
||||
else Staff({ operation, level: level + 1 }).withId()
|
||||
else Staff({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The voice actors of the character with role date */
|
||||
withVoiceActorRoles(
|
||||
voiceActorRoles(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<CharacterEdgeVoiceActorRolesArgs>
|
||||
|
@ -118,34 +118,34 @@ const CharacterEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The media the character is in */
|
||||
withMedia(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
media(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "media", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The order the character should be displayed from the users favourites */
|
||||
withFavouriteOrder(op?: { alias?: string }) {
|
||||
favouriteOrder(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favouriteOrder", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const CharacterConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { alias?: string; fn?: Fn<typeof CharacterEdge> }) {
|
||||
edges(op?: { alias?: string; fn?: Fn<typeof CharacterEdge> }) {
|
||||
operation.set({ alias: op?.alias, subField: "edges", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(CharacterEdge({ operation, level: level + 1 }))
|
||||
else CharacterEdge({ operation, level: level + 1 }).withId()
|
||||
else CharacterEdge({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { alias?: string; fn?: Fn<typeof Character> }) {
|
||||
nodes(op?: { alias?: string; fn?: Fn<typeof Character> }) {
|
||||
operation.set({ alias: op?.alias, subField: "nodes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Character({ operation, level: level + 1 }))
|
||||
else Character({ operation, level: level + 1 }).withId()
|
||||
else Character({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
pageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ alias: op.alias, subField: "pageInfo", level, hasSubField: true })
|
||||
op.fn(PageInfo({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
@ -154,68 +154,68 @@ export const CharacterConnection = ({ operation, level }: Fields<OperationParser
|
|||
|
||||
export const Character = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the character */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The names of the character */
|
||||
withName(op?: { alias?: string; fn?: Fn<typeof CharacterName> }) {
|
||||
name(op?: { alias?: string; fn?: Fn<typeof CharacterName> }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(CharacterName({ operation, level: level + 1 }))
|
||||
else CharacterName({ operation, level: level + 1 }).withUserPreferred()
|
||||
else CharacterName({ operation, level: level + 1 }).userPreferred()
|
||||
return this
|
||||
},
|
||||
/** Character images */
|
||||
withImage(op?: { alias?: string; fn?: Fn<typeof CharacterImage> }) {
|
||||
image(op?: { alias?: string; fn?: Fn<typeof CharacterImage> }) {
|
||||
operation.set({ alias: op?.alias, subField: "image", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(CharacterImage({ operation, level: level + 1 }))
|
||||
else CharacterImage({ operation, level: level + 1 }).withMedium()
|
||||
else CharacterImage({ operation, level: level + 1 }).medium()
|
||||
return this
|
||||
},
|
||||
/** A general description of the character */
|
||||
withDescription(op?: { alias?: string; args?: CharacterDescriptionArgs }) {
|
||||
description(op?: { alias?: string; args?: CharacterDescriptionArgs }) {
|
||||
operation.set({ alias: op?.alias, subField: "description", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** The character's gender. Usually Male, Female, or Non-binary but can be any string. */
|
||||
withGender(op?: { alias?: string }) {
|
||||
gender(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "gender", level })
|
||||
return this
|
||||
},
|
||||
/** The character's birth date */
|
||||
withDateOfBirth(op?: { alias?: string; fn?: Fn<typeof FuzzyDate> }) {
|
||||
dateOfBirth(op?: { alias?: string; fn?: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({ alias: op?.alias, subField: "dateOfBirth", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(FuzzyDate({ operation, level: level + 1 }))
|
||||
else FuzzyDate({ operation, level: level + 1 }).withYear().withMonth().withDay()
|
||||
else FuzzyDate({ operation, level: level + 1 }).year().month().day()
|
||||
return this
|
||||
},
|
||||
/** The character's age. Note this is a string, not an int, it may contain further text and additional ages. */
|
||||
withAge(op?: { alias?: string }) {
|
||||
age(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "age", level })
|
||||
return this
|
||||
},
|
||||
/** The characters blood type */
|
||||
withBloodType(op?: { alias?: string }) {
|
||||
bloodType(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "bloodType", level })
|
||||
return this
|
||||
},
|
||||
/** If the character is marked as favourite by the currently authenticated user */
|
||||
withIsFavourite(op?: { alias?: string }) {
|
||||
isFavourite(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavourite", level })
|
||||
return this
|
||||
},
|
||||
/** If the character is blocked from being added to favourites */
|
||||
withIsFavouriteBlocked(op?: { alias?: string }) {
|
||||
isFavouriteBlocked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavouriteBlocked", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the character page on the AniList website */
|
||||
withSiteUrl(op?: { alias?: string }) {
|
||||
siteUrl(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** Media that includes the character */
|
||||
withMedia(
|
||||
media(
|
||||
op: { alias?: string; args?: AtLeastOne<CharacterMediaArgs>; fn: Fn<typeof MediaConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -229,12 +229,12 @@ export const Character = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The amount of user's who have favourited the character */
|
||||
withFavourites(op?: { alias?: string }) {
|
||||
favourites(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favourites", level })
|
||||
return this
|
||||
},
|
||||
/** Notes for site moderators */
|
||||
withModNotes(op?: { alias?: string }) {
|
||||
modNotes(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "modNotes", level })
|
||||
return this
|
||||
},
|
||||
|
|
|
@ -2,48 +2,48 @@ import { Fields, OperationParser } from "../types/Anilist.ts"
|
|||
|
||||
export const ExternalLinkSourceCollection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the external link */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The url of the external link or base url of link source */
|
||||
withUrl(op?: { alias?: string }) {
|
||||
url(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "url", level })
|
||||
return this
|
||||
},
|
||||
/** The links website site name */
|
||||
withSite(op?: { alias?: string }) {
|
||||
site(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "site", level })
|
||||
return this
|
||||
},
|
||||
/** The links website site id */
|
||||
withSiteId(op?: { alias?: string }) {
|
||||
siteId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteId", level })
|
||||
return this
|
||||
},
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** Language the site content is in. See Staff language field for values. */
|
||||
withLanguage(op?: { alias?: string }) {
|
||||
language(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "language", level })
|
||||
return this
|
||||
},
|
||||
withColor(op?: { alias?: string }) {
|
||||
color(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "color", level })
|
||||
return this
|
||||
},
|
||||
/** The icon image url of the site. Not available for all links. Transparent PNG 64x64 */
|
||||
withIcon(op?: { alias?: string }) {
|
||||
icon(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "icon", level })
|
||||
return this
|
||||
},
|
||||
withNotes(op?: { alias?: string }) {
|
||||
notes(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "notes", level })
|
||||
return this
|
||||
},
|
||||
withIsDisabled(op?: { alias?: string }) {
|
||||
isDisabled(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isDisabled", level })
|
||||
return this
|
||||
},
|
||||
|
|
|
@ -14,7 +14,7 @@ import { StudioConnection } from "./Studio.ts"
|
|||
|
||||
export const Favourites = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** Favourite anime */
|
||||
withAnime(
|
||||
anime(
|
||||
op: { alias?: string; args?: AtLeastOne<FavouritesAnimeArgs>; fn: Fn<typeof MediaConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -28,7 +28,7 @@ export const Favourites = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** Favourite manga */
|
||||
withManga(
|
||||
manga(
|
||||
op: { alias?: string; args?: AtLeastOne<FavouritesMangaArgs>; fn: Fn<typeof MediaConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -42,7 +42,7 @@ export const Favourites = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** Favourite characters */
|
||||
withCharacters(
|
||||
characters(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<FavouritesCharactersArgs>
|
||||
|
@ -60,7 +60,7 @@ export const Favourites = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** Favourite staff */
|
||||
withStaff(
|
||||
staff(
|
||||
op: { alias?: string; args?: AtLeastOne<FavouritesStaffArgs>; fn: Fn<typeof StaffConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -74,7 +74,7 @@ export const Favourites = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** Favourite studios */
|
||||
withStudios(
|
||||
studios(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<FavouritesStudiosArgs>
|
||||
|
|
|
@ -5,7 +5,7 @@ import { Thread } from "./Thread.ts"
|
|||
import { ThreadComment } from "./ThreadComment.ts"
|
||||
|
||||
export const LikeableUnion = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withListActivity(op?: { alias?: string; fn?: Fn<typeof ListActivity> }) {
|
||||
listActivity(op?: { alias?: string; fn?: Fn<typeof ListActivity> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ListActivity",
|
||||
|
@ -14,10 +14,10 @@ export const LikeableUnion = ({ operation, level }: Fields<OperationParser>) =>
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ListActivity({ operation, level: level + 1 }))
|
||||
else ListActivity({ operation, level: level + 1 }).withId()
|
||||
else ListActivity({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withTextActivity(op?: { alias?: string; fn?: Fn<typeof TextActivity> }) {
|
||||
textActivity(op?: { alias?: string; fn?: Fn<typeof TextActivity> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "TextActivity",
|
||||
|
@ -26,10 +26,10 @@ export const LikeableUnion = ({ operation, level }: Fields<OperationParser>) =>
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(TextActivity({ operation, level: level + 1 }))
|
||||
else TextActivity({ operation, level: level + 1 }).withId()
|
||||
else TextActivity({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withMessageActivity(op?: { alias?: string; fn?: Fn<typeof MessageActivity> }) {
|
||||
messageActivity(op?: { alias?: string; fn?: Fn<typeof MessageActivity> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "MessageActivity",
|
||||
|
@ -38,10 +38,10 @@ export const LikeableUnion = ({ operation, level }: Fields<OperationParser>) =>
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(MessageActivity({ operation, level: level + 1 }))
|
||||
else MessageActivity({ operation, level: level + 1 }).withId()
|
||||
else MessageActivity({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withActivityReply(op?: { alias?: string; fn?: Fn<typeof ActivityReply> }) {
|
||||
activityReply(op?: { alias?: string; fn?: Fn<typeof ActivityReply> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ActivityReply",
|
||||
|
@ -50,16 +50,16 @@ export const LikeableUnion = ({ operation, level }: Fields<OperationParser>) =>
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ActivityReply({ operation, level: level + 1 }))
|
||||
else ActivityReply({ operation, level: level + 1 }).withId()
|
||||
else ActivityReply({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withThread(op?: { alias?: string; fn?: Fn<typeof Thread> }) {
|
||||
thread(op?: { alias?: string; fn?: Fn<typeof Thread> }) {
|
||||
operation.set({ alias: op?.alias, subField: "Thread", level, hasSubField: true, isUnion: true })
|
||||
if (op?.fn) op.fn(Thread({ operation, level: level + 1 }))
|
||||
else Thread({ operation, level: level + 1 }).withId()
|
||||
else Thread({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withThreadComment(op?: { alias?: string; fn?: Fn<typeof ThreadComment> }) {
|
||||
threadComment(op?: { alias?: string; fn?: Fn<typeof ThreadComment> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ThreadComment",
|
||||
|
@ -68,7 +68,7 @@ export const LikeableUnion = ({ operation, level }: Fields<OperationParser>) =>
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ThreadComment({ operation, level: level + 1 }))
|
||||
else ThreadComment({ operation, level: level + 1 }).withId()
|
||||
else ThreadComment({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -2,7 +2,7 @@ import { Fields, OperationParser } from "../types/Anilist.ts"
|
|||
|
||||
export const Markdown = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The parsed markdown as html */
|
||||
withHtml(op?: { alias?: string }) {
|
||||
html(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "html", level })
|
||||
return this
|
||||
},
|
||||
|
|
|
@ -32,24 +32,24 @@ import { StudioConnection } from "./Studio.ts"
|
|||
|
||||
export const MediaListGroup = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** Media list entries */
|
||||
withEntries(op: { alias?: string; fn: Fn<typeof MediaList> }) {
|
||||
entries(op: { alias?: string; fn: Fn<typeof MediaList> }) {
|
||||
operation.set({ alias: op.alias, subField: "entries", level, hasSubField: true })
|
||||
op.fn(MediaList({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withName(op?: { alias?: string }) {
|
||||
name(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
withIsCustomList(op?: { alias?: string }) {
|
||||
isCustomList(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isCustomList", level })
|
||||
return this
|
||||
},
|
||||
withIsSplitCompletedList(op?: { alias?: string }) {
|
||||
isSplitCompletedList(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isSplitCompletedList", level })
|
||||
return this
|
||||
},
|
||||
withStatus(op?: { alias?: string }) {
|
||||
status(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "status", level })
|
||||
return this
|
||||
},
|
||||
|
@ -80,17 +80,17 @@ const MediaTitle = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
const MediaTrailer = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The trailer video id */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The site the video is hosted by (Currently either youtube or dailymotion) */
|
||||
withSite(op?: { alias?: string }) {
|
||||
site(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "site", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the thumbnail image of the video */
|
||||
withThumbnail(op?: { alias?: string }) {
|
||||
thumbnail(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "thumbnail", level })
|
||||
return this
|
||||
},
|
||||
|
@ -98,22 +98,22 @@ const MediaTrailer = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
const MediaCoverImage = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The cover image url of the media at its largest size. If this size isn't available, large will be provided instead. */
|
||||
withExtraLarge(op?: { alias?: string }) {
|
||||
extraLarge(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "extraLarge", level })
|
||||
return this
|
||||
},
|
||||
/** The cover image url of the media at a large size */
|
||||
withLarge(op?: { alias?: string }) {
|
||||
large(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "large", level })
|
||||
return this
|
||||
},
|
||||
/** The cover image url of the media at medium size */
|
||||
withMedium(op?: { alias?: string }) {
|
||||
medium(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "medium", level })
|
||||
return this
|
||||
},
|
||||
/** Average #hex color of cover image */
|
||||
withColor(op?: { alias?: string }) {
|
||||
color(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "color", level })
|
||||
return this
|
||||
},
|
||||
|
@ -121,48 +121,48 @@ const MediaCoverImage = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
const MediaExternalLink = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the external link */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The url of the external link or base url of link source */
|
||||
withUrl(op?: { alias?: string }) {
|
||||
url(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "url", level })
|
||||
return this
|
||||
},
|
||||
/** The links website site name */
|
||||
withSite(op?: { alias?: string }) {
|
||||
site(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "site", level })
|
||||
return this
|
||||
},
|
||||
/** The links website site id */
|
||||
withSiteId(op?: { alias?: string }) {
|
||||
siteId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteId", level })
|
||||
return this
|
||||
},
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** Language the site content is in. See Staff language field for values. */
|
||||
withLanguage(op?: { alias?: string }) {
|
||||
language(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "language", level })
|
||||
return this
|
||||
},
|
||||
withColor(op?: { alias?: string }) {
|
||||
color(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "color", level })
|
||||
return this
|
||||
},
|
||||
/** The icon image url of the site. Not available for all links. Transparent PNG 64x64 */
|
||||
withIcon(op?: { alias?: string }) {
|
||||
icon(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "icon", level })
|
||||
return this
|
||||
},
|
||||
withNotes(op?: { alias?: string }) {
|
||||
notes(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "notes", level })
|
||||
return this
|
||||
},
|
||||
withIsDisabled(op?: { alias?: string }) {
|
||||
isDisabled(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isDisabled", level })
|
||||
return this
|
||||
},
|
||||
|
@ -170,22 +170,22 @@ const MediaExternalLink = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
const MediaStreamingEpisode = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** Title of the episode */
|
||||
withTitle(op?: { alias?: string }) {
|
||||
title(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "title", level })
|
||||
return this
|
||||
},
|
||||
/** Url of episode image thumbnail */
|
||||
withThumbnail(op?: { alias?: string }) {
|
||||
thumbnail(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "thumbnail", level })
|
||||
return this
|
||||
},
|
||||
/** The url of the episode */
|
||||
withUrl(op?: { alias?: string }) {
|
||||
url(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "url", level })
|
||||
return this
|
||||
},
|
||||
/** The site location of the streaming episodes */
|
||||
withSite(op?: { alias?: string }) {
|
||||
site(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "site", level })
|
||||
return this
|
||||
},
|
||||
|
@ -193,42 +193,42 @@ const MediaStreamingEpisode = ({ operation, level }: Fields<OperationParser>) =>
|
|||
|
||||
const MediaRank = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the rank */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The numerical rank of the media */
|
||||
withRank(op?: { alias?: string }) {
|
||||
rank(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "rank", level })
|
||||
return this
|
||||
},
|
||||
/** The type of ranking */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The format the media is ranked within */
|
||||
withFormat(op?: { alias?: string }) {
|
||||
format(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "format", level })
|
||||
return this
|
||||
},
|
||||
/** The year the media is ranked within */
|
||||
withYear(op?: { alias?: string }) {
|
||||
year(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "year", level })
|
||||
return this
|
||||
},
|
||||
/** The season the media is ranked within */
|
||||
withSeason(op?: { alias?: string }) {
|
||||
season(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "season", level })
|
||||
return this
|
||||
},
|
||||
/** If the ranking is based on all time instead of a season/year */
|
||||
withAllTime(op?: { alias?: string }) {
|
||||
allTime(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "allTime", level })
|
||||
return this
|
||||
},
|
||||
/** String that gives context to the ranking type and time span */
|
||||
withContext(op?: { alias?: string }) {
|
||||
context(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
|
@ -248,82 +248,82 @@ const MediaStats = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
})
|
||||
|
||||
const StatusDistribution = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withStatus(op?: { alias?: string }) {
|
||||
status(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "status", level })
|
||||
return this
|
||||
},
|
||||
withAmount(op?: { alias?: string }) {
|
||||
amount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "amount", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ScoreDistribution = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withScore(op?: { alias?: string }) {
|
||||
score(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "score", level })
|
||||
return this
|
||||
},
|
||||
withAmount(op?: { alias?: string }) {
|
||||
amount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "amount", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
node(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "node", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The id of the connection */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of relation to the parent model */
|
||||
withRelationType(op?: { alias?: string; args?: AtLeastOne<MediaEdgeRelationTypeArgs> }) {
|
||||
relationType(op?: { alias?: string; args?: AtLeastOne<MediaEdgeRelationTypeArgs> }) {
|
||||
operation.set({ alias: op?.alias, subField: "relationType", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** If the studio is the main animation studio of the media (For Studio->MediaConnection field only) */
|
||||
withIsMainStudio(op?: { alias?: string }) {
|
||||
isMainStudio(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isMainStudio", level })
|
||||
return this
|
||||
},
|
||||
/** The characters in the media voiced by the parent actor */
|
||||
withCharacters(op: { alias?: string; fn: Fn<typeof Character> }) {
|
||||
characters(op: { alias?: string; fn: Fn<typeof Character> }) {
|
||||
operation.set({ alias: op.alias, subField: "characters", level, hasSubField: true })
|
||||
op.fn(Character({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The characters role in the media */
|
||||
withCharacterRole(op?: { alias?: string }) {
|
||||
characterRole(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "characterRole", level })
|
||||
return this
|
||||
},
|
||||
/** Media specific character name */
|
||||
withCharacterName(op?: { alias?: string }) {
|
||||
characterName(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "characterName", level })
|
||||
return this
|
||||
},
|
||||
/** Notes regarding the VA's role for the character */
|
||||
withRoleNotes(op?: { alias?: string }) {
|
||||
roleNotes(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "roleNotes", level })
|
||||
return this
|
||||
},
|
||||
/** Used for grouping roles where multiple dubs exist for the same language. Either dubbing company name or language variant. */
|
||||
withDubGroup(op?: { alias?: string }) {
|
||||
dubGroup(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "dubGroup", level })
|
||||
return this
|
||||
},
|
||||
/** The role of the staff member in the production of the media */
|
||||
withStaffRole(op?: { alias?: string }) {
|
||||
staffRole(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "staffRole", level })
|
||||
return this
|
||||
},
|
||||
/** The voice actors of the character */
|
||||
withVoiceActors(
|
||||
voiceActors(
|
||||
op?: { alias?: string; args?: AtLeastOne<MediaEdgeVoiceActorsArgs>; fn?: Fn<typeof Staff> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -334,11 +334,11 @@ const MediaEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
hasSubField: true,
|
||||
})
|
||||
if (op?.fn) op.fn(Staff({ operation, level: level + 1 }))
|
||||
else Staff({ operation, level: level + 1 }).withId()
|
||||
else Staff({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The voice actors of the character with role date */
|
||||
withVoiceActorRoles(op: {
|
||||
voiceActorRoles(op: {
|
||||
args?: AtLeastOne<MediaEdgeVoiceActorRolesArgs>
|
||||
fn: Fn<typeof StaffRoleType>
|
||||
}) {
|
||||
|
@ -352,27 +352,27 @@ const MediaEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The order the media should be displayed from the users favourites */
|
||||
withFavouriteOrder(op?: { alias?: string }) {
|
||||
favouriteOrder(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favouriteOrder", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const MediaConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { alias?: string; fn?: Fn<typeof MediaEdge> }) {
|
||||
edges(op?: { alias?: string; fn?: Fn<typeof MediaEdge> }) {
|
||||
operation.set({ alias: op?.alias, subField: "edges", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(MediaEdge({ operation, level: level + 1 }))
|
||||
else MediaEdge({ operation, level: level + 1 }).withId()
|
||||
else MediaEdge({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
nodes(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "nodes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
pageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ alias: op.alias, subField: "pageInfo", level, hasSubField: true })
|
||||
op.fn(PageInfo({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
@ -381,189 +381,189 @@ export const MediaConnection = ({ operation, level }: Fields<OperationParser>) =
|
|||
|
||||
export const Media = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the media */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The mal id of the media */
|
||||
withIdMal(op?: { alias?: string }) {
|
||||
idMal(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "idMal", level })
|
||||
return this
|
||||
},
|
||||
/** The type of the media; anime or manga */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The format the media was released in */
|
||||
withFormat(op?: { alias?: string }) {
|
||||
format(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "format", level })
|
||||
return this
|
||||
},
|
||||
/** The season the media was initially released in */
|
||||
withSeason(op?: { alias?: string }) {
|
||||
season(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "season", level })
|
||||
return this
|
||||
},
|
||||
/** The season year the media was initially released in */
|
||||
withSeasonYear(op?: { alias?: string }) {
|
||||
seasonYear(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "seasonYear", level })
|
||||
return this
|
||||
},
|
||||
/** The year & season the media was initially released in */
|
||||
withSeasonInt(op?: { alias?: string }) {
|
||||
seasonInt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "seasonInt", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of episodes the anime has when complete */
|
||||
withEpisodes(op?: { alias?: string }) {
|
||||
episodes(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "episodes", level })
|
||||
return this
|
||||
},
|
||||
/** The general length of each anime episode in minutes */
|
||||
withDuration(op?: { alias?: string }) {
|
||||
duration(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "duration", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of chapters the manga has when complete */
|
||||
withChapters(op?: { alias?: string }) {
|
||||
chapters(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chapters", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of volumes the manga has when complete */
|
||||
withVolumes(op?: { alias?: string }) {
|
||||
volumes(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "volumes", level })
|
||||
return this
|
||||
},
|
||||
/** Where the media was created. (ISO 3166-1 alpha-2) */
|
||||
withCountryOfOrigin(op?: { alias?: string }) {
|
||||
countryOfOrigin(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "countryOfOrigin", level })
|
||||
return this
|
||||
},
|
||||
/** If the media is officially licensed or a self-published doujin release */
|
||||
withIsLicensed(op?: { alias?: string }) {
|
||||
isLicensed(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLicensed", level })
|
||||
return this
|
||||
},
|
||||
/** Official Twitter hashtags for the media */
|
||||
withHashtag(op?: { alias?: string }) {
|
||||
hashtag(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "hashtag", level })
|
||||
return this
|
||||
},
|
||||
/** When the media's data was last updated */
|
||||
withUpdatedAt(op?: { alias?: string }) {
|
||||
updatedAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedAt", level })
|
||||
return this
|
||||
},
|
||||
/** The banner image of the media */
|
||||
withBannerImage(op?: { alias?: string }) {
|
||||
bannerImage(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "bannerImage", level })
|
||||
return this
|
||||
},
|
||||
/** The genres of the media */
|
||||
withGenres(op?: { alias?: string }) {
|
||||
genres(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "genres", level })
|
||||
return this
|
||||
},
|
||||
/** Alternative titles of the media */
|
||||
withSynonyms(op?: { alias?: string }) {
|
||||
synonyms(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "synonyms", level })
|
||||
return this
|
||||
},
|
||||
/** A weighted average score of all the user's scores of the media */
|
||||
withAverageScore(op?: { alias?: string }) {
|
||||
averageScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "averageScore", level })
|
||||
return this
|
||||
},
|
||||
/** Mean score of all the user's scores of the media */
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
/** The number of users with the media on their list */
|
||||
withPopularity(op?: { alias?: string }) {
|
||||
popularity(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "popularity", level })
|
||||
return this
|
||||
},
|
||||
/** Locked media may not be added to lists our favorited. This may be due to the entry pending for deletion or other reasons. */
|
||||
withIsLocked(op?: { alias?: string }) {
|
||||
isLocked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of related activity in the past hour */
|
||||
withTrending(op?: { alias?: string }) {
|
||||
trending(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "trending", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of user's who have favourited the media */
|
||||
withFavourites(op?: { alias?: string }) {
|
||||
favourites(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favourites", level })
|
||||
return this
|
||||
},
|
||||
/** If the media is marked as favourite by the current authenticated user */
|
||||
withIsFavourite(op?: { alias?: string }) {
|
||||
isFavourite(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavourite", level })
|
||||
return this
|
||||
},
|
||||
/** If the media is blocked from being added to favourites */
|
||||
withIsFavouriteBlocked(op?: { alias?: string }) {
|
||||
isFavouriteBlocked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavouriteBlocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the media is intended only for 18+ adult audiences */
|
||||
withIsAdult(op?: { alias?: string }) {
|
||||
isAdult(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isAdult", level })
|
||||
return this
|
||||
},
|
||||
/** The media's next episode airing schedule */
|
||||
withNextAiringEpisode(op?: { alias?: string; fn?: Fn<typeof AiringSchedule> }) {
|
||||
nextAiringEpisode(op?: { alias?: string; fn?: Fn<typeof AiringSchedule> }) {
|
||||
operation.set({ alias: op?.alias, subField: "nextAiringEpisode", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(AiringSchedule({ operation, level: level + 1 }))
|
||||
else AiringSchedule({ operation, level: level + 1 }).withId()
|
||||
else AiringSchedule({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The url for the media page on the AniList website */
|
||||
withSiteUrl(op?: { alias?: string }) {
|
||||
siteUrl(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** If the media should have forum thread automatically created for it on airing episode release */
|
||||
withAutoCreateForumThread(op?: { alias?: string }) {
|
||||
autoCreateForumThread(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "autoCreateForumThread", level })
|
||||
return this
|
||||
},
|
||||
/** If the media is blocked from being recommended to/from */
|
||||
withIsRecommendationBlocked(op?: { alias?: string }) {
|
||||
isRecommendationBlocked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isRecommendationBlocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the media is blocked from being reviewed */
|
||||
withIsReviewBlocked(op?: { alias?: string }) {
|
||||
isReviewBlocked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isReviewBlocked", level })
|
||||
return this
|
||||
},
|
||||
/** Notes for site moderators */
|
||||
withModNotes(op?: { alias?: string }) {
|
||||
modNotes(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "modNotes", level })
|
||||
return this
|
||||
},
|
||||
/** The current releasing status of the media */
|
||||
withStatus(op?: { alias?: string; args?: AtLeastOne<MediaStatusArgs> }) {
|
||||
status(op?: { alias?: string; args?: AtLeastOne<MediaStatusArgs> }) {
|
||||
operation.set({ alias: op?.alias, subField: "status", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** Short description of the media's story and characters */
|
||||
withDescription(op?: { alias?: string; args?: AtLeastOne<MediaDescriptionArgs> }) {
|
||||
description(op?: { alias?: string; args?: AtLeastOne<MediaDescriptionArgs> }) {
|
||||
operation.set({ alias: op?.alias, subField: "description", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** Source type the media was adapted from. */
|
||||
withSource(op?: { alias?: string; args?: AtLeastOne<MediaSourceArgs> }) {
|
||||
source(op?: { alias?: string; args?: AtLeastOne<MediaSourceArgs> }) {
|
||||
operation.set({ alias: op?.alias, subField: "source", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** The staff who produced the media */
|
||||
withStaff(
|
||||
staff(
|
||||
op: { alias?: string; args?: AtLeastOne<MediaStaffArgs>; fn: Fn<typeof StaffConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -577,7 +577,7 @@ export const Media = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** User recommendations for similar media */
|
||||
withRecommendations(
|
||||
recommendations(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<MediaRecommendationsArgs>
|
||||
|
@ -595,7 +595,7 @@ export const Media = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The characters in the media */
|
||||
withCharacters(op: {
|
||||
characters(op: {
|
||||
args?: AtLeastOne<MediaCharactersArgs>
|
||||
fn: Fn<typeof CharacterConnection>
|
||||
}) {
|
||||
|
@ -609,7 +609,7 @@ export const Media = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The companies who produced the media */
|
||||
withStudios(op: {
|
||||
studios(op: {
|
||||
args?: AtLeastOne<MediaStudiosArgs>
|
||||
fn: Fn<typeof StudioConnection>
|
||||
}) {
|
||||
|
@ -618,7 +618,7 @@ export const Media = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The media's entire airing schedule */
|
||||
withAiringSchedule(op: {
|
||||
airingSchedule(op: {
|
||||
args?: AtLeastOne<MediaAiringScheduleArgs>
|
||||
fn: Fn<typeof AiringScheduleConnection>
|
||||
}) {
|
||||
|
@ -632,7 +632,7 @@ export const Media = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The media's daily trend stats */
|
||||
withTrends(
|
||||
trends(
|
||||
op: { alias?: string; args?: AtLeastOne<MediaTrendsArgs>; fn: Fn<typeof MediaTrendConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -646,7 +646,7 @@ export const Media = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** User reviews of the media */
|
||||
withReviews(
|
||||
reviews(
|
||||
op: { alias?: string; args?: AtLeastOne<MediaReviewsArgs>; fn: Fn<typeof ReviewConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -660,86 +660,86 @@ export const Media = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The official titles of the media in various languages */
|
||||
withTitle(op: { alias?: string; fn: Fn<typeof MediaTitle> }) {
|
||||
title(op: { alias?: string; fn: Fn<typeof MediaTitle> }) {
|
||||
operation.set({ alias: op.alias, subField: "title", level, hasSubField: true })
|
||||
op.fn(MediaTitle({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The first official release date of the media */
|
||||
withStartDate(op?: { alias?: string; fn?: Fn<typeof FuzzyDate> }) {
|
||||
startDate(op?: { alias?: string; fn?: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({ alias: op?.alias, subField: "startDate", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(FuzzyDate({ operation, level: level + 1 }))
|
||||
else {
|
||||
FuzzyDate({ operation, level: level + 1 })
|
||||
.withYear()
|
||||
.withMonth()
|
||||
.withDay()
|
||||
.year()
|
||||
.month()
|
||||
.day()
|
||||
}
|
||||
return this
|
||||
},
|
||||
/** The last official release date of the media */
|
||||
withEndDate(op?: { alias?: string; fn?: Fn<typeof FuzzyDate> }) {
|
||||
endDate(op?: { alias?: string; fn?: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({ alias: op?.alias, subField: "endDate", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(FuzzyDate({ operation, level: level + 1 }))
|
||||
else {
|
||||
FuzzyDate({ operation, level: level + 1 })
|
||||
.withYear()
|
||||
.withMonth()
|
||||
.withDay()
|
||||
.year()
|
||||
.month()
|
||||
.day()
|
||||
}
|
||||
return this
|
||||
},
|
||||
/** Media trailer or advertisement */
|
||||
withTrailer(op: { alias?: string; fn: Fn<typeof MediaTrailer> }) {
|
||||
trailer(op: { alias?: string; fn: Fn<typeof MediaTrailer> }) {
|
||||
operation.set({ alias: op.alias, subField: "trailer", level, hasSubField: true })
|
||||
op.fn(MediaTrailer({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The cover images of the media */
|
||||
withCoverImage(op?: { alias?: string; fn?: Fn<typeof MediaCoverImage> }) {
|
||||
coverImage(op?: { alias?: string; fn?: Fn<typeof MediaCoverImage> }) {
|
||||
operation.set({ alias: op?.alias, subField: "coverImage", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(MediaCoverImage({ operation, level: level + 1 }))
|
||||
else MediaCoverImage({ operation, level: level + 1 }).withMedium()
|
||||
else MediaCoverImage({ operation, level: level + 1 }).medium()
|
||||
return this
|
||||
},
|
||||
/** List of tags that describes elements and themes of the media */
|
||||
withTags(op: { alias?: string; fn: Fn<typeof MediaTag> }) {
|
||||
tags(op: { alias?: string; fn: Fn<typeof MediaTag> }) {
|
||||
operation.set({ alias: op.alias, subField: "tags", level, hasSubField: true })
|
||||
op.fn(MediaTag({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** Other media in the same or connecting franchise */
|
||||
withRelations(op: { alias?: string; fn: Fn<typeof MediaConnection> }) {
|
||||
relations(op: { alias?: string; fn: Fn<typeof MediaConnection> }) {
|
||||
operation.set({ alias: op.alias, subField: "relations", level, hasSubField: true })
|
||||
op.fn(MediaConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** External links to another site related to the media */
|
||||
withExternalLinks(op: { alias?: string; fn: Fn<typeof MediaExternalLink> }) {
|
||||
externalLinks(op: { alias?: string; fn: Fn<typeof MediaExternalLink> }) {
|
||||
operation.set({ alias: op.alias, subField: "externalLinks", level, hasSubField: true })
|
||||
op.fn(MediaExternalLink({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** Data and links to legal streaming episodes on external sites */
|
||||
withStreamingEpisodes(op: { alias?: string; fn: Fn<typeof MediaStreamingEpisode> }) {
|
||||
streamingEpisodes(op: { alias?: string; fn: Fn<typeof MediaStreamingEpisode> }) {
|
||||
operation.set({ alias: op.alias, subField: "streamingEpisodes", level, hasSubField: true })
|
||||
op.fn(MediaStreamingEpisode({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The ranking of the media in a particular time span and format compared to other media */
|
||||
withRankings(op: { alias?: string; fn: Fn<typeof MediaRank> }) {
|
||||
rankings(op: { alias?: string; fn: Fn<typeof MediaRank> }) {
|
||||
operation.set({ alias: op.alias, subField: "rankings", level, hasSubField: true })
|
||||
op.fn(MediaRank({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The authenticated user's media list entry for the media */
|
||||
withMediaListEntry(op?: { alias?: string; fn?: Fn<typeof MediaList> }) {
|
||||
mediaListEntry(op?: { alias?: string; fn?: Fn<typeof MediaList> }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaListEntry", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(MediaList({ operation, level: level + 1 }))
|
||||
else MediaList({ operation, level: level + 1 }).withId()
|
||||
else MediaList({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withStats(op: { alias?: string; fn: Fn<typeof MediaStats> }) {
|
||||
stats(op: { alias?: string; fn: Fn<typeof MediaStats> }) {
|
||||
operation.set({ alias: op.alias, subField: "stats", level, hasSubField: true })
|
||||
op.fn(MediaStats({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
|
|
@ -6,27 +6,27 @@ import { MediaListScoreArgs } from "../../graphql-codegen/generated/graphql.ts"
|
|||
|
||||
export const MediaListTypeOptions = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The order each list should be displayed in */
|
||||
withSectionOrder(op?: { alias?: string }) {
|
||||
sectionOrder(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "sectionOrder", level })
|
||||
return this
|
||||
},
|
||||
/** If the completed sections of the list should be separated by format */
|
||||
withSplitCompletedSectionByFormat(op?: { alias?: string }) {
|
||||
splitCompletedSectionByFormat(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "splitCompletedSectionByFormat", level })
|
||||
return this
|
||||
},
|
||||
/** The names of the user's custom lists */
|
||||
withCustomLists(op?: { alias?: string }) {
|
||||
customLists(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "customLists", level })
|
||||
return this
|
||||
},
|
||||
/** The names of the user's advanced scoring sections */
|
||||
withAdvancedScoring(op?: { alias?: string }) {
|
||||
advancedScoring(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "advancedScoring", level })
|
||||
return this
|
||||
},
|
||||
/** If advanced scoring is enabled */
|
||||
withAdvancedScoringEnabled(op?: { alias?: string }) {
|
||||
advancedScoringEnabled(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "advancedScoringEnabled", level })
|
||||
return this
|
||||
},
|
||||
|
@ -34,23 +34,23 @@ export const MediaListTypeOptions = ({ operation, level }: Fields<OperationParse
|
|||
|
||||
export const MediaListOptions = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The score format the user is using for media lists */
|
||||
withScoreFormat(op?: { alias?: string }) {
|
||||
scoreFormat(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "scoreFormat", level })
|
||||
return this
|
||||
},
|
||||
/** The default order list rows should be displayed in */
|
||||
withRowOrder(op?: { alias?: string }) {
|
||||
rowOrder(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "rowOrder", level })
|
||||
return this
|
||||
},
|
||||
/** The user's anime list options */
|
||||
withAnimeList(op: { alias?: string; fn: Fn<typeof MediaListTypeOptions> }) {
|
||||
animeList(op: { alias?: string; fn: Fn<typeof MediaListTypeOptions> }) {
|
||||
operation.set({ alias: op.alias, subField: "animeList", level, hasSubField: true })
|
||||
op.fn(MediaListTypeOptions({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The user's manga list options */
|
||||
withMangaList(op: { alias?: string; fn: Fn<typeof MediaListTypeOptions> }) {
|
||||
mangaList(op: { alias?: string; fn: Fn<typeof MediaListTypeOptions> }) {
|
||||
operation.set({ alias: op.alias, subField: "mangaList", level, hasSubField: true })
|
||||
op.fn(MediaListTypeOptions({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
@ -58,86 +58,86 @@ export const MediaListOptions = ({ operation, level }: Fields<OperationParser>)
|
|||
})
|
||||
|
||||
export const MediaList = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCompletedAt(op: { alias?: string; fn: Fn<typeof FuzzyDate> }) {
|
||||
completedAt(op: { alias?: string; fn: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({ alias: op.alias, subField: "completedAt", level, hasSubField: true })
|
||||
op.fn(FuzzyDate({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withStartedAt(op: { alias?: string; fn: Fn<typeof FuzzyDate> }) {
|
||||
startedAt(op: { alias?: string; fn: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({ alias: op.alias, subField: "startedAt", level, hasSubField: true })
|
||||
op.fn(FuzzyDate({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
withMediaId(op?: { alias?: string }) {
|
||||
mediaId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
withScore(op?: { alias?: string; args?: MediaListScoreArgs }) {
|
||||
score(op?: { alias?: string; args?: MediaListScoreArgs }) {
|
||||
operation.set({ alias: op?.alias, subField: "score", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
withStatus(op?: { alias?: string }) {
|
||||
status(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "status", level })
|
||||
return this
|
||||
},
|
||||
withProgress(op?: { alias?: string }) {
|
||||
progress(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "progress", level })
|
||||
return this
|
||||
},
|
||||
withProgressVolumes(op?: { alias?: string }) {
|
||||
progressVolumes(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "progressVolumes", level })
|
||||
return this
|
||||
},
|
||||
withRepeat(op?: { alias?: string }) {
|
||||
repeat(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "repeat", level })
|
||||
return this
|
||||
},
|
||||
withPriority(op?: { alias?: string }) {
|
||||
priority(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "priority", level })
|
||||
return this
|
||||
},
|
||||
withPrivate(op?: { alias?: string }) {
|
||||
private(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "private", level })
|
||||
return this
|
||||
},
|
||||
withNotes(op?: { alias?: string }) {
|
||||
notes(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "notes", level })
|
||||
return this
|
||||
},
|
||||
withAdvancedScores(op?: { alias?: string }) {
|
||||
advancedScores(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "advancedScores", level })
|
||||
return this
|
||||
},
|
||||
withHiddenFromStatusLists(op?: { alias?: string }) {
|
||||
hiddenFromStatusLists(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "hiddenFromStatusLists", level })
|
||||
return this
|
||||
},
|
||||
withUpdatedAt(op?: { alias?: string }) {
|
||||
updatedAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedAt", level })
|
||||
return this
|
||||
},
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
withMedia(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
media(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "media", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -4,20 +4,20 @@ import { User } from "./User.ts"
|
|||
|
||||
export const MediaListCollection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** Grouped media list entries */
|
||||
withLists(op: { alias?: string; fn: Fn<typeof MediaListGroup> }) {
|
||||
lists(op: { alias?: string; fn: Fn<typeof MediaListGroup> }) {
|
||||
operation.set({ alias: op.alias, subField: "lists", level, hasSubField: true })
|
||||
op.fn(MediaListGroup({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The owner of the list */
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** If there is another chunk */
|
||||
withHasNextChunk(op?: { alias?: string }) {
|
||||
hasNextChunk(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "hasNextChunk", level })
|
||||
return this
|
||||
},
|
||||
|
|
|
@ -2,47 +2,47 @@ import { Fields, OperationParser } from "../types/Anilist.ts"
|
|||
|
||||
export const MediaTag = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the tag */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The name of the tag */
|
||||
withName(op?: { alias?: string }) {
|
||||
name(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
/** A general description of the tag */
|
||||
withDescription(op?: { alias?: string }) {
|
||||
description(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "description", level })
|
||||
return this
|
||||
},
|
||||
/** The categories of tags this tag belongs to */
|
||||
withCategory(op?: { alias?: string }) {
|
||||
category(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "category", level })
|
||||
return this
|
||||
},
|
||||
/** The relevance ranking of the tag out of the 100 for this media */
|
||||
withRank(op?: { alias?: string }) {
|
||||
rank(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "rank", level })
|
||||
return this
|
||||
},
|
||||
/** If the tag could be a spoiler for any media */
|
||||
withIsGeneralSpoiler(op?: { alias?: string }) {
|
||||
isGeneralSpoiler(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isGeneralSpoiler", level })
|
||||
return this
|
||||
},
|
||||
/** If the tag is a spoiler for this media */
|
||||
withIsMediaSpoiler(op?: { alias?: string }) {
|
||||
isMediaSpoiler(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isMediaSpoiler", level })
|
||||
return this
|
||||
},
|
||||
/** If the tag is only for adult 18+ media */
|
||||
withIsAdult(op?: { alias?: string }) {
|
||||
isAdult(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isAdult", level })
|
||||
return this
|
||||
},
|
||||
/** The user who submitted the tag */
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
|
|
|
@ -3,29 +3,29 @@ import { Media } from "./Media.ts"
|
|||
import { PageInfo } from "./Page.ts"
|
||||
|
||||
const MediaTrendEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op?: { alias?: string; fn?: Fn<typeof MediaTrend> }) {
|
||||
node(op?: { alias?: string; fn?: Fn<typeof MediaTrend> }) {
|
||||
operation.set({ alias: op?.alias, subField: "node", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(MediaTrend({ operation, level: level + 1 }))
|
||||
else MediaTrend({ operation, level: level + 1 }).withMediaId()
|
||||
else MediaTrend({ operation, level: level + 1 }).mediaId()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const MediaTrendConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { alias?: string; fn?: Fn<typeof MediaTrendEdge> }) {
|
||||
edges(op?: { alias?: string; fn?: Fn<typeof MediaTrendEdge> }) {
|
||||
operation.set({ alias: op?.alias, subField: "edges", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(MediaTrendEdge({ operation, level: level + 1 }))
|
||||
else MediaTrendEdge({ operation, level: level + 1 }).withNode()
|
||||
else MediaTrendEdge({ operation, level: level + 1 }).node()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { alias?: string; fn?: Fn<typeof MediaTrend> }) {
|
||||
nodes(op?: { alias?: string; fn?: Fn<typeof MediaTrend> }) {
|
||||
operation.set({ alias: op?.alias, subField: "nodes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(MediaTrend({ operation, level: level + 1 }))
|
||||
else MediaTrend({ operation, level: level + 1 }).withMediaId()
|
||||
else MediaTrend({ operation, level: level + 1 }).mediaId()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
pageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ alias: op.alias, subField: "pageInfo", level, hasSubField: true })
|
||||
op.fn(PageInfo({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
@ -34,50 +34,50 @@ export const MediaTrendConnection = ({ operation, level }: Fields<OperationParse
|
|||
|
||||
export const MediaTrend = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the tag */
|
||||
withMediaId(op?: { alias?: string }) {
|
||||
mediaId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The day the data was recorded (timestamp) */
|
||||
withDate(op?: { alias?: string }) {
|
||||
date(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "date", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of media activity on the day */
|
||||
withTrending(op?: { alias?: string }) {
|
||||
trending(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "trending", level })
|
||||
return this
|
||||
},
|
||||
/** A weighted average score of all the user's scores of the media */
|
||||
withAverageScore(op?: { alias?: string }) {
|
||||
averageScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "averageScore", level })
|
||||
return this
|
||||
},
|
||||
/** The number of users with the media on their list */
|
||||
withPopularity(op?: { alias?: string }) {
|
||||
popularity(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "popularity", level })
|
||||
return this
|
||||
},
|
||||
/** The number of users with watching/reading the media */
|
||||
withInProgress(op?: { alias?: string }) {
|
||||
inProgress(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "inProgress", level })
|
||||
return this
|
||||
},
|
||||
/** If the media was being released at this time */
|
||||
withReleasing(op?: { alias?: string }) {
|
||||
releasing(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "releasing", level })
|
||||
return this
|
||||
},
|
||||
/** The episode number of the anime released on this day */
|
||||
withEpisode(op?: { alias?: string }) {
|
||||
episode(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "episode", level })
|
||||
return this
|
||||
},
|
||||
/** The related media */
|
||||
withMedia(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
media(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "node", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -7,37 +7,37 @@ import { User } from "./User.ts"
|
|||
|
||||
const AiringNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the aired anime */
|
||||
withAnimeId(op?: { alias?: string }) {
|
||||
animeId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "animeId", level })
|
||||
return this
|
||||
},
|
||||
/** The episode number that just aired */
|
||||
withEpisode(op?: { alias?: string }) {
|
||||
episode(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "episode", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContexts(op?: { alias?: string }) {
|
||||
contexts(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "contexts", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The associated media of the airing schedule */
|
||||
withMedia(op: { alias?: string; fn: Fn<typeof Media> }) {
|
||||
media(op: { alias?: string; fn: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op.alias, subField: "media", level, hasSubField: true })
|
||||
op.fn(Media({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
@ -46,394 +46,394 @@ const AiringNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
const FollowingNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who followed the authenticated user */
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext(op?: { alias?: string }) {
|
||||
context(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The liked activity */
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ActivityMessageNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The if of the user who send the message */
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the activity message */
|
||||
withActivityId(op?: { alias?: string }) {
|
||||
activityId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "activityId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext(op?: { alias?: string }) {
|
||||
context(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The message activity */
|
||||
withMessage(op?: { alias?: string; fn?: Fn<typeof MessageActivity> }) {
|
||||
message(op?: { alias?: string; fn?: Fn<typeof MessageActivity> }) {
|
||||
operation.set({ alias: op?.alias, subField: "message", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(MessageActivity({ operation, level: level + 1 }))
|
||||
else MessageActivity({ operation, level: level + 1 }).withId()
|
||||
else MessageActivity({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The user who sent the message */
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ActivityNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who mentioned the authenticated user */
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the activity where mentioned */
|
||||
withActivityId(op?: { alias?: string }) {
|
||||
activityId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "activityId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext(op?: { alias?: string }) {
|
||||
context(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The liked activity */
|
||||
withActivity(op?: { alias?: string; fn?: Fn<typeof ActivityUnion> }) {
|
||||
activity(op?: { alias?: string; fn?: Fn<typeof ActivityUnion> }) {
|
||||
operation.set({ alias: op?.alias, subField: "activity", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(ActivityUnion({ operation, level: level + 1 }))
|
||||
else {
|
||||
ActivityUnion({ operation, level: level + 1 })
|
||||
.withListActivity()
|
||||
.withMessageActivity()
|
||||
.withTextActivity()
|
||||
.listActivity()
|
||||
.messageActivity()
|
||||
.textActivity()
|
||||
}
|
||||
return this
|
||||
},
|
||||
/** The user who mentioned the authenticated user */
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ThreadCommentNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who mentioned the authenticated user */
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the comment where mentioned */
|
||||
withCommentId(op?: { alias?: string }) {
|
||||
commentId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "commentId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext(op?: { alias?: string }) {
|
||||
context(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The thread that the relevant comment belongs to */
|
||||
withThread(op?: { alias?: string; fn?: Fn<typeof Thread> }) {
|
||||
thread(op?: { alias?: string; fn?: Fn<typeof Thread> }) {
|
||||
operation.set({ alias: op?.alias, subField: "thread", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Thread({ operation, level: level + 1 }))
|
||||
else Thread({ operation, level: level + 1 }).withId()
|
||||
else Thread({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The thread comment that included the @ mention */
|
||||
withComment(op?: { alias?: string; fn?: Fn<typeof ThreadComment> }) {
|
||||
comment(op?: { alias?: string; fn?: Fn<typeof ThreadComment> }) {
|
||||
operation.set({ alias: op?.alias, subField: "comment", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(ThreadComment({ operation, level: level + 1 }))
|
||||
else ThreadComment({ operation, level: level + 1 }).withId()
|
||||
else ThreadComment({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The user who mentioned the authenticated user */
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ThreadLikeNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who liked to the activity */
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the thread which was liked */
|
||||
withThreadId(op?: { alias?: string }) {
|
||||
threadId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "threadId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext(op?: { alias?: string }) {
|
||||
context(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The thread that the relevant comment belongs to */
|
||||
withThread(op?: { alias?: string; fn?: Fn<typeof Thread> }) {
|
||||
thread(op?: { alias?: string; fn?: Fn<typeof Thread> }) {
|
||||
operation.set({ alias: op?.alias, subField: "thread", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Thread({ operation, level: level + 1 }))
|
||||
else Thread({ operation, level: level + 1 }).withId()
|
||||
else Thread({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The liked thread comment */
|
||||
withComment(op?: { alias?: string; fn?: Fn<typeof ThreadComment> }) {
|
||||
comment(op?: { alias?: string; fn?: Fn<typeof ThreadComment> }) {
|
||||
operation.set({ alias: op?.alias, subField: "comment", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(ThreadComment({ operation, level: level + 1 }))
|
||||
else ThreadComment({ operation, level: level + 1 }).withId()
|
||||
else ThreadComment({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The user who liked the activity */
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const RelatedMediaAdditionNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the new media */
|
||||
withMediaId(op?: { alias?: string }) {
|
||||
mediaId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext(op?: { alias?: string }) {
|
||||
context(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The associated media of the airing schedule */
|
||||
withMedia(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
media(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "media", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaDataChangeNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the media that received data changes */
|
||||
withMediaId(op?: { alias?: string }) {
|
||||
mediaId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media data change */
|
||||
withContext(op?: { alias?: string }) {
|
||||
context(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media data change */
|
||||
withReason(op?: { alias?: string }) {
|
||||
reason(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "reason", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The media that received data changes */
|
||||
withMedia(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
media(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "media", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaMergeNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the media that was merged into */
|
||||
withMediaId(op?: { alias?: string }) {
|
||||
mediaId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The title of the deleted media */
|
||||
withDeletedMediaTitles(op?: { alias?: string }) {
|
||||
deletedMediaTitles(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "deletedMediaTitles", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media data change */
|
||||
withContext(op?: { alias?: string }) {
|
||||
context(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media merge */
|
||||
withReason(op?: { alias?: string }) {
|
||||
reason(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "reason", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The media that was merged into */
|
||||
withMedia(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
media(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "media", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaDeletionNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The title of the deleted media */
|
||||
withDeletedMediaTitle(op?: { alias?: string }) {
|
||||
deletedMediaTitle(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "deletedMediaTitle", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media deletion */
|
||||
withContext(op?: { alias?: string }) {
|
||||
context(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media deletion */
|
||||
withReason(op?: { alias?: string }) {
|
||||
reason(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "reason", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
|
@ -449,7 +449,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(AiringNotification({ operation, level: level + 1 }))
|
||||
else AiringNotification({ operation, level: level + 1 }).withId()
|
||||
else AiringNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
FollowingNotification(op?: { alias?: string; fn?: Fn<typeof FollowingNotification> }) {
|
||||
|
@ -461,7 +461,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(FollowingNotification({ operation, level: level + 1 }))
|
||||
else FollowingNotification({ operation, level: level + 1 }).withId()
|
||||
else FollowingNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
ActivityMessageNotification(
|
||||
|
@ -476,7 +476,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
})
|
||||
if (op?.fn) {
|
||||
op.fn(ActivityMessageNotification({ operation, level: level + 1 }))
|
||||
} else ActivityMessageNotification({ operation, level: level + 1 }).withId()
|
||||
} else ActivityMessageNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
ActivityMentionNotification(op?: { alias?: string; fn?: Fn<typeof ActivityNotification> }) {
|
||||
|
@ -488,7 +488,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ActivityNotification({ operation, level: level + 1 }))
|
||||
else ActivityNotification({ operation, level: level + 1 }).withId()
|
||||
else ActivityNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
ActivityReplyNotification(op?: { alias?: string; fn?: Fn<typeof ActivityNotification> }) {
|
||||
|
@ -500,7 +500,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ActivityNotification({ operation, level: level + 1 }))
|
||||
else ActivityNotification({ operation, level: level + 1 }).withId()
|
||||
else ActivityNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
ActivityReplySubscribedNotification(
|
||||
|
@ -514,7 +514,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ActivityNotification({ operation, level: level + 1 }))
|
||||
else ActivityNotification({ operation, level: level + 1 }).withId()
|
||||
else ActivityNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
ActivityLikeNotification(op?: { alias?: string; fn?: Fn<typeof ActivityNotification> }) {
|
||||
|
@ -526,7 +526,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ActivityNotification({ operation, level: level + 1 }))
|
||||
else ActivityNotification({ operation, level: level + 1 }).withId()
|
||||
else ActivityNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
ActivityReplyLikeNotification(op?: { alias?: string; fn?: Fn<typeof ActivityNotification> }) {
|
||||
|
@ -538,7 +538,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ActivityNotification({ operation, level: level + 1 }))
|
||||
else ActivityNotification({ operation, level: level + 1 }).withId()
|
||||
else ActivityNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
ThreadCommentMentionNotification(
|
||||
|
@ -552,7 +552,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ThreadCommentNotification({ operation, level: level + 1 }))
|
||||
else ThreadCommentNotification({ operation, level: level + 1 }).withId()
|
||||
else ThreadCommentNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
ThreadCommentReplyNotification(
|
||||
|
@ -566,7 +566,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ThreadCommentNotification({ operation, level: level + 1 }))
|
||||
else ThreadCommentNotification({ operation, level: level + 1 }).withId()
|
||||
else ThreadCommentNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
ThreadCommentSubscribedNotification(
|
||||
|
@ -580,7 +580,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ThreadCommentNotification({ operation, level: level + 1 }))
|
||||
else ThreadCommentNotification({ operation, level: level + 1 }).withId()
|
||||
else ThreadCommentNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
ThreadCommentLikeNotification(
|
||||
|
@ -594,7 +594,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ThreadCommentNotification({ operation, level: level + 1 }))
|
||||
else ThreadCommentNotification({ operation, level: level + 1 }).withId()
|
||||
else ThreadCommentNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
ThreadLikeNotification(op?: { alias?: string; fn?: Fn<typeof ThreadLikeNotification> }) {
|
||||
|
@ -606,7 +606,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ThreadLikeNotification({ operation, level: level + 1 }))
|
||||
else ThreadLikeNotification({ operation, level: level + 1 }).withId()
|
||||
else ThreadLikeNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
RelatedMediaAdditionNotification(
|
||||
|
@ -622,7 +622,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
if (op?.fn) {
|
||||
op.fn(RelatedMediaAdditionNotification({ operation, level: level + 1 }))
|
||||
} else {RelatedMediaAdditionNotification({ operation, level: level + 1 })
|
||||
.withId()}
|
||||
.id()}
|
||||
return this
|
||||
},
|
||||
MediaDataChangeNotification(
|
||||
|
@ -637,7 +637,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
})
|
||||
if (op?.fn) {
|
||||
op.fn(MediaDataChangeNotification({ operation, level: level + 1 }))
|
||||
} else MediaDataChangeNotification({ operation, level: level + 1 }).withId()
|
||||
} else MediaDataChangeNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
MediaMergeNotification(op?: { alias?: string; fn?: Fn<typeof MediaMergeNotification> }) {
|
||||
|
@ -649,7 +649,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(MediaMergeNotification({ operation, level: level + 1 }))
|
||||
else MediaMergeNotification({ operation, level: level + 1 }).withId()
|
||||
else MediaMergeNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
MediaDeletionNotification(op?: { alias?: string; fn?: Fn<typeof MediaDeletionNotification> }) {
|
||||
|
@ -661,7 +661,7 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(MediaDeletionNotification({ operation, level: level + 1 }))
|
||||
else MediaDeletionNotification({ operation, level: level + 1 }).withId()
|
||||
else MediaDeletionNotification({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -39,27 +39,27 @@ import { User } from "./User.ts"
|
|||
|
||||
export const PageInfo = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The total number of items. Note: This value is not guaranteed to be accurate, do not rely on this for logic */
|
||||
withTotal(op?: { alias?: string }) {
|
||||
total(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "total", level })
|
||||
return this
|
||||
},
|
||||
/** The count on a page */
|
||||
withPerPage(op?: { alias?: string }) {
|
||||
perPage(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "perPage", level })
|
||||
return this
|
||||
},
|
||||
/** The current page */
|
||||
withCurrentPage(op?: { alias?: string }) {
|
||||
currentPage(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "currentPage", level })
|
||||
return this
|
||||
},
|
||||
/** The last page */
|
||||
withLastPage(op?: { alias?: string }) {
|
||||
lastPage(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "lastPage", level })
|
||||
return this
|
||||
},
|
||||
/** If there is another page */
|
||||
withHasNextPage(op?: { alias?: string }) {
|
||||
hasNextPage(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "hasNextPage", level })
|
||||
return this
|
||||
},
|
||||
|
@ -67,12 +67,12 @@ export const PageInfo = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
pageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ alias: op.alias, subField: "pageInfo", level, hasSubField: true })
|
||||
op.fn(PageInfo({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withUsers(op?: { alias?: string; args?: AtLeastOne<PageUsersArgs>; fn?: Fn<typeof User> }) {
|
||||
users(op?: { alias?: string; args?: AtLeastOne<PageUsersArgs>; fn?: Fn<typeof User> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "users",
|
||||
|
@ -81,10 +81,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withMedia(op?: { alias?: string; args?: AtLeastOne<PageMediaArgs>; fn?: Fn<typeof Media> }) {
|
||||
media(op?: { alias?: string; args?: AtLeastOne<PageMediaArgs>; fn?: Fn<typeof Media> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "media",
|
||||
|
@ -93,10 +93,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withCharacters(
|
||||
characters(
|
||||
op?: { alias?: string; args?: AtLeastOne<PageCharactersArgs>; fn?: Fn<typeof Character> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -107,10 +107,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(Character({ operation, level: level + 1 }))
|
||||
else Character({ operation, level: level + 1 }).withId()
|
||||
else Character({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withStaff(op?: { alias?: string; args?: AtLeastOne<PageStaffArgs>; fn?: Fn<typeof Staff> }) {
|
||||
staff(op?: { alias?: string; args?: AtLeastOne<PageStaffArgs>; fn?: Fn<typeof Staff> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "staff",
|
||||
|
@ -119,10 +119,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(Staff({ operation, level: level + 1 }))
|
||||
else Staff({ operation, level: level + 1 }).withId()
|
||||
else Staff({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withStudios(op?: { alias?: string; args?: AtLeastOne<PageStudiosArgs>; fn?: Fn<typeof Studio> }) {
|
||||
studios(op?: { alias?: string; args?: AtLeastOne<PageStudiosArgs>; fn?: Fn<typeof Studio> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "studios",
|
||||
|
@ -131,10 +131,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(Studio({ operation, level: level + 1 }))
|
||||
else Studio({ operation, level: level + 1 }).withId()
|
||||
else Studio({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withMediaList(
|
||||
mediaList(
|
||||
op?: { alias?: string; args?: AtLeastOne<PageMediaListArgs>; fn?: Fn<typeof MediaList> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -145,10 +145,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(MediaList({ operation, level: level + 1 }))
|
||||
else MediaList({ operation, level: level + 1 }).withId()
|
||||
else MediaList({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withAiringSchedules(
|
||||
airingSchedules(
|
||||
op?: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<PageAiringSchedulesArgs>
|
||||
|
@ -163,10 +163,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(AiringSchedule({ operation, level: level + 1 }))
|
||||
else AiringSchedule({ operation, level: level + 1 }).withId()
|
||||
else AiringSchedule({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withMediaTrends(
|
||||
mediaTrends(
|
||||
op?: { alias?: string; args?: AtLeastOne<PageMediaTrendsArgs>; fn?: Fn<typeof MediaTrend> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -177,10 +177,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(MediaTrend({ operation, level: level + 1 }))
|
||||
else MediaTrend({ operation, level: level + 1 }).withMediaId()
|
||||
else MediaTrend({ operation, level: level + 1 }).mediaId()
|
||||
return this
|
||||
},
|
||||
withNotifications(
|
||||
notifications(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<PageNotificationsArgs>
|
||||
|
@ -197,7 +197,7 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
op.fn(NotificationUnion({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withFollowers(
|
||||
followers(
|
||||
op?: { alias?: string; args?: AtLeastOne<PageFollowersArgs>; fn?: Fn<typeof User> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -208,10 +208,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withFollowing(
|
||||
following(
|
||||
op?: { alias?: string; args?: AtLeastOne<PageFollowingArgs>; fn?: Fn<typeof User> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -222,10 +222,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withActivities(
|
||||
activities(
|
||||
op?: { alias?: string; args?: AtLeastOne<PageActivitiesArgs>; fn?: Fn<typeof ActivityUnion> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -238,13 +238,13 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
if (op?.fn) op.fn(ActivityUnion({ operation, level: level + 1 }))
|
||||
else {
|
||||
ActivityUnion({ operation, level: level + 1 })
|
||||
.withListActivity()
|
||||
.withMessageActivity()
|
||||
.withTextActivity()
|
||||
.listActivity()
|
||||
.messageActivity()
|
||||
.textActivity()
|
||||
}
|
||||
return this
|
||||
},
|
||||
withActivityReplies(
|
||||
activityReplies(
|
||||
op?: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<PageActivityRepliesArgs>
|
||||
|
@ -259,10 +259,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(ActivityReply({ operation, level: level + 1 }))
|
||||
else ActivityReply({ operation, level: level + 1 }).withId()
|
||||
else ActivityReply({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withThreads(op?: { alias?: string; args?: AtLeastOne<PageThreadsArgs>; fn?: Fn<typeof Thread> }) {
|
||||
threads(op?: { alias?: string; args?: AtLeastOne<PageThreadsArgs>; fn?: Fn<typeof Thread> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "threads",
|
||||
|
@ -271,10 +271,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(Thread({ operation, level: level + 1 }))
|
||||
else Thread({ operation, level: level + 1 }).withId()
|
||||
else Thread({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withThreadComments(
|
||||
threadComments(
|
||||
op?: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<PageThreadCommentsArgs>
|
||||
|
@ -289,10 +289,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(ThreadComment({ operation, level: level + 1 }))
|
||||
else ThreadComment({ operation, level: level + 1 }).withId()
|
||||
else ThreadComment({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withReviews(op?: { alias?: string; args?: AtLeastOne<PageReviewsArgs>; fn?: Fn<typeof Review> }) {
|
||||
reviews(op?: { alias?: string; args?: AtLeastOne<PageReviewsArgs>; fn?: Fn<typeof Review> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "reviews",
|
||||
|
@ -301,10 +301,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(Review({ operation, level: level + 1 }))
|
||||
else Review({ operation, level: level + 1 }).withId()
|
||||
else Review({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withRecommendations(
|
||||
recommendations(
|
||||
op?: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<PageRecommendationsArgs>
|
||||
|
@ -319,10 +319,10 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(Recommendation({ operation, level: level + 1 }))
|
||||
else Recommendation({ operation, level: level + 1 }).withId()
|
||||
else Recommendation({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withLikes(op?: { alias?: string; args?: AtLeastOne<PageLikesArgs>; fn?: Fn<typeof User> }) {
|
||||
likes(op?: { alias?: string; args?: AtLeastOne<PageLikesArgs>; fn?: Fn<typeof User> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "likes",
|
||||
|
@ -331,7 +331,7 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -4,28 +4,28 @@ import { User } from "./User.ts"
|
|||
import { PageInfo } from "./Page.ts"
|
||||
|
||||
const RecommendationEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op?: { alias?: string; fn?: Fn<typeof Recommendation> }) {
|
||||
node(op?: { alias?: string; fn?: Fn<typeof Recommendation> }) {
|
||||
operation.set({ alias: op?.alias, subField: "node", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Recommendation({ operation, level: level + 1 }))
|
||||
else Recommendation({ operation, level: level + 1 }).withId()
|
||||
else Recommendation({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
export const RecommendationConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { alias?: string; fn?: Fn<typeof RecommendationEdge> }) {
|
||||
edges(op?: { alias?: string; fn?: Fn<typeof RecommendationEdge> }) {
|
||||
operation.set({ alias: op?.alias, subField: "edges", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(RecommendationEdge({ operation, level: level + 1 }))
|
||||
else RecommendationEdge({ operation, level: level + 1 }).withNode()
|
||||
else RecommendationEdge({ operation, level: level + 1 }).node()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { alias?: string; fn?: Fn<typeof Recommendation> }) {
|
||||
nodes(op?: { alias?: string; fn?: Fn<typeof Recommendation> }) {
|
||||
operation.set({ alias: op?.alias, subField: "nodes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Recommendation({ operation, level: level + 1 }))
|
||||
else Recommendation({ operation, level: level + 1 }).withId()
|
||||
else Recommendation({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
pageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ alias: op.alias, subField: "pageInfo", level, hasSubField: true })
|
||||
op.fn(PageInfo({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
@ -34,39 +34,39 @@ export const RecommendationConnection = ({ operation, level }: Fields<OperationP
|
|||
|
||||
export const Recommendation = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the recommendation */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** Users rating of the recommendation */
|
||||
withRating(op?: { alias?: string }) {
|
||||
rating(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "rating", level })
|
||||
return this
|
||||
},
|
||||
/** The rating of the recommendation by currently authenticated user */
|
||||
withUserRating(op?: { alias?: string }) {
|
||||
userRating(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userRating", level })
|
||||
return this
|
||||
},
|
||||
/** The media the recommendation is from */
|
||||
withMedia(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
media(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "media", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The recommended media */
|
||||
withMediaRecommendation(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
mediaRecommendation(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "media", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The user that first created the recommendation */
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -4,29 +4,29 @@ import { Media } from "./Media.ts"
|
|||
import { User } from "./User.ts"
|
||||
|
||||
const ReviewEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op?: { alias?: string; fn?: Fn<typeof Review> }) {
|
||||
node(op?: { alias?: string; fn?: Fn<typeof Review> }) {
|
||||
operation.set({ alias: op?.alias, subField: "node", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Review({ operation, level: level + 1 }))
|
||||
else Review({ operation, level: level + 1 }).withId()
|
||||
else Review({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const ReviewConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { alias?: string; fn?: Fn<typeof ReviewEdge> }) {
|
||||
edges(op?: { alias?: string; fn?: Fn<typeof ReviewEdge> }) {
|
||||
operation.set({ alias: op?.alias, subField: "edges", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(ReviewEdge({ operation, level: level + 1 }))
|
||||
else ReviewEdge({ operation, level: level + 1 }).withNode()
|
||||
else ReviewEdge({ operation, level: level + 1 }).node()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { alias?: string; fn?: Fn<typeof Review> }) {
|
||||
nodes(op?: { alias?: string; fn?: Fn<typeof Review> }) {
|
||||
operation.set({ alias: op?.alias, subField: "nodes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Review({ operation, level: level + 1 }))
|
||||
else Review({ operation, level: level + 1 }).withId()
|
||||
else Review({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
pageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ alias: op.alias, subField: "pageInfo", level, hasSubField: true })
|
||||
op.fn(PageInfo({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
@ -35,87 +35,87 @@ export const ReviewConnection = ({ operation, level }: Fields<OperationParser>)
|
|||
|
||||
export const Review = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the review */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the review's creator */
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userid", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the review's media */
|
||||
withMediaId(op?: { alias?: string }) {
|
||||
mediaId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaid", level })
|
||||
return this
|
||||
},
|
||||
/** For which type of media the review is for */
|
||||
withMediaType(op?: { alias?: string }) {
|
||||
mediaType(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediatype", level })
|
||||
return this
|
||||
},
|
||||
/** A short summary of the review */
|
||||
withSummary(op?: { alias?: string }) {
|
||||
summary(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "summary", level })
|
||||
return this
|
||||
},
|
||||
/** The main review body text */
|
||||
withBody(op?: { alias?: string; args?: { asHtml: boolean } }) {
|
||||
body(op?: { alias?: string; args?: { asHtml: boolean } }) {
|
||||
operation.set({ alias: op?.alias, subField: "body", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** The total user rating of the review */
|
||||
withRating(op?: { alias?: string }) {
|
||||
rating(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "rating", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of user ratings of the review */
|
||||
withRatingAmount(op?: { alias?: string }) {
|
||||
ratingAmount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "ratingamount", level })
|
||||
return this
|
||||
},
|
||||
/** The rating of the review by currently authenticated user */
|
||||
withUserRating(op?: { alias?: string }) {
|
||||
userRating(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userrating", level })
|
||||
return this
|
||||
},
|
||||
/** The review score of the media */
|
||||
withScore(op?: { alias?: string }) {
|
||||
score(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "score", level })
|
||||
return this
|
||||
},
|
||||
/** If the review is not yet publicly published and is only viewable by creator */
|
||||
withPrivate(op?: { alias?: string }) {
|
||||
private(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "private", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the review page on the AniList website */
|
||||
withSiteUrl(op?: { alias?: string }) {
|
||||
siteUrl(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteurl", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the thread creation */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdat", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the thread last update */
|
||||
withUpdatedAt(op?: { alias?: string }) {
|
||||
updatedAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedat", level })
|
||||
return this
|
||||
},
|
||||
/** The creator of the review */
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The media the review is of */
|
||||
withMedia(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
media(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "media", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -12,7 +12,7 @@ import type { AtLeastOne } from "../types/AtLeastOne.ts"
|
|||
import { SiteTrendConnection } from "./SiteTrend.ts"
|
||||
|
||||
export const SiteStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withUsers(
|
||||
users(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsUsersArgs>
|
||||
|
@ -29,7 +29,7 @@ export const SiteStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
op.fn(SiteTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withAnime(
|
||||
anime(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsAnimeArgs>
|
||||
|
@ -46,7 +46,7 @@ export const SiteStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
op.fn(SiteTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withManga(
|
||||
manga(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsMangaArgs>
|
||||
|
@ -63,7 +63,7 @@ export const SiteStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
op.fn(SiteTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withCharacters(
|
||||
characters(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsCharactersArgs>
|
||||
|
@ -80,7 +80,7 @@ export const SiteStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
op.fn(SiteTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withStaff(
|
||||
staff(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsStaffArgs>
|
||||
|
@ -97,7 +97,7 @@ export const SiteStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
op.fn(SiteTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withStudios(
|
||||
studios(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsStudiosArgs>
|
||||
|
@ -114,7 +114,7 @@ export const SiteStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
op.fn(SiteTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withReviews(
|
||||
reviews(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsReviewsArgs>
|
||||
|
|
|
@ -3,24 +3,24 @@ import { PageInfo } from "./Page.ts"
|
|||
|
||||
const SiteTrend = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The day the data was recorded (timestamp) */
|
||||
withDate(op?: { alias?: string }) {
|
||||
date(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "date", level })
|
||||
return this
|
||||
},
|
||||
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
/** The change from yesterday */
|
||||
withChange(op?: { alias?: string }) {
|
||||
change(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "change", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const SiteTrendEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op: { alias?: string; fn: Fn<typeof SiteTrend> }) {
|
||||
node(op: { alias?: string; fn: Fn<typeof SiteTrend> }) {
|
||||
operation.set({ alias: op.alias, subField: "node", level, hasSubField: true })
|
||||
op.fn(SiteTrend({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
@ -28,18 +28,18 @@ const SiteTrendEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
})
|
||||
|
||||
export const SiteTrendConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op: { alias?: string; fn: Fn<typeof SiteTrendEdge> }) {
|
||||
edges(op: { alias?: string; fn: Fn<typeof SiteTrendEdge> }) {
|
||||
operation.set({ alias: op.alias, subField: "edges", level, hasSubField: true })
|
||||
op.fn(SiteTrendEdge({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withNodes(op: { alias?: string; fn: Fn<typeof SiteTrend> }) {
|
||||
nodes(op: { alias?: string; fn: Fn<typeof SiteTrend> }) {
|
||||
operation.set({ alias: op.alias, subField: "nodes", level, hasSubField: true })
|
||||
op.fn(SiteTrend({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
pageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ alias: op.alias, subField: "pageInfo", level, hasSubField: true })
|
||||
op.fn(PageInfo({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
|
|
@ -13,62 +13,62 @@ import { AtLeastOne } from "../types/AtLeastOne.ts"
|
|||
|
||||
export const StaffRoleType = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The voice actors of the character */
|
||||
withVoiceActor(op: { alias?: string; fn: Fn<typeof Staff> }) {
|
||||
voiceActor(op: { alias?: string; fn: Fn<typeof Staff> }) {
|
||||
operation.set({ alias: op.alias, subField: "voiceActor", level, hasSubField: true })
|
||||
op.fn(Staff({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** Notes regarding the VA's role for the character */
|
||||
withRoleNotes(op?: { alias?: string }) {
|
||||
roleNotes(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "roleNotes", level })
|
||||
return this
|
||||
},
|
||||
/** Used for grouping roles where multiple dubs exist for the same language. Either dubbing company name or language variant. */
|
||||
withDubGroup(op?: { alias?: string }) {
|
||||
dubGroup(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "dubGroup", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const StaffEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op?: { alias?: string; fn?: Fn<typeof Staff> }) {
|
||||
node(op?: { alias?: string; fn?: Fn<typeof Staff> }) {
|
||||
operation.set({ alias: op?.alias, subField: "node", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Staff({ operation, level: level + 1 }))
|
||||
else Staff({ operation, level: level + 1 }).withId()
|
||||
else Staff({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The id of the connection */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The role of the staff member in the production of the media */
|
||||
withRole(op?: { alias?: string }) {
|
||||
role(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "role", level })
|
||||
return this
|
||||
},
|
||||
/** The order the staff should be displayed from the users favourites */
|
||||
withFavouriteOrder(op?: { alias?: string }) {
|
||||
favouriteOrder(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favouriteOrder", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const StaffConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { alias?: string; fn?: Fn<typeof StaffEdge> }) {
|
||||
edges(op?: { alias?: string; fn?: Fn<typeof StaffEdge> }) {
|
||||
operation.set({ alias: op?.alias, subField: "edges", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(StaffEdge({ operation, level: level + 1 }))
|
||||
else StaffEdge({ operation, level: level + 1 }).withNode()
|
||||
else StaffEdge({ operation, level: level + 1 }).node()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { alias?: string; fn?: Fn<typeof Staff> }) {
|
||||
nodes(op?: { alias?: string; fn?: Fn<typeof Staff> }) {
|
||||
operation.set({ alias: op?.alias, subField: "nodes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Staff({ operation, level: level + 1 }))
|
||||
else Staff({ operation, level: level + 1 }).withId()
|
||||
else Staff({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
pageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ alias: op.alias, subField: "pageInfo", level, hasSubField: true })
|
||||
op.fn(PageInfo({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
@ -77,37 +77,37 @@ export const StaffConnection = ({ operation, level }: Fields<OperationParser>) =
|
|||
|
||||
const StaffName = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The person's given name */
|
||||
withFirst(op?: { alias?: string }) {
|
||||
first(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "first", level })
|
||||
return this
|
||||
},
|
||||
/** The person's middle name */
|
||||
withMiddle(op?: { alias?: string }) {
|
||||
middle(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "middle", level })
|
||||
return this
|
||||
},
|
||||
/** The person's surname */
|
||||
withLast(op?: { alias?: string }) {
|
||||
last(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "last", level })
|
||||
return this
|
||||
},
|
||||
/** The person's first and last name */
|
||||
withFull(op?: { alias?: string }) {
|
||||
full(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "full", level })
|
||||
return this
|
||||
},
|
||||
/** The person's full name in their native language */
|
||||
withNative(op?: { alias?: string }) {
|
||||
native(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "native", level })
|
||||
return this
|
||||
},
|
||||
/** Other names the staff member might be referred to as (pen names) */
|
||||
withAlternative(op?: { alias?: string }) {
|
||||
alternative(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "alternative", level })
|
||||
return this
|
||||
},
|
||||
/** The currently authenticated users preferred name language. Default romaji for non-authenticated */
|
||||
withUserPreferred(op?: { alias?: string }) {
|
||||
userPreferred(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userPreferred", level })
|
||||
return this
|
||||
},
|
||||
|
@ -115,12 +115,12 @@ const StaffName = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
const StaffImage = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The person's image of media at its largest size */
|
||||
withLarge(op?: { alias?: string }) {
|
||||
large(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "large", level })
|
||||
return this
|
||||
},
|
||||
/** The person's image of media at medium size */
|
||||
withMedium(op?: { alias?: string }) {
|
||||
medium(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "medium", level })
|
||||
return this
|
||||
},
|
||||
|
@ -128,103 +128,103 @@ const StaffImage = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
export const Staff = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the staff member */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The names of the staff member */
|
||||
withName(op?: { alias?: string; fn?: Fn<typeof StaffName> }) {
|
||||
name(op?: { alias?: string; fn?: Fn<typeof StaffName> }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(StaffName({ operation, level: level + 1 }))
|
||||
else StaffName({ operation, level: level + 1 }).withUserPreferred()
|
||||
else StaffName({ operation, level: level + 1 }).userPreferred()
|
||||
return this
|
||||
},
|
||||
/** The primary language of the staff member. Current values: Japanese, English, Korean, Italian, Spanish, Portuguese, French, German, Hebrew, Hungarian, Chinese, Arabic, Filipino, Catalan, Finnish, Turkish, Dutch, Swedish, Thai, Tagalog, Malaysian, Indonesian, Vietnamese, Nepali, Hindi, Urdu */
|
||||
withLanguageV2(op?: { alias?: string }) {
|
||||
languageV2(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "languageV2", level })
|
||||
return this
|
||||
},
|
||||
/** The staff images */
|
||||
withImage(op?: { alias?: string; fn?: Fn<typeof StaffImage> }) {
|
||||
image(op?: { alias?: string; fn?: Fn<typeof StaffImage> }) {
|
||||
operation.set({ alias: op?.alias, subField: "image", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(StaffImage({ operation, level: level + 1 }))
|
||||
else StaffImage({ operation, level: level + 1 }).withMedium()
|
||||
else StaffImage({ operation, level: level + 1 }).medium()
|
||||
return this
|
||||
},
|
||||
/** A general description of the staff member */
|
||||
withDescription(op?: { alias?: string; args?: { asHtml: boolean } }) {
|
||||
description(op?: { alias?: string; args?: { asHtml: boolean } }) {
|
||||
operation.set({ alias: op?.alias, subField: "description", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** The person's primary occupations */
|
||||
withPrimaryOccupations(op?: { alias?: string }) {
|
||||
primaryOccupations(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "primaryOccupations", level })
|
||||
return this
|
||||
},
|
||||
/** The staff's gender. Usually Male, Female, or Non-binary but can be any string. */
|
||||
withGender(op?: { alias?: string }) {
|
||||
gender(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "gender", level })
|
||||
return this
|
||||
},
|
||||
withDateOfBirth(op?: { alias?: string; fn?: Fn<typeof FuzzyDate> }) {
|
||||
dateOfBirth(op?: { alias?: string; fn?: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({ alias: op?.alias, subField: "dateOfBirth", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(FuzzyDate({ operation, level: level + 1 }))
|
||||
else {
|
||||
FuzzyDate({ operation, level: level + 1 })
|
||||
.withYear()
|
||||
.withMonth()
|
||||
.withDay()
|
||||
.year()
|
||||
.month()
|
||||
.day()
|
||||
}
|
||||
return this
|
||||
},
|
||||
withDateOfDeath(op?: { alias?: string; fn?: Fn<typeof FuzzyDate> }) {
|
||||
dateOfDeath(op?: { alias?: string; fn?: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({ alias: op?.alias, subField: "dateOfDeath", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(FuzzyDate({ operation, level: level + 1 }))
|
||||
else {
|
||||
FuzzyDate({ operation, level: level + 1 })
|
||||
.withYear()
|
||||
.withMonth()
|
||||
.withDay()
|
||||
.year()
|
||||
.month()
|
||||
.day()
|
||||
}
|
||||
return this
|
||||
},
|
||||
/** The person's age in years */
|
||||
withAge(op?: { alias?: string }) {
|
||||
age(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "age", level })
|
||||
return this
|
||||
},
|
||||
/** [startYear, endYear] (If the 2nd value is not present staff is still active) */
|
||||
withYearsActive(op?: { alias?: string }) {
|
||||
yearsActive(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "yearsActive", level })
|
||||
return this
|
||||
},
|
||||
/** The persons birthplace or hometown */
|
||||
withHomeTown(op?: { alias?: string }) {
|
||||
homeTown(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "homeTown", level })
|
||||
return this
|
||||
},
|
||||
/** The persons blood type */
|
||||
withBloodType(op?: { alias?: string }) {
|
||||
bloodType(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "bloodType", level })
|
||||
return this
|
||||
},
|
||||
/** If the staff member is marked as favourite by the currently authenticated user */
|
||||
withIsFavourite(op?: { alias?: string }) {
|
||||
isFavourite(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavourite", level })
|
||||
return this
|
||||
},
|
||||
/** If the staff member is blocked from being added to favourites */
|
||||
withIsFavouriteBlocked(op?: { alias?: string }) {
|
||||
isFavouriteBlocked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavouriteBlocked", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the staff page on the AniList website */
|
||||
withSiteUrl(op?: { alias?: string }) {
|
||||
siteUrl(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** Media where the staff member has a production role */
|
||||
withStaffMedia(
|
||||
staffMedia(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<StaffStaffMediaArgs> | undefined
|
||||
|
@ -242,7 +242,7 @@ export const Staff = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** Characters voiced by the actor */
|
||||
withCharacters(
|
||||
characters(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<StaffCharactersArgs> | undefined
|
||||
|
@ -260,7 +260,7 @@ export const Staff = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** Media the actor voiced characters in. (Same data as characters with media as node instead of characters) */
|
||||
withCharacterMedia(
|
||||
characterMedia(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<StaffCharacterMediaArgs>
|
||||
|
@ -278,36 +278,36 @@ export const Staff = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** Staff member that the submission is referencing */
|
||||
withStaff(op?: { alias?: string; fn?: Fn<typeof Staff> }) {
|
||||
staff(op?: { alias?: string; fn?: Fn<typeof Staff> }) {
|
||||
operation.set({ alias: op?.alias, subField: "staff", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Staff({ operation, level: level + 1 }))
|
||||
else Staff({ operation, level: level + 1 }).withId()
|
||||
else Staff({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** Submitter for the submission */
|
||||
withSubmitter(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
submitter(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "submitter", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** Status of the submission */
|
||||
withSubmissionStatus(op?: { alias?: string }) {
|
||||
submissionStatus(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "submissionStatus", level })
|
||||
return this
|
||||
},
|
||||
/** Inner details of submission status */
|
||||
withSubmissionNotes(op?: { alias?: string }) {
|
||||
submissionNotes(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "submissionNotes", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of user's who have favourited the staff member */
|
||||
withFavourites(op?: { alias?: string }) {
|
||||
favourites(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favourites", level })
|
||||
return this
|
||||
},
|
||||
/** Notes for site moderators */
|
||||
withModNotes(op?: { alias?: string }) {
|
||||
modNotes(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "modNotes", level })
|
||||
return this
|
||||
},
|
||||
|
|
|
@ -5,44 +5,44 @@ import { MediaConnection } from "./Media.ts"
|
|||
import { AtLeastOne } from "../types/AtLeastOne.ts"
|
||||
|
||||
const StudioEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op?: { alias?: string; fn?: Fn<typeof Studio> }) {
|
||||
node(op?: { alias?: string; fn?: Fn<typeof Studio> }) {
|
||||
operation.set({ alias: op?.alias, subField: "node", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Studio({ operation, level: level + 1 }))
|
||||
else Studio({ operation, level: level + 1 }).withId()
|
||||
else Studio({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The id of the connection */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** If the studio is the main animation studio of the anime */
|
||||
withIsMain(op?: { alias?: string }) {
|
||||
isMain(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isMain", level })
|
||||
return this
|
||||
},
|
||||
/** The order the character should be displayed from the users favourites */
|
||||
withFavouriteOrder(op?: { alias?: string }) {
|
||||
favouriteOrder(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favouriteOrder", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const StudioConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { alias?: string; fn?: Fn<typeof StudioEdge> }) {
|
||||
edges(op?: { alias?: string; fn?: Fn<typeof StudioEdge> }) {
|
||||
operation.set({ alias: op?.alias, subField: "edges", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(StudioEdge({ operation, level: level + 1 }))
|
||||
else StudioEdge({ operation, level: level + 1 }).withNode()
|
||||
else StudioEdge({ operation, level: level + 1 }).node()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { alias?: string; fn?: Fn<typeof Studio> }) {
|
||||
nodes(op?: { alias?: string; fn?: Fn<typeof Studio> }) {
|
||||
operation.set({ alias: op?.alias, subField: "nodes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Studio({ operation, level: level + 1 }))
|
||||
else Studio({ operation, level: level + 1 }).withId()
|
||||
else Studio({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
pageInfo(op: { alias?: string; fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ alias: op.alias, subField: "pageInfo", level, hasSubField: true })
|
||||
op.fn(PageInfo({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
@ -51,22 +51,22 @@ export const StudioConnection = ({ operation, level }: Fields<OperationParser>)
|
|||
|
||||
export const Studio = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the studio */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The name of the studio */
|
||||
withName(op?: { alias?: string }) {
|
||||
name(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
/** If the studio is an animation studio or a different kind of company */
|
||||
withIsAnimationStudio(op?: { alias?: string }) {
|
||||
isAnimationStudio(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isAnimationStudio", level })
|
||||
return this
|
||||
},
|
||||
/** The media the studio has worked on */
|
||||
withMedia(
|
||||
media(
|
||||
op: { alias?: string; args?: AtLeastOne<StudioMediaArgs>; fn: Fn<typeof MediaConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
|
@ -80,17 +80,17 @@ export const Studio = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The url for the studio page on the AniList website */
|
||||
withSiteUrl(op?: { alias?: string }) {
|
||||
siteUrl(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** If the studio is marked as favourite by the currently authenticated user */
|
||||
withIsFavourite(op?: { alias?: string }) {
|
||||
isFavourite(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavourite", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of user's who have favourited the studio */
|
||||
withFavourites(op?: { alias?: string }) {
|
||||
favourites(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favourites", level })
|
||||
return this
|
||||
},
|
||||
|
|
|
@ -4,12 +4,12 @@ import { User } from "./User.ts"
|
|||
|
||||
const ThreadCategory = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the category */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The name of the category */
|
||||
withName(op?: { alias?: string }) {
|
||||
name(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
|
@ -17,122 +17,122 @@ const ThreadCategory = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
export const Thread = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the thread */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The title of the thread */
|
||||
withTitle(op?: { alias?: string }) {
|
||||
title(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "title", level })
|
||||
return this
|
||||
},
|
||||
/** The text body of the thread (Markdown) */
|
||||
withBody(op?: { alias?: string; args?: { asHtml: boolean } }) {
|
||||
body(op?: { alias?: string; args?: { asHtml: boolean } }) {
|
||||
operation.set({ alias: op?.alias, subField: "body", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** The id of the thread owner user */
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who most recently commented on the thread */
|
||||
withReplyUserId(op?: { alias?: string }) {
|
||||
replyUserId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "replyUserId", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the most recent comment on the thread */
|
||||
withReplyCommentId(op?: { alias?: string }) {
|
||||
replyCommentId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "replyCommentId", level })
|
||||
return this
|
||||
},
|
||||
/** The number of comments on the thread */
|
||||
withReplyCount(op?: { alias?: string }) {
|
||||
replyCount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "replyCount", level })
|
||||
return this
|
||||
},
|
||||
/** The number of times users have viewed the thread */
|
||||
withViewCount(op?: { alias?: string }) {
|
||||
viewCount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "viewCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the thread is locked and can receive comments */
|
||||
withIsLocked(op?: { alias?: string }) {
|
||||
isLocked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the thread is stickied and should be displayed at the top of the page */
|
||||
withIsSticky(op?: { alias?: string }) {
|
||||
isSticky(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isSticky", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user is subscribed to the thread */
|
||||
withIsSubscribed(op?: { alias?: string }) {
|
||||
isSubscribed(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isSubscribed", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the thread has */
|
||||
withLikeCount(op?: { alias?: string }) {
|
||||
likeCount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the thread */
|
||||
withIsLiked(op?: { alias?: string }) {
|
||||
isLiked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLiked", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the last reply */
|
||||
withRepliedAt(op?: { alias?: string }) {
|
||||
repliedAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "repliedAt", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the thread creation */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the thread last update */
|
||||
withUpdatedAt(op?: { alias?: string }) {
|
||||
updatedAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedAt", level })
|
||||
return this
|
||||
},
|
||||
/** The owner of the thread */
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The user to last reply to the thread */
|
||||
withReplyUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
replyUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "replayUser", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The users who liked the thread */
|
||||
withLikes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
likes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "likes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The url for the thread page on the AniList website */
|
||||
withSiteUrl(op?: { alias?: string }) {
|
||||
siteUrl(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** The categories of the thread */
|
||||
withCategories(op: { alias?: string; fn: Fn<typeof ThreadCategory> }) {
|
||||
categories(op: { alias?: string; fn: Fn<typeof ThreadCategory> }) {
|
||||
operation.set({ alias: op.alias, subField: "categories", level, hasSubField: true })
|
||||
op.fn(ThreadCategory({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The media categories of the thread */
|
||||
withMediaCategories(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
mediaCategories(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaCategories", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
else Media({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -4,78 +4,78 @@ import { Fields, Fn, OperationParser } from "../types/Anilist.ts"
|
|||
|
||||
export const ThreadComment = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the comment */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the comment's owner */
|
||||
withUserId(op?: { alias?: string }) {
|
||||
userId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The id of thread the comment belongs to */
|
||||
withThreadId(op?: { alias?: string }) {
|
||||
threadId(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "threadId", level })
|
||||
return this
|
||||
},
|
||||
/** The text content of the comment (Markdown) */
|
||||
withComment(op?: { alias?: string; args?: { asHtml: boolean } }) {
|
||||
comment(op?: { alias?: string; args?: { asHtml: boolean } }) {
|
||||
operation.set({ alias: op?.alias, subField: "comment", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the comment has */
|
||||
withLikeCount(op?: { alias?: string }) {
|
||||
likeCount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the comment */
|
||||
withIsLiked(op?: { alias?: string }) {
|
||||
isLiked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLiked", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the comment page on the AniList website */
|
||||
withSiteUrl(op?: { alias?: string }) {
|
||||
siteUrl(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the comments creation */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the comments last update */
|
||||
withUpdatedAt(op?: { alias?: string }) {
|
||||
updatedAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedAt", level })
|
||||
return this
|
||||
},
|
||||
/** The thread the comment belongs to */
|
||||
withThread(op?: { alias?: string; fn?: Fn<typeof Thread> }) {
|
||||
thread(op?: { alias?: string; fn?: Fn<typeof Thread> }) {
|
||||
operation.set({ alias: op?.alias, subField: "thread", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Thread({ operation, level: level + 1 }))
|
||||
else Thread({ operation, level: level + 1 }).withId()
|
||||
else Thread({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The user who created the comment */
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
user(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The users who liked the comment */
|
||||
withLikes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
likes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "likes", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
else User({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
/** The comment's child reply comments */
|
||||
withChildComments(op?: { alias?: string }) {
|
||||
childComments(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "childComments", level })
|
||||
return this
|
||||
},
|
||||
/** If the comment tree is locked and may not receive replies or edits */
|
||||
withIsLocked(op?: { alias?: string }) {
|
||||
isLocked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
|
|
|
@ -5,22 +5,22 @@ import { MediaListOptions } from "./MediaList.ts"
|
|||
import { UserStatisticTypes } from "./UserStatistics.ts"
|
||||
|
||||
const NotificationOption = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEnabled(op?: { alias?: string }) {
|
||||
enabled(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "enabled", level })
|
||||
return this
|
||||
},
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ListActivityOption = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withDisabled(op?: { alias?: string }) {
|
||||
disabled(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "disabled", level })
|
||||
return this
|
||||
},
|
||||
withType(op?: { alias?: string }) {
|
||||
type(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
|
@ -28,17 +28,17 @@ const ListActivityOption = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
export const UserPreviousName = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** A previous name of the user. */
|
||||
withName(op?: { alias?: string }) {
|
||||
name(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
/** When the user first changed from this name. */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** When the user most recently changed from this name. */
|
||||
withUpdatedAt(op?: { alias?: string }) {
|
||||
updatedAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedAt", level })
|
||||
return this
|
||||
},
|
||||
|
@ -46,62 +46,62 @@ export const UserPreviousName = ({ operation, level }: Fields<OperationParser>)
|
|||
|
||||
export const UserOptions = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The language the user wants to see media titles in */
|
||||
withTitleLanguage(op?: { alias?: string }) {
|
||||
titleLanguage(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "titleLanguage", level })
|
||||
return this
|
||||
},
|
||||
|
||||
/** Whether the user has enabled viewing of 18+ content */
|
||||
withDisplayAdultContent(op?: { alias?: string }) {
|
||||
displayAdultContent(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "displayAdultContent", level })
|
||||
return this
|
||||
},
|
||||
|
||||
/** Whether the user receives notifications when a show they are watching aires */
|
||||
withAiringNotifications(op?: { alias?: string }) {
|
||||
airingNotifications(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "airingNotifications", level })
|
||||
return this
|
||||
},
|
||||
|
||||
/** Profile highlight color (blue, purple, pink, orange, red, green, gray) */
|
||||
withProfileColor(op?: { alias?: string }) {
|
||||
profileColor(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "profileColor", level })
|
||||
return this
|
||||
},
|
||||
|
||||
/** Notification options */
|
||||
withNotificationOptions(op: { alias?: string; fn: Fn<typeof NotificationOption> }) {
|
||||
notificationOptions(op: { alias?: string; fn: Fn<typeof NotificationOption> }) {
|
||||
operation.set({ alias: op.alias, subField: "notificationOptions", level, hasSubField: true })
|
||||
op.fn(NotificationOption({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
|
||||
/** The user's timezone offset (Auth user only) */
|
||||
withTimezone(op?: { alias?: string }) {
|
||||
timezone(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "timezone", level })
|
||||
return this
|
||||
},
|
||||
|
||||
/** Minutes between activity for them to be merged together. 0 is Never, Above 2 weeks (20160 mins) is Always. */
|
||||
withActivityMergeTime(op?: { alias?: string }) {
|
||||
activityMergeTime(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "activityMergeTime", level })
|
||||
return this
|
||||
},
|
||||
|
||||
/** The language the user wants to see staff and character names in */
|
||||
withStaffNameLanguage(op?: { alias?: string }) {
|
||||
staffNameLanguage(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "staffNameLanguage", level })
|
||||
return this
|
||||
},
|
||||
|
||||
/** Whether the user only allow messages from users they follow */
|
||||
withRestrictMessagesToFollowing(op?: { alias?: string }) {
|
||||
restrictMessagesToFollowing(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "restrictMessagesToFollowing", level })
|
||||
return this
|
||||
},
|
||||
|
||||
/** The list activity types the user has disabled from being created from list updates */
|
||||
withDisabledListActivity(op: { alias?: string; fn: Fn<typeof ListActivityOption> }) {
|
||||
disabledListActivity(op: { alias?: string; fn: Fn<typeof ListActivityOption> }) {
|
||||
operation.set({ alias: op.alias, subField: "disabledListActivity", level, hasSubField: true })
|
||||
op.fn(ListActivityOption({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
@ -110,12 +110,12 @@ export const UserOptions = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
export const UserAvatar = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The avatar of user at its largest size */
|
||||
withLarge(op?: { alias?: string }) {
|
||||
large(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "large", level })
|
||||
return this
|
||||
},
|
||||
/** The avatar of user at medium size */
|
||||
withMedium(op?: { alias?: string }) {
|
||||
medium(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "medium", level })
|
||||
return this
|
||||
},
|
||||
|
@ -123,65 +123,65 @@ export const UserAvatar = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
export const User = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the user */
|
||||
withId(op?: { alias?: string }) {
|
||||
id(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The name of the user */
|
||||
withName(op?: { alias?: string }) {
|
||||
name(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
/** The bio written by user (Markdown) */
|
||||
withAbout(op?: { alias?: string; args?: { asHtml: boolean } }) {
|
||||
about(op?: { alias?: string; args?: { asHtml: boolean } }) {
|
||||
operation.set({ alias: op?.alias, subField: "about", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** The user's avatar images */
|
||||
withAvatar(op?: { alias?: string; fn?: Fn<typeof UserAvatar> }) {
|
||||
avatar(op?: { alias?: string; fn?: Fn<typeof UserAvatar> }) {
|
||||
operation.set({ alias: op?.alias, subField: "avatar", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(UserAvatar({ operation, level: level + 1 }))
|
||||
else UserAvatar({ operation, level: level + 1 }).withMedium()
|
||||
else UserAvatar({ operation, level: level + 1 }).medium()
|
||||
return this
|
||||
},
|
||||
/** The user's banner images */
|
||||
withBannerImage(op?: { alias?: string }) {
|
||||
bannerImage(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "bannerImage", level })
|
||||
return this
|
||||
},
|
||||
/** If the authenticated user if following this user */
|
||||
withIsFollowing(op?: { alias?: string }) {
|
||||
isFollowing(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFollowing", level })
|
||||
return this
|
||||
},
|
||||
/** If this user if following the authenticated user */
|
||||
withIsFollower(op?: { alias?: string }) {
|
||||
isFollower(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFollower", level })
|
||||
return this
|
||||
},
|
||||
/** If the user is blocked by the authenticated user */
|
||||
withIsBlocked(op?: { alias?: string }) {
|
||||
isBlocked(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isBlocked", level })
|
||||
return this
|
||||
},
|
||||
withBans(op?: { alias?: string }) {
|
||||
bans(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "bans", level })
|
||||
return this
|
||||
},
|
||||
/* The user's general options */
|
||||
withOptions(op: { alias?: string; fn: Fn<typeof UserOptions> }) {
|
||||
options(op: { alias?: string; fn: Fn<typeof UserOptions> }) {
|
||||
operation.set({ alias: op.alias, subField: "options", level, hasSubField: true })
|
||||
op.fn(UserOptions({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/* The user's media list options */
|
||||
withMediaListOptions(op: { alias?: string; fn: Fn<typeof MediaListOptions> }) {
|
||||
mediaListOptions(op: { alias?: string; fn: Fn<typeof MediaListOptions> }) {
|
||||
operation.set({ alias: op.alias, subField: "mediaListOptions", level, hasSubField: true })
|
||||
op.fn(MediaListOptions({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/* The users favourites */
|
||||
withFavourites(op: { alias?: string; args?: UserFavouritesArgs; fn: Fn<typeof Favourites> }) {
|
||||
favourites(op: { alias?: string; args?: UserFavouritesArgs; fn: Fn<typeof Favourites> }) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "favourites",
|
||||
|
@ -193,51 +193,51 @@ export const User = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/* The users anime & manga list statistics */
|
||||
withStatistics(op: { alias?: string; fn: Fn<typeof UserStatisticTypes> }) {
|
||||
statistics(op: { alias?: string; fn: Fn<typeof UserStatisticTypes> }) {
|
||||
operation.set({ alias: op.alias, subField: "statistics", level, hasSubField: true })
|
||||
op.fn(UserStatisticTypes({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/* The number of unread notifications the user has */
|
||||
withUnreadNotificationCount(op?: { alias?: string }) {
|
||||
unreadNotificationCount(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "unreadNotificationCount", level })
|
||||
return this
|
||||
},
|
||||
/* The url for the user page on the AniList website */
|
||||
withSiteUrl(op?: { alias?: string }) {
|
||||
siteUrl(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/* The donation tier of the user */
|
||||
withDonatorTier(op?: { alias?: string }) {
|
||||
donatorTier(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "donatorTier", level })
|
||||
return this
|
||||
},
|
||||
/* Custom donation badge text */
|
||||
withDonatorBadge(op?: { alias?: string }) {
|
||||
donatorBadge(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "donatorBadge", level })
|
||||
return this
|
||||
},
|
||||
/* The user's moderator roles if they are a site moderator */
|
||||
withModeratorRoles(op?: { alias?: string }) {
|
||||
moderatorRoles(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "moderatorRoles", level })
|
||||
return this
|
||||
},
|
||||
/* When the user's account was created. (Does not exist for accounts created before 2020) */
|
||||
withCreatedAt(op?: { alias?: string }) {
|
||||
createdAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/* When the user's data was last updated */
|
||||
withUpdatedAt(op?: { alias?: string }) {
|
||||
updatedAt(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedAt", level })
|
||||
return this
|
||||
},
|
||||
/* The user's previously used names. */
|
||||
withPreviousNames(op?: { alias?: string; fn?: Fn<typeof UserPreviousName> }) {
|
||||
previousNames(op?: { alias?: string; fn?: Fn<typeof UserPreviousName> }) {
|
||||
operation.set({ alias: op?.alias, subField: "previousNames", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(UserPreviousName({ operation, level: level + 1 }))
|
||||
else UserPreviousName({ operation, level: level + 1 }).withName()
|
||||
else UserPreviousName({ operation, level: level + 1 }).name()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -17,50 +17,50 @@ import { Staff } from "./Staff.ts"
|
|||
import { Studio } from "./Studio.ts"
|
||||
|
||||
const UserFormatStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds(op?: { alias?: string }) {
|
||||
mediaIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
withFormat(op?: { alias?: string }) {
|
||||
format(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "format", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserStatusStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds(op?: { alias?: string }) {
|
||||
mediaIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
|
@ -71,23 +71,23 @@ const UserStatusStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
})
|
||||
|
||||
const UserScoreStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds(op?: { alias?: string }) {
|
||||
mediaIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
|
@ -98,23 +98,23 @@ const UserScoreStatistics = ({ operation, level }: Fields<OperationParser>) => (
|
|||
})
|
||||
|
||||
const UserLengthStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds(op?: { alias?: string }) {
|
||||
mediaIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
|
@ -125,23 +125,23 @@ const UserLengthStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
})
|
||||
|
||||
const UserReleaseYearStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds(op?: { alias?: string }) {
|
||||
mediaIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
|
@ -152,23 +152,23 @@ const UserReleaseYearStatistics = ({ operation, level }: Fields<OperationParser>
|
|||
})
|
||||
|
||||
const UserStartYearStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds(op?: { alias?: string }) {
|
||||
mediaIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
|
@ -179,23 +179,23 @@ const UserStartYearStatistics = ({ operation, level }: Fields<OperationParser>)
|
|||
})
|
||||
|
||||
const UserGenreStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds(op?: { alias?: string }) {
|
||||
mediaIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
|
@ -206,23 +206,23 @@ const UserGenreStatistics = ({ operation, level }: Fields<OperationParser>) => (
|
|||
})
|
||||
|
||||
const UserTagStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds(op?: { alias?: string }) {
|
||||
mediaIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
|
@ -233,23 +233,23 @@ const UserTagStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
})
|
||||
|
||||
const UserCountryStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds(op?: { alias?: string }) {
|
||||
mediaIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
|
@ -260,154 +260,154 @@ const UserCountryStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
})
|
||||
|
||||
const UserVoiceActorStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds(op?: { alias?: string }) {
|
||||
mediaIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
withVoiceActor(op?: { alias?: string; fn?: Fn<typeof Staff> }) {
|
||||
voiceActor(op?: { alias?: string; fn?: Fn<typeof Staff> }) {
|
||||
operation.set({ alias: op?.alias, subField: "voiceActor", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Staff({ operation, level: level + 1 }))
|
||||
else Staff({ operation, level: level + 1 }).withId()
|
||||
else Staff({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
withCharacterIds(op?: { alias?: string }) {
|
||||
characterIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "characterIds", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserStaffStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds(op?: { alias?: string }) {
|
||||
mediaIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
withStaff(op?: { alias?: string; fn?: Fn<typeof Staff> }) {
|
||||
staff(op?: { alias?: string; fn?: Fn<typeof Staff> }) {
|
||||
operation.set({ alias: op?.alias, subField: "staff", level, hasSubField: true })
|
||||
if (op?.fn) op?.fn(Staff({ operation, level: level + 1 }))
|
||||
else Staff({ operation, level: level + 1 }).withId()
|
||||
else Staff({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserStudioStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds(op?: { alias?: string }) {
|
||||
mediaIds(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
withStudio(op?: { alias?: string; fn?: Fn<typeof Studio> }) {
|
||||
studio(op?: { alias?: string; fn?: Fn<typeof Studio> }) {
|
||||
operation.set({ alias: op?.alias, subField: "studio", level, hasSubField: true })
|
||||
if (op?.fn) op.fn(Studio({ operation, level: level + 1 }))
|
||||
else Studio({ operation, level: level + 1 }).withId()
|
||||
else Studio({ operation, level: level + 1 }).id()
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const UserStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount(op?: { alias?: string }) {
|
||||
count(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore(op?: { alias?: string }) {
|
||||
meanScore(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withStandardDeviation(op?: { alias?: string }) {
|
||||
standardDeviation(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "standardDeviation", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched(op?: { alias?: string }) {
|
||||
minutesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withEpisodesWatched(op?: { alias?: string }) {
|
||||
episodesWatched(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "episodesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead(op?: { alias?: string }) {
|
||||
chaptersRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withVolumesRead(op?: { alias?: string }) {
|
||||
volumesRead(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "volumesRead", level })
|
||||
return this
|
||||
},
|
||||
withFormats(
|
||||
formats(
|
||||
op: { alias?: string; args?: UserStatisticsFormatsArgs; fn: Fn<typeof UserFormatStatistics> },
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "formats", level, hasSubField: true })
|
||||
op.fn(UserFormatStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withStatuses(
|
||||
statuses(
|
||||
op: { alias?: string; args?: UserStatisticsStatusesArgs; fn: Fn<typeof UserStatusStatistics> },
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "statuses", level, hasSubField: true })
|
||||
op.fn(UserStatusStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withScores(
|
||||
scores(
|
||||
op: { alias?: string; args?: UserStatisticsScoresArgs; fn: Fn<typeof UserScoreStatistics> },
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "scores", level, hasSubField: true })
|
||||
op.fn(UserScoreStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withLengths(
|
||||
lengths(
|
||||
op: { alias?: string; args?: UserStatisticsLengthsArgs; fn: Fn<typeof UserLengthStatistics> },
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "lengths", level, hasSubField: true })
|
||||
op.fn(UserLengthStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withReleaseYears(
|
||||
releaseYears(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: UserStatisticsReleaseYearsArgs
|
||||
|
@ -418,7 +418,7 @@ export const UserStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
op.fn(UserReleaseYearStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withStartYears(
|
||||
startYears(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: UserStatisticsStartYearsArgs
|
||||
|
@ -429,21 +429,21 @@ export const UserStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
op.fn(UserStartYearStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withGenres(
|
||||
genres(
|
||||
op: { alias?: string; args?: UserStatisticsGenresArgs; fn: Fn<typeof UserGenreStatistics> },
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "genres", level, hasSubField: true })
|
||||
op.fn(UserGenreStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withTags(
|
||||
tags(
|
||||
op: { alias?: string; args?: UserStatisticsTagsArgs; fn: Fn<typeof UserTagStatistics> },
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "tags", level, hasSubField: true })
|
||||
op.fn(UserTagStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withCountries(
|
||||
countries(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: UserStatisticsCountriesArgs
|
||||
|
@ -454,7 +454,7 @@ export const UserStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
op.fn(UserCountryStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withVoiceActors(
|
||||
voiceActors(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: UserStatisticsVoiceActorsArgs
|
||||
|
@ -465,14 +465,14 @@ export const UserStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
op.fn(UserVoiceActorStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withStaff(
|
||||
staff(
|
||||
op: { alias?: string; args?: UserStatisticsStaffArgs; fn: Fn<typeof UserStaffStatistics> },
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "staff", level, hasSubField: true })
|
||||
op.fn(UserStaffStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withStudios(
|
||||
studios(
|
||||
op: { alias?: string; args?: UserStatisticsStudiosArgs; fn: Fn<typeof UserStudioStatistics> },
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "studios", level, hasSubField: true })
|
||||
|
@ -482,12 +482,12 @@ export const UserStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
})
|
||||
|
||||
export const UserStatisticTypes = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withAnime(op: { alias?: string; fn: Fn<typeof UserStatistics> }) {
|
||||
anime(op: { alias?: string; fn: Fn<typeof UserStatistics> }) {
|
||||
operation.set({ alias: op.alias, subField: "anime", level, hasSubField: true })
|
||||
op.fn(UserStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withManga(op: { alias?: string; fn: Fn<typeof UserStatistics> }) {
|
||||
manga(op: { alias?: string; fn: Fn<typeof UserStatistics> }) {
|
||||
operation.set({ alias: op.alias, subField: "manga", level, hasSubField: true })
|
||||
op.fn(UserStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
|
|
Loading…
Reference in New Issue