Sha256: fe429e3188b34b152b8ff4b0278c427b4ddc9690662c2da65fce3bf850d7f690
Contents?: true
Size: 1.16 KB
Versions: 2
Compression:
Stored size: 1.16 KB
Contents
# frozen_string_literal: true module DiscourseApi module API module PrivateMessages # TODO: Deprecated. Remove after 20220628 def create_private_message(args = {}) deprecated(__method__, "create_pm") args[:target_recipients] = args.delete :target_usernames create_pm(args.to_h) end # :target_recipients REQUIRED comma separated list of usernames # :category OPTIONAL name of category, not ID # :created_at OPTIONAL seconds since epoch. def create_pm(args = {}) args[:archetype] = "private_message" args = API .params(args) .required(:title, :raw, :target_recipients, :archetype) .optional(:category, :created_at, :api_username) post("/posts", args.to_h) end def private_messages(username, *args) response = get("topics/private-messages/#{username}.json", args) response[:body]["topic_list"]["topics"] end def sent_private_messages(username, *args) response = get("topics/private-messages-sent/#{username}.json", args) response[:body]["topic_list"]["topics"] end end end end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
discourse_api-2.0.1 | lib/discourse_api/api/private_messages.rb |
discourse_api-2.0.0 | lib/discourse_api/api/private_messages.rb |