export type GetApiDrivesDriveIdRootPathToItemContentArgs = {driveId: string, pathToItem: string, $format?: string | undefined}; export type GetApiDrivesDriveIdRootPathToItemContentOptions = {baseUrl?: string | undefined, azureaadv2?: string | undefined, fetch?: typeof fetch | undefined}; /** * Get content for the navigation property children from drives * * GET /drives/{driveId}/root:{pathToItem}:/content */ export const getApiDrivesDriveIdRootPathToItemContent = async (args: GetApiDrivesDriveIdRootPathToItemContentArgs, options?: GetApiDrivesDriveIdRootPathToItemContentOptions) => { const {baseUrl = "https://graph.microsoft.com/v1.0", fetch: fetchFn = fetch, azureaadv2} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('accept', "application/octet-stream") if (args.$format != null) query.append("$format", String(args.$format)) if (azureaadv2 !== undefined) headers.set('authorization', `Bearer ${azureaadv2}`) const url = `${baseUrl.replace(/\/+$/, '')}/drives/${encodeURIComponent(String(args.driveId))}/root:${encodeURIComponent(String(args.pathToItem))}:/content${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "GET", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return res.blob() };