/* * 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 { GetV1CompanyExternalPayrollsHeaderXGustoAPIVersion, GetV1CompanyExternalPayrollsRequest, } from "../models/operations/getv1companyexternalpayrolls.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildExternalPayrollsGetQuery, ExternalPayrollsGetQueryData, prefetchExternalPayrollsGet, queryKeyExternalPayrollsGet, } from "./externalPayrollsGet.core.js"; export { buildExternalPayrollsGetQuery, type ExternalPayrollsGetQueryData, prefetchExternalPayrollsGet, queryKeyExternalPayrollsGet, }; export type ExternalPayrollsGetQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get external payrolls for a company * * @remarks * Get external payrolls for a company. * * scope: `external_payrolls:read` */ export function useExternalPayrollsGet( request: GetV1CompanyExternalPayrollsRequest, options?: QueryHookOptions< ExternalPayrollsGetQueryData, ExternalPayrollsGetQueryError >, ): UseQueryResult { const client = useGustoEmbeddedContext(); return useQuery({ ...buildExternalPayrollsGetQuery( client, request, options, ), ...options, }); } /** * Get external payrolls for a company * * @remarks * Get external payrolls for a company. * * scope: `external_payrolls:read` */ export function useExternalPayrollsGetSuspense( request: GetV1CompanyExternalPayrollsRequest, options?: SuspenseQueryHookOptions< ExternalPayrollsGetQueryData, ExternalPayrollsGetQueryError >, ): UseSuspenseQueryResult< ExternalPayrollsGetQueryData, ExternalPayrollsGetQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildExternalPayrollsGetQuery( client, request, options, ), ...options, }); } export function setExternalPayrollsGetData( client: QueryClient, queryKeyBase: [ companyUuid: string, parameters: { xGustoAPIVersion?: | GetV1CompanyExternalPayrollsHeaderXGustoAPIVersion | undefined; page?: number | undefined; per?: number | undefined; }, ], data: ExternalPayrollsGetQueryData, ): ExternalPayrollsGetQueryData | undefined { const key = queryKeyExternalPayrollsGet(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateExternalPayrollsGet( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyUuid: string, parameters: { xGustoAPIVersion?: | GetV1CompanyExternalPayrollsHeaderXGustoAPIVersion | undefined; page?: number | undefined; per?: number | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "externalPayrolls", "get", ...queryKeyBase, ], }); } export function invalidateAllExternalPayrollsGet( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "externalPayrolls", "get"], }); }