Enhance documentation for getGraphClient and getApp functions in graph.js
This commit is contained in:
17
src/graph.js
17
src/graph.js
@@ -1,6 +1,15 @@
|
|||||||
import { Client } from "@microsoft/microsoft-graph-client";
|
import { Client } from "@microsoft/microsoft-graph-client";
|
||||||
import { loginInteractive } from "./azure.js";
|
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 }) {
|
export async function getGraphClient({ tenantId, clientId }) {
|
||||||
const graphApiToken = await loginInteractive({
|
const graphApiToken = await loginInteractive({
|
||||||
tenantId,
|
tenantId,
|
||||||
@@ -17,6 +26,14 @@ export async function getGraphClient({ tenantId, clientId }) {
|
|||||||
return { graphApiToken, client };
|
return { graphApiToken, client };
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Get an Azure application by its display name.
|
||||||
|
*
|
||||||
|
* @param { Object } client
|
||||||
|
* @param { string } appName
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
export async function getApp(client, appName) {
|
export async function getApp(client, appName) {
|
||||||
const result = await client
|
const result = await client
|
||||||
.api("/applications")
|
.api("/applications")
|
||||||
|
|||||||
Reference in New Issue
Block a user