/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { reimbursementsGetV1RecurringReimbursements } from "../funcs/reimbursementsGetV1RecurringReimbursements.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1RecurringReimbursementsHeaderXGustoAPIVersion, GetV1RecurringReimbursementsRequest, GetV1RecurringReimbursementsResponse, } from "../models/operations/getv1recurringreimbursements.js"; import { unwrapAsync } from "../types/fp.js"; export type ReimbursementsGetV1RecurringReimbursementsQueryData = GetV1RecurringReimbursementsResponse; export function prefetchReimbursementsGetV1RecurringReimbursements( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1RecurringReimbursementsRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildReimbursementsGetV1RecurringReimbursementsQuery( client$, request, options, ), }); } export function buildReimbursementsGetV1RecurringReimbursementsQuery( client$: GustoEmbeddedCore, request: GetV1RecurringReimbursementsRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyReimbursementsGetV1RecurringReimbursements(request.id, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function reimbursementsGetV1RecurringReimbursementsQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(reimbursementsGetV1RecurringReimbursements( client$, request, mergedOptions, )); }, }; } export function queryKeyReimbursementsGetV1RecurringReimbursements( id: string, parameters: { xGustoAPIVersion?: | GetV1RecurringReimbursementsHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "Reimbursements", "getV1RecurringReimbursements", id, parameters, ]; }