export type DeleteApiApiV1CvmsCvmIdDraftArgs = {cvm_id: string}; export type DeleteApiApiV1CvmsCvmIdDraftOptions = {baseUrl?: string | undefined, fetch?: typeof fetch | undefined}; /** * Discard staged CVM changes * * DELETE /api/v1/cvms/{cvm_id}/draft */ export const deleteApiApiV1CvmsCvmIdDraft = async (args: DeleteApiApiV1CvmsCvmIdDraftArgs, options?: DeleteApiApiV1CvmsCvmIdDraftOptions) => { const {baseUrl = "https://cloud-api.phala.com", fetch: fetchFn = fetch} = options ?? {} const query = new URLSearchParams() const headers = new Headers() const url = `${baseUrl.replace(/\/+$/, '')}/api/v1/cvms/${encodeURIComponent(String(args.cvm_id))}/draft${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 };