From a973679d693969e2228888836675103e0a0f4b22 Mon Sep 17 00:00:00 2001 From: Thomas Rossetto Date: Thu, 20 Nov 2025 17:57:52 +0100 Subject: [PATCH 1/3] Add support for external_id in topic creation --- lib/discourse_api/api/topics.rb | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/discourse_api/api/topics.rb b/lib/discourse_api/api/topics.rb index 2e97621..a92c398 100644 --- a/lib/discourse_api/api/topics.rb +++ b/lib/discourse_api/api/topics.rb @@ -11,7 +11,7 @@ def create_topic(args = {}) API .params(args) .required(:title, :raw) - .optional(:skip_validations, :category, :auto_track, :created_at, :api_username, :tags) + .optional(:skip_validations, :category, :auto_track, :created_at, :api_username, :tags, :external_id) post("/posts", args.to_h) end From 341dbd18562303211c4488fe974a0ee81dfe416e Mon Sep 17 00:00:00 2001 From: Thomas Rossetto Date: Tue, 2 Dec 2025 17:32:17 +0100 Subject: [PATCH 2/3] fix linting --- lib/discourse_api/api/topics.rb | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/lib/discourse_api/api/topics.rb b/lib/discourse_api/api/topics.rb index a92c398..944deb3 100644 --- a/lib/discourse_api/api/topics.rb +++ b/lib/discourse_api/api/topics.rb @@ -11,7 +11,15 @@ def create_topic(args = {}) API .params(args) .required(:title, :raw) - .optional(:skip_validations, :category, :auto_track, :created_at, :api_username, :tags, :external_id) + .optional( + :skip_validations, + :category, + :auto_track, + :created_at, + :api_username, + :tags, + :external_id, + ) post("/posts", args.to_h) end From 00e541c61d60ac31634fa302bbb1a76654a62419 Mon Sep 17 00:00:00 2001 From: Thomas Rossetto Date: Tue, 2 Dec 2025 17:32:26 +0100 Subject: [PATCH 3/3] add get_topic_url_by_external_id --- lib/discourse_api/api/topics.rb | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/lib/discourse_api/api/topics.rb b/lib/discourse_api/api/topics.rb index 944deb3..7157978 100644 --- a/lib/discourse_api/api/topics.rb +++ b/lib/discourse_api/api/topics.rb @@ -119,6 +119,10 @@ def bookmark_topic(topic_id) def remove_topic_bookmark(topic_id) put("/t/#{topic_id}/remove_bookmarks.json") end + + def get_topic_url_by_external_id(external_id) + get("/t/external_id/#{external_id}") + end end end end