discgolf is an R client for the Discourse API

Discourse API docs: https://docs.discourse.org/

discgolf package docs: https://sckott.github.io/discgolf/

Installation

CRAN version

install.packages("discgolf")

Development version

install.packages("remotes")
remotes::install_github("sckott/discgolf")

Authentication

The Discourse API is based on using a specific installation of Discourse, which requires the URL of the target Discourse forum, your username and an API key for that installation. Get those, set as option variables in .Rprofile (use discourse_url, discourse_username and discourse_api_key) or environment variables in .Renviron (use DISCOURSE_URL, DISCOURSE_USERNAME and DISCOURSE_API_KEY) or similar file (.bashrc, .zshrc, etc.).

Get latest topics

topics_latest()$topic_list$topics[,c(1:5)]

Get new topics

Get topics by a specific user

topics_by("cboettig")

Get a single topic by id number

topic(8)$post_stream$posts[,c(1:5)]

Get a post

Create post, create topic first

topic_create("The problem with blue skies", text = "just saying and all that")
post_create(topic_id = 13, text = "There isn't a problem!")

Wikify a post

post_wikify(x$post_stream$posts$id[4])

List a user

user('sckott')
user('cboettig')

List users

users_list('staff')
users_list('new')

Create a user

(x <- user_create("jane doe", "jane@doe.com", "jane_doe", "afafasfdasdf"))

Activate a user

user_activate(x$user_id)

Update email address

user_update_email('jane_doe', 'jane2@doe.com')

Update user name

user_update_username('jane_doe', 'jane_doe2')

Delete a user

user_delete(x$user_id)

Meta

  • Please note that this project is released with a Contributor Code of Conduct. By participating in this project you agree to abide by its terms.