mirror of
https://github.com/n8n-io/n8n.git
synced 2025-03-05 20:50:17 -08:00
Add GET attachment API
This commit is contained in:
parent
a1972c2d61
commit
995297f87e
|
@ -1346,12 +1346,83 @@ export class Trello implements INodeType {
|
||||||
name: 'List',
|
name: 'List',
|
||||||
value: 'list',
|
value: 'list',
|
||||||
description: 'List all attachments',
|
description: 'List all attachments',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
name: 'Get',
|
||||||
|
value: 'get',
|
||||||
|
description: 'Get the data of an attachments',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
default: 'list',
|
default: 'list',
|
||||||
description: 'The operation to perform.',
|
description: 'The operation to perform.',
|
||||||
},
|
},
|
||||||
|
|
||||||
|
// ----------------------------------
|
||||||
|
// attachment:create
|
||||||
|
// ----------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Card ID',
|
||||||
|
name: 'id',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'get',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'attachment',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The ID of the Card to get attachment.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Attachment ID',
|
||||||
|
name: 'attachmentId',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'get',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'attachment',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The ID of the attachment to get.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Additional Fields',
|
||||||
|
name: 'additionalFields',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'get',
|
||||||
|
],
|
||||||
|
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.',
|
||||||
|
},
|
||||||
|
],
|
||||||
|
},
|
||||||
|
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// attachment:list
|
// attachment:list
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
@ -1371,7 +1442,7 @@ export class Trello implements INodeType {
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
},
|
},
|
||||||
description: 'The ID of the list to get.',
|
description: 'The ID of the Card to get attachments.',
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
displayName: 'Additional Fields',
|
displayName: 'Additional Fields',
|
||||||
|
@ -1398,6 +1469,72 @@ export class Trello implements INodeType {
|
||||||
description: 'Fields to return. Either "all" or a comma-separated list of fields.',
|
description: 'Fields to return. Either "all" or a comma-separated list of fields.',
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
|
},
|
||||||
|
|
||||||
|
// ----------------------------------
|
||||||
|
// attachment:get
|
||||||
|
// ----------------------------------
|
||||||
|
{
|
||||||
|
displayName: 'Card ID',
|
||||||
|
name: 'id',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'get',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'attachment',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The ID of the Card to get attachment.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Attachment ID',
|
||||||
|
name: 'attachmentId',
|
||||||
|
type: 'string',
|
||||||
|
default: '',
|
||||||
|
required: true,
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'get',
|
||||||
|
],
|
||||||
|
resource: [
|
||||||
|
'attachment',
|
||||||
|
],
|
||||||
|
},
|
||||||
|
},
|
||||||
|
description: 'The ID of the attachment to get.',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
displayName: 'Additional Fields',
|
||||||
|
name: 'additionalFields',
|
||||||
|
type: 'collection',
|
||||||
|
placeholder: 'Add Field',
|
||||||
|
displayOptions: {
|
||||||
|
show: {
|
||||||
|
operation: [
|
||||||
|
'get',
|
||||||
|
],
|
||||||
|
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.',
|
||||||
|
},
|
||||||
|
],
|
||||||
},
|
},
|
||||||
|
|
||||||
],
|
],
|
||||||
|
@ -1610,19 +1747,35 @@ export class Trello implements INodeType {
|
||||||
} else if (resource === 'attachment') {
|
} else if (resource === 'attachment') {
|
||||||
|
|
||||||
if (operation === 'list') {
|
if (operation === 'list') {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// list
|
// list
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
|
|
||||||
requestMethod = 'GET';
|
requestMethod = 'GET';
|
||||||
|
|
||||||
const id = this.getNodeParameter('id', i) as string;
|
const id = this.getNodeParameter('id', i) as string;
|
||||||
|
|
||||||
endpoint = `cards/${id}/attachments`;
|
endpoint = `cards/${id}/attachments`;
|
||||||
|
|
||||||
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
Object.assign(qs, additionalFields);
|
Object.assign(qs, additionalFields);
|
||||||
} else {
|
|
||||||
|
} else if (operation === 'get') {
|
||||||
|
// ----------------------------------
|
||||||
|
// get
|
||||||
|
// ----------------------------------
|
||||||
|
|
||||||
|
requestMethod = 'GET';
|
||||||
|
|
||||||
|
const id = this.getNodeParameter('id', i) as string;
|
||||||
|
const attachmentId = this.getNodeParameter('attachmentId', i) as string;
|
||||||
|
|
||||||
|
endpoint = `cards/${id}/attachments/${attachmentId}`;
|
||||||
|
|
||||||
|
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
|
||||||
|
Object.assign(qs, additionalFields);
|
||||||
|
|
||||||
|
} else {
|
||||||
throw new Error(`The operation "${operation}" is not known!`);
|
throw new Error(`The operation "${operation}" is not known!`);
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in a new issue