2020-03-08 15:22:33 -07:00
import { INodeProperties } from 'n8n-workflow' ;
2021-12-03 00:44:16 -08:00
export const fileOperations : INodeProperties [ ] = [
2020-03-08 15:22:33 -07:00
{
displayName : 'Operation' ,
name : 'operation' ,
type : 'options' ,
2022-05-20 14:47:24 -07:00
noDataExpression : true ,
2020-03-08 15:22:33 -07:00
displayOptions : {
show : {
resource : [
'file' ,
] ,
} ,
} ,
options : [
{
name : 'Get' ,
value : 'get' ,
description : 'Get a file info' ,
} ,
{
name : 'Get All' ,
value : 'getAll' ,
2022-05-06 14:01:25 -07:00
description : 'Get & filters team files' ,
2020-03-08 15:22:33 -07:00
} ,
{
name : 'Upload' ,
value : 'upload' ,
2022-05-06 14:01:25 -07:00
description : 'Create or upload an existing file' ,
2020-03-08 15:22:33 -07:00
} ,
] ,
default : 'upload' ,
} ,
2021-12-03 00:44:16 -08:00
] ;
2020-03-08 15:22:33 -07:00
2021-12-03 00:44:16 -08:00
export const fileFields : INodeProperties [ ] = [
2020-03-08 15:22:33 -07:00
2020-12-13 01:47:52 -08:00
/* -------------------------------------------------------------------------- */
/* file:upload */
/* -------------------------------------------------------------------------- */
2020-03-08 15:22:33 -07:00
{
displayName : 'Binary Data' ,
name : 'binaryData' ,
type : 'boolean' ,
default : false ,
displayOptions : {
show : {
operation : [
2020-10-22 06:46:03 -07:00
'upload' ,
2020-03-08 15:22:33 -07:00
] ,
resource : [
'file' ,
] ,
} ,
} ,
2022-05-06 14:01:25 -07:00
description : 'If the data to upload should be taken from binary field' ,
2020-03-08 15:22:33 -07:00
} ,
{
displayName : 'File Content' ,
name : 'fileContent' ,
type : 'string' ,
default : '' ,
displayOptions : {
show : {
operation : [
2020-10-22 06:46:03 -07:00
'upload' ,
2020-03-08 15:22:33 -07:00
] ,
resource : [
'file' ,
] ,
binaryData : [
2020-10-22 06:46:03 -07:00
false ,
2020-03-08 15:22:33 -07:00
] ,
} ,
} ,
placeholder : '' ,
2022-05-06 14:01:25 -07:00
description : 'The text content of the file to upload' ,
2020-03-08 15:22:33 -07:00
} ,
{
displayName : 'Binary Property' ,
name : 'binaryPropertyName' ,
type : 'string' ,
default : 'data' ,
required : true ,
displayOptions : {
show : {
operation : [
2020-10-22 06:46:03 -07:00
'upload' ,
2020-03-08 15:22:33 -07:00
] ,
resource : [
'file' ,
] ,
binaryData : [
2020-10-22 06:46:03 -07:00
true ,
2020-03-08 15:22:33 -07:00
] ,
} ,
} ,
placeholder : '' ,
2022-05-06 14:01:25 -07:00
description : 'Name of the binary property which contains the data for the file to be uploaded' ,
2020-03-08 15:22:33 -07:00
} ,
{
displayName : 'Options' ,
name : 'options' ,
type : 'collection' ,
displayOptions : {
show : {
operation : [
2020-10-22 06:46:03 -07:00
'upload' ,
2020-03-08 15:22:33 -07:00
] ,
resource : [
'file' ,
] ,
} ,
} ,
default : { } ,
description : 'Other options to set' ,
placeholder : 'Add options' ,
options : [
{
displayName : 'Channels' ,
name : 'channelIds' ,
type : 'multiOptions' ,
typeOptions : {
loadOptionsMethod : 'getChannels' ,
} ,
default : [ ] ,
2022-05-06 14:01:25 -07:00
description : 'The channels to send the file to' ,
2020-03-08 15:22:33 -07:00
} ,
{
displayName : 'File Name' ,
name : 'fileName' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Filename of file' ,
2020-03-08 15:22:33 -07:00
} ,
{
displayName : 'Initial Comment' ,
name : 'initialComment' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'The message text introducing the file in specified channels' ,
2020-03-08 15:22:33 -07:00
} ,
{
displayName : 'Thread TS' ,
name : 'threadTs' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Provide another message\'s ts value to upload this file as a reply. Never use a reply\'s ts value; use its parent instead.' ,
2020-03-08 15:22:33 -07:00
} ,
{
displayName : 'Title' ,
name : 'title' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Title of file' ,
2020-03-08 15:22:33 -07:00
} ,
] ,
} ,
2020-12-13 01:47:52 -08:00
/* ----------------------------------------------------------------------- */
/* file:getAll */
/* ----------------------------------------------------------------------- */
2020-03-08 15:22:33 -07:00
{
displayName : 'Return All' ,
name : 'returnAll' ,
type : 'boolean' ,
displayOptions : {
show : {
resource : [
'file' ,
] ,
operation : [
'getAll' ,
] ,
} ,
} ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Whether to return all results or only up to a given limit' ,
2020-03-08 15:22:33 -07:00
} ,
{
displayName : 'Limit' ,
name : 'limit' ,
type : 'number' ,
displayOptions : {
show : {
resource : [
'file' ,
] ,
operation : [
'getAll' ,
] ,
returnAll : [
false ,
] ,
} ,
} ,
typeOptions : {
minValue : 1 ,
maxValue : 100 ,
} ,
default : 50 ,
2022-05-06 14:01:25 -07:00
description : 'Max number of results to return' ,
2020-03-08 15:22:33 -07:00
} ,
{
displayName : 'Filters' ,
name : 'filters' ,
type : 'collection' ,
displayOptions : {
show : {
operation : [
2020-10-22 06:46:03 -07:00
'getAll' ,
2020-03-08 15:22:33 -07:00
] ,
resource : [
'file' ,
] ,
} ,
} ,
default : { } ,
placeholder : 'Add Field' ,
options : [
{
2022-06-03 10:23:49 -07:00
displayName : 'Channel Name or ID' ,
2020-03-08 15:22:33 -07:00
name : 'channelId' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getChannels' ,
} ,
2022-06-03 10:23:49 -07:00
description : 'Channel containing the file to be listed. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2020-03-08 15:22:33 -07:00
} ,
{
displayName : 'Show Files Hidden By Limit' ,
name : 'showFilesHidden' ,
type : 'boolean' ,
default : false ,
2022-05-06 14:01:25 -07:00
description : 'Show truncated file info for files hidden due to being too old, and the team who owns the file being over the file limit' ,
2020-03-08 15:22:33 -07:00
} ,
{
2021-01-23 03:17:38 -08:00
displayName : 'Timestamp From' ,
2020-03-08 15:22:33 -07:00
name : 'tsFrom' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Filter files created after this timestamp (inclusive)' ,
2020-03-08 15:22:33 -07:00
} ,
{
2021-01-23 03:17:38 -08:00
displayName : 'Timestamp To' ,
2020-03-08 15:22:33 -07:00
name : 'tsTo' ,
type : 'string' ,
default : '' ,
2022-05-06 14:01:25 -07:00
description : 'Filter files created before this timestamp (inclusive)' ,
2020-03-08 15:22:33 -07:00
} ,
{
displayName : 'Types' ,
name : 'types' ,
type : 'multiOptions' ,
options : [
{
name : 'All' ,
value : 'all' ,
} ,
{
2020-12-13 01:47:52 -08:00
name : 'Google Docs' ,
value : 'gdocs' ,
2020-03-08 15:22:33 -07:00
} ,
{
name : 'Images' ,
value : 'images' ,
} ,
{
2020-12-13 01:47:52 -08:00
name : 'Snippets' ,
value : 'snippets' ,
2020-03-08 15:22:33 -07:00
} ,
{
2020-12-13 01:47:52 -08:00
name : 'Spaces' ,
value : 'spaces' ,
2020-03-08 15:22:33 -07:00
} ,
{
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased
name : 'PDFs' ,
2020-03-08 15:22:33 -07:00
value : 'pdfs' ,
} ,
2020-12-13 01:47:52 -08:00
{
2022-06-03 10:23:49 -07:00
// eslint-disable-next-line n8n-nodes-base/node-param-display-name-miscased
name : 'zips' ,
2020-12-13 01:47:52 -08:00
value : 'zips' ,
} ,
2020-03-08 15:22:33 -07:00
] ,
default : [ 'all' ] ,
description : 'Filter files by type' ,
} ,
{
2022-06-03 10:23:49 -07:00
displayName : 'User Name or ID' ,
2020-03-08 15:22:33 -07:00
name : 'userId' ,
type : 'options' ,
default : '' ,
typeOptions : {
loadOptionsMethod : 'getUsers' ,
} ,
2022-06-03 10:23:49 -07:00
description : 'Filter files created by a single user. Choose from the list, or specify an ID using an <a href="https://docs.n8n.io/nodes/expressions.html#expressions">expression</a>.' ,
2020-03-08 15:22:33 -07:00
} ,
] ,
} ,
2020-12-13 01:47:52 -08:00
/* ----------------------------------------------------------------------- */
/* file:get */
/* ----------------------------------------------------------------------- */
2020-03-08 15:22:33 -07:00
{
displayName : 'File ID' ,
name : 'fileId' ,
type : 'string' ,
displayOptions : {
show : {
resource : [
'file' ,
] ,
operation : [
'get' ,
] ,
} ,
} ,
default : '' ,
} ,
2021-12-03 00:44:16 -08:00
] ;