mirror of
https://github.com/n8n-io/n8n.git
synced 2025-01-12 13:27:31 -08:00
⚡ Minor improvements to Box Node
This commit is contained in:
parent
8370940713
commit
d726e11af4
|
@ -84,7 +84,7 @@ export class Box implements INodeType {
|
||||||
const operation = this.getNodeParameter('operation', 0) as string;
|
const operation = this.getNodeParameter('operation', 0) as string;
|
||||||
for (let i = 0; i < length; i++) {
|
for (let i = 0; i < length; i++) {
|
||||||
if (resource === 'file') {
|
if (resource === 'file') {
|
||||||
//https://developer.box.com/reference/post-files-id-copy
|
// https://developer.box.com/reference/post-files-id-copy
|
||||||
if (operation === 'copy') {
|
if (operation === 'copy') {
|
||||||
const fileId = this.getNodeParameter('fileId', i) as string;
|
const fileId = this.getNodeParameter('fileId', i) as string;
|
||||||
const parentId = this.getNodeParameter('parentId', i) as string;
|
const parentId = this.getNodeParameter('parentId', i) as string;
|
||||||
|
@ -108,14 +108,14 @@ export class Box implements INodeType {
|
||||||
|
|
||||||
returnData.push(responseData as IDataObject);
|
returnData.push(responseData as IDataObject);
|
||||||
}
|
}
|
||||||
//https://developer.box.com/reference/delete-files-id
|
// https://developer.box.com/reference/delete-files-id
|
||||||
if (operation === 'delete') {
|
if (operation === 'delete') {
|
||||||
const fileId = this.getNodeParameter('fileId', i) as string;
|
const fileId = this.getNodeParameter('fileId', i) as string;
|
||||||
responseData = await boxApiRequest.call(this, 'DELETE', `/files/${fileId}`);
|
responseData = await boxApiRequest.call(this, 'DELETE', `/files/${fileId}`);
|
||||||
responseData = { success: true };
|
responseData = { success: true };
|
||||||
returnData.push(responseData as IDataObject);
|
returnData.push(responseData as IDataObject);
|
||||||
}
|
}
|
||||||
//https://developer.box.com/reference/get-files-id-content
|
// https://developer.box.com/reference/get-files-id-content
|
||||||
if (operation === 'download') {
|
if (operation === 'download') {
|
||||||
const fileId = this.getNodeParameter('fileId', i) as string;
|
const fileId = this.getNodeParameter('fileId', i) as string;
|
||||||
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i) as string;
|
const dataPropertyNameDownload = this.getNodeParameter('binaryPropertyName', i) as string;
|
||||||
|
@ -149,7 +149,7 @@ export class Box implements INodeType {
|
||||||
|
|
||||||
items[i].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data as unknown as Buffer, fileName, mimeType);
|
items[i].binary![dataPropertyNameDownload] = await this.helpers.prepareBinaryData(data as unknown as Buffer, fileName, mimeType);
|
||||||
}
|
}
|
||||||
//https://developer.box.com/reference/get-files-id
|
// https://developer.box.com/reference/get-files-id
|
||||||
if (operation === 'get') {
|
if (operation === 'get') {
|
||||||
const fileId = this.getNodeParameter('fileId', i) as string;
|
const fileId = this.getNodeParameter('fileId', i) as string;
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
@ -159,7 +159,7 @@ export class Box implements INodeType {
|
||||||
responseData = await boxApiRequest.call(this, 'GET', `/files/${fileId}`, {}, qs);
|
responseData = await boxApiRequest.call(this, 'GET', `/files/${fileId}`, {}, qs);
|
||||||
returnData.push(responseData as IDataObject);
|
returnData.push(responseData as IDataObject);
|
||||||
}
|
}
|
||||||
//https://developer.box.com/reference/get-search/
|
// https://developer.box.com/reference/get-search/
|
||||||
if (operation === 'search') {
|
if (operation === 'search') {
|
||||||
const query = this.getNodeParameter('query', i) as string;
|
const query = this.getNodeParameter('query', i) as string;
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
|
@ -198,7 +198,7 @@ export class Box implements INodeType {
|
||||||
}
|
}
|
||||||
returnData.push.apply(returnData, responseData as IDataObject[]);
|
returnData.push.apply(returnData, responseData as IDataObject[]);
|
||||||
}
|
}
|
||||||
//https://developer.box.com/reference/post-files-content
|
// https://developer.box.com/reference/post-files-content
|
||||||
if (operation === 'upload') {
|
if (operation === 'upload') {
|
||||||
const parentId = this.getNodeParameter('parentId', i) as string;
|
const parentId = this.getNodeParameter('parentId', i) as string;
|
||||||
const isBinaryData = this.getNodeParameter('binaryData', i) as boolean;
|
const isBinaryData = this.getNodeParameter('binaryData', i) as boolean;
|
||||||
|
@ -207,7 +207,7 @@ export class Box implements INodeType {
|
||||||
const attributes: IDataObject = {};
|
const attributes: IDataObject = {};
|
||||||
|
|
||||||
if (parentId !== '') {
|
if (parentId !== '') {
|
||||||
attributes['parent'] = { id: parentId };
|
attributes['parent'] = { id: parentId };
|
||||||
} else {
|
} else {
|
||||||
// if not parent defined save it on the root directory
|
// if not parent defined save it on the root directory
|
||||||
attributes['parent'] = { id: 0 };
|
attributes['parent'] = { id: 0 };
|
||||||
|
@ -264,14 +264,14 @@ export class Box implements INodeType {
|
||||||
contentType: 'text/plain',
|
contentType: 'text/plain',
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
responseData = await boxApiRequest.call(this, 'POST', '', {} , {}, 'https://upload.box.com/api/2.0/files/content', { formData: body });
|
responseData = await boxApiRequest.call(this, 'POST', '', {}, {}, 'https://upload.box.com/api/2.0/files/content', { formData: body });
|
||||||
|
|
||||||
returnData.push.apply(returnData, responseData.entries as IDataObject[]);
|
returnData.push.apply(returnData, responseData.entries as IDataObject[]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
if (resource === 'folder') {
|
if (resource === 'folder') {
|
||||||
//https://developer.box.com/reference/post-folders
|
// https://developer.box.com/reference/post-folders
|
||||||
if (operation === 'create') {
|
if (operation === 'create') {
|
||||||
const name = this.getNodeParameter('name', i) as string;
|
const name = this.getNodeParameter('name', i) as string;
|
||||||
const parentId = this.getNodeParameter('parentId', i) as string;
|
const parentId = this.getNodeParameter('parentId', i) as string;
|
||||||
|
@ -300,7 +300,7 @@ export class Box implements INodeType {
|
||||||
|
|
||||||
returnData.push(responseData);
|
returnData.push(responseData);
|
||||||
}
|
}
|
||||||
//https://developer.box.com/reference/delete-folders-id
|
// https://developer.box.com/reference/delete-folders-id
|
||||||
if (operation === 'delete') {
|
if (operation === 'delete') {
|
||||||
const folderId = this.getNodeParameter('folderId', i) as string;
|
const folderId = this.getNodeParameter('folderId', i) as string;
|
||||||
const recursive = this.getNodeParameter('recursive', i) as boolean;
|
const recursive = this.getNodeParameter('recursive', i) as boolean;
|
||||||
|
@ -310,7 +310,7 @@ export class Box implements INodeType {
|
||||||
responseData = { success: true };
|
responseData = { success: true };
|
||||||
returnData.push(responseData as IDataObject);
|
returnData.push(responseData as IDataObject);
|
||||||
}
|
}
|
||||||
//https://developer.box.com/reference/get-search/
|
// https://developer.box.com/reference/get-search/
|
||||||
if (operation === 'search') {
|
if (operation === 'search') {
|
||||||
const query = this.getNodeParameter('query', i) as string;
|
const query = this.getNodeParameter('query', i) as string;
|
||||||
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
const returnAll = this.getNodeParameter('returnAll', i) as boolean;
|
||||||
|
|
|
@ -48,16 +48,16 @@ export class BoxTrigger implements INodeType {
|
||||||
name: 'events',
|
name: 'events',
|
||||||
type: 'multiOptions',
|
type: 'multiOptions',
|
||||||
options: [
|
options: [
|
||||||
{
|
|
||||||
name: 'Collaboration Created',
|
|
||||||
value: 'COLLABORATION.CREATED',
|
|
||||||
description: 'A collaboration is created',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'Collaboration Accepted',
|
name: 'Collaboration Accepted',
|
||||||
value: 'COLLABORATION.ACCEPTED',
|
value: 'COLLABORATION.ACCEPTED',
|
||||||
description: 'A collaboration has been accepted',
|
description: 'A collaboration has been accepted',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Collaboration Created',
|
||||||
|
value: 'COLLABORATION.CREATED',
|
||||||
|
description: 'A collaboration is created',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Collaboration Rejected',
|
name: 'Collaboration Rejected',
|
||||||
value: 'COLLABORATION.REJECTED',
|
value: 'COLLABORATION.REJECTED',
|
||||||
|
@ -78,45 +78,15 @@ export class BoxTrigger implements INodeType {
|
||||||
value: 'COMMENT.CREATED',
|
value: 'COMMENT.CREATED',
|
||||||
description: 'A comment object is created',
|
description: 'A comment object is created',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'Comment Updated',
|
|
||||||
value: 'COMMENT.UPDATED',
|
|
||||||
description: 'A comment object is edited',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'Comment Deleted',
|
name: 'Comment Deleted',
|
||||||
value: 'COMMENT.DELETED',
|
value: 'COMMENT.DELETED',
|
||||||
description: 'A comment object is removed',
|
description: 'A comment object is removed',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'File Uploaded',
|
name: 'Comment Updated',
|
||||||
value: 'FILE.UPLOADED',
|
value: 'COMMENT.UPDATED',
|
||||||
description: 'A file is uploaded to or moved to this folder',
|
description: 'A comment object is edited',
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'File Previewed',
|
|
||||||
value: 'FILE.PREVIEWED',
|
|
||||||
description: 'A file is previewed',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'File Downloaded',
|
|
||||||
value: 'FILE.DOWNLOADED',
|
|
||||||
description: 'A file is downloaded',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'File Trashed',
|
|
||||||
value: 'FILE.TRASHED',
|
|
||||||
description: 'A file is moved to the trash',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'File Deleted',
|
|
||||||
value: 'FILE.DELETED',
|
|
||||||
description: 'A file is moved to the trash',
|
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'File Restored',
|
|
||||||
value: 'FILE.RESTORED',
|
|
||||||
description: 'A file is restored from the trash',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'File Copied',
|
name: 'File Copied',
|
||||||
|
@ -124,9 +94,14 @@ export class BoxTrigger implements INodeType {
|
||||||
description: 'A file is copied',
|
description: 'A file is copied',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'File Moved',
|
name: 'File Deleted',
|
||||||
value: 'FILE.MOVED',
|
value: 'FILE.DELETED',
|
||||||
description: 'A file is moved from one folder to another',
|
description: 'A file is moved to the trash',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File Downloaded',
|
||||||
|
value: 'FILE.DOWNLOADED',
|
||||||
|
description: 'A file is downloaded',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'File Locked',
|
name: 'File Locked',
|
||||||
|
@ -134,9 +109,14 @@ export class BoxTrigger implements INodeType {
|
||||||
description: 'A file is locked',
|
description: 'A file is locked',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'File Unlocked',
|
name: 'File Moved',
|
||||||
value: 'FILE.UNLOCKED',
|
value: 'FILE.MOVED',
|
||||||
description: 'A file is unlocked',
|
description: 'A file is moved from one folder to another',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'File Previewed',
|
||||||
|
value: 'FILE.PREVIEWED',
|
||||||
|
description: 'A file is previewed',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'File Renamed',
|
name: 'File Renamed',
|
||||||
|
@ -144,40 +124,60 @@ export class BoxTrigger implements INodeType {
|
||||||
description: 'A file was renamed.',
|
description: 'A file was renamed.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Folder Created',
|
name: 'File Restored',
|
||||||
value: 'FOLDER.CREATED',
|
value: 'FILE.RESTORED',
|
||||||
description: 'A folder is created',
|
description: 'A file is restored from the trash',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Folder Renamed',
|
name: 'File Trashed',
|
||||||
value: 'FOLDER.RENAMED',
|
value: 'FILE.TRASHED',
|
||||||
description: 'A folder was renamed.',
|
description: 'A file is moved to the trash',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Folder Downloaded',
|
name: 'File Unlocked',
|
||||||
value: 'FOLDER.DOWNLOADED',
|
value: 'FILE.UNLOCKED',
|
||||||
description: 'A folder is downloaded',
|
description: 'A file is unlocked',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Folder Restored',
|
name: 'File Uploaded',
|
||||||
value: 'FOLDER.RESTORED',
|
value: 'FILE.UPLOADED',
|
||||||
description: 'A folder is restored from the trash',
|
description: 'A file is uploaded to or moved to this folder',
|
||||||
},
|
|
||||||
{
|
|
||||||
name: 'Folder Deleted',
|
|
||||||
value: 'FOLDER.DELETED',
|
|
||||||
description: 'A folder is permanently removed',
|
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Folder Copied',
|
name: 'Folder Copied',
|
||||||
value: 'FOLDER.COPIED',
|
value: 'FOLDER.COPIED',
|
||||||
description: 'A copy of a folder is made',
|
description: 'A copy of a folder is made',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Folder Created',
|
||||||
|
value: 'FOLDER.CREATED',
|
||||||
|
description: 'A folder is created',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Folder Deleted',
|
||||||
|
value: 'FOLDER.DELETED',
|
||||||
|
description: 'A folder is permanently removed',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Folder Downloaded',
|
||||||
|
value: 'FOLDER.DOWNLOADED',
|
||||||
|
description: 'A folder is downloaded',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Folder Moved',
|
name: 'Folder Moved',
|
||||||
value: 'FOLDER.MOVED',
|
value: 'FOLDER.MOVED',
|
||||||
description: 'A folder is moved to a different folder',
|
description: 'A folder is moved to a different folder',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: 'Folder Renamed',
|
||||||
|
value: 'FOLDER.RENAMED',
|
||||||
|
description: 'A folder was renamed.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Folder Restored',
|
||||||
|
value: 'FOLDER.RESTORED',
|
||||||
|
description: 'A folder is restored from the trash',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
name: 'Folder Trashed',
|
name: 'Folder Trashed',
|
||||||
value: 'FOLDER.TRASHED',
|
value: 'FOLDER.TRASHED',
|
||||||
|
@ -188,20 +188,15 @@ export class BoxTrigger implements INodeType {
|
||||||
value: 'METADATA_INSTANCE.CREATED',
|
value: 'METADATA_INSTANCE.CREATED',
|
||||||
description: 'A new metadata template instance is associated with a file or folder',
|
description: 'A new metadata template instance is associated with a file or folder',
|
||||||
},
|
},
|
||||||
{
|
|
||||||
name: 'Metadata Instance Updated',
|
|
||||||
value: 'METADATA_INSTANCE.UPDATED',
|
|
||||||
description: 'An attribute (value) is updated/deleted for an existing metadata template instance associated with a file or folder',
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
name: 'Metadata Instance Deleted',
|
name: 'Metadata Instance Deleted',
|
||||||
value: 'METADATA_INSTANCE.DELETED',
|
value: 'METADATA_INSTANCE.DELETED',
|
||||||
description: 'An existing metadata template instance associated with a file or folder is deleted',
|
description: 'An existing metadata template instance associated with a file or folder is deleted',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Sharedlink Deleted',
|
name: 'Metadata Instance Updated',
|
||||||
value: 'SHARED_LINK.DELETED',
|
value: 'METADATA_INSTANCE.UPDATED',
|
||||||
description: 'A shared link was deleted',
|
description: 'An attribute (value) is updated/deleted for an existing metadata template instance associated with a file or folder',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Sharedlink Created',
|
name: 'Sharedlink Created',
|
||||||
|
@ -209,7 +204,12 @@ export class BoxTrigger implements INodeType {
|
||||||
description: 'A shared link was created',
|
description: 'A shared link was created',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
name: 'Sharedlink UPDATED',
|
name: 'Sharedlink Deleted',
|
||||||
|
value: 'SHARED_LINK.DELETED',
|
||||||
|
description: 'A shared link was deleted',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Sharedlink Updated',
|
||||||
value: 'SHARED_LINK.UPDATED',
|
value: 'SHARED_LINK.UPDATED',
|
||||||
description: 'A shared link was updated',
|
description: 'A shared link was updated',
|
||||||
},
|
},
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {
|
import {
|
||||||
INodeProperties,
|
INodeProperties,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
export const fileOperations = [
|
export const fileOperations = [
|
||||||
{
|
{
|
||||||
|
@ -53,9 +53,9 @@ export const fileOperations = [
|
||||||
|
|
||||||
export const fileFields = [
|
export const fileFields = [
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* file:copy */
|
/* file:copy */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'File ID',
|
displayName: 'File ID',
|
||||||
name: 'fileId',
|
name: 'fileId',
|
||||||
|
@ -131,9 +131,10 @@ export const fileFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* file:delete */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* file:delete */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'File ID',
|
displayName: 'File ID',
|
||||||
name: 'fileId',
|
name: 'fileId',
|
||||||
|
@ -151,9 +152,10 @@ export const fileFields = [
|
||||||
default: '',
|
default: '',
|
||||||
description: 'Field ID',
|
description: 'Field ID',
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* file:download */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* file:download */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'File ID',
|
displayName: 'File ID',
|
||||||
name: 'fileId',
|
name: 'fileId',
|
||||||
|
@ -189,9 +191,10 @@ export const fileFields = [
|
||||||
},
|
},
|
||||||
description: 'Name of the binary property to which to<br />write the data of the read file.',
|
description: 'Name of the binary property to which to<br />write the data of the read file.',
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* file:get */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* file:get */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'File ID',
|
displayName: 'File ID',
|
||||||
name: 'fileId',
|
name: 'fileId',
|
||||||
|
@ -235,9 +238,10 @@ export const fileFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* file:search */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* file:search */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Query',
|
displayName: 'Query',
|
||||||
name: 'query',
|
name: 'query',
|
||||||
|
@ -491,9 +495,10 @@ export const fileFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* file:upload */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* file:upload */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'File Name',
|
displayName: 'File Name',
|
||||||
name: 'fileName',
|
name: 'fileName',
|
||||||
|
@ -550,7 +555,6 @@ export const fileFields = [
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
placeholder: '',
|
|
||||||
description: 'The text content of the file.',
|
description: 'The text content of the file.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
@ -573,7 +577,6 @@ export const fileFields = [
|
||||||
},
|
},
|
||||||
|
|
||||||
},
|
},
|
||||||
placeholder: '',
|
|
||||||
description: 'Name of the binary property which contains<br />the data for the file.',
|
description: 'Name of the binary property which contains<br />the data for the file.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
import {
|
import {
|
||||||
INodeProperties,
|
INodeProperties,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
export const folderOperations = [
|
export const folderOperations = [
|
||||||
{
|
{
|
||||||
|
@ -38,9 +38,9 @@ export const folderOperations = [
|
||||||
|
|
||||||
export const folderFields = [
|
export const folderFields = [
|
||||||
|
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* folder:create */
|
/* folder:create */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Name',
|
displayName: 'Name',
|
||||||
name: 'name',
|
name: 'name',
|
||||||
|
@ -121,9 +121,10 @@ export const folderFields = [
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* folder:delete */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* folder:delete */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Folder ID',
|
displayName: 'Folder ID',
|
||||||
name: 'folderId',
|
name: 'folderId',
|
||||||
|
@ -158,9 +159,10 @@ export const folderFields = [
|
||||||
default: false,
|
default: false,
|
||||||
description: 'Delete a folder that is not empty by recursively deleting the folder and all of its content.',
|
description: 'Delete a folder that is not empty by recursively deleting the folder and all of its content.',
|
||||||
},
|
},
|
||||||
/* -------------------------------------------------------------------------- */
|
|
||||||
/* file:search */
|
/* -------------------------------------------------------------------------- */
|
||||||
/* -------------------------------------------------------------------------- */
|
/* file:search */
|
||||||
|
/* -------------------------------------------------------------------------- */
|
||||||
{
|
{
|
||||||
displayName: 'Query',
|
displayName: 'Query',
|
||||||
name: 'query',
|
name: 'query',
|
||||||
|
|
|
@ -47,17 +47,11 @@ export async function boxApiRequest(this: IExecuteFunctions | IExecuteSingleFunc
|
||||||
if (error.response && error.response.body) {
|
if (error.response && error.response.body) {
|
||||||
|
|
||||||
if (error.response.body.context_info && error.response.body.context_info.errors) {
|
if (error.response.body.context_info && error.response.body.context_info.errors) {
|
||||||
|
|
||||||
const errors = error.response.body.context_info.errors;
|
const errors = error.response.body.context_info.errors;
|
||||||
|
|
||||||
errorMessage = errors.map((e: IDataObject) => e.message);
|
errorMessage = errors.map((e: IDataObject) => e.message);
|
||||||
|
|
||||||
errorMessage = errorMessage.join('|');
|
errorMessage = errorMessage.join('|');
|
||||||
|
|
||||||
} else if (error.response.body.message) {
|
} else if (error.response.body.message) {
|
||||||
|
|
||||||
errorMessage = error.response.body.message;
|
errorMessage = error.response.body.message;
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
throw new Error(`Box error response [${error.statusCode}]: ${errorMessage}`);
|
throw new Error(`Box error response [${error.statusCode}]: ${errorMessage}`);
|
||||||
|
|
Loading…
Reference in a new issue