/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { i9VerificationGetDocumentOptions } from "../funcs/i9VerificationGetDocumentOptions.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1EmployeesEmployeeIdI9AuthorizationDocumentOptionsHeaderXGustoAPIVersion, GetV1EmployeesEmployeeIdI9AuthorizationDocumentOptionsRequest, GetV1EmployeesEmployeeIdI9AuthorizationDocumentOptionsResponse, } from "../models/operations/getv1employeesemployeeidi9authorizationdocumentoptions.js"; import { unwrapAsync } from "../types/fp.js"; export type I9VerificationGetDocumentOptionsQueryData = GetV1EmployeesEmployeeIdI9AuthorizationDocumentOptionsResponse; export function prefetchI9VerificationGetDocumentOptions( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1EmployeesEmployeeIdI9AuthorizationDocumentOptionsRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildI9VerificationGetDocumentOptionsQuery( client$, request, options, ), }); } export function buildI9VerificationGetDocumentOptionsQuery( client$: GustoEmbeddedCore, request: GetV1EmployeesEmployeeIdI9AuthorizationDocumentOptionsRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyI9VerificationGetDocumentOptions(request.employeeId, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function i9VerificationGetDocumentOptionsQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(i9VerificationGetDocumentOptions( client$, request, mergedOptions, )); }, }; } export function queryKeyI9VerificationGetDocumentOptions( employeeId: string, parameters: { xGustoAPIVersion?: | GetV1EmployeesEmployeeIdI9AuthorizationDocumentOptionsHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "i9Verification", "getDocumentOptions", employeeId, parameters, ]; }