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