@@ -26,8 +26,13 @@ def page_by_slug(self, page_slug):
2626 def all_page_revisions (self , page_id ):
2727 return self ._request ("page/{}/revisions" , page_id )
2828
29- def page_revisions (self , page_id , * , limit = 20 , offset = 0 , direction = "asc" ):
30- data = {'limit' : limit , 'offset' : offset , 'direction' : direction }
29+ def page_revisions (self , page_id , * ,
30+ limit = 20 , offset = 0 , direction = 'asc' ):
31+ data = {
32+ 'limit' : limit ,
33+ 'offset' : offset ,
34+ 'direction' : direction ,
35+ }
3136 return self ._request ("page/{}/revisions" , page_id , data )
3237
3338 def page_votes (self , page_id ):
@@ -51,19 +56,36 @@ def all_forums(self):
5156 def forum (self , forum_id ):
5257 return self ._request ("forum/{}" , forum_id )
5358
54- def forum_threads (self , forum_id , since = None ):
59+ def forum_threads (self , forum_id , * ,
60+ since = None , limit = 20 , offset = 0 , direction = 'asc' ):
5561 if since is None :
5662 return self ._request ("forum/{}/threads" , forum_id )
57- elif isinstance (since , int ): # TODO other arguments and move since to data
58- return self ._request ("forum/{}/since/{}" , [forum_id , since ])
59- else :
60- raise TypeError ("`since` must be a UNIX timestamp" )
63+ if isinstance (since , int ):
64+ data = {
65+ 'timestamp' : since ,
66+ 'limit' : limit ,
67+ 'offset' : offset ,
68+ 'direction' : direction ,
69+ }
70+ return self ._request ("forum/{}/since" , forum_id , data )
71+ raise TypeError ("`since` must be a UNIX timestamp" )
6172
6273 def thread (self , thread_id ):
6374 return self ._request ("thread/{}" , thread_id )
6475
65- def thread_posts (self , thread_id ):
66- return self ._request ("thread/{}/posts" , thread_id ) # TODO POST, including since
76+ def thread_posts (self , thread_id , * ,
77+ since = None , limit = 20 , offset = 0 , direction = 'asc' ):
78+ if since is None :
79+ return self ._request ("thread/{}/posts" , thread_id )
80+ if isinstance (since , int ):
81+ data = {
82+ 'timestamp' : since ,
83+ 'limit' : limit ,
84+ 'offset' : offset ,
85+ 'direction' : direction ,
86+ }
87+ return self ._request ("thread/{}/since" , thread_id , data )
88+ raise TypeError ("`since` must be a UNIX timestamp" )
6789
6890 def post (self , post_id ):
6991 return self ._request ("post/{}" , post_id )
0 commit comments