/* * 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 { UnprocessableEntityError } from "../models/errors/unprocessableentityerror.js"; import { GetNotificationsNotificationUuidHeaderXGustoAPIVersion, GetNotificationsNotificationUuidRequest, } from "../models/operations/getnotificationsnotificationuuid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildNotificationsGetDetailsQuery, NotificationsGetDetailsQueryData, prefetchNotificationsGetDetails, queryKeyNotificationsGetDetails, } from "./notificationsGetDetails.core.js"; export { buildNotificationsGetDetailsQuery, type NotificationsGetDetailsQueryData, prefetchNotificationsGetDetails, queryKeyNotificationsGetDetails, }; export type NotificationsGetDetailsQueryError = | NotFoundErrorObject | UnprocessableEntityError | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get a notification's details * * @remarks * Upon receiving a notification webhook event, use this endpoint to fetch the notification's details. The notification details include basic suggested content that can help you build notifications in your platform. * * Note: partners are responsible for the delivery and any custom state management of notifications in their application. Refer to our [partner notification guide](https://docs.gusto.com/embedded-payroll/docs/partner-notifications) for more details. * * If the notification UUID is not found, the response will be 404 Not Found. If the notification's supporting data is no longer valid, the response will be 422 Unprocessable Entity. * * scope: `notifications:read` */ export function useNotificationsGetDetails( request: GetNotificationsNotificationUuidRequest, options?: QueryHookOptions< NotificationsGetDetailsQueryData, NotificationsGetDetailsQueryError >, ): UseQueryResult< NotificationsGetDetailsQueryData, NotificationsGetDetailsQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildNotificationsGetDetailsQuery( client, request, options, ), ...options, }); } /** * Get a notification's details * * @remarks * Upon receiving a notification webhook event, use this endpoint to fetch the notification's details. The notification details include basic suggested content that can help you build notifications in your platform. * * Note: partners are responsible for the delivery and any custom state management of notifications in their application. Refer to our [partner notification guide](https://docs.gusto.com/embedded-payroll/docs/partner-notifications) for more details. * * If the notification UUID is not found, the response will be 404 Not Found. If the notification's supporting data is no longer valid, the response will be 422 Unprocessable Entity. * * scope: `notifications:read` */ export function useNotificationsGetDetailsSuspense( request: GetNotificationsNotificationUuidRequest, options?: SuspenseQueryHookOptions< NotificationsGetDetailsQueryData, NotificationsGetDetailsQueryError >, ): UseSuspenseQueryResult< NotificationsGetDetailsQueryData, NotificationsGetDetailsQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildNotificationsGetDetailsQuery( client, request, options, ), ...options, }); } export function setNotificationsGetDetailsData( client: QueryClient, queryKeyBase: [ notificationUuid: string, parameters: { xGustoAPIVersion?: | GetNotificationsNotificationUuidHeaderXGustoAPIVersion | undefined; }, ], data: NotificationsGetDetailsQueryData, ): NotificationsGetDetailsQueryData | undefined { const key = queryKeyNotificationsGetDetails(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateNotificationsGetDetails( client: QueryClient, queryKeyBase: TupleToPrefixes< [ notificationUuid: string, parameters: { xGustoAPIVersion?: | GetNotificationsNotificationUuidHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Notifications", "getDetails", ...queryKeyBase, ], }); } export function invalidateAllNotificationsGetDetails( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "Notifications", "getDetails"], }); }