lib/discourse_api/api/topics.rb in discourse_api-0.45.1 vs lib/discourse_api/api/topics.rb in discourse_api-0.46.0

- old
+ new

@@ -72,17 +72,26 @@ def delete_topic(id) delete("/t/#{id}.json") end - def topic_posts(topic_id, post_ids = []) + def topic_posts(topic_id, post_ids = [], params = {}) + params = API.params(params) + .optional(:asc, + :filter, + :include_raw, + :include_suggested, + :post_number, + :username_filters, + ) + url = ["/t/#{topic_id}/posts.json"] if post_ids.count > 0 url.push('?') url.push(post_ids.map { |id| "post_ids[]=#{id}" }.join('&')) end - response = get(url.join) + response = get(url.join, params) response[:body] end def change_owner(topic_id, params = {}) params = API.params(params) @@ -93,9 +102,17 @@ def topic_set_user_notification_level(topic_id, params) params = API.params(params) .required(:notification_level) post("/t/#{topic_id}/notifications", params) + end + + def bookmark_topic(topic_id) + put("/t/#{topic_id}/bookmark.json") + end + + def remove_topic_bookmark(topic_id) + put("/t/#{topic_id}/remove_bookmarks.json") end end end end