export type DriveItemIdMicrosoftGraphCheckinBody = {checkInAs?: (string | null) | undefined, comment?: (string | null) | undefined} | {[key: string]: unknown}; export type CreateApiDrivesDriveIdRootMicrosoftGraphCheckinArgs = {driveId: string, body: DriveItemIdMicrosoftGraphCheckinBody}; export type CreateApiDrivesDriveIdRootMicrosoftGraphCheckinOptions = {baseUrl?: string | undefined, azureaadv2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Invoke action checkin * * POST /drives/{driveId}/root/microsoft.graph.checkin */ export const createApiDrivesDriveIdRootMicrosoftGraphCheckin = async (args: CreateApiDrivesDriveIdRootMicrosoftGraphCheckinArgs, options?: CreateApiDrivesDriveIdRootMicrosoftGraphCheckinOptions) => { 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))}/root/microsoft.graph.checkin${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 };