mirror of
https://github.com/Abdulazizzn/n8n-enterprise-unlocked.git
synced 2025-12-17 10:02:05 +00:00
test(Gmail Node): Add tests for Gmail node v1 (no-changelog) (#12461)
This commit is contained in:
@@ -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;
|
||||
});
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user