/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { jobsAndCompensationsGetJob } from "../funcs/jobsAndCompensationsGetJob.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1JobsJobIdHeaderXGustoAPIVersion, GetV1JobsJobIdQueryParamInclude, GetV1JobsJobIdRequest, GetV1JobsJobIdResponse, } from "../models/operations/getv1jobsjobid.js"; import { unwrapAsync } from "../types/fp.js"; export type JobsAndCompensationsGetJobQueryData = GetV1JobsJobIdResponse; export function prefetchJobsAndCompensationsGetJob( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1JobsJobIdRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildJobsAndCompensationsGetJobQuery( client$, request, options, ), }); } export function buildJobsAndCompensationsGetJobQuery( client$: GustoEmbeddedCore, request: GetV1JobsJobIdRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyJobsAndCompensationsGetJob(request.jobId, { include: request.include, xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function jobsAndCompensationsGetJobQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(jobsAndCompensationsGetJob( client$, request, mergedOptions, )); }, }; } export function queryKeyJobsAndCompensationsGetJob( jobId: string, parameters: { include?: GetV1JobsJobIdQueryParamInclude | undefined; xGustoAPIVersion?: GetV1JobsJobIdHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "jobsAndCompensations", "getJob", jobId, parameters, ]; }