export type DriveItemIdMicrosoftGraphValidatePermissionBody = {challengeToken?: (string | null) | undefined, password?: string | undefined} | {[key: string]: unknown}; export type CreateApiDrivesDriveIdItemsDriveItemIdMicrosoftGraphValidatePermissionArgs = {driveId: string, driveItemId: string, body: DriveItemIdMicrosoftGraphValidatePermissionBody}; export type CreateApiDrivesDriveIdItemsDriveItemIdMicrosoftGraphValidatePermissionOptions = {baseUrl?: string | undefined, azureaadv2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Invoke action validatePermission * * POST /drives/{driveId}/items/{driveItemId}/microsoft.graph.validatePermission */ export const createApiDrivesDriveIdItemsDriveItemIdMicrosoftGraphValidatePermission = async (args: CreateApiDrivesDriveIdItemsDriveItemIdMicrosoftGraphValidatePermissionArgs, options?: CreateApiDrivesDriveIdItemsDriveItemIdMicrosoftGraphValidatePermissionOptions) => { const {baseUrl = "https://graph.microsoft.com/v1.0", fetch: fetchFn = fetch, azureaadv2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "application/json") if (azureaadv2 !== undefined) headers.set('authorization', `Bearer ${azureaadv2}`) const url = `${baseUrl.replace(/\/+$/, '')}/drives/${encodeURIComponent(String(args.driveId))}/items/${encodeURIComponent(String(args.driveItemId))}/microsoft.graph.validatePermission${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "POST", headers, body: JSON.stringify(args.body)}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };