From e71961e62460f0f1bafa15dbf79896c4078a7c80 Mon Sep 17 00:00:00 2001 From: Bekhtin Sergey Date: Fri, 21 Jul 2023 23:53:57 +0300 Subject: [PATCH] added metadata argument to create_post method. Added metadata argument to be able to set priority and requested_ack for ew post. https://api.mattermost.com/#tag/posts/operation/CreatePost --- mattermost/__init__.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/mattermost/__init__.py b/mattermost/__init__.py index 8f8bf5d..209c8ee 100644 --- a/mattermost/__init__.py +++ b/mattermost/__init__.py @@ -1072,7 +1072,7 @@ def get_channels_for_user(self, user_id, team_id, **kwargs): #+ **POSTS** - def create_post(self, channel_id, message, props=None, filepaths=None, root_id=None, **kwargs): + def create_post(self, channel_id, message, props=None, filepaths=None, root_id=None, metadata=None, **kwargs): """ Create a new post in a channel. To create the post as a comment on another post, provide root_id. @@ -1082,6 +1082,7 @@ def create_post(self, channel_id, message, props=None, filepaths=None, root_id=N props (string, optional): see MM-API docs. filepaths (list, optional): Paths to upload files from and attach to post. root_id (string, optional): see MM-API docs. + metadata (dict, optional): Priority metadata. see MM-API docs. Returns: dict: created Post. @@ -1098,12 +1099,12 @@ def create_post(self, channel_id, message, props=None, filepaths=None, root_id=N "channel_id": channel_id, "message": message, **({"props": props} if props else {"props": {"from_webhook":"true"}}), + **({"metadata": metadata} if metadata else {"metadata": {}}), "root_id":root_id, "file_ids": file_ids, }, **kwargs) - def create_ephemeral_post(self, channel_id, message, user_id, **kwargs): """ Create a new ephemeral post in a channel.