test(Gmail Node): Add tests for Gmail node v1 (no-changelog) (#12461)

This commit is contained in:
Elias Meire
2025-03-14 18:13:12 +01:00
committed by GitHub
parent 86b791167a
commit 5670449025
12 changed files with 1650 additions and 62 deletions

View File

@@ -9,6 +9,7 @@ import type {
ILoadOptionsFunctions,
INode,
INodeExecutionData,
INodePropertyOptions,
IPollFunctions,
IRequestOptions,
JsonObject,
@@ -637,3 +638,34 @@ export async function simplifyOutput(
return item;
});
}
/**
* Get all the labels to display them to user so that they can select them easily
*/
export async function getLabels(this: ILoadOptionsFunctions): Promise<INodePropertyOptions[]> {
const returnData: INodePropertyOptions[] = [];
const labels = await googleApiRequestAllItems.call(
this,
'labels',
'GET',
'/gmail/v1/users/me/labels',
);
for (const label of labels) {
returnData.push({
name: label.name,
value: label.id,
});
}
return returnData.sort((a, b) => {
if (a.name < b.name) {
return -1;
}
if (a.name > b.name) {
return 1;
}
return 0;
});
}