/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { employeePaymentMethodGet } from "../funcs/employeePaymentMethodGet.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1EmployeesEmployeeIdPaymentMethodHeaderXGustoAPIVersion, GetV1EmployeesEmployeeIdPaymentMethodRequest, GetV1EmployeesEmployeeIdPaymentMethodResponse, } from "../models/operations/getv1employeesemployeeidpaymentmethod.js"; import { unwrapAsync } from "../types/fp.js"; export type EmployeePaymentMethodGetQueryData = GetV1EmployeesEmployeeIdPaymentMethodResponse; export function prefetchEmployeePaymentMethodGet( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1EmployeesEmployeeIdPaymentMethodRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildEmployeePaymentMethodGetQuery( client$, request, options, ), }); } export function buildEmployeePaymentMethodGetQuery( client$: GustoEmbeddedCore, request: GetV1EmployeesEmployeeIdPaymentMethodRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyEmployeePaymentMethodGet(request.employeeId, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function employeePaymentMethodGetQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(employeePaymentMethodGet( client$, request, mergedOptions, )); }, }; } export function queryKeyEmployeePaymentMethodGet( employeeId: string, parameters: { xGustoAPIVersion?: | GetV1EmployeesEmployeeIdPaymentMethodHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "employeePaymentMethod", "get", employeeId, parameters, ]; }