GV14982 / async-airtable

A lightweight npm package to handle working with the Airtable API.
https://www.npmjs.com/package/asyncairtable
MIT License
54 stars 5 forks source link

Allow the base URL for API calls to be customized #56

Closed MoralCode closed 3 years ago

MoralCode commented 3 years ago

I didn't see any documentation for this behavior and it seemed easy enough to add.

The Airtable API docs say that API calls are limited to 5 requests per base per second with a 30 second cooldown if you violate it. The docs suggest setting up a caching proxy to get around this, which would require changing the baseURL that API calls are made against.

This PR adds a baseURL option to the Config object passed into the AsyncAirtable constructor to override the default baseURL value.

MoralCode commented 3 years ago

If usage examples would help, this feature is currently part of a custom version of async-airtable that merges this branch and https://github.com/VacFind/VacFind-site/pull/2/commits/f56cd7118bdf75119ef7cababec9435ef0509812.

GV14982 commented 3 years ago

This looks good. I'll get this into the next release.

MoralCode commented 3 years ago

hmmm, despite updating the @types.ts file for this change, it seems like im getting an error when trying to specify the baseURL in a Config object.

Did I do something wrong? i'm using the latest version (2.1.0) from npm

Screenshot_20210223_091736

GV14982 commented 3 years ago

Hey there, I haven't pushed a full release yet, only the develop one on the @next tag. I'll be pushing a regular release later this week, but there are a few more features I want to get added first.