export type DeleteApiExperimentalFlowDraftsDraftIdArgs = {draft_id: string}; export type DeleteApiExperimentalFlowDraftsDraftIdOptions = {baseUrl?: string | undefined, OAuth10?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete a Flow draft * * DELETE /experimental/flow/drafts/{draft_id} * * Also accepts auth: OAuth2.0, SessionCookie + XToken */ export const deleteApiExperimentalFlowDraftsDraftId = async (args: DeleteApiExperimentalFlowDraftsDraftIdArgs, options?: DeleteApiExperimentalFlowDraftsDraftIdOptions) => { const {baseUrl = "https://scrive.com", fetch: fetchFn = fetch, OAuth10} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (OAuth10 !== undefined) headers.set('authorization', `oauth1 ${OAuth10}`) const url = `${baseUrl.replace(/\/+$/, '')}/experimental/flow/drafts/${encodeURIComponent(String(args.draft_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 };