add delete mutations
This commit is contained in:
parent
9d0ef7b579
commit
a7a9860c0c
107
src/anilist.ts
107
src/anilist.ts
|
@ -1,4 +1,11 @@
|
|||
import {
|
||||
MutationDeleteActivityArgs,
|
||||
MutationDeleteActivityReplyArgs,
|
||||
MutationDeleteCustomListArgs,
|
||||
MutationDeleteMediaListEntryArgs,
|
||||
MutationDeleteReviewArgs,
|
||||
MutationDeleteThreadArgs,
|
||||
MutationDeleteThreadCommentArgs,
|
||||
MutationRateReviewArgs,
|
||||
MutationSaveActivityReplyArgs,
|
||||
MutationSaveMediaListEntryArgs,
|
||||
|
@ -200,6 +207,15 @@ export const PageInfo = ({ query, level }: Fields<typeof updateOperation>) => ({
|
|||
},
|
||||
})
|
||||
|
||||
export const Deleted = ({ query, level }: Fields<typeof updateOperation>) => ({
|
||||
/** If an item has been successfully deleted */
|
||||
withDeleted() {
|
||||
query[0] = query[0].set({ subField: "deleted", level })
|
||||
console.log("asd")
|
||||
return this
|
||||
},
|
||||
})
|
||||
|
||||
export const Client = function (auth?: { token: string }) {
|
||||
let operation: ReturnType<typeof updateOperation>
|
||||
return {
|
||||
|
@ -690,12 +706,30 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Delete a media list entry */
|
||||
DeleteMediaListEntry() {
|
||||
throw "To be Implemented"
|
||||
DeleteMediaListEntry(args: MutationDeleteMediaListEntryArgs) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteMediaListEntry",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
Deleted({ query: tmpQuery = [operation], level: 2 }).withDeleted()
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Delete a custom list and remove the list entries from it */
|
||||
DeleteCustomList() {
|
||||
throw "To be Implemented"
|
||||
DeleteCustomList(args: MutationDeleteCustomListArgs) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteCustomList",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
Deleted({ query: tmpQuery = [operation], level: 2 }).withDeleted()
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Create or update text activity for the currently authenticated user */
|
||||
SaveTextActivity() {
|
||||
|
@ -710,8 +744,17 @@ export const Client = function (auth?: { token: string }) {
|
|||
throw "To be Implemented"
|
||||
},
|
||||
/** Delete an activity item of the authenticated users */
|
||||
DeleteActivity() {
|
||||
throw "To be Implemented"
|
||||
DeleteActivity(args: MutationDeleteActivityArgs) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteActivity",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
Deleted({ query: tmpQuery = [operation], level: 2 }).withDeleted()
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Toggle activity to be pinned to the top of the user's activity feed */
|
||||
ToggleActivityPin() {
|
||||
|
@ -741,8 +784,17 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Delete an activity reply of the authenticated users */
|
||||
DeleteActivityReply() {
|
||||
throw "To be Implemented"
|
||||
DeleteActivityReply(args: MutationDeleteActivityReplyArgs) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteActivityReply",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
Deleted({ query: tmpQuery = [operation], level: 2 }).withDeleted()
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Add or remove a like from a likeable type. Returns all the users who liked the same model */
|
||||
ToggleLike(
|
||||
|
@ -814,8 +866,17 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Delete a review */
|
||||
DeleteReview() {
|
||||
throw "To be Implemented"
|
||||
DeleteReview(args: MutationDeleteReviewArgs) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteReview",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
Deleted({ query: tmpQuery = [operation], level: 2 }).withDeleted()
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Rate a review */
|
||||
RateReview(
|
||||
|
@ -875,8 +936,17 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Delete a thread */
|
||||
DeleteThread() {
|
||||
throw "To be Implemented"
|
||||
DeleteThread(args: MutationDeleteThreadArgs) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteThread",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
Deleted({ query: tmpQuery = [operation], level: 2 }).withDeleted()
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
/** Toggle the subscription of a forum thread */
|
||||
ToggleThreadSubscription(
|
||||
|
@ -917,8 +987,17 @@ export const Client = function (auth?: { token: string }) {
|
|||
return this
|
||||
},
|
||||
/** Delete a thread comment */
|
||||
DeleteThreadComment() {
|
||||
throw "To be Implemented"
|
||||
DeleteThreadComment(args: MutationDeleteThreadCommentArgs) {
|
||||
operation = operation.set({
|
||||
level: 1,
|
||||
subField: "DeleteThreadComment",
|
||||
hasSubField: true,
|
||||
variables: args,
|
||||
})
|
||||
let tmpQuery
|
||||
Deleted({ query: tmpQuery = [operation], level: 2 }).withDeleted()
|
||||
operation = tmpQuery[0]
|
||||
return this
|
||||
},
|
||||
UpdateAniChartSettings() {
|
||||
throw "To be Implemented"
|
||||
|
|
Loading…
Reference in New Issue