Ecosyste.ms: Awesome

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

Awesome Lists | Featured Topics | Projects

https://github.com/grikomsn/airtable-deno

Unofficial Airtable client for Deno 🦕
https://github.com/grikomsn/airtable-deno

airtable airtable-api deno

Last synced: 28 days ago
JSON representation

Unofficial Airtable client for Deno 🦕

Awesome Lists containing this project

README

        

![airtable-deno](https://raw.githubusercontent.com/grikomsn/airtable-deno/master/header.png)

![release](https://badgen.net/github/release/grikomsn/airtable-deno/)

---

- [Imports](#imports)
- [Comparison with Node.js version](#comparison-with-nodejs-version)
- [Permissions](#permissions)
- [Basic examples](#basic-examples)
- [Advanced examples](#advanced-examples)
- [Further reading](#further-reading)
- [Used by](#used-by)
- [Dependencies](#dependencies)
- [License](#license)

---

## Imports

-
-
-

## Comparison with [Node.js version](https://github.com/Airtable/airtable.js)

- Using built-in Deno `fetch` and [only one dependency](#dependencies)
- First-class support for generic field types with extra field types (`Collaborators`, `MultipleSelect`, etc.)
- Single object instance (`new Airtable()` instead of `new 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](#advanced-examples)).

## Basic examples

**Instantiate Airtable client**

```ts
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)**

```ts
const results = await airtable.select();
```

**Creating record(s)**

```ts
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(
[
{ Name: "Foo", Age: 20 },
{ Name: "Bar", Age: 15 },
],
{ typecast: true }
);
```

**Updating record(s)**

```ts
const updateOne = await airtable.update("recXXXXXXXXXXXXXX", {
Name: "Adult boi",
Age: 30,
});

const updateMultiple = await airtable.update(
[
{
id: "recXXXXXXXXXXXXXX",
fields: { Name: "Adult boi", Age: 30 },
},
{
id: "recXXXXXXXXXXXXXX",
fields: { Name: "Yung boi", Age: 15 },
},
],
{ typecast: true }
);
```

**Delete record(s)**

```ts
const deleteOne = await airtable.delete("recXXXXXXXXXXXXXX");

const deleteMultiple = await airtable.delete([
"recXXXXXXXXXXXXXX",
"recXXXXXXXXXXXXXX",
]);
```

## Advanced examples

For advanced examples, view the [`examples.ts`](./examples.ts) file.

## Further reading

All options, parameters, errors, and responses are the same as on the [Airtable API documentation](https://airtable.com/api).

## Used by

- Shrtn Deno:

## Dependencies

- `querystring`:

## License

MIT License Copyright (c) 2020 [Griko Nibras](https://github.com/grikomsn)