makenotion / notion-sdk-js

Official Notion JavaScript Client
https://developers.notion.com/docs
MIT License
4.96k stars 593 forks source link

Reading a "Person" property from a database entry returns only the first result #478

Open aDogCalledSpot opened 12 months ago

aDogCalledSpot commented 12 months ago

Describe the bug Fetching a "Persons" property from a database entry (e.g. "Assignees") returns only the first person as an object instead of returning a list of people.

Setting the property strangely enough demands a list of people instead of just a single value (which is more in line with the expected behavior).

To Reproduce Node version: ts-node version 10.9.1 Notion JS library version: 2.2.13

Steps to reproduce the behavior:

const response = await notion.pages.properties.retrieve({
        page_id: pageId,
        property_id: "Assignees"
    }) as any;
    console.log(response.results);

returns

[
  {
    object: 'property_item',
    type: 'people',
    id: 'Assignees',
    people: { object: 'user', id: 'abcdefdeadbeef123' }
// no array ^-----------------------------------------^
  }
]

Expected behavior

[
  {
    object: 'property_item',
    type: 'people',
    id: 'Assignees',
    people: [{ object: 'user', id: 'abcdefdeadbeef123' }]
// array ---^-------------------------------------------^
  }
]