/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { QueryClient, QueryFunctionContext, QueryKey, } from "@tanstack/react-query"; import { GustoEmbeddedCore } from "../core.js"; import { notificationsGetCompanyNotifications } from "../funcs/notificationsGetCompanyNotifications.js"; import { combineSignals } from "../lib/primitives.js"; import { RequestOptions } from "../lib/sdks.js"; import { GetCompanyNotificationsHeaderXGustoAPIVersion, GetCompanyNotificationsRequest, GetCompanyNotificationsResponse, Status, } from "../models/operations/getcompanynotifications.js"; import { unwrapAsync } from "../types/fp.js"; export type NotificationsGetCompanyNotificationsQueryData = GetCompanyNotificationsResponse; export function prefetchNotificationsGetCompanyNotifications( queryClient: QueryClient, client$: GustoEmbeddedCore, request: GetCompanyNotificationsRequest, options?: RequestOptions, ): Promise { return queryClient.prefetchQuery({ ...buildNotificationsGetCompanyNotificationsQuery( client$, request, options, ), }); } export function buildNotificationsGetCompanyNotificationsQuery( client$: GustoEmbeddedCore, request: GetCompanyNotificationsRequest, options?: RequestOptions, ): { queryKey: QueryKey; queryFn: ( context: QueryFunctionContext, ) => Promise; } { return { queryKey: queryKeyNotificationsGetCompanyNotifications( request.companyUuid, { status: request.status, xGustoAPIVersion: request.xGustoAPIVersion, page: request.page, per: request.per, }, ), queryFn: async function notificationsGetCompanyNotificationsQueryFn( ctx, ): Promise { const sig = combineSignals( ctx.signal, options?.signal, options?.fetchOptions?.signal, ); const mergedOptions = { ...options?.fetchOptions, ...options, signal: sig, }; return unwrapAsync(notificationsGetCompanyNotifications( client$, request, mergedOptions, )); }, }; } export function queryKeyNotificationsGetCompanyNotifications( companyUuid: string, parameters: { status?: Status | undefined; xGustoAPIVersion?: | GetCompanyNotificationsHeaderXGustoAPIVersion | undefined; page?: number | undefined; per?: number | undefined; }, ): QueryKey { return [ "@gusto/embedded-api", "Notifications", "getCompanyNotifications", companyUuid, parameters, ]; }