Fixed Simkl Bugs

This commit is contained in:
John O'Keefe 2024-08-18 17:23:09 -04:00
parent 6ebf5ac48e
commit 4d9012b43c
13 changed files with 280 additions and 157 deletions

View File

@ -7,43 +7,23 @@ import (
"io"
"log"
"net/http"
"reflect"
"strconv"
)
func (a *App) SimklGetUserWatchlist() SimklWatchList {
client := &http.Client{}
var WatchList SimklWatchList
req, _ := http.NewRequest("GET", "https://api.simkl.com/sync/all-items/anime/watching", nil)
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer "+simklJwt.AccessToken)
req.Header.Add("simkl-api-key", Environment.SIMKL_CLIENT_ID)
resp, err := client.Do(req)
if err != nil {
fmt.Println("Errored when sending request to the server")
return SimklWatchList{}
}
defer resp.Body.Close()
respBody, _ := io.ReadAll(resp.Body)
var watchlist SimklWatchList
err = json.Unmarshal(respBody, &watchlist)
if err != nil {
log.Printf("Failed at unmarshal, %s\n", err)
}
return watchlist
}
func SimklPostHelper(url string, body interface{}) json.RawMessage {
func SimklHelper(method string, url string, body interface{}) json.RawMessage {
reader, _ := json.Marshal(body)
var req *http.Request
client := &http.Client{}
req, _ := http.NewRequest("POST", url, bytes.NewBuffer(reader))
if body != nil {
req, _ = http.NewRequest(method, url, bytes.NewBuffer(reader))
} else {
req, _ = http.NewRequest(method, url, nil)
}
req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer "+simklJwt.AccessToken)
@ -54,7 +34,7 @@ func SimklPostHelper(url string, body interface{}) json.RawMessage {
if err != nil {
fmt.Println("Errored when sending request to the server")
message, _ := json.Marshal(struct {
Message string `json:"message" ts_type:"message"`
Message string `json:"message"`
}{
Message: "Errored when sending request to the server" + err.Error(),
})
@ -69,7 +49,41 @@ func SimklPostHelper(url string, body interface{}) json.RawMessage {
}
func (a *App) SimklSyncEpisodes(anime Anime, progress int) interface{} {
func (a *App) SimklGetUserWatchlist() SimklWatchList {
method := "GET"
url := "https://api.simkl.com/sync/all-items/anime/watching"
respBody := SimklHelper(method, url, nil)
var errCheck struct {
Error string `json:"error"`
Message string `json:"message"`
}
err := json.Unmarshal(respBody, &errCheck)
if err != nil {
log.Printf("Failed at unmarshal, %s\n", err)
}
if errCheck.Error != "" {
a.LogoutSimkl()
return SimklWatchList{}
}
var watchlist SimklWatchList
err = json.Unmarshal(respBody, &watchlist)
if err != nil {
log.Printf("Failed at unmarshal, %s\n", err)
}
WatchList = watchlist
return watchlist
}
func (a *App) SimklSyncEpisodes(anime SimklAnime, progress int) interface{} {
var episodes []Episode
var url string
@ -101,7 +115,7 @@ func (a *App) SimklSyncEpisodes(anime Anime, progress int) interface{} {
simklSync := SimklSyncHistoryType{shows}
respBody := SimklPostHelper(url, simklSync)
respBody := SimklHelper("POST", url, simklSync)
var success interface{}
@ -113,7 +127,7 @@ func (a *App) SimklSyncEpisodes(anime Anime, progress int) interface{} {
return success
}
func (a *App) SimklSyncRating(anime Anime, rating int) interface{} {
func (a *App) SimklSyncRating(anime SimklAnime, rating int) interface{} {
var url string
var showWithRating = ShowWithRating{
Title: anime.Show.Title,
@ -148,7 +162,7 @@ func (a *App) SimklSyncRating(anime Anime, rating int) interface{} {
Shows []interface{} `json:"shows" ts_type:"shows"`
}{shows}
respBody := SimklPostHelper(url, simklSync)
respBody := SimklHelper("POST", url, simklSync)
var success interface{}
@ -160,7 +174,7 @@ func (a *App) SimklSyncRating(anime Anime, rating int) interface{} {
return success
}
func (a *App) SimklSyncStatus(anime Anime, status string) interface{} {
func (a *App) SimklSyncStatus(anime SimklAnime, status string) interface{} {
url := "https://api.simkl.com/sync/add-to-list"
var show = SimklShowStatus{
Title: anime.Show.Title,
@ -180,7 +194,7 @@ func (a *App) SimklSyncStatus(anime Anime, status string) interface{} {
Shows []SimklShowStatus `json:"shows" ts_type:"shows"`
}{shows}
respBody := SimklPostHelper(url, simklSync)
respBody := SimklHelper("POST", url, simklSync)
var success interface{}
@ -191,3 +205,44 @@ func (a *App) SimklSyncStatus(anime Anime, status string) interface{} {
return success
}
func (a *App) SimklSearch(aniId int) SimklAnime {
fmt.Println(aniId)
var result SimklAnime
if reflect.DeepEqual(WatchList, SimklWatchList{}) {
fmt.Println("Watchlist empty. Calling...")
WatchList = a.SimklGetUserWatchlist()
}
for _, anime := range WatchList.Anime {
id, err := strconv.Atoi(anime.Show.Ids.AniList)
if err != nil {
fmt.Println("AniList ID does not exist on " + anime.Show.Title)
}
if id == aniId {
result = anime
}
}
if reflect.DeepEqual(result, SimklAnime{}) {
var anime SimklSearchType
url := "https://api.simkl.com/search/id?anilist=" + strconv.Itoa(aniId)
respBody := SimklHelper("GET", url, nil)
err := json.Unmarshal(respBody, &anime)
if err != nil {
log.Printf("Failed at unmarshal, %s\n", err)
}
if len(anime) > 0 {
result.Show.Title = anime[0].Title
result.Show.Poster = anime[0].Poster
result.Show.Ids.Simkl = anime[0].Ids.Simkl
result.Show.Ids.Slug = anime[0].Ids.Slug
}
}
return result
}

View File

@ -27,10 +27,10 @@ type SimklUser struct {
}
type SimklWatchList struct {
Anime []Anime `json:"anime" ts_type:"anime"`
Anime []SimklAnime `json:"anime" ts_type:"anime"`
}
type Anime struct {
type SimklAnime struct {
LastWatchedAt string `json:"last_watched_at" ts_type:"last_watched_at"`
Status string `json:"status" ts_type:"status"`
UserRating float64 `json:"user_rating" ts_type:"user_rating"`
@ -105,3 +105,17 @@ type SimklShowStatus struct {
Ids `json:"ids" ts_type:"ids"`
To string `json:"to" ts_type:"to"`
}
type SimklSearchType []struct {
Type string `json:"type"`
Title string `json:"title"`
Poster string `json:"poster"`
Year int `json:"year"`
Status string `json:"status"`
Ids struct {
Simkl int `json:"simkl"`
Slug string `json:"slug"`
} `json:"ids"`
TotalEpisodes int `json:"total_episodes"`
AnimeType string `json:"anime_type"`
}

View File

@ -181,10 +181,26 @@ func (a *App) GetSimklLoggedInUser() SimklUser {
defer response.Body.Close()
var user SimklUser
respBody, _ := io.ReadAll(response.Body)
var errCheck struct {
Error string `json:"error"`
Message string `json:"message"`
}
err = json.Unmarshal(respBody, &errCheck)
if err != nil {
log.Printf("Failed at unmarshal, %s\n", err)
}
if errCheck.Error != "" {
a.LogoutSimkl()
return SimklUser{}
}
var user SimklUser
err = json.Unmarshal(respBody, &user)
if err != nil {
log.Printf("Failed at unmarshal, %s\n", err)

View File

@ -5,7 +5,7 @@ meta {
}
get {
url: https://api.myanimelist.net/v2/anime/52991?fields=id,title,main_picture,alternative_titles,start_date,end_date,synopsis,mean,rank,popularity,num_list_users,num_scoring_users,nsfw,genres,created_at,updated_at,media_type,status,my_list_status,num_episodes,start_season,broadcast,source,average_episode_duration,rating,pictures,background,related_anime,recommendations,studios,statistics
url: https://api.myanimelist.net/v2/anime/53580?fields=id,title,main_picture,alternative_titles,start_date,end_date,synopsis,mean,rank,popularity,num_list_users,num_scoring_users,nsfw,genres,created_at,updated_at,media_type,status,my_list_status,num_episodes,start_season,broadcast,source,average_episode_duration,rating,pictures,background,related_anime,recommendations,studios,statistics
body: none
auth: bearer
}

View File

@ -1,16 +0,0 @@
meta {
name: Search By MalID
type: http
seq: 1
}
get {
url: https://api.simkl.com/search/id?client_id={{SIMKL_CLIENT_ID}}&simkl=2307708
body: none
auth: none
}
params:query {
client_id: {{SIMKL_CLIENT_ID}}
simkl: 2307708
}

View File

@ -4,28 +4,30 @@
anilistModal,
aniListPrimary,
aniListUser,
malUser,
malLoggedIn,
aniListWatchlist,
animePerPage,
GetAniListSingleItemAndOpenModal,
malLoggedIn,
malPrimary,
malUser,
malWatchList,
simklLoggedIn,
simklUser,
simklWatchList,
title,
watchListPage,
animePerPage,
malWatchList,
malPrimary
simklPrimary,
} from "./GlobalVariablesAndHelperFunctions.svelte";
import {
CheckIfAniListLoggedIn,
CheckIfSimklLoggedIn,
CheckIfMyAnimeListLoggedIn,
CheckIfSimklLoggedIn,
GetAniListLoggedInUser,
GetAniListUserWatchingList,
GetMyAnimeList,
GetMyAnimeListLoggedInUser,
GetSimklLoggedInUser,
SimklGetUserWatchlist,
GetMyAnimeListLoggedInUser, GetMyAnimeList,
} from "../wailsjs/go/main/App";
import {MediaListSort} from "./anilist/types/AniListTypes";
import type {AniListCurrentUserWatchList} from "./anilist/types/AniListCurrentUserWatchListType"
@ -40,12 +42,14 @@
let isAniListLoggedIn: boolean
let isAniListPrimary: boolean
let isMalPrimary: boolean
let isSimklPrimary: boolean
let aniListWatchListLoaded: AniListCurrentUserWatchList
aniListLoggedIn.subscribe((value) => isAniListLoggedIn = value)
aniListPrimary.subscribe((value) => isAniListPrimary = value)
aniListWatchlist.subscribe((value) => aniListWatchListLoaded = value)
malPrimary.subscribe((value) => isMalPrimary = value)
simklPrimary.subscribe(value => isSimklPrimary = value)
let page: number
@ -75,7 +79,7 @@
if (loggedIn) {
GetMyAnimeListLoggedInUser().then(user => {
malUser.set(user)
if (isMalPrimary){
if (isMalPrimary) {
GetMyAnimeList(1000).then(watchList => {
malWatchList.set(watchList)
malLoggedIn.set(loggedIn)
@ -90,11 +94,19 @@
await CheckIfSimklLoggedIn().then(loggedIn => {
if (loggedIn) {
GetSimklLoggedInUser().then(user => {
simklUser.set(user)
SimklGetUserWatchlist().then(result => {
simklWatchList.set(result)
simklLoggedIn.set(loggedIn)
})
if (Object.keys(user).length === 0) {
simklLoggedIn.set(false)
} else {
simklUser.set(user)
if(isSimklPrimary) {
SimklGetUserWatchlist().then(result => {
simklWatchList.set(result)
simklLoggedIn.set(loggedIn)
})
} else {
simklLoggedIn.set(loggedIn)
}
}
})
}
})
@ -107,15 +119,19 @@
{#if isAniListLoggedIn}
<div class="mx-auto max-w-2xl p-4 sm:p-6 lg:max-w-7xl lg:px-8 relative items-center">
<div id="spinner" role="status" class="fixed hidden -translate-x-1/2 -translate-y-1/2 top-2/4 left-1/2">
<svg aria-hidden="true" class="inline w-16 h-16 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600" viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z" fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z" fill="currentFill"/>
<svg aria-hidden="true"
class="inline w-16 h-16 text-gray-200 animate-spin dark:text-gray-600 fill-blue-600"
viewBox="0 0 100 101" fill="none" xmlns="http://www.w3.org/2000/svg">
<path d="M100 50.5908C100 78.2051 77.6142 100.591 50 100.591C22.3858 100.591 0 78.2051 0 50.5908C0 22.9766 22.3858 0.59082 50 0.59082C77.6142 0.59082 100 22.9766 100 50.5908ZM9.08144 50.5908C9.08144 73.1895 27.4013 91.5094 50 91.5094C72.5987 91.5094 90.9186 73.1895 90.9186 50.5908C90.9186 27.9921 72.5987 9.67226 50 9.67226C27.4013 9.67226 9.08144 27.9921 9.08144 50.5908Z"
fill="currentColor"/>
<path d="M93.9676 39.0409C96.393 38.4038 97.8624 35.9116 97.0079 33.5539C95.2932 28.8227 92.871 24.3692 89.8167 20.348C85.8452 15.1192 80.8826 10.7238 75.2124 7.41289C69.5422 4.10194 63.2754 1.94025 56.7698 1.05124C51.7666 0.367541 46.6976 0.446843 41.7345 1.27873C39.2613 1.69328 37.813 4.19778 38.4501 6.62326C39.0873 9.04874 41.5694 10.4717 44.0505 10.1071C47.8511 9.54855 51.7191 9.52689 55.5402 10.0491C60.8642 10.7766 65.9928 12.5457 70.6331 15.2552C75.2735 17.9648 79.3347 21.5619 82.5849 25.841C84.9175 28.9121 86.7997 32.2913 88.1811 35.8758C89.083 38.2158 91.5421 39.6781 93.9676 39.0409Z"
fill="currentFill"/>
</svg>
<span class="sr-only">Loading...</span>
</div>
<h1 class="text-left text-xl font-bold mb-4">Your AniList WatchList</h1>
<Pagination />
<Pagination/>
<div class="grid grid-cols-1 gap-x-6 gap-y-10 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 xl:gap-x-8">
{#each aniListWatchListLoaded.data.Page.mediaList as media}
@ -153,7 +169,7 @@
{/each}
</div>
<Pagination />
<Pagination/>
</div>
{/if}

View File

@ -5,7 +5,8 @@
aniListLoggedIn,
simklLoggedIn,
malLoggedIn,
malAnime
malAnime,
simklAnime,
} from "./GlobalVariablesAndHelperFunctions.svelte";
import {aniListAnime} from "./GlobalVariablesAndHelperFunctions.svelte";
import {Button} from "flowbite-svelte";
@ -14,8 +15,7 @@
import moment from 'moment'
import { Table, TableBody, TableBodyCell, TableBodyRow, TableHead, TableHeadCell } from 'flowbite-svelte';
import { writable } from 'svelte/store';
import type {SimklAnime} from "./simkl/types/simklTypes";
import { get } from 'svelte/store';
import type {SimklAnime, SimklWatchList} from "./simkl/types/simklTypes";
import {
AniListUpdateEntry, MyAnimeListUpdate,
SimklSyncEpisodes,
@ -25,13 +25,12 @@
import type {MALAnime, MALUploadStatus, MyListStatus} from "./mal/types/MALTypes";
import type {AniListUpdateVariables} from "./anilist/types/AniListTypes";
const simklWatch = get(simklWatchList);
let simklWatch: SimklWatchList
let isAniListLoggedIn: boolean
let isMalLoggedIn: boolean
let isSimklLoggedIn: boolean
let simklAnimeIndex: number
let currentMalAnime: MALAnime
let simklAnime: SimklAnime | undefined = undefined
let currentSimklAnime: SimklAnime
let submitting = writable(false)
let isSubmitting: boolean
@ -40,13 +39,8 @@
simklLoggedIn.subscribe((value) => isSimklLoggedIn = value)
malAnime.subscribe((value) => currentMalAnime = value)
submitting.subscribe((value) => isSubmitting = value)
for (let i = 0; i < simklWatch.anime.length; i++) {
if (Number(simklWatch.anime[i].show.ids.mal) === aniListAnime.data.MediaList.media.idMal) {
simklAnimeIndex = i
simklAnime = simklWatch.anime[i]
}
}
simklWatchList.subscribe((value) => simklWatch = value)
simklAnime.subscribe((value) => currentSimklAnime = value)
type statusOption = {
id: number,
@ -108,15 +102,15 @@
})
}
if(isSimklLoggedIn && simklAnime !== undefined) {
if(isSimklLoggedIn && Object.keys(currentSimklAnime).length > 0) {
items.push({
id: simklAnime.show.ids.simkl,
id: currentSimklAnime.show.ids.simkl,
service: "Simkl",
progress: simklAnime.watched_episodes_count,
status: simklAnime.status,
progress: currentSimklAnime.watched_episodes_count,
status: currentSimklAnime.status,
startedAt: "",
completedAt: "",
score: simklAnime.user_rating,
score: currentSimklAnime.user_rating,
repeat: 0,
notes: ""
})
@ -299,24 +293,24 @@
}
if (simklLoggedIn) {
if (simklAnime.watched_episodes_count !== values.progress) {
await SimklSyncEpisodes(simklAnime, values.progress).then(() => {
simklAnime.watched_episodes_count = values.progress
simklWatch.anime[simklAnimeIndex].watched_episodes_count = values.progress
if (currentSimklAnime.watched_episodes_count !== values.progress) {
await SimklSyncEpisodes(currentSimklAnime, values.progress).then(() => {
currentSimklAnime.watched_episodes_count = values.progress
simklWatch.anime[simklWatch.currentIndex].watched_episodes_count = values.progress
})
}
if (simklAnime.user_rating !== values.score) {
await SimklSyncRating(simklAnime, values.score).then(() => {
simklAnime.user_rating = values.score
simklWatch.anime[simklAnimeIndex].user_rating = values.score
if (currentSimklAnime.user_rating !== values.score) {
await SimklSyncRating(currentSimklAnime, values.score).then(() => {
currentSimklAnime.user_rating = values.score
simklWatch.anime[simklWatch.currentIndex].user_rating = values.score
})
}
if (simklAnime.status !== values.status.simkl) {
await SimklSyncStatus(simklAnime, values.status.simkl).then(() => {
simklAnime.status = values.status.simkl
simklWatch.anime[simklAnimeIndex].status = values.status.simkl
if (currentSimklAnime.status !== values.status.simkl) {
await SimklSyncStatus(currentSimklAnime, values.status.simkl).then(() => {
currentSimklAnime.status = values.status.simkl
simklWatch.anime[simklWatch.currentIndex].status = values.status.simkl
})
}
}

View File

@ -1,15 +1,23 @@
<script lang="ts" context="module">
import {
GetAniListItem,
GetAniListLoggedInUser, GetAniListUserWatchingList, GetMyAnimeListAnime, GetMyAnimeListLoggedInUser,
GetSimklLoggedInUser, LogoutAniList, LogoutMyAnimeList, LogoutSimkl
GetAniListLoggedInUser,
GetAniListUserWatchingList,
GetMyAnimeListAnime,
GetMyAnimeListLoggedInUser,
GetSimklLoggedInUser,
LogoutAniList,
LogoutMyAnimeList,
LogoutSimkl,
SimklGetUserWatchlist,
SimklSearch
} from "../wailsjs/go/main/App";
import type {
AniListCurrentUserWatchList,
AniListGetSingleAnime
} from "./anilist/types/AniListCurrentUserWatchListType.js";
import {writable} from 'svelte/store'
import type {SimklUser, SimklWatchList} from "./simkl/types/simklTypes";
import type {SimklAnime, SimklUser, SimklWatchList} from "./simkl/types/simklTypes";
import {type AniListUser, MediaListSort} from "./anilist/types/AniListTypes";
import type {MALAnime, MALWatchlist, MyAnimeListUser} from "./mal/types/MALTypes";
@ -21,6 +29,7 @@
export let malLoggedIn = writable(false)
export let simklWatchList = writable({} as SimklWatchList)
export let aniListPrimary = writable(true)
export let simklPrimary = writable(false)
export let malPrimary = writable(false)
export let simklUser = writable({} as SimklUser)
export let aniListUser = writable({} as AniListUser)
@ -28,6 +37,7 @@
export let aniListWatchlist = writable({} as AniListCurrentUserWatchList)
export let malWatchList = writable({} as MALWatchlist)
export let malAnime = writable({} as MALAnime)
export let simklAnime = writable({} as SimklAnime)
export let watchListPage = writable(1)
export let animePerPage = writable(20)
@ -36,14 +46,20 @@
let page: number
let perPage: number
let aniWatchlist: AniListCurrentUserWatchList
let simklWatch: SimklWatchList
let currentSimklAnime: SimklAnime
let isMalLoggedIn: boolean
let isSimklLoggedIn: boolean
aniListPrimary.subscribe(value => isAniListPrimary = value)
watchListPage.subscribe(value => page = value)
animePerPage.subscribe(value => perPage = value)
aniListWatchlist.subscribe(value => aniWatchlist = value)
malLoggedIn.subscribe(value => isMalLoggedIn = value)
simklLoggedIn.subscribe(value => isSimklLoggedIn = value)
simklWatchList.subscribe(value => simklWatch = value)
simklAnime.subscribe(value => currentSimklAnime = value)
export async function GetAniListSingleItemAndOpenModal(aniId: number, login: boolean): Promise<""> {
@ -52,24 +68,32 @@
title.set(aniListAnime.data.MediaList.media.title.english === "" ?
aniListAnime.data.MediaList.media.title.romaji :
aniListAnime.data.MediaList.media.title.english)
if(isMalLoggedIn) {
GetMyAnimeListAnime(aniListAnime.data.MediaList.media.idMal).then(malResult => {
malAnime.set(malResult)
anilistModal.set(true)
return ""
})
} else {
anilistModal.set(true)
return ""
}
})
if (isMalLoggedIn) {
await GetMyAnimeListAnime(aniListAnime.data.MediaList.media.idMal).then(malResult => {
malAnime.set(malResult)
})
}
if (isSimklLoggedIn) {
await SimklSearch(aniListAnime.data.MediaList.media.id).then((value: SimklAnime) => {
simklAnime.set(value)
})
}
anilistModal.set(true)
return ""
}
export function loginToSimkl(): void {
GetSimklLoggedInUser().then(result => {
simklUser.set(result)
simklLoggedIn.set(true)
GetSimklLoggedInUser().then(user => {
if (Object.keys(user).length === 0) {
simklLoggedIn.set(false)
} else {
simklUser.set(user)
SimklGetUserWatchlist().then(result => {
simklWatchList.set(result)
simklLoggedIn.set(true)
})
}
})
}

View File

@ -10,7 +10,6 @@
function runAniListSearch(): void {
AniListSearch(aniSearch).then(result => {
console.log(result.data.Page.media[5])
aniListSearch = result
aniListSearchActive = true
})

View File

@ -20,6 +20,7 @@ export type SimklUser = {
export type SimklWatchList = {
anime: [SimklAnime]
currentIndex: number
}
export type SimklAnime = {
@ -58,4 +59,18 @@ export type SimklAnime = {
}
},
anime_type: string
}
}
export type SimklSearchType = [{
type: string;
title: string;
poster: string;
year: number;
status: string;
ids: {
simkl: number;
slug: string;
};
totalEpisodes: number;
animeType: string;
}]

View File

@ -42,8 +42,10 @@ export function SimklGetUserWatchlist():Promise<main.SimklWatchList>;
export function SimklLogin():Promise<void>;
export function SimklSyncEpisodes(arg1:main.Anime,arg2:number):Promise<any>;
export function SimklSearch(arg1:number):Promise<main.SimklAnime>;
export function SimklSyncRating(arg1:main.Anime,arg2:number):Promise<any>;
export function SimklSyncEpisodes(arg1:main.SimklAnime,arg2:number):Promise<any>;
export function SimklSyncStatus(arg1:main.Anime,arg2:string):Promise<any>;
export function SimklSyncRating(arg1:main.SimklAnime,arg2:number):Promise<any>;
export function SimklSyncStatus(arg1:main.SimklAnime,arg2:string):Promise<any>;

View File

@ -82,6 +82,10 @@ export function SimklLogin() {
return window['go']['main']['App']['SimklLogin']();
}
export function SimklSearch(arg1) {
return window['go']['main']['App']['SimklSearch'](arg1);
}
export function SimklSyncEpisodes(arg1, arg2) {
return window['go']['main']['App']['SimklSyncEpisodes'](arg1, arg2);
}

View File

@ -167,36 +167,6 @@ export namespace main {
return a;
}
}
export class Anime {
last_watched_at: last_watched_at;
status: status;
user_rating: user_rating;
last_watched: last_watched;
next_to_watch: next_to_watch;
watched_episodes_count: watched_episodes_count;
total_episodes_count: total_episodes_count;
not_aired_episodes_count: not_aired_episodes_count;
show: show;
anime_type: anime_type;
static createFrom(source: any = {}) {
return new Anime(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.last_watched_at = source["last_watched_at"];
this.status = source["status"];
this.user_rating = source["user_rating"];
this.last_watched = source["last_watched"];
this.next_to_watch = source["next_to_watch"];
this.watched_episodes_count = source["watched_episodes_count"];
this.total_episodes_count = source["total_episodes_count"];
this.not_aired_episodes_count = source["not_aired_episodes_count"];
this.show = source["show"];
this.anime_type = source["anime_type"];
}
}
export class MALAnime {
id: id;
@ -489,6 +459,36 @@ export namespace main {
this.updated_at = source["updated_at"];
}
}
export class SimklAnime {
last_watched_at: last_watched_at;
status: status;
user_rating: user_rating;
last_watched: last_watched;
next_to_watch: next_to_watch;
watched_episodes_count: watched_episodes_count;
total_episodes_count: total_episodes_count;
not_aired_episodes_count: not_aired_episodes_count;
show: show;
anime_type: anime_type;
static createFrom(source: any = {}) {
return new SimklAnime(source);
}
constructor(source: any = {}) {
if ('string' === typeof source) source = JSON.parse(source);
this.last_watched_at = source["last_watched_at"];
this.status = source["status"];
this.user_rating = source["user_rating"];
this.last_watched = source["last_watched"];
this.next_to_watch = source["next_to_watch"];
this.watched_episodes_count = source["watched_episodes_count"];
this.total_episodes_count = source["total_episodes_count"];
this.not_aired_episodes_count = source["not_aired_episodes_count"];
this.show = source["show"];
this.anime_type = source["anime_type"];
}
}
export class SimklUser {
user: user;
account: account;