mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00: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:
@@ -241,6 +241,7 @@ export class NotionV2 implements INodeType {
|
|||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
const blockId = extractPageId(this.getNodeParameter('blockId', i) as string);
|
const blockId = extractPageId(this.getNodeParameter('blockId', i) as string);
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
|
|
||||||
if (returnAll) {
|
if (returnAll) {
|
||||||
responseData = await notionApiRequestAllItems.call(this, 'results', 'GET', `/blocks/${blockId}/children`, {});
|
responseData = await notionApiRequestAllItems.call(this, 'results', 'GET', `/blocks/${blockId}/children`, {});
|
||||||
} else {
|
} else {
|
||||||
@@ -248,6 +249,9 @@ export class NotionV2 implements INodeType {
|
|||||||
responseData = await notionApiRequest.call(this, 'GET', `/blocks/${blockId}/children`, {}, qs);
|
responseData = await notionApiRequest.call(this, 'GET', `/blocks/${blockId}/children`, {}, qs);
|
||||||
responseData = responseData.results;
|
responseData = responseData.results;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
responseData = responseData.map((_data: IDataObject) => ({ object: _data.object, parent_id: blockId, ..._data }));
|
||||||
|
|
||||||
returnData.push.apply(returnData, responseData);
|
returnData.push.apply(returnData, responseData);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user