/* * 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 { GetV1CompanyFormsHeaderXGustoAPIVersion, GetV1CompanyFormsRequest, } from "../models/operations/getv1companyforms.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildCompanyFormsGetAllQuery, CompanyFormsGetAllQueryData, prefetchCompanyFormsGetAll, queryKeyCompanyFormsGetAll, } from "./companyFormsGetAll.core.js"; export { buildCompanyFormsGetAllQuery, type CompanyFormsGetAllQueryData, prefetchCompanyFormsGetAll, queryKeyCompanyFormsGetAll, }; export type CompanyFormsGetAllQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get all company forms * * @remarks * Get a list of all company's forms * * ### Related guides * - [Company Forms](doc:company-form) * * scope: `company_forms:read` */ export function useCompanyFormsGetAll( request: GetV1CompanyFormsRequest, options?: QueryHookOptions< CompanyFormsGetAllQueryData, CompanyFormsGetAllQueryError >, ): UseQueryResult { const client = useGustoEmbeddedContext(); return useQuery({ ...buildCompanyFormsGetAllQuery( client, request, options, ), ...options, }); } /** * Get all company forms * * @remarks * Get a list of all company's forms * * ### Related guides * - [Company Forms](doc:company-form) * * scope: `company_forms:read` */ export function useCompanyFormsGetAllSuspense( request: GetV1CompanyFormsRequest, options?: SuspenseQueryHookOptions< CompanyFormsGetAllQueryData, CompanyFormsGetAllQueryError >, ): UseSuspenseQueryResult< CompanyFormsGetAllQueryData, CompanyFormsGetAllQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildCompanyFormsGetAllQuery( client, request, options, ), ...options, }); } export function setCompanyFormsGetAllData( client: QueryClient, queryKeyBase: [ companyId: string, parameters: { xGustoAPIVersion?: GetV1CompanyFormsHeaderXGustoAPIVersion | undefined; sortBy?: string | undefined; page?: number | undefined; per?: number | undefined; }, ], data: CompanyFormsGetAllQueryData, ): CompanyFormsGetAllQueryData | undefined { const key = queryKeyCompanyFormsGetAll(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateCompanyFormsGetAll( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyId: string, parameters: { xGustoAPIVersion?: GetV1CompanyFormsHeaderXGustoAPIVersion | undefined; sortBy?: string | undefined; page?: number | undefined; per?: number | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "companyForms", "getAll", ...queryKeyBase, ], }); } export function invalidateAllCompanyFormsGetAll( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "companyForms", "getAll"], }); }