mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 18:12:04 +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,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;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user