Class BaseServiceAbstract

Provides foundational methods for interacting with the Airtable API. This class serves as a base for more specialized Airtable service implementations. It encapsulates common operations like retrieving, creating, updating, and deleting records.

BaseService

Hierarchy (View Summary)

Constructors

Methods

Constructors

Methods

  • Protected

    Deletes a single record from the specified Airtable table using its record ID.

    Type Parameters

    • T extends BaseModel

      The type extending BaseModel representing the record to delete. Must include the id property.

    Parameters

    • token: string

      The Airtable Personal Access Token for authentication.

    • baseId: string

      The ID of the target Airtable base.

    • tableName: string

      The name or ID of the target table.

    • model: T

      The object representing the record to delete. It must include the id property.

    Returns Promise<AirtableDeletion>

    A promise that resolves to the Airtable API response confirming the deletion.

    BaseService

  • Protected

    Retrieves multiple records from a specified Airtable table, optionally applying query parameters. Maps the Airtable record structure to the provided generic type T.

    Type Parameters

    • T extends BaseModel

      The type extending BaseModel that represents the structure of the records.

    Parameters

    • token: string

      The Airtable Personal Access Token for authentication.

    • baseId: string

      The ID of the target Airtable base.

    • tableName: string

      The name or ID of the target table within the base.

    • Optionaloptions: SelectOptions

      Optional parameters for filtering, sorting, pagination, etc. See Airtable API documentation for details.

    Returns Promise<T[]>

    A promise that resolves to an array of records matching the query, cast to type T.

    BaseService

  • Protected

    Creates a single new record in the specified Airtable table.

    Type Parameters

    • T extends BaseModel

      The type extending BaseModel representing the record to create.

    Parameters

    • token: string

      The Airtable Personal Access Token for authentication.

    • baseId: string

      The ID of the target Airtable base.

    • tableName: string

      The name or ID of the target table.

    • model: T

      The data object representing the record to be created. The id property, if present, will be ignored by Airtable.

    Returns Promise<AirtableResult>

    A promise that resolves to the Airtable API response for the created record.

    BaseService

  • Protected

    Updates an existing record in the specified Airtable table using its record ID.

    Type Parameters

    • T extends BaseModel

      The type extending BaseModel representing the record to update. Must include the id property.

    Parameters

    • token: string

      The Airtable Personal Access Token for authentication.

    • baseId: string

      The ID of the target Airtable base.

    • tableName: string

      The name or ID of the target table.

    • model: T

      The data object containing the fields to update. It must include the id property of the record to update.

    Returns Promise<AirtableUpdateResult>

    A promise that resolves to the Airtable API response for the updated record.

    BaseService