From d72f78f597c729d3c1f3cce5e945a94a91f44668 Mon Sep 17 00:00:00 2001 From: Slawomir Koszewski Date: Wed, 4 Feb 2026 22:33:31 +0100 Subject: [PATCH] Enhance documentation for getGraphClient and getApp functions in graph.js --- src/graph.js | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) diff --git a/src/graph.js b/src/graph.js index 7195abe..99bdcc9 100644 --- a/src/graph.js +++ b/src/graph.js @@ -1,6 +1,15 @@ import { Client } from "@microsoft/microsoft-graph-client"; import { loginInteractive } from "./azure.js"; +/** + * Initialize and return a Microsoft Graph client + * along with the authentication token. + * + * @param { Object } options - Options for authentication + * @param { string } options.tenantId - The Azure AD tenant ID + * @param { string } options.clientId - The Azure AD client ID + * @returns { Object } An object containing the Graph API token and client + */ export async function getGraphClient({ tenantId, clientId }) { const graphApiToken = await loginInteractive({ tenantId, @@ -17,6 +26,14 @@ export async function getGraphClient({ tenantId, clientId }) { return { graphApiToken, client }; } + +/** + * 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")