/* * 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 { GetV1CompaniesAttachmentHeaderXGustoAPIVersion, GetV1CompaniesAttachmentRequest, } from "../models/operations/getv1companiesattachment.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildCompanyAttachmentsGetDetailsQuery, CompanyAttachmentsGetDetailsQueryData, prefetchCompanyAttachmentsGetDetails, queryKeyCompanyAttachmentsGetDetails, } from "./companyAttachmentsGetDetails.core.js"; export { buildCompanyAttachmentsGetDetailsQuery, type CompanyAttachmentsGetDetailsQueryData, prefetchCompanyAttachmentsGetDetails, queryKeyCompanyAttachmentsGetDetails, }; export type CompanyAttachmentsGetDetailsQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get Company Attachment Details * * @remarks * Retrieve the detail of an attachment uploaded by the company. * * ### Related guides * - [Manage company attachments](doc:manage-company-attachments) * * scope: `company_attachments:read` */ export function useCompanyAttachmentsGetDetails( request: GetV1CompaniesAttachmentRequest, options?: QueryHookOptions< CompanyAttachmentsGetDetailsQueryData, CompanyAttachmentsGetDetailsQueryError >, ): UseQueryResult< CompanyAttachmentsGetDetailsQueryData, CompanyAttachmentsGetDetailsQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildCompanyAttachmentsGetDetailsQuery( client, request, options, ), ...options, }); } /** * Get Company Attachment Details * * @remarks * Retrieve the detail of an attachment uploaded by the company. * * ### Related guides * - [Manage company attachments](doc:manage-company-attachments) * * scope: `company_attachments:read` */ export function useCompanyAttachmentsGetDetailsSuspense( request: GetV1CompaniesAttachmentRequest, options?: SuspenseQueryHookOptions< CompanyAttachmentsGetDetailsQueryData, CompanyAttachmentsGetDetailsQueryError >, ): UseSuspenseQueryResult< CompanyAttachmentsGetDetailsQueryData, CompanyAttachmentsGetDetailsQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildCompanyAttachmentsGetDetailsQuery( client, request, options, ), ...options, }); } export function setCompanyAttachmentsGetDetailsData( client: QueryClient, queryKeyBase: [ companyId: string, companyAttachmentUuid: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesAttachmentHeaderXGustoAPIVersion | undefined; }, ], data: CompanyAttachmentsGetDetailsQueryData, ): CompanyAttachmentsGetDetailsQueryData | undefined { const key = queryKeyCompanyAttachmentsGetDetails(...queryKeyBase); return client.setQueryData(key, data); } export function invalidateCompanyAttachmentsGetDetails( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyId: string, companyAttachmentUuid: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesAttachmentHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "companyAttachments", "getDetails", ...queryKeyBase, ], }); } export function invalidateAllCompanyAttachmentsGetDetails( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "companyAttachments", "getDetails"], }); }