Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/kyeotic/airtable

An alternate airtable client
https://github.com/kyeotic/airtable

Last synced: about 1 month ago
JSON representation

An alternate airtable client

Awesome Lists containing this project

README

        

# @kyeotic/airtable

This is alternative to the largely undocumented, and slightly unconventional, [official client](https://github.com/Airtable/airtable.js). This library is _heavily_ inspired by the official client.

# Installation

```
npm install @kyeotic/airtable
```

# Quick Start

```javascript
const { Client } = require('@kyeotic/airtable')
const client = new Client({
apiKey: string,
baseUrl: string
})
const myTable = client.base(baseId).table(tableName)

let query = myTable.query({ view: 'Grid View' })

// --- Paging ---

// AsyncIterator paging
for await (let page of query()) {
console.log(page) /* {
records: [Record],
offset: string
}*/
}

// Auto paging
let records = await query.all()

// Stream paging
await query.eachPage(async page => {
await processPage(page.records)
})

// --- CRUD ---

/* Record: {
id: string,
fields: {},
createdOn: Datetime
} */

let dbItem = await myTable.get(recordId)
let newItem = await myTable.create(record)
let updated = await myTable.update({ ...newItem.fields, name: 'updated' })
await myTable.delete(recordId)
```

# API

The Typedoc generated docs are hosted [here](https://kyeotic.github.io/airtable/)