fetch
and only one dependencyCollaborators
, MultipleSelect<T>
, etc.)new Airtable()
instead of new Airtable().base()().select()...
)--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).
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",
]);
For advanced examples, view the examples.ts
file.
All options, parameters, errors, and responses are the same as on the Airtable API documentation.
querystring
: https://deno.land/std/node/querystring.tsMIT License Copyright (c) 2020 Griko Nibras