Added more filtering options to app listing.
This commit is contained in:
@@ -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();
|
||||
|
||||
Reference in New Issue
Block a user