mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-18 02:21:13 +00: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:
@@ -1,10 +1,10 @@
|
||||
import type { OptionsWithUri } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
IHttpRequestMethods,
|
||||
ILoadOptionsFunctions,
|
||||
IRequestOptions,
|
||||
} from 'n8n-workflow';
|
||||
|
||||
/**
|
||||
@@ -13,14 +13,14 @@ import type {
|
||||
*/
|
||||
export async function apiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: object,
|
||||
query?: IDataObject,
|
||||
): Promise<any> {
|
||||
query = query || {};
|
||||
|
||||
const options: OptionsWithUri = {
|
||||
const options: IRequestOptions = {
|
||||
method,
|
||||
body,
|
||||
qs: query,
|
||||
@@ -33,7 +33,7 @@ export async function apiRequest(
|
||||
|
||||
export async function apiRequestAllItems(
|
||||
this: IHookFunctions | IExecuteFunctions,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
endpoint: string,
|
||||
body: IDataObject,
|
||||
query: IDataObject = {},
|
||||
|
||||
@@ -6,6 +6,7 @@ import type {
|
||||
INodeListSearchResult,
|
||||
INodeType,
|
||||
INodeTypeDescription,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
@@ -202,7 +203,7 @@ export class Trello implements INodeType {
|
||||
// For Query string
|
||||
let qs: IDataObject;
|
||||
|
||||
let requestMethod: string;
|
||||
let requestMethod: IHttpRequestMethods;
|
||||
let endpoint: string;
|
||||
let returnAll = false;
|
||||
let responseData;
|
||||
|
||||
Reference in New Issue
Block a user