/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { jobsAndCompensationsGetCompensation } from "../funcs/jobsAndCompensationsGetCompensation.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1CompensationsCompensationIdHeaderXGustoAPIVersion, GetV1CompensationsCompensationIdRequest, GetV1CompensationsCompensationIdResponse, } from "../models/operations/getv1compensationscompensationid.js"; import { unwrapAsync } from "../types/fp.js"; export type JobsAndCompensationsGetCompensationQueryData = GetV1CompensationsCompensationIdResponse; export function prefetchJobsAndCompensationsGetCompensation( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1CompensationsCompensationIdRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildJobsAndCompensationsGetCompensationQuery( client$, request, options, ), }); } export function buildJobsAndCompensationsGetCompensationQuery( client$: GustoEmbeddedCore, request: GetV1CompensationsCompensationIdRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyJobsAndCompensationsGetCompensation( request.compensationId, { xGustoAPIVersion: request.xGustoAPIVersion }, ), queryFn: async function jobsAndCompensationsGetCompensationQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(jobsAndCompensationsGetCompensation( client$, request, mergedOptions, )); }, }; } export function queryKeyJobsAndCompensationsGetCompensation( compensationId: string, parameters: { xGustoAPIVersion?: | GetV1CompensationsCompensationIdHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "jobsAndCompensations", "getCompensation", compensationId, parameters, ]; }