feat: add NewsApi, openArticleInChat, and newsApiProvider

This commit is contained in:
2026-04-06 08:16:00 -04:00
parent 77fc82af45
commit b56f3d3a0f
3 changed files with 71 additions and 0 deletions
+14
View File
@@ -127,4 +127,18 @@ class ChatApi {
throw dioToApp(e);
}
}
/// POST /api/chat/from-article/{itemId}
/// Creates or retrieves a chat conversation seeded with the article.
/// Returns the conversation_id.
Future<int> openArticleInChat(int itemId) async {
try {
final response =
await _dio.post('/api/chat/from-article/$itemId', data: <String, dynamic>{});
final data = response.data as Map<String, dynamic>;
return data['conversation_id'] as int;
} on DioException catch (e) {
throw dioToApp(e);
}
}
}