If it helps I found that we can call any API using something like this:
async function getLineItems(dealId) {
showApiCall('Calling /crm/v3/associations/deal/line_items/batch/read API method. id:', dealId);
let apiResponse = await hubSpotClient.apiRequest({
method: 'POST',
path: '/crm/v3/associations/deal/line_items/batch/read',
body: { inputs: [{ id: dealId }] },
});
return apiResponse.body;
}
Then we can call it and loop through linked line items like:
let deals = await getDeals(companyId).catch(e => { showError(e) });
let requestStatus = deals.status;
// TODO: handle retrieving more than one page of deals
if (deals.results.length > 0) {
let result = deals.results[0];
let to = result.to;
to.forEach(async function (deal) {
let dealId = deal.id;
....
So we can use the client modeule even though it has not been configured for all end points.
The endpoints I have worked out so far as the nice and simple ones like:
apiResponse = await hubSpotClient.crm.companies.basicApi.getById(id);
apiResponse = await hubSpotClient.crm.deals.basicApi.getById(id);
apiResponse = await hubSpotClient.crm.lineItems.basicApi.getById(id);
apiResponse = await hubSpotClient.crm.products.basicApi.getById(id);
// the pattern becomes obvious after a while 🙂
Still would have been nice to read this in a simple doc page somwhere.. which Im sure exists…