2023-01-27 03:22:44 -08:00
|
|
|
import type { INodeProperties } from 'n8n-workflow';
|
2020-03-29 23:19:59 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const folderOperations: INodeProperties[] = [
|
2020-03-29 23:19:59 -07:00
|
|
|
{
|
|
|
|
displayName: 'Operation',
|
|
|
|
name: 'operation',
|
|
|
|
type: 'options',
|
2022-05-20 14:47:24 -07:00
|
|
|
noDataExpression: true,
|
2020-03-29 23:19:59 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
resource: ['folder'],
|
2020-03-29 23:19:59 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
options: [
|
2020-03-29 19:39:43 -07:00
|
|
|
{
|
|
|
|
name: 'Create',
|
|
|
|
value: 'create',
|
|
|
|
description: 'Create a folder',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Create a folder',
|
2020-03-29 19:39:43 -07:00
|
|
|
},
|
2021-04-17 01:18:29 -07:00
|
|
|
{
|
|
|
|
name: 'Delete',
|
|
|
|
value: 'delete',
|
|
|
|
description: 'Delete a folder',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Delete a folder',
|
2021-04-17 01:18:29 -07:00
|
|
|
},
|
2020-03-29 23:19:59 -07:00
|
|
|
{
|
|
|
|
name: 'Get Children',
|
|
|
|
value: 'getChildren',
|
|
|
|
description: 'Get items inside a folder',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Get items in a folder',
|
2020-03-29 23:19:59 -07:00
|
|
|
},
|
2022-05-15 10:55:09 -07:00
|
|
|
{
|
|
|
|
name: 'Rename',
|
|
|
|
value: 'rename',
|
|
|
|
description: 'Rename a folder',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Rename a folder',
|
2022-05-15 10:55:09 -07:00
|
|
|
},
|
2020-03-29 23:19:59 -07:00
|
|
|
{
|
|
|
|
name: 'Search',
|
|
|
|
value: 'search',
|
|
|
|
description: 'Search a folder',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Search a folder',
|
2020-03-29 23:19:59 -07:00
|
|
|
},
|
2020-10-13 02:08:07 -07:00
|
|
|
{
|
|
|
|
name: 'Share',
|
|
|
|
value: 'share',
|
|
|
|
description: 'Share a folder',
|
2022-07-10 13:50:51 -07:00
|
|
|
action: 'Share a folder',
|
2020-10-13 02:08:07 -07:00
|
|
|
},
|
2020-03-29 23:19:59 -07:00
|
|
|
],
|
|
|
|
default: 'getChildren',
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|
2020-03-29 23:19:59 -07:00
|
|
|
|
2021-12-03 00:44:16 -08:00
|
|
|
export const folderFields: INodeProperties[] = [
|
2022-08-17 08:50:24 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* folder:create */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-03-29 19:39:43 -07:00
|
|
|
{
|
|
|
|
displayName: 'Name',
|
|
|
|
name: 'name',
|
|
|
|
required: true,
|
|
|
|
type: 'string',
|
2021-10-20 20:07:33 -07:00
|
|
|
placeholder: '/Pictures/2021',
|
2020-03-29 19:39:43 -07:00
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['create'],
|
|
|
|
resource: ['folder'],
|
2020-03-29 19:39:43 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2021-10-20 19:24:10 -07:00
|
|
|
description: 'The name or path of the folder',
|
2020-03-29 19:39:43 -07:00
|
|
|
},
|
2020-04-03 08:19:35 -07:00
|
|
|
{
|
|
|
|
displayName: 'Options',
|
|
|
|
name: 'options',
|
|
|
|
type: 'collection',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['create'],
|
|
|
|
resource: ['folder'],
|
2020-04-03 08:19:35 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: {},
|
|
|
|
placeholder: 'Add Field',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
displayName: 'Parent Folder ID',
|
|
|
|
name: 'parentFolderId',
|
|
|
|
type: 'string',
|
|
|
|
default: '',
|
|
|
|
description: 'ID of the folder you want to crate the new folder in',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
},
|
2022-08-17 08:50:24 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* folder:getChildren/delete */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-03-29 23:19:59 -07:00
|
|
|
{
|
|
|
|
displayName: 'Folder ID',
|
|
|
|
name: 'folderId',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['delete', 'getChildren'],
|
|
|
|
resource: ['folder'],
|
2020-03-29 23:19:59 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
},
|
2022-08-17 08:50:24 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* folder:rename */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
{
|
|
|
|
displayName: 'Item ID',
|
|
|
|
name: 'itemId',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: ['rename'],
|
|
|
|
resource: ['folder'],
|
|
|
|
},
|
2022-05-15 10:55:09 -07:00
|
|
|
},
|
2022-08-17 08:50:24 -07:00
|
|
|
default: '',
|
|
|
|
description: 'ID of the folder',
|
2022-05-15 10:55:09 -07:00
|
|
|
},
|
2022-08-17 08:50:24 -07:00
|
|
|
{
|
|
|
|
displayName: 'New Name',
|
|
|
|
name: 'newName',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
|
|
|
operation: ['rename'],
|
|
|
|
resource: ['folder'],
|
|
|
|
},
|
2022-05-15 10:55:09 -07:00
|
|
|
},
|
2022-08-17 08:50:24 -07:00
|
|
|
default: '',
|
|
|
|
description: 'New name for folder',
|
2022-05-15 10:55:09 -07:00
|
|
|
},
|
2022-08-17 08:50:24 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* folder:search */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-03-29 23:19:59 -07:00
|
|
|
{
|
|
|
|
displayName: 'Query',
|
|
|
|
name: 'query',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['search'],
|
|
|
|
resource: ['folder'],
|
2020-03-29 23:19:59 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
2022-08-17 08:50:24 -07:00
|
|
|
description:
|
|
|
|
'The query text used to search for items. Values may be matched across several fields including filename, metadata, and file content.',
|
2020-03-29 23:19:59 -07:00
|
|
|
},
|
2022-08-17 08:50:24 -07:00
|
|
|
/* -------------------------------------------------------------------------- */
|
|
|
|
/* folder:share */
|
|
|
|
/* -------------------------------------------------------------------------- */
|
2020-10-13 02:08:07 -07:00
|
|
|
{
|
|
|
|
displayName: 'Folder ID',
|
|
|
|
name: 'folderId',
|
|
|
|
type: 'string',
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['share'],
|
|
|
|
resource: ['folder'],
|
2020-10-13 02:08:07 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'File ID',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Type',
|
|
|
|
name: 'type',
|
|
|
|
type: 'options',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'View',
|
|
|
|
value: 'view',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Edit',
|
|
|
|
value: 'edit',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Embed',
|
|
|
|
value: 'embed',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['share'],
|
|
|
|
resource: ['folder'],
|
2020-10-13 02:08:07 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'The type of sharing link to create',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
displayName: 'Scope',
|
|
|
|
name: 'scope',
|
|
|
|
type: 'options',
|
|
|
|
options: [
|
|
|
|
{
|
|
|
|
name: 'Anonymous',
|
|
|
|
value: 'anonymous',
|
|
|
|
},
|
|
|
|
{
|
|
|
|
name: 'Organization',
|
|
|
|
value: 'organization',
|
|
|
|
},
|
|
|
|
],
|
|
|
|
displayOptions: {
|
|
|
|
show: {
|
2022-08-17 08:50:24 -07:00
|
|
|
operation: ['share'],
|
|
|
|
resource: ['folder'],
|
2020-10-13 02:08:07 -07:00
|
|
|
},
|
|
|
|
},
|
|
|
|
default: '',
|
|
|
|
description: 'The type of sharing link to create',
|
|
|
|
},
|
2021-12-03 00:44:16 -08:00
|
|
|
];
|