mirror of
https://github.com/hydralauncher/hydra.git
synced 2025-03-09 15:40:26 +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;
|
id: string;
|
||||||
filename: string;
|
filename: string;
|
||||||
mimeType: string;
|
mimeType: string;
|
||||||
|
@ -12,13 +12,13 @@ interface RealDebridUnrestrictLink {
|
||||||
streamable: number;
|
streamable: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RealDebridAddMagnet {
|
export interface RealDebridAddMagnet {
|
||||||
"id": string,
|
"id": string,
|
||||||
// URL of the created ressource
|
// URL of the created ressource
|
||||||
"uri": string
|
"uri": string
|
||||||
}
|
}
|
||||||
|
|
||||||
interface RealDebridTorrentInfo {
|
export interface RealDebridTorrentInfo {
|
||||||
"id": string,
|
"id": string,
|
||||||
"filename": string,
|
"filename": string,
|
||||||
"original_filename": string, // Original name of the torrent
|
"original_filename": string, // Original name of the torrent
|
||||||
|
@ -50,16 +50,4 @@ interface RealDebridTorrentInfo {
|
||||||
"ended": string, // !! Only present when finished, jsonDate
|
"ended": string, // !! Only present when finished, jsonDate
|
||||||
"speed": number, // !! Only present in "downloading", "compressing", "uploading" status
|
"speed": number, // !! Only present in "downloading", "compressing", "uploading" status
|
||||||
"seeders": number // !! Only present in "downloading", "magnet_conversion" 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 { userPreferencesRepository } from "@main/repository";
|
||||||
import fetch from "node-fetch";
|
import fetch from "node-fetch";
|
||||||
|
import { RealDebridAddMagnet, RealDebridTorrentInfo, RealDebridUnrestrictLink } from "./real-debrid-types";
|
||||||
|
|
||||||
const base = "https://api.real-debrid.com/rest/1.0";
|
const base = "https://api.real-debrid.com/rest/1.0";
|
||||||
|
|
||||||
|
@ -50,6 +50,6 @@ export class RealDebridClient {
|
||||||
}
|
}
|
||||||
|
|
||||||
static getApiToken() {
|
static getApiToken() {
|
||||||
return userPreferencesRepository.findOne({ where: { id: 1 } }).then(userPreferences => userPreferences.realDebridApiToken);
|
return userPreferencesRepository.findOne({ where: { id: 1 } }).then(userPreferences => userPreferences!.realDebridApiToken);
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
Add table
Add a link
Reference in a new issue