mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-24 20:24:05 -08:00
⚡ Add parent id to children blocks on Notion node (#2850)
* [Notion] Adds possibility to return blocks as an array
* ⚡ add parent id to response
Co-authored-by: Ugo Bataillard <ugopublic@bataillard.me>
This commit is contained in:
parent
db2af7effb
commit
4df958807d
|
@ -241,6 +241,7 @@ export class NotionV2 implements INodeType {
|
|||
for (let i = 0; i < length; i++) {
|
||||
const blockId = extractPageId(this.getNodeParameter('blockId', i) as string);
|
||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||
|
||||
if (returnAll) {
|
||||
responseData = await notionApiRequestAllItems.call(this, 'results', 'GET', `/blocks/${blockId}/children`, {});
|
||||
} else {
|
||||
|
@ -248,6 +249,9 @@ export class NotionV2 implements INodeType {
|
|||
responseData = await notionApiRequest.call(this, 'GET', `/blocks/${blockId}/children`, {}, qs);
|
||||
responseData = responseData.results;
|
||||
}
|
||||
|
||||
responseData = responseData.map((_data: IDataObject) => ({ object: _data.object, parent_id: blockId, ..._data }));
|
||||
|
||||
returnData.push.apply(returnData, responseData);
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue