mirror of
https://github.com/n8n-io/n8n.git
synced 2024-12-23 11:44:06 -08:00
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:
parent
24859cfef5
commit
100d9bc087
|
@ -117,7 +117,6 @@
|
|||
"@types/express": "^4.17.6",
|
||||
"@types/html-to-text": "^9.0.1",
|
||||
"@types/json-schema": "^7.0.12",
|
||||
"@types/request-promise-native": "~1.0.15",
|
||||
"@types/temp": "^0.9.1",
|
||||
"eslint-plugin-n8n-nodes-base": "^1.16.0",
|
||||
"gulp": "^4.0.2",
|
||||
|
|
|
@ -40,7 +40,6 @@
|
|||
"@types/express": "^4.17.6",
|
||||
"@types/lodash": "^4.14.195",
|
||||
"@types/mime-types": "^2.1.0",
|
||||
"@types/request-promise-native": "~1.0.15",
|
||||
"@types/uuid": "^8.3.2",
|
||||
"@types/xml2js": "^0.4.11"
|
||||
},
|
||||
|
|
|
@ -18,10 +18,8 @@ import type {
|
|||
AxiosError,
|
||||
AxiosHeaders,
|
||||
AxiosPromise,
|
||||
AxiosProxyConfig,
|
||||
AxiosRequestConfig,
|
||||
AxiosResponse,
|
||||
Method,
|
||||
} from 'axios';
|
||||
import axios from 'axios';
|
||||
import crypto, { createHmac } from 'crypto';
|
||||
|
@ -77,6 +75,7 @@ import type {
|
|||
IOAuth2Options,
|
||||
IPairedItemData,
|
||||
IPollFunctions,
|
||||
IRequestOptions,
|
||||
IRunExecutionData,
|
||||
ISourceData,
|
||||
ITaskData,
|
||||
|
@ -121,8 +120,6 @@ import type { Token } from 'oauth-1.0a';
|
|||
import clientOAuth1 from 'oauth-1.0a';
|
||||
import path from 'path';
|
||||
import { stringify } from 'qs';
|
||||
import type { OptionsWithUrl } from 'request';
|
||||
import type { OptionsWithUri, RequestPromiseOptions } from 'request-promise-native';
|
||||
import { Readable } from 'stream';
|
||||
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
|
||||
// That translates all http requests done via
|
||||
// the request library to axios directly
|
||||
|
@ -369,28 +366,28 @@ export async function parseRequestObject(requestObject: IDataObject) {
|
|||
}
|
||||
|
||||
if (requestObject.uri !== undefined) {
|
||||
axiosConfig.url = requestObject.uri?.toString() as string;
|
||||
axiosConfig.url = requestObject.uri?.toString();
|
||||
}
|
||||
|
||||
if (requestObject.url !== undefined) {
|
||||
axiosConfig.url = requestObject.url?.toString() as string;
|
||||
axiosConfig.url = requestObject.url?.toString();
|
||||
}
|
||||
|
||||
if (requestObject.baseURL !== undefined) {
|
||||
axiosConfig.baseURL = requestObject.baseURL?.toString() as string;
|
||||
axiosConfig.baseURL = requestObject.baseURL?.toString();
|
||||
}
|
||||
|
||||
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) {
|
||||
axiosConfig.params = requestObject.qs as IDataObject;
|
||||
axiosConfig.params = requestObject.qs;
|
||||
}
|
||||
|
||||
function hasArrayFormatOptions(
|
||||
arg: IDataObject,
|
||||
): arg is IDataObject & { qsStringifyOptions: { arrayFormat: 'repeat' | 'brackets' } } {
|
||||
arg: IRequestOptions,
|
||||
): arg is Required<Pick<IRequestOptions, 'qsStringifyOptions'>> {
|
||||
if (
|
||||
typeof arg.qsStringifyOptions === 'object' &&
|
||||
arg.qsStringifyOptions !== null &&
|
||||
|
@ -428,13 +425,13 @@ export async function parseRequestObject(requestObject: IDataObject) {
|
|||
|
||||
if (requestObject.auth !== undefined) {
|
||||
// Check support for sendImmediately
|
||||
if ((requestObject.auth as IDataObject).bearer !== undefined) {
|
||||
if (requestObject.auth.bearer !== undefined) {
|
||||
axiosConfig.headers = Object.assign(axiosConfig.headers || {}, {
|
||||
// eslint-disable-next-line @typescript-eslint/restrict-template-expressions
|
||||
Authorization: `Bearer ${(requestObject.auth as IDataObject).bearer}`,
|
||||
Authorization: `Bearer ${requestObject.auth.bearer}`,
|
||||
});
|
||||
} else {
|
||||
const authObj = requestObject.auth as IDataObject;
|
||||
const authObj = requestObject.auth;
|
||||
// Request accepts both user/username and pass/password
|
||||
axiosConfig.auth = {
|
||||
username: (authObj.user || authObj.username) as string,
|
||||
|
@ -506,7 +503,7 @@ export async function parseRequestObject(requestObject: IDataObject) {
|
|||
axiosConfig.httpsAgent = new Agent(agentOptions);
|
||||
|
||||
if (requestObject.timeout !== undefined) {
|
||||
axiosConfig.timeout = requestObject.timeout as number;
|
||||
axiosConfig.timeout = requestObject.timeout;
|
||||
}
|
||||
|
||||
if (requestObject.proxy !== undefined) {
|
||||
|
@ -565,7 +562,7 @@ export async function parseRequestObject(requestObject: IDataObject) {
|
|||
}
|
||||
}
|
||||
} else {
|
||||
axiosConfig.proxy = requestObject.proxy as AxiosProxyConfig;
|
||||
axiosConfig.proxy = requestObject.proxy;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -664,12 +661,6 @@ function digestAuthAxiosConfig(
|
|||
return axiosConfig;
|
||||
}
|
||||
|
||||
type ConfigObject = {
|
||||
auth?: { sendImmediately: boolean };
|
||||
resolveWithFullResponse?: boolean;
|
||||
simple?: boolean;
|
||||
};
|
||||
|
||||
interface IContentType {
|
||||
type: string;
|
||||
parameters: {
|
||||
|
@ -762,14 +753,14 @@ export async function proxyRequestToAxios(
|
|||
workflow: Workflow | undefined,
|
||||
additionalData: IWorkflowExecuteAdditionalData | undefined,
|
||||
node: INode | undefined,
|
||||
uriOrObject: string | object,
|
||||
options?: object,
|
||||
uriOrObject: string | IRequestOptions,
|
||||
options?: IRequestOptions,
|
||||
): Promise<any> {
|
||||
let axiosConfig: AxiosRequestConfig = {
|
||||
maxBodyLength: Infinity,
|
||||
maxContentLength: Infinity,
|
||||
};
|
||||
let configObject: ConfigObject & { uri?: string };
|
||||
let configObject: IRequestOptions;
|
||||
if (typeof uriOrObject === 'string') {
|
||||
configObject = { uri: uriOrObject, ...options };
|
||||
} else {
|
||||
|
@ -1247,10 +1238,10 @@ async function prepareBinaryData(
|
|||
}
|
||||
|
||||
function applyPaginationRequestData(
|
||||
requestData: OptionsWithUri,
|
||||
requestData: IRequestOptions,
|
||||
paginationRequestData: PaginationOptions['request'],
|
||||
): OptionsWithUri {
|
||||
const preparedPaginationData: Partial<OptionsWithUri> = {
|
||||
): IRequestOptions {
|
||||
const preparedPaginationData: Partial<IRequestOptions> = {
|
||||
...paginationRequestData,
|
||||
uri: paginationRequestData.url,
|
||||
};
|
||||
|
@ -1269,13 +1260,13 @@ function applyPaginationRequestData(
|
|||
/**
|
||||
* Makes a request using OAuth data for authentication
|
||||
*
|
||||
* @param {(OptionsWithUri | RequestPromiseOptions)} requestOptions
|
||||
* @param {(IHttpRequestOptions | IRequestOptions)} requestOptions
|
||||
*
|
||||
*/
|
||||
export async function requestOAuth2(
|
||||
this: IAllExecuteFunctions,
|
||||
credentialsType: string,
|
||||
requestOptions: OptionsWithUri | RequestPromiseOptions | IHttpRequestOptions,
|
||||
requestOptions: IHttpRequestOptions | IRequestOptions,
|
||||
node: INode,
|
||||
additionalData: IWorkflowExecuteAdditionalData,
|
||||
oAuth2Options?: IOAuth2Options,
|
||||
|
@ -1339,7 +1330,7 @@ export async function requestOAuth2(
|
|||
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
|
||||
// on the token-type used.
|
||||
|
@ -1423,7 +1414,7 @@ export async function requestOAuth2(
|
|||
: oAuth2Options?.tokenExpiredStatusCode;
|
||||
|
||||
return await this.helpers
|
||||
.request(newRequestOptions)
|
||||
.request(newRequestOptions as IRequestOptions)
|
||||
.then((response) => {
|
||||
const requestOptions = newRequestOptions as any;
|
||||
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
|
||||
|
@ -1513,7 +1504,7 @@ export async function requestOAuth2(
|
|||
export async function requestOAuth1(
|
||||
this: IAllExecuteFunctions,
|
||||
credentialsType: string,
|
||||
requestOptions: OptionsWithUrl | OptionsWithUri | RequestPromiseOptions | IHttpRequestOptions,
|
||||
requestOptions: IHttpRequestOptions | IRequestOptions,
|
||||
isN8nRequest = false,
|
||||
) {
|
||||
const credentials = await this.getCredentials(credentialsType);
|
||||
|
@ -1560,25 +1551,24 @@ export async function requestOAuth1(
|
|||
requestOptions.data = { ...requestOptions.qs, ...requestOptions.form };
|
||||
|
||||
// Fixes issue that OAuth1 library only works with "url" property and not with "uri"
|
||||
// @ts-expect-error @TECH_DEBT: Remove request library
|
||||
if (requestOptions.uri && !requestOptions.url) {
|
||||
// @ts-expect-error @TECH_DEBT: Remove request library
|
||||
if ('uri' in requestOptions && !requestOptions.url) {
|
||||
requestOptions.url = requestOptions.uri;
|
||||
// @ts-expect-error @TECH_DEBT: Remove request library
|
||||
delete requestOptions.uri;
|
||||
}
|
||||
|
||||
requestOptions.headers = oauth.toHeader(
|
||||
oauth.authorize(requestOptions as unknown as clientOAuth1.RequestOptions, token),
|
||||
);
|
||||
) as unknown as Record<string, string>;
|
||||
if (isN8nRequest) {
|
||||
return await this.helpers.httpRequest(requestOptions as IHttpRequestOptions);
|
||||
}
|
||||
|
||||
return await this.helpers.request(requestOptions).catch(async (error: IResponseError) => {
|
||||
// Unknown error so simply throw it
|
||||
throw error;
|
||||
});
|
||||
return await this.helpers
|
||||
.request(requestOptions as IRequestOptions)
|
||||
.catch(async (error: IResponseError) => {
|
||||
// Unknown error so simply throw it
|
||||
throw error;
|
||||
});
|
||||
}
|
||||
|
||||
export async function httpRequestWithAuthentication(
|
||||
|
@ -1776,7 +1766,7 @@ export function normalizeItems(
|
|||
export async function requestWithAuthentication(
|
||||
this: IAllExecuteFunctions,
|
||||
credentialsType: string,
|
||||
requestOptions: OptionsWithUri | RequestPromiseOptions,
|
||||
requestOptions: IRequestOptions,
|
||||
workflow: Workflow,
|
||||
node: INode,
|
||||
additionalData: IWorkflowExecuteAdditionalData,
|
||||
|
@ -1831,14 +1821,14 @@ export async function requestWithAuthentication(
|
|||
Object.assign(credentialsDecrypted, data);
|
||||
}
|
||||
|
||||
requestOptions = await additionalData.credentialsHelper.authenticate(
|
||||
requestOptions = (await additionalData.credentialsHelper.authenticate(
|
||||
credentialsDecrypted,
|
||||
credentialsType,
|
||||
requestOptions as IHttpRequestOptions,
|
||||
workflow,
|
||||
node,
|
||||
);
|
||||
return await proxyRequestToAxios(workflow, additionalData, node, requestOptions as IDataObject);
|
||||
)) as IRequestOptions;
|
||||
return await proxyRequestToAxios(workflow, additionalData, node, requestOptions);
|
||||
} catch (error) {
|
||||
try {
|
||||
if (credentialsDecrypted !== undefined) {
|
||||
|
@ -1855,20 +1845,15 @@ export async function requestWithAuthentication(
|
|||
// make the updated property in the credentials
|
||||
// available to the authenticate method
|
||||
Object.assign(credentialsDecrypted, data);
|
||||
requestOptions = await additionalData.credentialsHelper.authenticate(
|
||||
requestOptions = (await additionalData.credentialsHelper.authenticate(
|
||||
credentialsDecrypted,
|
||||
credentialsType,
|
||||
requestOptions as IHttpRequestOptions,
|
||||
workflow,
|
||||
node,
|
||||
);
|
||||
)) as IRequestOptions;
|
||||
// retry the request
|
||||
return await proxyRequestToAxios(
|
||||
workflow,
|
||||
additionalData,
|
||||
node,
|
||||
requestOptions as IDataObject,
|
||||
);
|
||||
return await proxyRequestToAxios(workflow, additionalData, node, requestOptions);
|
||||
}
|
||||
}
|
||||
throw error;
|
||||
|
@ -2849,7 +2834,7 @@ const getRequestHelperFunctions = (
|
|||
httpRequest,
|
||||
async requestWithAuthenticationPaginated(
|
||||
this: IExecuteFunctions,
|
||||
requestOptions: OptionsWithUri,
|
||||
requestOptions: IRequestOptions,
|
||||
itemIndex: number,
|
||||
paginationOptions: PaginationOptions,
|
||||
credentialsType?: string,
|
||||
|
@ -3093,7 +3078,7 @@ const getRequestHelperFunctions = (
|
|||
async requestOAuth1(
|
||||
this: IAllExecuteFunctions,
|
||||
credentialsType: string,
|
||||
requestOptions: OptionsWithUrl | RequestPromiseOptions,
|
||||
requestOptions: IRequestOptions,
|
||||
): Promise<any> {
|
||||
return await requestOAuth1.call(this, credentialsType, requestOptions);
|
||||
},
|
||||
|
@ -3101,7 +3086,7 @@ const getRequestHelperFunctions = (
|
|||
async requestOAuth2(
|
||||
this: IAllExecuteFunctions,
|
||||
credentialsType: string,
|
||||
requestOptions: OptionsWithUri | RequestPromiseOptions,
|
||||
requestOptions: IRequestOptions,
|
||||
oAuth2Options?: IOAuth2Options,
|
||||
): Promise<any> {
|
||||
return await requestOAuth2.call(
|
||||
|
|
|
@ -8,9 +8,9 @@ import type {
|
|||
IDataObject,
|
||||
IHttpRequestOptions,
|
||||
INodeProperties,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { isObjectEmpty } from 'n8n-workflow';
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
export const regions = [
|
||||
{
|
||||
|
@ -286,16 +286,16 @@ export class Aws implements ICredentialType {
|
|||
let body = requestOptions.body;
|
||||
let region = credentials.region;
|
||||
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
|
||||
const requestWithUri = requestOptions as unknown as OptionsWithUri;
|
||||
const requestWithUri = requestOptions as unknown as IRequestOptions;
|
||||
if (requestWithUri.uri) {
|
||||
requestOptions.url = requestWithUri.uri as string;
|
||||
requestOptions.url = requestWithUri.uri;
|
||||
endpoint = new URL(requestOptions.url);
|
||||
if (service === 'sts') {
|
||||
try {
|
||||
if (requestWithUri.qs?.Action !== 'GetCallerIdentity') {
|
||||
query = requestWithUri.qs;
|
||||
query = requestWithUri.qs as IDataObject;
|
||||
} else {
|
||||
endpoint.searchParams.set('Action', 'GetCallerIdentity');
|
||||
endpoint.searchParams.set('Version', '2011-06-15');
|
||||
|
|
|
@ -1,6 +1,10 @@
|
|||
import type { IDataObject, IExecuteFunctions, ILoadOptionsFunctions } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import flow from 'lodash/flow';
|
||||
import omit from 'lodash/omit';
|
||||
|
@ -17,12 +21,12 @@ import type {
|
|||
|
||||
export async function actionNetworkApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
) {
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs,
|
||||
|
@ -59,7 +63,7 @@ const toItemsKey = (endpoint: string) => {
|
|||
|
||||
export async function handleListing(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -77,7 +81,13 @@ export async function handleListing(
|
|||
const itemsKey = toItemsKey(endpoint);
|
||||
|
||||
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];
|
||||
returnData.push(...(items as IDataObject[]));
|
||||
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
|
@ -317,7 +318,7 @@ export class ActiveCampaign implements INodeType {
|
|||
// For Query string
|
||||
let qs: IDataObject;
|
||||
|
||||
let requestMethod: string;
|
||||
let requestMethod: IHttpRequestMethods;
|
||||
let endpoint: string;
|
||||
let returnAll = false;
|
||||
let dataKey: string | undefined;
|
||||
|
|
|
@ -5,11 +5,11 @@ import type {
|
|||
ILoadOptionsFunctions,
|
||||
INodeProperties,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
export interface IProduct {
|
||||
fields: {
|
||||
item?: object[];
|
||||
|
@ -22,7 +22,7 @@ export interface IProduct {
|
|||
*/
|
||||
export async function activeCampaignApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject,
|
||||
query?: IDataObject,
|
||||
|
@ -34,7 +34,7 @@ export async function activeCampaignApiRequest(
|
|||
query = {};
|
||||
}
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {},
|
||||
method,
|
||||
qs: query,
|
||||
|
@ -75,7 +75,7 @@ export async function activeCampaignApiRequest(
|
|||
*/
|
||||
export async function activeCampaignApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject,
|
||||
query?: IDataObject,
|
||||
|
|
|
@ -1,9 +1,10 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
|
@ -11,7 +12,7 @@ import { NodeApiError } from 'n8n-workflow';
|
|||
|
||||
export async function acuitySchedulingApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -20,7 +21,7 @@ export async function acuitySchedulingApiRequest(
|
|||
): Promise<any> {
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
|
@ -7,12 +5,14 @@ import type {
|
|||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { BINARY_ENCODING, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function affinityApiRequest(
|
||||
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
|
@ -25,7 +25,7 @@ export async function affinityApiRequest(
|
|||
|
||||
const endpoint = 'https://api.affinity.co';
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `Basic ${Buffer.from(apiKey).toString(BINARY_ENCODING)}`,
|
||||
|
@ -53,7 +53,7 @@ export async function affinityApiRequest(
|
|||
export async function affinityApiRequestAllItems(
|
||||
this: IHookFunctions | ILoadOptionsFunctions | IExecuteFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
|
@ -15,7 +15,7 @@ import type { IFilterRules, ISearchConditions } from './FilterInterface';
|
|||
|
||||
export async function agileCrmApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
|
@ -23,7 +23,7 @@ export async function agileCrmApiRequest(
|
|||
sendAsForm?: boolean,
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('agileCrmApi');
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
|
@ -56,7 +56,7 @@ export async function agileCrmApiRequest(
|
|||
|
||||
export async function agileCrmApiRequestAllItems(
|
||||
this: IHookFunctions | ILoadOptionsFunctions | IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
|
@ -95,7 +95,7 @@ export async function agileCrmApiRequestAllItems(
|
|||
|
||||
export async function agileCrmApiRequestUpdate(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method = 'PUT',
|
||||
method: IHttpRequestMethods = 'PUT',
|
||||
endpoint?: string,
|
||||
body: any = {},
|
||||
_query: IDataObject = {},
|
||||
|
@ -103,7 +103,7 @@ export async function agileCrmApiRequestUpdate(
|
|||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('agileCrmApi');
|
||||
const baseUri = `https://${credentials.subdomain}.agilecrm.com/dev/`;
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
INodeType,
|
||||
INodeTypeDescription,
|
||||
INodeTypeBaseDescription,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
|
@ -569,7 +570,7 @@ export class AirtableV1 implements INodeType {
|
|||
|
||||
let returnAll = false;
|
||||
let endpoint = '';
|
||||
let requestMethod = '';
|
||||
let requestMethod: IHttpRequestMethods;
|
||||
|
||||
const body: IDataObject = {};
|
||||
const qs: IDataObject = {};
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IBinaryKeyData,
|
||||
IDataObject,
|
||||
|
@ -8,6 +6,8 @@ import type {
|
|||
ILoadOptionsFunctions,
|
||||
INodeExecutionData,
|
||||
IPairedItemData,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
interface IAttachment {
|
||||
|
@ -28,7 +28,7 @@ export interface IRecord {
|
|||
*/
|
||||
export async function apiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: object,
|
||||
query?: IDataObject,
|
||||
|
@ -42,7 +42,7 @@ export async function apiRequest(
|
|||
// it as query string.
|
||||
// query.api_key = credentials.apiKey;
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {},
|
||||
method,
|
||||
body,
|
||||
|
@ -71,7 +71,7 @@ export async function apiRequest(
|
|||
*/
|
||||
export async function apiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject,
|
||||
query?: IDataObject,
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IBinaryKeyData,
|
||||
IDataObject,
|
||||
|
@ -8,6 +6,8 @@ import type {
|
|||
ILoadOptionsFunctions,
|
||||
INodeExecutionData,
|
||||
IPairedItemData,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { ApplicationError } from 'n8n-workflow';
|
||||
import type { IAttachment, IRecord } from '../helpers/interfaces';
|
||||
|
@ -19,7 +19,7 @@ import { flattenOutput } from '../helpers/utils';
|
|||
*/
|
||||
export async function apiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
query?: IDataObject,
|
||||
|
@ -28,7 +28,7 @@ export async function apiRequest(
|
|||
) {
|
||||
query = query || {};
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {},
|
||||
method,
|
||||
body,
|
||||
|
@ -58,7 +58,7 @@ export async function apiRequest(
|
|||
*/
|
||||
export async function apiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body?: IDataObject,
|
||||
query?: IDataObject,
|
||||
|
|
|
@ -1,16 +1,20 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type { IExecuteFunctions, ILoadOptionsFunctions, JsonObject } from 'n8n-workflow';
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function apiTemplateIoApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
qs = {},
|
||||
body = {},
|
||||
) {
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
'user-agent': 'n8n',
|
||||
Accept: 'application/json',
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IDataObject,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function automizyApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -19,7 +19,7 @@ export async function automizyApiRequest(
|
|||
): Promise<any> {
|
||||
const credentials = (await this.getCredentials('automizyApi')) as IDataObject;
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: `Bearer ${credentials.apiToken}`,
|
||||
},
|
||||
|
@ -50,7 +50,7 @@ export async function automizyApiRequest(
|
|||
export async function automizyApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { autopilotApiRequest, autopilotApiRequestAllItems } from './GenericFunctions';
|
||||
|
@ -228,7 +229,7 @@ export class Autopilot implements INodeType {
|
|||
|
||||
const contactId = this.getNodeParameter('contactId', i) as string;
|
||||
|
||||
const method: { [key: string]: string } = {
|
||||
const method: { [key: string]: IHttpRequestMethods } = {
|
||||
add: 'POST',
|
||||
remove: 'DELETE',
|
||||
exist: 'GET',
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
|
@ -7,14 +5,15 @@ import type {
|
|||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function autopilotApiRequest(
|
||||
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
uri?: string,
|
||||
|
@ -26,7 +25,7 @@ export async function autopilotApiRequest(
|
|||
|
||||
const endpoint = 'https://api2.autopilothq.com/v1';
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
autopilotapikey: apiKey,
|
||||
|
@ -54,7 +53,7 @@ export async function autopilotApiRequest(
|
|||
export async function autopilotApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -8,13 +8,14 @@ import type {
|
|||
IWebhookFunctions,
|
||||
IHttpRequestOptions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { jsonParse, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function awsApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string | Buffer,
|
||||
query: IDataObject = {},
|
||||
|
@ -45,7 +46,7 @@ export async function awsApiRequest(
|
|||
export async function awsApiRequestREST(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
query: IDataObject = {},
|
||||
|
@ -63,7 +64,7 @@ export async function awsApiRequestAllItems(
|
|||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
query: IDataObject = {},
|
||||
|
|
|
@ -6,12 +6,13 @@ import type {
|
|||
ILoadOptionsFunctions,
|
||||
IWebhookFunctions,
|
||||
IHttpRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function awsApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
@ -35,7 +36,7 @@ export async function awsApiRequest(
|
|||
export async function awsApiRequestREST(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
@ -51,7 +52,7 @@ export async function awsApiRequestREST(
|
|||
export async function awsApiRequestSOAP(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
IWebhookFunctions,
|
||||
IHttpRequestOptions,
|
||||
INodeExecutionData,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { ApplicationError, deepCopy } from 'n8n-workflow';
|
||||
|
||||
|
@ -14,7 +15,7 @@ import type { IRequestBody } from './types';
|
|||
export async function awsApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: object | IRequestBody,
|
||||
headers?: object,
|
||||
|
@ -68,7 +69,7 @@ export async function awsApiRequest(
|
|||
export async function awsApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: IRequestBody,
|
||||
headers?: object,
|
||||
|
|
|
@ -10,13 +10,14 @@ import type {
|
|||
IWebhookFunctions,
|
||||
IHttpRequestOptions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function awsApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string | Buffer,
|
||||
query: IDataObject = {},
|
||||
|
@ -49,7 +50,7 @@ export async function awsApiRequest(
|
|||
export async function awsApiRequestREST(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
query: IDataObject = {},
|
||||
|
@ -78,7 +79,7 @@ export async function awsApiRequestREST(
|
|||
export async function awsApiRequestSOAP(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string | Buffer,
|
||||
query: IDataObject = {},
|
||||
|
@ -115,7 +116,7 @@ export async function awsApiRequestSOAPAllItems(
|
|||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
propertyName: string,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
query: IDataObject = {},
|
||||
|
|
|
@ -7,13 +7,14 @@ import type {
|
|||
IWebhookFunctions,
|
||||
IHttpRequestOptions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function awsApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
@ -41,7 +42,7 @@ export async function awsApiRequest(
|
|||
export async function awsApiRequestREST(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
@ -57,7 +58,7 @@ export async function awsApiRequestREST(
|
|||
export async function awsApiRequestSOAP(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
|
|
@ -9,6 +9,7 @@ import type {
|
|||
ILoadOptionsFunctions,
|
||||
IWebhookFunctions,
|
||||
IHttpRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { pascalCase } from 'change-case';
|
||||
|
@ -16,7 +17,7 @@ import { pascalCase } from 'change-case';
|
|||
export async function awsApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string | Buffer | IDataObject,
|
||||
_query: IDataObject = {},
|
||||
|
@ -47,7 +48,7 @@ export async function awsApiRequest(
|
|||
export async function awsApiRequestREST(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
query: IDataObject = {},
|
||||
|
@ -76,7 +77,7 @@ export async function awsApiRequestREST(
|
|||
export async function awsApiRequestSOAP(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string | Buffer | IDataObject,
|
||||
query: IDataObject = {},
|
||||
|
@ -113,7 +114,7 @@ export async function awsApiRequestSOAPAllItems(
|
|||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
propertyName: string,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
query: IDataObject = {},
|
||||
|
|
|
@ -9,12 +9,13 @@ import type {
|
|||
ILoadOptionsFunctions,
|
||||
IWebhookFunctions,
|
||||
IHttpRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function awsApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string | Buffer,
|
||||
query: IDataObject = {},
|
||||
|
@ -45,7 +46,7 @@ export async function awsApiRequest(
|
|||
export async function awsApiRequestREST(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
query: IDataObject = {},
|
||||
|
@ -74,7 +75,7 @@ export async function awsApiRequestREST(
|
|||
export async function awsApiRequestSOAP(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string | Buffer,
|
||||
query: IDataObject = {},
|
||||
|
@ -111,7 +112,7 @@ export async function awsApiRequestSOAPAllItems(
|
|||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
propertyName: string,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
query: IDataObject = {},
|
||||
|
|
|
@ -9,12 +9,13 @@ import type {
|
|||
ILoadOptionsFunctions,
|
||||
IWebhookFunctions,
|
||||
IHttpRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function awsApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string | Buffer | any,
|
||||
query: IDataObject = {},
|
||||
|
@ -43,7 +44,7 @@ export async function awsApiRequest(
|
|||
export async function awsApiRequestREST(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string | Buffer | any,
|
||||
query: IDataObject = {},
|
||||
|
@ -83,7 +84,7 @@ export async function awsApiRequestRESTAllItems(
|
|||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
query: IDataObject = {},
|
||||
|
|
|
@ -8,6 +8,7 @@ import type {
|
|||
IWebhookFunctions,
|
||||
IHttpRequestOptions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
|
@ -16,7 +17,7 @@ import get from 'lodash/get';
|
|||
export async function awsApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
@ -45,7 +46,7 @@ export async function awsApiRequest(
|
|||
export async function awsApiRequestREST(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
@ -61,7 +62,7 @@ export async function awsApiRequestREST(
|
|||
export async function awsApiRequestSOAP(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
@ -85,7 +86,7 @@ export async function awsApiRequestSOAPAllItems(
|
|||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
propertyName: string,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
query: IDataObject = {},
|
||||
|
|
|
@ -3,8 +3,6 @@ import { URL } from 'url';
|
|||
import type { Request } from 'aws4';
|
||||
import { sign } from 'aws4';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import { parseString } from 'xml2js';
|
||||
|
||||
import type {
|
||||
|
@ -16,6 +14,8 @@ import type {
|
|||
IWebhookFunctions,
|
||||
IHttpRequestOptions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
|
@ -37,7 +37,7 @@ function getEndpointForService(
|
|||
export async function awsApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
@ -77,7 +77,7 @@ export async function awsApiRequest(
|
|||
export async function awsApiRequestREST(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
@ -93,7 +93,7 @@ export async function awsApiRequestREST(
|
|||
export async function awsApiRequestSOAP(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
@ -165,7 +165,7 @@ export async function validateCredentials(
|
|||
|
||||
sign(signOpts, securityHeaders);
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: signOpts.headers,
|
||||
method: 'POST',
|
||||
uri: endpoint.href,
|
||||
|
|
|
@ -3,14 +3,14 @@ import { URL } from 'url';
|
|||
import type { Request } from 'aws4';
|
||||
import { sign } from 'aws4';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
ICredentialDataDecryptedObject,
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
|
@ -36,7 +36,7 @@ function getEndpointForService(
|
|||
export async function awsApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
@ -58,7 +58,7 @@ export async function awsApiRequest(
|
|||
|
||||
sign(signOpts, securityHeaders);
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: signOpts.headers,
|
||||
method,
|
||||
uri: endpoint.href,
|
||||
|
@ -75,7 +75,7 @@ export async function awsApiRequest(
|
|||
export async function awsApiRequestREST(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
headers?: object,
|
||||
|
@ -92,7 +92,7 @@ export async function awsApiRequestRESTAllItems(
|
|||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
service: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
body?: string,
|
||||
query: IDataObject = {},
|
||||
|
|
|
@ -4,11 +4,10 @@ import type {
|
|||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUrl } from 'request';
|
||||
|
||||
/**
|
||||
* Make an API request to Mattermost
|
||||
*/
|
||||
|
@ -29,7 +28,7 @@ export async function apiRequest(
|
|||
//set-up uri
|
||||
const uri = `https://api.bamboohr.com/api/gateway.php/${subdomain}/v1/${endpoint}`;
|
||||
|
||||
const options: OptionsWithUrl = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs: query,
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
|
@ -7,6 +5,8 @@ import type {
|
|||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
|
@ -14,7 +14,7 @@ import { snakeCase } from 'change-case';
|
|||
|
||||
export async function bannerbearApiRequest(
|
||||
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -24,7 +24,7 @@ export async function bannerbearApiRequest(
|
|||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('bannerbearApi');
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
Authorization: `Bearer ${credentials.apiKey}`,
|
||||
|
|
|
@ -1,9 +1,9 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
@ -15,7 +15,7 @@ import type { Accumulator, BaserowCredentials, LoadedResource } from './types';
|
|||
*/
|
||||
export async function baserowApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
jwtToken: string,
|
||||
body: IDataObject = {},
|
||||
|
@ -23,7 +23,7 @@ export async function baserowApiRequest(
|
|||
) {
|
||||
const credentials = (await this.getCredentials('baserowApi')) as BaserowCredentials;
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: `JWT ${jwtToken}`,
|
||||
},
|
||||
|
@ -54,7 +54,7 @@ export async function baserowApiRequest(
|
|||
*/
|
||||
export async function baserowApiRequestAllItems(
|
||||
this: IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
jwtToken: string,
|
||||
body: IDataObject,
|
||||
|
@ -90,7 +90,7 @@ export async function getJwtToken(
|
|||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
{ username, password, host }: BaserowCredentials,
|
||||
) {
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method: 'POST',
|
||||
body: {
|
||||
username,
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IDataObject,
|
||||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
const BEEMINDER_URI = 'https://www.beeminder.com/api/v1';
|
||||
|
||||
export async function beeminderApiRequest(
|
||||
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
query: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs: query,
|
||||
|
@ -39,7 +39,7 @@ export async function beeminderApiRequest(
|
|||
|
||||
export async function beeminderApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
|
@ -12,6 +10,7 @@ import type {
|
|||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IWebhookResponseData,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { bitbucketApiRequest, bitbucketApiRequestAllItems } from './GenericFunctions';
|
||||
|
@ -145,7 +144,7 @@ export class BitbucketTrigger implements INodeType {
|
|||
): Promise<INodeCredentialTestResult> {
|
||||
const credentials = credential.data;
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method: 'GET',
|
||||
auth: {
|
||||
user: credentials!.username as string,
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function bitbucketApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -19,7 +20,7 @@ export async function bitbucketApiRequest(
|
|||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('bitbucketApi');
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
method,
|
||||
auth: {
|
||||
user: credentials.username as string,
|
||||
|
@ -49,7 +50,7 @@ export async function bitbucketApiRequest(
|
|||
export async function bitbucketApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function bitlyApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -20,7 +20,7 @@ export async function bitlyApiRequest(
|
|||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0) as string;
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {},
|
||||
method,
|
||||
qs,
|
||||
|
@ -56,7 +56,7 @@ export async function bitlyApiRequest(
|
|||
export async function bitlyApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,14 +1,14 @@
|
|||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
INodePropertyOptions,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
/**
|
||||
* 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(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
qs: IDataObject,
|
||||
body: IDataObject,
|
||||
token: string,
|
||||
): Promise<any> {
|
||||
const baseUrl = await getBaseUrl.call(this);
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
'user-agent': 'n8n',
|
||||
Authorization: `Bearer ${token}`,
|
||||
|
@ -77,7 +77,7 @@ export async function getAccessToken(
|
|||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('bitwardenApi');
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
|
@ -109,7 +109,7 @@ export async function getAccessToken(
|
|||
export async function handleGetAll(
|
||||
this: IExecuteFunctions,
|
||||
i: number,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
qs: IDataObject,
|
||||
body: IDataObject,
|
||||
|
|
|
@ -1,18 +1,18 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IOAuth2Options,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function boxApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -20,7 +20,7 @@ export async function boxApiRequest(
|
|||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
@ -51,7 +51,7 @@ export async function boxApiRequest(
|
|||
export async function boxApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function brandfetchApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -21,7 +21,7 @@ export async function brandfetchApiRequest(
|
|||
): Promise<any> {
|
||||
try {
|
||||
const credentials = await this.getCredentials('brandfetchApi');
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
'x-api-key': credentials.apiKey,
|
||||
},
|
||||
|
|
|
@ -2,11 +2,11 @@ import type {
|
|||
IExecuteSingleFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestOptions,
|
||||
IRequestOptions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { jsonParse, NodeOperationError } from 'n8n-workflow';
|
||||
import type { OptionsWithUri } from 'request';
|
||||
import MailComposer from 'nodemailer/lib/mail-composer';
|
||||
export namespace BrevoNode {
|
||||
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> => {
|
||||
const endpoint = `${baseURL}/webhooks?type=${type}`;
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method: 'GET',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
|
@ -336,7 +336,7 @@ export namespace BrevoWebhookApi {
|
|||
): Promise<WebhookId> => {
|
||||
const endpoint = `${baseURL}/webhooks`;
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method: 'POST',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
|
@ -362,7 +362,7 @@ export namespace BrevoWebhookApi {
|
|||
const endpoint = `${baseURL}/webhooks/${webhookId}`;
|
||||
const body = {};
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method: 'DELETE',
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
|
|
|
@ -4,17 +4,17 @@ import type {
|
|||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
/**
|
||||
* Make an authenticated API request to Bubble.
|
||||
*/
|
||||
export async function bubbleApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject,
|
||||
qs: IDataObject,
|
||||
|
@ -32,7 +32,7 @@ export async function bubbleApiRequest(
|
|||
const rootUrl = hosting === 'bubbleHosted' ? `https://${appName}.bubbleapps.io` : domain;
|
||||
const urlSegment = environment === 'development' ? '/version-test/api/1.1' : '/api/1.1';
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
'user-agent': 'n8n',
|
||||
Authorization: `Bearer ${apiToken}`,
|
||||
|
@ -64,7 +64,7 @@ export async function bubbleApiRequest(
|
|||
*/
|
||||
export async function bubbleApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject,
|
||||
qs: IDataObject,
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
ICredentialDataDecryptedObject,
|
||||
ICredentialTestFunctions,
|
||||
|
@ -8,6 +6,8 @@ import type {
|
|||
ILoadOptionsFunctions,
|
||||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export function getAuthenticationType(data: string): 'accessToken' | 'apiKey' {
|
||||
|
@ -18,7 +18,7 @@ export function getAuthenticationType(data: string): 'accessToken' | 'apiKey' {
|
|||
|
||||
export async function calendlyApiRequest(
|
||||
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -41,7 +41,7 @@ export async function calendlyApiRequest(
|
|||
endpoint = 'https://calendly.com/api/v1';
|
||||
}
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers,
|
||||
method,
|
||||
body,
|
||||
|
@ -72,7 +72,7 @@ export async function validateCredentials(
|
|||
|
||||
const authenticationType = getAuthenticationType(apiKey);
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method: 'GET',
|
||||
uri: '',
|
||||
json: true,
|
||||
|
|
|
@ -6,6 +6,8 @@ import type {
|
|||
INodeTypeDescription,
|
||||
JsonObject,
|
||||
NodeParameterValue,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} 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 operation = this.getNodeParameter('operation', i);
|
||||
|
||||
let requestMethod = 'GET';
|
||||
let requestMethod: IHttpRequestMethods = 'GET';
|
||||
let endpoint = '';
|
||||
body = {};
|
||||
qs = {};
|
||||
|
@ -589,7 +591,7 @@ export class Chargebee implements INodeType {
|
|||
pass: '',
|
||||
},
|
||||
json: true,
|
||||
};
|
||||
} satisfies IRequestOptions;
|
||||
|
||||
let responseData;
|
||||
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function circleciApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -20,7 +20,7 @@ export async function circleciApiRequest(
|
|||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('circleCiApi');
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
'Circle-Token': credentials.apiKey,
|
||||
Accept: 'application/json',
|
||||
|
@ -49,7 +49,7 @@ export async function circleciApiRequest(
|
|||
export async function circleciApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,13 +1,14 @@
|
|||
import { createHash } from 'crypto';
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
ICredentialDataDecryptedObject,
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
INodeProperties,
|
||||
IRequestOptions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
|
@ -17,7 +18,7 @@ import upperFirst from 'lodash/upperFirst';
|
|||
|
||||
export async function webexApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions | IWebhookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -25,7 +26,7 @@ export async function webexApiRequest(
|
|||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs,
|
||||
|
@ -54,7 +55,7 @@ export async function webexApiRequest(
|
|||
export async function webexApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
|
@ -7,12 +5,14 @@ import type {
|
|||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function citrixADCApiRequest(
|
||||
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -21,7 +21,7 @@ export async function citrixADCApiRequest(
|
|||
): Promise<any> {
|
||||
const { url } = (await this.getCredentials('citrixAdcApi')) as { url: string };
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function clearbitApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
api: string,
|
||||
resource: string,
|
||||
|
||||
|
@ -21,7 +21,7 @@ export async function clearbitApiRequest(
|
|||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('clearbitApi');
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: { Authorization: `Bearer ${credentials.apiKey}` },
|
||||
method,
|
||||
qs,
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
|
@ -8,12 +6,14 @@ import type {
|
|||
IWebhookFunctions,
|
||||
IOAuth2Options,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function clickupApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -21,7 +21,7 @@ export async function clickupApiRequest(
|
|||
uri?: string,
|
||||
_option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
@ -58,7 +58,7 @@ export async function clickupApiRequest(
|
|||
export async function clickupApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IPollFunctions,
|
||||
IDataObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function clockifyApiRequest(
|
||||
this: ILoadOptionsFunctions | IPollFunctions | IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -19,7 +19,7 @@ export async function clockifyApiRequest(
|
|||
): Promise<any> {
|
||||
const BASE_URL = 'https://api.clockify.me/api/v1';
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
@ -35,7 +35,7 @@ export async function clockifyApiRequest(
|
|||
|
||||
export async function clockifyApiRequestAllItems(
|
||||
this: IExecuteFunctions | IPollFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,24 +1,24 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IPollFunctions,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function cloudflareApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body = {},
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
headers: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs,
|
||||
|
@ -42,7 +42,7 @@ export async function cloudflareApiRequest(
|
|||
export async function cloudflareApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
query: IDataObject = {},
|
||||
|
|
|
@ -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(
|
||||
|
@ -76,7 +76,7 @@ export async function getAllCollectionEntries(
|
|||
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(
|
||||
|
|
|
@ -11,5 +11,5 @@ export async function submitForm(
|
|||
form,
|
||||
};
|
||||
|
||||
return await cockpitApiRequest.call(this, 'post', `/forms/submit/${resourceName}`, body);
|
||||
return await cockpitApiRequest.call(this, 'POST', `/forms/submit/${resourceName}`, body);
|
||||
}
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { jsonParse, NodeApiError } from 'n8n-workflow';
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
export async function cockpitApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -17,7 +18,7 @@ export async function cockpitApiRequest(
|
|||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('cockpitApi');
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
|
|
|
@ -5,7 +5,7 @@ export async function getSingleton(
|
|||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
resourceName: string,
|
||||
): Promise<any> {
|
||||
return await cockpitApiRequest.call(this, 'get', `/singletons/get/${resourceName}`);
|
||||
return await cockpitApiRequest.call(this, 'GET', `/singletons/get/${resourceName}`);
|
||||
}
|
||||
|
||||
export async function getAllSingletonNames(
|
||||
|
|
|
@ -1,15 +1,16 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function codaApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -19,7 +20,7 @@ export async function codaApiRequest(
|
|||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('codaApi');
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: `Bearer ${credentials.accessToken}`,
|
||||
'User-Agent': 'n8n',
|
||||
|
@ -49,7 +50,7 @@ export async function codaApiRequest(
|
|||
export async function codaApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IDataObject,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function coinGeckoApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -18,7 +18,7 @@ export async function coinGeckoApiRequest(
|
|||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
|
@ -47,7 +47,7 @@ export async function coinGeckoApiRequest(
|
|||
export async function coinGeckoRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function contentfulApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -22,7 +22,7 @@ export async function contentfulApiRequest(
|
|||
const source = this.getNodeParameter('source', 0) as string;
|
||||
const isPreview = source === 'previewApi';
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
qs,
|
||||
body,
|
||||
|
@ -46,7 +46,7 @@ export async function contentfulApiRequest(
|
|||
export async function contentfulApiRequestAllItems(
|
||||
this: ILoadOptionsFunctions | IExecuteFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IDataObject,
|
||||
IHookFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function convertKitApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -21,7 +21,7 @@ export async function convertKitApiRequest(
|
|||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('convertKitApi');
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
|
|
@ -1,13 +1,13 @@
|
|||
import { createHash } from 'crypto';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
ICredentialDataDecryptedObject,
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
|
@ -28,7 +28,7 @@ import type {
|
|||
*/
|
||||
export async function copperApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -37,7 +37,7 @@ export async function copperApiRequest(
|
|||
) {
|
||||
const credentials = (await this.getCredentials('copperApi')) as { apiKey: string; email: string };
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
'X-PW-AccessToken': credentials.apiKey,
|
||||
'X-PW-Application': 'developer_api',
|
||||
|
@ -147,7 +147,7 @@ export const adjustTaskFields = flow(adjustLeadFields, adjustProjectIds);
|
|||
*/
|
||||
export async function copperApiRequestAllItems(
|
||||
this: IHookFunctions | ILoadOptionsFunctions | IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -173,7 +173,7 @@ export async function copperApiRequestAllItems(
|
|||
*/
|
||||
export async function handleListing(
|
||||
this: IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
qs: IDataObject = {},
|
||||
body: IDataObject = {},
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import moment from 'moment-timezone';
|
||||
|
||||
export async function cortexApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -21,7 +21,7 @@ export async function cortexApiRequest(
|
|||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('cortexApi');
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {},
|
||||
method,
|
||||
qs: query,
|
||||
|
|
|
@ -11,7 +11,7 @@ import get from 'lodash/get';
|
|||
|
||||
export async function customerIoApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: object,
|
||||
baseApi?: string,
|
||||
|
@ -22,7 +22,7 @@ export async function customerIoApiRequest(
|
|||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
method: method as IHttpRequestMethods,
|
||||
method,
|
||||
body,
|
||||
url: '',
|
||||
json: true,
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IDataObject,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function deepLApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -22,7 +22,7 @@ export async function deepLApiRequest(
|
|||
|
||||
const credentials = await this.getCredentials('deepLApi');
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function demioApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -21,7 +21,7 @@ export async function demioApiRequest(
|
|||
): Promise<any> {
|
||||
try {
|
||||
const credentials = await this.getCredentials('demioApi');
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
'Api-Key': credentials.apiKey,
|
||||
'Api-Secret': credentials.apiSecret,
|
||||
|
|
|
@ -1,19 +1,19 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
ICredentialDataDecryptedObject,
|
||||
ICredentialTestFunctions,
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function dhlApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -23,7 +23,7 @@ export async function dhlApiRequest(
|
|||
): Promise<any> {
|
||||
const credentials = (await this.getCredentials('dhlApi')) as { apiKey: string };
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
'DHL-API-Key': credentials.apiKey,
|
||||
},
|
||||
|
@ -55,7 +55,7 @@ export async function validateCredentials(
|
|||
apiKey: string;
|
||||
};
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
'DHL-API-Key': apiKey,
|
||||
},
|
||||
|
|
|
@ -1,6 +1,5 @@
|
|||
import type { INodeTypes } from 'n8n-workflow';
|
||||
import type { INodeTypes, IRequestOptions } from 'n8n-workflow';
|
||||
import nock from 'nock';
|
||||
import type { OptionsWithUrl } from 'request-promise-native';
|
||||
import * as transport from '../../../../v2/transport/helpers';
|
||||
import { getResultNodeData, setup, workflowToTests } from '@test/nodes/Helpers';
|
||||
import type { WorkflowTestData } from '@test/nodes/types';
|
||||
|
@ -9,7 +8,7 @@ import { executeWorkflow } from '@test/nodes/ExecuteWorkflow';
|
|||
const requestApiSpy = jest.spyOn(transport, 'requestApi');
|
||||
|
||||
requestApiSpy.mockImplementation(
|
||||
async (options: OptionsWithUrl, credentialType: string, endpoint: string) => {
|
||||
async (options: IRequestOptions, credentialType: string, endpoint: string) => {
|
||||
if (endpoint === '/users/@me/guilds') {
|
||||
return {
|
||||
headers: {},
|
||||
|
|
|
@ -6,6 +6,7 @@ import type {
|
|||
INodeType,
|
||||
INodeTypeBaseDescription,
|
||||
INodeTypeDescription,
|
||||
IRequestOptions,
|
||||
} 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.attachments) delete body.attachments;
|
||||
|
||||
let requestOptions;
|
||||
let requestOptions: IRequestOptions;
|
||||
|
||||
if (!body.payload_json) {
|
||||
requestOptions = {
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { OptionsWithUrl } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import { sleep, NodeApiError, jsonParse } from 'n8n-workflow';
|
||||
|
@ -15,7 +15,7 @@ import { getCredentialsType, requestApi } from './helpers';
|
|||
|
||||
export async function discordApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body?: IDataObject,
|
||||
qs?: IDataObject,
|
||||
|
@ -25,7 +25,7 @@ export async function discordApiRequest(
|
|||
|
||||
const credentialType = getCredentialsType(authentication);
|
||||
|
||||
const options: OptionsWithUrl = {
|
||||
const options: IRequestOptions = {
|
||||
headers,
|
||||
method,
|
||||
qs,
|
||||
|
@ -59,7 +59,7 @@ export async function discordApiRequest(
|
|||
|
||||
export async function discordApiMultiPartRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
formData: FormData,
|
||||
) {
|
||||
|
@ -70,7 +70,7 @@ export async function discordApiMultiPartRequest(
|
|||
|
||||
const credentialType = getCredentialsType(authentication);
|
||||
|
||||
const options: OptionsWithUrl = {
|
||||
const options: IRequestOptions = {
|
||||
headers,
|
||||
method,
|
||||
formData,
|
||||
|
|
|
@ -1,11 +1,10 @@
|
|||
import type { OptionsWithUrl } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IExecuteSingleFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export const getCredentialsType = (authentication: string) => {
|
||||
|
@ -28,7 +27,7 @@ export const getCredentialsType = (authentication: string) => {
|
|||
|
||||
export async function requestApi(
|
||||
this: IHookFunctions | IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions,
|
||||
options: OptionsWithUrl,
|
||||
options: IRequestOptions,
|
||||
credentialType: string,
|
||||
endpoint: string,
|
||||
) {
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IDataObject,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function discourseApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
path: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -19,7 +19,7 @@ export async function discourseApiRequest(
|
|||
): Promise<any> {
|
||||
const credentials = (await this.getCredentials('discourseApi')) as { url: string };
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs,
|
||||
|
@ -39,7 +39,7 @@ export async function discourseApiRequest(
|
|||
|
||||
export async function discourseApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -4,6 +4,7 @@ import type {
|
|||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
|
@ -576,7 +577,7 @@ export class Disqus implements INodeType {
|
|||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
let endpoint = '';
|
||||
let requestMethod = '';
|
||||
let requestMethod: IHttpRequestMethods;
|
||||
let qs: IDataObject;
|
||||
|
||||
for (let i = 0; i < items.length; i++) {
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function disqusApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
body: IDataObject = {},
|
||||
|
@ -31,7 +32,7 @@ export async function disqusApiRequest(
|
|||
}
|
||||
}
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
uri: `https://disqus.com/api/3.0/${uri}?${queryStringElements.join('&')}`,
|
||||
|
@ -55,7 +56,7 @@ export async function disqusApiRequest(
|
|||
*/
|
||||
export async function disqusApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
qs: IDataObject = {},
|
||||
uri?: string,
|
||||
body: IDataObject = {},
|
||||
|
|
|
@ -1,5 +1,3 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
|
@ -7,12 +5,14 @@ import type {
|
|||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function driftApiRequest(
|
||||
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -20,7 +20,7 @@ export async function driftApiRequest(
|
|||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {},
|
||||
method,
|
||||
body,
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHttpRequestMethods,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
|
@ -697,7 +698,7 @@ export class Dropbox implements INodeType {
|
|||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
||||
let endpoint = '';
|
||||
let requestMethod = '';
|
||||
let requestMethod: IHttpRequestMethods = 'GET';
|
||||
let returnAll = false;
|
||||
let property = '';
|
||||
let body: IDataObject | Buffer;
|
||||
|
|
|
@ -1,6 +1,11 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type { IDataObject, IExecuteFunctions, IHookFunctions, JsonObject } from 'n8n-workflow';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
/**
|
||||
|
@ -9,14 +14,14 @@ import { NodeApiError } from 'n8n-workflow';
|
|||
*/
|
||||
export async function dropboxApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: object,
|
||||
query: IDataObject = {},
|
||||
headers: object = {},
|
||||
headers: IDataObject = {},
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers,
|
||||
method,
|
||||
qs: query,
|
||||
|
@ -47,7 +52,7 @@ export async function dropboxApiRequest(
|
|||
export async function dropboxpiRequestAllItems(
|
||||
this: IExecuteFunctions | IHookFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -4,21 +4,21 @@ import type {
|
|||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
IPairedItemData,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
/**
|
||||
* Make an authenticated API request to Bubble.
|
||||
*/
|
||||
export async function dropcontactApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject,
|
||||
qs: IDataObject,
|
||||
) {
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
uri: `https://api.dropcontact.io${endpoint}`,
|
||||
qs,
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
IDataObject,
|
||||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
|
@ -17,7 +17,7 @@ const getBaseUrl = ({ environment, domain, subdomain }: ERPNextApiCredentials) =
|
|||
|
||||
export async function erpNextApiRequest(
|
||||
this: IExecuteFunctions | IWebhookFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body: IDataObject = {},
|
||||
query: IDataObject = {},
|
||||
|
@ -27,7 +27,7 @@ export async function erpNextApiRequest(
|
|||
const credentials = (await this.getCredentials('erpNextApi')) as ERPNextApiCredentials;
|
||||
const baseUrl = getBaseUrl(credentials);
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
'Content-Type': 'application/json',
|
||||
|
@ -68,7 +68,7 @@ export async function erpNextApiRequest(
|
|||
export async function erpNextApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body: IDataObject,
|
||||
query: IDataObject = {},
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { OptionsWithUrl } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
|
@ -21,7 +21,7 @@ const fieldCache: {
|
|||
|
||||
export async function egoiApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -30,7 +30,7 @@ export async function egoiApiRequest(
|
|||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('egoiApi');
|
||||
|
||||
const options: OptionsWithUrl = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
Apikey: `${credentials.apiKey}`,
|
||||
|
@ -64,7 +64,7 @@ export async function getFields(this: IExecuteFunctions, listId: string) {
|
|||
export async function egoiApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -9,10 +9,10 @@ import type {
|
|||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
import {
|
||||
elasticSecurityApiRequest,
|
||||
getConnector,
|
||||
|
@ -132,7 +132,7 @@ export class ElasticSecurity implements INodeType {
|
|||
|
||||
const endpoint = '/cases/status';
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: `Basic ${token}`,
|
||||
'kbn-xsrf': true,
|
||||
|
|
|
@ -3,11 +3,11 @@ import type {
|
|||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type { Connector, ElasticSecurityApiCredentials } from './types';
|
||||
|
||||
export function tolerateTrailingSlash(baseUrl: string) {
|
||||
|
@ -16,7 +16,7 @@ export function tolerateTrailingSlash(baseUrl: string) {
|
|||
|
||||
export async function elasticSecurityApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -31,7 +31,7 @@ export async function elasticSecurityApiRequest(
|
|||
|
||||
const token = Buffer.from(`${username}:${password}`).toString('base64');
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: `Basic ${token}`,
|
||||
'kbn-xsrf': true,
|
||||
|
@ -64,7 +64,7 @@ export async function elasticSecurityApiRequest(
|
|||
|
||||
export async function elasticSecurityApiRequestAllItems(
|
||||
this: IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -89,7 +89,7 @@ export async function elasticSecurityApiRequestAllItems(
|
|||
|
||||
export async function handleListing(
|
||||
this: IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
|
|
@ -1,13 +1,17 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type { IExecuteFunctions, IDataObject, JsonObject } from 'n8n-workflow';
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IDataObject,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import type { ElasticsearchApiCredentials } from './types';
|
||||
|
||||
export async function elasticsearchApiRequest(
|
||||
this: IExecuteFunctions,
|
||||
method: 'GET' | 'PUT' | 'POST' | 'DELETE',
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -16,7 +20,7 @@ export async function elasticsearchApiRequest(
|
|||
'elasticsearchApi',
|
||||
)) as ElasticsearchApiCredentials;
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs,
|
||||
|
|
|
@ -7,6 +7,9 @@ import type {
|
|||
INodeCredentialTestResult,
|
||||
INodePropertyOptions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
IDataObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
|
@ -15,14 +18,14 @@ import { NodeApiError } from 'n8n-workflow';
|
|||
*/
|
||||
export async function emeliaApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions | IHookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: object = {},
|
||||
qs: object = {},
|
||||
qs: IDataObject = {},
|
||||
) {
|
||||
const { apiKey } = (await this.getCredentials('emeliaApi')) as { apiKey: string };
|
||||
|
||||
const options = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: apiKey,
|
||||
},
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
|
@ -12,7 +12,7 @@ import { NodeApiError } from 'n8n-workflow';
|
|||
|
||||
export async function eventbriteApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -20,7 +20,7 @@ export async function eventbriteApiRequest(
|
|||
uri?: string,
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {},
|
||||
method,
|
||||
qs,
|
||||
|
@ -56,7 +56,7 @@ export async function eventbriteApiRequest(
|
|||
export async function eventbriteApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
import { readFile as fsReadFile } from 'fs/promises';
|
||||
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) {
|
||||
const workflowInfo: IExecuteWorkflowInfo = {};
|
||||
|
@ -43,7 +43,7 @@ export async function getWorkflowInfo(this: IExecuteFunctions, source: string, i
|
|||
uri: workflowUrl,
|
||||
json: true,
|
||||
gzip: true,
|
||||
};
|
||||
} satisfies IRequestOptions;
|
||||
|
||||
const response = await this.helpers.request(requestOptions);
|
||||
workflowInfo.code = response;
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHttpRequestMethods,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
export class FacebookGraphApi implements INodeType {
|
||||
description: INodeTypeDescription = {
|
||||
displayName: 'Facebook Graph API',
|
||||
|
@ -308,7 +308,10 @@ export class FacebookGraphApi implements INodeType {
|
|||
const graphApiCredentials = await this.getCredentials('facebookGraphApi');
|
||||
|
||||
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;
|
||||
const node = this.getNodeParameter('node', itemIndex) as string;
|
||||
const edge = this.getNodeParameter('edge', itemIndex) as string;
|
||||
|
@ -323,7 +326,10 @@ export class FacebookGraphApi implements INodeType {
|
|||
uri = `${uri}/${edge}`;
|
||||
}
|
||||
|
||||
const requestOptions: OptionsWithUri = {
|
||||
const qs: IDataObject = {
|
||||
access_token: graphApiCredentials.accessToken,
|
||||
};
|
||||
const requestOptions: IRequestOptions = {
|
||||
headers: {
|
||||
accept: 'application/json,text/*;q=0.99',
|
||||
},
|
||||
|
@ -331,9 +337,6 @@ export class FacebookGraphApi implements INodeType {
|
|||
uri,
|
||||
json: true,
|
||||
gzip: true,
|
||||
qs: {
|
||||
access_token: graphApiCredentials.accessToken,
|
||||
},
|
||||
rejectUnauthorized: !this.getNodeParameter('allowUnauthorizedCerts', itemIndex, false),
|
||||
};
|
||||
|
||||
|
@ -343,7 +346,7 @@ export class FacebookGraphApi implements INodeType {
|
|||
const fields = options.fields as IDataObject;
|
||||
if (fields.field !== undefined) {
|
||||
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) {
|
||||
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
|
||||
if (options.queryParametersJson) {
|
||||
let queryParametersJsonObj = {};
|
||||
|
@ -366,7 +371,6 @@ export class FacebookGraphApi implements INodeType {
|
|||
} catch {
|
||||
/* Do nothing, at least for now */
|
||||
}
|
||||
const qs = requestOptions.qs;
|
||||
requestOptions.qs = {
|
||||
...qs,
|
||||
...queryParametersJsonObj,
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
|
@ -14,7 +14,7 @@ import { capitalCase } from 'change-case';
|
|||
|
||||
export async function facebookApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -32,7 +32,7 @@ export async function facebookApiRequest(
|
|||
|
||||
qs.access_token = credentials.accessToken;
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
accept: 'application/json,text/*;q=0.99',
|
||||
},
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
|
@ -20,12 +20,12 @@ import type {
|
|||
|
||||
export async function facebookApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body = {},
|
||||
qs: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
},
|
||||
|
@ -51,7 +51,7 @@ export async function appAccessTokenRead(
|
|||
): Promise<{ access_token: string }> {
|
||||
const credentials = await this.getCredentials('facebookLeadAdsOAuth2Api');
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
'content-type': 'application/x-www-form-urlencoded',
|
||||
},
|
||||
|
@ -73,7 +73,7 @@ export async function appAccessTokenRead(
|
|||
|
||||
export async function facebookAppApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body?: { type: 'json'; payload: IDataObject } | { type: 'form'; payload: IDataObject },
|
||||
qs: IDataObject = {},
|
||||
|
@ -81,7 +81,7 @@ export async function facebookAppApiRequest(
|
|||
const tokenResponse = await appAccessTokenRead.call(this);
|
||||
const appAccessToken = tokenResponse.access_token;
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
authorization: `Bearer ${appAccessToken}`,
|
||||
|
@ -164,7 +164,7 @@ export async function facebookEntityDetail(
|
|||
|
||||
export async function facebookPageApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
body = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -172,7 +172,7 @@ export async function facebookPageApiRequest(
|
|||
const pageId = this.getNodeParameter('page', '', { extractValue: true }) as string;
|
||||
const page = (await facebookEntityDetail.call(this, pageId)) as FacebookPage;
|
||||
const pageAccessToken = page.access_token;
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
accept: 'application/json',
|
||||
authorization: `Bearer ${pageAccessToken}`,
|
||||
|
|
|
@ -1,17 +1,17 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function figmaApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -21,7 +21,7 @@ export async function figmaApiRequest(
|
|||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('figmaApi');
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: { 'X-FIGMA-TOKEN': credentials.accessToken },
|
||||
method,
|
||||
body,
|
||||
|
|
|
@ -7,10 +7,10 @@ import type {
|
|||
INodePropertyOptions,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
import {
|
||||
getFields,
|
||||
getPortals,
|
||||
|
@ -683,7 +683,7 @@ export class FileMaker implements INodeType {
|
|||
throw new NodeOperationError(this.getNode(), error as string);
|
||||
}
|
||||
|
||||
let requestOptions: OptionsWithUri;
|
||||
let requestOptions: IRequestOptions;
|
||||
|
||||
const host = credentials.host as string;
|
||||
const database = credentials.db as string;
|
||||
|
|
|
@ -4,11 +4,10 @@ import type {
|
|||
IDataObject,
|
||||
INodePropertyOptions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { ApplicationError, NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
interface ScriptsOptions {
|
||||
script?: 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`;
|
||||
|
||||
// Reset all values
|
||||
const requestOptions: OptionsWithUri = {
|
||||
const requestOptions: IRequestOptions = {
|
||||
uri: url,
|
||||
headers: {},
|
||||
method: 'POST',
|
||||
|
@ -114,7 +113,7 @@ export async function layoutsApiRequest(
|
|||
const db = credentials.db as string;
|
||||
|
||||
const url = `https://${host}/fmi/data/v1/databases/${db}/layouts`;
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
|
@ -146,7 +145,7 @@ export async function getFields(this: ILoadOptionsFunctions): Promise<any> {
|
|||
const db = credentials.db as string;
|
||||
|
||||
const url = `https://${host}/fmi/data/v1/databases/${db}/layouts/${layout}`;
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
|
@ -177,7 +176,7 @@ export async function getPortals(this: ILoadOptionsFunctions): Promise<any> {
|
|||
const db = credentials.db as string;
|
||||
|
||||
const url = `https://${host}/fmi/data/v1/databases/${db}/layouts/${layout}`;
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
|
@ -222,7 +221,7 @@ export async function getScripts(this: ILoadOptionsFunctions): Promise<any> {
|
|||
const db = credentials.db as string;
|
||||
|
||||
const url = `https://${host}/fmi/data/v1/databases/${db}/scripts`;
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: `Bearer ${token}`,
|
||||
},
|
||||
|
@ -254,7 +253,7 @@ export async function logout(
|
|||
const url = `https://${host}/fmi/data/v1/databases/${db}/sessions/${token}`;
|
||||
|
||||
// Reset all values
|
||||
const requestOptions: OptionsWithUri = {
|
||||
const requestOptions: IRequestOptions = {
|
||||
uri: url,
|
||||
headers: {},
|
||||
method: 'DELETE',
|
||||
|
|
|
@ -1,16 +1,17 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function flowApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -20,7 +21,7 @@ export async function flowApiRequest(
|
|||
): Promise<any> {
|
||||
const credentials = await this.getCredentials('flowApi');
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: { Authorization: `Bearer ${credentials.accessToken}` },
|
||||
method,
|
||||
qs,
|
||||
|
@ -47,7 +48,7 @@ export async function flowApiRequest(
|
|||
export async function FlowApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -4,6 +4,8 @@ import type {
|
|||
IHookFunctions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { ApplicationError, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
|
@ -36,7 +38,7 @@ async function getToken(
|
|||
uri: `${base}/user/login`,
|
||||
json: true,
|
||||
resolveWithFullResponse: true,
|
||||
};
|
||||
} satisfies IRequestOptions;
|
||||
|
||||
try {
|
||||
const responseObject = await this.helpers.request(options);
|
||||
|
@ -54,7 +56,7 @@ async function getToken(
|
|||
*/
|
||||
export async function formIoApiRequest(
|
||||
this: IHookFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body = {},
|
||||
qs = {},
|
||||
|
|
|
@ -6,11 +6,11 @@ import type {
|
|||
IWebhookFunctions,
|
||||
INodePropertyOptions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { ApplicationError, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
export interface IFormstackFieldDefinitionType {
|
||||
id: string;
|
||||
label: string;
|
||||
|
@ -51,14 +51,14 @@ export const enum FormstackFieldFormat {
|
|||
*/
|
||||
export async function apiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
query: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const authenticationMethod = this.getNodeParameter('authentication', 0);
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {},
|
||||
method,
|
||||
body,
|
||||
|
@ -93,7 +93,7 @@ export async function apiRequest(
|
|||
*/
|
||||
export async function apiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IWebhookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject,
|
||||
dataKey: string,
|
||||
|
|
|
@ -1,16 +1,16 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
import { BINARY_ENCODING, NodeApiError } from 'n8n-workflow';
|
||||
|
||||
export async function freshdeskApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -24,7 +24,7 @@ export async function freshdeskApiRequest(
|
|||
|
||||
const endpoint = 'freshdesk.com/api/v2';
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
Authorization: `${Buffer.from(apiKey).toString(BINARY_ENCODING)}`,
|
||||
|
@ -51,7 +51,7 @@ export async function freshdeskApiRequest(
|
|||
|
||||
export async function freshdeskApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -4,11 +4,11 @@ import type {
|
|||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import { omit } from 'lodash';
|
||||
import type {
|
||||
AddressFixedCollection,
|
||||
|
@ -19,7 +19,7 @@ import type {
|
|||
|
||||
export async function freshserviceApiRequest(
|
||||
this: IExecuteFunctions | IHookFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -29,7 +29,7 @@ export async function freshserviceApiRequest(
|
|||
)) as FreshserviceCredentials;
|
||||
const encodedApiKey = Buffer.from(`${apiKey}:X`).toString('base64');
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Authorization: `Basic ${encodedApiKey}`,
|
||||
},
|
||||
|
@ -75,7 +75,7 @@ export async function freshserviceApiRequest(
|
|||
|
||||
export async function freshserviceApiRequestAllItems(
|
||||
this: IExecuteFunctions | IHookFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -98,7 +98,7 @@ export async function freshserviceApiRequestAllItems(
|
|||
|
||||
export async function handleListing(
|
||||
this: IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
|
|
@ -3,11 +3,11 @@ import type {
|
|||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import omit from 'lodash/omit';
|
||||
import type {
|
||||
FreshworksConfigResponse,
|
||||
|
@ -18,14 +18,14 @@ import type {
|
|||
|
||||
export async function freshworksCrmApiRequest(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
) {
|
||||
const { domain } = (await this.getCredentials('freshworksCrmApi')) as FreshworksCrmApiCredentials;
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs,
|
||||
|
@ -80,7 +80,7 @@ export async function getAllItemsViewId(
|
|||
|
||||
export async function freshworksCrmApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
@ -102,7 +102,7 @@ export async function freshworksCrmApiRequestAllItems(
|
|||
|
||||
export async function handleListing(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject = {},
|
||||
qs: IDataObject = {},
|
||||
|
|
|
@ -1,10 +1,10 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
IWebhookFunctions,
|
||||
JsonObject,
|
||||
} from 'n8n-workflow';
|
||||
|
@ -12,7 +12,7 @@ import { NodeApiError } from 'n8n-workflow';
|
|||
|
||||
export async function getresponseApiRequest(
|
||||
this: IWebhookFunctions | IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
resource: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -22,7 +22,7 @@ export async function getresponseApiRequest(
|
|||
): Promise<any> {
|
||||
const authentication = this.getNodeParameter('authentication', 0, 'apiKey') as string;
|
||||
|
||||
let options: OptionsWithUri = {
|
||||
let options: IRequestOptions = {
|
||||
headers: {
|
||||
'Content-Type': 'application/json',
|
||||
},
|
||||
|
@ -51,7 +51,7 @@ export async function getresponseApiRequest(
|
|||
|
||||
export async function getResponseApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,15 +1,15 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
export async function ghostApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
@ -32,7 +32,7 @@ export async function ghostApiRequest(
|
|||
|
||||
const credentials = await this.getCredentials(credentialType);
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
qs: query,
|
||||
uri: uri || `${credentials.url}/ghost/api/${version}${endpoint}`,
|
||||
|
@ -46,7 +46,7 @@ export async function ghostApiRequest(
|
|||
export async function ghostApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
propertyName: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,11 +1,11 @@
|
|||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IDataObject,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IHttpRequestMethods,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
|
@ -15,13 +15,13 @@ import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
|||
*/
|
||||
export async function githubApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: object,
|
||||
query?: object,
|
||||
query?: IDataObject,
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
headers: {
|
||||
'User-Agent': 'n8n',
|
||||
|
@ -92,7 +92,7 @@ export async function getFileSha(
|
|||
|
||||
export async function githubApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHttpRequestMethods,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
|
@ -1746,7 +1747,7 @@ export class Github implements INodeType {
|
|||
// For Query string
|
||||
let qs: IDataObject;
|
||||
|
||||
let requestMethod: string;
|
||||
let requestMethod: IHttpRequestMethods;
|
||||
let endpoint: string;
|
||||
|
||||
const operation = this.getNodeParameter('operation', 0);
|
||||
|
|
|
@ -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 type { OptionsWithUri } from 'request';
|
||||
|
||||
/**
|
||||
* Make an API request to Gitlab
|
||||
|
@ -8,13 +14,13 @@ import type { OptionsWithUri } from 'request';
|
|||
*/
|
||||
export async function gitlabApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: object,
|
||||
query?: object,
|
||||
query?: IDataObject,
|
||||
option: IDataObject = {},
|
||||
): Promise<any> {
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
headers: {},
|
||||
body,
|
||||
|
@ -51,7 +57,7 @@ export async function gitlabApiRequest(
|
|||
|
||||
export async function gitlabApiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
|
||||
body: any = {},
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHttpRequestMethods,
|
||||
INodeExecutionData,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
|
@ -1373,7 +1374,7 @@ export class Gitlab implements INodeType {
|
|||
// For Query string
|
||||
let qs: IDataObject;
|
||||
|
||||
let requestMethod: string;
|
||||
let requestMethod: IHttpRequestMethods;
|
||||
let endpoint: string;
|
||||
let returnAll = false;
|
||||
|
||||
|
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue