🚚 Rename main generic functions

This commit is contained in:
Iván Ovejero 2021-03-02 11:54:47 -03:00
parent d6c4fc3809
commit 1533536c8f
2 changed files with 9 additions and 9 deletions

View file

@ -11,7 +11,7 @@ import {
IDataObject,
} from 'n8n-workflow';
export async function instagramBasicDisplayApiRequest(
export async function instagramApiRequest(
this: IHookFunctions | IExecuteFunctions,
method: string,
endpoint: string,
@ -52,7 +52,7 @@ export async function instagramBasicDisplayApiRequest(
/**
* Make an authenticated API request to Instagram Basic Display API and return all results.
*/
export async function instagramBasicDisplayApiRequestAllItems(
export async function instagramApiRequestAllItems(
this: IHookFunctions | IExecuteFunctions,
method: string,
endpoint: string,
@ -66,7 +66,7 @@ export async function instagramBasicDisplayApiRequestAllItems(
const limit = this.getNodeParameter('limit', 0, 0) as number;
do {
responseData = await instagramBasicDisplayApiRequest.call(this, method, endpoint, qs, body);
responseData = await instagramApiRequest.call(this, method, endpoint, qs, body);
returnData.push(...responseData.data);
if (!returnAll && returnData.length > limit) {

View file

@ -10,8 +10,8 @@ import {
} from 'n8n-workflow';
import {
instagramBasicDisplayApiRequest,
instagramBasicDisplayApiRequestAllItems,
instagramApiRequest,
instagramApiRequestAllItems,
} from './GenericFunctions';
import {
@ -101,7 +101,7 @@ export class Instagram implements INodeType {
? '/me'
: `/${this.getNodeParameter('userId', i)}`;
responseData = await instagramBasicDisplayApiRequest.call(this, 'GET', endpoint, qs);
responseData = await instagramApiRequest.call(this, 'GET', endpoint, qs);
}
@ -121,7 +121,7 @@ export class Instagram implements INodeType {
const qs: IDataObject = {
fields: 'caption,id,media_type,media_url,permalink,thumbnail_url,timestamp,username',
};
responseData = await instagramBasicDisplayApiRequestAllItems.call(this, 'GET', `/${mediaId}`, qs);
responseData = await instagramApiRequestAllItems.call(this, 'GET', `/${mediaId}`, qs);
}
if (operation === 'getAll') {
@ -138,12 +138,12 @@ export class Instagram implements INodeType {
const qs: IDataObject = {
fields: 'caption,children,id,media_type,media_url,permalink,thumbnail_url,timestamp,username',
};
responseData = await instagramBasicDisplayApiRequestAllItems.call(this, 'GET', `/${userId}/media`, qs);
responseData = await instagramApiRequestAllItems.call(this, 'GET', `/${userId}/media`, qs);
} else if (type === 'albumMedia') {
const mediaId = this.getNodeParameter('mediaId', i);
responseData = await instagramBasicDisplayApiRequestAllItems.call(this, 'GET', `/${mediaId}/children`);
responseData = await instagramApiRequestAllItems.call(this, 'GET', `/${mediaId}/children`);
}
}