mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +00:00
n8n-3867-progressively-apply-prettier-to-all (#3873)
* 🔨 formatting nodes with prettier
This commit is contained in:
@@ -1,18 +1,18 @@
|
||||
import {
|
||||
OptionsWithUri,
|
||||
} from 'request';
|
||||
import { OptionsWithUri } from 'request';
|
||||
|
||||
import {
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
} from 'n8n-core';
|
||||
import { IExecuteFunctions, IHookFunctions } from 'n8n-core';
|
||||
|
||||
import {
|
||||
IDataObject, NodeApiError,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function nasaApiRequest(this: IHookFunctions | IExecuteFunctions, method: string, endpoint: string, qs: IDataObject, option: IDataObject = {}, uri?: string | undefined): Promise<any> { // tslint:disable-line:no-any
|
||||
import { IDataObject, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function nasaApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
method: string,
|
||||
endpoint: string,
|
||||
qs: IDataObject,
|
||||
option: IDataObject = {},
|
||||
uri?: string | undefined,
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('nasaApi');
|
||||
|
||||
qs.api_key = credentials['api_key'] as string;
|
||||
@@ -30,14 +30,19 @@ export async function nasaApiRequest(this: IHookFunctions | IExecuteFunctions, m
|
||||
|
||||
try {
|
||||
return await this.helpers.request(options);
|
||||
|
||||
} catch (error) {
|
||||
throw new NodeApiError(this.getNode(), error);
|
||||
}
|
||||
}
|
||||
|
||||
export async function nasaApiRequestAllItems(this: IHookFunctions | IExecuteFunctions, propertyName: string, method: string, resource: string, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
export async function nasaApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
resource: string,
|
||||
query: IDataObject = {},
|
||||
// tslint:disable-next-line:no-any
|
||||
): Promise<any> {
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
@@ -50,11 +55,7 @@ export async function nasaApiRequestAllItems(this: IHookFunctions | IExecuteFunc
|
||||
responseData = await nasaApiRequest.call(this, method, resource, query, {}, uri);
|
||||
uri = responseData.links.next;
|
||||
returnData.push.apply(returnData, responseData[propertyName]);
|
||||
} while (
|
||||
responseData.links.next !== undefined
|
||||
);
|
||||
} while (responseData.links.next !== undefined);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user