MadKudu / node-hubspot

Node wrapper for the HubSpot API
MIT License
192 stars 157 forks source link

Expose `request` method publically #168

Closed dobesv closed 5 years ago

dobesv commented 5 years ago

When an API is not "wrapped" with a specific call in this package, it can still be handy to use the request wrapper you have created, currently called _request to make the request. This benefits from the bottleneck throttling and request parsing and formatting.

For example, the "batch association" endpoint doesn't have a wrapper defined in this package, but I can still call it like this:

(hubspot as any)
          ._request({
            method: 'PUT',
            path: '/crm-associations/v1/associations/create-batch',
            body: batch,
          })

It would be nice if this method were part of the public API and declared in the typescript definitions.

pcothenet commented 5 years ago

@dobesv this is a great idea!

pcothenet commented 5 years ago

@dobesv this is doable today with _request today, correct?. Are you recommending we rename it as request?

dobesv commented 5 years ago

@pcothenet I guess my idea was to:

  1. Add it to the documentation
  2. Add it to the typescript definitions

It might make sense to rename it as well, if the reason for the leading underscore is to indicate that it's "private". The underscore could also be interpreted to mean you don't want it to conflict with some other naming convention from HubSpot, though. I'm not personally concerned about that part.