refactor: Add IRequestOptions type to helpers.request for more type safety (no-changelog) (#8563)

Co-authored-by: कारतोफ्फेलस्क्रिप्ट™ <aditya@netroy.in>
This commit is contained in:
Elias Meire 2024-02-14 16:29:09 +01:00 committed by GitHub
parent 24859cfef5
commit 100d9bc087
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
330 changed files with 1682 additions and 1492 deletions

View file

@ -117,7 +117,6 @@
"@types/express": "^4.17.6", "@types/express": "^4.17.6",
"@types/html-to-text": "^9.0.1", "@types/html-to-text": "^9.0.1",
"@types/json-schema": "^7.0.12", "@types/json-schema": "^7.0.12",
"@types/request-promise-native": "~1.0.15",
"@types/temp": "^0.9.1", "@types/temp": "^0.9.1",
"eslint-plugin-n8n-nodes-base": "^1.16.0", "eslint-plugin-n8n-nodes-base": "^1.16.0",
"gulp": "^4.0.2", "gulp": "^4.0.2",

View file

@ -40,7 +40,6 @@
"@types/express": "^4.17.6", "@types/express": "^4.17.6",
"@types/lodash": "^4.14.195", "@types/lodash": "^4.14.195",
"@types/mime-types": "^2.1.0", "@types/mime-types": "^2.1.0",
"@types/request-promise-native": "~1.0.15",
"@types/uuid": "^8.3.2", "@types/uuid": "^8.3.2",
"@types/xml2js": "^0.4.11" "@types/xml2js": "^0.4.11"
}, },

View file

@ -18,10 +18,8 @@ import type {
AxiosError, AxiosError,
AxiosHeaders, AxiosHeaders,
AxiosPromise, AxiosPromise,
AxiosProxyConfig,
AxiosRequestConfig, AxiosRequestConfig,
AxiosResponse, AxiosResponse,
Method,
} from 'axios'; } from 'axios';
import axios from 'axios'; import axios from 'axios';
import crypto, { createHmac } from 'crypto'; import crypto, { createHmac } from 'crypto';
@ -77,6 +75,7 @@ import type {
IOAuth2Options, IOAuth2Options,
IPairedItemData, IPairedItemData,
IPollFunctions, IPollFunctions,
IRequestOptions,
IRunExecutionData, IRunExecutionData,
ISourceData, ISourceData,
ITaskData, ITaskData,
@ -121,8 +120,6 @@ import type { Token } from 'oauth-1.0a';
import clientOAuth1 from 'oauth-1.0a'; import clientOAuth1 from 'oauth-1.0a';
import path from 'path'; import path from 'path';
import { stringify } from 'qs'; import { stringify } from 'qs';
import type { OptionsWithUrl } from 'request';
import type { OptionsWithUri, RequestPromiseOptions } from 'request-promise-native';
import { Readable } from 'stream'; import { Readable } from 'stream';
import url, { URL, URLSearchParams } from 'url'; import url, { URL, URLSearchParams } from 'url';
@ -255,7 +252,7 @@ const getHostFromRequestObject = (
} }
}; };
export async function parseRequestObject(requestObject: IDataObject) { export async function parseRequestObject(requestObject: IRequestOptions) {
// This function is a temporary implementation // This function is a temporary implementation
// That translates all http requests done via // That translates all http requests done via
// the request library to axios directly // the request library to axios directly
@ -369,28 +366,28 @@ export async function parseRequestObject(requestObject: IDataObject) {
} }
if (requestObject.uri !== undefined) { if (requestObject.uri !== undefined) {
axiosConfig.url = requestObject.uri?.toString() as string; axiosConfig.url = requestObject.uri?.toString();
} }
if (requestObject.url !== undefined) { if (requestObject.url !== undefined) {
axiosConfig.url = requestObject.url?.toString() as string; axiosConfig.url = requestObject.url?.toString();
} }
if (requestObject.baseURL !== undefined) { if (requestObject.baseURL !== undefined) {
axiosConfig.baseURL = requestObject.baseURL?.toString() as string; axiosConfig.baseURL = requestObject.baseURL?.toString();
} }
if (requestObject.method !== undefined) { if (requestObject.method !== undefined) {
axiosConfig.method = requestObject.method as Method; axiosConfig.method = requestObject.method;
} }
if (requestObject.qs !== undefined && Object.keys(requestObject.qs as object).length > 0) { if (requestObject.qs !== undefined && Object.keys(requestObject.qs as object).length > 0) {
axiosConfig.params = requestObject.qs as IDataObject; axiosConfig.params = requestObject.qs;
} }
function hasArrayFormatOptions( function hasArrayFormatOptions(
arg: IDataObject, arg: IRequestOptions,
): arg is IDataObject & { qsStringifyOptions: { arrayFormat: 'repeat' | 'brackets' } } { ): arg is Required<Pick<IRequestOptions, 'qsStringifyOptions'>> {
if ( if (
typeof arg.qsStringifyOptions === 'object' && typeof arg.qsStringifyOptions === 'object' &&
arg.qsStringifyOptions !== null && arg.qsStringifyOptions !== null &&
@ -428,13 +425,13 @@ export async function parseRequestObject(requestObject: IDataObject) {
if (requestObject.auth !== undefined) { if (requestObject.auth !== undefined) {
// Check support for sendImmediately // Check support for sendImmediately
if ((requestObject.auth as IDataObject).bearer !== undefined) { if (requestObject.auth.bearer !== undefined) {
axiosConfig.headers = Object.assign(axiosConfig.headers || {}, { axiosConfig.headers = Object.assign(axiosConfig.headers || {}, {
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions // eslint-disable-next-line @typescript-eslint/restrict-template-expressions
Authorization: `Bearer ${(requestObject.auth as IDataObject).bearer}`, Authorization: `Bearer ${requestObject.auth.bearer}`,
}); });
} else { } else {
const authObj = requestObject.auth as IDataObject; const authObj = requestObject.auth;
// Request accepts both user/username and pass/password // Request accepts both user/username and pass/password
axiosConfig.auth = { axiosConfig.auth = {
username: (authObj.user || authObj.username) as string, username: (authObj.user || authObj.username) as string,
@ -506,7 +503,7 @@ export async function parseRequestObject(requestObject: IDataObject) {
axiosConfig.httpsAgent = new Agent(agentOptions); axiosConfig.httpsAgent = new Agent(agentOptions);
if (requestObject.timeout !== undefined) { if (requestObject.timeout !== undefined) {
axiosConfig.timeout = requestObject.timeout as number; axiosConfig.timeout = requestObject.timeout;
} }
if (requestObject.proxy !== undefined) { if (requestObject.proxy !== undefined) {
@ -565,7 +562,7 @@ export async function parseRequestObject(requestObject: IDataObject) {
} }
} }
} else { } else {
axiosConfig.proxy = requestObject.proxy as AxiosProxyConfig; axiosConfig.proxy = requestObject.proxy;
} }
} }
@ -664,12 +661,6 @@ function digestAuthAxiosConfig(
return axiosConfig; return axiosConfig;
} }
type ConfigObject = {
auth?: { sendImmediately: boolean };
resolveWithFullResponse?: boolean;
simple?: boolean;
};
interface IContentType { interface IContentType {
type: string; type: string;
parameters: { parameters: {
@ -762,14 +753,14 @@ export async function proxyRequestToAxios(
workflow: Workflow | undefined, workflow: Workflow | undefined,
additionalData: IWorkflowExecuteAdditionalData | undefined, additionalData: IWorkflowExecuteAdditionalData | undefined,
node: INode | undefined, node: INode | undefined,
uriOrObject: string | object, uriOrObject: string | IRequestOptions,
options?: object, options?: IRequestOptions,
): Promise<any> { ): Promise<any> {
let axiosConfig: AxiosRequestConfig = { let axiosConfig: AxiosRequestConfig = {
maxBodyLength: Infinity, maxBodyLength: Infinity,
maxContentLength: Infinity, maxContentLength: Infinity,
}; };
let configObject: ConfigObject & { uri?: string }; let configObject: IRequestOptions;
if (typeof uriOrObject === 'string') { if (typeof uriOrObject === 'string') {
configObject = { uri: uriOrObject, ...options }; configObject = { uri: uriOrObject, ...options };
} else { } else {
@ -1247,10 +1238,10 @@ async function prepareBinaryData(
} }
function applyPaginationRequestData( function applyPaginationRequestData(
requestData: OptionsWithUri, requestData: IRequestOptions,
paginationRequestData: PaginationOptions['request'], paginationRequestData: PaginationOptions['request'],
): OptionsWithUri { ): IRequestOptions {
const preparedPaginationData: Partial<OptionsWithUri> = { const preparedPaginationData: Partial<IRequestOptions> = {
...paginationRequestData, ...paginationRequestData,
uri: paginationRequestData.url, uri: paginationRequestData.url,
}; };
@ -1269,13 +1260,13 @@ function applyPaginationRequestData(
/** /**
* Makes a request using OAuth data for authentication * Makes a request using OAuth data for authentication
* *
* @param {(OptionsWithUri | RequestPromiseOptions)} requestOptions * @param {(IHttpRequestOptions | IRequestOptions)} requestOptions
* *
*/ */
export async function requestOAuth2( export async function requestOAuth2(
this: IAllExecuteFunctions, this: IAllExecuteFunctions,
credentialsType: string, credentialsType: string,
requestOptions: OptionsWithUri | RequestPromiseOptions | IHttpRequestOptions, requestOptions: IHttpRequestOptions | IRequestOptions,
node: INode, node: INode,
additionalData: IWorkflowExecuteAdditionalData, additionalData: IWorkflowExecuteAdditionalData,
oAuth2Options?: IOAuth2Options, oAuth2Options?: IOAuth2Options,
@ -1339,7 +1330,7 @@ export async function requestOAuth2(
oAuth2Options?.tokenType || oauthTokenData.tokenType, oAuth2Options?.tokenType || oauthTokenData.tokenType,
); );
(requestOptions as OptionsWithUri).rejectUnauthorized = !credentials.ignoreSSLIssues; (requestOptions as IRequestOptions).rejectUnauthorized = !credentials.ignoreSSLIssues;
// Signs the request by adding authorization headers or query parameters depending // Signs the request by adding authorization headers or query parameters depending
// on the token-type used. // on the token-type used.
@ -1423,7 +1414,7 @@ export async function requestOAuth2(
: oAuth2Options?.tokenExpiredStatusCode; : oAuth2Options?.tokenExpiredStatusCode;
return await this.helpers return await this.helpers
.request(newRequestOptions) .request(newRequestOptions as IRequestOptions)
.then((response) => { .then((response) => {
const requestOptions = newRequestOptions as any; const requestOptions = newRequestOptions as any;
if ( if (
@ -1499,7 +1490,7 @@ export async function requestOAuth2(
}); });
} }
return await this.helpers.request(newRequestOptions); return await this.helpers.request(newRequestOptions as IRequestOptions);
} }
// Unknown error so simply throw it // Unknown error so simply throw it
@ -1513,7 +1504,7 @@ export async function requestOAuth2(
export async function requestOAuth1( export async function requestOAuth1(
this: IAllExecuteFunctions, this: IAllExecuteFunctions,
credentialsType: string, credentialsType: string,
requestOptions: OptionsWithUrl | OptionsWithUri | RequestPromiseOptions | IHttpRequestOptions, requestOptions: IHttpRequestOptions | IRequestOptions,
isN8nRequest = false, isN8nRequest = false,
) { ) {
const credentials = await this.getCredentials(credentialsType); const credentials = await this.getCredentials(credentialsType);
@ -1560,25 +1551,24 @@ export async function requestOAuth1(
requestOptions.data = { ...requestOptions.qs, ...requestOptions.form }; requestOptions.data = { ...requestOptions.qs, ...requestOptions.form };
// Fixes issue that OAuth1 library only works with "url" property and not with "uri" // Fixes issue that OAuth1 library only works with "url" property and not with "uri"
// @ts-expect-error @TECH_DEBT: Remove request library if ('uri' in requestOptions && !requestOptions.url) {
if (requestOptions.uri && !requestOptions.url) {
// @ts-expect-error @TECH_DEBT: Remove request library
requestOptions.url = requestOptions.uri; requestOptions.url = requestOptions.uri;
// @ts-expect-error @TECH_DEBT: Remove request library
delete requestOptions.uri; delete requestOptions.uri;
} }
requestOptions.headers = oauth.toHeader( requestOptions.headers = oauth.toHeader(
oauth.authorize(requestOptions as unknown as clientOAuth1.RequestOptions, token), oauth.authorize(requestOptions as unknown as clientOAuth1.RequestOptions, token),
); ) as unknown as Record<string, string>;
if (isN8nRequest) { if (isN8nRequest) {
return await this.helpers.httpRequest(requestOptions as IHttpRequestOptions); return await this.helpers.httpRequest(requestOptions as IHttpRequestOptions);
} }
return await this.helpers.request(requestOptions).catch(async (error: IResponseError) => { return await this.helpers
// Unknown error so simply throw it .request(requestOptions as IRequestOptions)
throw error; .catch(async (error: IResponseError) => {
}); // Unknown error so simply throw it
throw error;
});
} }
export async function httpRequestWithAuthentication( export async function httpRequestWithAuthentication(
@ -1776,7 +1766,7 @@ export function normalizeItems(
export async function requestWithAuthentication( export async function requestWithAuthentication(
this: IAllExecuteFunctions, this: IAllExecuteFunctions,
credentialsType: string, credentialsType: string,
requestOptions: OptionsWithUri | RequestPromiseOptions, requestOptions: IRequestOptions,
workflow: Workflow, workflow: Workflow,
node: INode, node: INode,
additionalData: IWorkflowExecuteAdditionalData, additionalData: IWorkflowExecuteAdditionalData,
@ -1831,14 +1821,14 @@ export async function requestWithAuthentication(
Object.assign(credentialsDecrypted, data); Object.assign(credentialsDecrypted, data);
} }
requestOptions = await additionalData.credentialsHelper.authenticate( requestOptions = (await additionalData.credentialsHelper.authenticate(
credentialsDecrypted, credentialsDecrypted,
credentialsType, credentialsType,
requestOptions as IHttpRequestOptions, requestOptions as IHttpRequestOptions,
workflow, workflow,
node, node,
); )) as IRequestOptions;
return await proxyRequestToAxios(workflow, additionalData, node, requestOptions as IDataObject); return await proxyRequestToAxios(workflow, additionalData, node, requestOptions);
} catch (error) { } catch (error) {
try { try {
if (credentialsDecrypted !== undefined) { if (credentialsDecrypted !== undefined) {
@ -1855,20 +1845,15 @@ export async function requestWithAuthentication(
// make the updated property in the credentials // make the updated property in the credentials
// available to the authenticate method // available to the authenticate method
Object.assign(credentialsDecrypted, data); Object.assign(credentialsDecrypted, data);
requestOptions = await additionalData.credentialsHelper.authenticate( requestOptions = (await additionalData.credentialsHelper.authenticate(
credentialsDecrypted, credentialsDecrypted,
credentialsType, credentialsType,
requestOptions as IHttpRequestOptions, requestOptions as IHttpRequestOptions,
workflow, workflow,
node, node,
); )) as IRequestOptions;
// retry the request // retry the request
return await proxyRequestToAxios( return await proxyRequestToAxios(workflow, additionalData, node, requestOptions);
workflow,
additionalData,
node,
requestOptions as IDataObject,
);
} }
} }
throw error; throw error;
@ -2849,7 +2834,7 @@ const getRequestHelperFunctions = (
httpRequest, httpRequest,
async requestWithAuthenticationPaginated( async requestWithAuthenticationPaginated(
this: IExecuteFunctions, this: IExecuteFunctions,
requestOptions: OptionsWithUri, requestOptions: IRequestOptions,
itemIndex: number, itemIndex: number,
paginationOptions: PaginationOptions, paginationOptions: PaginationOptions,
credentialsType?: string, credentialsType?: string,
@ -3093,7 +3078,7 @@ const getRequestHelperFunctions = (
async requestOAuth1( async requestOAuth1(
this: IAllExecuteFunctions, this: IAllExecuteFunctions,
credentialsType: string, credentialsType: string,
requestOptions: OptionsWithUrl | RequestPromiseOptions, requestOptions: IRequestOptions,
): Promise<any> { ): Promise<any> {
return await requestOAuth1.call(this, credentialsType, requestOptions); return await requestOAuth1.call(this, credentialsType, requestOptions);
}, },
@ -3101,7 +3086,7 @@ const getRequestHelperFunctions = (
async requestOAuth2( async requestOAuth2(
this: IAllExecuteFunctions, this: IAllExecuteFunctions,
credentialsType: string, credentialsType: string,
requestOptions: OptionsWithUri | RequestPromiseOptions, requestOptions: IRequestOptions,
oAuth2Options?: IOAuth2Options, oAuth2Options?: IOAuth2Options,
): Promise<any> { ): Promise<any> {
return await requestOAuth2.call( return await requestOAuth2.call(

View file

@ -8,9 +8,9 @@ import type {
IDataObject, IDataObject,
IHttpRequestOptions, IHttpRequestOptions,
INodeProperties, INodeProperties,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { isObjectEmpty } from 'n8n-workflow'; import { isObjectEmpty } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
export const regions = [ export const regions = [
{ {
@ -286,16 +286,16 @@ export class Aws implements ICredentialType {
let body = requestOptions.body; let body = requestOptions.body;
let region = credentials.region; let region = credentials.region;
let query = requestOptions.qs?.query as IDataObject; let query = requestOptions.qs?.query as IDataObject;
// ! Workaround as we still use the OptionsWithUri interface which uses uri instead of url // ! Workaround as we still use the IRequestOptions interface which uses uri instead of url
// ! To change when we replace the interface with IHttpRequestOptions // ! To change when we replace the interface with IHttpRequestOptions
const requestWithUri = requestOptions as unknown as OptionsWithUri; const requestWithUri = requestOptions as unknown as IRequestOptions;
if (requestWithUri.uri) { if (requestWithUri.uri) {
requestOptions.url = requestWithUri.uri as string; requestOptions.url = requestWithUri.uri;
endpoint = new URL(requestOptions.url); endpoint = new URL(requestOptions.url);
if (service === 'sts') { if (service === 'sts') {
try { try {
if (requestWithUri.qs?.Action !== 'GetCallerIdentity') { if (requestWithUri.qs?.Action !== 'GetCallerIdentity') {
query = requestWithUri.qs; query = requestWithUri.qs as IDataObject;
} else { } else {
endpoint.searchParams.set('Action', 'GetCallerIdentity'); endpoint.searchParams.set('Action', 'GetCallerIdentity');
endpoint.searchParams.set('Version', '2011-06-15'); endpoint.searchParams.set('Version', '2011-06-15');

View file

@ -1,6 +1,10 @@
import type { IDataObject, IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-workflow'; import type {
IDataObject,
import type { OptionsWithUri } from 'request'; IExecuteFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions,
IRequestOptions,
} from 'n8n-workflow';
import flow from 'lodash/flow'; import flow from 'lodash/flow';
import omit from 'lodash/omit'; import omit from 'lodash/omit';
@ -17,12 +21,12 @@ import type {
export async function actionNetworkApiRequest( export async function actionNetworkApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
) { ) {
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
body, body,
qs, qs,
@ -59,7 +63,7 @@ const toItemsKey = (endpoint: string) => {
export async function handleListing( export async function handleListing(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -77,7 +81,13 @@ export async function handleListing(
const itemsKey = toItemsKey(endpoint); const itemsKey = toItemsKey(endpoint);
do { do {
responseData = await actionNetworkApiRequest.call(this, method, endpoint, body, qs); responseData = await actionNetworkApiRequest.call(
this,
method as IHttpRequestMethods,
endpoint,
body,
qs,
);
const items = responseData._embedded[itemsKey]; const items = responseData._embedded[itemsKey];
returnData.push(...(items as IDataObject[])); returnData.push(...(items as IDataObject[]));

View file

@ -6,6 +6,7 @@ import type {
INodePropertyOptions, INodePropertyOptions,
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow';
@ -317,7 +318,7 @@ export class ActiveCampaign implements INodeType {
// For Query string // For Query string
let qs: IDataObject; let qs: IDataObject;
let requestMethod: string; let requestMethod: IHttpRequestMethods;
let endpoint: string; let endpoint: string;
let returnAll = false; let returnAll = false;
let dataKey: string | undefined; let dataKey: string | undefined;

View file

@ -5,11 +5,11 @@ import type {
ILoadOptionsFunctions, ILoadOptionsFunctions,
INodeProperties, INodeProperties,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
export interface IProduct { export interface IProduct {
fields: { fields: {
item?: object[]; item?: object[];
@ -22,7 +22,7 @@ export interface IProduct {
*/ */
export async function activeCampaignApiRequest( export async function activeCampaignApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject, body: IDataObject,
query?: IDataObject, query?: IDataObject,
@ -34,7 +34,7 @@ export async function activeCampaignApiRequest(
query = {}; query = {};
} }
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: {}, headers: {},
method, method,
qs: query, qs: query,
@ -75,7 +75,7 @@ export async function activeCampaignApiRequest(
*/ */
export async function activeCampaignApiRequestAllItems( export async function activeCampaignApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject, body: IDataObject,
query?: IDataObject, query?: IDataObject,

View file

@ -1,9 +1,10 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
@ -11,7 +12,7 @@ import { NodeApiError } from 'n8n-workflow';
export async function acuitySchedulingApiRequest( export async function acuitySchedulingApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -20,7 +21,7 @@ export async function acuitySchedulingApiRequest(
): Promise<any> { ): Promise<any> {
const authenticationMethod = this.getNodeParameter('authentication', 0); const authenticationMethod = this.getNodeParameter('authentication', 0);
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },

View file

@ -1,5 +1,3 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
@ -7,12 +5,14 @@ import type {
IHookFunctions, IHookFunctions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { BINARY_ENCODING, NodeApiError } from 'n8n-workflow'; import { BINARY_ENCODING, NodeApiError } from 'n8n-workflow';
export async function affinityApiRequest( export async function affinityApiRequest(
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
query: IDataObject = {}, query: IDataObject = {},
@ -25,7 +25,7 @@ export async function affinityApiRequest(
const endpoint = 'https://api.affinity.co'; const endpoint = 'https://api.affinity.co';
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Authorization: `Basic ${Buffer.from(apiKey).toString(BINARY_ENCODING)}`, Authorization: `Basic ${Buffer.from(apiKey).toString(BINARY_ENCODING)}`,
@ -53,7 +53,7 @@ export async function affinityApiRequest(
export async function affinityApiRequestAllItems( export async function affinityApiRequestAllItems(
this: IHookFunctions | ILoadOptionsFunctions | IExecuteFunctions, this: IHookFunctions | ILoadOptionsFunctions | IExecuteFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
query: IDataObject = {}, query: IDataObject = {},

View file

@ -1,11 +1,11 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
@ -15,7 +15,7 @@ import type { IFilterRules, ISearchConditions } from './FilterInterface';
export async function agileCrmApiRequest( export async function agileCrmApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},
query: IDataObject = {}, query: IDataObject = {},
@ -23,7 +23,7 @@ export async function agileCrmApiRequest(
sendAsForm?: boolean, sendAsForm?: boolean,
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('agileCrmApi'); const credentials = await this.getCredentials('agileCrmApi');
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
@ -56,7 +56,7 @@ export async function agileCrmApiRequest(
export async function agileCrmApiRequestAllItems( export async function agileCrmApiRequestAllItems(
this: IHookFunctions | ILoadOptionsFunctions | IExecuteFunctions, this: IHookFunctions | ILoadOptionsFunctions | IExecuteFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
query: IDataObject = {}, query: IDataObject = {},
@ -95,7 +95,7 @@ export async function agileCrmApiRequestAllItems(
export async function agileCrmApiRequestUpdate( export async function agileCrmApiRequestUpdate(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method = 'PUT', method: IHttpRequestMethods = 'PUT',
endpoint?: string, endpoint?: string,
body: any = {}, body: any = {},
_query: IDataObject = {}, _query: IDataObject = {},
@ -103,7 +103,7 @@ export async function agileCrmApiRequestUpdate(
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('agileCrmApi'); const credentials = await this.getCredentials('agileCrmApi');
const baseUri = `https://${credentials.subdomain}.agilecrm.com/dev/`; const baseUri = `https://${credentials.subdomain}.agilecrm.com/dev/`;
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',

View file

@ -6,6 +6,7 @@ import type {
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
INodeTypeBaseDescription, INodeTypeBaseDescription,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow';
@ -569,7 +570,7 @@ export class AirtableV1 implements INodeType {
let returnAll = false; let returnAll = false;
let endpoint = ''; let endpoint = '';
let requestMethod = ''; let requestMethod: IHttpRequestMethods;
const body: IDataObject = {}; const body: IDataObject = {};
const qs: IDataObject = {}; const qs: IDataObject = {};

View file

@ -1,5 +1,3 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IBinaryKeyData, IBinaryKeyData,
IDataObject, IDataObject,
@ -8,6 +6,8 @@ import type {
ILoadOptionsFunctions, ILoadOptionsFunctions,
INodeExecutionData, INodeExecutionData,
IPairedItemData, IPairedItemData,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
interface IAttachment { interface IAttachment {
@ -28,7 +28,7 @@ export interface IRecord {
*/ */
export async function apiRequest( export async function apiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions, this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: object, body: object,
query?: IDataObject, query?: IDataObject,
@ -42,7 +42,7 @@ export async function apiRequest(
// it as query string. // it as query string.
// query.api_key = credentials.apiKey; // query.api_key = credentials.apiKey;
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: {}, headers: {},
method, method,
body, body,
@ -71,7 +71,7 @@ export async function apiRequest(
*/ */
export async function apiRequestAllItems( export async function apiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions, this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject, body: IDataObject,
query?: IDataObject, query?: IDataObject,

View file

@ -1,5 +1,3 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IBinaryKeyData, IBinaryKeyData,
IDataObject, IDataObject,
@ -8,6 +6,8 @@ import type {
ILoadOptionsFunctions, ILoadOptionsFunctions,
INodeExecutionData, INodeExecutionData,
IPairedItemData, IPairedItemData,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { ApplicationError } from 'n8n-workflow'; import { ApplicationError } from 'n8n-workflow';
import type { IAttachment, IRecord } from '../helpers/interfaces'; import type { IAttachment, IRecord } from '../helpers/interfaces';
@ -19,7 +19,7 @@ import { flattenOutput } from '../helpers/utils';
*/ */
export async function apiRequest( export async function apiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions, this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
query?: IDataObject, query?: IDataObject,
@ -28,7 +28,7 @@ export async function apiRequest(
) { ) {
query = query || {}; query = query || {};
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: {}, headers: {},
method, method,
body, body,
@ -58,7 +58,7 @@ export async function apiRequest(
*/ */
export async function apiRequestAllItems( export async function apiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions, this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body?: IDataObject, body?: IDataObject,
query?: IDataObject, query?: IDataObject,

View file

@ -1,16 +1,20 @@
import type { OptionsWithUri } from 'request'; import type {
IExecuteFunctions,
import type { IExecuteFunctions, ILoadOptionsFunctions, JsonObject } from 'n8n-workflow'; ILoadOptionsFunctions,
JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function apiTemplateIoApiRequest( export async function apiTemplateIoApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
qs = {}, qs = {},
body = {}, body = {},
) { ) {
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
'user-agent': 'n8n', 'user-agent': 'n8n',
Accept: 'application/json', Accept: 'application/json',

View file

@ -1,16 +1,16 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IDataObject, IDataObject,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function automizyApiRequest( export async function automizyApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body: any = {}, body: any = {},
@ -19,7 +19,7 @@ export async function automizyApiRequest(
): Promise<any> { ): Promise<any> {
const credentials = (await this.getCredentials('automizyApi')) as IDataObject; const credentials = (await this.getCredentials('automizyApi')) as IDataObject;
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
Authorization: `Bearer ${credentials.apiToken}`, Authorization: `Bearer ${credentials.apiToken}`,
}, },
@ -50,7 +50,7 @@ export async function automizyApiRequest(
export async function automizyApiRequestAllItems( export async function automizyApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -6,6 +6,7 @@ import type {
INodePropertyOptions, INodePropertyOptions,
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { autopilotApiRequest, autopilotApiRequestAllItems } from './GenericFunctions'; import { autopilotApiRequest, autopilotApiRequestAllItems } from './GenericFunctions';
@ -228,7 +229,7 @@ export class Autopilot implements INodeType {
const contactId = this.getNodeParameter('contactId', i) as string; const contactId = this.getNodeParameter('contactId', i) as string;
const method: { [key: string]: string } = { const method: { [key: string]: IHttpRequestMethods } = {
add: 'POST', add: 'POST',
remove: 'DELETE', remove: 'DELETE',
exist: 'GET', exist: 'GET',

View file

@ -1,5 +1,3 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
@ -7,14 +5,15 @@ import type {
IHookFunctions, IHookFunctions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function autopilotApiRequest( export async function autopilotApiRequest(
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
query: IDataObject = {}, query: IDataObject = {},
uri?: string, uri?: string,
@ -26,7 +25,7 @@ export async function autopilotApiRequest(
const endpoint = 'https://api2.autopilothq.com/v1'; const endpoint = 'https://api2.autopilothq.com/v1';
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
autopilotapikey: apiKey, autopilotapikey: apiKey,
@ -54,7 +53,7 @@ export async function autopilotApiRequest(
export async function autopilotApiRequestAllItems( export async function autopilotApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -8,13 +8,14 @@ import type {
IWebhookFunctions, IWebhookFunctions,
IHttpRequestOptions, IHttpRequestOptions,
JsonObject, JsonObject,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { jsonParse, NodeApiError } from 'n8n-workflow'; import { jsonParse, NodeApiError } from 'n8n-workflow';
export async function awsApiRequest( export async function awsApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string | Buffer, body?: string | Buffer,
query: IDataObject = {}, query: IDataObject = {},
@ -45,7 +46,7 @@ export async function awsApiRequest(
export async function awsApiRequestREST( export async function awsApiRequestREST(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
query: IDataObject = {}, query: IDataObject = {},
@ -63,7 +64,7 @@ export async function awsApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
query: IDataObject = {}, query: IDataObject = {},

View file

@ -6,12 +6,13 @@ import type {
ILoadOptionsFunctions, ILoadOptionsFunctions,
IWebhookFunctions, IWebhookFunctions,
IHttpRequestOptions, IHttpRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
export async function awsApiRequest( export async function awsApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,
@ -35,7 +36,7 @@ export async function awsApiRequest(
export async function awsApiRequestREST( export async function awsApiRequestREST(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,
@ -51,7 +52,7 @@ export async function awsApiRequestREST(
export async function awsApiRequestSOAP( export async function awsApiRequestSOAP(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,

View file

@ -6,6 +6,7 @@ import type {
IWebhookFunctions, IWebhookFunctions,
IHttpRequestOptions, IHttpRequestOptions,
INodeExecutionData, INodeExecutionData,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { ApplicationError, deepCopy } from 'n8n-workflow'; import { ApplicationError, deepCopy } from 'n8n-workflow';
@ -14,7 +15,7 @@ import type { IRequestBody } from './types';
export async function awsApiRequest( export async function awsApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: object | IRequestBody, body?: object | IRequestBody,
headers?: object, headers?: object,
@ -68,7 +69,7 @@ export async function awsApiRequest(
export async function awsApiRequestAllItems( export async function awsApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: IRequestBody, body?: IRequestBody,
headers?: object, headers?: object,

View file

@ -10,13 +10,14 @@ import type {
IWebhookFunctions, IWebhookFunctions,
IHttpRequestOptions, IHttpRequestOptions,
JsonObject, JsonObject,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function awsApiRequest( export async function awsApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string | Buffer, body?: string | Buffer,
query: IDataObject = {}, query: IDataObject = {},
@ -49,7 +50,7 @@ export async function awsApiRequest(
export async function awsApiRequestREST( export async function awsApiRequestREST(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
query: IDataObject = {}, query: IDataObject = {},
@ -78,7 +79,7 @@ export async function awsApiRequestREST(
export async function awsApiRequestSOAP( export async function awsApiRequestSOAP(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string | Buffer, body?: string | Buffer,
query: IDataObject = {}, query: IDataObject = {},
@ -115,7 +116,7 @@ export async function awsApiRequestSOAPAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
propertyName: string, propertyName: string,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
query: IDataObject = {}, query: IDataObject = {},

View file

@ -7,13 +7,14 @@ import type {
IWebhookFunctions, IWebhookFunctions,
IHttpRequestOptions, IHttpRequestOptions,
JsonObject, JsonObject,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function awsApiRequest( export async function awsApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,
@ -41,7 +42,7 @@ export async function awsApiRequest(
export async function awsApiRequestREST( export async function awsApiRequestREST(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,
@ -57,7 +58,7 @@ export async function awsApiRequestREST(
export async function awsApiRequestSOAP( export async function awsApiRequestSOAP(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,

View file

@ -9,6 +9,7 @@ import type {
ILoadOptionsFunctions, ILoadOptionsFunctions,
IWebhookFunctions, IWebhookFunctions,
IHttpRequestOptions, IHttpRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { pascalCase } from 'change-case'; import { pascalCase } from 'change-case';
@ -16,7 +17,7 @@ import { pascalCase } from 'change-case';
export async function awsApiRequest( export async function awsApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string | Buffer | IDataObject, body?: string | Buffer | IDataObject,
_query: IDataObject = {}, _query: IDataObject = {},
@ -47,7 +48,7 @@ export async function awsApiRequest(
export async function awsApiRequestREST( export async function awsApiRequestREST(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
query: IDataObject = {}, query: IDataObject = {},
@ -76,7 +77,7 @@ export async function awsApiRequestREST(
export async function awsApiRequestSOAP( export async function awsApiRequestSOAP(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string | Buffer | IDataObject, body?: string | Buffer | IDataObject,
query: IDataObject = {}, query: IDataObject = {},
@ -113,7 +114,7 @@ export async function awsApiRequestSOAPAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
propertyName: string, propertyName: string,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
query: IDataObject = {}, query: IDataObject = {},

View file

@ -9,12 +9,13 @@ import type {
ILoadOptionsFunctions, ILoadOptionsFunctions,
IWebhookFunctions, IWebhookFunctions,
IHttpRequestOptions, IHttpRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
export async function awsApiRequest( export async function awsApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string | Buffer, body?: string | Buffer,
query: IDataObject = {}, query: IDataObject = {},
@ -45,7 +46,7 @@ export async function awsApiRequest(
export async function awsApiRequestREST( export async function awsApiRequestREST(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
query: IDataObject = {}, query: IDataObject = {},
@ -74,7 +75,7 @@ export async function awsApiRequestREST(
export async function awsApiRequestSOAP( export async function awsApiRequestSOAP(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string | Buffer, body?: string | Buffer,
query: IDataObject = {}, query: IDataObject = {},
@ -111,7 +112,7 @@ export async function awsApiRequestSOAPAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
propertyName: string, propertyName: string,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
query: IDataObject = {}, query: IDataObject = {},

View file

@ -9,12 +9,13 @@ import type {
ILoadOptionsFunctions, ILoadOptionsFunctions,
IWebhookFunctions, IWebhookFunctions,
IHttpRequestOptions, IHttpRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
export async function awsApiRequest( export async function awsApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string | Buffer | any, body?: string | Buffer | any,
query: IDataObject = {}, query: IDataObject = {},
@ -43,7 +44,7 @@ export async function awsApiRequest(
export async function awsApiRequestREST( export async function awsApiRequestREST(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string | Buffer | any, body?: string | Buffer | any,
query: IDataObject = {}, query: IDataObject = {},
@ -83,7 +84,7 @@ export async function awsApiRequestRESTAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
query: IDataObject = {}, query: IDataObject = {},

View file

@ -8,6 +8,7 @@ import type {
IWebhookFunctions, IWebhookFunctions,
IHttpRequestOptions, IHttpRequestOptions,
JsonObject, JsonObject,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
@ -16,7 +17,7 @@ import get from 'lodash/get';
export async function awsApiRequest( export async function awsApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,
@ -45,7 +46,7 @@ export async function awsApiRequest(
export async function awsApiRequestREST( export async function awsApiRequestREST(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,
@ -61,7 +62,7 @@ export async function awsApiRequestREST(
export async function awsApiRequestSOAP( export async function awsApiRequestSOAP(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,
@ -85,7 +86,7 @@ export async function awsApiRequestSOAPAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
propertyName: string, propertyName: string,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
query: IDataObject = {}, query: IDataObject = {},

View file

@ -3,8 +3,6 @@ import { URL } from 'url';
import type { Request } from 'aws4'; import type { Request } from 'aws4';
import { sign } from 'aws4'; import { sign } from 'aws4';
import type { OptionsWithUri } from 'request';
import { parseString } from 'xml2js'; import { parseString } from 'xml2js';
import type { import type {
@ -16,6 +14,8 @@ import type {
IWebhookFunctions, IWebhookFunctions,
IHttpRequestOptions, IHttpRequestOptions,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
@ -37,7 +37,7 @@ function getEndpointForService(
export async function awsApiRequest( export async function awsApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,
@ -77,7 +77,7 @@ export async function awsApiRequest(
export async function awsApiRequestREST( export async function awsApiRequestREST(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,
@ -93,7 +93,7 @@ export async function awsApiRequestREST(
export async function awsApiRequestSOAP( export async function awsApiRequestSOAP(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,
@ -165,7 +165,7 @@ export async function validateCredentials(
sign(signOpts, securityHeaders); sign(signOpts, securityHeaders);
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: signOpts.headers, headers: signOpts.headers,
method: 'POST', method: 'POST',
uri: endpoint.href, uri: endpoint.href,

View file

@ -3,14 +3,14 @@ import { URL } from 'url';
import type { Request } from 'aws4'; import type { Request } from 'aws4';
import { sign } from 'aws4'; import { sign } from 'aws4';
import type { OptionsWithUri } from 'request';
import type { import type {
ICredentialDataDecryptedObject, ICredentialDataDecryptedObject,
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
@ -36,7 +36,7 @@ function getEndpointForService(
export async function awsApiRequest( export async function awsApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,
@ -58,7 +58,7 @@ export async function awsApiRequest(
sign(signOpts, securityHeaders); sign(signOpts, securityHeaders);
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: signOpts.headers, headers: signOpts.headers,
method, method,
uri: endpoint.href, uri: endpoint.href,
@ -75,7 +75,7 @@ export async function awsApiRequest(
export async function awsApiRequestREST( export async function awsApiRequestREST(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
headers?: object, headers?: object,
@ -92,7 +92,7 @@ export async function awsApiRequestRESTAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
service: string, service: string,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body?: string, body?: string,
query: IDataObject = {}, query: IDataObject = {},

View file

@ -4,11 +4,10 @@ import type {
IHookFunctions, IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
import type { OptionsWithUrl } from 'request';
/** /**
* Make an API request to Mattermost * Make an API request to Mattermost
*/ */
@ -29,7 +28,7 @@ export async function apiRequest(
//set-up uri //set-up uri
const uri = `https://api.bamboohr.com/api/gateway.php/${subdomain}/v1/${endpoint}`; const uri = `https://api.bamboohr.com/api/gateway.php/${subdomain}/v1/${endpoint}`;
const options: OptionsWithUrl = { const options: IRequestOptions = {
method, method,
body, body,
qs: query, qs: query,

View file

@ -1,5 +1,3 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
@ -7,6 +5,8 @@ import type {
IHookFunctions, IHookFunctions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
@ -14,7 +14,7 @@ import { snakeCase } from 'change-case';
export async function bannerbearApiRequest( export async function bannerbearApiRequest(
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -24,7 +24,7 @@ export async function bannerbearApiRequest(
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('bannerbearApi'); const credentials = await this.getCredentials('bannerbearApi');
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
Authorization: `Bearer ${credentials.apiKey}`, Authorization: `Bearer ${credentials.apiKey}`,

View file

@ -1,9 +1,9 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
@ -15,7 +15,7 @@ import type { Accumulator, BaserowCredentials, LoadedResource } from './types';
*/ */
export async function baserowApiRequest( export async function baserowApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
jwtToken: string, jwtToken: string,
body: IDataObject = {}, body: IDataObject = {},
@ -23,7 +23,7 @@ export async function baserowApiRequest(
) { ) {
const credentials = (await this.getCredentials('baserowApi')) as BaserowCredentials; const credentials = (await this.getCredentials('baserowApi')) as BaserowCredentials;
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
Authorization: `JWT ${jwtToken}`, Authorization: `JWT ${jwtToken}`,
}, },
@ -54,7 +54,7 @@ export async function baserowApiRequest(
*/ */
export async function baserowApiRequestAllItems( export async function baserowApiRequestAllItems(
this: IExecuteFunctions, this: IExecuteFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
jwtToken: string, jwtToken: string,
body: IDataObject, body: IDataObject,
@ -90,7 +90,7 @@ export async function getJwtToken(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
{ username, password, host }: BaserowCredentials, { username, password, host }: BaserowCredentials,
) { ) {
const options: OptionsWithUri = { const options: IRequestOptions = {
method: 'POST', method: 'POST',
body: { body: {
username, username,

View file

@ -1,24 +1,24 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IDataObject, IDataObject,
IHookFunctions, IHookFunctions,
IWebhookFunctions, IWebhookFunctions,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
const BEEMINDER_URI = 'https://www.beeminder.com/api/v1'; const BEEMINDER_URI = 'https://www.beeminder.com/api/v1';
export async function beeminderApiRequest( export async function beeminderApiRequest(
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},
query: IDataObject = {}, query: IDataObject = {},
): Promise<any> { ): Promise<any> {
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
body, body,
qs: query, qs: query,
@ -39,7 +39,7 @@ export async function beeminderApiRequest(
export async function beeminderApiRequestAllItems( export async function beeminderApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -1,5 +1,3 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IHookFunctions, IHookFunctions,
IWebhookFunctions, IWebhookFunctions,
@ -12,6 +10,7 @@ import type {
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
IWebhookResponseData, IWebhookResponseData,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { bitbucketApiRequest, bitbucketApiRequestAllItems } from './GenericFunctions'; import { bitbucketApiRequest, bitbucketApiRequestAllItems } from './GenericFunctions';
@ -145,7 +144,7 @@ export class BitbucketTrigger implements INodeType {
): Promise<INodeCredentialTestResult> { ): Promise<INodeCredentialTestResult> {
const credentials = credential.data; const credentials = credential.data;
const options: OptionsWithUri = { const options: IRequestOptions = {
method: 'GET', method: 'GET',
auth: { auth: {
user: credentials!.username as string, user: credentials!.username as string,

View file

@ -1,16 +1,17 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function bitbucketApiRequest( export async function bitbucketApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -19,7 +20,7 @@ export async function bitbucketApiRequest(
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('bitbucketApi'); const credentials = await this.getCredentials('bitbucketApi');
let options: OptionsWithUri = { let options: IRequestOptions = {
method, method,
auth: { auth: {
user: credentials.username as string, user: credentials.username as string,
@ -49,7 +50,7 @@ export async function bitbucketApiRequest(
export async function bitbucketApiRequestAllItems( export async function bitbucketApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},

View file

@ -1,17 +1,17 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function bitlyApiRequest( export async function bitlyApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -20,7 +20,7 @@ export async function bitlyApiRequest(
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
const authenticationMethod = this.getNodeParameter('authentication', 0) as string; const authenticationMethod = this.getNodeParameter('authentication', 0) as string;
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: {}, headers: {},
method, method,
qs, qs,
@ -56,7 +56,7 @@ export async function bitlyApiRequest(
export async function bitlyApiRequestAllItems( export async function bitlyApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},

View file

@ -1,14 +1,14 @@
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
INodePropertyOptions, INodePropertyOptions,
IRequestOptions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
/** /**
* Return the access token URL based on the user's environment. * Return the access token URL based on the user's environment.
*/ */
@ -34,14 +34,14 @@ async function getBaseUrl(this: IExecuteFunctions | ILoadOptionsFunctions) {
*/ */
export async function bitwardenApiRequest( export async function bitwardenApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
qs: IDataObject, qs: IDataObject,
body: IDataObject, body: IDataObject,
token: string, token: string,
): Promise<any> { ): Promise<any> {
const baseUrl = await getBaseUrl.call(this); const baseUrl = await getBaseUrl.call(this);
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
'user-agent': 'n8n', 'user-agent': 'n8n',
Authorization: `Bearer ${token}`, Authorization: `Bearer ${token}`,
@ -77,7 +77,7 @@ export async function getAccessToken(
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('bitwardenApi'); const credentials = await this.getCredentials('bitwardenApi');
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
}, },
@ -109,7 +109,7 @@ export async function getAccessToken(
export async function handleGetAll( export async function handleGetAll(
this: IExecuteFunctions, this: IExecuteFunctions,
i: number, i: number,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
qs: IDataObject, qs: IDataObject,
body: IDataObject, body: IDataObject,

View file

@ -1,18 +1,18 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IOAuth2Options, IOAuth2Options,
IRequestOptions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function boxApiRequest( export async function boxApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -20,7 +20,7 @@ export async function boxApiRequest(
uri?: string, uri?: string,
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
@ -51,7 +51,7 @@ export async function boxApiRequest(
export async function boxApiRequestAllItems( export async function boxApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -1,17 +1,17 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function brandfetchApiRequest( export async function brandfetchApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -21,7 +21,7 @@ export async function brandfetchApiRequest(
): Promise<any> { ): Promise<any> {
try { try {
const credentials = await this.getCredentials('brandfetchApi'); const credentials = await this.getCredentials('brandfetchApi');
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
'x-api-key': credentials.apiKey, 'x-api-key': credentials.apiKey,
}, },

View file

@ -2,11 +2,11 @@ import type {
IExecuteSingleFunctions, IExecuteSingleFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestOptions, IHttpRequestOptions,
IRequestOptions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { jsonParse, NodeOperationError } from 'n8n-workflow'; import { jsonParse, NodeOperationError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
import MailComposer from 'nodemailer/lib/mail-composer'; import MailComposer from 'nodemailer/lib/mail-composer';
export namespace BrevoNode { export namespace BrevoNode {
type ValidEmailFields = { to: string } | { sender: string } | { cc: string } | { bcc: string }; type ValidEmailFields = { to: string } | { sender: string } | { cc: string } | { bcc: string };
@ -311,7 +311,7 @@ export namespace BrevoWebhookApi {
export const fetchWebhooks = async (ref: IHookFunctions, type: string): Promise<Webhooks> => { export const fetchWebhooks = async (ref: IHookFunctions, type: string): Promise<Webhooks> => {
const endpoint = `${baseURL}/webhooks?type=${type}`; const endpoint = `${baseURL}/webhooks?type=${type}`;
const options: OptionsWithUri = { const options: IRequestOptions = {
method: 'GET', method: 'GET',
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
@ -336,7 +336,7 @@ export namespace BrevoWebhookApi {
): Promise<WebhookId> => { ): Promise<WebhookId> => {
const endpoint = `${baseURL}/webhooks`; const endpoint = `${baseURL}/webhooks`;
const options: OptionsWithUri = { const options: IRequestOptions = {
method: 'POST', method: 'POST',
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
@ -362,7 +362,7 @@ export namespace BrevoWebhookApi {
const endpoint = `${baseURL}/webhooks/${webhookId}`; const endpoint = `${baseURL}/webhooks/${webhookId}`;
const body = {}; const body = {};
const options: OptionsWithUri = { const options: IRequestOptions = {
method: 'DELETE', method: 'DELETE',
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',

View file

@ -4,17 +4,17 @@ import type {
IDataObject, IDataObject,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
/** /**
* Make an authenticated API request to Bubble. * Make an authenticated API request to Bubble.
*/ */
export async function bubbleApiRequest( export async function bubbleApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject, body: IDataObject,
qs: IDataObject, qs: IDataObject,
@ -32,7 +32,7 @@ export async function bubbleApiRequest(
const rootUrl = hosting === 'bubbleHosted' ? `https://${appName}.bubbleapps.io` : domain; const rootUrl = hosting === 'bubbleHosted' ? `https://${appName}.bubbleapps.io` : domain;
const urlSegment = environment === 'development' ? '/version-test/api/1.1' : '/api/1.1'; const urlSegment = environment === 'development' ? '/version-test/api/1.1' : '/api/1.1';
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
'user-agent': 'n8n', 'user-agent': 'n8n',
Authorization: `Bearer ${apiToken}`, Authorization: `Bearer ${apiToken}`,
@ -64,7 +64,7 @@ export async function bubbleApiRequest(
*/ */
export async function bubbleApiRequestAllItems( export async function bubbleApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject, body: IDataObject,
qs: IDataObject, qs: IDataObject,

View file

@ -1,5 +1,3 @@
import type { OptionsWithUri } from 'request';
import type { import type {
ICredentialDataDecryptedObject, ICredentialDataDecryptedObject,
ICredentialTestFunctions, ICredentialTestFunctions,
@ -8,6 +6,8 @@ import type {
ILoadOptionsFunctions, ILoadOptionsFunctions,
IHookFunctions, IHookFunctions,
IWebhookFunctions, IWebhookFunctions,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
export function getAuthenticationType(data: string): 'accessToken' | 'apiKey' { export function getAuthenticationType(data: string): 'accessToken' | 'apiKey' {
@ -18,7 +18,7 @@ export function getAuthenticationType(data: string): 'accessToken' | 'apiKey' {
export async function calendlyApiRequest( export async function calendlyApiRequest(
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -41,7 +41,7 @@ export async function calendlyApiRequest(
endpoint = 'https://calendly.com/api/v1'; endpoint = 'https://calendly.com/api/v1';
} }
let options: OptionsWithUri = { let options: IRequestOptions = {
headers, headers,
method, method,
body, body,
@ -72,7 +72,7 @@ export async function validateCredentials(
const authenticationType = getAuthenticationType(apiKey); const authenticationType = getAuthenticationType(apiKey);
const options: OptionsWithUri = { const options: IRequestOptions = {
method: 'GET', method: 'GET',
uri: '', uri: '',
json: true, json: true,

View file

@ -6,6 +6,8 @@ import type {
INodeTypeDescription, INodeTypeDescription,
JsonObject, JsonObject,
NodeParameterValue, NodeParameterValue,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError, NodeOperationError } from 'n8n-workflow'; import { NodeApiError, NodeOperationError } from 'n8n-workflow';
@ -463,7 +465,7 @@ export class Chargebee implements INodeType {
const resource = this.getNodeParameter('resource', i); const resource = this.getNodeParameter('resource', i);
const operation = this.getNodeParameter('operation', i); const operation = this.getNodeParameter('operation', i);
let requestMethod = 'GET'; let requestMethod: IHttpRequestMethods = 'GET';
let endpoint = ''; let endpoint = '';
body = {}; body = {};
qs = {}; qs = {};
@ -589,7 +591,7 @@ export class Chargebee implements INodeType {
pass: '', pass: '',
}, },
json: true, json: true,
}; } satisfies IRequestOptions;
let responseData; let responseData;

View file

@ -1,17 +1,17 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function circleciApiRequest( export async function circleciApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -20,7 +20,7 @@ export async function circleciApiRequest(
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('circleCiApi'); const credentials = await this.getCredentials('circleCiApi');
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
'Circle-Token': credentials.apiKey, 'Circle-Token': credentials.apiKey,
Accept: 'application/json', Accept: 'application/json',
@ -49,7 +49,7 @@ export async function circleciApiRequest(
export async function circleciApiRequestAllItems( export async function circleciApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},

View file

@ -1,13 +1,14 @@
import { createHash } from 'crypto'; import { createHash } from 'crypto';
import type { OptionsWithUri } from 'request';
import type { import type {
ICredentialDataDecryptedObject, ICredentialDataDecryptedObject,
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
INodeProperties, INodeProperties,
IRequestOptions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
@ -17,7 +18,7 @@ import upperFirst from 'lodash/upperFirst';
export async function webexApiRequest( export async function webexApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions, this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -25,7 +26,7 @@ export async function webexApiRequest(
uri?: string, uri?: string,
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
let options: OptionsWithUri = { let options: IRequestOptions = {
method, method,
body, body,
qs, qs,
@ -54,7 +55,7 @@ export async function webexApiRequest(
export async function webexApiRequestAllItems( export async function webexApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -1,5 +1,3 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
@ -7,12 +5,14 @@ import type {
IHookFunctions, IHookFunctions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function citrixADCApiRequest( export async function citrixADCApiRequest(
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -21,7 +21,7 @@ export async function citrixADCApiRequest(
): Promise<any> { ): Promise<any> {
const { url } = (await this.getCredentials('citrixAdcApi')) as { url: string }; const { url } = (await this.getCredentials('citrixAdcApi')) as { url: string };
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },

View file

@ -1,17 +1,17 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function clearbitApiRequest( export async function clearbitApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
api: string, api: string,
resource: string, resource: string,
@ -21,7 +21,7 @@ export async function clearbitApiRequest(
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('clearbitApi'); const credentials = await this.getCredentials('clearbitApi');
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { Authorization: `Bearer ${credentials.apiKey}` }, headers: { Authorization: `Bearer ${credentials.apiKey}` },
method, method,
qs, qs,

View file

@ -1,5 +1,3 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
@ -8,12 +6,14 @@ import type {
IWebhookFunctions, IWebhookFunctions,
IOAuth2Options, IOAuth2Options,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function clickupApiRequest( export async function clickupApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -21,7 +21,7 @@ export async function clickupApiRequest(
uri?: string, uri?: string,
_option: IDataObject = {}, _option: IDataObject = {},
): Promise<any> { ): Promise<any> {
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
@ -58,7 +58,7 @@ export async function clickupApiRequest(
export async function clickupApiRequestAllItems( export async function clickupApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},

View file

@ -1,15 +1,15 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IPollFunctions, IPollFunctions,
IDataObject, IDataObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
export async function clockifyApiRequest( export async function clockifyApiRequest(
this: ILoadOptionsFunctions | IPollFunctions | IExecuteFunctions, this: ILoadOptionsFunctions | IPollFunctions | IExecuteFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -19,7 +19,7 @@ export async function clockifyApiRequest(
): Promise<any> { ): Promise<any> {
const BASE_URL = 'https://api.clockify.me/api/v1'; const BASE_URL = 'https://api.clockify.me/api/v1';
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
@ -35,7 +35,7 @@ export async function clockifyApiRequest(
export async function clockifyApiRequestAllItems( export async function clockifyApiRequestAllItems(
this: IExecuteFunctions | IPollFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | IPollFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -1,24 +1,24 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IPollFunctions, IPollFunctions,
IRequestOptions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function cloudflareApiRequest( export async function cloudflareApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions, this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body = {}, body = {},
qs: IDataObject = {}, qs: IDataObject = {},
uri?: string, uri?: string,
headers: IDataObject = {}, headers: IDataObject = {},
): Promise<any> { ): Promise<any> {
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
body, body,
qs, qs,
@ -42,7 +42,7 @@ export async function cloudflareApiRequest(
export async function cloudflareApiRequestAllItems( export async function cloudflareApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
query: IDataObject = {}, query: IDataObject = {},

View file

@ -20,7 +20,7 @@ export async function createCollectionEntry(
}; };
} }
return await cockpitApiRequest.call(this, 'post', `/collections/save/${resourceName}`, body); return await cockpitApiRequest.call(this, 'POST', `/collections/save/${resourceName}`, body);
} }
export async function getAllCollectionEntries( export async function getAllCollectionEntries(
@ -76,7 +76,7 @@ export async function getAllCollectionEntries(
body.lang = options.language as string; body.lang = options.language as string;
} }
return await cockpitApiRequest.call(this, 'post', `/collections/get/${resourceName}`, body); return await cockpitApiRequest.call(this, 'POST', `/collections/get/${resourceName}`, body);
} }
export async function getAllCollectionNames( export async function getAllCollectionNames(

View file

@ -11,5 +11,5 @@ export async function submitForm(
form, form,
}; };
return await cockpitApiRequest.call(this, 'post', `/forms/submit/${resourceName}`, body); return await cockpitApiRequest.call(this, 'POST', `/forms/submit/${resourceName}`, body);
} }

View file

@ -1,15 +1,16 @@
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { jsonParse, NodeApiError } from 'n8n-workflow'; import { jsonParse, NodeApiError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
export async function cockpitApiRequest( export async function cockpitApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -17,7 +18,7 @@ export async function cockpitApiRequest(
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('cockpitApi'); const credentials = await this.getCredentials('cockpitApi');
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',

View file

@ -5,7 +5,7 @@ export async function getSingleton(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
resourceName: string, resourceName: string,
): Promise<any> { ): Promise<any> {
return await cockpitApiRequest.call(this, 'get', `/singletons/get/${resourceName}`); return await cockpitApiRequest.call(this, 'GET', `/singletons/get/${resourceName}`);
} }
export async function getAllSingletonNames( export async function getAllSingletonNames(

View file

@ -1,15 +1,16 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function codaApiRequest( export async function codaApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -19,7 +20,7 @@ export async function codaApiRequest(
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('codaApi'); const credentials = await this.getCredentials('codaApi');
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
Authorization: `Bearer ${credentials.accessToken}`, Authorization: `Bearer ${credentials.accessToken}`,
'User-Agent': 'n8n', 'User-Agent': 'n8n',
@ -49,7 +50,7 @@ export async function codaApiRequest(
export async function codaApiRequestAllItems( export async function codaApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},

View file

@ -1,16 +1,16 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IDataObject, IDataObject,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function coinGeckoApiRequest( export async function coinGeckoApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},
@ -18,7 +18,7 @@ export async function coinGeckoApiRequest(
uri?: string, uri?: string,
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -47,7 +47,7 @@ export async function coinGeckoApiRequest(
export async function coinGeckoRequestAllItems( export async function coinGeckoRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -1,16 +1,16 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function contentfulApiRequest( export async function contentfulApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -22,7 +22,7 @@ export async function contentfulApiRequest(
const source = this.getNodeParameter('source', 0) as string; const source = this.getNodeParameter('source', 0) as string;
const isPreview = source === 'previewApi'; const isPreview = source === 'previewApi';
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
qs, qs,
body, body,
@ -46,7 +46,7 @@ export async function contentfulApiRequest(
export async function contentfulApiRequestAllItems( export async function contentfulApiRequestAllItems(
this: ILoadOptionsFunctions | IExecuteFunctions, this: ILoadOptionsFunctions | IExecuteFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},

View file

@ -1,17 +1,17 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IDataObject, IDataObject,
IHookFunctions, IHookFunctions,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function convertKitApiRequest( export async function convertKitApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},
@ -21,7 +21,7 @@ export async function convertKitApiRequest(
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('convertKitApi'); const credentials = await this.getCredentials('convertKitApi');
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },

View file

@ -1,13 +1,13 @@
import { createHash } from 'crypto'; import { createHash } from 'crypto';
import type { OptionsWithUri } from 'request';
import type { import type {
ICredentialDataDecryptedObject, ICredentialDataDecryptedObject,
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
@ -28,7 +28,7 @@ import type {
*/ */
export async function copperApiRequest( export async function copperApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -37,7 +37,7 @@ export async function copperApiRequest(
) { ) {
const credentials = (await this.getCredentials('copperApi')) as { apiKey: string; email: string }; const credentials = (await this.getCredentials('copperApi')) as { apiKey: string; email: string };
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
'X-PW-AccessToken': credentials.apiKey, 'X-PW-AccessToken': credentials.apiKey,
'X-PW-Application': 'developer_api', 'X-PW-Application': 'developer_api',
@ -147,7 +147,7 @@ export const adjustTaskFields = flow(adjustLeadFields, adjustProjectIds);
*/ */
export async function copperApiRequestAllItems( export async function copperApiRequestAllItems(
this: IHookFunctions | ILoadOptionsFunctions | IExecuteFunctions, this: IHookFunctions | ILoadOptionsFunctions | IExecuteFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -173,7 +173,7 @@ export async function copperApiRequestAllItems(
*/ */
export async function handleListing( export async function handleListing(
this: IExecuteFunctions, this: IExecuteFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
qs: IDataObject = {}, qs: IDataObject = {},
body: IDataObject = {}, body: IDataObject = {},

View file

@ -1,17 +1,17 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import moment from 'moment-timezone'; import moment from 'moment-timezone';
export async function cortexApiRequest( export async function cortexApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -21,7 +21,7 @@ export async function cortexApiRequest(
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('cortexApi'); const credentials = await this.getCredentials('cortexApi');
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: {}, headers: {},
method, method,
qs: query, qs: query,

View file

@ -11,7 +11,7 @@ import get from 'lodash/get';
export async function customerIoApiRequest( export async function customerIoApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: object, body: object,
baseApi?: string, baseApi?: string,
@ -22,7 +22,7 @@ export async function customerIoApiRequest(
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
method: method as IHttpRequestMethods, method,
body, body,
url: '', url: '',
json: true, json: true,

View file

@ -1,16 +1,16 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IDataObject, IDataObject,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function deepLApiRequest( export async function deepLApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -22,7 +22,7 @@ export async function deepLApiRequest(
const credentials = await this.getCredentials('deepLApi'); const credentials = await this.getCredentials('deepLApi');
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
'Content-Type': 'application/x-www-form-urlencoded', 'Content-Type': 'application/x-www-form-urlencoded',
}, },

View file

@ -1,17 +1,17 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function demioApiRequest( export async function demioApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -21,7 +21,7 @@ export async function demioApiRequest(
): Promise<any> { ): Promise<any> {
try { try {
const credentials = await this.getCredentials('demioApi'); const credentials = await this.getCredentials('demioApi');
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
'Api-Key': credentials.apiKey, 'Api-Key': credentials.apiKey,
'Api-Secret': credentials.apiSecret, 'Api-Secret': credentials.apiSecret,

View file

@ -1,19 +1,19 @@
import type { OptionsWithUri } from 'request';
import type { import type {
ICredentialDataDecryptedObject, ICredentialDataDecryptedObject,
ICredentialTestFunctions, ICredentialTestFunctions,
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function dhlApiRequest( export async function dhlApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body: any = {}, body: any = {},
@ -23,7 +23,7 @@ export async function dhlApiRequest(
): Promise<any> { ): Promise<any> {
const credentials = (await this.getCredentials('dhlApi')) as { apiKey: string }; const credentials = (await this.getCredentials('dhlApi')) as { apiKey: string };
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
'DHL-API-Key': credentials.apiKey, 'DHL-API-Key': credentials.apiKey,
}, },
@ -55,7 +55,7 @@ export async function validateCredentials(
apiKey: string; apiKey: string;
}; };
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
'DHL-API-Key': apiKey, 'DHL-API-Key': apiKey,
}, },

View file

@ -1,6 +1,5 @@
import type { INodeTypes } from 'n8n-workflow'; import type { INodeTypes, IRequestOptions } from 'n8n-workflow';
import nock from 'nock'; import nock from 'nock';
import type { OptionsWithUrl } from 'request-promise-native';
import * as transport from '../../../../v2/transport/helpers'; import * as transport from '../../../../v2/transport/helpers';
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers'; import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
import type { WorkflowTestData } from '@test/nodes/types'; import type { WorkflowTestData } from '@test/nodes/types';
@ -9,7 +8,7 @@ import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
const requestApiSpy = jest.spyOn(transport, 'requestApi'); const requestApiSpy = jest.spyOn(transport, 'requestApi');
requestApiSpy.mockImplementation( requestApiSpy.mockImplementation(
async (options: OptionsWithUrl, credentialType: string, endpoint: string) => { async (options: IRequestOptions, credentialType: string, endpoint: string) => {
if (endpoint === '/users/@me/guilds') { if (endpoint === '/users/@me/guilds') {
return { return {
headers: {}, headers: {},

View file

@ -6,6 +6,7 @@ import type {
INodeType, INodeType,
INodeTypeBaseDescription, INodeTypeBaseDescription,
INodeTypeDescription, INodeTypeDescription,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { jsonParse, NodeApiError, NodeOperationError, sleep } from 'n8n-workflow'; import { jsonParse, NodeApiError, NodeOperationError, sleep } from 'n8n-workflow';
@ -216,7 +217,7 @@ export class DiscordV1 implements INodeType {
if (!body.payload_json) delete body.payload_json; if (!body.payload_json) delete body.payload_json;
if (!body.attachments) delete body.attachments; if (!body.attachments) delete body.attachments;
let requestOptions; let requestOptions: IRequestOptions;
if (!body.payload_json) { if (!body.payload_json) {
requestOptions = { requestOptions = {

View file

@ -1,11 +1,11 @@
import type { OptionsWithUrl } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IExecuteSingleFunctions, IExecuteSingleFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { sleep, NodeApiError, jsonParse } from 'n8n-workflow'; import { sleep, NodeApiError, jsonParse } from 'n8n-workflow';
@ -15,7 +15,7 @@ import { getCredentialsType, requestApi } from './helpers';
export async function discordApiRequest( export async function discordApiRequest(
this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body?: IDataObject, body?: IDataObject,
qs?: IDataObject, qs?: IDataObject,
@ -25,7 +25,7 @@ export async function discordApiRequest(
const credentialType = getCredentialsType(authentication); const credentialType = getCredentialsType(authentication);
const options: OptionsWithUrl = { const options: IRequestOptions = {
headers, headers,
method, method,
qs, qs,
@ -59,7 +59,7 @@ export async function discordApiRequest(
export async function discordApiMultiPartRequest( export async function discordApiMultiPartRequest(
this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
formData: FormData, formData: FormData,
) { ) {
@ -70,7 +70,7 @@ export async function discordApiMultiPartRequest(
const credentialType = getCredentialsType(authentication); const credentialType = getCredentialsType(authentication);
const options: OptionsWithUrl = { const options: IRequestOptions = {
headers, headers,
method, method,
formData, formData,

View file

@ -1,11 +1,10 @@
import type { OptionsWithUrl } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IExecuteSingleFunctions, IExecuteSingleFunctions,
IHookFunctions, IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
export const getCredentialsType = (authentication: string) => { export const getCredentialsType = (authentication: string) => {
@ -28,7 +27,7 @@ export const getCredentialsType = (authentication: string) => {
export async function requestApi( export async function requestApi(
this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
options: OptionsWithUrl, options: IRequestOptions,
credentialType: string, credentialType: string,
endpoint: string, endpoint: string,
) { ) {

View file

@ -1,16 +1,16 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IDataObject, IDataObject,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function discourseApiRequest( export async function discourseApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
path: string, path: string,
body: any = {}, body: any = {},
@ -19,7 +19,7 @@ export async function discourseApiRequest(
): Promise<any> { ): Promise<any> {
const credentials = (await this.getCredentials('discourseApi')) as { url: string }; const credentials = (await this.getCredentials('discourseApi')) as { url: string };
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
body, body,
qs, qs,
@ -39,7 +39,7 @@ export async function discourseApiRequest(
export async function discourseApiRequestAllItems( export async function discourseApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -4,6 +4,7 @@ import type {
INodeExecutionData, INodeExecutionData,
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow';
@ -576,7 +577,7 @@ export class Disqus implements INodeType {
const operation = this.getNodeParameter('operation', 0); const operation = this.getNodeParameter('operation', 0);
let endpoint = ''; let endpoint = '';
let requestMethod = ''; let requestMethod: IHttpRequestMethods;
let qs: IDataObject; let qs: IDataObject;
for (let i = 0; i < items.length; i++) { for (let i = 0; i < items.length; i++) {

View file

@ -1,16 +1,17 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function disqusApiRequest( export async function disqusApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
qs: IDataObject = {}, qs: IDataObject = {},
uri?: string, uri?: string,
body: IDataObject = {}, body: IDataObject = {},
@ -31,7 +32,7 @@ export async function disqusApiRequest(
} }
} }
let options: OptionsWithUri = { let options: IRequestOptions = {
method, method,
body, body,
uri: `https://disqus.com/api/3.0/${uri}?${queryStringElements.join('&')}`, uri: `https://disqus.com/api/3.0/${uri}?${queryStringElements.join('&')}`,
@ -55,7 +56,7 @@ export async function disqusApiRequest(
*/ */
export async function disqusApiRequestAllItems( export async function disqusApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
qs: IDataObject = {}, qs: IDataObject = {},
uri?: string, uri?: string,
body: IDataObject = {}, body: IDataObject = {},

View file

@ -1,5 +1,3 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
@ -7,12 +5,14 @@ import type {
IHookFunctions, IHookFunctions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function driftApiRequest( export async function driftApiRequest(
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -20,7 +20,7 @@ export async function driftApiRequest(
uri?: string, uri?: string,
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: {}, headers: {},
method, method,
body, body,

View file

@ -1,6 +1,7 @@
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHttpRequestMethods,
INodeExecutionData, INodeExecutionData,
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
@ -697,7 +698,7 @@ export class Dropbox implements INodeType {
const operation = this.getNodeParameter('operation', 0); const operation = this.getNodeParameter('operation', 0);
let endpoint = ''; let endpoint = '';
let requestMethod = ''; let requestMethod: IHttpRequestMethods = 'GET';
let returnAll = false; let returnAll = false;
let property = ''; let property = '';
let body: IDataObject | Buffer; let body: IDataObject | Buffer;

View file

@ -1,6 +1,11 @@
import type { OptionsWithUri } from 'request'; import type {
IDataObject,
import type { IDataObject, IExecuteFunctions, IHookFunctions, JsonObject } from 'n8n-workflow'; IExecuteFunctions,
IHookFunctions,
IHttpRequestMethods,
IRequestOptions,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
/** /**
@ -9,14 +14,14 @@ import { NodeApiError } from 'n8n-workflow';
*/ */
export async function dropboxApiRequest( export async function dropboxApiRequest(
this: IHookFunctions | IExecuteFunctions, this: IHookFunctions | IExecuteFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: object, body: object,
query: IDataObject = {}, query: IDataObject = {},
headers: object = {}, headers: IDataObject = {},
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
const options: OptionsWithUri = { const options: IRequestOptions = {
headers, headers,
method, method,
qs: query, qs: query,
@ -47,7 +52,7 @@ export async function dropboxApiRequest(
export async function dropboxpiRequestAllItems( export async function dropboxpiRequestAllItems(
this: IExecuteFunctions | IHookFunctions, this: IExecuteFunctions | IHookFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -4,21 +4,21 @@ import type {
IDataObject, IDataObject,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IPairedItemData, IPairedItemData,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
/** /**
* Make an authenticated API request to Bubble. * Make an authenticated API request to Bubble.
*/ */
export async function dropcontactApiRequest( export async function dropcontactApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject, body: IDataObject,
qs: IDataObject, qs: IDataObject,
) { ) {
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
uri: `https://api.dropcontact.io${endpoint}`, uri: `https://api.dropcontact.io${endpoint}`,
qs, qs,

View file

@ -1,11 +1,11 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IDataObject, IDataObject,
IHookFunctions, IHookFunctions,
IWebhookFunctions, IWebhookFunctions,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
@ -17,7 +17,7 @@ const getBaseUrl = ({ environment, domain, subdomain }: ERPNextApiCredentials) =
export async function erpNextApiRequest( export async function erpNextApiRequest(
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: IDataObject = {}, body: IDataObject = {},
query: IDataObject = {}, query: IDataObject = {},
@ -27,7 +27,7 @@ export async function erpNextApiRequest(
const credentials = (await this.getCredentials('erpNextApi')) as ERPNextApiCredentials; const credentials = (await this.getCredentials('erpNextApi')) as ERPNextApiCredentials;
const baseUrl = getBaseUrl(credentials); const baseUrl = getBaseUrl(credentials);
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
Accept: 'application/json', Accept: 'application/json',
'Content-Type': 'application/json', 'Content-Type': 'application/json',
@ -68,7 +68,7 @@ export async function erpNextApiRequest(
export async function erpNextApiRequestAllItems( export async function erpNextApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: IDataObject, body: IDataObject,
query: IDataObject = {}, query: IDataObject = {},

View file

@ -1,11 +1,11 @@
import type { OptionsWithUrl } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
@ -21,7 +21,7 @@ const fieldCache: {
export async function egoiApiRequest( export async function egoiApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},
@ -30,7 +30,7 @@ export async function egoiApiRequest(
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('egoiApi'); const credentials = await this.getCredentials('egoiApi');
const options: OptionsWithUrl = { const options: IRequestOptions = {
headers: { headers: {
accept: 'application/json', accept: 'application/json',
Apikey: `${credentials.apiKey}`, Apikey: `${credentials.apiKey}`,
@ -64,7 +64,7 @@ export async function getFields(this: IExecuteFunctions, listId: string) {
export async function egoiApiRequestAllItems( export async function egoiApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -9,10 +9,10 @@ import type {
INodePropertyOptions, INodePropertyOptions,
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
import { import {
elasticSecurityApiRequest, elasticSecurityApiRequest,
getConnector, getConnector,
@ -132,7 +132,7 @@ export class ElasticSecurity implements INodeType {
const endpoint = '/cases/status'; const endpoint = '/cases/status';
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
Authorization: `Basic ${token}`, Authorization: `Basic ${token}`,
'kbn-xsrf': true, 'kbn-xsrf': true,

View file

@ -3,11 +3,11 @@ import type {
IDataObject, IDataObject,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError, NodeOperationError } from 'n8n-workflow'; import { NodeApiError, NodeOperationError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
import type { Connector, ElasticSecurityApiCredentials } from './types'; import type { Connector, ElasticSecurityApiCredentials } from './types';
export function tolerateTrailingSlash(baseUrl: string) { export function tolerateTrailingSlash(baseUrl: string) {
@ -16,7 +16,7 @@ export function tolerateTrailingSlash(baseUrl: string) {
export async function elasticSecurityApiRequest( export async function elasticSecurityApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -31,7 +31,7 @@ export async function elasticSecurityApiRequest(
const token = Buffer.from(`${username}:${password}`).toString('base64'); const token = Buffer.from(`${username}:${password}`).toString('base64');
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
Authorization: `Basic ${token}`, Authorization: `Basic ${token}`,
'kbn-xsrf': true, 'kbn-xsrf': true,
@ -64,7 +64,7 @@ export async function elasticSecurityApiRequest(
export async function elasticSecurityApiRequestAllItems( export async function elasticSecurityApiRequestAllItems(
this: IExecuteFunctions, this: IExecuteFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -89,7 +89,7 @@ export async function elasticSecurityApiRequestAllItems(
export async function handleListing( export async function handleListing(
this: IExecuteFunctions, this: IExecuteFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},

View file

@ -1,13 +1,17 @@
import type { OptionsWithUri } from 'request'; import type {
IExecuteFunctions,
import type { IExecuteFunctions, IDataObject, JsonObject } from 'n8n-workflow'; IDataObject,
JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
import type { ElasticsearchApiCredentials } from './types'; import type { ElasticsearchApiCredentials } from './types';
export async function elasticsearchApiRequest( export async function elasticsearchApiRequest(
this: IExecuteFunctions, this: IExecuteFunctions,
method: 'GET' | 'PUT' | 'POST' | 'DELETE', method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -16,7 +20,7 @@ export async function elasticsearchApiRequest(
'elasticsearchApi', 'elasticsearchApi',
)) as ElasticsearchApiCredentials; )) as ElasticsearchApiCredentials;
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
body, body,
qs, qs,

View file

@ -7,6 +7,9 @@ import type {
INodeCredentialTestResult, INodeCredentialTestResult,
INodePropertyOptions, INodePropertyOptions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
IDataObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
@ -15,14 +18,14 @@ import { NodeApiError } from 'n8n-workflow';
*/ */
export async function emeliaApiRequest( export async function emeliaApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions, this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: object = {}, body: object = {},
qs: object = {}, qs: IDataObject = {},
) { ) {
const { apiKey } = (await this.getCredentials('emeliaApi')) as { apiKey: string }; const { apiKey } = (await this.getCredentials('emeliaApi')) as { apiKey: string };
const options = { const options: IRequestOptions = {
headers: { headers: {
Authorization: apiKey, Authorization: apiKey,
}, },

View file

@ -1,10 +1,10 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
@ -12,7 +12,7 @@ import { NodeApiError } from 'n8n-workflow';
export async function eventbriteApiRequest( export async function eventbriteApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -20,7 +20,7 @@ export async function eventbriteApiRequest(
uri?: string, uri?: string,
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: {}, headers: {},
method, method,
qs, qs,
@ -56,7 +56,7 @@ export async function eventbriteApiRequest(
export async function eventbriteApiRequestAllItems( export async function eventbriteApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},

View file

@ -1,6 +1,6 @@
import { readFile as fsReadFile } from 'fs/promises'; import { readFile as fsReadFile } from 'fs/promises';
import { NodeOperationError, jsonParse } from 'n8n-workflow'; import { NodeOperationError, jsonParse } from 'n8n-workflow';
import type { IExecuteFunctions, IExecuteWorkflowInfo } from 'n8n-workflow'; import type { IExecuteFunctions, IExecuteWorkflowInfo, IRequestOptions } from 'n8n-workflow';
export async function getWorkflowInfo(this: IExecuteFunctions, source: string, itemIndex = 0) { export async function getWorkflowInfo(this: IExecuteFunctions, source: string, itemIndex = 0) {
const workflowInfo: IExecuteWorkflowInfo = {}; const workflowInfo: IExecuteWorkflowInfo = {};
@ -43,7 +43,7 @@ export async function getWorkflowInfo(this: IExecuteFunctions, source: string, i
uri: workflowUrl, uri: workflowUrl,
json: true, json: true,
gzip: true, gzip: true,
}; } satisfies IRequestOptions;
const response = await this.helpers.request(requestOptions); const response = await this.helpers.request(requestOptions);
workflowInfo.code = response; workflowInfo.code = response;

View file

@ -1,15 +1,15 @@
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHttpRequestMethods,
INodeExecutionData, INodeExecutionData,
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
IRequestOptions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError, NodeOperationError } from 'n8n-workflow'; import { NodeApiError, NodeOperationError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
export class FacebookGraphApi implements INodeType { export class FacebookGraphApi implements INodeType {
description: INodeTypeDescription = { description: INodeTypeDescription = {
displayName: 'Facebook Graph API', displayName: 'Facebook Graph API',
@ -308,7 +308,10 @@ export class FacebookGraphApi implements INodeType {
const graphApiCredentials = await this.getCredentials('facebookGraphApi'); const graphApiCredentials = await this.getCredentials('facebookGraphApi');
const hostUrl = this.getNodeParameter('hostUrl', itemIndex) as string; const hostUrl = this.getNodeParameter('hostUrl', itemIndex) as string;
const httpRequestMethod = this.getNodeParameter('httpRequestMethod', itemIndex) as string; const httpRequestMethod = this.getNodeParameter(
'httpRequestMethod',
itemIndex,
) as IHttpRequestMethods;
let graphApiVersion = this.getNodeParameter('graphApiVersion', itemIndex) as string; let graphApiVersion = this.getNodeParameter('graphApiVersion', itemIndex) as string;
const node = this.getNodeParameter('node', itemIndex) as string; const node = this.getNodeParameter('node', itemIndex) as string;
const edge = this.getNodeParameter('edge', itemIndex) as string; const edge = this.getNodeParameter('edge', itemIndex) as string;
@ -323,7 +326,10 @@ export class FacebookGraphApi implements INodeType {
uri = `${uri}/${edge}`; uri = `${uri}/${edge}`;
} }
const requestOptions: OptionsWithUri = { const qs: IDataObject = {
access_token: graphApiCredentials.accessToken,
};
const requestOptions: IRequestOptions = {
headers: { headers: {
accept: 'application/json,text/*;q=0.99', accept: 'application/json,text/*;q=0.99',
}, },
@ -331,9 +337,6 @@ export class FacebookGraphApi implements INodeType {
uri, uri,
json: true, json: true,
gzip: true, gzip: true,
qs: {
access_token: graphApiCredentials.accessToken,
},
rejectUnauthorized: !this.getNodeParameter('allowUnauthorizedCerts', itemIndex, false), rejectUnauthorized: !this.getNodeParameter('allowUnauthorizedCerts', itemIndex, false),
}; };
@ -343,7 +346,7 @@ export class FacebookGraphApi implements INodeType {
const fields = options.fields as IDataObject; const fields = options.fields as IDataObject;
if (fields.field !== undefined) { if (fields.field !== undefined) {
const fieldsCsv = (fields.field as IDataObject[]).map((field) => field.name).join(','); const fieldsCsv = (fields.field as IDataObject[]).map((field) => field.name).join(',');
requestOptions.qs.fields = fieldsCsv; qs.fields = fieldsCsv;
} }
} }
@ -353,11 +356,13 @@ export class FacebookGraphApi implements INodeType {
if (queryParameters.parameter !== undefined) { if (queryParameters.parameter !== undefined) {
for (const queryParameter of queryParameters.parameter as IDataObject[]) { for (const queryParameter of queryParameters.parameter as IDataObject[]) {
requestOptions.qs[queryParameter.name as string] = queryParameter.value; qs[queryParameter.name as string] = queryParameter.value;
} }
} }
} }
requestOptions.qs = qs;
// Add the query parameters defined as a JSON object // Add the query parameters defined as a JSON object
if (options.queryParametersJson) { if (options.queryParametersJson) {
let queryParametersJsonObj = {}; let queryParametersJsonObj = {};
@ -366,7 +371,6 @@ export class FacebookGraphApi implements INodeType {
} catch { } catch {
/* Do nothing, at least for now */ /* Do nothing, at least for now */
} }
const qs = requestOptions.qs;
requestOptions.qs = { requestOptions.qs = {
...qs, ...qs,
...queryParametersJsonObj, ...queryParametersJsonObj,

View file

@ -1,10 +1,10 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
@ -14,7 +14,7 @@ import { capitalCase } from 'change-case';
export async function facebookApiRequest( export async function facebookApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -32,7 +32,7 @@ export async function facebookApiRequest(
qs.access_token = credentials.accessToken; qs.access_token = credentials.accessToken;
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
accept: 'application/json,text/*;q=0.99', accept: 'application/json,text/*;q=0.99',
}, },

View file

@ -1,10 +1,10 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
@ -20,12 +20,12 @@ import type {
export async function facebookApiRequest( export async function facebookApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body = {}, body = {},
qs: IDataObject = {}, qs: IDataObject = {},
): Promise<any> { ): Promise<any> {
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
accept: 'application/json', accept: 'application/json',
}, },
@ -51,7 +51,7 @@ export async function appAccessTokenRead(
): Promise<{ access_token: string }> { ): Promise<{ access_token: string }> {
const credentials = await this.getCredentials('facebookLeadAdsOAuth2Api'); const credentials = await this.getCredentials('facebookLeadAdsOAuth2Api');
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
'content-type': 'application/x-www-form-urlencoded', 'content-type': 'application/x-www-form-urlencoded',
}, },
@ -73,7 +73,7 @@ export async function appAccessTokenRead(
export async function facebookAppApiRequest( export async function facebookAppApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body?: { type: 'json'; payload: IDataObject } | { type: 'form'; payload: IDataObject }, body?: { type: 'json'; payload: IDataObject } | { type: 'form'; payload: IDataObject },
qs: IDataObject = {}, qs: IDataObject = {},
@ -81,7 +81,7 @@ export async function facebookAppApiRequest(
const tokenResponse = await appAccessTokenRead.call(this); const tokenResponse = await appAccessTokenRead.call(this);
const appAccessToken = tokenResponse.access_token; const appAccessToken = tokenResponse.access_token;
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
accept: 'application/json', accept: 'application/json',
authorization: `Bearer ${appAccessToken}`, authorization: `Bearer ${appAccessToken}`,
@ -164,7 +164,7 @@ export async function facebookEntityDetail(
export async function facebookPageApiRequest( export async function facebookPageApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body = {}, body = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -172,7 +172,7 @@ export async function facebookPageApiRequest(
const pageId = this.getNodeParameter('page', '', { extractValue: true }) as string; const pageId = this.getNodeParameter('page', '', { extractValue: true }) as string;
const page = (await facebookEntityDetail.call(this, pageId)) as FacebookPage; const page = (await facebookEntityDetail.call(this, pageId)) as FacebookPage;
const pageAccessToken = page.access_token; const pageAccessToken = page.access_token;
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
accept: 'application/json', accept: 'application/json',
authorization: `Bearer ${pageAccessToken}`, authorization: `Bearer ${pageAccessToken}`,

View file

@ -1,17 +1,17 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function figmaApiRequest( export async function figmaApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -21,7 +21,7 @@ export async function figmaApiRequest(
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('figmaApi'); const credentials = await this.getCredentials('figmaApi');
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { 'X-FIGMA-TOKEN': credentials.accessToken }, headers: { 'X-FIGMA-TOKEN': credentials.accessToken },
method, method,
body, body,

View file

@ -7,10 +7,10 @@ import type {
INodePropertyOptions, INodePropertyOptions,
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeOperationError } from 'n8n-workflow'; import { NodeOperationError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
import { import {
getFields, getFields,
getPortals, getPortals,
@ -683,7 +683,7 @@ export class FileMaker implements INodeType {
throw new NodeOperationError(this.getNode(), error as string); throw new NodeOperationError(this.getNode(), error as string);
} }
let requestOptions: OptionsWithUri; let requestOptions: IRequestOptions;
const host = credentials.host as string; const host = credentials.host as string;
const database = credentials.db as string; const database = credentials.db as string;

View file

@ -4,11 +4,10 @@ import type {
IDataObject, IDataObject,
INodePropertyOptions, INodePropertyOptions,
JsonObject, JsonObject,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { ApplicationError, NodeApiError, NodeOperationError } from 'n8n-workflow'; import { ApplicationError, NodeApiError, NodeOperationError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
interface ScriptsOptions { interface ScriptsOptions {
script?: any; script?: any;
'script.param'?: any; 'script.param'?: any;
@ -40,7 +39,7 @@ export async function getToken(this: ILoadOptionsFunctions | IExecuteFunctions):
const url = `https://${host}/fmi/data/v1/databases/${db}/sessions`; const url = `https://${host}/fmi/data/v1/databases/${db}/sessions`;
// Reset all values // Reset all values
const requestOptions: OptionsWithUri = { const requestOptions: IRequestOptions = {
uri: url, uri: url,
headers: {}, headers: {},
method: 'POST', method: 'POST',
@ -114,7 +113,7 @@ export async function layoutsApiRequest(
const db = credentials.db as string; const db = credentials.db as string;
const url = `https://${host}/fmi/data/v1/databases/${db}/layouts`; const url = `https://${host}/fmi/data/v1/databases/${db}/layouts`;
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
Authorization: `Bearer ${token}`, Authorization: `Bearer ${token}`,
}, },
@ -146,7 +145,7 @@ export async function getFields(this: ILoadOptionsFunctions): Promise<any> {
const db = credentials.db as string; const db = credentials.db as string;
const url = `https://${host}/fmi/data/v1/databases/${db}/layouts/${layout}`; const url = `https://${host}/fmi/data/v1/databases/${db}/layouts/${layout}`;
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
Authorization: `Bearer ${token}`, Authorization: `Bearer ${token}`,
}, },
@ -177,7 +176,7 @@ export async function getPortals(this: ILoadOptionsFunctions): Promise<any> {
const db = credentials.db as string; const db = credentials.db as string;
const url = `https://${host}/fmi/data/v1/databases/${db}/layouts/${layout}`; const url = `https://${host}/fmi/data/v1/databases/${db}/layouts/${layout}`;
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
Authorization: `Bearer ${token}`, Authorization: `Bearer ${token}`,
}, },
@ -222,7 +221,7 @@ export async function getScripts(this: ILoadOptionsFunctions): Promise<any> {
const db = credentials.db as string; const db = credentials.db as string;
const url = `https://${host}/fmi/data/v1/databases/${db}/scripts`; const url = `https://${host}/fmi/data/v1/databases/${db}/scripts`;
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
Authorization: `Bearer ${token}`, Authorization: `Bearer ${token}`,
}, },
@ -254,7 +253,7 @@ export async function logout(
const url = `https://${host}/fmi/data/v1/databases/${db}/sessions/${token}`; const url = `https://${host}/fmi/data/v1/databases/${db}/sessions/${token}`;
// Reset all values // Reset all values
const requestOptions: OptionsWithUri = { const requestOptions: IRequestOptions = {
uri: url, uri: url,
headers: {}, headers: {},
method: 'DELETE', method: 'DELETE',

View file

@ -1,16 +1,17 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
export async function flowApiRequest( export async function flowApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -20,7 +21,7 @@ export async function flowApiRequest(
): Promise<any> { ): Promise<any> {
const credentials = await this.getCredentials('flowApi'); const credentials = await this.getCredentials('flowApi');
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { Authorization: `Bearer ${credentials.accessToken}` }, headers: { Authorization: `Bearer ${credentials.accessToken}` },
method, method,
qs, qs,
@ -47,7 +48,7 @@ export async function flowApiRequest(
export async function FlowApiRequestAllItems( export async function FlowApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions, this: IHookFunctions | IExecuteFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},

View file

@ -4,6 +4,8 @@ import type {
IHookFunctions, IHookFunctions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
IRequestOptions,
IHttpRequestMethods,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { ApplicationError, NodeApiError } from 'n8n-workflow'; import { ApplicationError, NodeApiError } from 'n8n-workflow';
@ -36,7 +38,7 @@ async function getToken(
uri: `${base}/user/login`, uri: `${base}/user/login`,
json: true, json: true,
resolveWithFullResponse: true, resolveWithFullResponse: true,
}; } satisfies IRequestOptions;
try { try {
const responseObject = await this.helpers.request(options); const responseObject = await this.helpers.request(options);
@ -54,7 +56,7 @@ async function getToken(
*/ */
export async function formIoApiRequest( export async function formIoApiRequest(
this: IHookFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | ILoadOptionsFunctions | IWebhookFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body = {}, body = {},
qs = {}, qs = {},

View file

@ -6,11 +6,11 @@ import type {
IWebhookFunctions, IWebhookFunctions,
INodePropertyOptions, INodePropertyOptions,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { ApplicationError, NodeApiError } from 'n8n-workflow'; import { ApplicationError, NodeApiError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
export interface IFormstackFieldDefinitionType { export interface IFormstackFieldDefinitionType {
id: string; id: string;
label: string; label: string;
@ -51,14 +51,14 @@ export const enum FormstackFieldFormat {
*/ */
export async function apiRequest( export async function apiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
query: IDataObject = {}, query: IDataObject = {},
): Promise<any> { ): Promise<any> {
const authenticationMethod = this.getNodeParameter('authentication', 0); const authenticationMethod = this.getNodeParameter('authentication', 0);
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: {}, headers: {},
method, method,
body, body,
@ -93,7 +93,7 @@ export async function apiRequest(
*/ */
export async function apiRequestAllItems( export async function apiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject, body: IDataObject,
dataKey: string, dataKey: string,

View file

@ -1,16 +1,16 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { BINARY_ENCODING, NodeApiError } from 'n8n-workflow'; import { BINARY_ENCODING, NodeApiError } from 'n8n-workflow';
export async function freshdeskApiRequest( export async function freshdeskApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -24,7 +24,7 @@ export async function freshdeskApiRequest(
const endpoint = 'freshdesk.com/api/v2'; const endpoint = 'freshdesk.com/api/v2';
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
Authorization: `${Buffer.from(apiKey).toString(BINARY_ENCODING)}`, Authorization: `${Buffer.from(apiKey).toString(BINARY_ENCODING)}`,
@ -51,7 +51,7 @@ export async function freshdeskApiRequest(
export async function freshdeskApiRequestAllItems( export async function freshdeskApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -4,11 +4,11 @@ import type {
IDataObject, IDataObject,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError, NodeOperationError } from 'n8n-workflow'; import { NodeApiError, NodeOperationError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
import { omit } from 'lodash'; import { omit } from 'lodash';
import type { import type {
AddressFixedCollection, AddressFixedCollection,
@ -19,7 +19,7 @@ import type {
export async function freshserviceApiRequest( export async function freshserviceApiRequest(
this: IExecuteFunctions | IHookFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | IHookFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -29,7 +29,7 @@ export async function freshserviceApiRequest(
)) as FreshserviceCredentials; )) as FreshserviceCredentials;
const encodedApiKey = Buffer.from(`${apiKey}:X`).toString('base64'); const encodedApiKey = Buffer.from(`${apiKey}:X`).toString('base64');
const options: OptionsWithUri = { const options: IRequestOptions = {
headers: { headers: {
Authorization: `Basic ${encodedApiKey}`, Authorization: `Basic ${encodedApiKey}`,
}, },
@ -75,7 +75,7 @@ export async function freshserviceApiRequest(
export async function freshserviceApiRequestAllItems( export async function freshserviceApiRequestAllItems(
this: IExecuteFunctions | IHookFunctions, this: IExecuteFunctions | IHookFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -98,7 +98,7 @@ export async function freshserviceApiRequestAllItems(
export async function handleListing( export async function handleListing(
this: IExecuteFunctions, this: IExecuteFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},

View file

@ -3,11 +3,11 @@ import type {
IDataObject, IDataObject,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError, NodeOperationError } from 'n8n-workflow'; import { NodeApiError, NodeOperationError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
import omit from 'lodash/omit'; import omit from 'lodash/omit';
import type { import type {
FreshworksConfigResponse, FreshworksConfigResponse,
@ -18,14 +18,14 @@ import type {
export async function freshworksCrmApiRequest( export async function freshworksCrmApiRequest(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
) { ) {
const { domain } = (await this.getCredentials('freshworksCrmApi')) as FreshworksCrmApiCredentials; const { domain } = (await this.getCredentials('freshworksCrmApi')) as FreshworksCrmApiCredentials;
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
body, body,
qs, qs,
@ -80,7 +80,7 @@ export async function getAllItemsViewId(
export async function freshworksCrmApiRequestAllItems( export async function freshworksCrmApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},
@ -102,7 +102,7 @@ export async function freshworksCrmApiRequestAllItems(
export async function handleListing( export async function handleListing(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: IDataObject = {}, body: IDataObject = {},
qs: IDataObject = {}, qs: IDataObject = {},

View file

@ -1,10 +1,10 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
IWebhookFunctions, IWebhookFunctions,
JsonObject, JsonObject,
} from 'n8n-workflow'; } from 'n8n-workflow';
@ -12,7 +12,7 @@ import { NodeApiError } from 'n8n-workflow';
export async function getresponseApiRequest( export async function getresponseApiRequest(
this: IWebhookFunctions | IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IWebhookFunctions | IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
resource: string, resource: string,
body: any = {}, body: any = {},
@ -22,7 +22,7 @@ export async function getresponseApiRequest(
): Promise<any> { ): Promise<any> {
const authentication = this.getNodeParameter('authentication', 0, 'apiKey') as string; const authentication = this.getNodeParameter('authentication', 0, 'apiKey') as string;
let options: OptionsWithUri = { let options: IRequestOptions = {
headers: { headers: {
'Content-Type': 'application/json', 'Content-Type': 'application/json',
}, },
@ -51,7 +51,7 @@ export async function getresponseApiRequest(
export async function getResponseApiRequestAllItems( export async function getResponseApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions, this: IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -1,15 +1,15 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions, ILoadOptionsFunctions,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
export async function ghostApiRequest( export async function ghostApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},
@ -32,7 +32,7 @@ export async function ghostApiRequest(
const credentials = await this.getCredentials(credentialType); const credentials = await this.getCredentials(credentialType);
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
qs: query, qs: query,
uri: uri || `${credentials.url}/ghost/api/${version}${endpoint}`, uri: uri || `${credentials.url}/ghost/api/${version}${endpoint}`,
@ -46,7 +46,7 @@ export async function ghostApiRequest(
export async function ghostApiRequestAllItems( export async function ghostApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
propertyName: string, propertyName: string,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -1,11 +1,11 @@
import type { OptionsWithUri } from 'request';
import type { import type {
IExecuteFunctions, IExecuteFunctions,
IHookFunctions, IHookFunctions,
IDataObject, IDataObject,
ILoadOptionsFunctions, ILoadOptionsFunctions,
JsonObject, JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow'; } from 'n8n-workflow';
import { NodeApiError, NodeOperationError } from 'n8n-workflow'; import { NodeApiError, NodeOperationError } from 'n8n-workflow';
@ -15,13 +15,13 @@ import { NodeApiError, NodeOperationError } from 'n8n-workflow';
*/ */
export async function githubApiRequest( export async function githubApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions, this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: object, body: object,
query?: object, query?: IDataObject,
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
headers: { headers: {
'User-Agent': 'n8n', 'User-Agent': 'n8n',
@ -92,7 +92,7 @@ export async function getFileSha(
export async function githubApiRequestAllItems( export async function githubApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions, this: IHookFunctions | IExecuteFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -1,6 +1,7 @@
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHttpRequestMethods,
INodeExecutionData, INodeExecutionData,
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
@ -1746,7 +1747,7 @@ export class Github implements INodeType {
// For Query string // For Query string
let qs: IDataObject; let qs: IDataObject;
let requestMethod: string; let requestMethod: IHttpRequestMethods;
let endpoint: string; let endpoint: string;
const operation = this.getNodeParameter('operation', 0); const operation = this.getNodeParameter('operation', 0);

View file

@ -1,6 +1,12 @@
import type { IExecuteFunctions, IHookFunctions, IDataObject, JsonObject } from 'n8n-workflow'; import type {
IExecuteFunctions,
IHookFunctions,
IDataObject,
JsonObject,
IHttpRequestMethods,
IRequestOptions,
} from 'n8n-workflow';
import { NodeApiError } from 'n8n-workflow'; import { NodeApiError } from 'n8n-workflow';
import type { OptionsWithUri } from 'request';
/** /**
* Make an API request to Gitlab * Make an API request to Gitlab
@ -8,13 +14,13 @@ import type { OptionsWithUri } from 'request';
*/ */
export async function gitlabApiRequest( export async function gitlabApiRequest(
this: IHookFunctions | IExecuteFunctions, this: IHookFunctions | IExecuteFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: object, body: object,
query?: object, query?: IDataObject,
option: IDataObject = {}, option: IDataObject = {},
): Promise<any> { ): Promise<any> {
const options: OptionsWithUri = { const options: IRequestOptions = {
method, method,
headers: {}, headers: {},
body, body,
@ -51,7 +57,7 @@ export async function gitlabApiRequest(
export async function gitlabApiRequestAllItems( export async function gitlabApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions, this: IHookFunctions | IExecuteFunctions,
method: string, method: IHttpRequestMethods,
endpoint: string, endpoint: string,
body: any = {}, body: any = {},

View file

@ -1,6 +1,7 @@
import type { import type {
IDataObject, IDataObject,
IExecuteFunctions, IExecuteFunctions,
IHttpRequestMethods,
INodeExecutionData, INodeExecutionData,
INodeType, INodeType,
INodeTypeDescription, INodeTypeDescription,
@ -1373,7 +1374,7 @@ export class Gitlab implements INodeType {
// For Query string // For Query string
let qs: IDataObject; let qs: IDataObject;
let requestMethod: string; let requestMethod: IHttpRequestMethods;
let endpoint: string; let endpoint: string;
let returnAll = false; let returnAll = false;

Some files were not shown because too many files have changed in this diff Show more