mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
⚡ Add Trello List getAll/getCards functionality (#1350)
* Fix to add List.getCards * ⚡ Small improvements to #1347 * ⚡ Minor formatting improvements * ⚡ Small fix Co-authored-by: tumf <y.takahara@gmail.com> Co-authored-by: Jan Oberhauser <jan.oberhauser@gmail.com>
This commit is contained in:
@@ -53,3 +53,26 @@ export async function apiRequest(this: IHookFunctions | IExecuteFunctions | ILoa
|
||||
throw error;
|
||||
}
|
||||
}
|
||||
|
||||
export async function apiRequestAllItems(this: IHookFunctions | IExecuteFunctions, method: string, endpoint: string, body: IDataObject, query: IDataObject = {}): Promise<any> { // tslint:disable-line:no-any
|
||||
|
||||
query.limit = 30;
|
||||
|
||||
query.sort = '-id';
|
||||
|
||||
const returnData: IDataObject[] = [];
|
||||
|
||||
let responseData;
|
||||
|
||||
do {
|
||||
responseData = await apiRequest.call(this, method, endpoint, body, query);
|
||||
returnData.push.apply(returnData, responseData);
|
||||
if (responseData.length !== 0) {
|
||||
query.before = responseData[responseData.length - 1].id;
|
||||
}
|
||||
} while (
|
||||
query.limit <= responseData.length
|
||||
);
|
||||
|
||||
return returnData;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user