hydra/src/types/index.ts

258 lines
5.1 KiB
TypeScript
Raw Normal View History

import type { DownloadSourceStatus, Downloader } from "@shared";
import type { SteamAppDetails } from "./steam.types";
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";
2024-07-10 22:52:57 +00:00
export type FriendRequestAction = "ACCEPTED" | "REFUSED" | "CANCEL";
2024-04-18 07:46:06 +00:00
export interface GameRepack {
id: number;
title: string;
2024-08-18 00:39:50 +00:00
/**
* @deprecated Use uris instead
*/
2024-04-18 07:46:06 +00:00
magnet: string;
2024-08-18 00:39:50 +00:00
uris: string[];
2024-04-18 07:46:06 +00:00
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;
}
2024-06-16 21:39:28 +00:00
export interface UserGame {
2024-09-11 23:53:16 +00:00
objectId: string;
2024-06-13 03:39:11 +00:00
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;
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-08-19 23:02:41 +00:00
id?: number;
2024-06-19 22:07:36 +00:00
title: string;
iconUrl: string | null;
2024-06-19 22:07:36 +00:00
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;
2024-08-18 00:39:50 +00:00
uri: string;
downloadPath: string;
downloader: Downloader;
}
2024-05-28 13:01:28 +00:00
2024-07-09 01:07:14 +00:00
export interface UserFriend {
id: string;
displayName: string;
profileImageUrl: string | null;
2024-09-11 23:53:16 +00:00
createdAt: string;
updatedAt: string;
2024-07-09 01:07:14 +00:00
}
2024-07-21 19:35:02 +00:00
export interface UserFriends {
totalFriends: number;
friends: UserFriend[];
}
2024-08-14 22:45:48 +00:00
export interface UserBlocks {
totalBlocks: number;
blocks: UserFriend[];
}
2024-09-16 16:50:58 +00:00
export interface FriendRequestSync {
friendRequestCount: number;
}
2024-07-10 22:52:57 +00:00
export interface FriendRequest {
2024-07-11 00:04:45 +00:00
id: string;
displayName: string;
profileImageUrl: string | null;
type: "SENT" | "RECEIVED";
2024-07-09 01:07:14 +00:00
}
export interface UserRelation {
AId: string;
BId: string;
status: "ACCEPTED" | "PENDING";
createdAt: string;
updatedAt: string;
}
export interface UserProfileCurrentGame extends Omit<GameRunning, "objectID"> {
objectId: string;
2024-09-11 23:53:16 +00:00
sessionDurationInSeconds: number;
}
export type ProfileVisibility = "PUBLIC" | "PRIVATE" | "FRIENDS";
export interface UserDetails {
id: string;
username: string;
displayName: string;
profileImageUrl: string | null;
profileVisibility: ProfileVisibility;
bio: string;
}
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;
profileVisibility: ProfileVisibility;
2024-07-17 22:03:32 +00:00
libraryGames: UserGame[];
recentGames: UserGame[];
2024-07-29 22:10:53 +00:00
friends: UserFriend[];
totalFriends: number;
relation: UserRelation | null;
2024-09-11 23:53:16 +00:00
currentGame: UserProfileCurrentGame | null;
bio: string;
2024-06-12 01:09:24 +00:00
}
2024-09-11 23:53:16 +00:00
export interface UpdateProfileRequest {
2024-08-07 02:17:12 +00:00
displayName?: string;
profileVisibility?: ProfileVisibility;
2024-08-07 02:17:12 +00:00
profileImageUrl?: string | null;
bio?: string;
}
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;
}
export interface GameStats {
downloadCount: number;
playerCount: number;
}
2024-09-13 00:04:38 +00:00
2024-09-12 23:39:49 +00:00
export interface TrendingGame {
uri: string;
description: string;
background: string;
2024-09-14 16:16:31 +00:00
logo: string | null;
2024-09-12 23:39:49 +00:00
}
2024-09-14 19:55:00 +00:00
export interface UserStats {
libraryCount: number;
friendsCount: number;
}
export * from "./steam.types";
export * from "./real-debrid.types";