added tags to get functions for AniList and fixed AniList Post Data query
This commit is contained in:
parent
94c0f97e95
commit
ce52ae20f5
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
"io"
|
"io"
|
||||||
"log"
|
"log"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -90,6 +91,15 @@ func (a *App) GetAniListItem(aniId int, login bool) AniListGetSingleAnime {
|
|||||||
timeUntilAiring
|
timeUntilAiring
|
||||||
episode
|
episode
|
||||||
}
|
}
|
||||||
|
tags{
|
||||||
|
id
|
||||||
|
name
|
||||||
|
description
|
||||||
|
rank
|
||||||
|
isMediaSpoiler
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
isAdult
|
||||||
}
|
}
|
||||||
status
|
status
|
||||||
startedAt{
|
startedAt{
|
||||||
@ -180,6 +190,15 @@ func (a *App) AniListSearch(query string) any {
|
|||||||
timeUntilAiring
|
timeUntilAiring
|
||||||
episode
|
episode
|
||||||
}
|
}
|
||||||
|
tags{
|
||||||
|
id
|
||||||
|
name
|
||||||
|
description
|
||||||
|
rank
|
||||||
|
isMediaSpoiler
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
isAdult
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,6 +275,15 @@ func (a *App) GetAniListUserWatchingList(page int, perPage int, sort string) Ani
|
|||||||
timeUntilAiring
|
timeUntilAiring
|
||||||
episode
|
episode
|
||||||
}
|
}
|
||||||
|
tags{
|
||||||
|
id
|
||||||
|
name
|
||||||
|
description
|
||||||
|
rank
|
||||||
|
isMediaSpoiler
|
||||||
|
isAdult
|
||||||
|
}
|
||||||
|
isAdult
|
||||||
}
|
}
|
||||||
status
|
status
|
||||||
startedAt {
|
startedAt {
|
||||||
@ -330,7 +358,7 @@ func (a *App) GetAniListUserWatchingList(page int, perPage int, sort string) Ani
|
|||||||
|
|
||||||
func (a *App) AniListUpdateEntry(
|
func (a *App) AniListUpdateEntry(
|
||||||
mediaId int,
|
mediaId int,
|
||||||
progress string,
|
progress int,
|
||||||
status string,
|
status string,
|
||||||
score float64,
|
score float64,
|
||||||
repeat int,
|
repeat int,
|
||||||
@ -354,7 +382,7 @@ func (a *App) AniListUpdateEntry(
|
|||||||
}
|
}
|
||||||
type Variables struct {
|
type Variables struct {
|
||||||
MediaId int `json:"mediaId"`
|
MediaId int `json:"mediaId"`
|
||||||
Progress string `json:"progress"`
|
Progress int `json:"progress"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
Score float64 `json:"score"`
|
Score float64 `json:"score"`
|
||||||
Repeat int `json:"repeat"`
|
Repeat int `json:"repeat"`
|
||||||
@ -363,10 +391,10 @@ func (a *App) AniListUpdateEntry(
|
|||||||
CompletedAt CompletedAt `json:"completedAt"`
|
CompletedAt CompletedAt `json:"completedAt"`
|
||||||
}
|
}
|
||||||
body := struct {
|
body := struct {
|
||||||
Mutation string `json:"mutation"`
|
Query string `json:"query"`
|
||||||
Variables Variables `json:"variables"`
|
Variables Variables `json:"variables"`
|
||||||
}{
|
}{
|
||||||
Mutation: `
|
Query: `
|
||||||
mutation(
|
mutation(
|
||||||
$mediaId:Int,
|
$mediaId:Int,
|
||||||
$progress:Int,
|
$progress:Int,
|
||||||
@ -427,6 +455,8 @@ func (a *App) AniListUpdateEntry(
|
|||||||
|
|
||||||
returnedBody, _ := AniListQuery(body, true)
|
returnedBody, _ := AniListQuery(body, true)
|
||||||
|
|
||||||
|
fmt.Println(string(returnedBody))
|
||||||
|
|
||||||
var post interface{}
|
var post interface{}
|
||||||
err := json.Unmarshal(returnedBody, &post)
|
err := json.Unmarshal(returnedBody, &post)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
143
AniListTypes.go
143
AniListTypes.go
@ -68,6 +68,15 @@ type MediaList struct {
|
|||||||
TimeUntilAiring int `json:"timeUntilAiring"`
|
TimeUntilAiring int `json:"timeUntilAiring"`
|
||||||
Episode int `json:"episode"`
|
Episode int `json:"episode"`
|
||||||
} `json:"nextAiringEpisode"`
|
} `json:"nextAiringEpisode"`
|
||||||
|
Tags []struct {
|
||||||
|
Id int `json:"id"`
|
||||||
|
Name string `json:"name"`
|
||||||
|
Description string `json:"description"`
|
||||||
|
Rank int `json:"rank"`
|
||||||
|
IsMediaSpoiler bool `json:"isMediaSpoiler"`
|
||||||
|
IsAdult bool `json:"isAdult"`
|
||||||
|
} `json:"tags"`
|
||||||
|
IsAdult bool `json:"isAdult"`
|
||||||
} `json:"media"`
|
} `json:"media"`
|
||||||
Status string `json:"status"`
|
Status string `json:"status"`
|
||||||
StartedAt struct {
|
StartedAt struct {
|
||||||
@ -80,10 +89,10 @@ type MediaList struct {
|
|||||||
Month int `json:"month"`
|
Month int `json:"month"`
|
||||||
Day int `json:"day"`
|
Day int `json:"day"`
|
||||||
} `json:"completedAt"`
|
} `json:"completedAt"`
|
||||||
Notes string `json:"notes"`
|
Notes string `json:"notes"`
|
||||||
Progress int `json:"progress"`
|
Progress int `json:"progress"`
|
||||||
Score int `json:"score"`
|
Score float64 `json:"score"`
|
||||||
Repeat int `json:"repeat"`
|
Repeat int `json:"repeat"`
|
||||||
User struct {
|
User struct {
|
||||||
ID int `json:"id"`
|
ID int `json:"id"`
|
||||||
Name string `json:"name"`
|
Name string `json:"name"`
|
||||||
@ -103,66 +112,66 @@ type MediaList struct {
|
|||||||
} `json:"user"`
|
} `json:"user"`
|
||||||
}
|
}
|
||||||
|
|
||||||
var MediaListSort = struct {
|
//var MediaListSort = struct {
|
||||||
MediaId string
|
// MediaId string
|
||||||
MediaIdDesc string
|
// MediaIdDesc string
|
||||||
Score string
|
// Score string
|
||||||
ScoreDesc string
|
// ScoreDesc string
|
||||||
Status string
|
// Status string
|
||||||
StatusDesc string
|
// StatusDesc string
|
||||||
Progress string
|
// Progress string
|
||||||
ProgressDesc string
|
// ProgressDesc string
|
||||||
ProgressVolumes string
|
// ProgressVolumes string
|
||||||
ProgressVolumesDesc string
|
// ProgressVolumesDesc string
|
||||||
Repeat string
|
// Repeat string
|
||||||
RepeatDesc string
|
// RepeatDesc string
|
||||||
Priority string
|
// Priority string
|
||||||
PriorityDesc string
|
// PriorityDesc string
|
||||||
StartedOn string
|
// StartedOn string
|
||||||
StartedOnDesc string
|
// StartedOnDesc string
|
||||||
FinishedOn string
|
// FinishedOn string
|
||||||
FinishedOnDesc string
|
// FinishedOnDesc string
|
||||||
AddedTime string
|
// AddedTime string
|
||||||
AddedTimeDesc string
|
// AddedTimeDesc string
|
||||||
UpdatedTime string
|
// UpdatedTime string
|
||||||
UpdatedTimeDesc string
|
// UpdatedTimeDesc string
|
||||||
MediaTitleRomaji string
|
// MediaTitleRomaji string
|
||||||
MediaTitleRomajiDesc string
|
// MediaTitleRomajiDesc string
|
||||||
MediaTitleEnglish string
|
// MediaTitleEnglish string
|
||||||
MediaTitleEnglishDesc string
|
// MediaTitleEnglishDesc string
|
||||||
MediaTitleNative string
|
// MediaTitleNative string
|
||||||
MediaTitleNativeDesc string
|
// MediaTitleNativeDesc string
|
||||||
MediaPopularity string
|
// MediaPopularity string
|
||||||
MediaPopularityDesc string
|
// MediaPopularityDesc string
|
||||||
}{
|
//}{
|
||||||
MediaId: "MEDIA_ID",
|
// MediaId: "MEDIA_ID",
|
||||||
MediaIdDesc: "MEDIA_ID_DESC",
|
// MediaIdDesc: "MEDIA_ID_DESC",
|
||||||
Score: "SCORE",
|
// Score: "SCORE",
|
||||||
ScoreDesc: "SCORE_DESC",
|
// ScoreDesc: "SCORE_DESC",
|
||||||
Status: "STATUS",
|
// Status: "STATUS",
|
||||||
StatusDesc: "STATUS_DESC",
|
// StatusDesc: "STATUS_DESC",
|
||||||
Progress: "PROGRESS",
|
// Progress: "PROGRESS",
|
||||||
ProgressDesc: "PROGRESS_DESC",
|
// ProgressDesc: "PROGRESS_DESC",
|
||||||
ProgressVolumes: "PROGRESS_VOLUMES",
|
// ProgressVolumes: "PROGRESS_VOLUMES",
|
||||||
ProgressVolumesDesc: "PROGRESS_VOLUMES_DESC",
|
// ProgressVolumesDesc: "PROGRESS_VOLUMES_DESC",
|
||||||
Repeat: "REPEAT",
|
// Repeat: "REPEAT",
|
||||||
RepeatDesc: "REPEAT_DESC",
|
// RepeatDesc: "REPEAT_DESC",
|
||||||
Priority: "PRIORITY",
|
// Priority: "PRIORITY",
|
||||||
PriorityDesc: "PRIORITY_DESC",
|
// PriorityDesc: "PRIORITY_DESC",
|
||||||
StartedOn: "STARTED_ON",
|
// StartedOn: "STARTED_ON",
|
||||||
StartedOnDesc: "STARTED_ON_DESC",
|
// StartedOnDesc: "STARTED_ON_DESC",
|
||||||
FinishedOn: "FINISHED_ON",
|
// FinishedOn: "FINISHED_ON",
|
||||||
FinishedOnDesc: "FINISHED_ON_DESC",
|
// FinishedOnDesc: "FINISHED_ON_DESC",
|
||||||
AddedTime: "ADDED_TIME",
|
// AddedTime: "ADDED_TIME",
|
||||||
AddedTimeDesc: "ADDED_TIME_DESC",
|
// AddedTimeDesc: "ADDED_TIME_DESC",
|
||||||
UpdatedTime: "UPDATED_TIME",
|
// UpdatedTime: "UPDATED_TIME",
|
||||||
UpdatedTimeDesc: "UPDATED_TIME_DESC",
|
// UpdatedTimeDesc: "UPDATED_TIME_DESC",
|
||||||
MediaTitleRomaji: "MEDIA_TITLE_ROMAJI",
|
// MediaTitleRomaji: "MEDIA_TITLE_ROMAJI",
|
||||||
MediaTitleRomajiDesc: "MEDIA_TITLE_ROMAJI_DESC",
|
// MediaTitleRomajiDesc: "MEDIA_TITLE_ROMAJI_DESC",
|
||||||
MediaTitleEnglish: "MEDIA_TITLE_ENGLISH",
|
// MediaTitleEnglish: "MEDIA_TITLE_ENGLISH",
|
||||||
MediaTitleEnglishDesc: "MEDIA_TITLE_ENGLISH_DESC",
|
// MediaTitleEnglishDesc: "MEDIA_TITLE_ENGLISH_DESC",
|
||||||
MediaTitleNative: "MEDIA_TITLE_NATIVE",
|
// MediaTitleNative: "MEDIA_TITLE_NATIVE",
|
||||||
MediaTitleNativeDesc: "MEDIA_TITLE_NATIVE_DESC",
|
// MediaTitleNativeDesc: "MEDIA_TITLE_NATIVE_DESC",
|
||||||
MediaPopularity: "MEDIA_POPULARITY",
|
// MediaPopularity: "MEDIA_POPULARITY",
|
||||||
MediaPopularityDesc: "MEDIA_POPULARITY_DESC",
|
// MediaPopularityDesc: "MEDIA_POPULARITY_DESC",
|
||||||
}
|
//}
|
||||||
|
Loading…
Reference in New Issue
Block a user