- Imports
- Comparison with Node.js version
- Permissions
- Basic examples
- Advanced examples
- Further reading
- Used by
- Dependencies
- License
Imports
- https://deno.land/x/airtable@v1.0.2/mod.ts
- https://denoland.id/x/airtable@v1.0.2/mod.ts
- https://denopkg.com/grikomsn/airtable-deno@v1.0.2/mod.ts
Node.js version
Comparison with- Using built-in Deno
fetch
and only one dependency - First-class support for generic field types with extra field types (
Collaborators
,MultipleSelect<T>
, etc.) - Single object instance (
new Airtable()
instead ofnew Airtable().base()().select()...
)
Permissions
--allow-net
Network access for
fetch
ing and requesting datas to Airtable API endpoints.--allow-env
(optional)Configuring Airtable options via environment variables instead of passing values (see advanced examples).
Basic examples
Instantiate Airtable client
import { Airtable } from "https://deno.land/x/airtable/mod.ts";
const airtable = new Airtable({
apiKey: "keyXXXXXXXXXXXXXX",
baseId: "appXXXXXXXXXXXXXX",
tableName: "Some table name",
});
Select record(s)
const results = await airtable.select();
Creating record(s)
const createOne = await airtable.create({
Name: "Griko Nibras",
Age: 25,
});
import { Field } from "https://deno.land/x/airtable/mod.ts";
type Fields = {
Name: string;
Age: number;
Active?: Field.Checkbox;
};
const createMultiple = await airtable.create<Fields>(
[
{ Name: "Foo", Age: 20 },
{ Name: "Bar", Age: 15 },
],
{ typecast: true }
);
Updating record(s)
const updateOne = await airtable.update<Fields>("recXXXXXXXXXXXXXX", {
Name: "Adult boi",
Age: 30,
});
const updateMultiple = await airtable.update<Fields>(
[
{
id: "recXXXXXXXXXXXXXX",
fields: { Name: "Adult boi", Age: 30 },
},
{
id: "recXXXXXXXXXXXXXX",
fields: { Name: "Yung boi", Age: 15 },
},
],
{ typecast: true }
);
Delete record(s)
const deleteOne = await airtable.delete("recXXXXXXXXXXXXXX");
const deleteMultiple = await airtable.delete([
"recXXXXXXXXXXXXXX",
"recXXXXXXXXXXXXXX",
]);
Advanced examples
For advanced examples, view the examples.ts
file.
Further reading
All options, parameters, errors, and responses are the same as on the Airtable API documentation.
Used by
- Shrtn Deno: https://github.com/grikomsn/shrtn-deno
Dependencies
querystring
: https://deno.land/std/node/querystring.ts
License
MIT License Copyright (c) 2020 Griko Nibras