mirror of
https://github.com/meienberger/runtipi.git
synced 2024-11-29 10:31:21 +03:00
chore: gen api
This commit is contained in:
parent
9a422d6c45
commit
65c17bba67
@ -8,7 +8,9 @@ import {
|
||||
appContext,
|
||||
updateUserSettings,
|
||||
acknowledgeWelcome,
|
||||
getError,
|
||||
systemLoad,
|
||||
downloadLocalCertificate,
|
||||
getTranslation,
|
||||
login,
|
||||
verifyTotp,
|
||||
@ -41,6 +43,7 @@ import {
|
||||
createLink,
|
||||
editLink,
|
||||
deleteLink,
|
||||
check,
|
||||
} from '../services.gen';
|
||||
import type {
|
||||
UpdateUserSettingsData,
|
||||
@ -212,6 +215,22 @@ export const acknowledgeWelcomeMutation = () => {
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const getErrorQueryKey = (options?: Options) => [createQueryKey('getError', options)];
|
||||
|
||||
export const getErrorOptions = (options?: Options) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey }) => {
|
||||
const { data } = await getError({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: getErrorQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
export const systemLoadQueryKey = (options?: Options) => [createQueryKey('systemLoad', options)];
|
||||
|
||||
export const systemLoadOptions = (options?: Options) => {
|
||||
@ -228,6 +247,22 @@ export const systemLoadOptions = (options?: Options) => {
|
||||
});
|
||||
};
|
||||
|
||||
export const downloadLocalCertificateQueryKey = (options?: Options) => [createQueryKey('downloadLocalCertificate', options)];
|
||||
|
||||
export const downloadLocalCertificateOptions = (options?: Options) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey }) => {
|
||||
const { data } = await downloadLocalCertificate({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: downloadLocalCertificateQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
||||
export const getTranslationQueryKey = (options: Options<GetTranslationData>) => [createQueryKey('getTranslation', options)];
|
||||
|
||||
export const getTranslationOptions = (options: Options<GetTranslationData>) => {
|
||||
@ -981,3 +1016,19 @@ export const deleteLinkMutation = () => {
|
||||
};
|
||||
return mutationOptions;
|
||||
};
|
||||
|
||||
export const checkQueryKey = (options?: Options) => [createQueryKey('check', options)];
|
||||
|
||||
export const checkOptions = (options?: Options) => {
|
||||
return queryOptions({
|
||||
queryFn: async ({ queryKey }) => {
|
||||
const { data } = await check({
|
||||
...options,
|
||||
...queryKey[0],
|
||||
throwOnError: true,
|
||||
});
|
||||
return data;
|
||||
},
|
||||
queryKey: checkQueryKey(options),
|
||||
});
|
||||
};
|
||||
|
@ -12,8 +12,12 @@ import type {
|
||||
AcknowledgeWelcomeData,
|
||||
AcknowledgeWelcomeError,
|
||||
AcknowledgeWelcomeResponse,
|
||||
GetErrorError,
|
||||
GetErrorResponse,
|
||||
SystemLoadError,
|
||||
SystemLoadResponse,
|
||||
DownloadLocalCertificateError,
|
||||
DownloadLocalCertificateResponse,
|
||||
GetTranslationData,
|
||||
GetTranslationError,
|
||||
GetTranslationResponse,
|
||||
@ -104,6 +108,8 @@ import type {
|
||||
DeleteLinkData,
|
||||
DeleteLinkError,
|
||||
DeleteLinkResponse,
|
||||
CheckError,
|
||||
CheckResponse,
|
||||
} from './types.gen';
|
||||
|
||||
export const client = createClient(createConfig());
|
||||
@ -136,6 +142,13 @@ export const acknowledgeWelcome = <ThrowOnError extends boolean = false>(options
|
||||
});
|
||||
};
|
||||
|
||||
export const getError = <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => {
|
||||
return (options?.client ?? client).get<GetErrorResponse, GetErrorError, ThrowOnError>({
|
||||
...options,
|
||||
url: '/api/debug-sentry',
|
||||
});
|
||||
};
|
||||
|
||||
export const systemLoad = <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => {
|
||||
return (options?.client ?? client).get<SystemLoadResponse, SystemLoadError, ThrowOnError>({
|
||||
...options,
|
||||
@ -143,6 +156,13 @@ export const systemLoad = <ThrowOnError extends boolean = false>(options?: Optio
|
||||
});
|
||||
};
|
||||
|
||||
export const downloadLocalCertificate = <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => {
|
||||
return (options?.client ?? client).get<DownloadLocalCertificateResponse, DownloadLocalCertificateError, ThrowOnError>({
|
||||
...options,
|
||||
url: '/api/system/certificate',
|
||||
});
|
||||
};
|
||||
|
||||
export const getTranslation = <ThrowOnError extends boolean = false>(options: Options<GetTranslationData, ThrowOnError>) => {
|
||||
return (options?.client ?? client).get<GetTranslationResponse, GetTranslationError, ThrowOnError>({
|
||||
...options,
|
||||
@ -366,3 +386,10 @@ export const deleteLink = <ThrowOnError extends boolean = false>(options: Option
|
||||
url: '/api/links/{id}',
|
||||
});
|
||||
};
|
||||
|
||||
export const check = <ThrowOnError extends boolean = false>(options?: Options<unknown, ThrowOnError>) => {
|
||||
return (options?.client ?? client).get<CheckResponse, CheckError, ThrowOnError>({
|
||||
...options,
|
||||
url: '/api/health',
|
||||
});
|
||||
};
|
||||
|
@ -548,10 +548,18 @@ export type AcknowledgeWelcomeResponse = unknown;
|
||||
|
||||
export type AcknowledgeWelcomeError = unknown;
|
||||
|
||||
export type GetErrorResponse = unknown;
|
||||
|
||||
export type GetErrorError = unknown;
|
||||
|
||||
export type SystemLoadResponse = LoadDto;
|
||||
|
||||
export type SystemLoadError = unknown;
|
||||
|
||||
export type DownloadLocalCertificateResponse = unknown;
|
||||
|
||||
export type DownloadLocalCertificateError = unknown;
|
||||
|
||||
export type GetTranslationData = {
|
||||
path: {
|
||||
lng: string;
|
||||
@ -844,3 +852,47 @@ export type DeleteLinkData = {
|
||||
export type DeleteLinkResponse = unknown;
|
||||
|
||||
export type DeleteLinkError = unknown;
|
||||
|
||||
export type CheckResponse = {
|
||||
status?: string;
|
||||
info?: {
|
||||
[key: string]: {
|
||||
status: string;
|
||||
[key: string]: unknown | string;
|
||||
};
|
||||
} | null;
|
||||
error?: {
|
||||
[key: string]: {
|
||||
status: string;
|
||||
[key: string]: unknown | string;
|
||||
};
|
||||
} | null;
|
||||
details?: {
|
||||
[key: string]: {
|
||||
status: string;
|
||||
[key: string]: unknown | string;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
export type CheckError = {
|
||||
status?: string;
|
||||
info?: {
|
||||
[key: string]: {
|
||||
status: string;
|
||||
[key: string]: unknown | string;
|
||||
};
|
||||
} | null;
|
||||
error?: {
|
||||
[key: string]: {
|
||||
status: string;
|
||||
[key: string]: unknown | string;
|
||||
};
|
||||
} | null;
|
||||
details?: {
|
||||
[key: string]: {
|
||||
status: string;
|
||||
[key: string]: unknown | string;
|
||||
};
|
||||
};
|
||||
};
|
||||
|
Loading…
Reference in New Issue
Block a user