AsyncAirtable is a lightweight npm package to handle working with the Airtable API.
They have an existing library, but it is callback based and can get a little klunky at times, so I wrote this one that is promise based to make your life easier 😊.
I also wrote a query builder so, instead of having to write those really annyoying filter formula strings you can just use an object like:
{
where: {
name: 'AsyncAirtable',
$gte: {stars: 13}
}
}
which will generate the following filterFormula string for you: AND({name} = 'AsyncAirtable', {stars} >= 13)
Be sure get your API key
To get the base ID of your new base. You can do this by heading over to Airtable's API page and selecting that base from the list, you should see:
The ID of this base is BASE_ID
Install all dependancies:
npm install asyncairtable
Then you should be good to go!👍
If you want to use AsyncAirtable in a browser, please use the files in the ./dist
folder. There is a regular and a minified version.
They are also available via unpkg.com:
const AsyncAirtable = require('async-airtable');
const asyncAirtable = new AsyncAirtable(API_KEY, BASE_ID, { ...CONFIG });
asyncAirtable.select(TABLE_NAME, { ...OPTS }, PAGE_NUM);
asyncAirtable.find(TABLE_NAME, RECORD_ID);
asyncAirtable.createRecord(TABLE_NAME, { ...FIELDS });
asyncAirtable.updateRecord(TABLE_NAME, { id: RECORD_ID, fields {...FIELDS} });
asyncAirtable.deleteRecord(TABLE_NAME, RECORD_ID);
asyncAirtable.bulkCreate(TABLE_NAME, [
{ ...FIELDS },
{ ...FIELDS },
]);
asyncAirtable.bulkUpdate(TABLE_NAME, [
{ id: RECORD_ID, fields: {...FIELDS} },
{ id: RECORD_ID, fields: {...FIELDS} },
{ id: RECORD_ID, fields: {...FIELDS} },
]);
asyncAirtable.bulkDelete(TABLE_NAME, [
RECORD_ID,
RECORD_ID,
RECORD_ID,
RECORD_ID,
]);
To setup documentation run:
npm run doc
This will generate a docs folder. Just open or serve index.html and you will have the docs!
You can also view them online.
Generated using TypeDoc