/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { webhooksGetV1WebhooksHealthCheck } from "../funcs/webhooksGetV1WebhooksHealthCheck.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetV1WebhooksHealthCheckHeaderXGustoAPIVersion, GetV1WebhooksHealthCheckRequest, GetV1WebhooksHealthCheckResponse, GetV1WebhooksHealthCheckSecurity, } from "../models/operations/getv1webhookshealthcheck.js"; import { unwrapAsync } from "../types/fp.js"; export type WebhooksGetV1WebhooksHealthCheckQueryData = GetV1WebhooksHealthCheckResponse; export function prefetchWebhooksGetV1WebhooksHealthCheck( queryClient: QueryClient, client$: GustoEmbeddedCore, security: GetV1WebhooksHealthCheckSecurity, request: GetV1WebhooksHealthCheckRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildWebhooksGetV1WebhooksHealthCheckQuery( client$, security, request, options, ), }); } export function buildWebhooksGetV1WebhooksHealthCheckQuery( client$: GustoEmbeddedCore, security: GetV1WebhooksHealthCheckSecurity, request: GetV1WebhooksHealthCheckRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyWebhooksGetV1WebhooksHealthCheck({ xGustoAPIVersion: request.xGustoAPIVersion, }), queryFn: async function webhooksGetV1WebhooksHealthCheckQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(webhooksGetV1WebhooksHealthCheck( client$, security, request, mergedOptions, )); }, }; } export function queryKeyWebhooksGetV1WebhooksHealthCheck( parameters: { xGustoAPIVersion?: | GetV1WebhooksHealthCheckHeaderXGustoAPIVersion | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "Webhooks", "getV1WebhooksHealthCheck", parameters, ]; }