mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 01:56:46 +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,11 +1,11 @@
|
||||
import type { OptionsWithUrl } from 'request';
|
||||
|
||||
import type {
|
||||
IDataObject,
|
||||
IExecuteFunctions,
|
||||
IHookFunctions,
|
||||
ILoadOptionsFunctions,
|
||||
JsonObject,
|
||||
IRequestOptions,
|
||||
IHttpRequestMethods,
|
||||
} from 'n8n-workflow';
|
||||
import { NodeApiError, NodeOperationError } from 'n8n-workflow';
|
||||
|
||||
@@ -14,7 +14,7 @@ async function getMetadata(
|
||||
oauthTokenData: IDataObject,
|
||||
) {
|
||||
const credentials = await this.getCredentials('mailchimpOAuth2Api');
|
||||
const options: OptionsWithUrl = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
Authorization: `OAuth ${oauthTokenData.access_token}`,
|
||||
@@ -29,7 +29,7 @@ async function getMetadata(
|
||||
export async function mailchimpApiRequest(
|
||||
this: IHookFunctions | IExecuteFunctions | ILoadOptionsFunctions,
|
||||
endpoint: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
|
||||
body: any = {},
|
||||
qs: IDataObject = {},
|
||||
@@ -39,7 +39,7 @@ export async function mailchimpApiRequest(
|
||||
|
||||
const host = 'api.mailchimp.com/3.0';
|
||||
|
||||
const options: OptionsWithUrl = {
|
||||
const options: IRequestOptions = {
|
||||
headers: {
|
||||
Accept: 'application/json',
|
||||
},
|
||||
@@ -84,7 +84,7 @@ export async function mailchimpApiRequest(
|
||||
export async function mailchimpApiRequestAllItems(
|
||||
this: IExecuteFunctions | ILoadOptionsFunctions,
|
||||
endpoint: string,
|
||||
method: string,
|
||||
method: IHttpRequestMethods,
|
||||
propertyName: string,
|
||||
|
||||
body: any = {},
|
||||
|
||||
Reference in New Issue
Block a user