Add Checklist createItem functionality to Trello Node (#1444)

* Add Trello Checklist createItem functionality

* 💄 Small cosmetic change to #1433

Co-authored-by: Nicolas Antoniazzi <nicolas@codingame.com>
This commit is contained in:
Ricardo Espinoza 2021-02-15 03:42:41 -05:00 committed by GitHub
parent 19412b6025
commit c1ddb6c000
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 93 additions and 0 deletions

View file

@ -18,6 +18,11 @@ export const checklistOperations = [
},
},
options: [
{
name: 'Create Checklist Item',
value: 'createCheckItem',
description: 'Create a checklist item',
},
{
name: 'Create',
value: 'create',
@ -276,6 +281,79 @@ export const checklistFields = [
],
},
// ----------------------------------
// checklist:createCheckItem
// ----------------------------------
{
displayName: 'Checklist ID',
name: 'checklistId',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'createCheckItem',
],
resource: [
'checklist',
],
},
},
description: 'The ID of the checklist to update.',
},
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
required: true,
displayOptions: {
show: {
operation: [
'createCheckItem',
],
resource: [
'checklist',
],
},
},
description: 'The name of the new check item on the checklist.',
},
{
displayName: 'Additional Fields',
name: 'additionalFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: [
'createCheckItem',
],
resource: [
'checklist',
],
},
},
default: {},
options: [
{
displayName: 'Checked',
name: 'checked',
type: 'boolean',
default: false,
description: 'Determines whether the check item is already checked when created.',
},
{
displayName: 'Position',
name: 'pos',
type: 'string',
default: '',
description: 'The position of the checklist on the card. One of: top, bottom, or a positive number.',
},
],
},
// ----------------------------------
// checklist:deleteCheckItem
// ----------------------------------

View file

@ -565,6 +565,21 @@ export class Trello implements INodeType {
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(qs, additionalFields);
} else if (operation === 'createCheckItem') {
// ----------------------------------
// createCheckItem
// ----------------------------------
requestMethod = 'POST';
const checklistId = this.getNodeParameter('checklistId', i) as string;
endpoint = `checklists/${checklistId}/checkItems`;
const name = this.getNodeParameter('name', i) as string;
const additionalFields = this.getNodeParameter('additionalFields', i) as IDataObject;
Object.assign(qs, { name, ...additionalFields });
} else if (operation === 'deleteCheckItem') {
// ----------------------------------
// deleteCheckItem