Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)``**
Expand Down
6 changes: 4 additions & 2 deletions mattermost/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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
Expand Down