Options
All
  • Public
  • Public/Protected
  • All
Menu

Class Airtable<T>

Airtable client for a single table within a base.

Type parameters

  • T

Hierarchy

  • Airtable

Implements

Index

Constructors

constructor

  • new Airtable<T>(apiKey: string, base: string, table: string): Airtable<T>
  • Creates a client for a table with Airtable.

    Type parameters

    • T

    Parameters

    • apiKey: string

      Your Airtable API Key.

    • base: string

      The Airable Base ID.

    • table: string

      The Airtable Table Name.

    Returns Airtable<T>

Properties

Private Readonly _apiKey

_apiKey: string

Private Readonly _base

_base: string

Private Readonly _table

_table: string

Methods

Private _createHeaders

  • _createHeaders(): Headers
  • Creates the appropriate headers for the Airtable API.

    Returns Headers

Private _createURL

  • _createURL(...path: string[]): URL
  • Creates an API URL for the Airtable base and table.

    Parameters

    • Rest ...path: string[]

      The path segments to include.

    Returns URL

Private _dispatch

  • _dispatch<R>(req: Request): Promise<R>
  • Dispatches a request and handles errors.

    Type parameters

    • R

    Parameters

    • req: Request

      The Request to dispatch.

    Returns Promise<R>

bulkCreate

  • bulkCreate(records: readonly Partial<T>[], typecast?: true): Promise<readonly AirtableRecord<T>[]>
  • Bulk creates a list of record.

    Parameters

    • records: readonly Partial<T>[]

      The records to create.

    • Optional typecast: true

      Whether to typecast the record.

    Returns Promise<readonly AirtableRecord<T>[]>

bulkDelete

bulkUpdate

  • bulkUpdate(records: readonly Pick<AirtableRecord<Partial<T>>, "id" | "fields">[], destructive?: boolean, typecast?: true): Promise<readonly AirtableRecord<T>[]>
  • Bulk updates records.

    Parameters

    • records: readonly Pick<AirtableRecord<Partial<T>>, "id" | "fields">[]

      The records to update.

    • destructive: boolean = false

      Whether to clear unspecified fields.

    • Optional typecast: true

      Whether to typecast the record.

    Returns Promise<readonly AirtableRecord<T>[]>

create

  • create(fields: Partial<T>, typecast?: true): Promise<AirtableRecord<T>>

delete

find

select

update

  • update(id: string, fields: Partial<T>, destructive?: boolean, typecast?: true): Promise<AirtableRecord<T>>
  • Updates a single record.

    Parameters

    • id: string

      The record ID to update.

    • fields: Partial<T>

      The fields to update.

    • destructive: boolean = false

      Whether to clear unspecified fields.

    • Optional typecast: true

      Whether to typecast the record.

    Returns Promise<AirtableRecord<T>>

Generated using TypeDoc