/* * 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 { GetV1CompaniesAttachmentUrlHeaderXGustoAPIVersion, GetV1CompaniesAttachmentUrlRequest, } from "../models/operations/getv1companiesattachmenturl.js"; import { useGustoEmbeddedContext } from "./_context.js"; import { QueryHookOptions, SuspenseQueryHookOptions, TupleToPrefixes, } from "./_types.js"; import { buildCompanyAttachmentGetDownloadUrlQuery, CompanyAttachmentGetDownloadUrlQueryData, prefetchCompanyAttachmentGetDownloadUrl, queryKeyCompanyAttachmentGetDownloadUrl, } from "./companyAttachmentGetDownloadUrl.core.js"; export { buildCompanyAttachmentGetDownloadUrlQuery, type CompanyAttachmentGetDownloadUrlQueryData, prefetchCompanyAttachmentGetDownloadUrl, queryKeyCompanyAttachmentGetDownloadUrl, }; export type CompanyAttachmentGetDownloadUrlQueryError = | NotFoundErrorObject | GustoEmbeddedError | ResponseValidationError | ConnectionError | RequestAbortedError | RequestTimeoutError | InvalidRequestError | UnexpectedClientError | SDKValidationError; /** * Get a temporary url to download the Company Attachment file * * @remarks * Retrieve a temporary url to download an attachment file uploaded by the company. * * ### Related guides * - [Manage company attachments](doc:manage-company-attachments) * * scope: `company_attachments:read` */ export function useCompanyAttachmentGetDownloadUrl( request: GetV1CompaniesAttachmentUrlRequest, options?: QueryHookOptions< CompanyAttachmentGetDownloadUrlQueryData, CompanyAttachmentGetDownloadUrlQueryError >, ): UseQueryResult< CompanyAttachmentGetDownloadUrlQueryData, CompanyAttachmentGetDownloadUrlQueryError > { const client = useGustoEmbeddedContext(); return useQuery({ ...buildCompanyAttachmentGetDownloadUrlQuery( client, request, options, ), ...options, }); } /** * Get a temporary url to download the Company Attachment file * * @remarks * Retrieve a temporary url to download an attachment file uploaded by the company. * * ### Related guides * - [Manage company attachments](doc:manage-company-attachments) * * scope: `company_attachments:read` */ export function useCompanyAttachmentGetDownloadUrlSuspense( request: GetV1CompaniesAttachmentUrlRequest, options?: SuspenseQueryHookOptions< CompanyAttachmentGetDownloadUrlQueryData, CompanyAttachmentGetDownloadUrlQueryError >, ): UseSuspenseQueryResult< CompanyAttachmentGetDownloadUrlQueryData, CompanyAttachmentGetDownloadUrlQueryError > { const client = useGustoEmbeddedContext(); return useSuspenseQuery({ ...buildCompanyAttachmentGetDownloadUrlQuery( client, request, options, ), ...options, }); } export function setCompanyAttachmentGetDownloadUrlData( client: QueryClient, queryKeyBase: [ companyId: string, companyAttachmentUuid: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesAttachmentUrlHeaderXGustoAPIVersion | undefined; }, ], data: CompanyAttachmentGetDownloadUrlQueryData, ): CompanyAttachmentGetDownloadUrlQueryData | undefined { const key = queryKeyCompanyAttachmentGetDownloadUrl(...queryKeyBase); return client.setQueryData( key, data, ); } export function invalidateCompanyAttachmentGetDownloadUrl( client: QueryClient, queryKeyBase: TupleToPrefixes< [ companyId: string, companyAttachmentUuid: string, parameters: { xGustoAPIVersion?: | GetV1CompaniesAttachmentUrlHeaderXGustoAPIVersion | undefined; }, ] >, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: [ "@gusto/embedded-api", "companyAttachment", "getDownloadUrl", ...queryKeyBase, ], }); } export function invalidateAllCompanyAttachmentGetDownloadUrl( client: QueryClient, filters?: Omit, ): Promise { return client.invalidateQueries({ ...filters, queryKey: ["@gusto/embedded-api", "companyAttachment", "getDownloadUrl"], }); }