added ability to change simkl status

This commit is contained in:
2024-08-11 19:42:52 -04:00
parent a6b26171d4
commit 1b08918d8e
5 changed files with 77 additions and 10 deletions

View File

@ -160,3 +160,35 @@ func (a *App) SimklSyncRating(anime Anime, rating int) interface{} {
return success
}
func (a *App) SimklSyncStatus(anime Anime, status string) interface{} {
url := "https://api.simkl.com/sync/add-to-list"
var show = SimklShowStatus{
Title: anime.Show.Title,
Ids: Ids{
Simkl: anime.Show.Ids.Simkl,
Mal: anime.Show.Ids.Mal,
Anilist: anime.Show.Ids.AniList,
},
To: status,
}
var shows []SimklShowStatus
shows = append(shows, show)
simklSync := struct {
Shows []SimklShowStatus `json:"shows" ts_type:"shows"`
}{shows}
respBody := SimklPostHelper(url, simklSync)
var success interface{}
err := json.Unmarshal(respBody, &success)
if err != nil {
log.Printf("Failed at unmarshal, %s\n", err)
}
return success
}