Sha256: 4fb576ff3ccb5962226e054c3021ec201555ca5fc55df81ba75361c279d9acb2

Contents?: true

Size: 915 Bytes

Versions: 22

Compression:

Stored size: 915 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

      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

22 entries across 22 versions & 1 rubygems

Version Path
discourse_api-0.34.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.33.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.32.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.31.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.30.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.29.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.28.1 lib/discourse_api/api/private_messages.rb
discourse_api-0.28.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.27.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.26.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.25.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.24.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.23.1 lib/discourse_api/api/private_messages.rb
discourse_api-0.23.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.22.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.20.1 lib/discourse_api/api/private_messages.rb
discourse_api-0.20.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.19.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.18.0 lib/discourse_api/api/private_messages.rb
discourse_api-0.17.0 lib/discourse_api/api/private_messages.rb