export type DeleteApiMemoriesMemoryIdArgs = {memory_id: string, user_id?: (string | null) | undefined, db_id?: (string | null) | undefined, table?: (string | null) | undefined}; export type DeleteApiMemoriesMemoryIdOptions = {baseUrl: string, HTTPBearer?: string | undefined, fetch?: typeof fetch | undefined}; /** * Delete Memory * * DELETE /memories/{memory_id} */ export const deleteApiMemoriesMemoryId = async (args: DeleteApiMemoriesMemoryIdArgs, options: DeleteApiMemoriesMemoryIdOptions) => { const {baseUrl, fetch: fetchFn = fetch, HTTPBearer} = options ?? {} const query = new URLSearchParams() const headers = new Headers() if (args.user_id != null) query.append("user_id", String(args.user_id)) 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(/\/+$/, '')}/memories/${encodeURIComponent(String(args.memory_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 };