import { connectWiseApi } from "../../constants"; import { Company } from "../../types/ConnectWiseTypes"; import { withCwRetry } from "./withCwRetry"; export const fetchCwCompanyById = async ( companyId: number, ): Promise => { try { const response = await withCwRetry( () => connectWiseApi.get(`/company/companies/${companyId}`), { label: `fetchCompany#${companyId}`, maxAttempts: 3, baseDelayMs: 1_500, }, ); return response.data; } catch (error) { console.error( `Error fetching company with ID ${companyId}:`, (error as any).response?.data || error, ); return null; } };