added ability to change simkl status
This commit is contained in:
@ -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
|
||||
}
|
||||
|
Reference in New Issue
Block a user