1.1.3 • Published 1 year ago

easy-airtable v1.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

EasyAirtable.js

The EasyAirtable API provides easier way of accessing your data with airtable. It provides functions like typeorm features and some complicated features.

Installation

Node.js

To install easy-airtable.js in node project:

npm install easy-airtable

Configuration

There are three variables for configure

Airtable

  • apiKey - your secret API token. Visit /create/tokens to create a personal access token. OAuth access tokens can also be used.
  • endpointUrl - the API endpoint to hit. You might want to override it if you are using an API proxy (e.g. runscope.net) to debug your API calls. (AIRTABLE_ENDPOINT_URL)
new EasyAirtable({ apiKey: 'YOUR_SECRET_API_TOKEN' })
// or
new EasyAirtable({ endpointUrl: 'https://api-airtable-com-8hw7i1oz63iz.runscope.net/' })

AirtableBase

new EasyAirtable({ apiKey: 'YOUR_SECRET_API_TOKEN' }).getBase('YOUR_BASE_ID')
// or
EasyAirtableBase.fromConfig({ apiKey: 'YOUR_SECRET_API_TOKEN', baseId: 'YOUR_BASE_ID' })

AirtableTable

new EasyAirtable({ apiKey: 'YOUR_SECRET_API_TOKEN' })
  .getTable({ baseId: 'YOUR_BASE_ID', tableId: 'YOUR_TABLE_ID' });
// or
EasyAirtableTable.fromConfig({ 
  apiKey: 'YOUR_SECRET_API_TOKEN', 
  baseId: 'YOUR_BASE_ID', 
  tableId: 'YOUR_TABLE_ID',
})

Usage

Find All

find all records in table

import { EasyAirtableTable } from 'easy-airtable';

const config = {
  apiKey: 'YOUR_SECRET_API_TOKEN',
  baseId: 'YOUR_BASE_ID',
  tableId: 'YOUR_TABLE_ID',
}
const table = EasyAirtableTable.fromConfig(config);
const allRecords = await table.findAll();

Find

find all records in specific conditions in table

import { EasyAirtableTable } from 'easy-airtable';

const config = {
  apiKey: 'YOUR_SECRET_API_TOKEN',
  baseId: 'YOUR_BASE_ID',
  tableId: 'YOUR_TABLE_ID',
}
const table = EasyAirtableTable.fromConfig(config);
const allRecords = await table.findBy({ 'FIELD_NAME1': 'MATCHING_VALUE1', 'FIELD_NAME2': 'MATCHING_VALUE2' });
1.1.3

1 year ago

1.1.2

1 year ago

1.1.1

1 year ago

1.1.0

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago