/* * 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 { GetV1GarnishmentsGarnishmentIdHeaderXGustoAPIVersion, GetV1GarnishmentsGarnishmentIdRequest, } from "../models/operations/getv1garnishmentsgarnishmentid.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildGarnishmentsGetQuery, GarnishmentsGetQueryData, prefetchGarnishmentsGet, queryKeyGarnishmentsGet, } from "./garnishmentsGet.core.js"; export { buildGarnishmentsGetQuery, type GarnishmentsGetQueryData, prefetchGarnishmentsGet, queryKeyGarnishmentsGet, }; export type GarnishmentsGetQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get a garnishment * * @remarks * Garnishments, or employee deductions, are fixed amounts or percentages deducted from an employee’s pay. They can be deducted a specific number of times or on a recurring basis. Garnishments can also have maximum deductions on a yearly or per-pay-period bases. Common uses for garnishments are court-ordered payments for child support or back taxes. Some companies provide loans to their employees that are repaid via garnishments. * * scope: `garnishments:read` */ export function useGarnishmentsGet( request: GetV1GarnishmentsGarnishmentIdRequest, options?: QueryHookOptions< GarnishmentsGetQueryData, GarnishmentsGetQueryError >, ): UseQueryResult { const client = useGustoEmbeddedContext(); return useQuery({ ...buildGarnishmentsGetQuery( client, request, options, ), ...options, }); } /** * Get a garnishment * * @remarks * Garnishments, or employee deductions, are fixed amounts or percentages deducted from an employee’s pay. They can be deducted a specific number of times or on a recurring basis. Garnishments can also have maximum deductions on a yearly or per-pay-period bases. Common uses for garnishments are court-ordered payments for child support or back taxes. Some companies provide loans to their employees that are repaid via garnishments. * * scope: `garnishments:read` */ export function useGarnishmentsGetSuspense( request: GetV1GarnishmentsGarnishmentIdRequest, options?: SuspenseQueryHookOptions< GarnishmentsGetQueryData, GarnishmentsGetQueryError >, ): UseSuspenseQueryResult { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildGarnishmentsGetQuery( client, request, options, ), ...options, }); } export function setGarnishmentsGetData( client: QueryClient, queryKeyBase: [ garnishmentId: string, parameters: { xGustoAPIVersion?: | GetV1GarnishmentsGarnishmentIdHeaderXGustoAPIVersion | undefined; }, ], data: GarnishmentsGetQueryData, ): GarnishmentsGetQueryData | undefined { const key = queryKeyGarnishmentsGet(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateGarnishmentsGet( client: QueryClient, queryKeyBase: TupleToPrefixes< [ garnishmentId: string, parameters: { xGustoAPIVersion?: | GetV1GarnishmentsGarnishmentIdHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "Garnishments", "get", ...queryKeyBase], }); } export function invalidateAllGarnishmentsGet( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "Garnishments", "get"], }); }