| 389 | } |
| 390 | |
| 391 | protected malToKitsu(malid: number, type: any) { |
| 392 | return this.apiCall( |
| 393 | 'GET', |
| 394 | `https://kitsu.app/api/edge/mappings?filter[externalSite]=myanimelist/${type}&filter[externalId]=${malid}&include=item&fields[item]=id`, |
| 395 | {}, |
| 396 | ) |
| 397 | .catch(e => { |
| 398 | if (e instanceof NotAutenticatedError) { |
| 399 | this._authenticated = false; |
| 400 | return this.apiCall( |
| 401 | 'GET', |
| 402 | `https://kitsu.app/api/edge/mappings?filter[externalSite]=myanimelist/${type}&filter[externalId]=${malid}&include=item&fields[item]=id`, |
| 403 | {}, |
| 404 | false, |
| 405 | ); |
| 406 | } |
| 407 | throw e; |
| 408 | }) |
| 409 | .then(res => { |
| 410 | return res; |
| 411 | }); |
| 412 | } |
| 413 | |
| 414 | protected async userId() { |
| 415 | const userId = await api.storage.get('kitsuUserId'); |