/* * 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 { GetV1EmployeeFormHeaderXGustoAPIVersion, GetV1EmployeeFormRequest, } from "../models/operations/getv1employeeform.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildEmployeeFormsGetQuery, EmployeeFormsGetQueryData, prefetchEmployeeFormsGet, queryKeyEmployeeFormsGet, } from "./employeeFormsGet.core.js"; export { buildEmployeeFormsGetQuery, type EmployeeFormsGetQueryData, prefetchEmployeeFormsGet, queryKeyEmployeeFormsGet, }; export type EmployeeFormsGetQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get an employee form * * @remarks * Get an employee form * * scope: `employee_forms:read` */ export function useEmployeeFormsGet( request: GetV1EmployeeFormRequest, options?: QueryHookOptions< EmployeeFormsGetQueryData, EmployeeFormsGetQueryError >, ): UseQueryResult { const client = useGustoEmbeddedContext(); return useQuery({ ...buildEmployeeFormsGetQuery( client, request, options, ), ...options, }); } /** * Get an employee form * * @remarks * Get an employee form * * scope: `employee_forms:read` */ export function useEmployeeFormsGetSuspense( request: GetV1EmployeeFormRequest, options?: SuspenseQueryHookOptions< EmployeeFormsGetQueryData, EmployeeFormsGetQueryError >, ): UseSuspenseQueryResult< EmployeeFormsGetQueryData, EmployeeFormsGetQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildEmployeeFormsGetQuery( client, request, options, ), ...options, }); } export function setEmployeeFormsGetData( client: QueryClient, queryKeyBase: [ employeeId: string, formId: string, parameters: { xGustoAPIVersion?: GetV1EmployeeFormHeaderXGustoAPIVersion | undefined; }, ], data: EmployeeFormsGetQueryData, ): EmployeeFormsGetQueryData | undefined { const key = queryKeyEmployeeFormsGet(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateEmployeeFormsGet( client: QueryClient, queryKeyBase: TupleToPrefixes< [ employeeId: string, formId: string, parameters: { xGustoAPIVersion?: GetV1EmployeeFormHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "employeeForms", "get", ...queryKeyBase], }); } export function invalidateAllEmployeeFormsGet( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "employeeForms", "get"], }); }