mirror of
https://github.com/n8n-io/n8n.git
synced 2025-02-02 07:01:30 -08:00
Add Attachment listing API
This commit is contained in:
parent
027c951660
commit
a1972c2d61
|
@ -50,7 +50,11 @@ export class Trello implements INodeType {
|
||||||
{
|
{
|
||||||
name: 'List',
|
name: 'List',
|
||||||
value: 'list',
|
value: 'list',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
name: "Attachment",
|
||||||
|
value: "attachment"
|
||||||
|
}
|
||||||
],
|
],
|
||||||
default: 'card',
|
default: 'card',
|
||||||
description: 'The resource to operate on.',
|
description: 'The resource to operate on.',
|
||||||
|
@ -544,10 +548,119 @@ export class Trello implements INodeType {
|
||||||
name: 'Update',
|
name: 'Update',
|
||||||
value: 'update',
|
value: 'update',
|
||||||
description: 'Update a card',
|
description: 'Update a card',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'AttachmentList',
|
||||||
|
value: 'attachmentList',
|
||||||
|
description: 'List all attachments',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'create',
|
default: 'create',
|
||||||
description: 'The operation to perform.',
|
description: 'The operation to perform.',
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------------------------
|
||||||
|
// card:attachmentList
|
||||||
|
// ----------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Card ID',
|
||||||
|
name: 'id',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'attachmentList',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'card',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The ID of the card to get.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Additional Fields',
|
||||||
|
name: 'additionalFields',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'attachmentList',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'card',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Fields',
|
||||||
|
name: 'fields',
|
||||||
|
type: 'string',
|
||||||
|
default: 'all',
|
||||||
|
description: 'Fields to return. Either "all" or a comma-separated list:<br />badges, checkItemStates, closed, dateLastActivity, desc,<br />descData, due, email, idBoard, idChecklists, idLabels, idList,<br />idMembers, idShort, idAttachmentCover, manualCoverAttachment<br />, labels, name, pos, shortUrl, url',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Board',
|
||||||
|
name: 'board',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'Whether to return the board object the card is on.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Board Fields',
|
||||||
|
name: 'board_fields',
|
||||||
|
type: 'string',
|
||||||
|
default: 'all',
|
||||||
|
description: 'Fields to return. Either "all" or a comma-separated list:<br />name, desc, descData, closed, idOrganization, pinned, url, prefs',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Custom Field Items',
|
||||||
|
name: 'customFieldItems',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'Whether to include the customFieldItems.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Members',
|
||||||
|
name: 'members',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'Whether to return member objects for members on the card.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Member Fields',
|
||||||
|
name: 'member_fields',
|
||||||
|
type: 'string',
|
||||||
|
default: 'all',
|
||||||
|
description: 'Fields to return. Either "all" or a comma-separated list:<br />avatarHash, fullName, initials, username',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Plugin Data',
|
||||||
|
name: 'pluginData',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'Whether to include pluginData on the card with the response.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Stickers',
|
||||||
|
name: 'stickers',
|
||||||
|
type: 'boolean',
|
||||||
|
default: false,
|
||||||
|
description: 'Whether to include sticker models with the response.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Sticker Fields',
|
||||||
|
name: 'sticker_fields',
|
||||||
|
type: 'string',
|
||||||
|
default: 'all',
|
||||||
|
description: 'Fields to return. Either "all" or a comma-separated list of sticker fields.',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
@ -1211,6 +1324,80 @@ export class Trello implements INodeType {
|
||||||
description: 'Whether the acting user is subscribed to the list.',
|
description: 'Whether the acting user is subscribed to the list.',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------------------------
|
||||||
|
// attachment
|
||||||
|
// ----------------------------------
|
||||||
|
|
||||||
|
{
|
||||||
|
displayName: 'Operation',
|
||||||
|
name: 'operation',
|
||||||
|
type: 'options',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
resource: [
|
||||||
|
'attachment',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
name: 'List',
|
||||||
|
value: 'list',
|
||||||
|
description: 'List all attachments',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
default: 'list',
|
||||||
|
description: 'The operation to perform.',
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------------------------
|
||||||
|
// attachment:list
|
||||||
|
// ----------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Card ID',
|
||||||
|
name: 'id',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'list',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'attachment',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The ID of the list to get.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Additional Fields',
|
||||||
|
name: 'additionalFields',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'list',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'attachment',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
default: {},
|
||||||
|
options: [
|
||||||
|
{
|
||||||
|
displayName: 'Fields',
|
||||||
|
name: 'fields',
|
||||||
|
type: 'string',
|
||||||
|
default: 'all',
|
||||||
|
description: 'Fields to return. Either "all" or a comma-separated list of fields.',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
|
@ -1420,7 +1607,25 @@ export class Trello implements INodeType {
|
||||||
throw new Error(`The operation "${operation}" is not known!`);
|
throw new Error(`The operation "${operation}" is not known!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
} else {
|
} else if (resource === 'attachment') {
|
||||||
|
|
||||||
|
if (operation === 'list') {
|
||||||
|
// ----------------------------------
|
||||||
|
// list
|
||||||
|
// ----------------------------------
|
||||||
|
|
||||||
|
requestMethod = 'GET';
|
||||||
|
|
||||||
|
const id = this.getNodeParameter('id', i) as string;
|
||||||
|
|
||||||
|
endpoint = `cards/${id}/attachments`;
|
||||||
|
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
Object.assign(qs, additionalFields);
|
||||||
|
} else {
|
||||||
|
throw new Error(`The operation "${operation}" is not known!`);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
throw new Error(`The resource "${resource}" is not known!`);
|
throw new Error(`The resource "${resource}" is not known!`);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue