Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
## Added

- **All bindings:** `ContentContext` adds two new methods (Rust, Go, C, C++, Java, Python, Node.js):
- `topics_mine(opts)` — get topics created by the current authenticated user, with optional page/size/topic_type filtering.
- `create_topic(opts)` — create a new topic; returns the full `OwnedTopic` on success.
- **All bindings:** New types `OwnedTopic`, `ListMyTopicsOptions`, and `CreateTopicOptions` to support the above methods.
- `my_topics(opts)` — get topics created by the current authenticated user, with optional page/size/topic_type filtering.
- `create_topic(opts)` — create a new topic; returns the topic ID (`String`) on success.
- **All bindings:** New types `OwnedTopic`, `MyTopicsOptions`, and `CreateTopicOptions` to support the above methods.
- **Python:** Added type stubs (`openapi.pyi`) for `ContentContext`, `AsyncContentContext`, `OwnedTopic`, `TopicReply`, `TopicAuthor`, and `TopicImage`.

## Fixed

- **C++:** `create_topic` callback now correctly yields `std::string` (topic ID) instead of `OwnedTopic`.

# [4.0.5]

Expand Down
2 changes: 1 addition & 1 deletion cpp/include/content_context.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ContentContext

/// Create a new topic
void create_topic(const CreateTopicOptions& opts,
AsyncCallback<ContentContext, OwnedTopic> callback) const;
AsyncCallback<ContentContext, std::string> callback) const;

/// Get discussion topics list for a symbol
void topics(const std::string& symbol,
Expand Down
13 changes: 6 additions & 7 deletions cpp/src/content_context.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ ContentContext::my_topics(
void
ContentContext::create_topic(
const CreateTopicOptions& opts,
AsyncCallback<ContentContext, OwnedTopic> callback) const
AsyncCallback<ContentContext, std::string> callback) const
{
const char* topic_type =
opts.topic_type.empty() ? nullptr : opts.topic_type.c_str();
Expand All @@ -128,25 +128,24 @@ ContentContext::create_topic(
hashtags_cstr.size(),
[](auto res) {
auto callback_ptr =
callback::get_async_callback<ContentContext, OwnedTopic>(
callback::get_async_callback<ContentContext, std::string>(
res->userdata);
ContentContext ctx((const lb_content_context_t*)res->ctx);
Status status(res->error);

if (status) {
auto resp = (const lb_owned_topic_t*)res->data;
OwnedTopic result = convert(resp);
std::string result((const char*)res->data);

(*callback_ptr)(
AsyncResult<ContentContext, OwnedTopic>(
AsyncResult<ContentContext, std::string>(
ctx, std::move(status), &result));
} else {
(*callback_ptr)(
AsyncResult<ContentContext, OwnedTopic>(
AsyncResult<ContentContext, std::string>(
ctx, std::move(status), nullptr));
}
},
new AsyncCallback<ContentContext, OwnedTopic>(callback));
new AsyncCallback<ContentContext, std::string>(callback));
}

void
Expand Down
Loading
Loading