mirror of
https://github.com/n8n-io/n8n.git
synced 2024-11-14 16:44:07 -08:00
🚚 Rename main generic functions
This commit is contained in:
parent
d6c4fc3809
commit
1533536c8f
|
@ -11,7 +11,7 @@ import {
|
||||||
IDataObject,
|
IDataObject,
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
export async function instagramBasicDisplayApiRequest(
|
export async function instagramApiRequest(
|
||||||
this: IHookFunctions | IExecuteFunctions,
|
this: IHookFunctions | IExecuteFunctions,
|
||||||
method: string,
|
method: string,
|
||||||
endpoint: 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.
|
* 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,
|
this: IHookFunctions | IExecuteFunctions,
|
||||||
method: string,
|
method: string,
|
||||||
endpoint: string,
|
endpoint: string,
|
||||||
|
@ -66,7 +66,7 @@ export async function instagramBasicDisplayApiRequestAllItems(
|
||||||
const limit = this.getNodeParameter('limit', 0, 0) as number;
|
const limit = this.getNodeParameter('limit', 0, 0) as number;
|
||||||
|
|
||||||
do {
|
do {
|
||||||
responseData = await instagramBasicDisplayApiRequest.call(this, method, endpoint, qs, body);
|
responseData = await instagramApiRequest.call(this, method, endpoint, qs, body);
|
||||||
returnData.push(...responseData.data);
|
returnData.push(...responseData.data);
|
||||||
|
|
||||||
if (!returnAll && returnData.length > limit) {
|
if (!returnAll && returnData.length > limit) {
|
||||||
|
|
|
@ -10,8 +10,8 @@ import {
|
||||||
} from 'n8n-workflow';
|
} from 'n8n-workflow';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
instagramBasicDisplayApiRequest,
|
instagramApiRequest,
|
||||||
instagramBasicDisplayApiRequestAllItems,
|
instagramApiRequestAllItems,
|
||||||
} from './GenericFunctions';
|
} from './GenericFunctions';
|
||||||
|
|
||||||
import {
|
import {
|
||||||
|
@ -101,7 +101,7 @@ export class Instagram implements INodeType {
|
||||||
? '/me'
|
? '/me'
|
||||||
: `/${this.getNodeParameter('userId', i)}`;
|
: `/${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 = {
|
const qs: IDataObject = {
|
||||||
fields: 'caption,id,media_type,media_url,permalink,thumbnail_url,timestamp,username',
|
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') {
|
if (operation === 'getAll') {
|
||||||
|
@ -138,12 +138,12 @@ export class Instagram implements INodeType {
|
||||||
const qs: IDataObject = {
|
const qs: IDataObject = {
|
||||||
fields: 'caption,children,id,media_type,media_url,permalink,thumbnail_url,timestamp,username',
|
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') {
|
} else if (type === 'albumMedia') {
|
||||||
|
|
||||||
const mediaId = this.getNodeParameter('mediaId', i);
|
const mediaId = this.getNodeParameter('mediaId', i);
|
||||||
responseData = await instagramBasicDisplayApiRequestAllItems.call(this, 'GET', `/${mediaId}/children`);
|
responseData = await instagramApiRequestAllItems.call(this, 'GET', `/${mediaId}/children`);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue