add support for field aliases
This commit is contained in:
parent
e9e18f6034
commit
548aabdf5c
315
src/anilist.ts
315
src/anilist.ts
|
@ -116,27 +116,27 @@ export const operationParser: OperationParser = (root: string) => {
|
|||
get() {
|
||||
return operation.replace(/(\n|,)?(\t+| )%\w+\b/g, "")
|
||||
},
|
||||
set({ level, subField, alias, hasSubField, isUnion, variables }) {
|
||||
set({ level, subField, alias, hasSubField, isUnion, variables = "" }) {
|
||||
fields.splice(level, 0, subField)
|
||||
while (fields.length - 1 > level) fields.pop()
|
||||
|
||||
const convertedType: [string[], string[]] = [[], []]
|
||||
if (variables) {
|
||||
const convertedType: [string[], string[]] = [[], []]
|
||||
const variable = Object.entries(variables)
|
||||
for (let i = 0; i <= variable.length - 1; i++) {
|
||||
convertedType[0].push(`${variable[i][0]}: ${rewriteVarValues(variable[i][1])}`)
|
||||
}
|
||||
variables = ` (${convertedType[0].join(", ")})`
|
||||
}
|
||||
|
||||
const union = isUnion ? "... on " : ""
|
||||
alias = alias ? `${alias}: ` : ""
|
||||
subField = hasSubField ? `${` {\n${t(level + 1)}%${fields.at(-1)}\n${t(level)}}`}` : ""
|
||||
|
||||
operation = replaceLast(
|
||||
operation,
|
||||
`%${fields[level - 1]}`,
|
||||
`${union}${alias}${fields[level]}${variables ? ` (${convertedType[0].join(", ")})` : ""}${
|
||||
hasSubField ? `${` {\n${t(level + 1)}%${fields.at(-1)}\n${t(level)}}`}` : ""
|
||||
}\n${t(level)}%${fields[level - 1]}`,
|
||||
`${union}${alias}${fields[level]}${variables}${subField}\n${t(level)}%${fields[level - 1]}`,
|
||||
)
|
||||
|
||||
return this
|
||||
|
@ -194,24 +194,24 @@ const fetch: Fetch = async (init) => {
|
|||
}
|
||||
|
||||
export const FuzzyDate = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withDay() {
|
||||
operation.set({ subField: "day", level })
|
||||
withDay(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "day", level })
|
||||
return this
|
||||
},
|
||||
withMonth() {
|
||||
operation.set({ subField: "month", level })
|
||||
withMonth(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "month", level })
|
||||
return this
|
||||
},
|
||||
withYear() {
|
||||
operation.set({ subField: "year", level })
|
||||
withYear(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "year", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const Deleted = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** If an item has been successfully deleted */
|
||||
withDeleted() {
|
||||
operation.set({ subField: "deleted", level })
|
||||
withDeleted(op?: { alias?: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "deleted", level })
|
||||
console.log("asd")
|
||||
return this
|
||||
},
|
||||
|
@ -247,22 +247,24 @@ export const Client = function (auth?: { token: string }) {
|
|||
fetch() {
|
||||
return fetch({ query: this.raw.get()! })
|
||||
},
|
||||
Page(op: { args?: AtLeastOne<QueryPageArgs>; fn: Fn<typeof Page> }) {
|
||||
Page(op: { alias?: string; args?: AtLeastOne<QueryPageArgs>; fn: Fn<typeof Page> }) {
|
||||
operation.set({
|
||||
subField: "Page",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
op.fn(Page({ operation, level: 2 }))
|
||||
return this
|
||||
},
|
||||
/** Media query */
|
||||
Media(op: { args: AtLeastOne<QueryMediaArgs>; fn?: Fn<typeof Media> }) {
|
||||
Media(op: { alias?: string; args: AtLeastOne<QueryMediaArgs>; fn?: Fn<typeof Media> }) {
|
||||
operation.set({
|
||||
subField: getFieldName(this.Media.name),
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Media({ operation, level: 2 }))
|
||||
|
@ -271,12 +273,13 @@ export const Client = function (auth?: { token: string }) {
|
|||
},
|
||||
/** Media Trend query */
|
||||
MediaTrend(
|
||||
op: { args: AtLeastOne<QueryMediaTrendArgs>; fn?: Fn<typeof MediaTrend> },
|
||||
op: { alias?: string; args: AtLeastOne<QueryMediaTrendArgs>; fn?: Fn<typeof MediaTrend> },
|
||||
) {
|
||||
operation.set({
|
||||
subField: "MediaTrend",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(MediaTrend({ operation, level: 2 }))
|
||||
|
@ -286,6 +289,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
/** Airing schedule query */
|
||||
AiringSchedule(
|
||||
op: {
|
||||
alias?: string
|
||||
args: AtLeastOne<QueryAiringScheduleArgs>
|
||||
fn?: Fn<typeof AiringSchedule>
|
||||
},
|
||||
|
@ -294,6 +298,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
subField: "AiringSchedule",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(AiringSchedule({ operation, level: 2 }))
|
||||
|
@ -302,12 +307,13 @@ export const Client = function (auth?: { token: string }) {
|
|||
},
|
||||
/** Character query */
|
||||
Character(
|
||||
op: { args: AtLeastOne<QueryCharacterArgs>; fn?: Fn<typeof Character> },
|
||||
op: { alias?: string; args: AtLeastOne<QueryCharacterArgs>; fn?: Fn<typeof Character> },
|
||||
) {
|
||||
operation.set({
|
||||
subField: "Character",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Character({ operation, level: 2 }))
|
||||
|
@ -315,11 +321,12 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Staff query */
|
||||
Staff(op: { args: AtLeastOne<QueryStaffArgs>; fn?: Fn<typeof Staff> }) {
|
||||
Staff(op: { alias?: string; args: AtLeastOne<QueryStaffArgs>; fn?: Fn<typeof Staff> }) {
|
||||
operation.set({
|
||||
subField: "Staff",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Staff({ operation, level: 2 }))
|
||||
|
@ -328,12 +335,13 @@ export const Client = function (auth?: { token: string }) {
|
|||
},
|
||||
/** Media list query */
|
||||
MediaList(
|
||||
op: { args: AtLeastOne<QueryMediaListArgs>; fn?: Fn<typeof MediaList> },
|
||||
op: { alias?: string; args: AtLeastOne<QueryMediaListArgs>; fn?: Fn<typeof MediaList> },
|
||||
) {
|
||||
operation.set({
|
||||
subField: "MediaList",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(MediaList({ operation, level: 2 }))
|
||||
|
@ -343,6 +351,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
/** Media list collection query, provides list pre-grouped by status & custom lists. User ID and Media Type arguments required. */
|
||||
MediaListCollection(
|
||||
op: {
|
||||
alias?: string
|
||||
args: AtLeastOne<QueryMediaListCollectionArgs>
|
||||
fn?: Fn<typeof MediaListCollection>
|
||||
},
|
||||
|
@ -351,6 +360,7 @@ export const Client = function (auth?: { token: string }) {
|
|||
subField: "MediaListCollection",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(MediaListCollection({ operation, level: 2 }))
|
||||
|
@ -364,12 +374,13 @@ export const Client = function (auth?: { token: string }) {
|
|||
},
|
||||
/** Collection of all the possible media tags */
|
||||
MediaTagCollection(
|
||||
op?: { args?: QueryMediaTagCollectionArgs; fn?: Fn<typeof MediaTag> },
|
||||
op?: { alias?: string; args?: QueryMediaTagCollectionArgs; fn?: Fn<typeof MediaTag> },
|
||||
) {
|
||||
operation.set({
|
||||
subField: "MediaTagCollection",
|
||||
variables: op?.args,
|
||||
hasSubField: true,
|
||||
alias: op?.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op?.fn) op.fn(MediaTag({ operation, level: 2 }))
|
||||
|
@ -377,11 +388,12 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** User query */
|
||||
User(op: { args: AtLeastOne<QueryUserArgs>; fn?: Fn<typeof User> }) {
|
||||
User(op: { alias?: string; args: AtLeastOne<QueryUserArgs>; fn?: Fn<typeof User> }) {
|
||||
operation.set({
|
||||
subField: "User",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
|
@ -389,10 +401,11 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Get the currently authenticated user */
|
||||
Viewer(op: { fn?: Fn<typeof User> }) {
|
||||
Viewer(op: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({
|
||||
subField: "Viewer",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
|
@ -401,23 +414,29 @@ export const Client = function (auth?: { token: string }) {
|
|||
},
|
||||
/** Notification query */
|
||||
Notification(
|
||||
op: { args: AtLeastOne<QueryNotificationArgs>; fn: Fn<typeof NotificationUnion> },
|
||||
op: {
|
||||
alias?: string
|
||||
args: AtLeastOne<QueryNotificationArgs>
|
||||
fn: Fn<typeof NotificationUnion>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
subField: "Notification",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
op.fn(NotificationUnion({ operation, level: 2 }))
|
||||
return this
|
||||
},
|
||||
/** Studio query */
|
||||
Studio(op: { args: AtLeastOne<QueryStudioArgs>; fn?: Fn<typeof Studio> }) {
|
||||
Studio(op: { alias?: string; args: AtLeastOne<QueryStudioArgs>; fn?: Fn<typeof Studio> }) {
|
||||
operation.set({
|
||||
subField: "Studio",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Studio({ operation, level: 2 }))
|
||||
|
@ -425,11 +444,12 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Review query */
|
||||
Review(op: { args: AtLeastOne<QueryReviewArgs>; fn?: Fn<typeof Review> }) {
|
||||
Review(op: { alias?: string; args: AtLeastOne<QueryReviewArgs>; fn?: Fn<typeof Review> }) {
|
||||
operation.set({
|
||||
subField: "Review",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Review({ operation, level: 2 }))
|
||||
|
@ -437,8 +457,20 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Activity query */
|
||||
Activity(op: { args: AtLeastOne<QueryActivityArgs>; fn?: Fn<typeof ActivityUnion> }) {
|
||||
operation.set({ subField: "Activity", variables: op.args, hasSubField: true, level: 1 })
|
||||
Activity(
|
||||
op: {
|
||||
alias?: string
|
||||
args: AtLeastOne<QueryActivityArgs>
|
||||
fn?: Fn<typeof ActivityUnion>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "Activity",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(ActivityUnion({ operation, level: 2 }))
|
||||
else {
|
||||
ActivityUnion({ operation, level: 2 })
|
||||
|
@ -450,12 +482,17 @@ export const Client = function (auth?: { token: string }) {
|
|||
},
|
||||
/** Activity reply query */
|
||||
ActivityReply(
|
||||
op: { args: AtLeastOne<QueryActivityReplyArgs>; fn?: Fn<typeof ActivityReply> },
|
||||
op: {
|
||||
alias?: string
|
||||
args: AtLeastOne<QueryActivityReplyArgs>
|
||||
fn?: Fn<typeof ActivityReply>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
subField: "ActivityReply",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(ActivityReply({ operation, level: 2 }))
|
||||
|
@ -463,11 +500,14 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Follow query */
|
||||
Following(op: { args: AtLeastOne<QueryFollowingArgs>; fn?: Fn<typeof User> }) {
|
||||
Following(
|
||||
op: { alias?: string; args: AtLeastOne<QueryFollowingArgs>; fn?: Fn<typeof User> },
|
||||
) {
|
||||
operation.set({
|
||||
subField: "Following",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
|
@ -475,11 +515,14 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Follow query */
|
||||
Follower(op: { args: AtLeastOne<QueryFollowerArgs>; fn?: Fn<typeof User> }) {
|
||||
Follower(
|
||||
op: { alias?: string; args: AtLeastOne<QueryFollowerArgs>; fn?: Fn<typeof User> },
|
||||
) {
|
||||
operation.set({
|
||||
subField: "Follower",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
|
@ -487,11 +530,12 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Thread query */
|
||||
Thread(op: { args: AtLeastOne<QueryThreadArgs>; fn?: Fn<typeof Thread> }) {
|
||||
Thread(op: { alias?: string; args: AtLeastOne<QueryThreadArgs>; fn?: Fn<typeof Thread> }) {
|
||||
operation.set({
|
||||
subField: "Thread",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Thread({ operation, level: 2 }))
|
||||
|
@ -500,12 +544,17 @@ export const Client = function (auth?: { token: string }) {
|
|||
},
|
||||
/** Comment query */
|
||||
ThreadComment(
|
||||
op: { args: AtLeastOne<QueryThreadCommentArgs>; fn?: Fn<typeof ThreadComment> },
|
||||
op: {
|
||||
alias?: string
|
||||
args: AtLeastOne<QueryThreadCommentArgs>
|
||||
fn?: Fn<typeof ThreadComment>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "ThreadComment",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(ThreadComment({ operation, level: 2 }))
|
||||
|
@ -514,12 +563,17 @@ export const Client = function (auth?: { token: string }) {
|
|||
},
|
||||
/** Recommendation query */
|
||||
Recommendation(
|
||||
op: { args: AtLeastOne<QueryRecommendationArgs>; fn?: Fn<typeof Recommendation> },
|
||||
op: {
|
||||
alias?: string
|
||||
args: AtLeastOne<QueryRecommendationArgs>
|
||||
fn?: Fn<typeof Recommendation>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
subField: "Recommendation",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(Recommendation({ operation, level: 2 }))
|
||||
|
@ -527,11 +581,12 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Like query */
|
||||
Like(op: { args: AtLeastOne<QueryLikeArgs>; fn?: Fn<typeof User> }) {
|
||||
Like(op: { alias?: string; args: AtLeastOne<QueryLikeArgs>; fn?: Fn<typeof User> }) {
|
||||
operation.set({
|
||||
subField: "Like",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
|
@ -539,10 +594,11 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Provide AniList markdown to be converted to html (Requires auth) */
|
||||
Markdown(op: { args: QueryMarkdownArgs; fn?: Fn<typeof Markdown> }) {
|
||||
Markdown(op: { alias?: string; args: QueryMarkdownArgs; fn?: Fn<typeof Markdown> }) {
|
||||
operation.set({
|
||||
subField: "Markdown",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
level: 1,
|
||||
})
|
||||
|
@ -550,31 +606,36 @@ export const Client = function (auth?: { token: string }) {
|
|||
else Markdown({ operation, level: 2 }).withHtml()
|
||||
return this
|
||||
},
|
||||
AniChartUser(op?: { fn?: Fn<typeof AniChartUser> }) {
|
||||
operation.set({ subField: "AniChartUser", hasSubField: true, level: 1 })
|
||||
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()
|
||||
return this
|
||||
},
|
||||
/** Site statistics query */
|
||||
SiteStatistics(op: { fn: Fn<typeof SiteStatistics> }) {
|
||||
SiteStatistics(op: { alias?: string; fn: Fn<typeof SiteStatistics> }) {
|
||||
operation.set({
|
||||
subField: "SiteStatistics",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
op.fn(SiteStatistics({ operation, level: 2 }))
|
||||
return this
|
||||
},
|
||||
/** ExternalLinkSource collection query */
|
||||
ExternalLinkSourceCollection(op: {
|
||||
args: AtLeastOne<QueryExternalLinkSourceCollectionArgs>
|
||||
fn?: Fn<typeof ExternalLinkSourceCollection>
|
||||
}) {
|
||||
ExternalLinkSourceCollection(
|
||||
op: {
|
||||
alias?: string
|
||||
args: AtLeastOne<QueryExternalLinkSourceCollectionArgs>
|
||||
fn?: Fn<typeof ExternalLinkSourceCollection>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
subField: "ExternalLinkSourceCollection",
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
level: 1,
|
||||
})
|
||||
if (op.fn) op.fn(ExternalLinkSourceCollection({ operation, level: 2 }))
|
||||
|
@ -603,14 +664,12 @@ export const Client = function (auth?: { token: string }) {
|
|||
})
|
||||
},
|
||||
/** Update current user options */
|
||||
UpdateUser(op: {
|
||||
args: MutationUpdateUserArgs
|
||||
fn?: Fn<typeof User>
|
||||
}) {
|
||||
UpdateUser(op: { alias?: string; args: MutationUpdateUserArgs; fn?: Fn<typeof User> }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "UpdateUser",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
|
@ -619,12 +678,13 @@ export const Client = function (auth?: { token: string }) {
|
|||
},
|
||||
/** Create or update a media list entry */
|
||||
SaveMediaListEntry(
|
||||
op: { args: MutationSaveMediaListEntryArgs; fn?: Fn<typeof MediaList> },
|
||||
op: { alias?: string; args: MutationSaveMediaListEntryArgs; fn?: Fn<typeof MediaList> },
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "SaveMediaListEntry",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(MediaList({ operation, level: 2 }))
|
||||
|
@ -632,14 +692,18 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Update multiple media list entries to the same values */
|
||||
UpdateMediaListEntries(op: {
|
||||
args: MutationUpdateMediaListEntriesArgs
|
||||
fn?: Fn<typeof MediaList>
|
||||
}) {
|
||||
UpdateMediaListEntries(
|
||||
op: {
|
||||
alias?: string
|
||||
args: MutationUpdateMediaListEntriesArgs
|
||||
fn?: Fn<typeof MediaList>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "UpdateMediaListEntries",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(MediaList({ operation, level: 2 }))
|
||||
|
@ -647,33 +711,38 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Delete a media list entry */
|
||||
DeleteMediaListEntry(op: { args: MutationDeleteMediaListEntryArgs }) {
|
||||
DeleteMediaListEntry(op: { alias?: string; args: MutationDeleteMediaListEntryArgs }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteMediaListEntry",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
return this
|
||||
},
|
||||
/** Delete a custom list and remove the list entries from it */
|
||||
DeleteCustomList(op: { args: MutationDeleteCustomListArgs }) {
|
||||
DeleteCustomList(op: { alias?: string; args: MutationDeleteCustomListArgs }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteCustomList",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
return this
|
||||
},
|
||||
/** Create or update text activity for the currently authenticated user */
|
||||
SaveTextActivity(op: { args: MutationSaveTextActivityArgs; fn?: Fn<typeof TextActivity> }) {
|
||||
SaveTextActivity(
|
||||
op: { alias?: string; args: MutationSaveTextActivityArgs; fn?: Fn<typeof TextActivity> },
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "TextActivity",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(TextActivity({ operation, level: 2 }))
|
||||
|
@ -681,14 +750,18 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Create or update message activity for the currently authenticated user */
|
||||
SaveMessageActivity(op: {
|
||||
args: MutationSaveMessageActivityArgs
|
||||
fn?: Fn<typeof MessageActivity>
|
||||
}) {
|
||||
SaveMessageActivity(
|
||||
op: {
|
||||
alias?: string
|
||||
args: MutationSaveMessageActivityArgs
|
||||
fn?: Fn<typeof MessageActivity>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "MessageActivity",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(MessageActivity({ operation, level: 2 }))
|
||||
|
@ -696,11 +769,14 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Update list activity (Mod Only) */
|
||||
SaveListActivity(op: { args: MutationSaveListActivityArgs; fn?: Fn<typeof ListActivity> }) {
|
||||
SaveListActivity(
|
||||
op: { alias?: string; args: MutationSaveListActivityArgs; fn?: Fn<typeof ListActivity> },
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "ListActivity",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(ListActivity({ operation, level: 2 }))
|
||||
|
@ -708,11 +784,12 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Delete an activity item of the authenticated users */
|
||||
DeleteActivity(op: { args: MutationDeleteActivityArgs }) {
|
||||
DeleteActivity(op: { alias?: string; args: MutationDeleteActivityArgs }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteActivity",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
|
@ -720,40 +797,49 @@ export const Client = function (auth?: { token: string }) {
|
|||
},
|
||||
/** Toggle activity to be pinned to the top of the user's activity feed */
|
||||
ToggleActivityPin(
|
||||
op: { args: MutationToggleActivityPinArgs; fn: Fn<typeof ActivityUnion> },
|
||||
op: { alias?: string; args: MutationToggleActivityPinArgs; fn: Fn<typeof ActivityUnion> },
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "ToggleActivityPin",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
op.fn(ActivityUnion({ operation, level: 2 }))
|
||||
return this
|
||||
},
|
||||
/** Toggle the subscription of an activity item */
|
||||
ToggleActivitySubscription(op: {
|
||||
args: MutationToggleActivitySubscriptionArgs
|
||||
fn: Fn<typeof ActivityUnion>
|
||||
}) {
|
||||
ToggleActivitySubscription(
|
||||
op: {
|
||||
alias?: string
|
||||
args: MutationToggleActivitySubscriptionArgs
|
||||
fn: Fn<typeof ActivityUnion>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "ToggleActivitySubscription",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
op.fn(ActivityUnion({ operation, level: 2 }))
|
||||
return this
|
||||
},
|
||||
/** Create or update an activity reply */
|
||||
SaveActivityReply(op: {
|
||||
args: MutationSaveActivityReplyArgs
|
||||
fn?: Fn<typeof ActivityReply>
|
||||
}) {
|
||||
SaveActivityReply(
|
||||
op: {
|
||||
alias?: string
|
||||
args: MutationSaveActivityReplyArgs
|
||||
fn?: Fn<typeof ActivityReply>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "SaveActivityReply",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(ActivityReply({ operation, level: 2 }))
|
||||
|
@ -761,25 +847,24 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Delete an activity reply of the authenticated users */
|
||||
DeleteActivityReply(op: { args: MutationDeleteActivityReplyArgs }) {
|
||||
DeleteActivityReply(op: { alias?: string; args: MutationDeleteActivityReplyArgs }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteActivityReply",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
return this
|
||||
},
|
||||
/** Add or remove a like from a likeable type. Returns all the users who liked the same model */
|
||||
ToggleLike(op: {
|
||||
args: MutationToggleLikeArgs
|
||||
fn?: Fn<typeof User>
|
||||
}) {
|
||||
ToggleLike(op: { alias?: string; args: MutationToggleLikeArgs; fn?: Fn<typeof User> }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "ToggleLike",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
|
@ -787,25 +872,26 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Add or remove a like from a likeable type. */
|
||||
ToggleLikeV2(op: { args: MutationToggleLikeV2Args; fn: Fn<typeof LikeableUnion> }) {
|
||||
ToggleLikeV2(
|
||||
op: { alias?: string; args: MutationToggleLikeV2Args; fn: Fn<typeof LikeableUnion> },
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "ToggleLikeV2",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
op.fn(LikeableUnion({ operation, level: 2 }))
|
||||
return this
|
||||
},
|
||||
/** Toggle the un/following of a user */
|
||||
ToggleFollow(op: {
|
||||
args: MutationToggleFollowArgs
|
||||
fn?: Fn<typeof User>
|
||||
}) {
|
||||
ToggleFollow(op: { alias?: string; args: MutationToggleFollowArgs; fn?: Fn<typeof User> }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "ToggleFollow",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(User({ operation, level: 2 }))
|
||||
|
@ -813,11 +899,14 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Favourite or unfavourite an anime, manga, character, staff member, or studio */
|
||||
ToggleFavourite(op: { args: MutationToggleFavouriteArgs; fn: Fn<typeof Favourites> }) {
|
||||
ToggleFavourite(
|
||||
op: { alias?: string; args: MutationToggleFavouriteArgs; fn: Fn<typeof Favourites> },
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "ToggleFavourite",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
op.fn(Favourites({ operation, level: 2 }))
|
||||
|
@ -825,26 +914,25 @@ export const Client = function (auth?: { token: string }) {
|
|||
},
|
||||
/** Update the order favourites are displayed in */
|
||||
UpdateFavouriteOrder(
|
||||
op: { args: MutationUpdateFavouriteOrderArgs; fn: Fn<typeof Favourites> },
|
||||
op: { alias?: string; args: MutationUpdateFavouriteOrderArgs; fn: Fn<typeof Favourites> },
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "UpdateFavouriteOrder",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
op.fn(Favourites({ operation, level: 2 }))
|
||||
return this
|
||||
},
|
||||
/** Create or update a review */
|
||||
SaveReview(op: {
|
||||
args: MutationSaveReviewArgs
|
||||
fn?: Fn<typeof Review>
|
||||
}) {
|
||||
SaveReview(op: { alias?: string; args: MutationSaveReviewArgs; fn?: Fn<typeof Review> }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "SaveReview",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(Review({ operation, level: 2 }))
|
||||
|
@ -852,25 +940,24 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Delete a review */
|
||||
DeleteReview(op: { args: MutationDeleteReviewArgs }) {
|
||||
DeleteReview(op: { alias?: string; args: MutationDeleteReviewArgs }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteReview",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
return this
|
||||
},
|
||||
/** Rate a review */
|
||||
RateReview(op: {
|
||||
args: MutationRateReviewArgs
|
||||
fn?: Fn<typeof Review>
|
||||
}) {
|
||||
RateReview(op: { alias?: string; args: MutationRateReviewArgs; fn?: Fn<typeof Review> }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "RateReview",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(Review({ operation, level: 2 }))
|
||||
|
@ -878,14 +965,18 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Recommendation a media */
|
||||
SaveRecommendation(op: {
|
||||
args: MutationSaveRecommendationArgs
|
||||
fn?: Fn<typeof Recommendation>
|
||||
}) {
|
||||
SaveRecommendation(
|
||||
op: {
|
||||
alias?: string
|
||||
args: MutationSaveRecommendationArgs
|
||||
fn?: Fn<typeof Recommendation>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "SaveRecommendation",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(Recommendation({ operation, level: 2 }))
|
||||
|
@ -893,14 +984,12 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Create or update a forum thread */
|
||||
SaveThread(op: {
|
||||
args: MutationSaveThreadArgs
|
||||
fn?: Fn<typeof Thread>
|
||||
}) {
|
||||
SaveThread(op: { alias?: string; args: MutationSaveThreadArgs; fn?: Fn<typeof Thread> }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "SaveThread",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(Thread({ operation, level: 2 }))
|
||||
|
@ -908,25 +997,30 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Delete a thread */
|
||||
DeleteThread(op: { args: MutationDeleteThreadArgs }) {
|
||||
DeleteThread(op: { alias?: string; args: MutationDeleteThreadArgs }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteThread",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
return this
|
||||
},
|
||||
/** Toggle the subscription of a forum thread */
|
||||
ToggleThreadSubscription(op: {
|
||||
args: MutationToggleThreadSubscriptionArgs
|
||||
fn?: Fn<typeof Thread>
|
||||
}) {
|
||||
ToggleThreadSubscription(
|
||||
op: {
|
||||
alias?: string
|
||||
args: MutationToggleThreadSubscriptionArgs
|
||||
fn?: Fn<typeof Thread>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "ToggleThreadSubscription",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(Thread({ operation, level: 2 }))
|
||||
|
@ -934,14 +1028,18 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Create or update a thread comment */
|
||||
SaveThreadComment(op: {
|
||||
args: MutationSaveThreadCommentArgs
|
||||
fn?: Fn<typeof ThreadComment>
|
||||
}) {
|
||||
SaveThreadComment(
|
||||
op: {
|
||||
alias?: string
|
||||
args: MutationSaveThreadCommentArgs
|
||||
fn?: Fn<typeof ThreadComment>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "SaveThreadComment",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
if (op.fn) op.fn(ThreadComment({ operation, level: 2 }))
|
||||
|
@ -949,11 +1047,12 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Delete a thread comment */
|
||||
DeleteThreadComment(op: { args: MutationDeleteThreadCommentArgs }) {
|
||||
DeleteThreadComment(op: { alias?: string; args: MutationDeleteThreadCommentArgs }) {
|
||||
operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteThreadComment",
|
||||
hasSubField: true,
|
||||
alias: op.alias,
|
||||
variables: op.args,
|
||||
})
|
||||
Deleted({ operation, level: 2 }).withDeleted()
|
||||
|
|
|
@ -4,50 +4,50 @@ import { User } from "./User.ts"
|
|||
|
||||
export const ActivityReply = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the reply */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the replies creator */
|
||||
withUserId() {
|
||||
operation.set({ subField: "userId", level })
|
||||
withUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the parent activity */
|
||||
withActivityId() {
|
||||
operation.set({ subField: "activityId", level })
|
||||
withActivityId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "activityId", level })
|
||||
return this
|
||||
},
|
||||
/** The reply text */
|
||||
withText(op?: { args?: ActivityReplyTextArgs }) {
|
||||
operation.set({ subField: "text", level, variables: op?.args })
|
||||
withText(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() {
|
||||
operation.set({ subField: "likeCount", level })
|
||||
withLikeCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the reply */
|
||||
withIsLiked() {
|
||||
operation.set({ subField: "isLiked", level })
|
||||
withIsLiked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLiked", level })
|
||||
return this
|
||||
},
|
||||
/** The time the reply was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The user who created reply */
|
||||
withUser(op: { fn: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
},
|
||||
/** The users who liked the reply */
|
||||
withLikes(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "likes", level, hasSubField: true })
|
||||
withLikes(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()
|
||||
return this
|
||||
|
|
|
@ -6,82 +6,82 @@ import { User } from "./User.ts"
|
|||
|
||||
export const TextActivity = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the activity */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the activity's creator */
|
||||
withUserId() {
|
||||
operation.set({ subField: "userId", level })
|
||||
withUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of activity */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The number of activity replies */
|
||||
withReplyCount() {
|
||||
operation.set({ subField: "replyCount", level })
|
||||
withReplyCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "replyCount", level })
|
||||
return this
|
||||
},
|
||||
/** The status text (Markdown) */
|
||||
withText(op?: { args?: TextActivityTextArgs }) {
|
||||
operation.set({ subField: "text", level, variables: op?.args })
|
||||
withText(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() {
|
||||
operation.set({ subField: "siteUrl", level })
|
||||
withSiteUrl(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** If the activity is locked and can receive replies */
|
||||
withIsLocked() {
|
||||
operation.set({ subField: "isLocked", level })
|
||||
withIsLocked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user is subscribed to the activity */
|
||||
withIsSubscribed() {
|
||||
operation.set({ subField: "isSubscribed", level })
|
||||
withIsSubscribed(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isSubscribed", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the activity has */
|
||||
withLikeCount() {
|
||||
operation.set({ subField: "likeCount", level })
|
||||
withLikeCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the activity */
|
||||
withIsLiked() {
|
||||
operation.set({ subField: "isLiked", level })
|
||||
withIsLiked(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() {
|
||||
operation.set({ subField: "isPinned", level })
|
||||
withIsPinned(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isPinned", level })
|
||||
return this
|
||||
},
|
||||
/** The time the activity was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The user who created the activity */
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level })
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
/** The written replies to the activity */
|
||||
withReplies(op?: { fn?: Fn<typeof ActivityReply> }) {
|
||||
operation.set({ subField: "replies", level })
|
||||
withReplies(op?: { alias?: string; fn?: Fn<typeof ActivityReply> }) {
|
||||
operation.set({ alias: op?.alias, subField: "replies", level })
|
||||
if (op?.fn) op.fn(ActivityReply({ operation, level: level + 1 }))
|
||||
else ActivityReply({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
/** The users who liked the activity */
|
||||
withLikes(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "likes", level })
|
||||
withLikes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "likes", level })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
|
@ -90,94 +90,94 @@ export const TextActivity = ({ operation, level }: Fields<OperationParser>) => (
|
|||
|
||||
export const ListActivity = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the activity */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the activity's creator */
|
||||
withUserId() {
|
||||
operation.set({ subField: "userId", level })
|
||||
withUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of activity */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The number of activity replies */
|
||||
withReplyCount() {
|
||||
operation.set({ subField: "replyCount", level })
|
||||
withReplyCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "replyCount", level })
|
||||
return this
|
||||
},
|
||||
/** The list item's textual status */
|
||||
withStatus() {
|
||||
operation.set({ subField: "status", level })
|
||||
withStatus(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "status", level })
|
||||
return this
|
||||
},
|
||||
/** The list progress made */
|
||||
withProgress() {
|
||||
operation.set({ subField: "progress", level })
|
||||
withProgress(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "progress", level })
|
||||
return this
|
||||
},
|
||||
/** If the activity is locked and can receive replies */
|
||||
withIsLocked() {
|
||||
operation.set({ subField: "isLocked", level })
|
||||
withIsLocked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user is subscribed to the activity */
|
||||
withIsSubscribed() {
|
||||
operation.set({ subField: "isSubscribed", level })
|
||||
withIsSubscribed(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isSubscribed", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the activity has */
|
||||
withLikeCount() {
|
||||
operation.set({ subField: "likeCount", level })
|
||||
withLikeCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the activity */
|
||||
withIsLiked() {
|
||||
operation.set({ subField: "isLiked", level })
|
||||
withIsLiked(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() {
|
||||
operation.set({ subField: "isPinned", level })
|
||||
withIsPinned(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isPinned", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the activity page on the AniList website */
|
||||
withSiteUrl() {
|
||||
operation.set({ subField: "siteUrl", level })
|
||||
withSiteUrl(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** The time the activity was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The owner of the activity */
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level })
|
||||
withUser(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "user", level })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
/** The associated media to the activity update */
|
||||
withMedia(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "media", level })
|
||||
withMedia(op?: { alias?: string; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ alias: op?.alias, subField: "media", level })
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
/** The written replies to the activity */
|
||||
withReplies(op?: { fn?: Fn<typeof ActivityReply> }) {
|
||||
operation.set({ subField: "replies", level })
|
||||
withReplies(op?: { alias?: string; fn?: Fn<typeof ActivityReply> }) {
|
||||
operation.set({ alias: op?.alias, subField: "replies", level })
|
||||
if (op?.fn) op.fn(ActivityReply({ operation, level: level + 1 }))
|
||||
else ActivityReply({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
/** The users who liked the activity */
|
||||
withLikes(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "likes", level })
|
||||
withLikes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "likes", level })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
|
@ -186,94 +186,94 @@ export const ListActivity = ({ operation, level }: Fields<OperationParser>) => (
|
|||
|
||||
export const MessageActivity = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the activity */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the activity's recipient */
|
||||
withRecipientId() {
|
||||
operation.set({ subField: "recipientId", level })
|
||||
withRecipientId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "recipientId", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the activity's sender */
|
||||
withMessengerId() {
|
||||
operation.set({ subField: "messengerId", level })
|
||||
withMessengerId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "messengerId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of the activity */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The number of activity replies */
|
||||
withReplyCount() {
|
||||
operation.set({ subField: "replyCount", level })
|
||||
withReplyCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "replyCount", level })
|
||||
return this
|
||||
},
|
||||
/** The message text (Markdown) */
|
||||
withMessage(op?: { args?: MessageActivityMessageArgs }) {
|
||||
operation.set({ subField: "message", level, variables: op?.args })
|
||||
withMessage(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() {
|
||||
operation.set({ subField: "isLocked", level })
|
||||
withIsLocked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user is subscribed to the activity */
|
||||
withIsSubscribed() {
|
||||
operation.set({ subField: "isSubscribed", level })
|
||||
withIsSubscribed(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isSubscribed", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the activity has */
|
||||
withLikeCount() {
|
||||
operation.set({ subField: "likeCount", level })
|
||||
withLikeCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the activity */
|
||||
withIsLiked() {
|
||||
operation.set({ subField: "isLiked", level })
|
||||
withIsLiked(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() {
|
||||
operation.set({ subField: "isPrivate", level })
|
||||
withIsPrivate(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isPrivate", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the activity page on the AniList website */
|
||||
withSiteUrl() {
|
||||
operation.set({ subField: "siteUrl", level })
|
||||
withSiteUrl(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** The time the activity was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The user who the activity message was sent to */
|
||||
withRecipient(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "recipient", level })
|
||||
withRecipient(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "recipient", level })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
/** The user who sent the activity message */
|
||||
withMessenger(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "messenger", level })
|
||||
withMessenger(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "messenger", level })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
/** The written replies to the activity */
|
||||
withReplies(op?: { fn?: Fn<typeof ActivityReply> }) {
|
||||
operation.set({ subField: "replies", level })
|
||||
withReplies(op?: { alias?: string; fn?: Fn<typeof ActivityReply> }) {
|
||||
operation.set({ alias: op?.alias, subField: "replies", level })
|
||||
if (op?.fn) op.fn(ActivityReply({ operation, level: level + 1 }))
|
||||
else ActivityReply({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
/** The users who liked the activity */
|
||||
withLikes(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "likes", level })
|
||||
withLikes(op?: { alias?: string; fn?: Fn<typeof User> }) {
|
||||
operation.set({ alias: op?.alias, subField: "likes", level })
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
|
@ -281,20 +281,33 @@ export const MessageActivity = ({ operation, level }: Fields<OperationParser>) =
|
|||
})
|
||||
|
||||
export const ActivityUnion = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withTextActivity(op?: { fn?: Fn<typeof TextActivity> }) {
|
||||
operation.set({ subField: "TextActivity", level, hasSubField: true, isUnion: true })
|
||||
withTextActivity(op?: { alias?: string; fn?: Fn<typeof TextActivity> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "TextActivity",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(TextActivity({ operation, level: level + 1 }))
|
||||
else TextActivity({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withListActivity(op?: { fn?: Fn<typeof ListActivity> }) {
|
||||
operation.set({ subField: "ListActivity", level, hasSubField: true, isUnion: true })
|
||||
withListActivity(op?: { alias?: string; fn?: Fn<typeof ListActivity> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ListActivity",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ListActivity({ operation, level: level + 1 }))
|
||||
else ListActivity({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withMessageActivity(op?: { fn?: Fn<typeof MessageActivity> }) {
|
||||
withMessageActivity(op?: { alias?: string; fn?: Fn<typeof MessageActivity> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "MessageActivity",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
|
|
@ -3,32 +3,32 @@ import { Media } from "./Media.ts"
|
|||
import { PageInfo } from "./Page.ts"
|
||||
|
||||
const AiringScheduleEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op: { fn: Fn<typeof AiringSchedule> }) {
|
||||
operation.set({ subField: "node", level, hasSubField: true })
|
||||
withNode(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() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const AiringScheduleConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op: { fn: Fn<typeof AiringScheduleEdge> }) {
|
||||
operation.set({ subField: "edges", level, hasSubField: true })
|
||||
withEdges(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: { fn: Fn<typeof AiringSchedule> }) {
|
||||
operation.set({ subField: "nodes", level, hasSubField: true })
|
||||
withNodes(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: { fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ subField: "pageInfo", level, hasSubField: true })
|
||||
withPageInfo(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,33 +36,33 @@ export const AiringScheduleConnection = ({ operation, level }: Fields<OperationP
|
|||
|
||||
export const AiringSchedule = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the airing schedule item */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The time the episode airs at */
|
||||
withAiringAt() {
|
||||
operation.set({ subField: "airingAt", level })
|
||||
withAiringAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "airingAt", level })
|
||||
return this
|
||||
},
|
||||
/** Seconds until episode starts airing */
|
||||
withTimeUntilAiring() {
|
||||
operation.set({ subField: "timeUntilAiring", level })
|
||||
withTimeUntilAiring(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "timeUntilAiring", level })
|
||||
return this
|
||||
},
|
||||
/** The airing episode number */
|
||||
withEpisode() {
|
||||
operation.set({ subField: "episode", level })
|
||||
withEpisode(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "episode", level })
|
||||
return this
|
||||
},
|
||||
/** The associate media id of the airing episode */
|
||||
withMediaId() {
|
||||
operation.set({ subField: "mediaId", level })
|
||||
withMediaId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The associate media of the airing episode */
|
||||
withMedia(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "media", level, hasSubField: true })
|
||||
withMedia(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()
|
||||
return this
|
||||
|
|
|
@ -2,18 +2,18 @@ import { Fields, Fn, OperationParser } from "../types/Anilist.ts"
|
|||
import { User } from "./User.ts"
|
||||
|
||||
export const AniChartUser = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
},
|
||||
withSettings() {
|
||||
operation.set({ subField: "settings", level })
|
||||
withSettings(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "settings", level })
|
||||
return this
|
||||
},
|
||||
withHighlights() {
|
||||
operation.set({ subField: "highlights", level })
|
||||
withHighlights(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "highlights", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -13,80 +13,83 @@ import { AtLeastOne } from "../types/AtLeastOne.ts"
|
|||
|
||||
const CharacterName = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The person's given name */
|
||||
withFirst() {
|
||||
operation.set({ subField: "first", level })
|
||||
withFirst(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "first", level })
|
||||
return this
|
||||
},
|
||||
/** The person's middle name */
|
||||
withMiddle() {
|
||||
operation.set({ subField: "middle", level })
|
||||
withMiddle(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "middle", level })
|
||||
return this
|
||||
},
|
||||
/** The person's surname */
|
||||
withLast() {
|
||||
operation.set({ subField: "last", level })
|
||||
withLast(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "last", level })
|
||||
return this
|
||||
},
|
||||
/** The person's first and last name */
|
||||
withFull() {
|
||||
operation.set({ subField: "full", level })
|
||||
withFull(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "full", level })
|
||||
return this
|
||||
},
|
||||
/** The person's full name in their native language */
|
||||
withNative() {
|
||||
operation.set({ subField: "native", level })
|
||||
withNative(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() {
|
||||
operation.set({ subField: "alternative", level })
|
||||
withAlternative(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() {
|
||||
operation.set({ subField: "userPreferred", level })
|
||||
withUserPreferred(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userPreferred", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const CharacterImage = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The person's image of media at its largest size */
|
||||
withLarge() {
|
||||
operation.set({ subField: "large", level })
|
||||
withLarge(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "large", level })
|
||||
return this
|
||||
},
|
||||
/** The person's image of media at medium size */
|
||||
withMedium() {
|
||||
operation.set({ subField: "medium", level })
|
||||
withMedium(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "medium", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const CharacterEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op: { fn: Fn<typeof Character> }) {
|
||||
operation.set({ subField: "node", level, hasSubField: true })
|
||||
withNode(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()
|
||||
return this
|
||||
},
|
||||
/** The id of the connection */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The characters role in the media */
|
||||
withRole() {
|
||||
operation.set({ subField: "role", level })
|
||||
withRole(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "role", level })
|
||||
return this
|
||||
},
|
||||
/** Media specific character name */
|
||||
withName() {
|
||||
operation.set({ subField: "name", level })
|
||||
withName(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
/** The voice actors of the character */
|
||||
withVoiceActors(op?: { args?: AtLeastOne<CharacterEdgeVoiceActorsArgs>; fn?: Fn<typeof Staff> }) {
|
||||
withVoiceActors(
|
||||
op?: { alias?: string; args?: AtLeastOne<CharacterEdgeVoiceActorsArgs>; fn?: Fn<typeof Staff> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "voiceActors",
|
||||
level,
|
||||
variables: op?.args,
|
||||
|
@ -98,9 +101,14 @@ const CharacterEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
},
|
||||
/** The voice actors of the character with role date */
|
||||
withVoiceActorRoles(
|
||||
op: { args?: AtLeastOne<CharacterEdgeVoiceActorRolesArgs>; fn: Fn<typeof StaffRoleType> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<CharacterEdgeVoiceActorRolesArgs>
|
||||
fn: Fn<typeof StaffRoleType>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "voiceActorRoles",
|
||||
level,
|
||||
variables: op.args,
|
||||
|
@ -110,35 +118,35 @@ const CharacterEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The media the character is in */
|
||||
withMedia(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "media", level, hasSubField: true })
|
||||
withMedia(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()
|
||||
return this
|
||||
},
|
||||
/** The order the character should be displayed from the users favourites */
|
||||
withFavouriteOrder() {
|
||||
operation.set({ subField: "favouriteOrder", level })
|
||||
withFavouriteOrder(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favouriteOrder", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const CharacterConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { fn?: Fn<typeof CharacterEdge> }) {
|
||||
operation.set({ subField: "edges", level, hasSubField: true })
|
||||
withEdges(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()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { fn?: Fn<typeof Character> }) {
|
||||
operation.set({ subField: "nodes", level, hasSubField: true })
|
||||
withNodes(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()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ subField: "pageInfo", level, hasSubField: true })
|
||||
withPageInfo(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
|
||||
},
|
||||
|
@ -146,80 +154,88 @@ export const CharacterConnection = ({ operation, level }: Fields<OperationParser
|
|||
|
||||
export const Character = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the character */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The names of the character */
|
||||
withName(op?: { fn?: Fn<typeof CharacterName> }) {
|
||||
operation.set({ subField: "name", level, hasSubField: true })
|
||||
withName(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()
|
||||
return this
|
||||
},
|
||||
/** Character images */
|
||||
withImage(op?: { fn?: Fn<typeof CharacterImage> }) {
|
||||
operation.set({ subField: "image", level, hasSubField: true })
|
||||
withImage(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()
|
||||
return this
|
||||
},
|
||||
/** A general description of the character */
|
||||
withDescription(op?: { args?: CharacterDescriptionArgs }) {
|
||||
operation.set({ subField: "description", level, variables: op?.args })
|
||||
withDescription(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() {
|
||||
operation.set({ subField: "gender", level })
|
||||
withGender(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "gender", level })
|
||||
return this
|
||||
},
|
||||
/** The character's birth date */
|
||||
withDateOfBirth(op?: { fn?: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({ subField: "dateOfBirth", level, hasSubField: true })
|
||||
withDateOfBirth(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()
|
||||
return this
|
||||
},
|
||||
/** The character's age. Note this is a string, not an int, it may contain further text and additional ages. */
|
||||
withAge() {
|
||||
operation.set({ subField: "age", level })
|
||||
withAge(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "age", level })
|
||||
return this
|
||||
},
|
||||
/** The characters blood type */
|
||||
withBloodType() {
|
||||
operation.set({ subField: "bloodType", level })
|
||||
withBloodType(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() {
|
||||
operation.set({ subField: "isFavourite", level })
|
||||
withIsFavourite(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavourite", level })
|
||||
return this
|
||||
},
|
||||
/** If the character is blocked from being added to favourites */
|
||||
withIsFavouriteBlocked() {
|
||||
operation.set({ subField: "isFavouriteBlocked", level })
|
||||
withIsFavouriteBlocked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavouriteBlocked", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the character page on the AniList website */
|
||||
withSiteUrl() {
|
||||
operation.set({ subField: "siteUrl", level })
|
||||
withSiteUrl(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** Media that includes the character */
|
||||
withMedia(op: { args?: AtLeastOne<CharacterMediaArgs>; fn: Fn<typeof MediaConnection> }) {
|
||||
operation.set({ subField: "media", level, variables: op.args, hasSubField: true })
|
||||
withMedia(
|
||||
op: { alias?: string; args?: AtLeastOne<CharacterMediaArgs>; fn: Fn<typeof MediaConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "media",
|
||||
level,
|
||||
variables: op.args,
|
||||
hasSubField: true,
|
||||
})
|
||||
op.fn(MediaConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The amount of user's who have favourited the character */
|
||||
withFavourites() {
|
||||
operation.set({ subField: "favourites", level })
|
||||
withFavourites(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favourites", level })
|
||||
return this
|
||||
},
|
||||
/** Notes for site moderators */
|
||||
withModNotes() {
|
||||
operation.set({ subField: "modNotes", level })
|
||||
withModNotes(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "modNotes", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -2,49 +2,49 @@ import { Fields, OperationParser } from "../types/Anilist.ts"
|
|||
|
||||
export const ExternalLinkSourceCollection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the external link */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(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() {
|
||||
operation.set({ subField: "url", level })
|
||||
withUrl(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "url", level })
|
||||
return this
|
||||
},
|
||||
/** The links website site name */
|
||||
withSite() {
|
||||
operation.set({ subField: "site", level })
|
||||
withSite(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "site", level })
|
||||
return this
|
||||
},
|
||||
/** The links website site id */
|
||||
withSiteId() {
|
||||
operation.set({ subField: "siteId", level })
|
||||
withSiteId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteId", level })
|
||||
return this
|
||||
},
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(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() {
|
||||
operation.set({ subField: "language", level })
|
||||
withLanguage(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "language", level })
|
||||
return this
|
||||
},
|
||||
withColor() {
|
||||
operation.set({ subField: "color", level })
|
||||
withColor(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() {
|
||||
operation.set({ subField: "icon", level })
|
||||
withIcon(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "icon", level })
|
||||
return this
|
||||
},
|
||||
withNotes() {
|
||||
operation.set({ subField: "notes", level })
|
||||
withNotes(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "notes", level })
|
||||
return this
|
||||
},
|
||||
withIsDisabled() {
|
||||
operation.set({ subField: "isDisabled", level })
|
||||
withIsDisabled(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isDisabled", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -14,34 +14,50 @@ import { StudioConnection } from "./Studio.ts"
|
|||
|
||||
export const Favourites = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** Favourite anime */
|
||||
withAnime(op: { args?: AtLeastOne<FavouritesAnimeArgs>; fn: Fn<typeof MediaConnection> }) {
|
||||
operation.set({ subField: "anime", level, variables: op?.args })
|
||||
withAnime(
|
||||
op: { alias?: string; args?: AtLeastOne<FavouritesAnimeArgs>; fn: Fn<typeof MediaConnection> },
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "anime", level, variables: op?.args })
|
||||
op.fn(MediaConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** Favourite manga */
|
||||
withManga(op: { args?: AtLeastOne<FavouritesMangaArgs>; fn: Fn<typeof MediaConnection> }) {
|
||||
operation.set({ subField: "manga", level, variables: op?.args })
|
||||
withManga(
|
||||
op: { alias?: string; args?: AtLeastOne<FavouritesMangaArgs>; fn: Fn<typeof MediaConnection> },
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "manga", level, variables: op?.args })
|
||||
op.fn(MediaConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** Favourite characters */
|
||||
withCharacters(
|
||||
op: { args?: AtLeastOne<FavouritesCharactersArgs>; fn: Fn<typeof CharacterConnection> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<FavouritesCharactersArgs>
|
||||
fn: Fn<typeof CharacterConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({ subField: "characters", level, variables: op?.args })
|
||||
operation.set({ alias: op.alias, subField: "characters", level, variables: op?.args })
|
||||
op.fn(CharacterConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** Favourite staff */
|
||||
withStaff(op: { args?: AtLeastOne<FavouritesStaffArgs>; fn: Fn<typeof StaffConnection> }) {
|
||||
operation.set({ subField: "staff", level, variables: op?.args })
|
||||
withStaff(
|
||||
op: { alias?: string; args?: AtLeastOne<FavouritesStaffArgs>; fn: Fn<typeof StaffConnection> },
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "staff", level, variables: op?.args })
|
||||
op.fn(StaffConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** Favourite studios */
|
||||
withStudios(op: { args?: AtLeastOne<FavouritesStudiosArgs>; fn: Fn<typeof StudioConnection> }) {
|
||||
operation.set({ subField: "studios", level, variables: op?.args })
|
||||
withStudios(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<FavouritesStudiosArgs>
|
||||
fn: Fn<typeof StudioConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "studios", level, variables: op?.args })
|
||||
op.fn(StudioConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
|
|
|
@ -5,20 +5,33 @@ import { Thread } from "./Thread.ts"
|
|||
import { ThreadComment } from "./ThreadComment.ts"
|
||||
|
||||
export const LikeableUnion = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withListActivity(op?: { fn?: Fn<typeof ListActivity> }) {
|
||||
operation.set({ subField: "ListActivity", level, hasSubField: true, isUnion: true })
|
||||
withListActivity(op?: { alias?: string; fn?: Fn<typeof ListActivity> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ListActivity",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ListActivity({ operation, level: level + 1 }))
|
||||
else ListActivity({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withTextActivity(op?: { fn?: Fn<typeof TextActivity> }) {
|
||||
operation.set({ subField: "TextActivity", level, hasSubField: true, isUnion: true })
|
||||
withTextActivity(op?: { alias?: string; fn?: Fn<typeof TextActivity> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "TextActivity",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(TextActivity({ operation, level: level + 1 }))
|
||||
else TextActivity({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withMessageActivity(op?: { fn?: Fn<typeof MessageActivity> }) {
|
||||
withMessageActivity(op?: { alias?: string; fn?: Fn<typeof MessageActivity> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "MessageActivity",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -28,20 +41,32 @@ export const LikeableUnion = ({ operation, level }: Fields<OperationParser>) =>
|
|||
else MessageActivity({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withActivityReply(op?: { fn?: Fn<typeof ActivityReply> }) {
|
||||
operation.set({ subField: "ActivityReply", level, hasSubField: true, isUnion: true })
|
||||
withActivityReply(op?: { alias?: string; fn?: Fn<typeof ActivityReply> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ActivityReply",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ActivityReply({ operation, level: level + 1 }))
|
||||
else ActivityReply({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withThread(op?: { fn?: Fn<typeof Thread> }) {
|
||||
operation.set({ subField: "Thread", level, hasSubField: true, isUnion: true })
|
||||
withThread(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()
|
||||
return this
|
||||
},
|
||||
withThreadComment(op?: { fn?: Fn<typeof ThreadComment> }) {
|
||||
operation.set({ subField: "ThreadComment", level, hasSubField: true, isUnion: true })
|
||||
withThreadComment(op?: { alias?: string; fn?: Fn<typeof ThreadComment> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ThreadComment",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
if (op?.fn) op.fn(ThreadComment({ operation, level: level + 1 }))
|
||||
else ThreadComment({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
|
|
|
@ -2,8 +2,8 @@ import { Fields, OperationParser } from "../types/Anilist.ts"
|
|||
|
||||
export const Markdown = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The parsed markdown as html */
|
||||
withHtml() {
|
||||
operation.set({ subField: "html", level })
|
||||
withHtml(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "html", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -32,299 +32,302 @@ import { StudioConnection } from "./Studio.ts"
|
|||
|
||||
export const MediaListGroup = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** Media list entries */
|
||||
withEntries(op: { fn: Fn<typeof MediaList> }) {
|
||||
operation.set({ subField: "entries", level, hasSubField: true })
|
||||
withEntries(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() {
|
||||
operation.set({ subField: "name", level })
|
||||
withName(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
withIsCustomList() {
|
||||
operation.set({ subField: "isCustomList", level })
|
||||
withIsCustomList(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isCustomList", level })
|
||||
return this
|
||||
},
|
||||
withIsSplitCompletedList() {
|
||||
operation.set({ subField: "isSplitCompletedList", level })
|
||||
withIsSplitCompletedList(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isSplitCompletedList", level })
|
||||
return this
|
||||
},
|
||||
withStatus() {
|
||||
operation.set({ subField: "status", level })
|
||||
withStatus(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "status", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaTitle = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The romanization of the native language title */
|
||||
romaji(op?: { args?: MediaTitleRomajiArgs }) {
|
||||
operation.set({ subField: "romaji", level, variables: op?.args })
|
||||
romaji(op?: { alias: string; args?: MediaTitleRomajiArgs }) {
|
||||
operation.set({ alias: op?.alias, subField: "romaji", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** The official english title */
|
||||
english(op?: { args?: MediaTitleEnglishArgs }) {
|
||||
operation.set({ subField: "english", level, variables: op?.args })
|
||||
english(op?: { alias: string; args?: MediaTitleEnglishArgs }) {
|
||||
operation.set({ alias: op?.alias, subField: "english", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** Official title in it's native language */
|
||||
native(op?: { args?: MediaTitleNativeArgs }) {
|
||||
operation.set({ subField: "native", level, variables: op?.args })
|
||||
native(op?: { alias: string; args?: MediaTitleNativeArgs }) {
|
||||
operation.set({ alias: op?.alias, subField: "native", level, variables: op?.args })
|
||||
return this
|
||||
},
|
||||
/** The currently authenticated users preferred title language. Default romaji for non-authenticated */
|
||||
userPreferred() {
|
||||
operation.set({ subField: "userPreferred", level })
|
||||
userPreferred(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userPreferred", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaTrailer = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The trailer video id */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(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() {
|
||||
operation.set({ subField: "site", level })
|
||||
withSite(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "site", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the thumbnail image of the video */
|
||||
withThumbnail() {
|
||||
operation.set({ subField: "thumbnail", level })
|
||||
withThumbnail(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "thumbnail", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
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() {
|
||||
operation.set({ subField: "extraLarge", level })
|
||||
withExtraLarge(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() {
|
||||
operation.set({ subField: "large", level })
|
||||
withLarge(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "large", level })
|
||||
return this
|
||||
},
|
||||
/** The cover image url of the media at medium size */
|
||||
withMedium() {
|
||||
operation.set({ subField: "medium", level })
|
||||
withMedium(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "medium", level })
|
||||
return this
|
||||
},
|
||||
/** Average #hex color of cover image */
|
||||
withColor() {
|
||||
operation.set({ subField: "color", level })
|
||||
withColor(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "color", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaExternalLink = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the external link */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(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() {
|
||||
operation.set({ subField: "url", level })
|
||||
withUrl(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "url", level })
|
||||
return this
|
||||
},
|
||||
/** The links website site name */
|
||||
withSite() {
|
||||
operation.set({ subField: "site", level })
|
||||
withSite(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "site", level })
|
||||
return this
|
||||
},
|
||||
/** The links website site id */
|
||||
withSiteId() {
|
||||
operation.set({ subField: "siteId", level })
|
||||
withSiteId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteId", level })
|
||||
return this
|
||||
},
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(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() {
|
||||
operation.set({ subField: "language", level })
|
||||
withLanguage(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "language", level })
|
||||
return this
|
||||
},
|
||||
withColor() {
|
||||
operation.set({ subField: "color", level })
|
||||
withColor(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() {
|
||||
operation.set({ subField: "icon", level })
|
||||
withIcon(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "icon", level })
|
||||
return this
|
||||
},
|
||||
withNotes() {
|
||||
operation.set({ subField: "notes", level })
|
||||
withNotes(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "notes", level })
|
||||
return this
|
||||
},
|
||||
withIsDisabled() {
|
||||
operation.set({ subField: "isDisabled", level })
|
||||
withIsDisabled(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isDisabled", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaStreamingEpisode = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** Title of the episode */
|
||||
withTitle() {
|
||||
operation.set({ subField: "title", level })
|
||||
withTitle(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "title", level })
|
||||
return this
|
||||
},
|
||||
/** Url of episode image thumbnail */
|
||||
withThumbnail() {
|
||||
operation.set({ subField: "thumbnail", level })
|
||||
withThumbnail(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "thumbnail", level })
|
||||
return this
|
||||
},
|
||||
/** The url of the episode */
|
||||
withUrl() {
|
||||
operation.set({ subField: "url", level })
|
||||
withUrl(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "url", level })
|
||||
return this
|
||||
},
|
||||
/** The site location of the streaming episodes */
|
||||
withSite() {
|
||||
operation.set({ subField: "site", level })
|
||||
withSite(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "site", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaRank = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the rank */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The numerical rank of the media */
|
||||
withRank() {
|
||||
operation.set({ subField: "rank", level })
|
||||
withRank(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "rank", level })
|
||||
return this
|
||||
},
|
||||
/** The type of ranking */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The format the media is ranked within */
|
||||
withFormat() {
|
||||
operation.set({ subField: "format", level })
|
||||
withFormat(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "format", level })
|
||||
return this
|
||||
},
|
||||
/** The year the media is ranked within */
|
||||
withYear() {
|
||||
operation.set({ subField: "year", level })
|
||||
withYear(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "year", level })
|
||||
return this
|
||||
},
|
||||
/** The season the media is ranked within */
|
||||
withSeason() {
|
||||
operation.set({ subField: "season", level })
|
||||
withSeason(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() {
|
||||
operation.set({ subField: "allTime", level })
|
||||
withAllTime(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() {
|
||||
operation.set({ subField: "context", level })
|
||||
withContext(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaStats = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
scoreDistribution(op: { fn: Fn<typeof ScoreDistribution> }) {
|
||||
operation.set({ subField: "scoreDistribution", level, hasSubField: true })
|
||||
scoreDistribution(op: { alias?: string; fn: Fn<typeof ScoreDistribution> }) {
|
||||
operation.set({ alias: op.alias, subField: "scoreDistribution", level, hasSubField: true })
|
||||
op.fn(ScoreDistribution({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
statusDistribution(op: { fn: Fn<typeof StatusDistribution> }) {
|
||||
operation.set({ subField: "statusDistribution", level, hasSubField: true })
|
||||
statusDistribution(op: { alias?: string; fn: Fn<typeof StatusDistribution> }) {
|
||||
operation.set({ alias: op.alias, subField: "statusDistribution", level, hasSubField: true })
|
||||
op.fn(StatusDistribution({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const StatusDistribution = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withStatus() {
|
||||
operation.set({ subField: "status", level })
|
||||
withStatus(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "status", level })
|
||||
return this
|
||||
},
|
||||
withAmount() {
|
||||
operation.set({ subField: "amount", level })
|
||||
withAmount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "amount", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ScoreDistribution = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withScore() {
|
||||
operation.set({ subField: "score", level })
|
||||
withScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "score", level })
|
||||
return this
|
||||
},
|
||||
withAmount() {
|
||||
operation.set({ subField: "amount", level })
|
||||
withAmount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "amount", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "node", level, hasSubField: true })
|
||||
withNode(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()
|
||||
return this
|
||||
},
|
||||
/** The id of the connection */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of relation to the parent model */
|
||||
withRelationType(op?: { args?: AtLeastOne<MediaEdgeRelationTypeArgs> }) {
|
||||
operation.set({ subField: "relationType", level, variables: op?.args })
|
||||
withRelationType(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() {
|
||||
operation.set({ subField: "isMainStudio", level })
|
||||
withIsMainStudio(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: { fn: Fn<typeof Character> }) {
|
||||
operation.set({ subField: "characters", level, hasSubField: true })
|
||||
withCharacters(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() {
|
||||
operation.set({ subField: "characterRole", level })
|
||||
withCharacterRole(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "characterRole", level })
|
||||
return this
|
||||
},
|
||||
/** Media specific character name */
|
||||
withCharacterName() {
|
||||
operation.set({ subField: "characterName", level })
|
||||
withCharacterName(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "characterName", level })
|
||||
return this
|
||||
},
|
||||
/** Notes regarding the VA's role for the character */
|
||||
withRoleNotes() {
|
||||
operation.set({ subField: "roleNotes", level })
|
||||
withRoleNotes(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() {
|
||||
operation.set({ subField: "dubGroup", level })
|
||||
withDubGroup(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() {
|
||||
operation.set({ subField: "staffRole", level })
|
||||
withStaffRole(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "staffRole", level })
|
||||
return this
|
||||
},
|
||||
/** The voice actors of the character */
|
||||
withVoiceActors(op?: { args?: AtLeastOne<MediaEdgeVoiceActorsArgs>; fn?: Fn<typeof Staff> }) {
|
||||
withVoiceActors(
|
||||
op?: { alias?: string; args?: AtLeastOne<MediaEdgeVoiceActorsArgs>; fn?: Fn<typeof Staff> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "voiceActors",
|
||||
level,
|
||||
variables: op?.args,
|
||||
|
@ -349,28 +352,28 @@ const MediaEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The order the media should be displayed from the users favourites */
|
||||
withFavouriteOrder() {
|
||||
operation.set({ subField: "favouriteOrder", level })
|
||||
withFavouriteOrder(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favouriteOrder", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const MediaConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { fn?: Fn<typeof MediaEdge> }) {
|
||||
operation.set({ subField: "edges", level, hasSubField: true })
|
||||
withEdges(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()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "nodes", level, hasSubField: true })
|
||||
withNodes(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()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ subField: "pageInfo", level, hasSubField: true })
|
||||
withPageInfo(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
|
||||
},
|
||||
|
@ -378,198 +381,211 @@ export const MediaConnection = ({ operation, level }: Fields<OperationParser>) =
|
|||
|
||||
export const Media = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the media */
|
||||
withId() {
|
||||
operation.set({ subField: getFieldName(this.withId.name), level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: getFieldName(this.withId.name), level })
|
||||
return this
|
||||
},
|
||||
/** The mal id of the media */
|
||||
withIdMal() {
|
||||
operation.set({ subField: "idMal", level })
|
||||
withIdMal(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "idMal", level })
|
||||
return this
|
||||
},
|
||||
/** The type of the media; anime or manga */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The format the media was released in */
|
||||
withFormat() {
|
||||
operation.set({ subField: "format", level })
|
||||
withFormat(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "format", level })
|
||||
return this
|
||||
},
|
||||
/** The season the media was initially released in */
|
||||
withSeason() {
|
||||
operation.set({ subField: "season", level })
|
||||
withSeason(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "season", level })
|
||||
return this
|
||||
},
|
||||
/** The season year the media was initially released in */
|
||||
withSeasonYear() {
|
||||
operation.set({ subField: "seasonYear", level })
|
||||
withSeasonYear(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "seasonYear", level })
|
||||
return this
|
||||
},
|
||||
/** The year & season the media was initially released in */
|
||||
withSeasonInt() {
|
||||
operation.set({ subField: "seasonInt", level })
|
||||
withSeasonInt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "seasonInt", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of episodes the anime has when complete */
|
||||
withEpisodes() {
|
||||
operation.set({ subField: "episodes", level })
|
||||
withEpisodes(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "episodes", level })
|
||||
return this
|
||||
},
|
||||
/** The general length of each anime episode in minutes */
|
||||
withDuration() {
|
||||
operation.set({ subField: "duration", level })
|
||||
withDuration(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "duration", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of chapters the manga has when complete */
|
||||
withChapters() {
|
||||
operation.set({ subField: "chapters", level })
|
||||
withChapters(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chapters", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of volumes the manga has when complete */
|
||||
withVolumes() {
|
||||
operation.set({ subField: "volumes", level })
|
||||
withVolumes(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "volumes", level })
|
||||
return this
|
||||
},
|
||||
/** Where the media was created. (ISO 3166-1 alpha-2) */
|
||||
withCountryOfOrigin() {
|
||||
operation.set({ subField: "countryOfOrigin", level })
|
||||
withCountryOfOrigin(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() {
|
||||
operation.set({ subField: "isLicensed", level })
|
||||
withIsLicensed(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLicensed", level })
|
||||
return this
|
||||
},
|
||||
/** Official Twitter hashtags for the media */
|
||||
withHashtag() {
|
||||
operation.set({ subField: "hashtag", level })
|
||||
withHashtag(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "hashtag", level })
|
||||
return this
|
||||
},
|
||||
/** When the media's data was last updated */
|
||||
withUpdatedAt() {
|
||||
operation.set({ subField: "updatedAt", level })
|
||||
withUpdatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedAt", level })
|
||||
return this
|
||||
},
|
||||
/** The banner image of the media */
|
||||
withBannerImage() {
|
||||
operation.set({ subField: "bannerImage", level })
|
||||
withBannerImage(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "bannerImage", level })
|
||||
return this
|
||||
},
|
||||
/** The genres of the media */
|
||||
withGenres() {
|
||||
operation.set({ subField: "genres", level })
|
||||
withGenres(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "genres", level })
|
||||
return this
|
||||
},
|
||||
/** Alternative titles of the media */
|
||||
withSynonyms() {
|
||||
operation.set({ subField: "synonyms", level })
|
||||
withSynonyms(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() {
|
||||
operation.set({ subField: "averageScore", level })
|
||||
withAverageScore(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() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
/** The number of users with the media on their list */
|
||||
withPopularity() {
|
||||
operation.set({ subField: "popularity", level })
|
||||
withPopularity(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() {
|
||||
operation.set({ subField: "isLocked", level })
|
||||
withIsLocked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of related activity in the past hour */
|
||||
withTrending() {
|
||||
operation.set({ subField: "trending", level })
|
||||
withTrending(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "trending", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of user's who have favourited the media */
|
||||
withFavourites() {
|
||||
operation.set({ subField: "favourites", level })
|
||||
withFavourites(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() {
|
||||
operation.set({ subField: "isFavourite", level })
|
||||
withIsFavourite(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavourite", level })
|
||||
return this
|
||||
},
|
||||
/** If the media is blocked from being added to favourites */
|
||||
withIsFavouriteBlocked() {
|
||||
operation.set({ subField: "isFavouriteBlocked", level })
|
||||
withIsFavouriteBlocked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavouriteBlocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the media is intended only for 18+ adult audiences */
|
||||
withIsAdult() {
|
||||
operation.set({ subField: "isAdult", level })
|
||||
withIsAdult(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isAdult", level })
|
||||
return this
|
||||
},
|
||||
/** The media's next episode airing schedule */
|
||||
withNextAiringEpisode(op?: { fn?: Fn<typeof AiringSchedule> }) {
|
||||
operation.set({ subField: "nextAiringEpisode", level, hasSubField: true })
|
||||
withNextAiringEpisode(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()
|
||||
return this
|
||||
},
|
||||
/** The url for the media page on the AniList website */
|
||||
withSiteUrl() {
|
||||
operation.set({ subField: "siteUrl", level })
|
||||
withSiteUrl(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() {
|
||||
operation.set({ subField: "autoCreateForumThread", level })
|
||||
withAutoCreateForumThread(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "autoCreateForumThread", level })
|
||||
return this
|
||||
},
|
||||
/** If the media is blocked from being recommended to/from */
|
||||
withIsRecommendationBlocked() {
|
||||
operation.set({ subField: "isRecommendationBlocked", level })
|
||||
withIsRecommendationBlocked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isRecommendationBlocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the media is blocked from being reviewed */
|
||||
withIsReviewBlocked() {
|
||||
operation.set({ subField: "isReviewBlocked", level })
|
||||
withIsReviewBlocked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isReviewBlocked", level })
|
||||
return this
|
||||
},
|
||||
/** Notes for site moderators */
|
||||
withModNotes() {
|
||||
operation.set({ subField: "modNotes", level })
|
||||
withModNotes(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "modNotes", level })
|
||||
return this
|
||||
},
|
||||
/** The current releasing status of the media */
|
||||
withStatus(op?: { args?: AtLeastOne<MediaStatusArgs> }) {
|
||||
operation.set({ subField: "status", level, variables: op?.args })
|
||||
withStatus(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?: { args?: AtLeastOne<MediaDescriptionArgs> }) {
|
||||
operation.set({ subField: "description", level, variables: op?.args })
|
||||
withDescription(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?: { args?: AtLeastOne<MediaSourceArgs> }) {
|
||||
operation.set({ subField: "source", level, variables: op?.args })
|
||||
withSource(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(op: { args?: AtLeastOne<MediaStaffArgs>; fn: Fn<typeof StaffConnection> }) {
|
||||
operation.set({ subField: "staff", level, variables: op?.args, hasSubField: true })
|
||||
withStaff(
|
||||
op: { alias?: string; args?: AtLeastOne<MediaStaffArgs>; fn: Fn<typeof StaffConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "staff",
|
||||
level,
|
||||
variables: op?.args,
|
||||
hasSubField: true,
|
||||
})
|
||||
op.fn(StaffConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** User recommendations for similar media */
|
||||
withRecommendations(
|
||||
op: { args?: AtLeastOne<MediaRecommendationsArgs>; fn: Fn<typeof RecommendationConnection> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<MediaRecommendationsArgs>
|
||||
fn: Fn<typeof RecommendationConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "recommendations",
|
||||
level,
|
||||
variables: op?.args,
|
||||
|
@ -616,26 +632,42 @@ export const Media = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The media's daily trend stats */
|
||||
withTrends(op: { args?: AtLeastOne<MediaTrendsArgs>; fn: Fn<typeof MediaTrendConnection> }) {
|
||||
operation.set({ subField: "trends", level, variables: op?.args, hasSubField: true })
|
||||
withTrends(
|
||||
op: { alias?: string; args?: AtLeastOne<MediaTrendsArgs>; fn: Fn<typeof MediaTrendConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "trends",
|
||||
level,
|
||||
variables: op?.args,
|
||||
hasSubField: true,
|
||||
})
|
||||
op.fn(MediaTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** User reviews of the media */
|
||||
withReviews(op: { args?: AtLeastOne<MediaReviewsArgs>; fn: Fn<typeof ReviewConnection> }) {
|
||||
operation.set({ subField: "reviews", level, variables: op?.args, hasSubField: true })
|
||||
withReviews(
|
||||
op: { alias?: string; args?: AtLeastOne<MediaReviewsArgs>; fn: Fn<typeof ReviewConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "reviews",
|
||||
level,
|
||||
variables: op?.args,
|
||||
hasSubField: true,
|
||||
})
|
||||
op.fn(ReviewConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The official titles of the media in various languages */
|
||||
withTitle(op: { fn: Fn<typeof MediaTitle> }) {
|
||||
operation.set({ subField: "title", level, hasSubField: true })
|
||||
withTitle(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?: { fn?: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({ subField: "startDate", level, hasSubField: true })
|
||||
withStartDate(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 })
|
||||
|
@ -646,8 +678,8 @@ export const Media = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The last official release date of the media */
|
||||
withEndDate(op?: { fn?: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({ subField: "endDate", level, hasSubField: true })
|
||||
withEndDate(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 })
|
||||
|
@ -658,57 +690,57 @@ export const Media = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** Media trailer or advertisement */
|
||||
withTrailer(op: { fn: Fn<typeof MediaTrailer> }) {
|
||||
operation.set({ subField: "trailer", level, hasSubField: true })
|
||||
withTrailer(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?: { fn?: Fn<typeof MediaCoverImage> }) {
|
||||
operation.set({ subField: "coverImage", level, hasSubField: true })
|
||||
withCoverImage(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()
|
||||
return this
|
||||
},
|
||||
/** List of tags that describes elements and themes of the media */
|
||||
withTags(op: { fn: Fn<typeof MediaTag> }) {
|
||||
operation.set({ subField: "tags", level, hasSubField: true })
|
||||
withTags(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: { fn: Fn<typeof MediaConnection> }) {
|
||||
operation.set({ subField: "relations", level, hasSubField: true })
|
||||
withRelations(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: { fn: Fn<typeof MediaExternalLink> }) {
|
||||
operation.set({ subField: "externalLinks", level, hasSubField: true })
|
||||
withExternalLinks(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: { fn: Fn<typeof MediaStreamingEpisode> }) {
|
||||
operation.set({ subField: "streamingEpisodes", level, hasSubField: true })
|
||||
withStreamingEpisodes(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: { fn: Fn<typeof MediaRank> }) {
|
||||
operation.set({ subField: "rankings", level, hasSubField: true })
|
||||
withRankings(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?: { fn?: Fn<typeof MediaList> }) {
|
||||
operation.set({ subField: "mediaListEntry", level, hasSubField: true })
|
||||
withMediaListEntry(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()
|
||||
return this
|
||||
},
|
||||
withStats(op: { fn: Fn<typeof MediaStats> }) {
|
||||
operation.set({ subField: "stats", level, hasSubField: true })
|
||||
withStats(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
|
||||
},
|
||||
|
|
|
@ -5,140 +5,132 @@ import { User } from "./User.ts"
|
|||
|
||||
export const MediaListTypeOptions = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The order each list should be displayed in */
|
||||
withSectionOrder() {
|
||||
operation.set({ subField: "sectionOrder", level })
|
||||
withSectionOrder(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() {
|
||||
operation.set({ subField: "splitCompletedSectionByFormat", level })
|
||||
withSplitCompletedSectionByFormat(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "splitCompletedSectionByFormat", level })
|
||||
return this
|
||||
},
|
||||
/** The names of the user's custom lists */
|
||||
withCustomLists() {
|
||||
operation.set({ subField: "customLists", level })
|
||||
withCustomLists(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "customLists", level })
|
||||
return this
|
||||
},
|
||||
/** The names of the user's advanced scoring sections */
|
||||
withAdvancedScoring() {
|
||||
operation.set({ subField: "advancedScoring", level })
|
||||
withAdvancedScoring(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "advancedScoring", level })
|
||||
return this
|
||||
},
|
||||
/** If advanced scoring is enabled */
|
||||
withAdvancedScoringEnabled() {
|
||||
operation.set({ subField: "advancedScoringEnabled", level })
|
||||
withAdvancedScoringEnabled(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "advancedScoringEnabled", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const MediaListOptions = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The score format the user is using for media lists */
|
||||
withScoreFormat() {
|
||||
operation.set({ subField: "scoreFormat", level })
|
||||
withScoreFormat(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "scoreFormat", level })
|
||||
return this
|
||||
},
|
||||
/** The default order list rows should be displayed in */
|
||||
withRowOrder() {
|
||||
operation.set({ subField: "rowOrder", level })
|
||||
withRowOrder(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "rowOrder", level })
|
||||
return this
|
||||
},
|
||||
/** The user's anime list options */
|
||||
withAnimeList(op: { fn: Fn<typeof MediaListTypeOptions> }) {
|
||||
operation.set({ subField: "animeList", level })
|
||||
withAnimeList(op: { alias?: string; fn: Fn<typeof MediaListTypeOptions> }) {
|
||||
operation.set({ alias: op.alias, subField: "animeList", level })
|
||||
op.fn(MediaListTypeOptions({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The user's manga list options */
|
||||
withMangaList(op: { fn: Fn<typeof MediaListTypeOptions> }) {
|
||||
operation.set({ subField: "mangaList", level })
|
||||
withMangaList(op: { alias?: string; fn: Fn<typeof MediaListTypeOptions> }) {
|
||||
operation.set({ alias: op.alias, subField: "mangaList", level })
|
||||
op.fn(MediaListTypeOptions({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const MediaList = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCompletedAt(op: { fn: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({
|
||||
subField: "completedAt",
|
||||
level,
|
||||
hasSubField: true,
|
||||
})
|
||||
withCompletedAt(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: { fn: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({
|
||||
subField: "startedAt",
|
||||
level,
|
||||
hasSubField: true,
|
||||
})
|
||||
withStartedAt(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() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
withUserId() {
|
||||
operation.set({ subField: "userId", level })
|
||||
withUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
withMediaId() {
|
||||
operation.set({ subField: "mediaId", level })
|
||||
withMediaId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
withStatus() {
|
||||
operation.set({ subField: "status", level })
|
||||
withStatus(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "status", level })
|
||||
return this
|
||||
},
|
||||
withProgress() {
|
||||
operation.set({ subField: "progress", level })
|
||||
withProgress(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "progress", level })
|
||||
return this
|
||||
},
|
||||
withProgressVolumes() {
|
||||
operation.set({ subField: "progressVolumes", level })
|
||||
withProgressVolumes(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "progressVolumes", level })
|
||||
return this
|
||||
},
|
||||
withRepeat() {
|
||||
operation.set({ subField: "repeat", level })
|
||||
withRepeat(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "repeat", level })
|
||||
return this
|
||||
},
|
||||
withPriority() {
|
||||
operation.set({ subField: "priority", level })
|
||||
withPriority(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "priority", level })
|
||||
return this
|
||||
},
|
||||
withPrivate() {
|
||||
operation.set({ subField: "private", level })
|
||||
withPrivate(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "private", level })
|
||||
return this
|
||||
},
|
||||
withNotes() {
|
||||
operation.set({ subField: "notes", level })
|
||||
withNotes(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "notes", level })
|
||||
return this
|
||||
},
|
||||
withAdvancedScores() {
|
||||
operation.set({ subField: "advancedScores", level })
|
||||
withAdvancedScores(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "advancedScores", level })
|
||||
return this
|
||||
},
|
||||
withHiddenFromStatusLists() {
|
||||
operation.set({ subField: "hiddenFromStatusLists", level })
|
||||
withHiddenFromStatusLists(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "hiddenFromStatusLists", level })
|
||||
return this
|
||||
},
|
||||
withUpdatedAt() {
|
||||
operation.set({ subField: "updatedAt", level })
|
||||
withUpdatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedAt", level })
|
||||
return this
|
||||
},
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
withMedia(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "media", level, hasSubField: true })
|
||||
withMedia(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()
|
||||
return this
|
||||
},
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
|
|
|
@ -4,21 +4,21 @@ import { User } from "./User.ts"
|
|||
|
||||
export const MediaListCollection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** Grouped media list entries */
|
||||
withLists(op: { fn: Fn<typeof MediaListGroup> }) {
|
||||
operation.set({ subField: "lists", level, hasSubField: true })
|
||||
withLists(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?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
},
|
||||
/** If there is another chunk */
|
||||
withHasNextChunk() {
|
||||
operation.set({ subField: "hasNextChunk", level })
|
||||
withHasNextChunk(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "hasNextChunk", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -2,48 +2,48 @@ import { Fields, OperationParser } from "../types/Anilist.ts"
|
|||
|
||||
export const MediaTag = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the tag */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The name of the tag */
|
||||
withName() {
|
||||
operation.set({ subField: "name", level })
|
||||
withName(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
/** A general description of the tag */
|
||||
withDescription() {
|
||||
operation.set({ subField: "description", level })
|
||||
withDescription(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "description", level })
|
||||
return this
|
||||
},
|
||||
/** The categories of tags this tag belongs to */
|
||||
withCategory() {
|
||||
operation.set({ subField: "category", level })
|
||||
withCategory(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() {
|
||||
operation.set({ subField: "rank", level })
|
||||
withRank(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "rank", level })
|
||||
return this
|
||||
},
|
||||
/** If the tag could be a spoiler for any media */
|
||||
withIsGeneralSpoiler() {
|
||||
operation.set({ subField: "isGeneralSpoiler", level })
|
||||
withIsGeneralSpoiler(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isGeneralSpoiler", level })
|
||||
return this
|
||||
},
|
||||
/** If the tag is a spoiler for this media */
|
||||
withIsMediaSpoiler() {
|
||||
operation.set({ subField: "isMediaSpoiler", level })
|
||||
withIsMediaSpoiler(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isMediaSpoiler", level })
|
||||
return this
|
||||
},
|
||||
/** If the tag is only for adult 18+ media */
|
||||
withIsAdult() {
|
||||
operation.set({ subField: "isAdult", level })
|
||||
withIsAdult(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isAdult", level })
|
||||
return this
|
||||
},
|
||||
/** The user who submitted the tag */
|
||||
withUserId() {
|
||||
operation.set({ subField: "userId", level })
|
||||
withUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -3,8 +3,8 @@ import { Media } from "./Media.ts"
|
|||
import { PageInfo } from "./Page.ts"
|
||||
|
||||
const MediaTrendEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op?: { fn?: Fn<typeof MediaTrend> }) {
|
||||
operation.set({ subField: "node", level, hasSubField: true })
|
||||
withNode(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()
|
||||
return this
|
||||
|
@ -12,21 +12,21 @@ const MediaTrendEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
})
|
||||
|
||||
export const MediaTrendConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { fn?: Fn<typeof MediaTrendEdge> }) {
|
||||
operation.set({ subField: "edges", level, hasSubField: true })
|
||||
withEdges(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()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { fn?: Fn<typeof MediaTrend> }) {
|
||||
operation.set({ subField: "nodes", level, hasSubField: true })
|
||||
withNodes(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()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ subField: "pageInfo", level, hasSubField: true })
|
||||
withPageInfo(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,48 +34,48 @@ export const MediaTrendConnection = ({ operation, level }: Fields<OperationParse
|
|||
|
||||
export const MediaTrend = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the tag */
|
||||
withMediaId() {
|
||||
operation.set({ subField: "mediaId", level })
|
||||
withMediaId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The day the data was recorded (timestamp) */
|
||||
withDate() {
|
||||
operation.set({ subField: "date", level })
|
||||
withDate(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "date", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of media activity on the day */
|
||||
withTrending() {
|
||||
operation.set({ subField: "trending", level })
|
||||
withTrending(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() {
|
||||
operation.set({ subField: "averageScore", level })
|
||||
withAverageScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "averageScore", level })
|
||||
return this
|
||||
},
|
||||
/** The number of users with the media on their list */
|
||||
withPopularity() {
|
||||
operation.set({ subField: "popularity", level })
|
||||
withPopularity(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "popularity", level })
|
||||
return this
|
||||
},
|
||||
/** The number of users with watching/reading the media */
|
||||
withInProgress() {
|
||||
operation.set({ subField: "inProgress", level })
|
||||
withInProgress(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "inProgress", level })
|
||||
return this
|
||||
},
|
||||
/** If the media was being released at this time */
|
||||
withReleasing() {
|
||||
operation.set({ subField: "releasing", level })
|
||||
withReleasing(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "releasing", level })
|
||||
return this
|
||||
},
|
||||
/** The episode number of the anime released on this day */
|
||||
withEpisode() {
|
||||
operation.set({ subField: "episode", level })
|
||||
withEpisode(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "episode", level })
|
||||
return this
|
||||
},
|
||||
/** The related media */
|
||||
withMedia(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "node", level, hasSubField: true })
|
||||
withMedia(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()
|
||||
return this
|
||||
|
|
|
@ -7,38 +7,38 @@ import { User } from "./User.ts"
|
|||
|
||||
const AiringNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the aired anime */
|
||||
withAnimeId() {
|
||||
operation.set({ subField: "animeId", level })
|
||||
withAnimeId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "animeId", level })
|
||||
return this
|
||||
},
|
||||
/** The episode number that just aired */
|
||||
withEpisode() {
|
||||
operation.set({ subField: "episode", level })
|
||||
withEpisode(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "episode", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContexts() {
|
||||
operation.set({ subField: "contexts", level })
|
||||
withContexts(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "contexts", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The associated media of the airing schedule */
|
||||
withMedia(op: { fn: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "media", level, hasSubField: true })
|
||||
withMedia(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,33 +46,33 @@ const AiringNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
const FollowingNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who followed the authenticated user */
|
||||
withUserId() {
|
||||
operation.set({ subField: "userId", level })
|
||||
withUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext() {
|
||||
operation.set({ subField: "context", level })
|
||||
withContext(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The liked activity */
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
|
@ -81,45 +81,45 @@ const FollowingNotification = ({ operation, level }: Fields<OperationParser>) =>
|
|||
|
||||
const ActivityMessageNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The if of the user who send the message */
|
||||
withUserId() {
|
||||
operation.set({ subField: "userId", level })
|
||||
withUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the activity message */
|
||||
withActivityId() {
|
||||
operation.set({ subField: "activityId", level })
|
||||
withActivityId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "activityId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext() {
|
||||
operation.set({ subField: "context", level })
|
||||
withContext(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The message activity */
|
||||
withMessage(op?: { fn?: Fn<typeof MessageActivity> }) {
|
||||
operation.set({ subField: "message", level, hasSubField: true })
|
||||
withMessage(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()
|
||||
return this
|
||||
},
|
||||
/** The user who sent the message */
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
|
@ -128,38 +128,38 @@ const ActivityMessageNotification = ({ operation, level }: Fields<OperationParse
|
|||
|
||||
const ActivityNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who mentioned the authenticated user */
|
||||
withUserId() {
|
||||
operation.set({ subField: "userId", level })
|
||||
withUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the activity where mentioned */
|
||||
withActivityId() {
|
||||
operation.set({ subField: "activityId", level })
|
||||
withActivityId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "activityId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext() {
|
||||
operation.set({ subField: "context", level })
|
||||
withContext(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The liked activity */
|
||||
withActivity(op?: { fn?: Fn<typeof ActivityUnion> }) {
|
||||
operation.set({ subField: "activity", level, hasSubField: true })
|
||||
withActivity(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 })
|
||||
|
@ -170,8 +170,8 @@ const ActivityNotification = ({ operation, level }: Fields<OperationParser>) =>
|
|||
return this
|
||||
},
|
||||
/** The user who mentioned the authenticated user */
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
|
@ -180,52 +180,52 @@ const ActivityNotification = ({ operation, level }: Fields<OperationParser>) =>
|
|||
|
||||
const ThreadCommentNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who mentioned the authenticated user */
|
||||
withUserId() {
|
||||
operation.set({ subField: "userId", level })
|
||||
withUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the comment where mentioned */
|
||||
withCommentId() {
|
||||
operation.set({ subField: "commentId", level })
|
||||
withCommentId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "commentId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext() {
|
||||
operation.set({ subField: "context", level })
|
||||
withContext(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The thread that the relevant comment belongs to */
|
||||
withThread(op?: { fn?: Fn<typeof Thread> }) {
|
||||
operation.set({ subField: "thread", level, hasSubField: true })
|
||||
withThread(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()
|
||||
return this
|
||||
},
|
||||
/** The thread comment that included the @ mention */
|
||||
withComment(op?: { fn?: Fn<typeof ThreadComment> }) {
|
||||
operation.set({ subField: "comment", level, hasSubField: true })
|
||||
withComment(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()
|
||||
return this
|
||||
},
|
||||
/** The user who mentioned the authenticated user */
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
|
@ -234,52 +234,52 @@ const ThreadCommentNotification = ({ operation, level }: Fields<OperationParser>
|
|||
|
||||
const ThreadLikeNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who liked to the activity */
|
||||
withUserId() {
|
||||
operation.set({ subField: "userId", level })
|
||||
withUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the thread which was liked */
|
||||
withThreadId() {
|
||||
operation.set({ subField: "threadId", level })
|
||||
withThreadId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "threadId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext() {
|
||||
operation.set({ subField: "context", level })
|
||||
withContext(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The thread that the relevant comment belongs to */
|
||||
withThread(op?: { fn?: Fn<typeof Thread> }) {
|
||||
operation.set({ subField: "thread", level, hasSubField: true })
|
||||
withThread(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()
|
||||
return this
|
||||
},
|
||||
/** The liked thread comment */
|
||||
withComment(op?: { fn?: Fn<typeof ThreadComment> }) {
|
||||
operation.set({ subField: "comment", level, hasSubField: true })
|
||||
withComment(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()
|
||||
return this
|
||||
},
|
||||
/** The user who liked the activity */
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
|
@ -288,33 +288,33 @@ const ThreadLikeNotification = ({ operation, level }: Fields<OperationParser>) =
|
|||
|
||||
const RelatedMediaAdditionNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the new media */
|
||||
withMediaId() {
|
||||
operation.set({ subField: "mediaId", level })
|
||||
withMediaId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext() {
|
||||
operation.set({ subField: "context", level })
|
||||
withContext(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The associated media of the airing schedule */
|
||||
withMedia(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "media", level, hasSubField: true })
|
||||
withMedia(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()
|
||||
return this
|
||||
|
@ -323,38 +323,38 @@ const RelatedMediaAdditionNotification = ({ operation, level }: Fields<Operation
|
|||
|
||||
const MediaDataChangeNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the media that received data changes */
|
||||
withMediaId() {
|
||||
operation.set({ subField: "mediaId", level })
|
||||
withMediaId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media data change */
|
||||
withContext() {
|
||||
operation.set({ subField: "context", level })
|
||||
withContext(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media data change */
|
||||
withReason() {
|
||||
operation.set({ subField: "reason", level })
|
||||
withReason(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "reason", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The media that received data changes */
|
||||
withMedia(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "media", level, hasSubField: true })
|
||||
withMedia(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()
|
||||
return this
|
||||
|
@ -363,43 +363,43 @@ const MediaDataChangeNotification = ({ operation, level }: Fields<OperationParse
|
|||
|
||||
const MediaMergeNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the media that was merged into */
|
||||
withMediaId() {
|
||||
operation.set({ subField: "mediaId", level })
|
||||
withMediaId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The title of the deleted media */
|
||||
withDeletedMediaTitles() {
|
||||
operation.set({ subField: "deletedMediaTitles", level })
|
||||
withDeletedMediaTitles(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "deletedMediaTitles", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media data change */
|
||||
withContext() {
|
||||
operation.set({ subField: "context", level })
|
||||
withContext(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media merge */
|
||||
withReason() {
|
||||
operation.set({ subField: "reason", level })
|
||||
withReason(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "reason", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The media that was merged into */
|
||||
withMedia(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "media", level, hasSubField: true })
|
||||
withMedia(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()
|
||||
return this
|
||||
|
@ -408,40 +408,41 @@ const MediaMergeNotification = ({ operation, level }: Fields<OperationParser>) =
|
|||
|
||||
const MediaDeletionNotification = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The title of the deleted media */
|
||||
withDeletedMediaTitle() {
|
||||
operation.set({ subField: "deletedMediaTitle", level })
|
||||
withDeletedMediaTitle(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "deletedMediaTitle", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media deletion */
|
||||
withContext() {
|
||||
operation.set({ subField: "context", level })
|
||||
withContext(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media deletion */
|
||||
withReason() {
|
||||
operation.set({ subField: "reason", level })
|
||||
withReason(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "reason", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const NotificationUnion = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
AiringNotification(op?: { fn?: Fn<typeof AiringNotification> }) {
|
||||
AiringNotification(op?: { alias?: string; fn?: Fn<typeof AiringNotification> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "AiringNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -451,8 +452,9 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else AiringNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
FollowingNotification(op?: { fn?: Fn<typeof FollowingNotification> }) {
|
||||
FollowingNotification(op?: { alias?: string; fn?: Fn<typeof FollowingNotification> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "FollowingNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -462,8 +464,11 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else FollowingNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
ActivityMessageNotification(op?: { fn?: Fn<typeof ActivityMessageNotification> }) {
|
||||
ActivityMessageNotification(
|
||||
op?: { alias?: string; fn?: Fn<typeof ActivityMessageNotification> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ActivityMessageNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -474,8 +479,9 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
} else ActivityMessageNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
ActivityMentionNotification(op?: { fn?: Fn<typeof ActivityNotification> }) {
|
||||
ActivityMentionNotification(op?: { alias?: string; fn?: Fn<typeof ActivityNotification> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ActivityMentionNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -485,8 +491,9 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else ActivityNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
ActivityReplyNotification(op?: { fn?: Fn<typeof ActivityNotification> }) {
|
||||
ActivityReplyNotification(op?: { alias?: string; fn?: Fn<typeof ActivityNotification> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ActivityReplyNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -496,8 +503,11 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else ActivityNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
ActivityReplySubscribedNotification(op?: { fn?: Fn<typeof ActivityNotification> }) {
|
||||
ActivityReplySubscribedNotification(
|
||||
op?: { alias?: string; fn?: Fn<typeof ActivityNotification> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ActivityReplySubscribedNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -507,8 +517,9 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else ActivityNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
ActivityLikeNotification(op?: { fn?: Fn<typeof ActivityNotification> }) {
|
||||
ActivityLikeNotification(op?: { alias?: string; fn?: Fn<typeof ActivityNotification> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ActivityLikeNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -518,8 +529,9 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else ActivityNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
ActivityReplyLikeNotification(op?: { fn?: Fn<typeof ActivityNotification> }) {
|
||||
ActivityReplyLikeNotification(op?: { alias?: string; fn?: Fn<typeof ActivityNotification> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ActivityReplyLikeNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -529,8 +541,11 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else ActivityNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
ThreadCommentMentionNotification(op?: { fn?: Fn<typeof ThreadCommentNotification> }) {
|
||||
ThreadCommentMentionNotification(
|
||||
op?: { alias?: string; fn?: Fn<typeof ThreadCommentNotification> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ThreadCommentMentionNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -540,8 +555,11 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else ThreadCommentNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
ThreadCommentReplyNotification(op?: { fn?: Fn<typeof ThreadCommentNotification> }) {
|
||||
ThreadCommentReplyNotification(
|
||||
op?: { alias?: string; fn?: Fn<typeof ThreadCommentNotification> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ThreadCommentReplyNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -551,8 +569,11 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else ThreadCommentNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
ThreadCommentSubscribedNotification(op?: { fn?: Fn<typeof ThreadCommentNotification> }) {
|
||||
ThreadCommentSubscribedNotification(
|
||||
op?: { alias?: string; fn?: Fn<typeof ThreadCommentNotification> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ThreadCommentSubscribedNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -562,8 +583,11 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else ThreadCommentNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
ThreadCommentLikeNotification(op?: { fn?: Fn<typeof ThreadCommentNotification> }) {
|
||||
ThreadCommentLikeNotification(
|
||||
op?: { alias?: string; fn?: Fn<typeof ThreadCommentNotification> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ThreadCommentLikeNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -573,8 +597,9 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else ThreadCommentNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
ThreadLikeNotification(op?: { fn?: Fn<typeof ThreadLikeNotification> }) {
|
||||
ThreadLikeNotification(op?: { alias?: string; fn?: Fn<typeof ThreadLikeNotification> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "ThreadLikeNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -584,8 +609,11 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else ThreadLikeNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
RelatedMediaAdditionNotification(op?: { fn?: Fn<typeof RelatedMediaAdditionNotification> }) {
|
||||
RelatedMediaAdditionNotification(
|
||||
op?: { alias?: string; fn?: Fn<typeof RelatedMediaAdditionNotification> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "RelatedMediaAdditionNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -597,8 +625,11 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
.withId()}
|
||||
return this
|
||||
},
|
||||
MediaDataChangeNotification(op?: { fn?: Fn<typeof MediaDataChangeNotification> }) {
|
||||
MediaDataChangeNotification(
|
||||
op?: { alias?: string; fn?: Fn<typeof MediaDataChangeNotification> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "MediaDataChangeNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -609,8 +640,9 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
} else MediaDataChangeNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
MediaMergeNotification(op?: { fn?: Fn<typeof MediaMergeNotification> }) {
|
||||
MediaMergeNotification(op?: { alias?: string; fn?: Fn<typeof MediaMergeNotification> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "MediaMergeNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -620,8 +652,9 @@ export const NotificationUnion = ({ operation, level }: Fields<OperationParser>)
|
|||
else MediaMergeNotification({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
MediaDeletionNotification(op?: { fn?: Fn<typeof MediaDeletionNotification> }) {
|
||||
MediaDeletionNotification(op?: { alias?: string; fn?: Fn<typeof MediaDeletionNotification> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "MediaDeletionNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
|
|
@ -39,53 +39,68 @@ 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() {
|
||||
operation.set({ subField: "total", level })
|
||||
withTotal(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "total", level })
|
||||
return this
|
||||
},
|
||||
/** The count on a page */
|
||||
withPerPage() {
|
||||
operation.set({ subField: "perPage", level })
|
||||
withPerPage(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "perPage", level })
|
||||
return this
|
||||
},
|
||||
/** The current page */
|
||||
withCurrentPage() {
|
||||
operation.set({ subField: "currentPage", level })
|
||||
withCurrentPage(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "currentPage", level })
|
||||
return this
|
||||
},
|
||||
/** The last page */
|
||||
withLastPage() {
|
||||
operation.set({ subField: "lastPage", level })
|
||||
withLastPage(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "lastPage", level })
|
||||
return this
|
||||
},
|
||||
/** If there is another page */
|
||||
withHasNextPage() {
|
||||
operation.set({ subField: "hasNextPage", level })
|
||||
withHasNextPage(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "hasNextPage", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ subField: "pageInfo", level, hasSubField: true })
|
||||
withPageInfo(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?: { args?: AtLeastOne<PageUsersArgs>; fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "users", level, hasSubField: true, variables: op?.args })
|
||||
withUsers(op?: { alias: string; args?: AtLeastOne<PageUsersArgs>; fn?: Fn<typeof User> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "users",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withMedia(op?: { args?: AtLeastOne<PageMediaArgs>; fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "media", level, hasSubField: true, variables: op?.args })
|
||||
withMedia(op?: { alias: string; args?: AtLeastOne<PageMediaArgs>; fn?: Fn<typeof Media> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "media",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(Media({ operation, level: level + 1 }))
|
||||
else Media({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withCharacters(op?: { args?: AtLeastOne<PageCharactersArgs>; fn?: Fn<typeof Character> }) {
|
||||
withCharacters(
|
||||
op?: { alias?: string; args?: AtLeastOne<PageCharactersArgs>; fn?: Fn<typeof Character> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "characters",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -95,20 +110,35 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
else Character({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withStaff(op?: { args?: AtLeastOne<PageStaffArgs>; fn?: Fn<typeof Staff> }) {
|
||||
operation.set({ subField: "staff", level, hasSubField: true, variables: op?.args })
|
||||
withStaff(op?: { alias: string; args?: AtLeastOne<PageStaffArgs>; fn?: Fn<typeof Staff> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "staff",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(Staff({ operation, level: level + 1 }))
|
||||
else Staff({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withStudios(op?: { args?: AtLeastOne<PageStudiosArgs>; fn?: Fn<typeof Studio> }) {
|
||||
operation.set({ subField: "studios", level, hasSubField: true, variables: op?.args })
|
||||
withStudios(op?: { alias: string; args?: AtLeastOne<PageStudiosArgs>; fn?: Fn<typeof Studio> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "studios",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(Studio({ operation, level: level + 1 }))
|
||||
else Studio({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withMediaList(op?: { args?: AtLeastOne<PageMediaListArgs>; fn?: Fn<typeof MediaList> }) {
|
||||
withMediaList(
|
||||
op?: { alias?: string; args?: AtLeastOne<PageMediaListArgs>; fn?: Fn<typeof MediaList> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "mediaList",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -119,9 +149,14 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
withAiringSchedules(
|
||||
op?: { args?: AtLeastOne<PageAiringSchedulesArgs>; fn?: Fn<typeof AiringSchedule> },
|
||||
op?: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<PageAiringSchedulesArgs>
|
||||
fn?: Fn<typeof AiringSchedule>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "airingSchedules",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -131,8 +166,11 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
else AiringSchedule({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withMediaTrends(op?: { args?: AtLeastOne<PageMediaTrendsArgs>; fn?: Fn<typeof MediaTrend> }) {
|
||||
withMediaTrends(
|
||||
op?: { alias?: string; args?: AtLeastOne<PageMediaTrendsArgs>; fn?: Fn<typeof MediaTrend> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "mediaTrends",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -143,9 +181,14 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
withNotifications(
|
||||
op: { args?: AtLeastOne<PageNotificationsArgs>; fn: Fn<typeof NotificationUnion> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<PageNotificationsArgs>
|
||||
fn: Fn<typeof NotificationUnion>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "notifications",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -154,8 +197,11 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
op.fn(NotificationUnion({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withFollowers(op?: { args?: AtLeastOne<PageFollowersArgs>; fn?: Fn<typeof User> }) {
|
||||
withFollowers(
|
||||
op?: { alias?: string; args?: AtLeastOne<PageFollowersArgs>; fn?: Fn<typeof User> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "followers",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -165,8 +211,11 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
else User({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withFollowing(op?: { args?: AtLeastOne<PageFollowingArgs>; fn?: Fn<typeof User> }) {
|
||||
withFollowing(
|
||||
op?: { alias?: string; args?: AtLeastOne<PageFollowingArgs>; fn?: Fn<typeof User> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "following",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -176,8 +225,11 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
else User({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withActivities(op?: { args?: AtLeastOne<PageActivitiesArgs>; fn?: Fn<typeof ActivityUnion> }) {
|
||||
withActivities(
|
||||
op?: { alias?: string; args?: AtLeastOne<PageActivitiesArgs>; fn?: Fn<typeof ActivityUnion> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "activities",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -193,9 +245,14 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
withActivityReplies(
|
||||
op?: { args?: AtLeastOne<PageActivityRepliesArgs>; fn?: Fn<typeof ActivityReply> },
|
||||
op?: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<PageActivityRepliesArgs>
|
||||
fn?: Fn<typeof ActivityReply>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "activityReplies",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -205,16 +262,27 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
else ActivityReply({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withThreads(op?: { args?: AtLeastOne<PageThreadsArgs>; fn?: Fn<typeof Thread> }) {
|
||||
operation.set({ subField: "threads", level, hasSubField: true, variables: op?.args })
|
||||
withThreads(op?: { alias: string; args?: AtLeastOne<PageThreadsArgs>; fn?: Fn<typeof Thread> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "threads",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(Thread({ operation, level: level + 1 }))
|
||||
else Thread({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withThreadComments(
|
||||
op?: { args?: AtLeastOne<PageThreadCommentsArgs>; fn?: Fn<typeof ThreadComment> },
|
||||
op?: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<PageThreadCommentsArgs>
|
||||
fn?: Fn<typeof ThreadComment>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "threadComments",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -224,16 +292,27 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
else ThreadComment({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withReviews(op?: { args?: AtLeastOne<PageReviewsArgs>; fn?: Fn<typeof Review> }) {
|
||||
operation.set({ subField: "reviews", level, hasSubField: true, variables: op?.args })
|
||||
withReviews(op?: { alias: string; args?: AtLeastOne<PageReviewsArgs>; fn?: Fn<typeof Review> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "reviews",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(Review({ operation, level: level + 1 }))
|
||||
else Review({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withRecommendations(
|
||||
op?: { args?: AtLeastOne<PageRecommendationsArgs>; fn?: Fn<typeof Recommendation> },
|
||||
op?: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<PageRecommendationsArgs>
|
||||
fn?: Fn<typeof Recommendation>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "recommendations",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -243,8 +322,14 @@ export const Page = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
else Recommendation({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
},
|
||||
withLikes(op?: { args?: AtLeastOne<PageLikesArgs>; fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "likes", level, hasSubField: true, variables: op?.args })
|
||||
withLikes(op?: { alias: string; args?: AtLeastOne<PageLikesArgs>; fn?: Fn<typeof User> }) {
|
||||
operation.set({
|
||||
alias: op?.alias,
|
||||
subField: "likes",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
if (op?.fn) op.fn(User({ operation, level: level + 1 }))
|
||||
else User({ operation, level: level + 1 }).withId()
|
||||
return this
|
||||
|
|
|
@ -4,29 +4,29 @@ import { User } from "./User.ts"
|
|||
import { PageInfo } from "./Page.ts"
|
||||
|
||||
const RecommendationEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op?: { fn?: Fn<typeof Recommendation> }) {
|
||||
operation.set({ subField: "node", level, hasSubField: true })
|
||||
withNode(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()
|
||||
return this
|
||||
},
|
||||
})
|
||||
export const RecommendationConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { fn?: Fn<typeof RecommendationEdge> }) {
|
||||
operation.set({ subField: "edges", level, hasSubField: true })
|
||||
withEdges(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()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { fn?: Fn<typeof Recommendation> }) {
|
||||
operation.set({ subField: "nodes", level, hasSubField: true })
|
||||
withNodes(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()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ subField: "pageInfo", level, hasSubField: true })
|
||||
withPageInfo(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,37 +34,37 @@ export const RecommendationConnection = ({ operation, level }: Fields<OperationP
|
|||
|
||||
export const Recommendation = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the recommendation */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** Users rating of the recommendation */
|
||||
withRating() {
|
||||
operation.set({ subField: "rating", level })
|
||||
withRating(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "rating", level })
|
||||
return this
|
||||
},
|
||||
/** The rating of the recommendation by currently authenticated user */
|
||||
withUserRating() {
|
||||
operation.set({ subField: "userRating", level })
|
||||
withUserRating(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userRating", level })
|
||||
return this
|
||||
},
|
||||
/** The media the recommendation is from */
|
||||
withMedia(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "media", level, hasSubField: true })
|
||||
withMedia(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()
|
||||
return this
|
||||
},
|
||||
/** The recommended media */
|
||||
withMediaRecommendation(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "media", level, hasSubField: true })
|
||||
withMediaRecommendation(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()
|
||||
return this
|
||||
},
|
||||
/** The user that first created the recommendation */
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
|
|
|
@ -4,8 +4,8 @@ import { Media } from "./Media.ts"
|
|||
import { User } from "./User.ts"
|
||||
|
||||
const ReviewEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op?: { fn?: Fn<typeof Review> }) {
|
||||
operation.set({ subField: "node", level, hasSubField: true })
|
||||
withNode(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()
|
||||
return this
|
||||
|
@ -13,21 +13,21 @@ const ReviewEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
})
|
||||
|
||||
export const ReviewConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { fn?: Fn<typeof ReviewEdge> }) {
|
||||
operation.set({ subField: "edges", level, hasSubField: true })
|
||||
withEdges(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()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { fn?: Fn<typeof Review> }) {
|
||||
operation.set({ subField: "nodes", level, hasSubField: true })
|
||||
withNodes(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()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ subField: "pageInfo", level, hasSubField: true })
|
||||
withPageInfo(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,85 +35,85 @@ export const ReviewConnection = ({ operation, level }: Fields<OperationParser>)
|
|||
|
||||
export const Review = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the review */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the review's creator */
|
||||
withUserId() {
|
||||
operation.set({ subField: "userid", level })
|
||||
withUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userid", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the review's media */
|
||||
withMediaId() {
|
||||
operation.set({ subField: "mediaid", level })
|
||||
withMediaId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaid", level })
|
||||
return this
|
||||
},
|
||||
/** For which type of media the review is for */
|
||||
withMediaType() {
|
||||
operation.set({ subField: "mediatype", level })
|
||||
withMediaType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediatype", level })
|
||||
return this
|
||||
},
|
||||
/** A short summary of the review */
|
||||
withSummary() {
|
||||
operation.set({ subField: "summary", level })
|
||||
withSummary(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "summary", level })
|
||||
return this
|
||||
},
|
||||
/** The main review body text */
|
||||
withBody(op?: { args?: { asHtml: boolean } }) {
|
||||
operation.set({ subField: "body", level, variables: op?.args })
|
||||
withBody(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() {
|
||||
operation.set({ subField: "rating", level })
|
||||
withRating(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "rating", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of user ratings of the review */
|
||||
withRatingAmount() {
|
||||
operation.set({ subField: "ratingamount", level })
|
||||
withRatingAmount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "ratingamount", level })
|
||||
return this
|
||||
},
|
||||
/** The rating of the review by currently authenticated user */
|
||||
withUserRating() {
|
||||
operation.set({ subField: "userrating", level })
|
||||
withUserRating(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userrating", level })
|
||||
return this
|
||||
},
|
||||
/** The review score of the media */
|
||||
withScore() {
|
||||
operation.set({ subField: "score", level })
|
||||
withScore(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() {
|
||||
operation.set({ subField: "private", level })
|
||||
withPrivate(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "private", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the review page on the AniList website */
|
||||
withSiteUrl() {
|
||||
operation.set({ subField: "siteurl", level })
|
||||
withSiteUrl(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteurl", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the thread creation */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdat", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdat", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the thread last update */
|
||||
withUpdatedAt() {
|
||||
operation.set({ subField: "updatedat", level })
|
||||
withUpdatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedat", level })
|
||||
return this
|
||||
},
|
||||
/** The creator of the review */
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
},
|
||||
/** The media the review is of */
|
||||
withMedia(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "media", level, hasSubField: true })
|
||||
withMedia(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()
|
||||
return this
|
||||
|
|
|
@ -13,30 +13,65 @@ import { SiteTrendConnection } from "./SiteTrend.ts"
|
|||
|
||||
export const SiteStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withUsers(
|
||||
op: { args?: AtLeastOne<SiteStatisticsUsersArgs>; fn: Fn<typeof SiteTrendConnection> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsUsersArgs>
|
||||
fn: Fn<typeof SiteTrendConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({ subField: "users", level, hasSubField: true, variables: op?.args })
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "users",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
op.fn(SiteTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withAnime(
|
||||
op: { args?: AtLeastOne<SiteStatisticsAnimeArgs>; fn: Fn<typeof SiteTrendConnection> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsAnimeArgs>
|
||||
fn: Fn<typeof SiteTrendConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({ subField: "anime", level, hasSubField: true, variables: op?.args })
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "anime",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
op.fn(SiteTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withManga(
|
||||
op: { args?: AtLeastOne<SiteStatisticsMangaArgs>; fn: Fn<typeof SiteTrendConnection> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsMangaArgs>
|
||||
fn: Fn<typeof SiteTrendConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({ subField: "manga", level, hasSubField: true, variables: op?.args })
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "manga",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
op.fn(SiteTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withCharacters(
|
||||
op: { args?: AtLeastOne<SiteStatisticsCharactersArgs>; fn: Fn<typeof SiteTrendConnection> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsCharactersArgs>
|
||||
fn: Fn<typeof SiteTrendConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "characters",
|
||||
level,
|
||||
hasSubField: true,
|
||||
|
@ -46,23 +81,53 @@ export const SiteStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
return this
|
||||
},
|
||||
withStaff(
|
||||
op: { args?: AtLeastOne<SiteStatisticsStaffArgs>; fn: Fn<typeof SiteTrendConnection> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsStaffArgs>
|
||||
fn: Fn<typeof SiteTrendConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({ subField: "staff", level, hasSubField: true, variables: op?.args })
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "staff",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
op.fn(SiteTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withStudios(
|
||||
op: { args?: AtLeastOne<SiteStatisticsStudiosArgs>; fn: Fn<typeof SiteTrendConnection> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsStudiosArgs>
|
||||
fn: Fn<typeof SiteTrendConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({ subField: "studios", level, hasSubField: true, variables: op?.args })
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "studios",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
op.fn(SiteTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withReviews(
|
||||
op: { args?: AtLeastOne<SiteStatisticsReviewsArgs>; fn: Fn<typeof SiteTrendConnection> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<SiteStatisticsReviewsArgs>
|
||||
fn: Fn<typeof SiteTrendConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({ subField: "reviews", level, hasSubField: true, variables: op?.args })
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "reviews",
|
||||
level,
|
||||
hasSubField: true,
|
||||
variables: op?.args,
|
||||
})
|
||||
op.fn(SiteTrendConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
|
|
|
@ -3,44 +3,44 @@ import { PageInfo } from "./Page.ts"
|
|||
|
||||
const SiteTrend = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The day the data was recorded (timestamp) */
|
||||
withDate() {
|
||||
operation.set({ subField: "date", level })
|
||||
withDate(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "date", level })
|
||||
return this
|
||||
},
|
||||
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
/** The change from yesterday */
|
||||
withChange() {
|
||||
operation.set({ subField: "change", level })
|
||||
withChange(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "change", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const SiteTrendEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op: { fn: Fn<typeof SiteTrend> }) {
|
||||
operation.set({ subField: "node", level, hasSubField: true })
|
||||
withNode(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
|
||||
},
|
||||
})
|
||||
|
||||
export const SiteTrendConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op: { fn: Fn<typeof SiteTrendEdge> }) {
|
||||
operation.set({ subField: "edges", level, hasSubField: true })
|
||||
withEdges(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: { fn: Fn<typeof SiteTrend> }) {
|
||||
operation.set({ subField: "nodes", level, hasSubField: true })
|
||||
withNodes(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: { fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ subField: "pageInfo", level, hasSubField: true })
|
||||
withPageInfo(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,63 +13,63 @@ import { AtLeastOne } from "../types/AtLeastOne.ts"
|
|||
|
||||
export const StaffRoleType = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The voice actors of the character */
|
||||
withVoiceActor(op: { fn: Fn<typeof Staff> }) {
|
||||
operation.set({ subField: "voiceActor", level, hasSubField: true })
|
||||
withVoiceActor(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() {
|
||||
operation.set({ subField: "roleNotes", level })
|
||||
withRoleNotes(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() {
|
||||
operation.set({ subField: "dubGroup", level })
|
||||
withDubGroup(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "dubGroup", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const StaffEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op?: { fn?: Fn<typeof Staff> }) {
|
||||
operation.set({ subField: "node", level, hasSubField: true })
|
||||
withNode(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()
|
||||
return this
|
||||
},
|
||||
/** The id of the connection */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(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() {
|
||||
operation.set({ subField: "role", level })
|
||||
withRole(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() {
|
||||
operation.set({ subField: "favouriteOrder", level })
|
||||
withFavouriteOrder(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favouriteOrder", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const StaffConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { fn?: Fn<typeof StaffEdge> }) {
|
||||
operation.set({ subField: "edges", level, hasSubField: true })
|
||||
withEdges(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()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { fn?: Fn<typeof Staff> }) {
|
||||
operation.set({ subField: "nodes", level, hasSubField: true })
|
||||
withNodes(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()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ subField: "pageInfo", level, hasSubField: true })
|
||||
withPageInfo(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,97 +77,97 @@ export const StaffConnection = ({ operation, level }: Fields<OperationParser>) =
|
|||
|
||||
const StaffName = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The person's given name */
|
||||
withFirst() {
|
||||
operation.set({ subField: "first", level })
|
||||
withFirst(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "first", level })
|
||||
return this
|
||||
},
|
||||
/** The person's middle name */
|
||||
withMiddle() {
|
||||
operation.set({ subField: "middle", level })
|
||||
withMiddle(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "middle", level })
|
||||
return this
|
||||
},
|
||||
/** The person's surname */
|
||||
withLast() {
|
||||
operation.set({ subField: "last", level })
|
||||
withLast(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "last", level })
|
||||
return this
|
||||
},
|
||||
/** The person's first and last name */
|
||||
withFull() {
|
||||
operation.set({ subField: "full", level })
|
||||
withFull(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "full", level })
|
||||
return this
|
||||
},
|
||||
/** The person's full name in their native language */
|
||||
withNative() {
|
||||
operation.set({ subField: "native", level })
|
||||
withNative(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() {
|
||||
operation.set({ subField: "alternative", level })
|
||||
withAlternative(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() {
|
||||
operation.set({ subField: "userPreferred", level })
|
||||
withUserPreferred(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userPreferred", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const StaffImage = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The person's image of media at its largest size */
|
||||
withLarge() {
|
||||
operation.set({ subField: "large", level })
|
||||
withLarge(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "large", level })
|
||||
return this
|
||||
},
|
||||
/** The person's image of media at medium size */
|
||||
withMedium() {
|
||||
operation.set({ subField: "medium", level })
|
||||
withMedium(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "medium", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const Staff = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the staff member */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The names of the staff member */
|
||||
withName(op?: { fn?: Fn<typeof StaffName> }) {
|
||||
operation.set({ subField: "name", level, hasSubField: true })
|
||||
withName(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()
|
||||
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() {
|
||||
operation.set({ subField: "languageV2", level })
|
||||
withLanguageV2(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "languageV2", level })
|
||||
return this
|
||||
},
|
||||
/** The staff images */
|
||||
withImage(op?: { fn?: Fn<typeof StaffImage> }) {
|
||||
operation.set({ subField: "image", level, hasSubField: true })
|
||||
withImage(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()
|
||||
return this
|
||||
},
|
||||
/** A general description of the staff member */
|
||||
withDescription(op?: { args?: { asHtml: boolean } }) {
|
||||
operation.set({ subField: "description", level, variables: op?.args })
|
||||
withDescription(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() {
|
||||
operation.set({ subField: "primaryOccupations", level })
|
||||
withPrimaryOccupations(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() {
|
||||
operation.set({ subField: "gender", level })
|
||||
withGender(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "gender", level })
|
||||
return this
|
||||
},
|
||||
withDateOfBirth(op?: { fn?: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({ subField: "dateOfBirth", level, hasSubField: true })
|
||||
withDateOfBirth(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 })
|
||||
|
@ -177,8 +177,8 @@ export const Staff = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
}
|
||||
return this
|
||||
},
|
||||
withDateOfDeath(op?: { fn?: Fn<typeof FuzzyDate> }) {
|
||||
operation.set({ subField: "dateOfDeath", level, hasSubField: true })
|
||||
withDateOfDeath(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 })
|
||||
|
@ -189,45 +189,50 @@ export const Staff = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** The person's age in years */
|
||||
withAge() {
|
||||
operation.set({ subField: "age", level })
|
||||
withAge(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() {
|
||||
operation.set({ subField: "yearsActive", level })
|
||||
withYearsActive(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "yearsActive", level })
|
||||
return this
|
||||
},
|
||||
/** The persons birthplace or hometown */
|
||||
withHomeTown() {
|
||||
operation.set({ subField: "homeTown", level })
|
||||
withHomeTown(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "homeTown", level })
|
||||
return this
|
||||
},
|
||||
/** The persons blood type */
|
||||
withBloodType() {
|
||||
operation.set({ subField: "bloodType", level })
|
||||
withBloodType(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() {
|
||||
operation.set({ subField: "isFavourite", level })
|
||||
withIsFavourite(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() {
|
||||
operation.set({ subField: "isFavouriteBlocked", level })
|
||||
withIsFavouriteBlocked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavouriteBlocked", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the staff page on the AniList website */
|
||||
withSiteUrl() {
|
||||
operation.set({ subField: "siteUrl", level })
|
||||
withSiteUrl(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** Media where the staff member has a production role */
|
||||
withStaffMedia(
|
||||
op: { args?: AtLeastOne<StaffStaffMediaArgs> | undefined; fn: Fn<typeof MediaConnection> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<StaffStaffMediaArgs> | undefined
|
||||
fn: Fn<typeof MediaConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "staffMedia",
|
||||
level,
|
||||
variables: op?.args,
|
||||
|
@ -238,9 +243,14 @@ export const Staff = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
},
|
||||
/** Characters voiced by the actor */
|
||||
withCharacters(
|
||||
op: { args?: AtLeastOne<StaffCharactersArgs> | undefined; fn: Fn<typeof CharacterConnection> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<StaffCharactersArgs> | undefined
|
||||
fn: Fn<typeof CharacterConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "characters",
|
||||
level,
|
||||
variables: op?.args,
|
||||
|
@ -251,9 +261,14 @@ export const Staff = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
},
|
||||
/** Media the actor voiced characters in. (Same data as characters with media as node instead of characters) */
|
||||
withCharacterMedia(
|
||||
op: { args?: AtLeastOne<StaffCharacterMediaArgs>; fn: Fn<typeof MediaConnection> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: AtLeastOne<StaffCharacterMediaArgs>
|
||||
fn: Fn<typeof MediaConnection>
|
||||
},
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "characterMedia",
|
||||
level,
|
||||
variables: op?.args,
|
||||
|
@ -263,37 +278,37 @@ export const Staff = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
return this
|
||||
},
|
||||
/** Staff member that the submission is referencing */
|
||||
withStaff(op?: { fn?: Fn<typeof Staff> }) {
|
||||
operation.set({ subField: "staff", level, hasSubField: true })
|
||||
withStaff(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()
|
||||
return this
|
||||
},
|
||||
/** Submitter for the submission */
|
||||
withSubmitter(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "submitter", level, hasSubField: true })
|
||||
withSubmitter(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()
|
||||
return this
|
||||
},
|
||||
/** Status of the submission */
|
||||
withSubmissionStatus() {
|
||||
operation.set({ subField: "submissionStatus", level })
|
||||
withSubmissionStatus(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "submissionStatus", level })
|
||||
return this
|
||||
},
|
||||
/** Inner details of submission status */
|
||||
withSubmissionNotes() {
|
||||
operation.set({ subField: "submissionNotes", level })
|
||||
withSubmissionNotes(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() {
|
||||
operation.set({ subField: "favourites", level })
|
||||
withFavourites(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favourites", level })
|
||||
return this
|
||||
},
|
||||
/** Notes for site moderators */
|
||||
withModNotes() {
|
||||
operation.set({ subField: "modNotes", level })
|
||||
withModNotes(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "modNotes", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -5,45 +5,45 @@ import { MediaConnection } from "./Media.ts"
|
|||
import { AtLeastOne } from "../types/AtLeastOne.ts"
|
||||
|
||||
const StudioEdge = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withNode(op?: { fn?: Fn<typeof Studio> }) {
|
||||
operation.set({ subField: "node", level, hasSubField: true })
|
||||
withNode(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()
|
||||
return this
|
||||
},
|
||||
/** The id of the connection */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(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() {
|
||||
operation.set({ subField: "isMain", level })
|
||||
withIsMain(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() {
|
||||
operation.set({ subField: "favouriteOrder", level })
|
||||
withFavouriteOrder(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favouriteOrder", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const StudioConnection = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEdges(op?: { fn?: Fn<typeof StudioEdge> }) {
|
||||
operation.set({ subField: "edges", level, hasSubField: true })
|
||||
withEdges(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()
|
||||
return this
|
||||
},
|
||||
withNodes(op?: { fn?: Fn<typeof Studio> }) {
|
||||
operation.set({ subField: "nodes", level, hasSubField: true })
|
||||
withNodes(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()
|
||||
return this
|
||||
},
|
||||
/** The pagination information */
|
||||
withPageInfo(op: { fn: Fn<typeof PageInfo> }) {
|
||||
operation.set({ subField: "pageInfo", level, hasSubField: true })
|
||||
withPageInfo(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,39 +51,47 @@ export const StudioConnection = ({ operation, level }: Fields<OperationParser>)
|
|||
|
||||
export const Studio = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the studio */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The name of the studio */
|
||||
withName() {
|
||||
operation.set({ subField: "name", level })
|
||||
withName(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() {
|
||||
operation.set({ subField: "isAnimationStudio", level })
|
||||
withIsAnimationStudio(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isAnimationStudio", level })
|
||||
return this
|
||||
},
|
||||
/** The media the studio has worked on */
|
||||
withMedia(op: { args?: AtLeastOne<StudioMediaArgs>; fn: Fn<typeof MediaConnection> }) {
|
||||
operation.set({ subField: "media", level, variables: op?.args, hasSubField: true })
|
||||
withMedia(
|
||||
op: { alias?: string; args?: AtLeastOne<StudioMediaArgs>; fn: Fn<typeof MediaConnection> },
|
||||
) {
|
||||
operation.set({
|
||||
alias: op.alias,
|
||||
subField: "media",
|
||||
level,
|
||||
variables: op?.args,
|
||||
hasSubField: true,
|
||||
})
|
||||
op.fn(MediaConnection({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The url for the studio page on the AniList website */
|
||||
withSiteUrl() {
|
||||
operation.set({ subField: "siteUrl", level })
|
||||
withSiteUrl(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() {
|
||||
operation.set({ subField: "isFavourite", level })
|
||||
withIsFavourite(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFavourite", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of user's who have favourited the studio */
|
||||
withFavourites() {
|
||||
operation.set({ subField: "favourites", level })
|
||||
withFavourites(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "favourites", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -4,133 +4,133 @@ import { User } from "./User.ts"
|
|||
|
||||
const ThreadCategory = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the category */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The name of the category */
|
||||
withName() {
|
||||
operation.set({ subField: "name", level })
|
||||
withName(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const Thread = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the thread */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The title of the thread */
|
||||
withTitle() {
|
||||
operation.set({ subField: "title", level })
|
||||
withTitle(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "title", level })
|
||||
return this
|
||||
},
|
||||
/** The text body of the thread (Markdown) */
|
||||
withBody(op?: { args?: { asHtml: boolean } }) {
|
||||
operation.set({ subField: "body", level, variables: op?.args })
|
||||
withBody(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() {
|
||||
operation.set({ subField: "userId", level })
|
||||
withUserId(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() {
|
||||
operation.set({ subField: "replyUserId", level })
|
||||
withReplyUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "replyUserId", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the most recent comment on the thread */
|
||||
withReplyCommentId() {
|
||||
operation.set({ subField: "replyCommentId", level })
|
||||
withReplyCommentId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "replyCommentId", level })
|
||||
return this
|
||||
},
|
||||
/** The number of comments on the thread */
|
||||
withReplyCount() {
|
||||
operation.set({ subField: "replyCount", level })
|
||||
withReplyCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "replyCount", level })
|
||||
return this
|
||||
},
|
||||
/** The number of times users have viewed the thread */
|
||||
withViewCount() {
|
||||
operation.set({ subField: "viewCount", level })
|
||||
withViewCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "viewCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the thread is locked and can receive comments */
|
||||
withIsLocked() {
|
||||
operation.set({ subField: "isLocked", level })
|
||||
withIsLocked(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() {
|
||||
operation.set({ subField: "isSticky", level })
|
||||
withIsSticky(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isSticky", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user is subscribed to the thread */
|
||||
withIsSubscribed() {
|
||||
operation.set({ subField: "isSubscribed", level })
|
||||
withIsSubscribed(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isSubscribed", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the thread has */
|
||||
withLikeCount() {
|
||||
operation.set({ subField: "likeCount", level })
|
||||
withLikeCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the thread */
|
||||
withIsLiked() {
|
||||
operation.set({ subField: "isLiked", level })
|
||||
withIsLiked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLiked", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the last reply */
|
||||
withRepliedAt() {
|
||||
operation.set({ subField: "repliedAt", level })
|
||||
withRepliedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "repliedAt", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the thread creation */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the thread last update */
|
||||
withUpdatedAt() {
|
||||
operation.set({ subField: "updatedAt", level })
|
||||
withUpdatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedAt", level })
|
||||
return this
|
||||
},
|
||||
/** The owner of the thread */
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
},
|
||||
/** The user to last reply to the thread */
|
||||
withReplyUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "replayUser", level, hasSubField: true })
|
||||
withReplyUser(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()
|
||||
return this
|
||||
},
|
||||
/** The users who liked the thread */
|
||||
withLikes(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "likes", level, hasSubField: true })
|
||||
withLikes(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()
|
||||
return this
|
||||
},
|
||||
/** The url for the thread page on the AniList website */
|
||||
withSiteUrl() {
|
||||
operation.set({ subField: "siteUrl", level })
|
||||
withSiteUrl(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** The categories of the thread */
|
||||
withCategories(op: { fn: Fn<typeof ThreadCategory> }) {
|
||||
operation.set({ subField: "categories", level })
|
||||
withCategories(op: { alias?: string; fn: Fn<typeof ThreadCategory> }) {
|
||||
operation.set({ alias: op.alias, subField: "categories", level })
|
||||
op.fn(ThreadCategory({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/** The media categories of the thread */
|
||||
withMediaCategories(op?: { fn?: Fn<typeof Media> }) {
|
||||
operation.set({ subField: "mediaCategories", level, hasSubField: true })
|
||||
withMediaCategories(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()
|
||||
return this
|
||||
|
|
|
@ -4,79 +4,79 @@ import { Fields, Fn, OperationParser } from "../types/Anilist.ts"
|
|||
|
||||
export const ThreadComment = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the comment */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the comment's owner */
|
||||
withUserId() {
|
||||
operation.set({ subField: "userId", level })
|
||||
withUserId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The id of thread the comment belongs to */
|
||||
withThreadId() {
|
||||
operation.set({ subField: "threadId", level })
|
||||
withThreadId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "threadId", level })
|
||||
return this
|
||||
},
|
||||
/** The text content of the comment (Markdown) */
|
||||
withComment(op?: { args?: { asHtml: boolean } }) {
|
||||
operation.set({ subField: "comment", level, variables: op?.args })
|
||||
withComment(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() {
|
||||
operation.set({ subField: "likeCount", level })
|
||||
withLikeCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the comment */
|
||||
withIsLiked() {
|
||||
operation.set({ subField: "isLiked", level })
|
||||
withIsLiked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLiked", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the comment page on the AniList website */
|
||||
withSiteUrl() {
|
||||
operation.set({ subField: "siteUrl", level })
|
||||
withSiteUrl(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the comments creation */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The time of the comments last update */
|
||||
withUpdatedAt() {
|
||||
operation.set({ subField: "updatedAt", level })
|
||||
withUpdatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedAt", level })
|
||||
return this
|
||||
},
|
||||
/** The thread the comment belongs to */
|
||||
withThread(op?: { fn?: Fn<typeof Thread> }) {
|
||||
operation.set({ subField: "thread", level, hasSubField: true })
|
||||
withThread(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()
|
||||
return this
|
||||
},
|
||||
/** The user who created the comment */
|
||||
withUser(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "user", level, hasSubField: true })
|
||||
withUser(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()
|
||||
return this
|
||||
},
|
||||
/** The users who liked the comment */
|
||||
withLikes(op?: { fn?: Fn<typeof User> }) {
|
||||
operation.set({ subField: "likes", level, hasSubField: true })
|
||||
withLikes(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()
|
||||
return this
|
||||
},
|
||||
/** The comment's child reply comments */
|
||||
withChildComments() {
|
||||
operation.set({ subField: "childComments", level })
|
||||
withChildComments(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() {
|
||||
operation.set({ subField: "isLocked", level })
|
||||
withIsLocked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
|
|
@ -5,108 +5,104 @@ import { MediaListOptions } from "./MediaList.ts"
|
|||
import { UserStatisticTypes } from "./UserStatistics.ts"
|
||||
|
||||
const NotificationOption = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withEnabled() {
|
||||
operation.set({ subField: "enabled", level })
|
||||
withEnabled(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "enabled", level })
|
||||
return this
|
||||
},
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ListActivityOption = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withDisabled() {
|
||||
operation.set({ subField: "disabled", level })
|
||||
withDisabled(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "disabled", level })
|
||||
return this
|
||||
},
|
||||
withType() {
|
||||
operation.set({ subField: "type", level })
|
||||
withType(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "type", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const UserPreviousName = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** A previous name of the user. */
|
||||
withName() {
|
||||
operation.set({ subField: "name", level })
|
||||
withName(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
/** When the user first changed from this name. */
|
||||
withCreatedAt() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** When the user most recently changed from this name. */
|
||||
withUpdatedAt() {
|
||||
operation.set({ subField: "updatedAt", level })
|
||||
withUpdatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedAt", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const UserOptions = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The language the user wants to see media titles in */
|
||||
withTitleLanguage() {
|
||||
operation.set({ subField: "titleLanguage", level })
|
||||
withTitleLanguage(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "titleLanguage", level })
|
||||
return this
|
||||
},
|
||||
|
||||
/** Whether the user has enabled viewing of 18+ content */
|
||||
withDisplayAdultContent() {
|
||||
operation.set({ subField: "displayAdultContent", level })
|
||||
withDisplayAdultContent(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() {
|
||||
operation.set({ subField: "airingNotifications", level })
|
||||
withAiringNotifications(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "airingNotifications", level })
|
||||
return this
|
||||
},
|
||||
|
||||
/** Profile highlight color (blue, purple, pink, orange, red, green, gray) */
|
||||
withProfileColor() {
|
||||
operation.set({ subField: "profileColor", level })
|
||||
withProfileColor(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "profileColor", level })
|
||||
return this
|
||||
},
|
||||
|
||||
/** Notification options */
|
||||
withNotificationOptions(op: { fn: Fn<typeof NotificationOption> }) {
|
||||
operation.set({ subField: "notificationOptions", level })
|
||||
withNotificationOptions(op: { alias?: string; fn: Fn<typeof NotificationOption> }) {
|
||||
operation.set({ alias: op.alias, subField: "notificationOptions", level })
|
||||
op.fn(NotificationOption({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
|
||||
/** The user's timezone offset (Auth user only) */
|
||||
withTimezone() {
|
||||
operation.set({ subField: "timezone", level })
|
||||
withTimezone(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() {
|
||||
operation.set({ subField: "activityMergeTime", level })
|
||||
withActivityMergeTime(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() {
|
||||
operation.set({ subField: "staffNameLanguage", level })
|
||||
withStaffNameLanguage(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "staffNameLanguage", level })
|
||||
return this
|
||||
},
|
||||
|
||||
/** Whether the user only allow messages from users they follow */
|
||||
withRestrictMessagesToFollowing() {
|
||||
operation.set({ subField: "restrictMessagesToFollowing", level })
|
||||
withRestrictMessagesToFollowing(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: { fn: Fn<typeof ListActivityOption> }) {
|
||||
operation.set({
|
||||
subField: "disabledListActivity",
|
||||
level,
|
||||
hasSubField: true,
|
||||
})
|
||||
withDisabledListActivity(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
|
||||
},
|
||||
|
@ -114,130 +110,126 @@ export const UserOptions = ({ operation, level }: Fields<OperationParser>) => ({
|
|||
|
||||
export const UserAvatar = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The avatar of user at its largest size */
|
||||
withLarge() {
|
||||
operation.set({ subField: "large", level })
|
||||
withLarge(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "large", level })
|
||||
return this
|
||||
},
|
||||
/** The avatar of user at medium size */
|
||||
withMedium() {
|
||||
operation.set({ subField: "medium", level })
|
||||
withMedium(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "medium", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const User = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
/** The id of the user */
|
||||
withId() {
|
||||
operation.set({ subField: "id", level })
|
||||
withId(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The name of the user */
|
||||
withName() {
|
||||
operation.set({ subField: "name", level })
|
||||
withName(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "name", level })
|
||||
return this
|
||||
},
|
||||
/** The bio written by user (Markdown) */
|
||||
withAbout(op?: { args?: { asHtml: boolean } }) {
|
||||
operation.set({ subField: "about", level, variables: op?.args })
|
||||
withAbout(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?: { fn?: Fn<typeof UserAvatar> }) {
|
||||
operation.set({ subField: "avatar", level, hasSubField: true })
|
||||
withAvatar(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()
|
||||
return this
|
||||
},
|
||||
/** The user's banner images */
|
||||
withBannerImage() {
|
||||
operation.set({ subField: "bannerImage", level })
|
||||
withBannerImage(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "bannerImage", level })
|
||||
return this
|
||||
},
|
||||
/** If the authenticated user if following this user */
|
||||
withIsFollowing() {
|
||||
operation.set({ subField: "isFollowing", level })
|
||||
withIsFollowing(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFollowing", level })
|
||||
return this
|
||||
},
|
||||
/** If this user if following the authenticated user */
|
||||
withIsFollower() {
|
||||
operation.set({ subField: "isFollower", level })
|
||||
withIsFollower(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isFollower", level })
|
||||
return this
|
||||
},
|
||||
/** If the user is blocked by the authenticated user */
|
||||
withIsBlocked() {
|
||||
operation.set({ subField: "isBlocked", level })
|
||||
withIsBlocked(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "isBlocked", level })
|
||||
return this
|
||||
},
|
||||
withBans() {
|
||||
operation.set({ subField: "bans", level })
|
||||
withBans(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "bans", level })
|
||||
return this
|
||||
},
|
||||
/* The user's general options */
|
||||
withOptions(op: { fn: Fn<typeof UserOptions> }) {
|
||||
operation.set({ subField: "options", level })
|
||||
withOptions(op: { alias?: string; fn: Fn<typeof UserOptions> }) {
|
||||
operation.set({ alias: op.alias, subField: "options", level })
|
||||
op.fn(UserOptions({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/* The user's media list options */
|
||||
withMediaListOptions(op: { fn: Fn<typeof MediaListOptions> }) {
|
||||
operation.set({ subField: "mediaListOptions", level })
|
||||
withMediaListOptions(op: { alias?: string; fn: Fn<typeof MediaListOptions> }) {
|
||||
operation.set({ alias: op.alias, subField: "mediaListOptions", level })
|
||||
op.fn(MediaListOptions({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/* The users favourites */
|
||||
withFavourites(op: { args?: UserFavouritesArgs; fn: Fn<typeof Favourites> }) {
|
||||
operation.set({ subField: "favourites", level, variables: op?.args })
|
||||
withFavourites(op: { alias?: string; args?: UserFavouritesArgs; fn: Fn<typeof Favourites> }) {
|
||||
operation.set({ alias: op.alias, subField: "favourites", level, variables: op?.args })
|
||||
op.fn(Favourites({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
/* The users anime & manga list statistics */
|
||||
withStatistics(op: { fn: Fn<typeof UserStatisticTypes> }) {
|
||||
operation.set({ subField: "statistics", level, hasSubField: true })
|
||||
withStatistics(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() {
|
||||
operation.set({ subField: "unreadNotificationCount", level })
|
||||
withUnreadNotificationCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "unreadNotificationCount", level })
|
||||
return this
|
||||
},
|
||||
/* The url for the user page on the AniList website */
|
||||
withSiteUrl() {
|
||||
operation.set({ subField: "siteUrl", level })
|
||||
withSiteUrl(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/* The donation tier of the user */
|
||||
withDonatorTier() {
|
||||
operation.set({ subField: "donatorTier", level })
|
||||
withDonatorTier(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "donatorTier", level })
|
||||
return this
|
||||
},
|
||||
/* Custom donation badge text */
|
||||
withDonatorBadge() {
|
||||
operation.set({ subField: "donatorBadge", level })
|
||||
withDonatorBadge(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() {
|
||||
operation.set({ subField: "moderatorRoles", level })
|
||||
withModeratorRoles(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() {
|
||||
operation.set({ subField: "createdAt", level })
|
||||
withCreatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/* When the user's data was last updated */
|
||||
withUpdatedAt() {
|
||||
operation.set({ subField: "updatedAt", level })
|
||||
withUpdatedAt(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "updatedAt", level })
|
||||
return this
|
||||
},
|
||||
/* The user's previously used names. */
|
||||
withPreviousNames(op?: { fn?: Fn<typeof UserPreviousName> }) {
|
||||
operation.set({
|
||||
subField: "previousNames",
|
||||
level,
|
||||
hasSubField: true,
|
||||
})
|
||||
withPreviousNames(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()
|
||||
return this
|
||||
|
|
|
@ -17,304 +17,304 @@ import { Staff } from "./Staff.ts"
|
|||
import { Studio } from "./Studio.ts"
|
||||
|
||||
const UserFormatStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds() {
|
||||
operation.set({ subField: "mediaIds", level })
|
||||
withMediaIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
withFormat() {
|
||||
operation.set({ subField: "format", level })
|
||||
withFormat(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "format", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserStatusStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds() {
|
||||
operation.set({ subField: "mediaIds", level })
|
||||
withMediaIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
status() {
|
||||
operation.set({ subField: "status", level })
|
||||
status(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "status", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserScoreStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds() {
|
||||
operation.set({ subField: "mediaIds", level })
|
||||
withMediaIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
score() {
|
||||
operation.set({ subField: "score", level })
|
||||
score(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "score", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserLengthStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds() {
|
||||
operation.set({ subField: "mediaIds", level })
|
||||
withMediaIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
length() {
|
||||
operation.set({ subField: "length", level })
|
||||
length(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "length", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserReleaseYearStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds() {
|
||||
operation.set({ subField: "mediaIds", level })
|
||||
withMediaIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
releaseYear() {
|
||||
operation.set({ subField: "releaseYear", level })
|
||||
releaseYear(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "releaseYear", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserStartYearStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds() {
|
||||
operation.set({ subField: "mediaIds", level })
|
||||
withMediaIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
startYear() {
|
||||
operation.set({ subField: "startYear", level })
|
||||
startYear(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "startYear", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserGenreStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds() {
|
||||
operation.set({ subField: "mediaIds", level })
|
||||
withMediaIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
genre() {
|
||||
operation.set({ subField: "genre", level })
|
||||
genre(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "genre", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserTagStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds() {
|
||||
operation.set({ subField: "mediaIds", level })
|
||||
withMediaIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
tag() {
|
||||
operation.set({ subField: "tag", level })
|
||||
tag(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "tag", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserCountryStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds() {
|
||||
operation.set({ subField: "mediaIds", level })
|
||||
withMediaIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
country() {
|
||||
operation.set({ subField: "country", level })
|
||||
country(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "country", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserVoiceActorStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds() {
|
||||
operation.set({ subField: "mediaIds", level })
|
||||
withMediaIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
withVoiceActor(op?: { fn?: Fn<typeof Staff> }) {
|
||||
operation.set({ subField: "voiceActor", level, hasSubField: true })
|
||||
withVoiceActor(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()
|
||||
return this
|
||||
},
|
||||
withCharacterIds() {
|
||||
operation.set({ subField: "characterIds", level })
|
||||
withCharacterIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "characterIds", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const UserStaffStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds() {
|
||||
operation.set({ subField: "mediaIds", level })
|
||||
withMediaIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
withStaff(op?: { fn?: Fn<typeof Staff> }) {
|
||||
operation.set({ subField: "staff", level, hasSubField: true })
|
||||
withStaff(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()
|
||||
return this
|
||||
|
@ -322,28 +322,28 @@ const UserStaffStatistics = ({ operation, level }: Fields<OperationParser>) => (
|
|||
})
|
||||
|
||||
const UserStudioStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withMediaIds() {
|
||||
operation.set({ subField: "mediaIds", level })
|
||||
withMediaIds(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "mediaIds", level })
|
||||
return this
|
||||
},
|
||||
withStudio(op?: { fn?: Fn<typeof Studio> }) {
|
||||
operation.set({ subField: "studio", level, hasSubField: true })
|
||||
withStudio(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()
|
||||
return this
|
||||
|
@ -351,112 +351,144 @@ const UserStudioStatistics = ({ operation, level }: Fields<OperationParser>) =>
|
|||
})
|
||||
|
||||
export const UserStatistics = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withCount() {
|
||||
operation.set({ subField: "count", level })
|
||||
withCount(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "count", level })
|
||||
return this
|
||||
},
|
||||
withMeanScore() {
|
||||
operation.set({ subField: "meanScore", level })
|
||||
withMeanScore(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "meanScore", level })
|
||||
return this
|
||||
},
|
||||
withStandardDeviation() {
|
||||
operation.set({ subField: "standardDeviation", level })
|
||||
withStandardDeviation(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "standardDeviation", level })
|
||||
return this
|
||||
},
|
||||
withMinutesWatched() {
|
||||
operation.set({ subField: "minutesWatched", level })
|
||||
withMinutesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "minutesWatched", level })
|
||||
return this
|
||||
},
|
||||
withEpisodesWatched() {
|
||||
operation.set({ subField: "episodesWatched", level })
|
||||
withEpisodesWatched(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "episodesWatched", level })
|
||||
return this
|
||||
},
|
||||
withChaptersRead() {
|
||||
operation.set({ subField: "chaptersRead", level })
|
||||
withChaptersRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "chaptersRead", level })
|
||||
return this
|
||||
},
|
||||
withVolumesRead() {
|
||||
operation.set({ subField: "volumesRead", level })
|
||||
withVolumesRead(op?: { alias: string }) {
|
||||
operation.set({ alias: op?.alias, subField: "volumesRead", level })
|
||||
return this
|
||||
},
|
||||
withFormats(
|
||||
op: { args?: UserStatisticsFormatsArgs; fn: Fn<typeof UserFormatStatistics> },
|
||||
op: { alias?: string; args?: UserStatisticsFormatsArgs; fn: Fn<typeof UserFormatStatistics> },
|
||||
) {
|
||||
operation.set({ subField: "formats", level, hasSubField: true })
|
||||
operation.set({ alias: op.alias, subField: "formats", level, hasSubField: true })
|
||||
op.fn(UserFormatStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withStatuses(op: { args?: UserStatisticsStatusesArgs; fn: Fn<typeof UserStatusStatistics> }) {
|
||||
operation.set({ subField: "statuses", level, hasSubField: true })
|
||||
withStatuses(
|
||||
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(op: { args?: UserStatisticsScoresArgs; fn: Fn<typeof UserScoreStatistics> }) {
|
||||
operation.set({ subField: "scores", level, hasSubField: true })
|
||||
withScores(
|
||||
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(op: { args?: UserStatisticsLengthsArgs; fn: Fn<typeof UserLengthStatistics> }) {
|
||||
operation.set({ subField: "lengths", level, hasSubField: true })
|
||||
withLengths(
|
||||
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(
|
||||
op: { args?: UserStatisticsReleaseYearsArgs; fn: Fn<typeof UserReleaseYearStatistics> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: UserStatisticsReleaseYearsArgs
|
||||
fn: Fn<typeof UserReleaseYearStatistics>
|
||||
},
|
||||
) {
|
||||
operation.set({ subField: "releaseYears", level, hasSubField: true })
|
||||
operation.set({ alias: op.alias, subField: "releaseYears", level, hasSubField: true })
|
||||
op.fn(UserReleaseYearStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withStartYears(
|
||||
op: { args?: UserStatisticsStartYearsArgs; fn: Fn<typeof UserStartYearStatistics> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: UserStatisticsStartYearsArgs
|
||||
fn: Fn<typeof UserStartYearStatistics>
|
||||
},
|
||||
) {
|
||||
operation.set({ subField: "startYears", level, hasSubField: true })
|
||||
operation.set({ alias: op.alias, subField: "startYears", level, hasSubField: true })
|
||||
op.fn(UserStartYearStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withGenres(op: { args?: UserStatisticsGenresArgs; fn: Fn<typeof UserGenreStatistics> }) {
|
||||
operation.set({ subField: "genres", level, hasSubField: true })
|
||||
withGenres(
|
||||
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(op: { args?: UserStatisticsTagsArgs; fn: Fn<typeof UserTagStatistics> }) {
|
||||
operation.set({ subField: "tags", level, hasSubField: true })
|
||||
withTags(
|
||||
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(op: { args?: UserStatisticsCountriesArgs; fn: Fn<typeof UserCountryStatistics> }) {
|
||||
operation.set({ subField: "countries", level, hasSubField: true })
|
||||
withCountries(
|
||||
op: {
|
||||
alias?: string
|
||||
args?: UserStatisticsCountriesArgs
|
||||
fn: Fn<typeof UserCountryStatistics>
|
||||
},
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "countries", level, hasSubField: true })
|
||||
op.fn(UserCountryStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withVoiceActors(
|
||||
op: { args?: UserStatisticsVoiceActorsArgs; fn: Fn<typeof UserVoiceActorStatistics> },
|
||||
op: {
|
||||
alias?: string
|
||||
args?: UserStatisticsVoiceActorsArgs
|
||||
fn: Fn<typeof UserVoiceActorStatistics>
|
||||
},
|
||||
) {
|
||||
operation.set({ subField: "voiceActors", level, hasSubField: true })
|
||||
operation.set({ alias: op.alias, subField: "voiceActors", level, hasSubField: true })
|
||||
op.fn(UserVoiceActorStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
withStaff(op: { args?: UserStatisticsStaffArgs; fn: Fn<typeof UserStaffStatistics> }) {
|
||||
operation.set({ subField: "staff", level, hasSubField: true })
|
||||
withStaff(
|
||||
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(op: { args?: UserStatisticsStudiosArgs; fn: Fn<typeof UserStudioStatistics> }) {
|
||||
operation.set({ subField: "studios", level, hasSubField: true })
|
||||
withStudios(
|
||||
op: { alias?: string; args?: UserStatisticsStudiosArgs; fn: Fn<typeof UserStudioStatistics> },
|
||||
) {
|
||||
operation.set({ alias: op.alias, subField: "studios", level, hasSubField: true })
|
||||
op.fn(UserStudioStatistics({ operation, level: level + 1 }))
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const UserStatisticTypes = ({ operation, level }: Fields<OperationParser>) => ({
|
||||
withAnime(op: { fn: Fn<typeof UserStatistics> }) {
|
||||
operation.set({ subField: "anime", level, hasSubField: true })
|
||||
withAnime(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: { fn: Fn<typeof UserStatistics> }) {
|
||||
operation.set({ subField: "manga", level, hasSubField: true })
|
||||
withManga(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