/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { companyBenefitsGetAll } from "../funcs/companyBenefitsGetAll.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1BenefitsHeaderXGustoAPIVersion, GetV1BenefitsRequest, GetV1BenefitsResponse, } from "../models/operations/getv1benefits.js"; import { unwrapAsync } from "../types/fp.js"; export type CompanyBenefitsGetAllQueryData = GetV1BenefitsResponse; export function prefetchCompanyBenefitsGetAll( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1BenefitsRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildCompanyBenefitsGetAllQuery( client$, request, options, ), }); } export function buildCompanyBenefitsGetAllQuery( client$: GustoEmbeddedCore, request: GetV1BenefitsRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyCompanyBenefitsGetAll({ xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function companyBenefitsGetAllQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(companyBenefitsGetAll( client$, request, mergedOptions, )); }, }; } export function queryKeyCompanyBenefitsGetAll( parameters: { xGustoAPIVersion?: GetV1BenefitsHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return ["@gusto/embedded-api", "companyBenefits", "getAll", parameters]; }