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

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

View File

@@ -1,16 +1,16 @@
import type { OptionsWithUri } from 'request';
import type {
IBinaryKeyData,
IDataObject,
IDisplayOptions,
IExecuteFunctions,
IHookFunctions,
IHttpRequestMethods,
ILoadOptionsFunctions,
INodeExecutionData,
INodeProperties,
IPairedItemData,
IPollFunctions,
IRequestOptions,
JsonObject,
} from 'n8n-workflow';
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
@@ -45,7 +45,7 @@ const apiVersion: { [key: number]: string } = {
export async function notionApiRequest(
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
method: string,
method: IHttpRequestMethods,
resource: string,
body: any = {},
@@ -54,7 +54,7 @@ export async function notionApiRequest(
option: IDataObject = {},
): Promise<any> {
try {
let options: OptionsWithUri = {
let options: IRequestOptions = {
headers: {
'Notion-Version': apiVersion[this.getNode().typeVersion],
},
@@ -80,7 +80,7 @@ export async function notionApiRequest(
export async function notionApiRequestAllItems(
this: IExecuteFunctions | ILoadOptionsFunctions | IPollFunctions,
propertyName: string,
method: string,
method: IHttpRequestMethods,
endpoint: string,
body: any = {},
query: IDataObject = {},