Methods

Methods

  • Returns all fields based on the provided query parameters.

    Parameters

    Returns Promise<FieldResponse>

    A promise that resolves to an array of field objects.

    const fields = await affinity.fields.all({
    list_id: 123,
    value_type: FieldValueType.TEXT,
    entity_type: ListType.PERSON,
    with_modified_names: true,
    })
    console.log(fields)
  • Creates a new field.

    Parameters

    Returns Promise<FieldResponse>

    The created field object.

    const newField = await affinity.fields.create({
    name: '[Deals] Amount',
    entity_type: 1,
    value_type: 3,
    list_id: 11,
    allows_multiple: false,
    is_list_specific: true,
    is_required: false
    })
    console.log(newField)
  • Deletes a specific field.

    Parameters

    Returns Promise<boolean>

    boolean indicating whether the field was successfully deleted.

    const success = await affinity.fields.delete({ field_id: 1234 })
    console.log(success ? 'Field deleted': 'Field not deleted')