fix: Remove redundant await in node's api request functions without try/catch (#4639)

* 🐛 Remove useless await for actionNetwork

* 🔥 Remove useless await

* 🔥 Remove useless await keyword to other generic functions
This commit is contained in:
agobrech 2022-11-22 17:57:17 +01:00 committed by GitHub
parent b87c12285f
commit 67983e8f94
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
33 changed files with 33 additions and 33 deletions

View file

@ -39,7 +39,7 @@ export async function actionNetworkApiRequest(
delete options.qs; delete options.qs;
} }
return await this.helpers.requestWithAuthentication.call(this, 'actionNetworkApi', options); return this.helpers.requestWithAuthentication.call(this, 'actionNetworkApi', options);
} }
export async function handleListing( export async function handleListing(

View file

@ -60,7 +60,7 @@ export async function apiRequest(
delete options.body; delete options.body;
} }
return await this.helpers.requestWithAuthentication.call(this, 'airtableApi', options); return this.helpers.requestWithAuthentication.call(this, 'airtableApi', options);
} }
/** /**

View file

@ -31,7 +31,7 @@ export async function awsApiRequest(
headers, headers,
region: credentials?.region as string, region: credentials?.region as string,
} as IHttpRequestOptions; } as IHttpRequestOptions;
return await this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions); return this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions);
} }
export async function awsApiRequestREST( export async function awsApiRequestREST(

View file

@ -42,7 +42,7 @@ export async function awsApiRequest(
if (Object.keys(option).length !== 0) { if (Object.keys(option).length !== 0) {
Object.assign(requestOptions, option); Object.assign(requestOptions, option);
} }
return await this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions); return this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions);
} }
export async function awsApiRequestREST( export async function awsApiRequestREST(

View file

@ -40,7 +40,7 @@ export async function awsApiRequest(
if (Object.keys(option).length !== 0) { if (Object.keys(option).length !== 0) {
Object.assign(requestOptions, option); Object.assign(requestOptions, option);
} }
return await this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions); return this.helpers.requestWithAuthentication.call(this, 'aws', requestOptions);
} }
export async function awsApiRequestREST( export async function awsApiRequestREST(

View file

@ -31,7 +31,7 @@ export async function beeminderApiRequest(
delete options.qs; delete options.qs;
} }
return await this.helpers.requestWithAuthentication.call(this, 'beeminderApi', options); return this.helpers.requestWithAuthentication.call(this, 'beeminderApi', options);
} }
export async function beeminderApiRequestAllItems( export async function beeminderApiRequestAllItems(

View file

@ -52,7 +52,7 @@ export async function calendlyApiRequest(
delete options.qs; delete options.qs;
} }
options = Object.assign({}, options, option); options = Object.assign({}, options, option);
return await this.helpers.requestWithAuthentication.call(this, 'calendlyApi', options); return this.helpers.requestWithAuthentication.call(this, 'calendlyApi', options);
} }
export function getAuthenticationType(data: string): 'accessToken' | 'apiKey' { export function getAuthenticationType(data: string): 'accessToken' | 'apiKey' {

View file

@ -28,7 +28,7 @@ export async function clockifyApiRequest(
json: true, json: true,
useQuerystring: true, useQuerystring: true,
}; };
return await this.helpers.requestWithAuthentication.call(this, 'clockifyApi', options); return this.helpers.requestWithAuthentication.call(this, 'clockifyApi', options);
} }
export async function clockifyApiRequestAllItems( export async function clockifyApiRequestAllItems(

View file

@ -42,7 +42,7 @@ export async function cortexApiRequest(
delete options.qs; delete options.qs;
} }
return await this.helpers.requestWithAuthentication.call(this, 'cortexApi', options); return this.helpers.requestWithAuthentication.call(this, 'cortexApi', options);
} }
export function getEntityLabel(entity: IDataObject): string { export function getEntityLabel(entity: IDataObject): string {

View file

@ -32,7 +32,7 @@ export async function customerIoApiRequest(
options.url = `https://beta-api.customer.io/v1/api${endpoint}`; options.url = `https://beta-api.customer.io/v1/api${endpoint}`;
} }
return await this.helpers.requestWithAuthentication.call(this, 'customerIoApi', options); return this.helpers.requestWithAuthentication.call(this, 'customerIoApi', options);
} }
export function eventExists(currentEvents: string[], webhookEvents: IDataObject) { export function eventExists(currentEvents: string[], webhookEvents: IDataObject) {

View file

@ -30,5 +30,5 @@ export async function dropcontactApiRequest(
delete options.qs; delete options.qs;
} }
return await this.helpers.requestWithAuthentication.call(this, 'dropcontactApi', options); return this.helpers.requestWithAuthentication.call(this, 'dropcontactApi', options);
} }

View file

@ -44,7 +44,7 @@ export async function ghostApiRequest(
json: true, json: true,
}; };
return await this.helpers.requestWithAuthentication.call(this, credentialType, options); return this.helpers.requestWithAuthentication.call(this, credentialType, options);
} }
export async function ghostApiRequestAllItems( export async function ghostApiRequestAllItems(

View file

@ -232,7 +232,7 @@ export async function highLevelApiRequest(
delete options.qs; delete options.qs;
} }
options = Object.assign({}, options, option); options = Object.assign({}, options, option);
return await this.helpers.requestWithAuthentication.call(this, 'highLevelApi', options); return this.helpers.requestWithAuthentication.call(this, 'highLevelApi', options);
} }
export async function getPipelineStages( export async function getPipelineStages(

View file

@ -58,7 +58,7 @@ export async function jiraSoftwareCloudApiRequest(
delete options.qs; delete options.qs;
} }
return await this.helpers.requestWithAuthentication.call(this, credentialType, options); return this.helpers.requestWithAuthentication.call(this, credentialType, options);
} }
export async function jiraSoftwareCloudApiRequestAllItems( export async function jiraSoftwareCloudApiRequestAllItems(

View file

@ -38,7 +38,7 @@ export async function lemlistApiRequest(
Object.assign(options, option); Object.assign(options, option);
} }
return await this.helpers.requestWithAuthentication.call(this, 'lemlistApi', options); return this.helpers.requestWithAuthentication.call(this, 'lemlistApi', options);
} }
/** /**

View file

@ -48,7 +48,7 @@ export async function mailjetApiRequest(
delete options.body; delete options.body;
} }
return await this.helpers.requestWithAuthentication.call(this, credentialType, options); return this.helpers.requestWithAuthentication.call(this, credentialType, options);
} }
export async function mailjetApiRequestAllItems( export async function mailjetApiRequestAllItems(

View file

@ -52,5 +52,5 @@ export async function nextCloudApiRequest(
const credentialType = const credentialType =
authenticationMethod === 'accessToken' ? 'nextCloudApi' : 'nextCloudOAuth2Api'; authenticationMethod === 'accessToken' ? 'nextCloudApi' : 'nextCloudOAuth2Api';
return await this.helpers.requestWithAuthentication.call(this, credentialType, options); return this.helpers.requestWithAuthentication.call(this, credentialType, options);
} }

View file

@ -60,7 +60,7 @@ export async function apiRequest(
delete options.body; delete options.body;
} }
return await this.helpers.requestWithAuthentication.call(this, authenticationMethod, options); return this.helpers.requestWithAuthentication.call(this, authenticationMethod, options);
} }
/** /**

View file

@ -24,7 +24,7 @@ export async function rocketchatApiRequest(
if (Object.keys(options.body).length === 0) { if (Object.keys(options.body).length === 0) {
delete options.body; delete options.body;
} }
return await this.helpers.requestWithAuthentication.call(this, 'rocketchatApi', options); return this.helpers.requestWithAuthentication.call(this, 'rocketchatApi', options);
} }
// tslint:disable-next-line:no-any // tslint:disable-next-line:no-any

View file

@ -36,5 +36,5 @@ export async function segmentApiRequest(
if (!Object.keys(body).length) { if (!Object.keys(body).length) {
delete options.body; delete options.body;
} }
return await this.helpers.requestWithAuthentication.call(this, 'segmentApi', options); return this.helpers.requestWithAuthentication.call(this, 'segmentApi', options);
} }

View file

@ -37,7 +37,7 @@ export async function sendGridApiRequest(
Object.assign(options, option); Object.assign(options, option);
} }
return await this.helpers.requestWithAuthentication.call(this, 'sendGridApi', options); return this.helpers.requestWithAuthentication.call(this, 'sendGridApi', options);
} }
export async function sendGridApiRequestAllItems( export async function sendGridApiRequestAllItems(

View file

@ -66,7 +66,7 @@ export async function shopifyApiRequest(
delete options.qs; delete options.qs;
} }
return await this.helpers.requestWithAuthentication.call(this, credentialType, options, { return this.helpers.requestWithAuthentication.call(this, credentialType, options, {
oauth2: oAuth2Options, oauth2: oAuth2Options,
}); });
} }

View file

@ -27,7 +27,7 @@ export async function stripeApiRequest(
delete options.qs; delete options.qs;
} }
return await this.helpers.requestWithAuthentication.call(this, 'stripeApi', options); return this.helpers.requestWithAuthentication.call(this, 'stripeApi', options);
} }
/** /**

View file

@ -40,7 +40,7 @@ export async function theHiveApiRequest(
if (Object.keys(query).length === 0) { if (Object.keys(query).length === 0) {
delete options.qs; delete options.qs;
} }
return await this.helpers.requestWithAuthentication.call(this, 'theHiveApi', options); return this.helpers.requestWithAuthentication.call(this, 'theHiveApi', options);
} }
// Helpers functions // Helpers functions

View file

@ -26,7 +26,7 @@ export async function apiRequest(
json: true, json: true,
}; };
return await this.helpers.requestWithAuthentication.call(this, 'trelloApi', options); return this.helpers.requestWithAuthentication.call(this, 'trelloApi', options);
} }
export async function apiRequestAllItems( export async function apiRequestAllItems(

View file

@ -30,5 +30,5 @@ export async function twakeApiRequest(
// options.uri = `${credentials!.hostUrl}/api/v1${resource}`; // options.uri = `${credentials!.hostUrl}/api/v1${resource}`;
// } // }
return await this.helpers.requestWithAuthentication.call(this, 'twakeCloudApi', options); return this.helpers.requestWithAuthentication.call(this, 'twakeCloudApi', options);
} }

View file

@ -36,7 +36,7 @@ export async function twilioApiRequest(
json: true, json: true,
}; };
return await this.helpers.requestWithAuthentication.call(this, 'twilioApi', options); return this.helpers.requestWithAuthentication.call(this, 'twilioApi', options);
} }
const XML_CHAR_MAP: { [key: string]: string } = { const XML_CHAR_MAP: { [key: string]: string } = {

View file

@ -27,7 +27,7 @@ export async function urlScanIoApiRequest(
delete options.qs; delete options.qs;
} }
return await this.helpers.requestWithAuthentication.call(this, 'urlScanIoApi', options); return this.helpers.requestWithAuthentication.call(this, 'urlScanIoApi', options);
} }
export async function handleListing( export async function handleListing(

View file

@ -48,7 +48,7 @@ export async function webflowApiRequest(
if (Object.keys(options.body).length === 0) { if (Object.keys(options.body).length === 0) {
delete options.body; delete options.body;
} }
return await this.helpers.requestWithAuthentication.call(this, credentialsType, options); return this.helpers.requestWithAuthentication.call(this, credentialsType, options);
} }
export async function webflowApiRequestAllItems( export async function webflowApiRequestAllItems(

View file

@ -27,5 +27,5 @@ export async function apiRequest(
json: true, json: true,
}; };
return await this.helpers.requestWithAuthentication.call(this, 'wekanApi', options); return this.helpers.requestWithAuthentication.call(this, 'wekanApi', options);
} }

View file

@ -48,7 +48,7 @@ export async function woocommerceApiRequest(
delete options.form; delete options.form;
} }
options = Object.assign({}, options, option); options = Object.assign({}, options, option);
return await this.helpers.requestWithAuthentication.call(this, 'wooCommerceApi', options); return this.helpers.requestWithAuthentication.call(this, 'wooCommerceApi', options);
} }
export async function woocommerceApiRequestAllItems( export async function woocommerceApiRequestAllItems(

View file

@ -36,5 +36,5 @@ export async function wufooApiRequest(
delete options.body; delete options.body;
} }
return await this.helpers.requestWithAuthentication.call(this, 'wufooApi', options); return this.helpers.requestWithAuthentication.call(this, 'wufooApi', options);
} }

View file

@ -48,7 +48,7 @@ export async function zendeskApiRequest(
const credentialType = authenticationMethod === 'apiToken' ? 'zendeskApi' : 'zendeskOAuth2Api'; const credentialType = authenticationMethod === 'apiToken' ? 'zendeskApi' : 'zendeskOAuth2Api';
return await this.helpers.requestWithAuthentication.call(this, credentialType, options); return this.helpers.requestWithAuthentication.call(this, credentialType, options);
} }
/** /**