export type DeleteApiApiV1MediaAssetIdArgs = {asset_id: string, force?: boolean | undefined}; export type DeleteApiApiV1MediaAssetIdOptions = {baseUrl: string, OAuth2PasswordBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a media asset * * DELETE /api/v1/media/{asset_id} */ export const deleteApiApiV1MediaAssetId = async (args: DeleteApiApiV1MediaAssetIdArgs, options: DeleteApiApiV1MediaAssetIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, OAuth2PasswordBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.force != null) query.append("force", String(args.force)) if (OAuth2PasswordBearer !== undefined) headers.set('authorization', `Bearer ${OAuth2PasswordBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/media/${encodeURIComponent(String(args.asset_id))}${query.size > 0 ? `?${query}` : ''}` const res = await fetchFn(url, {method: "DELETE", headers}) if (!res.ok) throw new Error(`Request failed with status ${res.status}`, {cause: {status: res.status, body: await res.text()}}) return undefined };