Sha256: 68cb60c7cc7ea6c7dc6d3d3010fe6e4bf93b4d0c53f60cb98777e0926c3349fc

Contents?: true

Size: 686 Bytes

Versions: 4

Compression:

Stored size: 686 Bytes

Contents

# frozen_string_literal: true
$LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
require File.expand_path('../../lib/discourse_api', __FILE__)

client = DiscourseApi::Client.new("http://localhost:3000")
client.api_key = "YOUR_API_KEY"
client.api_username = "YOUR_USERNAME"

# Post Action Type IDs
# 1 - Bookmark
# 2 - Like
# 3 - Flag: Off-topic
# 4 - Flag: Inappropriate
# 5 - Vote
# 6 - Notify User
# 7 - Flag - Notify Moderators
# 8 - Flag - Spam

# Like a post
client.create_post_action(id: 2, post_action_type_id: 2)

# Flag a topic as spam
client.create_topic_action(id: 1, post_action_type_id: 8)

# Unlike a post
client.destroy_post_action(id: 3, post_action_type_id: 2)

Version data entries

4 entries across 4 versions & 1 rubygems

Version Path
discourse_api-0.38.0 examples/post_action.rb
discourse_api-0.37.0 examples/post_action.rb
discourse_api-0.36.0 examples/post_action.rb
discourse_api-0.35.0 examples/post_action.rb