/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { jobsAndCompensationsGetJobs } from "../funcs/jobsAndCompensationsGetJobs.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1EmployeesEmployeeIdJobsHeaderXGustoAPIVersion, GetV1EmployeesEmployeeIdJobsQueryParamInclude, GetV1EmployeesEmployeeIdJobsRequest, GetV1EmployeesEmployeeIdJobsResponse, } from "../models/operations/getv1employeesemployeeidjobs.js"; import { unwrapAsync } from "../types/fp.js"; export type JobsAndCompensationsGetJobsQueryData = GetV1EmployeesEmployeeIdJobsResponse; export function prefetchJobsAndCompensationsGetJobs( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1EmployeesEmployeeIdJobsRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildJobsAndCompensationsGetJobsQuery( client$, request, options, ), }); } export function buildJobsAndCompensationsGetJobsQuery( client$: GustoEmbeddedCore, request: GetV1EmployeesEmployeeIdJobsRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyJobsAndCompensationsGetJobs(request.employeeId, { page: request.page, per: request.per, include: request.include, xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function jobsAndCompensationsGetJobsQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(jobsAndCompensationsGetJobs( client$, request, mergedOptions, )); }, }; } export function queryKeyJobsAndCompensationsGetJobs( employeeId: string, parameters: { page?: number | undefined; per?: number | undefined; include?: GetV1EmployeesEmployeeIdJobsQueryParamInclude | undefined; xGustoAPIVersion?: | GetV1EmployeesEmployeeIdJobsHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "jobsAndCompensations", "getJobs", employeeId, parameters, ]; }