/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { paymentConfigsGet } from "../funcs/paymentConfigsGet.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1CompanyPaymentConfigsHeaderXGustoAPIVersion, GetV1CompanyPaymentConfigsRequest, GetV1CompanyPaymentConfigsResponse, } from "../models/operations/getv1companypaymentconfigs.js"; import { unwrapAsync } from "../types/fp.js"; export type PaymentConfigsGetQueryData = GetV1CompanyPaymentConfigsResponse; export function prefetchPaymentConfigsGet( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetV1CompanyPaymentConfigsRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildPaymentConfigsGetQuery( client$, request, options, ), }); } export function buildPaymentConfigsGetQuery( client$: GustoEmbeddedCore, request: GetV1CompanyPaymentConfigsRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyPaymentConfigsGet(request.companyUuid, { xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function paymentConfigsGetQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(paymentConfigsGet( client$, request, mergedOptions, )); }, }; } export function queryKeyPaymentConfigsGet( companyUuid: string, parameters: { xGustoAPIVersion?: | GetV1CompanyPaymentConfigsHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "paymentConfigs", "get", companyUuid, parameters, ]; }