Reorganized the module structure.

This commit is contained in:
2026-02-05 05:55:08 +01:00
parent d098081822
commit 21b469c118
13 changed files with 142 additions and 144 deletions

32
src/graph/app.js Normal file
View File

@@ -0,0 +1,32 @@
/**
* Get an Azure application by its display name.
*
* @param { Object } client
* @param { string } appName
* @returns
*/
export async function getApp(client, appName) {
const result = await client
.api("/applications")
.filter(`displayName eq '${appName}'`)
.get();
// Return the first application found or null if none exists
return result.value.length > 0 ? result.value[0] : null;
}
export async function createApp(client, appName) {
const app = await client.api("/applications").post({
displayName: appName,
});
if (!app || !app.appId) {
throw new Error("Failed to create application");
}
return app;
}
export async function deleteApp(client, appObjectId) {
await client.api(`/applications/${appObjectId}`).delete();
}