export type DeleteApiLearningsLearningIdArgs = {learning_id: string, db_id?: (string | null) | undefined, table?: (string | null) | undefined}; export type DeleteApiLearningsLearningIdOptions = {baseUrl: string, HTTPBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Learning * * DELETE /learnings/{learning_id} */ export const deleteApiLearningsLearningId = async (args: DeleteApiLearningsLearningIdArgs, options: DeleteApiLearningsLearningIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, HTTPBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.db_id != null) query.append("db_id", String(args.db_id)) if (args.table != null) query.append("table", String(args.table)) if (HTTPBearer !== undefined) headers.set('authorization', `Bearer ${HTTPBearer}`) const url = `${baseUrl.replace(/\/+$/, '')}/learnings/${encodeURIComponent(String(args.learning_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 };