add union fields on mutation and query fields
This commit is contained in:
parent
5d1c1bb92d
commit
ed7d209ea9
130
src/anilist.ts
130
src/anilist.ts
|
@ -8,18 +8,25 @@ import {
|
|||
MutationDeleteThreadCommentArgs,
|
||||
MutationRateReviewArgs,
|
||||
MutationSaveActivityReplyArgs,
|
||||
MutationSaveListActivityArgs,
|
||||
MutationSaveMediaListEntryArgs,
|
||||
MutationSaveMessageActivityArgs,
|
||||
MutationSaveRecommendationArgs,
|
||||
MutationSaveReviewArgs,
|
||||
MutationSaveTextActivityArgs,
|
||||
MutationSaveThreadArgs,
|
||||
MutationSaveThreadCommentArgs,
|
||||
MutationToggleActivityPinArgs,
|
||||
MutationToggleActivitySubscriptionArgs,
|
||||
MutationToggleFavouriteArgs,
|
||||
MutationToggleFollowArgs,
|
||||
MutationToggleLikeArgs,
|
||||
MutationToggleLikeV2Args,
|
||||
MutationToggleThreadSubscriptionArgs,
|
||||
MutationUpdateFavouriteOrderArgs,
|
||||
MutationUpdateMediaListEntriesArgs,
|
||||
MutationUpdateUserArgs,
|
||||
QueryActivityArgs,
|
||||
QueryActivityReplyArgs,
|
||||
QueryAiringScheduleArgs,
|
||||
QueryCharacterArgs,
|
||||
|
@ -33,6 +40,7 @@ import {
|
|||
QueryMediaListCollectionArgs,
|
||||
QueryMediaTagCollectionArgs,
|
||||
QueryMediaTrendArgs,
|
||||
QueryNotificationArgs,
|
||||
QueryRecommendationArgs,
|
||||
QueryReviewArgs,
|
||||
QueryStaffArgs,
|
||||
|
@ -65,6 +73,14 @@ import { ExternalLinkSourceCollection } from "./queries/ExternalLinkSourceCollec
|
|||
import { AuthorizationError } from "./utils/AuthorizationError.ts"
|
||||
import { ResponseError } from "./utils/ResponseError.ts"
|
||||
import { Favourites } from "./queries/Favourites.ts"
|
||||
import {
|
||||
ActivityUnion,
|
||||
ListActivity,
|
||||
MessageActivity,
|
||||
TextActivity,
|
||||
} from "./queries/ActivityUnion.ts"
|
||||
import { LikeableUnion } from "./queries/LikeableUnion.ts"
|
||||
import { NotificationUnion } from "./queries/NotificationUnion.ts"
|
||||
|
||||
const rewriteVarValues = (
|
||||
variable: PropertyKey | unknown | (PropertyKey | unknown)[],
|
||||
|
@ -425,8 +441,17 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Notification query */
|
||||
Notification() {
|
||||
throw "To be Implemented"
|
||||
Notification(args: QueryNotificationArgs, fn: Fn<typeof NotificationUnion>) {
|
||||
operation = operation.set({
|
||||
subField: "Notification",
|
||||
variables: args,
|
||||
hasSubField: true,
|
||||
level: 1,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(NotificationUnion({ query: tmpQuery = [operation], level: 2 }))
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Studio query */
|
||||
Studio(args: QueryStudioArgs, fn?: Fn<typeof Studio>) {
|
||||
|
@ -461,8 +486,18 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Activity query */
|
||||
Activity() {
|
||||
throw "To be Implemented"
|
||||
Activity(args: QueryActivityArgs, fn: Fn<typeof ActivityUnion>) {
|
||||
operation = operation.set({
|
||||
subField: "Activity",
|
||||
variables: args,
|
||||
hasSubField: true,
|
||||
level: 1,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ActivityUnion({ query: tmpQuery = [operation], level: 2 }))
|
||||
operation = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
/** Activity reply query */
|
||||
ActivityReply(args: QueryActivityReplyArgs, fn?: Fn<typeof ActivityReply>) {
|
||||
|
@ -737,16 +772,49 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Create or update text activity for the currently authenticated user */
|
||||
SaveTextActivity() {
|
||||
throw "To be Implemented"
|
||||
SaveTextActivity(args: MutationSaveTextActivityArgs, fn?: Fn<typeof TextActivity>) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "TextActivity",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
if (!fn) TextActivity({ query: tmpQuery = [operation], level: 2 }).withId()
|
||||
else fn(TextActivity({ query: tmpQuery = [operation], level: 2 }))
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Create or update message activity for the currently authenticated user */
|
||||
SaveMessageActivity() {
|
||||
throw "To be Implemented"
|
||||
SaveMessageActivity(
|
||||
args: MutationSaveMessageActivityArgs,
|
||||
fn?: Fn<typeof MessageActivity>,
|
||||
) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "MessageActivity",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
if (!fn) MessageActivity({ query: tmpQuery = [operation], level: 2 }).withId()
|
||||
else fn(MessageActivity({ query: tmpQuery = [operation], level: 2 }))
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Update list activity (Mod Only) */
|
||||
SaveListActivity() {
|
||||
throw "To be Implemented"
|
||||
SaveListActivity(args: MutationSaveListActivityArgs, fn?: Fn<typeof ListActivity>) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "ListActivity",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
if (!fn) ListActivity({ query: tmpQuery = [operation], level: 2 }).withId()
|
||||
else fn(ListActivity({ query: tmpQuery = [operation], level: 2 }))
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Delete an activity item of the authenticated users */
|
||||
DeleteActivity(args: MutationDeleteActivityArgs) {
|
||||
|
@ -762,12 +830,33 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Toggle activity to be pinned to the top of the user's activity feed */
|
||||
ToggleActivityPin() {
|
||||
throw "To be Implemented"
|
||||
ToggleActivityPin(args: MutationToggleActivityPinArgs, fn: Fn<typeof ActivityUnion>) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "ToggleActivityPin",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ActivityUnion({ query: tmpQuery = [operation], level: 2 }))
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Toggle the subscription of an activity item */
|
||||
ToggleActivitySubscription() {
|
||||
throw "To be Implemented"
|
||||
ToggleActivitySubscription(
|
||||
args: MutationToggleActivitySubscriptionArgs,
|
||||
fn: Fn<typeof ActivityUnion>,
|
||||
) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "ToggleActivitySubscription",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ActivityUnion({ query: tmpQuery = [operation], level: 2 }))
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Create or update an activity reply */
|
||||
SaveActivityReply(
|
||||
|
@ -821,8 +910,17 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Add or remove a like from a likeable type. */
|
||||
ToggleLikeV2() {
|
||||
throw "To be Implemented"
|
||||
ToggleLikeV2(args: MutationToggleLikeV2Args, fn: Fn<typeof LikeableUnion>) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "ToggleLikeV2",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(LikeableUnion({ query: tmpQuery = [operation], level: 2 }))
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Toggle the un/following of a user */
|
||||
ToggleFollow(
|
||||
|
|
|
@ -0,0 +1,320 @@
|
|||
import { Fields, Fn, UpdateOperation } from "../types/Anilist.ts"
|
||||
import { ActivityReply } from "./ActivityReply.ts"
|
||||
import { Media } from "./Media.ts"
|
||||
import { User } from "./User.ts"
|
||||
|
||||
export const TextActivity = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the activity */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the activity's creator */
|
||||
withUserId() {
|
||||
query[0] = query[0].set({ subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of activity */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The number of activity replies */
|
||||
withReplyCount() {
|
||||
query[0] = query[0].set({ subField: "replyCount", level })
|
||||
return this
|
||||
},
|
||||
/** The status text (Markdown) */
|
||||
withText(args: { asHtml: boolean }) {
|
||||
query[0] = query[0].set({ subField: "text", level, variables: args })
|
||||
return this
|
||||
},
|
||||
/** The url for the activity page on the AniList website */
|
||||
withSiteUrl() {
|
||||
query[0] = query[0].set({ subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** If the activity is locked and can receive replies */
|
||||
withIsLocked() {
|
||||
query[0] = query[0].set({ subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user is subscribed to the activity */
|
||||
withIsSubscribed() {
|
||||
query[0] = query[0].set({ subField: "isSubscribed", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the activity has */
|
||||
withLikeCount() {
|
||||
query[0] = query[0].set({ subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the activity */
|
||||
withIsLiked() {
|
||||
query[0] = query[0].set({ subField: "isLiked", level })
|
||||
return this
|
||||
},
|
||||
/** If the activity is pinned to the top of the users activity feed */
|
||||
withIsPinned() {
|
||||
query[0] = query[0].set({ subField: "isPinned", level })
|
||||
return this
|
||||
},
|
||||
/** The time the activity was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The user who created the activity */
|
||||
withUser(fn: Fn<typeof User>) {
|
||||
query[0] = query[0].set({ subField: "user", level })
|
||||
let tmpQuery
|
||||
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The written replies to the activity */
|
||||
withReplies(fn: Fn<typeof ActivityReply>) {
|
||||
query[0] = query[0].set({ subField: "replies", level })
|
||||
let tmpQuery
|
||||
fn(ActivityReply({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The users who liked the activity */
|
||||
withLikes(fn: Fn<typeof User>) {
|
||||
query[0] = query[0].set({ subField: "likes", level })
|
||||
let tmpQuery
|
||||
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const ListActivity = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the activity */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the activity's creator */
|
||||
withUserId() {
|
||||
query[0] = query[0].set({ subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of activity */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The number of activity replies */
|
||||
withReplyCount() {
|
||||
query[0] = query[0].set({ subField: "replyCount", level })
|
||||
return this
|
||||
},
|
||||
/** The list item's textual status */
|
||||
withStatus() {
|
||||
query[0] = query[0].set({ subField: "status", level })
|
||||
return this
|
||||
},
|
||||
/** The list progress made */
|
||||
withProgress() {
|
||||
query[0] = query[0].set({ subField: "progress", level })
|
||||
return this
|
||||
},
|
||||
/** If the activity is locked and can receive replies */
|
||||
withIsLocked() {
|
||||
query[0] = query[0].set({ subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user is subscribed to the activity */
|
||||
withIsSubscribed() {
|
||||
query[0] = query[0].set({ subField: "isSubscribed", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the activity has */
|
||||
withLikeCount() {
|
||||
query[0] = query[0].set({ subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the activity */
|
||||
withIsLiked() {
|
||||
query[0] = query[0].set({ subField: "isLiked", level })
|
||||
return this
|
||||
},
|
||||
/** If the activity is pinned to the top of the users activity feed */
|
||||
withIsPinned() {
|
||||
query[0] = query[0].set({ subField: "isPinned", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the activity page on the AniList website */
|
||||
withSiteUrl() {
|
||||
query[0] = query[0].set({ subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** The time the activity was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The owner of the activity */
|
||||
withUser(fn: Fn<typeof User>) {
|
||||
query[0] = query[0].set({ subField: "user", level })
|
||||
let tmpQuery
|
||||
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The associated media to the activity update */
|
||||
withMedia(fn: Fn<typeof Media>) {
|
||||
query[0] = query[0].set({ subField: "media", level })
|
||||
let tmpQuery
|
||||
fn(Media({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The written replies to the activity */
|
||||
withReplies(fn: Fn<typeof ActivityReply>) {
|
||||
query[0] = query[0].set({ subField: "replies", level })
|
||||
let tmpQuery
|
||||
fn(ActivityReply({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The users who liked the activity */
|
||||
withLikes(fn: Fn<typeof User>) {
|
||||
query[0] = query[0].set({ subField: "likes", level })
|
||||
let tmpQuery
|
||||
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const MessageActivity = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the activity */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the activity's recipient */
|
||||
withRecipientId() {
|
||||
query[0] = query[0].set({ subField: "recipientId", level })
|
||||
return this
|
||||
},
|
||||
/** The user id of the activity's sender */
|
||||
withMessengerId() {
|
||||
query[0] = query[0].set({ subField: "messengerId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of the activity */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The number of activity replies */
|
||||
withReplyCount() {
|
||||
query[0] = query[0].set({ subField: "replyCount", level })
|
||||
return this
|
||||
},
|
||||
/** The message text (Markdown) */
|
||||
withMessage(args: { asHtml: boolean }) {
|
||||
query[0] = query[0].set({ subField: "message", level, variables: args })
|
||||
return this
|
||||
},
|
||||
/** If the activity is locked and can receive replies */
|
||||
withIsLocked() {
|
||||
query[0] = query[0].set({ subField: "isLocked", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user is subscribed to the activity */
|
||||
withIsSubscribed() {
|
||||
query[0] = query[0].set({ subField: "isSubscribed", level })
|
||||
return this
|
||||
},
|
||||
/** The amount of likes the activity has */
|
||||
withLikeCount() {
|
||||
query[0] = query[0].set({ subField: "likeCount", level })
|
||||
return this
|
||||
},
|
||||
/** If the currently authenticated user liked the activity */
|
||||
withIsLiked() {
|
||||
query[0] = query[0].set({ subField: "isLiked", level })
|
||||
return this
|
||||
},
|
||||
/** If the message is private and only viewable to the sender and recipients */
|
||||
withIsPrivate() {
|
||||
query[0] = query[0].set({ subField: "isPrivate", level })
|
||||
return this
|
||||
},
|
||||
/** The url for the activity page on the AniList website */
|
||||
withSiteUrl() {
|
||||
query[0] = query[0].set({ subField: "siteUrl", level })
|
||||
return this
|
||||
},
|
||||
/** The time the activity was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The user who the activity message was sent to */
|
||||
withRecipient(fn: Fn<typeof User>) {
|
||||
query[0] = query[0].set({ subField: "recipient", level })
|
||||
let tmpQuery
|
||||
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The user who sent the activity message */
|
||||
withMessenger(fn: Fn<typeof User>) {
|
||||
query[0] = query[0].set({ subField: "messenger", level })
|
||||
let tmpQuery
|
||||
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The written replies to the activity */
|
||||
withReplies(fn: Fn<typeof ActivityReply>) {
|
||||
query[0] = query[0].set({ subField: "replies", level })
|
||||
let tmpQuery
|
||||
fn(ActivityReply({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The users who liked the activity */
|
||||
withLikes(fn: Fn<typeof User>) {
|
||||
query[0] = query[0].set({ subField: "likes", level })
|
||||
let tmpQuery
|
||||
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const ActivityUnion = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
withTextActivity(fn: Fn<typeof TextActivity>) {
|
||||
query[0] = query[0].set({ subField: "TextActivity", level, hasSubField: true, isUnion: true })
|
||||
let tmpQuery
|
||||
fn(TextActivity({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
withListActivity(fn: Fn<typeof ListActivity>) {
|
||||
query[0] = query[0].set({ subField: "ListActivity", level, hasSubField: true, isUnion: true })
|
||||
let tmpQuery
|
||||
fn(ListActivity({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
withMessageActivity(fn: Fn<typeof MessageActivity>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "MessageActivity",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(MessageActivity({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
|
@ -0,0 +1,55 @@
|
|||
import { Fields, Fn, UpdateOperation } from "../types/Anilist.ts"
|
||||
import { ActivityReply } from "./ActivityReply.ts"
|
||||
import { ListActivity, MessageActivity, TextActivity } from "./ActivityUnion.ts"
|
||||
import { Thread } from "./Thread.ts"
|
||||
import { ThreadComment } from "./ThreadComment.ts"
|
||||
|
||||
export const LikeableUnion = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
withListActivity(fn: Fn<typeof ListActivity>) {
|
||||
query[0] = query[0].set({ subField: "ListActivity", level, hasSubField: true, isUnion: true })
|
||||
let tmpQuery
|
||||
fn(ListActivity({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
withTextActivity(fn: Fn<typeof TextActivity>) {
|
||||
query[0] = query[0].set({ subField: "TextActivity", level, hasSubField: true, isUnion: true })
|
||||
let tmpQuery
|
||||
fn(TextActivity({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
withMessageActivity(fn: Fn<typeof MessageActivity>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "MessageActivity",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(MessageActivity({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
withActivityReply(fn: Fn<typeof ActivityReply>) {
|
||||
query[0] = query[0].set({ subField: "ActivityReply", level, hasSubField: true, isUnion: true })
|
||||
let tmpQuery
|
||||
fn(ActivityReply({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
withThread(fn: Fn<typeof Thread>) {
|
||||
query[0] = query[0].set({ subField: "Thread", level, hasSubField: true, isUnion: true })
|
||||
let tmpQuery
|
||||
fn(Thread({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
withThreadComment(fn: Fn<typeof ThreadComment>) {
|
||||
query[0] = query[0].set({ subField: "ThreadComment", level, hasSubField: true, isUnion: true })
|
||||
let tmpQuery
|
||||
fn(ThreadComment({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
|
@ -0,0 +1,675 @@
|
|||
import { Fields, Fn, UpdateOperation } from "../types/Anilist.ts"
|
||||
import { ActivityUnion, MessageActivity } from "./ActivityUnion.ts"
|
||||
import { Media } from "./Media.ts"
|
||||
import { Thread } from "./Thread.ts"
|
||||
import { ThreadComment } from "./ThreadComment.ts"
|
||||
import { User } from "./User.ts"
|
||||
|
||||
const AiringNotification = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the aired anime */
|
||||
withAnimeId() {
|
||||
query[0] = query[0].set({ subField: "animeId", level })
|
||||
return this
|
||||
},
|
||||
/** The episode number that just aired */
|
||||
withEpisode() {
|
||||
query[0] = query[0].set({ subField: "episode", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContexts() {
|
||||
query[0] = query[0].set({ subField: "contexts", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The associated media of the airing schedule */
|
||||
withMedia(fn: Fn<typeof Media>) {
|
||||
query[0] = query[0].set({ subField: "media", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(Media({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const FollowingNotification = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who followed the authenticated user */
|
||||
withUserId() {
|
||||
query[0] = query[0].set({ subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext() {
|
||||
query[0] = query[0].set({ subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The liked activity */
|
||||
withUser(fn: Fn<typeof User>) {
|
||||
query[0] = query[0].set({ subField: "user", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ActivityMessageNotification = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The if of the user who send the message */
|
||||
withUserId() {
|
||||
query[0] = query[0].set({ subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the activity message */
|
||||
withActivityId() {
|
||||
query[0] = query[0].set({ subField: "activityId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext() {
|
||||
query[0] = query[0].set({ subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The message activity */
|
||||
withMessage(fn: Fn<typeof MessageActivity>) {
|
||||
query[0] = query[0].set({ subField: "message", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(MessageActivity({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The user who sent the message */
|
||||
withUser(fn: Fn<typeof User>) {
|
||||
query[0] = query[0].set({ subField: "user", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ActivityNotification = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who mentioned the authenticated user */
|
||||
withUserId() {
|
||||
query[0] = query[0].set({ subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the activity where mentioned */
|
||||
withActivityId() {
|
||||
query[0] = query[0].set({ subField: "activityId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext() {
|
||||
query[0] = query[0].set({ subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The liked activity */
|
||||
withActivity(fn: Fn<typeof ActivityUnion>) {
|
||||
query[0] = query[0].set({ subField: "activity", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(ActivityUnion({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The user who mentioned the authenticated user */
|
||||
withUser(fn: Fn<typeof User>) {
|
||||
query[0] = query[0].set({ subField: "user", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ThreadCommentNotification = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who mentioned the authenticated user */
|
||||
withUserId() {
|
||||
query[0] = query[0].set({ subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the comment where mentioned */
|
||||
withCommentId() {
|
||||
query[0] = query[0].set({ subField: "commentId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext() {
|
||||
query[0] = query[0].set({ subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The thread that the relevant comment belongs to */
|
||||
withThread(fn: Fn<typeof Thread>) {
|
||||
query[0] = query[0].set({ subField: "thread", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(Thread({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The thread comment that included the @ mention */
|
||||
withComment(fn: Fn<typeof ThreadComment>) {
|
||||
query[0] = query[0].set({ subField: "comment", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(ThreadComment({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The user who mentioned the authenticated user */
|
||||
withUser(fn: Fn<typeof User>) {
|
||||
query[0] = query[0].set({ subField: "user", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const ThreadLikeNotification = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the user who liked to the activity */
|
||||
withUserId() {
|
||||
query[0] = query[0].set({ subField: "userId", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the thread which was liked */
|
||||
withThreadId() {
|
||||
query[0] = query[0].set({ subField: "threadId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext() {
|
||||
query[0] = query[0].set({ subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The thread that the relevant comment belongs to */
|
||||
withThread(fn: Fn<typeof Thread>) {
|
||||
query[0] = query[0].set({ subField: "thread", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(Thread({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The liked thread comment */
|
||||
withComment(fn: Fn<typeof ThreadComment>) {
|
||||
query[0] = query[0].set({ subField: "comment", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(ThreadComment({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** The user who liked the activity */
|
||||
withUser(fn: Fn<typeof User>) {
|
||||
query[0] = query[0].set({ subField: "user", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(User({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const RelatedMediaAdditionNotification = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the new media */
|
||||
withMediaId() {
|
||||
query[0] = query[0].set({ subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The notification context text */
|
||||
withContext() {
|
||||
query[0] = query[0].set({ subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The associated media of the airing schedule */
|
||||
withMedia(fn: Fn<typeof Media>) {
|
||||
query[0] = query[0].set({ subField: "media", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(Media({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaDataChangeNotification = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the media that received data changes */
|
||||
withMediaId() {
|
||||
query[0] = query[0].set({ subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media data change */
|
||||
withContext() {
|
||||
query[0] = query[0].set({ subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media data change */
|
||||
withReason() {
|
||||
query[0] = query[0].set({ subField: "reason", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The media that received data changes */
|
||||
withMedia(fn: Fn<typeof Media>) {
|
||||
query[0] = query[0].set({ subField: "media", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(Media({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaMergeNotification = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The id of the media that was merged into */
|
||||
withMediaId() {
|
||||
query[0] = query[0].set({ subField: "mediaId", level })
|
||||
return this
|
||||
},
|
||||
/** The title of the deleted media */
|
||||
withDeletedMediaTitles() {
|
||||
query[0] = query[0].set({ subField: "deletedMediaTitles", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media data change */
|
||||
withContext() {
|
||||
query[0] = query[0].set({ subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media merge */
|
||||
withReason() {
|
||||
query[0] = query[0].set({ subField: "reason", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
/** The media that was merged into */
|
||||
withMedia(fn: Fn<typeof Media>) {
|
||||
query[0] = query[0].set({ subField: "media", level, hasSubField: true })
|
||||
let tmpQuery
|
||||
fn(Media({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
const MediaDeletionNotification = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
/** The id of the Notification */
|
||||
withId() {
|
||||
query[0] = query[0].set({ subField: "id", level })
|
||||
return this
|
||||
},
|
||||
/** The type of notification */
|
||||
withType() {
|
||||
query[0] = query[0].set({ subField: "type", level })
|
||||
return this
|
||||
},
|
||||
/** The title of the deleted media */
|
||||
withDeletedMediaTitle() {
|
||||
query[0] = query[0].set({ subField: "deletedMediaTitle", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media deletion */
|
||||
withContext() {
|
||||
query[0] = query[0].set({ subField: "context", level })
|
||||
return this
|
||||
},
|
||||
/** The reason for the media deletion */
|
||||
withReason() {
|
||||
query[0] = query[0].set({ subField: "reason", level })
|
||||
return this
|
||||
},
|
||||
/** The time the notification was created at */
|
||||
withCreatedAt() {
|
||||
query[0] = query[0].set({ subField: "createdAt", level })
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const NotificationUnion = ({ query, level }: Fields<UpdateOperation>) => ({
|
||||
AiringNotification(fn: Fn<typeof AiringNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "AiringNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(AiringNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
FollowingNotification(fn: Fn<typeof FollowingNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "FollowingNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(FollowingNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
ActivityMessageNotification(fn: Fn<typeof ActivityMessageNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "ActivityMessageNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ActivityMessageNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
ActivityMentionNotification(fn: Fn<typeof ActivityNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "ActivityMentionNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ActivityNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
ActivityReplyNotification(fn: Fn<typeof ActivityNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "ActivityReplyNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ActivityNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
ActivityReplySubscribedNotification(fn: Fn<typeof ActivityNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "ActivityReplySubscribedNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ActivityNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
ActivityLikeNotification(fn: Fn<typeof ActivityNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "ActivityLikeNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ActivityNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
ActivityReplyLikeNotification(fn: Fn<typeof ActivityNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "ActivityReplyLikeNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ActivityNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
ThreadCommentMentionNotification(fn: Fn<typeof ThreadCommentNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "ThreadCommentMentionNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ThreadCommentNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
ThreadCommentReplyNotification(fn: Fn<typeof ThreadCommentNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "ThreadCommentReplyNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ThreadCommentNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
ThreadCommentSubscribedNotification(fn: Fn<typeof ThreadCommentNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "ThreadCommentSubscribedNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ThreadCommentNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
ThreadCommentLikeNotification(fn: Fn<typeof ThreadCommentNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "ThreadCommentLikeNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ThreadCommentNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
ThreadLikeNotification(fn: Fn<typeof ThreadLikeNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "ThreadLikeNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(ThreadLikeNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
RelatedMediaAdditionNotification(fn: Fn<typeof RelatedMediaAdditionNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "RelatedMediaAdditionNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(RelatedMediaAdditionNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
MediaDataChangeNotification(fn: Fn<typeof MediaDataChangeNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "MediaDataChangeNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(MediaDataChangeNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
MediaMergeNotification(fn: Fn<typeof MediaMergeNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "MediaMergeNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(MediaMergeNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
MediaDeletionNotification(fn: Fn<typeof MediaDeletionNotification>) {
|
||||
query[0] = query[0].set({
|
||||
subField: "MediaDeletionNotification",
|
||||
level,
|
||||
hasSubField: true,
|
||||
isUnion: true,
|
||||
})
|
||||
let tmpQuery
|
||||
fn(MediaDeletionNotification({ query: tmpQuery = [query[0]], level: level + 1 }))
|
||||
query[0] = tmpQuery[0]
|
||||
|
||||
return this
|
||||
},
|
||||
})
|
Loading…
Reference in New Issue