/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { i9VerificationGetDocuments } from "../funcs/i9VerificationGetDocuments.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1EmployeesEmployeeIdI9AuthorizationDocumentsHeaderXGustoAPIVersion, GetV1EmployeesEmployeeIdI9AuthorizationDocumentsRequest, GetV1EmployeesEmployeeIdI9AuthorizationDocumentsResponse, } from "../models/operations/getv1employeesemployeeidi9authorizationdocuments.js"; import { unwrapAsync } from "../types/fp.js"; export type I9VerificationGetDocumentsQueryData = GetV1EmployeesEmployeeIdI9AuthorizationDocumentsResponse; export function prefetchI9VerificationGetDocuments( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1EmployeesEmployeeIdI9AuthorizationDocumentsRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildI9VerificationGetDocumentsQuery( client$, request, options, ), }); } export function buildI9VerificationGetDocumentsQuery( client$: GustoEmbeddedCore, request: GetV1EmployeesEmployeeIdI9AuthorizationDocumentsRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyI9VerificationGetDocuments(request.employeeId, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function i9VerificationGetDocumentsQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(i9VerificationGetDocuments( client$, request, mergedOptions, )); }, }; } export function queryKeyI9VerificationGetDocuments( employeeId: string, parameters: { xGustoAPIVersion?: | GetV1EmployeesEmployeeIdI9AuthorizationDocumentsHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "i9Verification", "getDocuments", employeeId, parameters, ]; }