/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { InvalidateQueryFilters, QueryClient, useQuery, UseQueryResult, useSuspenseQuery, UseSuspenseQueryResult, } from "@tanstack/react-query"; import { GustoEmbeddedError } from "../models/errors/gustoembeddederror.js"; import { ConnectionError, InvalidRequestError, RequestAbortedError, RequestTimeoutError, UnexpectedClientError, } from "../models/errors/httpclienterrors.js"; import { NotFoundErrorObject } from "../models/errors/notfounderrorobject.js"; import { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { GetV1WebhookSubscriptionUuidHeaderXGustoAPIVersion, GetV1WebhookSubscriptionUuidRequest, GetV1WebhookSubscriptionUuidSecurity, } from "../models/operations/getv1webhooksubscriptionuuid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildWebhooksGetSubscriptionQuery, prefetchWebhooksGetSubscription, queryKeyWebhooksGetSubscription, WebhooksGetSubscriptionQueryData, } from "./webhooksGetSubscription.core.js"; export { buildWebhooksGetSubscriptionQuery, prefetchWebhooksGetSubscription, queryKeyWebhooksGetSubscription, type WebhooksGetSubscriptionQueryData, }; export type WebhooksGetSubscriptionQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get a webhook subscription * * @remarks * Returns the Webhook Subscription associated with the provided UUID. * * 📘 System Access Authentication * * This endpoint uses the [Bearer Auth scheme with the system-level access token in the HTTP Authorization header](https://docs.gusto.com/embedded-payroll/docs/system-access) * * scope: `webhook_subscriptions:read` */ export function useWebhooksGetSubscription( security: GetV1WebhookSubscriptionUuidSecurity, request: GetV1WebhookSubscriptionUuidRequest, options?: QueryHookOptions< WebhooksGetSubscriptionQueryData, WebhooksGetSubscriptionQueryError >, ): UseQueryResult< WebhooksGetSubscriptionQueryData, WebhooksGetSubscriptionQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildWebhooksGetSubscriptionQuery( client, security, request, options, ), ...options, }); } /** * Get a webhook subscription * * @remarks * Returns the Webhook Subscription associated with the provided UUID. * * 📘 System Access Authentication * * This endpoint uses the [Bearer Auth scheme with the system-level access token in the HTTP Authorization header](https://docs.gusto.com/embedded-payroll/docs/system-access) * * scope: `webhook_subscriptions:read` */ export function useWebhooksGetSubscriptionSuspense( security: GetV1WebhookSubscriptionUuidSecurity, request: GetV1WebhookSubscriptionUuidRequest, options?: SuspenseQueryHookOptions< WebhooksGetSubscriptionQueryData, WebhooksGetSubscriptionQueryError >, ): UseSuspenseQueryResult< WebhooksGetSubscriptionQueryData, WebhooksGetSubscriptionQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildWebhooksGetSubscriptionQuery( client, security, request, options, ), ...options, }); } export function setWebhooksGetSubscriptionData( client: QueryClient, queryKeyBase: [ webhookSubscriptionUuid: string, parameters: { xGustoAPIVersion?: | GetV1WebhookSubscriptionUuidHeaderXGustoAPIVersion | undefined; }, ], data: WebhooksGetSubscriptionQueryData, ): WebhooksGetSubscriptionQueryData | undefined { const key = queryKeyWebhooksGetSubscription(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateWebhooksGetSubscription( client: QueryClient, queryKeyBase: TupleToPrefixes< [ webhookSubscriptionUuid: string, parameters: { xGustoAPIVersion?: | GetV1WebhookSubscriptionUuidHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Webhooks", "getSubscription", ...queryKeyBase, ], }); } export function invalidateAllWebhooksGetSubscription( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "Webhooks", "getSubscription"], }); }