mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-02-13 03:32:13 +00:00
refactor: real debrid types
This commit is contained in:
parent
6d36db5446
commit
c5693e94af
2 changed files with 5 additions and 17 deletions
|
@ -1,4 +1,4 @@
|
|||
interface RealDebridUnrestrictLink {
|
||||
export interface RealDebridUnrestrictLink {
|
||||
id: string;
|
||||
filename: string;
|
||||
mimeType: string;
|
||||
|
@ -12,13 +12,13 @@ interface RealDebridUnrestrictLink {
|
|||
streamable: number;
|
||||
}
|
||||
|
||||
interface RealDebridAddMagnet {
|
||||
export interface RealDebridAddMagnet {
|
||||
"id": string,
|
||||
// URL of the created ressource
|
||||
"uri": string
|
||||
}
|
||||
|
||||
interface RealDebridTorrentInfo {
|
||||
export interface RealDebridTorrentInfo {
|
||||
"id": string,
|
||||
"filename": string,
|
||||
"original_filename": string, // Original name of the torrent
|
||||
|
@ -50,16 +50,4 @@ interface RealDebridTorrentInfo {
|
|||
"ended": string, // !! Only present when finished, jsonDate
|
||||
"speed": number, // !! Only present in "downloading", "compressing", "uploading" status
|
||||
"seeders": number // !! Only present in "downloading", "magnet_conversion" status
|
||||
}
|
||||
|
||||
declare module 'real-debrid-api' {
|
||||
interface Torrent {
|
||||
addMagnet(magnet: string): Promise<RealDebridAddMagnet>;
|
||||
info(id: string): Promise<RealDebridTorrentInfo[]>;
|
||||
}
|
||||
|
||||
export default class {
|
||||
constructor(token: string);
|
||||
torrents: Torrent;
|
||||
}
|
||||
}
|
|
@ -1,6 +1,6 @@
|
|||
/// <reference path="./real-debrid.d.ts" />
|
||||
import { userPreferencesRepository } from "@main/repository";
|
||||
import fetch from "node-fetch";
|
||||
import { RealDebridAddMagnet, RealDebridTorrentInfo, RealDebridUnrestrictLink } from "./real-debrid-types";
|
||||
|
||||
const base = "https://api.real-debrid.com/rest/1.0";
|
||||
|
||||
|
@ -50,6 +50,6 @@ export class RealDebridClient {
|
|||
}
|
||||
|
||||
static getApiToken() {
|
||||
return userPreferencesRepository.findOne({ where: { id: 1 } }).then(userPreferences => userPreferences.realDebridApiToken);
|
||||
return userPreferencesRepository.findOne({ where: { id: 1 } }).then(userPreferences => userPreferences!.realDebridApiToken);
|
||||
}
|
||||
}
|
Loading…
Reference in a new issue