Added more filtering options to app listing.

This commit is contained in:
2026-02-08 15:26:24 +01:00
parent 400d418763
commit 5888cb4d1a
3 changed files with 31 additions and 6 deletions

View File

@@ -34,19 +34,28 @@ export async function deleteApp(client, appObjectId) {
}
/**
* List Azure applications, optionally filtered by display name.
* List Azure applications, optionally filtered by display name and/or app ID.
*
* @param { Object } client
* @param { Object } [options]
* @param { string } [options.displayName]
* @param { string } [options.appId]
* @returns { Promise<Array> }
*/
export async function listApps(client, options = {}) {
const { displayName } = options;
const { displayName, appId } = options;
let request = client.api("/applications");
const filters = [];
if (displayName) {
request = request.filter(`displayName eq '${displayName}'`);
filters.push(`displayName eq '${displayName}'`);
}
if (appId) {
filters.push(`appId eq '${appId}'`);
}
if (filters.length > 0) {
request = request.filter(filters.join(" and "));
}
const result = await request.get();