/* * 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 { GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubHeaderXGustoAPIVersion, GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubRequest, } from "../models/operations/getv1payrollspayrolluuidemployeesemployeeuuidpaystub.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildPayrollsGetPayStubQuery, PayrollsGetPayStubQueryData, prefetchPayrollsGetPayStub, queryKeyPayrollsGetPayStub, } from "./payrollsGetPayStub.core.js"; export { buildPayrollsGetPayStubQuery, type PayrollsGetPayStubQueryData, prefetchPayrollsGetPayStub, queryKeyPayrollsGetPayStub, }; export type PayrollsGetPayStubQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get an employee pay stub (pdf) * * @remarks * Get an employee's pay stub for the specified payroll. By default, an application/pdf response will be returned. No other content types are currently supported, but may be supported in the future. * * scope: `pay_stubs:read` */ export function usePayrollsGetPayStub( request: GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubRequest, options?: QueryHookOptions< PayrollsGetPayStubQueryData, PayrollsGetPayStubQueryError >, ): UseQueryResult { const client = useGustoEmbeddedContext(); return useQuery({ ...buildPayrollsGetPayStubQuery( client, request, options, ), ...options, }); } /** * Get an employee pay stub (pdf) * * @remarks * Get an employee's pay stub for the specified payroll. By default, an application/pdf response will be returned. No other content types are currently supported, but may be supported in the future. * * scope: `pay_stubs:read` */ export function usePayrollsGetPayStubSuspense( request: GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubRequest, options?: SuspenseQueryHookOptions< PayrollsGetPayStubQueryData, PayrollsGetPayStubQueryError >, ): UseSuspenseQueryResult< PayrollsGetPayStubQueryData, PayrollsGetPayStubQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildPayrollsGetPayStubQuery( client, request, options, ), ...options, }); } export function setPayrollsGetPayStubData( client: QueryClient, queryKeyBase: [ payrollId: string, employeeId: string, parameters: { xGustoAPIVersion?: | GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubHeaderXGustoAPIVersion | undefined; }, ], data: PayrollsGetPayStubQueryData, ): PayrollsGetPayStubQueryData | undefined { const key = queryKeyPayrollsGetPayStub(...queryKeyBase); return client.setQueryData(key, data); } export function invalidatePayrollsGetPayStub( client: QueryClient, queryKeyBase: TupleToPrefixes< [ payrollId: string, employeeId: string, parameters: { xGustoAPIVersion?: | GetV1PayrollsPayrollUuidEmployeesEmployeeUuidPayStubHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "Payrolls", "getPayStub", ...queryKeyBase, ], }); } export function invalidateAllPayrollsGetPayStub( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "Payrolls", "getPayStub"], }); }