n8n/packages/nodes-base/nodes/Slack/FileDescription.ts

325 lines
6.2 KiB
TypeScript
Raw Normal View History

2020-03-08 15:22:33 -07:00
import { INodeProperties } from 'n8n-workflow';
export const fileOperations: INodeProperties[] = [
2020-03-08 15:22:33 -07:00
{
displayName: 'Operation',
name: 'operation',
type: 'options',
displayOptions: {
show: {
resource: [
'file',
],
},
},
options: [
{
name: 'Get',
value: 'get',
description: 'Get a file info',
},
{
name: 'Get All',
value: 'getAll',
description: 'Get & filters team files',
2020-03-08 15:22:33 -07:00
},
{
name: 'Upload',
value: 'upload',
description: 'Create or upload an existing file',
2020-03-08 15:22:33 -07:00
},
],
default: 'upload',
description: 'The operation to perform.',
},
];
2020-03-08 15:22:33 -07:00
export const fileFields: INodeProperties[] = [
2020-03-08 15:22:33 -07: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',
],
},
},
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: '',
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: '',
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: [],
description: 'The channels to send the file to',
2020-03-08 15:22:33 -07:00
},
{
displayName: 'File Name',
name: 'fileName',
type: 'string',
default: '',
description: 'Filename of file',
2020-03-08 15:22:33 -07:00
},
{
displayName: 'Initial Comment',
name: 'initialComment',
type: 'string',
default: '',
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: '',
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: '',
description: 'Title of file',
2020-03-08 15:22:33 -07: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,
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,
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: [
{
displayName: 'Channel',
name: 'channelId',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getChannels',
},
description: 'Channel containing the file to be listed',
2020-03-08 15:22:33 -07:00
},
{
displayName: 'Show Files Hidden By Limit',
name: 'showFilesHidden',
type: 'boolean',
default: false,
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
},
{
displayName: 'Timestamp From',
2020-03-08 15:22:33 -07:00
name: 'tsFrom',
type: 'string',
default: '',
description: 'Filter files created after this timestamp (inclusive)',
2020-03-08 15:22:33 -07:00
},
{
displayName: 'Timestamp To',
2020-03-08 15:22:33 -07:00
name: 'tsTo',
type: 'string',
default: '',
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',
},
{
name: 'Google Docs',
value: 'gdocs',
2020-03-08 15:22:33 -07:00
},
{
name: 'Images',
value: 'images',
},
{
name: 'Snippets',
value: 'snippets',
2020-03-08 15:22:33 -07:00
},
{
name: 'Spaces',
value: 'spaces',
2020-03-08 15:22:33 -07:00
},
{
name: 'pdfs',
value: 'pdfs',
},
{
name: 'Zips',
value: 'zips',
},
2020-03-08 15:22:33 -07:00
],
default: ['all'],
description: 'Filter files by type',
},
{
displayName: 'User',
name: 'userId',
type: 'options',
default: '',
typeOptions: {
loadOptionsMethod: 'getUsers',
},
description: 'Filter files created by a single user',
2020-03-08 15:22:33 -07: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: '',
},
];