/* * 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 { GetV1PayrollDigestsPayrollDigestUuidHeaderXGustoAPIVersion, GetV1PayrollDigestsPayrollDigestUuidRequest, GetV1PayrollDigestsPayrollDigestUuidSecurity, } from "../models/operations/getv1payrolldigestspayrolldigestuuid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildPayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQuery, PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryData, prefetchPayrollDigestsGetV1PayrollDigestsPayrollDigestUuid, queryKeyPayrollDigestsGetV1PayrollDigestsPayrollDigestUuid, } from "./payrollDigestsGetV1PayrollDigestsPayrollDigestUuid.core.js"; export { buildPayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQuery, type PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryData, prefetchPayrollDigestsGetV1PayrollDigestsPayrollDigestUuid, queryKeyPayrollDigestsGetV1PayrollDigestsPayrollDigestUuid, }; export type PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get a payroll digest batch * * @remarks * Returns the status and results of a payroll digest batch. * * Poll this endpoint until the batch `status` reaches a terminal value (`completed` or `failed`). Once terminal, the response includes the full `results` array (one entry per attempted company, each with its own per-company `status` — `success`, `partial_success`, or `failed`) and the `exclusions` array (one entry per company that could not be looked up or processed). * * Note that the top-level batch `status` (`pending` / `processing` / `completed` / `failed`) is distinct from the per-company `status` returned inside `results[]` and `exclusions[]`. A `completed` batch does not imply every company succeeded — inspect the arrays for per-company outcomes. * * Results are stored in Redis with a short TTL after completion. If the partner polls after results have expired, this endpoint returns 410 Gone — partners should re-submit a new batch to fetch fresh data. * * 📘 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: `payroll_digests:read` */ export function usePayrollDigestsGetV1PayrollDigestsPayrollDigestUuid( security: GetV1PayrollDigestsPayrollDigestUuidSecurity, request: GetV1PayrollDigestsPayrollDigestUuidRequest, options?: QueryHookOptions< PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryData, PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryError >, ): UseQueryResult< PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryData, PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildPayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQuery( client, security, request, options, ), ...options, }); } /** * Get a payroll digest batch * * @remarks * Returns the status and results of a payroll digest batch. * * Poll this endpoint until the batch `status` reaches a terminal value (`completed` or `failed`). Once terminal, the response includes the full `results` array (one entry per attempted company, each with its own per-company `status` — `success`, `partial_success`, or `failed`) and the `exclusions` array (one entry per company that could not be looked up or processed). * * Note that the top-level batch `status` (`pending` / `processing` / `completed` / `failed`) is distinct from the per-company `status` returned inside `results[]` and `exclusions[]`. A `completed` batch does not imply every company succeeded — inspect the arrays for per-company outcomes. * * Results are stored in Redis with a short TTL after completion. If the partner polls after results have expired, this endpoint returns 410 Gone — partners should re-submit a new batch to fetch fresh data. * * 📘 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: `payroll_digests:read` */ export function usePayrollDigestsGetV1PayrollDigestsPayrollDigestUuidSuspense( security: GetV1PayrollDigestsPayrollDigestUuidSecurity, request: GetV1PayrollDigestsPayrollDigestUuidRequest, options?: SuspenseQueryHookOptions< PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryData, PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryError >, ): UseSuspenseQueryResult< PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryData, PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildPayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQuery( client, security, request, options, ), ...options, }); } export function setPayrollDigestsGetV1PayrollDigestsPayrollDigestUuidData( client: QueryClient, queryKeyBase: [ payrollDigestUuid: string, parameters: { xGustoAPIVersion?: | GetV1PayrollDigestsPayrollDigestUuidHeaderXGustoAPIVersion | undefined; }, ], data: PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryData, ): PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryData | undefined { const key = queryKeyPayrollDigestsGetV1PayrollDigestsPayrollDigestUuid( ...queryKeyBase, ); return client.setQueryData< PayrollDigestsGetV1PayrollDigestsPayrollDigestUuidQueryData >(key, data); } export function invalidatePayrollDigestsGetV1PayrollDigestsPayrollDigestUuid( client: QueryClient, queryKeyBase: TupleToPrefixes< [ payrollDigestUuid: string, parameters: { xGustoAPIVersion?: | GetV1PayrollDigestsPayrollDigestUuidHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Payroll Digests", "getV1PayrollDigestsPayrollDigestUuid", ...queryKeyBase, ], }); } export function invalidateAllPayrollDigestsGetV1PayrollDigestsPayrollDigestUuid( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Payroll Digests", "getV1PayrollDigestsPayrollDigestUuid", ], }); }