Properties

Methods

Properties

entries: ListEntries

Methods

  • Returns a collection of all the lists visible to you.

    Returns Promise<ListResponse[]>

    An array of all the list resources for lists visible to you. Each list resource in the array includes the id, name, and type.

    const lists = await affinity.lists.all()
    console.log(`The first of ${lists.length} list is named`, lists?.[0].name)
  • Creates a new list with the specified properties.

    Parameters

    Returns Promise<SingleListResponse>

    The newly created list resource.

    const list = await affinity.lists.create({
    name: 'My List of Organizations',
    type: ListType.ORGANIZATION,
    is_public: true,
    })
    console.log('The ID of the newly created list is', list.id)
  • Gets the details for a specific list given the existing list id.

    Parameters

    Returns Promise<SingleListResponse>

    The details of the list resource corresponding to the list ID specified in the path parameter. These details include an array of the fields that are specific to this list. An appropriate error is returned if an invalid list is supplied.

    const list = await affinity.lists.get({ list_id: 123 })
    console.log('The name of the list is', list.name)