export type DeleteApiApiV3PreviewsPreviewIdArgs = {preview_id: string}; export type DeleteApiApiV3PreviewsPreviewIdOptions = {baseUrl?: string | undefined, apiKey?: string | undefined, fetch?: typeof fetch | undefined}; /** * Stop an app preview * * DELETE /api/v3/previews/{preview_id} */ export const deleteApiApiV3PreviewsPreviewId = async (args: DeleteApiApiV3PreviewsPreviewIdArgs, options?: DeleteApiApiV3PreviewsPreviewIdOptions) => { const {baseUrl = "https://codemagic.io", fetch: fetchFn = fetch, apiKey} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (apiKey !== undefined) headers.set("x-auth-token", apiKey) const url = `${baseUrl.replace(/\/+$/, '')}/api/v3/previews/${encodeURIComponent(String(args.preview_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 };