diff --git a/README.md b/README.md index 28028d0..263f439 100644 --- a/README.md +++ b/README.md @@ -220,7 +220,7 @@ Ordered by https://api.mattermost.com/ + **``get_post (post_id, **kwargs)``** + **``delete_post (post_id, **kwargs)``** + **``patch_post (post_id, message=None, is_pinned=None, props=None, **kwargs)``** - + **``get_posts_for_channel (channel_id, **kwargs)``** + + **``get_posts_for_channel (channel_id, after=None, before=None, **kwargs)``** + **FILES** + **``upload_file (channel_id, filepath, **kwargs)``** + **``get_file (file_id, **kwargs)``** diff --git a/mattermost/__init__.py b/mattermost/__init__.py index 3bebf8e..1ce30f2 100644 --- a/mattermost/__init__.py +++ b/mattermost/__init__.py @@ -1219,12 +1219,14 @@ def patch_post(self, post_id, message=None, is_pinned=None, file_ids=None, has_r - def get_posts_for_channel(self, channel_id, **kwargs): + def get_posts_for_channel(self, channel_id, after=None, before=None, **kwargs): """ Generator: Get a page of posts in a channel. Use the query parameters to modify the behaviour of this endpoint. Args: channel_id (string): The channel ID to iterate over. + after (string, optional): A post id to select the posts that came after this one + before (string, optional): A post id to select the posts that came before this one Returns: generates: Post. @@ -1234,7 +1236,7 @@ def get_posts_for_channel(self, channel_id, **kwargs): """ page = 0 while True: - data_page = self._get("/v4/channels/"+channel_id+"/posts", params={"page":str(page)}, **kwargs) + data_page = self._get("/v4/channels/"+channel_id+"/posts", params={"page":str(page), "after":after, "before":before}, **kwargs) if data_page["order"] == []: break