/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { employeeFormsGetPdf } from "../funcs/employeeFormsGetPdf.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1EmployeeFormPdfHeaderXGustoAPIVersion, GetV1EmployeeFormPdfRequest, GetV1EmployeeFormPdfResponse, } from "../models/operations/getv1employeeformpdf.js"; import { unwrapAsync } from "../types/fp.js"; export type EmployeeFormsGetPdfQueryData = GetV1EmployeeFormPdfResponse; export function prefetchEmployeeFormsGetPdf( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1EmployeeFormPdfRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildEmployeeFormsGetPdfQuery( client$, request, options, ), }); } export function buildEmployeeFormsGetPdfQuery( client$: GustoEmbeddedCore, request: GetV1EmployeeFormPdfRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyEmployeeFormsGetPdf(request.employeeId, request.formId, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function employeeFormsGetPdfQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(employeeFormsGetPdf( client$, request, mergedOptions, )); }, }; } export function queryKeyEmployeeFormsGetPdf( employeeId: string, formId: string, parameters: { xGustoAPIVersion?: GetV1EmployeeFormPdfHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "employeeForms", "getPdf", employeeId, formId, parameters, ]; }