From 5a214fb4aae73c36837eede6bac67a06910b8281 Mon Sep 17 00:00:00 2001 From: Mike Quinlan Date: Mon, 8 Mar 2021 10:01:39 -0700 Subject: [PATCH] :sparkles: Adding Box API folder:get functionality (#1512) --- packages/nodes-base/nodes/Box/Box.node.ts | 6 +++++ .../nodes-base/nodes/Box/FolderDescription.ts | 25 +++++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/packages/nodes-base/nodes/Box/Box.node.ts b/packages/nodes-base/nodes/Box/Box.node.ts index 4483c4e387..8a835451b0 100644 --- a/packages/nodes-base/nodes/Box/Box.node.ts +++ b/packages/nodes-base/nodes/Box/Box.node.ts @@ -310,6 +310,12 @@ export class Box implements INodeType { responseData = { success: true }; returnData.push(responseData as IDataObject); } + // https://developer.box.com/reference/get-folders-id/ + if (operation === 'get') { + const folderId = this.getNodeParameter('folderId', i) as string; + responseData = await boxApiRequest.call(this, 'GET', `/folders/${folderId}`, qs); + returnData.push(responseData as IDataObject); + } // https://developer.box.com/reference/get-search/ if (operation === 'search') { const query = this.getNodeParameter('query', i) as string; diff --git a/packages/nodes-base/nodes/Box/FolderDescription.ts b/packages/nodes-base/nodes/Box/FolderDescription.ts index c1a1fe8c53..5e944b25d1 100644 --- a/packages/nodes-base/nodes/Box/FolderDescription.ts +++ b/packages/nodes-base/nodes/Box/FolderDescription.ts @@ -20,6 +20,11 @@ export const folderOperations = [ value: 'create', description: 'Create a folder', }, + { + name: 'Get', + value: 'get', + description: 'Get a folder', + }, { name: 'Delete', value: 'delete', @@ -122,6 +127,26 @@ export const folderFields = [ ], }, + /* -------------------------------------------------------------------------- */ + /* folder:get */ + /* -------------------------------------------------------------------------- */ + { + displayName: 'Folder ID', + name: 'folderId', + type: 'string', + displayOptions: { + show: { + operation: [ + 'get', + ], + resource: [ + 'folder', + ], + }, + }, + default: '', + description: 'Folder ID', + }, /* -------------------------------------------------------------------------- */ /* folder:delete */ /* -------------------------------------------------------------------------- */