This commit is contained in:
Ricardo Espinoza
2020-01-01 10:58:27 -05:00
parent a6403fcc81
commit c490d4bc84
3 changed files with 154 additions and 95 deletions

View File

@@ -40,6 +40,29 @@ export async function wordpressApiRequest(this: IExecuteFunctions | IExecuteSing
}
}
export async function intercomApiRequestAllItems(this: IExecuteFunctions, propertyName: string, method: string, endpoint: string, body: any = {}, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
const returnData: IDataObject[] = [];
let responseData;
query.per_page = 10;
query.page = 1;
let uri: string | undefined;
do {
responseData = await wordpressApiRequest.call(this, method, endpoint, body, query, uri);
uri = responseData.pages.next;
} while (
responseData.pages !== undefined &&
responseData.pages.next !== undefined &&
responseData.pages.next !== null
);
return returnData;
}
export function validateJSON(json: string | undefined): any { // tslint:disable-line:no-any
let result;
try {