jadolg/rocketchat_API

rooms.upload API supports message and description, it seems this doesn't

kirkjantzer opened this issue · 2 comments

Hi,
It looks like the Rocketchat API rooms.upload method supports passing a message and description when uploading a file: https://developer.rocket.chat/api/rest-api/methods/rooms/upload
However when I use this pypi package, it seems to only support uploading an image without a message or description:
rooms.py:

...
class RocketChatRooms(RocketChatBase):
    def rooms_upload(self, rid, file, **kwargs):
        """Post a message with attached file to a dedicated room."""
        files = {
            "file": (
                os.path.basename(file),
                open(file, "rb"),
                mimetypes.guess_type(file)[0],
            ),
        }
        return self.call_api_post(
            "rooms.upload/" + rid, kwargs=kwargs, use_json=False, files=files
        )
...

Would it be possible to add the ability to add a message and/or description when uploading an image, please? Thank you in advance.

Hi @kirkjantzer 👋
the wrapper is designed this way. Only the required parameters are explicit, but you can add the needed parameter directly. that's why **kwargs is there.
You can call the method with msg="a text message" and it should land in the right place.

Stale issue