export type DeleteApiV1AssetsAssetIdUploadsArgs = {'App-ID': string, 'Auth-Token': string, asset_id: string, low_priority_indexing?: boolean | undefined}; export type DeleteApiV1AssetsAssetIdUploadsOptions = {baseUrl: string, fetch?: typeof fetch | undefined}; /** * Delete a particular asset by id on failed upload * * DELETE /v1/assets/{asset_id}/uploads/ */ export const deleteApiV1AssetsAssetIdUploads = async (args: DeleteApiV1AssetsAssetIdUploadsArgs, options: DeleteApiV1AssetsAssetIdUploadsOptions) => { const {baseUrl, fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args['App-ID'] != null) headers.set("App-ID", String(args['App-ID'])) if (args['Auth-Token'] != null) headers.set("Auth-Token", String(args['Auth-Token'])) if (args.low_priority_indexing != null) query.append("low_priority_indexing", String(args.low_priority_indexing)) const url = `${baseUrl.replace(/\/+$/, '')}/v1/assets/${encodeURIComponent(String(args.asset_id))}/uploads/${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 };