/* * 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 { GetV1CompaniesAttachmentsHeaderXGustoAPIVersion, GetV1CompaniesAttachmentsRequest, } from "../models/operations/getv1companiesattachments.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildCompanyAttachmentsGetListQuery, CompanyAttachmentsGetListQueryData, prefetchCompanyAttachmentsGetList, queryKeyCompanyAttachmentsGetList, } from "./companyAttachmentsGetList.core.js"; export { buildCompanyAttachmentsGetListQuery, type CompanyAttachmentsGetListQueryData, prefetchCompanyAttachmentsGetList, queryKeyCompanyAttachmentsGetList, }; export type CompanyAttachmentsGetListQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get List of Company Attachments * * @remarks * Retrieve a list of all the attachments uploaded by the company. * * ### Related guides * - [Manage company attachments](doc:manage-company-attachments) * * scope: `company_attachments:read` */ export function useCompanyAttachmentsGetList( request: GetV1CompaniesAttachmentsRequest, options?: QueryHookOptions< CompanyAttachmentsGetListQueryData, CompanyAttachmentsGetListQueryError >, ): UseQueryResult< CompanyAttachmentsGetListQueryData, CompanyAttachmentsGetListQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildCompanyAttachmentsGetListQuery( client, request, options, ), ...options, }); } /** * Get List of Company Attachments * * @remarks * Retrieve a list of all the attachments uploaded by the company. * * ### Related guides * - [Manage company attachments](doc:manage-company-attachments) * * scope: `company_attachments:read` */ export function useCompanyAttachmentsGetListSuspense( request: GetV1CompaniesAttachmentsRequest, options?: SuspenseQueryHookOptions< CompanyAttachmentsGetListQueryData, CompanyAttachmentsGetListQueryError >, ): UseSuspenseQueryResult< CompanyAttachmentsGetListQueryData, CompanyAttachmentsGetListQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildCompanyAttachmentsGetListQuery( client, request, options, ), ...options, }); } export function setCompanyAttachmentsGetListData( client: QueryClient, queryKeyBase: [ companyId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesAttachmentsHeaderXGustoAPIVersion | undefined; }, ], data: CompanyAttachmentsGetListQueryData, ): CompanyAttachmentsGetListQueryData | undefined { const key = queryKeyCompanyAttachmentsGetList(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateCompanyAttachmentsGetList( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyId: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesAttachmentsHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "companyAttachments", "getList", ...queryKeyBase, ], }); } export function invalidateAllCompanyAttachmentsGetList( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "companyAttachments", "getList"], }); }