export type UpdateApiAuthoringV1ResourcesIdArgs = {'Content-Type': string, name: string, id: string, md5: string, body: BodyInit}; export type UpdateApiAuthoringV1ResourcesIdOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Create a resource at the given id. * * PUT /authoring/v1/resources/{id} */ export const updateApiAuthoringV1ResourcesId = async (args: UpdateApiAuthoringV1ResourcesIdArgs, options: UpdateApiAuthoringV1ResourcesIdOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() headers.set('content-type', "*/*") if (args['Content-Type'] != null) headers.set("Content-Type", String(args['Content-Type'])) if (args.name != null) query.append("name", String(args.name)) if (args.md5 != null) query.append("md5", String(args.md5)) const url = `${baseUrl.replace(/\/+$/, '')}/authoring/v1/resources/${encodeURIComponent(String(args.id))}${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 };