Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Create TopicPostPM not supported. #67

Open
juanjosepablos opened this issue Sep 20, 2022 · 3 comments
Open

Create TopicPostPM not supported. #67

juanjosepablos opened this issue Sep 20, 2022 · 3 comments

Comments

@juanjosepablos
Copy link

Would it be possible to use pydiscource to create a new Topic?
https://docs.discourse.org/#tag/Topics/operation/createTopicPostPM

@bennylope
Copy link
Collaborator

As is, no, but it would make sense to add this facility!

@juanjosepablos
Copy link
Author

juanjosepablos commented Sep 20, 2022

Something like this?

--- /home/cheche/git/pydiscourse/src/pydiscourse/client.py.geanyvc.~BASE~
+++ /home/cheche/git/pydiscourse/src/pydiscourse/client.py
@@ -724,7 +724,17 @@
             topic_id=topic_id,
             **kwargs
         )
-
+    def create_topic(
+    self, title, raw , topic_id=None, category_id=None, **kwargs
+    ):
+     return self._post(
+     "/posts",
+     title=title,
+     raw=raw,
+     topic_id=topic_id,
+     category=category_id,
+     **kwargs
+     )
     def update_topic_status(self, topic_id, status, enabled, **kwargs):
         """
         Open or close a topic

@bennylope
Copy link
Collaborator

More or less!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants