/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { employeeFormsList } from "../funcs/employeeFormsList.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1EmployeeFormsHeaderXGustoAPIVersion, GetV1EmployeeFormsRequest, GetV1EmployeeFormsResponse, } from "../models/operations/getv1employeeforms.js"; import { unwrapAsync } from "../types/fp.js"; export type EmployeeFormsListQueryData = GetV1EmployeeFormsResponse; export function prefetchEmployeeFormsList( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1EmployeeFormsRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildEmployeeFormsListQuery( client$, request, options, ), }); } export function buildEmployeeFormsListQuery( client$: GustoEmbeddedCore, request: GetV1EmployeeFormsRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyEmployeeFormsList(request.employeeId, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function employeeFormsListQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(employeeFormsList( client$, request, mergedOptions, )); }, }; } export function queryKeyEmployeeFormsList( employeeId: string, parameters: { xGustoAPIVersion?: GetV1EmployeeFormsHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "employeeForms", "list", employeeId, parameters, ]; }