From 65c17bba671a1322275f8b01b2a916dd6324d721 Mon Sep 17 00:00:00 2001 From: Nicolas Meienberger Date: Sat, 9 Nov 2024 12:06:22 +0100 Subject: [PATCH] chore: gen api --- .../api-client/@tanstack/react-query.gen.ts | 51 ++++++++++++++++++ .../frontend/src/api-client/services.gen.ts | 27 ++++++++++ packages/frontend/src/api-client/types.gen.ts | 52 +++++++++++++++++++ 3 files changed, 130 insertions(+) diff --git a/packages/frontend/src/api-client/@tanstack/react-query.gen.ts b/packages/frontend/src/api-client/@tanstack/react-query.gen.ts index e53c00d6..e36ea640 100644 --- a/packages/frontend/src/api-client/@tanstack/react-query.gen.ts +++ b/packages/frontend/src/api-client/@tanstack/react-query.gen.ts @@ -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) => [createQueryKey('getTranslation', options)]; export const getTranslationOptions = (options: Options) => { @@ -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), + }); +}; diff --git a/packages/frontend/src/api-client/services.gen.ts b/packages/frontend/src/api-client/services.gen.ts index 556bc318..cdaffc82 100644 --- a/packages/frontend/src/api-client/services.gen.ts +++ b/packages/frontend/src/api-client/services.gen.ts @@ -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 = (options }); }; +export const getError = (options?: Options) => { + return (options?.client ?? client).get({ + ...options, + url: '/api/debug-sentry', + }); +}; + export const systemLoad = (options?: Options) => { return (options?.client ?? client).get({ ...options, @@ -143,6 +156,13 @@ export const systemLoad = (options?: Optio }); }; +export const downloadLocalCertificate = (options?: Options) => { + return (options?.client ?? client).get({ + ...options, + url: '/api/system/certificate', + }); +}; + export const getTranslation = (options: Options) => { return (options?.client ?? client).get({ ...options, @@ -366,3 +386,10 @@ export const deleteLink = (options: Option url: '/api/links/{id}', }); }; + +export const check = (options?: Options) => { + return (options?.client ?? client).get({ + ...options, + url: '/api/health', + }); +}; diff --git a/packages/frontend/src/api-client/types.gen.ts b/packages/frontend/src/api-client/types.gen.ts index 51ac0e59..0d5b067b 100644 --- a/packages/frontend/src/api-client/types.gen.ts +++ b/packages/frontend/src/api-client/types.gen.ts @@ -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; + }; + }; +};