mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-16 01:24:05 -08:00
cfd32d2642
* 🔥 Remove TSLint scripts * 🔥 Remove TSLint config * 🔥 Remove TSLint exceptions * 👕 Adjust lint config * ✏️ Add story numbers
31 lines
711 B
TypeScript
31 lines
711 B
TypeScript
import { IExecuteFunctions, IHookFunctions, ILoadOptionsFunctions } from 'n8n-core';
|
|
|
|
import { OptionsWithUri } from 'request';
|
|
|
|
import { IDataObject } from 'n8n-workflow';
|
|
|
|
export async function apiRequest(
|
|
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
|
method: string,
|
|
endpoint: string,
|
|
body: object,
|
|
query?: IDataObject,
|
|
): Promise<any> {
|
|
const credentials = await this.getCredentials('wekanApi');
|
|
|
|
query = query || {};
|
|
|
|
const options: OptionsWithUri = {
|
|
headers: {
|
|
Accept: 'application/json',
|
|
},
|
|
method,
|
|
body,
|
|
qs: query,
|
|
uri: `${credentials.url}/api/${endpoint}`,
|
|
json: true,
|
|
};
|
|
|
|
return this.helpers.requestWithAuthentication.call(this, 'wekanApi', options);
|
|
}
|