/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { garnishmentsGetChildSupportData } from "../funcs/garnishmentsGetChildSupportData.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1GarnishmentsChildSupportHeaderXGustoAPIVersion, GetV1GarnishmentsChildSupportRequest, GetV1GarnishmentsChildSupportResponse, } from "../models/operations/getv1garnishmentschildsupport.js"; import { unwrapAsync } from "../types/fp.js"; export type GarnishmentsGetChildSupportDataQueryData = GetV1GarnishmentsChildSupportResponse; export function prefetchGarnishmentsGetChildSupportData( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1GarnishmentsChildSupportRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildGarnishmentsGetChildSupportDataQuery( client$, request, options, ), }); } export function buildGarnishmentsGetChildSupportDataQuery( client$: GustoEmbeddedCore, request: GetV1GarnishmentsChildSupportRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyGarnishmentsGetChildSupportData({ xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function garnishmentsGetChildSupportDataQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(garnishmentsGetChildSupportData( client$, request, mergedOptions, )); }, }; } export function queryKeyGarnishmentsGetChildSupportData( parameters: { xGustoAPIVersion?: | GetV1GarnishmentsChildSupportHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "Garnishments", "getChildSupportData", parameters, ]; }