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',
refactor: Apply more nodelinting rules (#3324) * :pencil2: Alphabetize lint rules * :fire: Remove duplicates * :zap: Update `lintfix` script * :shirt: Apply `node-param-operation-without-no-data-expression` (#3329) * :shirt: Apply `node-param-operation-without-no-data-expression` * :shirt: Add exceptions * :shirt: Apply `node-param-description-weak` (#3328) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :shirt: Apply `node-param-option-value-duplicate` (#3331) * :shirt: Apply `node-param-description-miscased-json` (#3337) * :shirt: Apply `node-param-display-name-excess-inner-whitespace` (#3335) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :shirt: Apply `node-param-type-options-missing-from-limit` (#3336) * Rule workig as intended * :pencil2: Uncomment rules Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :shirt: Apply `node-param-option-name-duplicate` (#3338) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :shirt: Apply `node-param-description-wrong-for-simplify` (#3334) * :zap: fix * :zap: exceptions * :zap: changed rule ignoring from file to line * :shirt: Apply `node-param-resource-without-no-data-expression` (#3339) * :shirt: Apply `node-param-display-name-untrimmed` (#3341) * :shirt: Apply `node-param-display-name-miscased-id` (#3340) Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :shirt: Apply `node-param-resource-with-plural-option` (#3342) * :shirt: Apply `node-param-description-wrong-for-upsert` (#3333) * :zap: fix * :zap: replaced record with contact in description * :zap: fix Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :shirt: Apply `node-param-option-description-identical-to-name` (#3343) * :shirt: Apply `node-param-option-name-containing-star` (#3347) * :shirt: Apply `node-param-display-name-wrong-for-update-fields` (#3348) * :shirt: Apply `node-param-option-name-wrong-for-get-all` (#3345) * :zap: fix * :zap: exceptions * :shirt: Apply node-param-display-name-wrong-for-simplify (#3344) * Rule working as intended * Uncomented other rules * :shirt: Undo and add exceptions Co-authored-by: Iván Ovejero <ivov.src@gmail.com> * :zap: Alphabetize lint rules * :zap: Restore `lintfix` script Co-authored-by: Michael Kret <88898367+michael-radency@users.noreply.github.com> Co-authored-by: agobrech <45268029+agobrech@users.noreply.github.com>
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',
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',
},
];
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: '',
},
];