/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { i9VerificationGetAuthorization } from "../funcs/i9VerificationGetAuthorization.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1EmployeesEmployeeIdI9AuthorizationHeaderXGustoAPIVersion, GetV1EmployeesEmployeeIdI9AuthorizationRequest, GetV1EmployeesEmployeeIdI9AuthorizationResponse, } from "../models/operations/getv1employeesemployeeidi9authorization.js"; import { unwrapAsync } from "../types/fp.js"; export type I9VerificationGetAuthorizationQueryData = GetV1EmployeesEmployeeIdI9AuthorizationResponse; export function prefetchI9VerificationGetAuthorization( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1EmployeesEmployeeIdI9AuthorizationRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildI9VerificationGetAuthorizationQuery( client$, request, options, ), }); } export function buildI9VerificationGetAuthorizationQuery( client$: GustoEmbeddedCore, request: GetV1EmployeesEmployeeIdI9AuthorizationRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyI9VerificationGetAuthorization(request.employeeId, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function i9VerificationGetAuthorizationQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(i9VerificationGetAuthorization( client$, request, mergedOptions, )); }, }; } export function queryKeyI9VerificationGetAuthorization( employeeId: string, parameters: { xGustoAPIVersion?: | GetV1EmployeesEmployeeIdI9AuthorizationHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "i9Verification", "getAuthorization", employeeId, parameters, ]; }