feat: system optional capabilities

This commit is contained in:
Nicolas Meienberger
2025-11-08 10:14:42 +01:00
parent 4dc239139f
commit 9ec765bd90
13 changed files with 316 additions and 43 deletions

View File

@@ -35,6 +35,7 @@ import {
updateBackupSchedule,
getBackupScheduleForVolume,
runBackupNow,
getSystemInfo,
} from "../sdk.gen";
import { queryOptions, type UseMutationOptions, type DefaultError } from "@tanstack/react-query";
import type {
@@ -90,6 +91,7 @@ import type {
GetBackupScheduleForVolumeData,
RunBackupNowData,
RunBackupNowResponse,
GetSystemInfoData,
} from "../types.gen";
import { client as _heyApiClient } from "../client.gen";
@@ -1078,3 +1080,23 @@ export const runBackupNowMutation = (
};
return mutationOptions;
};
export const getSystemInfoQueryKey = (options?: Options<GetSystemInfoData>) => createQueryKey("getSystemInfo", options);
/**
* Get system information including available capabilities
*/
export const getSystemInfoOptions = (options?: Options<GetSystemInfoData>) => {
return queryOptions({
queryFn: async ({ queryKey, signal }) => {
const { data } = await getSystemInfo({
...options,
...queryKey[0],
signal,
throwOnError: true,
});
return data;
},
queryKey: getSystemInfoQueryKey(options),
});
};