feat(integrations): add mock integration (#3505)
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
import type { CalendarEvent } from "./calendar-types";
|
||||
|
||||
export interface ICalendarIntegration {
|
||||
getCalendarEventsAsync(start: Date, end: Date, includeUnmonitored: boolean): Promise<CalendarEvent[]>;
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
export const radarrReleaseTypes = ["inCinemas", "digitalRelease", "physicalRelease"] as const;
|
||||
export type RadarrReleaseType = (typeof radarrReleaseTypes)[number];
|
||||
|
||||
export interface CalendarEvent {
|
||||
name: string;
|
||||
subName: string;
|
||||
date: Date;
|
||||
dates?: { type: RadarrReleaseType; date: Date }[];
|
||||
description?: string;
|
||||
thumbnail?: string;
|
||||
mediaInformation?: {
|
||||
type: "audio" | "video" | "tv" | "movie";
|
||||
seasonNumber?: number;
|
||||
episodeNumber?: number;
|
||||
};
|
||||
links: {
|
||||
href: string;
|
||||
name: string;
|
||||
color: string | undefined;
|
||||
notificationColor?: string | undefined;
|
||||
isDark: boolean | undefined;
|
||||
logo: string;
|
||||
}[];
|
||||
}
|
||||
@@ -1,18 +1,17 @@
|
||||
import { Integration } from "../../base/integration";
|
||||
import type { DownloadClientJobsAndStatus } from "./download-client-data";
|
||||
import type { DownloadClientItem } from "./download-client-items";
|
||||
|
||||
export abstract class DownloadClientIntegration extends Integration {
|
||||
export interface IDownloadClientIntegration {
|
||||
/** Get download client's status and list of all of it's items */
|
||||
public abstract getClientJobsAndStatusAsync(input: { limit: number }): Promise<DownloadClientJobsAndStatus>;
|
||||
getClientJobsAndStatusAsync(input: { limit: number }): Promise<DownloadClientJobsAndStatus>;
|
||||
/** Pauses the client or all of it's items */
|
||||
public abstract pauseQueueAsync(): Promise<void>;
|
||||
pauseQueueAsync(): Promise<void>;
|
||||
/** Pause a single item using it's ID */
|
||||
public abstract pauseItemAsync(item: DownloadClientItem): Promise<void>;
|
||||
pauseItemAsync(item: DownloadClientItem): Promise<void>;
|
||||
/** Resumes the client or all of it's items */
|
||||
public abstract resumeQueueAsync(): Promise<void>;
|
||||
resumeQueueAsync(): Promise<void>;
|
||||
/** Resume a single item using it's ID */
|
||||
public abstract resumeItemAsync(item: DownloadClientItem): Promise<void>;
|
||||
resumeItemAsync(item: DownloadClientItem): Promise<void>;
|
||||
/** Delete an entry on the client or a file from disk */
|
||||
public abstract deleteItemAsync(item: DownloadClientItem, fromDisk: boolean): Promise<void>;
|
||||
deleteItemAsync(item: DownloadClientItem, fromDisk: boolean): Promise<void>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,9 @@
|
||||
import type { ClusterHealthMonitoring, SystemHealthMonitoring } from "./health-monitoring-types";
|
||||
|
||||
export interface ISystemHealthMonitoringIntegration {
|
||||
getSystemInfoAsync(): Promise<SystemHealthMonitoring>;
|
||||
}
|
||||
|
||||
export interface IClusterHealthMonitoringIntegration {
|
||||
getClusterInfoAsync(): Promise<ClusterHealthMonitoring>;
|
||||
}
|
||||
@@ -1,4 +1,6 @@
|
||||
export interface HealthMonitoring {
|
||||
import type { LxcResource, NodeResource, QemuResource, StorageResource } from "../../types";
|
||||
|
||||
export interface SystemHealthMonitoring {
|
||||
version: string;
|
||||
cpuModelName: string;
|
||||
cpuUtilization: number;
|
||||
@@ -25,3 +27,11 @@ export interface HealthMonitoring {
|
||||
overallStatus: string;
|
||||
}[];
|
||||
}
|
||||
|
||||
// TODO: in the future decouple this from the Proxmox integration
|
||||
export interface ClusterHealthMonitoring {
|
||||
nodes: NodeResource[];
|
||||
lxcs: LxcResource[];
|
||||
vms: QemuResource[];
|
||||
storages: StorageResource[];
|
||||
}
|
||||
@@ -0,0 +1,6 @@
|
||||
import type { Indexer } from "./indexer-manager-types";
|
||||
|
||||
export interface IIndexerManagerIntegration {
|
||||
getIndexersAsync(): Promise<Indexer[]>;
|
||||
testAllAsync(): Promise<void>;
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
import type { MediaInformation, MediaRequest, RequestStats, RequestUser } from "./media-request-types";
|
||||
|
||||
export interface IMediaRequestIntegration {
|
||||
getSeriesInformationAsync(mediaType: "movie" | "tv", id: number): Promise<MediaInformation>;
|
||||
requestMediaAsync(mediaType: "movie" | "tv", id: number, seasons?: number[]): Promise<void>;
|
||||
getRequestsAsync(): Promise<MediaRequest[]>;
|
||||
getStatsAsync(): Promise<RequestStats>;
|
||||
getUsersAsync(): Promise<RequestUser[]>;
|
||||
approveRequestAsync(requestId: number): Promise<void>;
|
||||
declineRequestAsync(requestId: number): Promise<void>;
|
||||
}
|
||||
@@ -1,3 +1,25 @@
|
||||
interface SerieSeason {
|
||||
id: number;
|
||||
seasonNumber: number;
|
||||
name: string;
|
||||
episodeCount: number;
|
||||
}
|
||||
|
||||
interface SeriesInformation {
|
||||
id: number;
|
||||
overview: string;
|
||||
seasons: SerieSeason[];
|
||||
posterPath: string;
|
||||
}
|
||||
|
||||
interface MovieInformation {
|
||||
id: number;
|
||||
overview: string;
|
||||
posterPath: string;
|
||||
}
|
||||
|
||||
export type MediaInformation = SeriesInformation | MovieInformation;
|
||||
|
||||
export interface MediaRequest {
|
||||
id: number;
|
||||
name: string;
|
||||
@@ -0,0 +1,5 @@
|
||||
import type { CurrentSessionsInput, StreamSession } from "./media-server-types";
|
||||
|
||||
export interface IMediaServerIntegration {
|
||||
getCurrentSessionsAsync(options: CurrentSessionsInput): Promise<StreamSession[]>;
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { TdarrQueue, TdarrStatistics, TdarrWorker } from "./media-transcoding-types";
|
||||
|
||||
export interface IMediaTranscodingIntegration {
|
||||
getStatisticsAsync(): Promise<TdarrStatistics>;
|
||||
getWorkersAsync(): Promise<TdarrWorker[]>;
|
||||
getQueueAsync(firstItemIndex: number, pageSize: number): Promise<TdarrQueue>;
|
||||
}
|
||||
@@ -1,3 +1,20 @@
|
||||
export interface TdarrQueue {
|
||||
array: {
|
||||
id: string;
|
||||
healthCheck: string;
|
||||
transcode: string;
|
||||
filePath: string;
|
||||
fileSize: number;
|
||||
container: string;
|
||||
codec: string;
|
||||
resolution: string;
|
||||
type: "transcode" | "health-check";
|
||||
}[];
|
||||
totalCount: number;
|
||||
startIndex: number;
|
||||
endIndex: number;
|
||||
}
|
||||
|
||||
export interface TdarrPieSegment {
|
||||
name: string;
|
||||
value: number;
|
||||
@@ -21,3 +38,17 @@ export interface TdarrStatistics {
|
||||
audioCodecs: TdarrPieSegment[];
|
||||
audioContainers: TdarrPieSegment[];
|
||||
}
|
||||
|
||||
export interface TdarrWorker {
|
||||
id: string;
|
||||
filePath: string;
|
||||
fps: number;
|
||||
percentage: number;
|
||||
ETA: string;
|
||||
jobType: string;
|
||||
status: string;
|
||||
step: string;
|
||||
originalSize: number;
|
||||
estimatedSize: number | null;
|
||||
outputSize: number | null;
|
||||
}
|
||||
@@ -1,16 +0,0 @@
|
||||
export interface TdarrQueue {
|
||||
array: {
|
||||
id: string;
|
||||
healthCheck: string;
|
||||
transcode: string;
|
||||
filePath: string;
|
||||
fileSize: number;
|
||||
container: string;
|
||||
codec: string;
|
||||
resolution: string;
|
||||
type: "transcode" | "health-check";
|
||||
}[];
|
||||
totalCount: number;
|
||||
startIndex: number;
|
||||
endIndex: number;
|
||||
}
|
||||
@@ -1,13 +0,0 @@
|
||||
export interface TdarrWorker {
|
||||
id: string;
|
||||
filePath: string;
|
||||
fps: number;
|
||||
percentage: number;
|
||||
ETA: string;
|
||||
jobType: string;
|
||||
status: string;
|
||||
step: string;
|
||||
originalSize: number;
|
||||
estimatedSize: number | null;
|
||||
outputSize: number | null;
|
||||
}
|
||||
@@ -1,6 +1,5 @@
|
||||
import { Integration } from "../../base/integration";
|
||||
import type { Notification } from "./notification";
|
||||
import type { Notification } from "./notification-types";
|
||||
|
||||
export abstract class NotificationsIntegration extends Integration {
|
||||
public abstract getNotificationsAsync(): Promise<Notification[]>;
|
||||
export interface INotificationsIntegration {
|
||||
getNotificationsAsync(): Promise<Notification[]>;
|
||||
}
|
||||
|
||||
@@ -0,0 +1,7 @@
|
||||
import type { EntityStateResult } from "./smart-home-types";
|
||||
|
||||
export interface ISmartHomeIntegration {
|
||||
getEntityStateAsync(entityId: string): Promise<EntityStateResult>;
|
||||
triggerAutomationAsync(entityId: string): Promise<boolean>;
|
||||
triggerToggleAsync(entityId: string): Promise<boolean>;
|
||||
}
|
||||
@@ -0,0 +1,17 @@
|
||||
interface EntityState {
|
||||
attributes: Record<string, string | number | boolean | null | (string | number)[]>;
|
||||
entity_id: string;
|
||||
last_changed: Date;
|
||||
last_updated: Date;
|
||||
state: string;
|
||||
}
|
||||
|
||||
export type EntityStateResult =
|
||||
| {
|
||||
success: true;
|
||||
data: EntityState;
|
||||
}
|
||||
| {
|
||||
success: false;
|
||||
error: unknown;
|
||||
};
|
||||
Reference in New Issue
Block a user