Sha256: 2aecbd9a7e60a4bfd6a3acb6fdc7eb51ac4224d5e3a7fc1f91335ba483b229af

Contents?: true

Size: 729 Bytes

Versions: 1

Compression:

Stored size: 729 Bytes

Contents

module DiscourseApi
  module API
    module PrivateMessages

      # :target_usernames REQUIRED comma separated list of usernames
      # :category OPTIONAL name of category, not ID
      # :created_at OPTIONAL seconds since epoch.
      def create_private_message(args={})
        args[:archetype] = 'private_message'
        args = API.params(args)
                  .required(:title, :raw, :target_usernames, :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
    end
  end
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
discourse_api-0.15.0 lib/discourse_api/api/private_messages.rb