export type UpdateApiMediaFolderArgs = {body: BodyInit}; export type UpdateApiMediaFolderOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Update a directory * * PUT /media/folder */ export const updateApiMediaFolder = async (args: UpdateApiMediaFolderArgs, options?: UpdateApiMediaFolderOptions) => { const {baseUrl = "https://www.rcac.purdue.edu/api", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "*/*") const url = `${baseUrl.replace(/\/+$/, '')}/media/folder${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "PUT", headers, body: args.body}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };