👋
Welcome to @raniel/airtable
Simple Airtable service for Angular applications.
Install in your Angular app
npm i @raniel/airtable
Setup
Add the HttpClientModule to imports array in your app.module.ts, using the following import:
import {HttpClientModule} from '@angular/common/http';
Injects the AirtableService in a constructor like this:
constructor(private airtable: AirtableService) {}
Set your api key and database id to airtable service variables:
this.airtable.apiKey = 'YOUR_AIRTABLE_API_KEY';
this.airtable.dbId = 'YOUR_AIRTABLE_DATABASE_ID';
Usage
// get all rows from your table
this.airtable.getList('your_table_name').subscribe(response => {
console.log(response);
});
// get a table row from a field value
this.airtable.getListByFieldValue('your_table_name', 'field_name', 'field_value').subscribe(response => {
console.log(response);
});
// get a table row from its id
this.airtable.getRecord('your_table_name', 'recN1pdRLKOt5R0rs').subscribe(response => {
console.log(response);
});
// delete rows given their id
this.airtable.doDelete('your_table_name', ['recMPsjsJGUOsz3gz', 'rec5UKOJL1jkAlPBB', 'recRjKYjaBvtDS4UW']).subscribe(response => {
console.log(response);
});
// insert a row in your table
this.airtable.doInsert('your_table_name', {
field1: 'field1 value',
field2: 'field2 value',
...
fieldN: 'fieldN value'
}).subscribe(response => {
console.log(response);
});
// alter the values of a row given its id
this.airtable.doUpdate('your_table_name', 'recN1pdRLKOt5R0rs', {
fieldName: 'new field value',
}).subscribe(response => {
console.log(response);
});
// clear the table (be careful!)
this.airtable.doTruncate('your_table_name');
Author
- Github: @raniel86
- Twitter: @raniel86
- LinkedIn: @danielesabre
🤝 Contributing
Contributions, issues and feature requests are welcome!
Feel free to check issues page.
Show your support
Give a
📝 License
Copyright © 2020 Daniele Sabre (https://github.com/raniel86).
This project is MIT licensed.
This README was generated with