hydra/src/types/index.ts

308 lines
5.7 KiB
TypeScript
Raw Normal View History

import type { DownloadSourceStatus, Downloader } from "@shared";
2024-06-27 13:55:50 +00:00
export type GameStatus =
| "active"
| "waiting"
| "paused"
| "error"
| "complete"
| "removed";
2024-04-18 07:46:06 +00:00
export type GameShop = "steam" | "epic";
export interface SteamGenre {
id: string;
name: string;
}
export interface SteamScreenshot {
id: number;
path_thumbnail: string;
path_full: string;
}
2024-05-05 02:37:47 +00:00
export interface SteamVideoSource {
max: string;
"480": string;
2024-05-05 02:37:47 +00:00
}
export interface SteamMovies {
id: number;
mp4: SteamVideoSource;
webm: SteamVideoSource;
thumbnail: string;
name: string;
highlight: boolean;
}
2024-04-18 07:46:06 +00:00
export interface SteamAppDetails {
name: string;
detailed_description: string;
about_the_game: string;
short_description: string;
publishers: string[];
genres: SteamGenre[];
movies?: SteamMovies[];
2024-06-03 19:56:21 +00:00
screenshots?: SteamScreenshot[];
2024-04-18 07:46:06 +00:00
pc_requirements: {
minimum: string;
recommended: string;
};
mac_requirements: {
minimum: string;
recommended: string;
};
linux_requirements: {
2024-04-18 07:46:06 +00:00
minimum: string;
recommended: string;
};
release_date: {
coming_soon: boolean;
date: string;
};
}
export interface GameRepack {
id: number;
title: string;
magnet: string;
repacker: string;
fileSize: string | null;
uploadDate: Date | string | null;
createdAt: Date;
updatedAt: Date;
}
2024-04-28 18:21:14 +00:00
export type ShopDetails = SteamAppDetails & {
objectID: string;
};
2024-04-18 07:46:06 +00:00
export interface TorrentFile {
path: string;
length: number;
}
/* Used by the catalogue */
export interface CatalogueEntry {
objectID: string;
shop: GameShop;
title: string;
/* Epic Games covers cannot be guessed with objectID */
cover: string;
repacks: GameRepack[];
}
2024-06-16 21:39:28 +00:00
export interface UserGame {
2024-06-13 03:39:11 +00:00
objectID: string;
shop: GameShop;
title: string;
2024-06-14 18:08:35 +00:00
iconUrl: string | null;
cover: string;
2024-06-14 17:46:30 +00:00
playTimeInSeconds: number;
lastTimePlayed: Date | null;
2024-06-13 03:39:11 +00:00
}
2024-06-04 14:33:47 +00:00
export interface DownloadQueue {
id: number;
createdAt: Date;
updatedAt: Date;
}
2024-04-18 07:46:06 +00:00
/* Used by the library */
export interface Game {
2024-04-18 07:46:06 +00:00
id: number;
title: string;
iconUrl: string;
2024-06-27 13:55:50 +00:00
status: GameStatus | null;
2024-04-18 07:46:06 +00:00
folderName: string;
downloadPath: string | null;
repacks: GameRepack[];
progress: number;
bytesDownloaded: number;
playTimeInMilliseconds: number;
downloader: Downloader;
2024-04-18 07:46:06 +00:00
executablePath: string | null;
lastTimePlayed: Date | null;
uri: string | null;
2024-04-18 07:46:06 +00:00
fileSize: number;
objectID: string;
shop: GameShop;
2024-06-04 14:33:47 +00:00
downloadQueue: DownloadQueue | null;
2024-04-18 07:46:06 +00:00
createdAt: Date;
updatedAt: Date;
}
export type LibraryGame = Omit<Game, "repacks">;
2024-06-20 21:09:49 +00:00
export interface GameRunning {
2024-06-20 01:05:22 +00:00
id: number;
2024-06-19 22:07:36 +00:00
title: string;
iconUrl: string;
objectID: string;
shop: GameShop;
2024-06-20 14:27:09 +00:00
sessionDurationInMillis: number;
2024-06-19 22:07:36 +00:00
}
2024-05-20 01:21:11 +00:00
export interface DownloadProgress {
2024-04-18 07:46:06 +00:00
downloadSpeed: number;
timeRemaining: number;
numPeers: number;
numSeeds: number;
2024-05-28 13:01:28 +00:00
isDownloadingMetadata: boolean;
2024-06-27 16:18:48 +00:00
isCheckingFiles: boolean;
progress: number;
gameId: number;
game: LibraryGame;
2024-04-18 07:46:06 +00:00
}
export interface UserPreferences {
downloadsPath: string | null;
language: string;
downloadNotificationsEnabled: boolean;
repackUpdatesNotificationsEnabled: boolean;
realDebridApiToken: string | null;
preferQuitInsteadOfHiding: boolean;
2024-05-05 23:11:12 +00:00
runAtStartup: boolean;
2024-04-18 07:46:06 +00:00
}
export interface HowLongToBeatCategory {
title: string;
duration: string;
accuracy: string;
}
export interface Steam250Game {
title: string;
objectID: string;
}
2024-05-18 20:55:12 +00:00
export interface SteamGame {
id: number;
name: string;
clientIcon: string | null;
}
2024-05-19 04:39:50 +00:00
export type AppUpdaterEvent =
| { type: "update-available"; info: { version: string } }
| { type: "update-downloaded" };
/* Events */
export interface StartGameDownloadPayload {
repackId: number;
objectID: string;
title: string;
shop: GameShop;
downloadPath: string;
downloader: Downloader;
}
2024-05-28 13:01:28 +00:00
export interface RealDebridUnrestrictLink {
id: string;
filename: string;
mimeType: string;
filesize: number;
link: string;
host: string;
host_icon: string;
chunks: number;
crc: number;
download: string;
streamable: number;
}
export interface RealDebridAddMagnet {
id: string;
// URL of the created ressource
uri: string;
}
export interface RealDebridTorrentInfo {
id: string;
filename: string;
original_filename: string;
hash: string;
bytes: number;
original_bytes: number;
host: string;
split: number;
progress: number;
status:
| "magnet_error"
| "magnet_conversion"
| "waiting_files_selection"
| "queued"
| "downloading"
| "downloaded"
| "error"
| "virus"
| "compressing"
| "uploading"
| "dead";
2024-05-28 13:01:28 +00:00
added: string;
files: {
id: number;
path: string;
bytes: number;
selected: number;
}[];
links: string[];
ended: string;
speed: number;
seeders: number;
}
export interface RealDebridUser {
id: number;
username: string;
email: string;
points: number;
locale: string;
avatar: string;
type: string;
premium: number;
expiration: string;
}
2024-06-03 01:12:05 +00:00
export interface UserDetails {
2024-06-16 16:58:24 +00:00
id: string;
displayName: string;
profileImageUrl: string | null;
}
2024-07-09 01:07:14 +00:00
export interface UserFriend {
id: string;
displayName: string;
profileImageUrl: string | null;
}
export interface PendingFriendRequest {
AId: string;
2024-07-09 19:14:47 +00:00
ADisplayName: string;
AProfileImageUrl: string | null;
2024-07-09 01:07:14 +00:00
BId: string;
2024-07-09 19:14:47 +00:00
BDisplayName: string;
BProfileImageUrl: string | null;
2024-07-09 01:07:14 +00:00
}
2024-06-12 01:09:24 +00:00
export interface UserProfile {
id: string;
displayName: string;
2024-06-14 21:23:57 +00:00
profileImageUrl: string | null;
totalPlayTimeInSeconds: number;
2024-07-09 01:07:14 +00:00
libraryGames: UserGame[] | null;
recentGames: UserGame[] | null;
friends: UserFriend[] | null;
2024-06-12 01:09:24 +00:00
}
2024-06-03 01:12:05 +00:00
export interface DownloadSource {
id: number;
name: string;
url: string;
repackCount: number;
status: DownloadSourceStatus;
2024-06-05 13:18:40 +00:00
downloadCount: number;
etag: string | null;
2024-06-03 01:12:05 +00:00
createdAt: Date;
updatedAt: Date;
}