mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-19 11:01:15 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,16 +1,8 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, IHookFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
JsonObject,
|
||||
NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
import { JsonObject, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
/**
|
||||
* Make an API request to NextCloud
|
||||
@@ -21,7 +13,16 @@ import {
|
||||
* @param {object} body
|
||||
* @returns {Promise<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
|
||||
export async function nextCloudApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
body: object | string | Buffer,
|
||||
headers?: object,
|
||||
encoding?: null | undefined,
|
||||
query?: object,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const resource = this.getNodeParameter('resource', 0);
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
||||
@@ -29,9 +30,9 @@ export async function nextCloudApiRequest(this: IHookFunctions | IExecuteFunctio
|
||||
let credentials;
|
||||
|
||||
if (authenticationMethod === 'accessToken') {
|
||||
credentials = await this.getCredentials('nextCloudApi') as { webDavUrl: string };
|
||||
credentials = (await this.getCredentials('nextCloudApi')) as { webDavUrl: string };
|
||||
} else {
|
||||
credentials = await this.getCredentials('nextCloudOAuth2Api') as { webDavUrl: string };
|
||||
credentials = (await this.getCredentials('nextCloudOAuth2Api')) as { webDavUrl: string };
|
||||
}
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
@@ -52,11 +53,12 @@ export async function nextCloudApiRequest(this: IHookFunctions | IExecuteFunctio
|
||||
options.uri = options.uri.replace('/remote.php/webdav', '');
|
||||
}
|
||||
|
||||
const credentialType = authenticationMethod === 'accessToken' ? 'nextCloudApi' : 'nextCloudOAuth2Api';
|
||||
const credentialType =
|
||||
authenticationMethod === 'accessToken' ? 'nextCloudApi' : 'nextCloudOAuth2Api';
|
||||
|
||||
try {
|
||||
return await this.helpers.requestWithAuthentication.call(this, credentialType, options);
|
||||
} catch(error) {
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user