discgolf

Build Status codecov.io rstudio mirror downloads cran version

discgolf is an R client for the Discourse API, based off the Ruby gem discourse_api

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

Installation

CRAN version

install.packages("discgolf")

Development version

install.packages("devtools")
devtools::install_github("sckott/discgolf")
library("discgolf")

Authentication

The Discourse API is based on using a specific installation of Discourse, which requires your username and an API key for that installation. Get those, and you can pass them in to each function call, or set as option variables in .Rprofile (use discourse_api_key and discourse_username) or environment variables in .Renviron (use DISCOURSE_API_KEY and DISCOURSE_USERNAME).

Get latest topics

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

Get new topics

topics_new()

Get topics by a specific user

topics_by("cboettig")

Get a single topic by id number

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

Get a post

post_get(90)

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])
dg_search(query = "poo")
dg_search(posts_count = 1)
dg_search(in_ = "posted")
dg_search(status = "open")

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)

upate email address

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

upate user name

user_update_username('jane_doe', 'jane_doe2')

delete a user

user_delete(x$user_id)

Meta