feat(Pipedrive Node): Add option to update the file name and description (#6883)

This commit is contained in:
Bram Kn 2023-08-09 11:54:20 +02:00 committed by GitHub
parent 223284e227
commit f8ad543af5
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -359,6 +359,12 @@ export class Pipedrive implements INodeType {
description: 'Get data of a file',
action: 'Get a file',
},
{
name: 'Update',
value: 'update',
description: 'Update file details',
action: 'update details of a file',
},
// {
// name: 'Get All',
// value: 'getAll',
@ -2023,6 +2029,57 @@ export class Pipedrive implements INodeType {
description: 'ID of the file to get',
},
// ----------------------------------
// file:update
// ----------------------------------
{
displayName: 'File ID',
name: 'fileId',
type: 'number',
displayOptions: {
show: {
operation: ['update'],
resource: ['file'],
},
},
default: 0,
required: true,
description: 'ID of the file to update',
},
{
displayName: 'Update Fields',
name: 'updateFields',
type: 'collection',
placeholder: 'Add Field',
displayOptions: {
show: {
operation: ['update'],
resource: ['file'],
},
},
default: {},
options: [
{
displayName: 'Name',
name: 'name',
type: 'string',
default: '',
description: 'The updated visible name of the file',
},
{
displayName: 'Description',
name: 'description',
type: 'string',
default: '',
description: 'The updated description of the file',
},
],
},
// ----------------------------------
// lead
// ----------------------------------
// ----------------------------------------
// lead: create
// ----------------------------------------
@ -4380,6 +4437,16 @@ export class Pipedrive implements INodeType {
const fileId = this.getNodeParameter('fileId', i) as number;
endpoint = `/files/${fileId}`;
} else if (operation === 'update') {
// ----------------------------------
// file:update
// ----------------------------------
requestMethod = 'PUT';
const fileId = this.getNodeParameter('fileId', i) as number;
const updateFields = this.getNodeParameter('updateFields', i);
endpoint = `/files/${fileId}`;
addAdditionalFields(body, updateFields);
}
} else if (resource === 'note') {
if (operation === 'create') {
@ -4842,7 +4909,7 @@ export class Pipedrive implements INodeType {
responseData.data = [];
}
if (operation === 'search' && responseData.data && responseData.data.items) {
if (operation === 'search' && responseData.data?.items) {
responseData.data = responseData.data.items;
const additionalFields = this.getNodeParameter('additionalFields', i);
if (additionalFields.rawData !== true) {