refactor: Format nodes-base package (A-F) (#3800)

* 🔨 prettier formated nodes - A

* 🔨 prettier formated nodes - B

*  prettier formated nodes - C

*  prettier formated nodes - D

*  prettier formated nodes - E-F

* 🎨 Adjust nodes-base formatting command (#3805)

* Format additional files in nodes A-F (#3811)

*  fixes

* 🎨 Add Mindee to ignored dirs

Co-authored-by: Iván Ovejero <ivov.src@gmail.com>
This commit is contained in:
Michael Kret
2022-08-01 23:47:55 +03:00
committed by GitHub
parent 2c17e6f3ca
commit 0ecbb4a19d
411 changed files with 12906 additions and 20148 deletions

View File

@@ -1,6 +1,4 @@
import {
OptionsWithUri,
} from 'request';
import { OptionsWithUri } from 'request';
import {
IExecuteFunctions,
@@ -9,18 +7,26 @@ import {
ILoadOptionsFunctions,
} from 'n8n-core';
import {
IDataObject, NodeApiError, NodeOperationError,
} from 'n8n-workflow';
import { IDataObject, NodeApiError, NodeOperationError } from 'n8n-workflow';
export async function bitlyApiRequest(this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
export async function bitlyApiRequest(
this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
method: string,
resource: string,
// tslint:disable-next-line:no-any
body: any = {},
qs: IDataObject = {},
uri?: string,
option: IDataObject = {},
// tslint:disable-next-line:no-any
): Promise<any> {
const authenticationMethod = this.getNodeParameter('authentication', 0) as string;
let options: OptionsWithUri = {
headers: {},
method,
qs,
body,
uri: uri ||`https://api-ssl.bitly.com/v4${resource}`,
uri: uri || `https://api-ssl.bitly.com/v4${resource}`,
json: true,
};
options = Object.assign({}, options, option);
@@ -28,17 +34,18 @@ export async function bitlyApiRequest(this: IHookFunctions | IExecuteFunctions |
delete options.body;
}
try{
try {
if (authenticationMethod === 'accessToken') {
const credentials = await this.getCredentials('bitlyApi');
options.headers = { Authorization: `Bearer ${credentials.accessToken}`};
options.headers = { Authorization: `Bearer ${credentials.accessToken}` };
return await this.helpers.request!(options);
} else {
return await this.helpers.requestOAuth2!.call(this, 'bitlyOAuth2Api', options, { tokenType: 'Bearer' });
return await this.helpers.requestOAuth2!.call(this, 'bitlyOAuth2Api', options, {
tokenType: 'Bearer',
});
}
} catch(error) {
} catch (error) {
throw new NodeApiError(this.getNode(), error);
}
}
@@ -47,8 +54,16 @@ export async function bitlyApiRequest(this: IHookFunctions | IExecuteFunctions |
* Make an API request to paginated flow endpoint
* and return all results
*/
export async function bitlyApiRequestAllItems(this: IHookFunctions | IExecuteFunctions| ILoadOptionsFunctions, propertyName: string, method: string, resource: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
export async function bitlyApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string,
method: string,
resource: string,
// tslint:disable-next-line:no-any
body: any = {},
query: IDataObject = {},
// tslint:disable-next-line:no-any
): Promise<any> {
const returnData: IDataObject[] = [];
let responseData;
@@ -61,9 +76,6 @@ export async function bitlyApiRequestAllItems(this: IHookFunctions | IExecuteFun
if (responseData.pagination && responseData.pagination.next) {
uri = responseData.pagination.next;
}
} while (
responseData.pagination !== undefined &&
responseData.pagination.next !== undefined
);
} while (responseData.pagination !== undefined && responseData.pagination.next !== undefined);
return returnData;
}