/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { employeeFormsGet } from "../funcs/employeeFormsGet.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1EmployeeFormHeaderXGustoAPIVersion, GetV1EmployeeFormRequest, GetV1EmployeeFormResponse, } from "../models/operations/getv1employeeform.js"; import { unwrapAsync } from "../types/fp.js"; export type EmployeeFormsGetQueryData = GetV1EmployeeFormResponse; export function prefetchEmployeeFormsGet( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1EmployeeFormRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildEmployeeFormsGetQuery( client$, request, options, ), }); } export function buildEmployeeFormsGetQuery( client$: GustoEmbeddedCore, request: GetV1EmployeeFormRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyEmployeeFormsGet(request.employeeId, request.formId, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function employeeFormsGetQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(employeeFormsGet( client$, request, mergedOptions, )); }, }; } export function queryKeyEmployeeFormsGet( employeeId: string, formId: string, parameters: { xGustoAPIVersion?: GetV1EmployeeFormHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "employeeForms", "get", employeeId, formId, parameters, ]; }