mirror of
https://github.com/ajnart/homarr.git
synced 2026-02-27 08:50:56 +01:00
21 lines
805 B
TypeScript
21 lines
805 B
TypeScript
import dayjs from "dayjs";
|
|
|
|
import type { IntegrationKindByCategory } from "@homarr/definitions";
|
|
import type { DownloadClientJobsAndStatus } from "@homarr/integrations";
|
|
import { createIntegrationAsync } from "@homarr/integrations";
|
|
|
|
import { createCachedIntegrationRequestHandler } from "./lib/cached-integration-request-handler";
|
|
|
|
export const downloadClientRequestHandler = createCachedIntegrationRequestHandler<
|
|
DownloadClientJobsAndStatus,
|
|
IntegrationKindByCategory<"downloadClient">,
|
|
{ limit: number }
|
|
>({
|
|
async requestAsync(integration, input) {
|
|
const integrationInstance = await createIntegrationAsync(integration);
|
|
return await integrationInstance.getClientJobsAndStatusAsync(input);
|
|
},
|
|
cacheDuration: dayjs.duration(5, "seconds"),
|
|
queryKey: "downloadClientJobStatus",
|
|
});
|