UNPKG

quickbooks-api

Version:

A modular TypeScript SDK for seamless integration with Intuit QuickBooks APIs. Provides robust authentication handling and future-ready foundation for accounting, payments, and commerce operations.

27 lines (26 loc) 852 B
/** * Get Estimate by ID * @param this - The Estimate API * @param id - The ID of the estimate * @returns The Estimate */ export async function getEstimateById(id, options = {}) { // Get the Query Builder const queryBuilder = await this.getQueryBuilder(); // Setup ID Filter queryBuilder.whereId(id); // Setup the Search Options (if provided) if (options.searchOptions) queryBuilder.setSearchOptions(options.searchOptions); // Setup the URL const url = queryBuilder.build(); // Get the Estimate const response = await this.apiClient.runRequest(url, { method: 'GET' }); // Check if the Response Failed to find an Estimate if (!response) return null; // Format the Response const estimates = this.formatResponse(response); // Return the Estimate return estimates[0]; }