/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { notificationsGetDetails } from "../funcs/notificationsGetDetails.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetNotificationsNotificationUuidHeaderXGustoAPIVersion, GetNotificationsNotificationUuidRequest, GetNotificationsNotificationUuidResponse, } from "../models/operations/getnotificationsnotificationuuid.js"; import { unwrapAsync } from "../types/fp.js"; export type NotificationsGetDetailsQueryData = GetNotificationsNotificationUuidResponse; export function prefetchNotificationsGetDetails( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetNotificationsNotificationUuidRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildNotificationsGetDetailsQuery( client$, request, options, ), }); } export function buildNotificationsGetDetailsQuery( client$: GustoEmbeddedCore, request: GetNotificationsNotificationUuidRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyNotificationsGetDetails(request.notificationUuid, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function notificationsGetDetailsQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(notificationsGetDetails( client$, request, mergedOptions, )); }, }; } export function queryKeyNotificationsGetDetails( notificationUuid: string, parameters: { xGustoAPIVersion?: | GetNotificationsNotificationUuidHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "Notifications", "getDetails", notificationUuid, parameters, ]; }