/* * 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 { ResponseValidationError } from "../models/errors/responsevalidationerror.js"; import { SDKValidationError } from "../models/errors/sdkvalidationerror.js"; import { GetCompanyNotificationsHeaderXGustoAPIVersion, GetCompanyNotificationsRequest, Status, } from "../models/operations/getcompanynotifications.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildNotificationsGetCompanyNotificationsQuery, NotificationsGetCompanyNotificationsQueryData, prefetchNotificationsGetCompanyNotifications, queryKeyNotificationsGetCompanyNotifications, } from "./notificationsGetCompanyNotifications.core.js"; export { buildNotificationsGetCompanyNotificationsQuery, type NotificationsGetCompanyNotificationsQueryData, prefetchNotificationsGetCompanyNotifications, queryKeyNotificationsGetCompanyNotifications, }; export type NotificationsGetCompanyNotificationsQueryError = | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get notifications for company * * @remarks * Returns all notifications relevant for the given company. * * scope: `notifications:read` */ export function useNotificationsGetCompanyNotifications( request: GetCompanyNotificationsRequest, options?: QueryHookOptions< NotificationsGetCompanyNotificationsQueryData, NotificationsGetCompanyNotificationsQueryError >, ): UseQueryResult< NotificationsGetCompanyNotificationsQueryData, NotificationsGetCompanyNotificationsQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildNotificationsGetCompanyNotificationsQuery( client, request, options, ), ...options, }); } /** * Get notifications for company * * @remarks * Returns all notifications relevant for the given company. * * scope: `notifications:read` */ export function useNotificationsGetCompanyNotificationsSuspense( request: GetCompanyNotificationsRequest, options?: SuspenseQueryHookOptions< NotificationsGetCompanyNotificationsQueryData, NotificationsGetCompanyNotificationsQueryError >, ): UseSuspenseQueryResult< NotificationsGetCompanyNotificationsQueryData, NotificationsGetCompanyNotificationsQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildNotificationsGetCompanyNotificationsQuery( client, request, options, ), ...options, }); } export function setNotificationsGetCompanyNotificationsData( client: QueryClient, queryKeyBase: [ companyUuid: string, parameters: { status?: Status | undefined; xGustoAPIVersion?: | GetCompanyNotificationsHeaderXGustoAPIVersion | undefined; page?: number | undefined; per?: number | undefined; }, ], data: NotificationsGetCompanyNotificationsQueryData, ): NotificationsGetCompanyNotificationsQueryData | undefined { const key = queryKeyNotificationsGetCompanyNotifications(...queryKeyBase); return client.setQueryData( key, data, ); } export function invalidateNotificationsGetCompanyNotifications( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyUuid: string, parameters: { status?: Status | undefined; xGustoAPIVersion?: | GetCompanyNotificationsHeaderXGustoAPIVersion | undefined; page?: number | undefined; per?: number | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Notifications", "getCompanyNotifications", ...queryKeyBase, ], }); } export function invalidateAllNotificationsGetCompanyNotifications( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Notifications", "getCompanyNotifications", ], }); }