19 lines
752 B
TypeScript
19 lines
752 B
TypeScript
import type { IntegrationKindByCategory } from "@homarr/definitions";
|
|
import type { DownloadClientJobsAndStatus } 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 }
|
|
>({
|
|
cacheNamespace: "downloads:jobs-and-status",
|
|
cacheTtlMs: 10 * 1000,
|
|
async requestAsync(integration, input) {
|
|
const integrationInstance = await createIntegrationAsync(integration);
|
|
return await integrationInstance.getClientJobsAndStatusAsync(input);
|
|
},
|
|
});
|