mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,15 +1,8 @@
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, IHookFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject, JsonObject, NodeApiError, NodeOperationError,
|
||||
} from 'n8n-workflow';
|
||||
import { IDataObject, JsonObject, NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
/**
|
||||
* Make an authenticated or unauthenticated API request to Reddit.
|
||||
@@ -19,8 +12,8 @@ export async function redditApiRequest(
|
||||
method: string,
|
||||
endpoint: string,
|
||||
qs: IDataObject,
|
||||
): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const resource = this.getNodeParameter('resource', 0) as string;
|
||||
|
||||
const authRequired = ['profile', 'post', 'postComment'].includes(resource);
|
||||
@@ -32,7 +25,9 @@ export async function redditApiRequest(
|
||||
'user-agent': 'n8n',
|
||||
},
|
||||
method,
|
||||
uri: authRequired ? `https://oauth.reddit.com/${endpoint}` : `https://www.reddit.com/${endpoint}`,
|
||||
uri: authRequired
|
||||
? `https://oauth.reddit.com/${endpoint}`
|
||||
: `https://www.reddit.com/${endpoint}`,
|
||||
qs,
|
||||
json: true,
|
||||
};
|
||||
@@ -47,9 +42,7 @@ export async function redditApiRequest(
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error as JsonObject);
|
||||
}
|
||||
|
||||
} else {
|
||||
|
||||
try {
|
||||
return await this.helpers.request.call(this, options);
|
||||
} catch (error) {
|
||||
@@ -66,8 +59,8 @@ export async function redditApiRequestAllItems(
|
||||
method: string,
|
||||
endpoint: string,
|
||||
qs: IDataObject,
|
||||
): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
let responseData;
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
@@ -93,7 +86,6 @@ export async function redditApiRequestAllItems(
|
||||
if (qs.limit && returnData.length >= qs.limit && returnAll === false) {
|
||||
return returnData;
|
||||
}
|
||||
|
||||
} while (responseData.data && responseData.data.after);
|
||||
|
||||
return returnData;
|
||||
@@ -108,8 +100,8 @@ export async function handleListing(
|
||||
endpoint: string,
|
||||
qs: IDataObject = {},
|
||||
requestMethod: 'GET' | 'POST' = 'GET',
|
||||
): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
let responseData;
|
||||
|
||||
const returnAll = this.getNodeParameter('returnAll', i);
|
||||
|
||||
Reference in New Issue
Block a user