Skip to content

A modern and easy to use dashboard. 80+ integrations. 20K+ icons built in. Authentication out of the box. No YAML, drag and drop configuration.

893 B
Raw Blame
import type { IntegrationKindByCategory } from "@homarr/definitions";
import type { DownloadClientJobsAndStatus, DownloadClientSelection } from "@homarr/integrations";
import { createIntegrationAsync } from "@homarr/integrations/factory";

import { createIntegrationRequestHandler } from "./lib/integration-request-handler";

export const downloadClientRequestHandler = createIntegrationRequestHandler<
  DownloadClientJobsAndStatus,
  IntegrationKindByCategory<"downloadClient">,
  {
    limit: number;
    selection?: DownloadClientSelection;
    includeArchivedHistory: boolean;
    historyWindowDays: number;
  }
>({
  cacheNamespace: "downloads:jobs-and-status",
  cacheTtlMs: 10 * 1000,
  async requestAsync(integration, input) {
    const integrationInstance = await createIntegrationAsync(integration);
    return await integrationInstance.getClientJobsAndStatusAsync(input);
  },
});