Added lead resource

This commit is contained in:
Ricardo Espinoza
2020-02-15 19:23:22 -05:00
parent 24670cb7ee
commit c630028531
5 changed files with 984 additions and 65 deletions

View File

@@ -7,6 +7,7 @@ import {
import {
IDataObject
} from 'n8n-workflow';
import { queryResult } from 'pg-promise';
export async function zohoApiRequest(this: IExecuteFunctions | IExecuteSingleFunctions | ILoadOptionsFunctions, method: string, resource: string, body: any = {}, qs: IDataObject = {}, uri?: string, option: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
const options: OptionsWithUri = {
@@ -41,14 +42,17 @@ export async function zohoApiRequestAllItems(this: IExecuteFunctions | ILoadOpti
let responseData;
let uri: string | undefined;
query.per_page = 200;
query.page = 0;
do {
responseData = await zohoApiRequest.call(this, method, endpoint, body, query, uri);
uri = responseData.nextRecordsUrl;
uri = responseData.info.more_records;
returnData.push.apply(returnData, responseData[propertyName]);
query.page++;
} while (
responseData.nextRecordsUrl !== undefined &&
responseData.nextRecordsUrl !== null
responseData.info.more_records !== undefined &&
responseData.info.more_records === true
);
return returnData;