Minor improvements on NextCloud Node

This commit is contained in:
Jan Oberhauser
2021-04-24 00:11:44 +02:00
parent d9f7ebdea9
commit 35e790b8dd

View File

@@ -699,8 +699,8 @@ export class NextCloud implements INodeType {
// user:update // user:update
// ---------------------------------- // ----------------------------------
{ {
displayName: 'Options', displayName: 'Update Fields',
name: 'options', name: 'updateFields',
type: 'fixedCollection', type: 'fixedCollection',
typeOptions: { typeOptions: {
multipleValues: false, multipleValues: false,
@@ -719,8 +719,8 @@ export class NextCloud implements INodeType {
}, },
options: [ options: [
{ {
displayName: 'Options', displayName: 'Fields',
name: 'option', name: 'field',
values: [ values: [
{ {
displayName: 'Key', displayName: 'Key',
@@ -730,9 +730,9 @@ export class NextCloud implements INodeType {
options: options:
[ [
{ {
name: 'Email', name: 'Address',
value: 'email', value: 'address',
description: 'The new email for the user.', description: 'The new address for the user.',
}, },
{ {
name: 'Display Name', name: 'Display Name',
@@ -740,34 +740,34 @@ export class NextCloud implements INodeType {
description: 'The new display name for the user.', description: 'The new display name for the user.',
}, },
{ {
name: 'Address', name: 'Email',
value: 'address', value: 'email',
description: 'The new address for the user.', description: 'The new email for the user.',
},
{
name: 'Website',
value: 'website',
description: 'The new website for the user.',
},
{
name: 'Twitter',
value: 'twitter',
description: 'The new twitter for the user.',
}, },
{ {
name: 'Password', name: 'Password',
value: 'password', value: 'password',
description: 'The new password for the user.', description: 'The new password for the user.',
}, },
{
name: 'Twitter',
value: 'twitter',
description: 'The new twitter handle for the user.',
},
{
name: 'Website',
value: 'website',
description: 'The new website for the user.',
},
], ],
description: 'Key of the updated attribut.', description: 'Key of the updated attribute.',
}, },
{ {
displayName: 'Value', displayName: 'Value',
name: 'value', name: 'value',
type: 'string', type: 'string',
default: '', default: '',
description: 'Value of the updated attribut.', description: 'Value of the updated attribute.',
}, },
], ],
}, },
@@ -900,6 +900,7 @@ export class NextCloud implements INodeType {
// ---------------------------------- // ----------------------------------
// user:create // user:create
// ---------------------------------- // ----------------------------------
requestMethod = 'POST'; requestMethod = 'POST';
endpoint = 'ocs/v1.php/cloud/users'; endpoint = 'ocs/v1.php/cloud/users';
@@ -922,6 +923,7 @@ export class NextCloud implements INodeType {
// ---------------------------------- // ----------------------------------
// user:delete // user:delete
// ---------------------------------- // ----------------------------------
requestMethod = 'DELETE'; requestMethod = 'DELETE';
const userid = this.getNodeParameter('userId', i) as string; const userid = this.getNodeParameter('userId', i) as string;
@@ -934,6 +936,7 @@ export class NextCloud implements INodeType {
// ---------------------------------- // ----------------------------------
// user:get // user:get
// ---------------------------------- // ----------------------------------
requestMethod = 'GET'; requestMethod = 'GET';
const userid = this.getNodeParameter('userId', i) as string; const userid = this.getNodeParameter('userId', i) as string;
@@ -946,6 +949,7 @@ export class NextCloud implements INodeType {
// ---------------------------------- // ----------------------------------
// user:getAll // user:getAll
// ---------------------------------- // ----------------------------------
requestMethod = 'GET'; requestMethod = 'GET';
const returnAll = this.getNodeParameter('returnAll', i) as boolean; const returnAll = this.getNodeParameter('returnAll', i) as boolean;
qs = this.getNodeParameter('options', i) as IDataObject; qs = this.getNodeParameter('options', i) as IDataObject;
@@ -959,14 +963,15 @@ export class NextCloud implements INodeType {
} }
if (operation === 'update') { if (operation === 'update') {
// ---------------------------------- // ----------------------------------
// user:get // user:update
// ---------------------------------- // ----------------------------------
requestMethod = 'PUT'; requestMethod = 'PUT';
const userid = this.getNodeParameter('userId', i) as string; const userid = this.getNodeParameter('userId', i) as string;
endpoint = `ocs/v1.php/cloud/users/${userid}`; endpoint = `ocs/v1.php/cloud/users/${userid}`;
body = Object.entries((this.getNodeParameter('options', i) as IDataObject).option as IDataObject).map(entry=> { body = Object.entries((this.getNodeParameter('updateFields', i) as IDataObject).field as IDataObject).map(entry => {
const [key, value] = entry; const [key, value] = entry;
return `${key}=${value}`; return `${key}=${value}`;
}).join('&'); }).join('&');