add new methods to the network client

pull/4/head
Blake DeMarcy 2017-04-13 16:46:33 -05:00
parent 2478b469a7
commit a0bce27105
1 changed files with 21 additions and 0 deletions

View File

@ -432,6 +432,27 @@ class BBJ(object):
return response["data"], response["usermap"]
def thread_create(self, title, body):
"""
Submit a new thread, and return its new object. Requires the
string arguments `title` and `body`. Title must be under
120 chars in length, else UserWarning is raised. Body must
also not be empty.
"""
response = self("thread_create", title=title, body=body)
return response["data"]
def thread_reply(self, thread_id, body):
"""
Submits a new reply to a thread and returns the new object.
Requires the thread's id and a non-empty body string.
"""
response = self("thread_reply", thread_id=thread_id, body=body)
return response["data"]
def fake_message(self, body="!!", format="sequential", author=None, post_id=0):
"""
Produce a a valid message object with `body`. Useful for