mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-25 12:44:07 -08:00
⚡ Minor improvement to NextCloud Node
This commit is contained in:
parent
2ca9c6de7d
commit
1cfdae389e
|
@ -19,8 +19,8 @@ import {
|
||||||
export async function nextCloudApiRequest(this: IHookFunctions | IExecuteFunctions, method: string, endpoint: string, body: object | string | Buffer, headers?: object, encoding?: null | undefined, query?: object): Promise<any> { // tslint:disable-line:no-any
|
export async function nextCloudApiRequest(this: IHookFunctions | IExecuteFunctions, method: string, endpoint: string, body: object | string | Buffer, headers?: object, encoding?: null | undefined, query?: object): Promise<any> { // tslint:disable-line:no-any
|
||||||
const resource = this.getNodeParameter('resource', 0);
|
const resource = this.getNodeParameter('resource', 0);
|
||||||
const operation = this.getNodeParameter('operation', 0);
|
const operation = this.getNodeParameter('operation', 0);
|
||||||
|
|
||||||
const options : OptionsWithUri = {
|
const options: OptionsWithUri = {
|
||||||
headers,
|
headers,
|
||||||
method,
|
method,
|
||||||
body,
|
body,
|
||||||
|
|
|
@ -695,7 +695,6 @@ export class NextCloud implements INodeType {
|
||||||
}
|
}
|
||||||
|
|
||||||
} else if (resource === 'user') {
|
} else if (resource === 'user') {
|
||||||
|
|
||||||
if (operation === 'create') {
|
if (operation === 'create') {
|
||||||
// ----------------------------------
|
// ----------------------------------
|
||||||
// user:create
|
// user:create
|
||||||
|
@ -774,7 +773,12 @@ export class NextCloud implements INodeType {
|
||||||
if (err) {
|
if (err) {
|
||||||
return reject(err);
|
return reject(err);
|
||||||
}
|
}
|
||||||
resolve(data as IDataObject);
|
|
||||||
|
if (data.ocs.meta.status !== 'ok') {
|
||||||
|
return reject(new Error(data.ocs.meta.message));
|
||||||
|
}
|
||||||
|
|
||||||
|
resolve(data.ocs.data as IDataObject);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|
||||||
|
@ -841,7 +845,7 @@ export class NextCloud implements INodeType {
|
||||||
if (resource === 'file' && operation === 'download') {
|
if (resource === 'file' && operation === 'download') {
|
||||||
// For file downloads the files get attached to the existing items
|
// For file downloads the files get attached to the existing items
|
||||||
return this.prepareOutputData(items);
|
return this.prepareOutputData(items);
|
||||||
} else {
|
} else {
|
||||||
// For all other ones does the output get replaced
|
// For all other ones does the output get replaced
|
||||||
return [this.helpers.returnJsonArray(returnData)];
|
return [this.helpers.returnJsonArray(returnData)];
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue