|
| 1 | +// This file is auto-generated by @hey-api/openapi-ts |
| 2 | + |
| 3 | +import type { OptionsLegacyParser } from "@hey-api/client-fetch"; |
| 4 | +import { queryOptions } from "@tanstack/react-query"; |
| 5 | +import { |
| 6 | + client, |
| 7 | + getMessagesDashboardMessagesGet, |
| 8 | + getAlertsDashboardAlertsGet, |
| 9 | + streamSseDashboardAlertsNotificationGet, |
| 10 | +} from "../sdk.gen"; |
| 11 | + |
| 12 | +type QueryKey<TOptions extends OptionsLegacyParser> = [ |
| 13 | + Pick<TOptions, "baseUrl" | "body" | "headers" | "path" | "query"> & { |
| 14 | + _id: string; |
| 15 | + _infinite?: boolean; |
| 16 | + }, |
| 17 | +]; |
| 18 | + |
| 19 | +const createQueryKey = <TOptions extends OptionsLegacyParser>( |
| 20 | + id: string, |
| 21 | + options?: TOptions, |
| 22 | + infinite?: boolean, |
| 23 | +): QueryKey<TOptions>[0] => { |
| 24 | + const params: QueryKey<TOptions>[0] = { |
| 25 | + _id: id, |
| 26 | + baseUrl: (options?.client ?? client).getConfig().baseUrl, |
| 27 | + } as QueryKey<TOptions>[0]; |
| 28 | + if (infinite) { |
| 29 | + params._infinite = infinite; |
| 30 | + } |
| 31 | + if (options?.body) { |
| 32 | + params.body = options.body; |
| 33 | + } |
| 34 | + if (options?.headers) { |
| 35 | + params.headers = options.headers; |
| 36 | + } |
| 37 | + if (options?.path) { |
| 38 | + params.path = options.path; |
| 39 | + } |
| 40 | + if (options?.query) { |
| 41 | + params.query = options.query; |
| 42 | + } |
| 43 | + return params; |
| 44 | +}; |
| 45 | + |
| 46 | +export const getMessagesDashboardMessagesGetQueryKey = ( |
| 47 | + options?: OptionsLegacyParser, |
| 48 | +) => [createQueryKey("getMessagesDashboardMessagesGet", options)]; |
| 49 | + |
| 50 | +export const getMessagesDashboardMessagesGetOptions = ( |
| 51 | + options?: OptionsLegacyParser, |
| 52 | +) => { |
| 53 | + return queryOptions({ |
| 54 | + queryFn: async ({ queryKey, signal }) => { |
| 55 | + const { data } = await getMessagesDashboardMessagesGet({ |
| 56 | + ...options, |
| 57 | + ...queryKey[0], |
| 58 | + signal, |
| 59 | + throwOnError: true, |
| 60 | + }); |
| 61 | + return data; |
| 62 | + }, |
| 63 | + queryKey: getMessagesDashboardMessagesGetQueryKey(options), |
| 64 | + }); |
| 65 | +}; |
| 66 | + |
| 67 | +export const getAlertsDashboardAlertsGetQueryKey = ( |
| 68 | + options?: OptionsLegacyParser, |
| 69 | +) => [createQueryKey("getAlertsDashboardAlertsGet", options)]; |
| 70 | + |
| 71 | +export const getAlertsDashboardAlertsGetOptions = ( |
| 72 | + options?: OptionsLegacyParser, |
| 73 | +) => { |
| 74 | + return queryOptions({ |
| 75 | + queryFn: async ({ queryKey, signal }) => { |
| 76 | + const { data } = await getAlertsDashboardAlertsGet({ |
| 77 | + ...options, |
| 78 | + ...queryKey[0], |
| 79 | + signal, |
| 80 | + throwOnError: true, |
| 81 | + }); |
| 82 | + return data; |
| 83 | + }, |
| 84 | + queryKey: getAlertsDashboardAlertsGetQueryKey(options), |
| 85 | + }); |
| 86 | +}; |
| 87 | + |
| 88 | +export const streamSseDashboardAlertsNotificationGetQueryKey = ( |
| 89 | + options?: OptionsLegacyParser, |
| 90 | +) => [createQueryKey("streamSseDashboardAlertsNotificationGet", options)]; |
| 91 | + |
| 92 | +export const streamSseDashboardAlertsNotificationGetOptions = ( |
| 93 | + options?: OptionsLegacyParser, |
| 94 | +) => { |
| 95 | + return queryOptions({ |
| 96 | + queryFn: async ({ queryKey, signal }) => { |
| 97 | + const { data } = await streamSseDashboardAlertsNotificationGet({ |
| 98 | + ...options, |
| 99 | + ...queryKey[0], |
| 100 | + signal, |
| 101 | + throwOnError: true, |
| 102 | + }); |
| 103 | + return data; |
| 104 | + }, |
| 105 | + queryKey: streamSseDashboardAlertsNotificationGetQueryKey(options), |
| 106 | + }); |
| 107 | +}; |
0 commit comments