Skip to content

Commit

Permalink
Merge pull request #49 from soundstorm/master
Browse files Browse the repository at this point in the history
Complete refresh
  • Loading branch information
pipozzz authored Mar 3, 2022
2 parents 3a32e0b + f4accc4 commit 4f88851
Show file tree
Hide file tree
Showing 14 changed files with 385 additions and 33 deletions.
97 changes: 67 additions & 30 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -16,61 +16,99 @@ Python API wrapper for the [Rocket chat API](https://rocket.chat/docs/developer-
#### Usage

Initialize the client with a username and password or token and user_id.
This user *must* have Admin privs:
Currently no 2FA is supported.

from rocketchat.api import RocketChatAPI

api = RocketChatAPI(settings={'username': 'someuser', 'password': 'somepassword',
'domain': 'https://myrockethchatdomain.com'})
'domain': 'https://myrocketchatdomain.com'})
# or
api = RocketChatAPI(settings={'token': 'sometoken', 'user_id': 'someuserid',
'domain': 'https://myrockethchatdomain.com'})
'domain': 'https://myrocketchatdomain.com'})

##### Available Calls

###### Messages / Rooms general functions
api.send_message('message', 'room_id')

api.upload_file(room_id='room_id',
file='file',
description='File description',
message='Example message')

api.upload_remote_file(room_id='room_id',
url='url',
description='File description',
message='Example message')

###### Users
api.create_user('email',
'name',
'password',
'username',
active=True,
roles=['user'],
join_default_channels=True,
require_password_change=False,
send_welcome_email=False,
verified=False,
customFields=None)
api.delete_user('user_id')

api.get_user_id('user_name')

api.get_users()

api.get_user_info('user_id')

api.get_my_info()

###### Direct Messages
api.create_im_room('username')

api.close_room('room_id')

api.open_room('room_id')

api.get_im_room_history('room_id', oldest=date)

api.get_im_rooms()

###### Groups / Private Rooms
api.create_private_room('room_name',
members=[],
read_only=False)

api.invite_private_room('room_id', 'user_id')

api.get_private_rooms()

api.get_private_room_history('room_id', oldest=date)

api.get_public_rooms()

api.get_room_info('room_id')
api.get_room_id('room_name')

api.get_private_room_info('room_id')

api.get_room_history('room_id')
api.set_room_topic('topic', 'room_id')

###### Channels / Public Rooms
api.get_public_rooms()

api.create_public_room('room_name',
members=[],
read_only=False)

api.delete_public_room('room_id')
api.invite_public_room('room_id', 'user_id')

api.get_my_info()
api.get_room_info('room_id')

api.get_users()
api.get_public_room_id('room_name')

api.get_user_info('user_id')
api.get_room_history('room_id')

api.create_user('email',
'name',
'password',
'username',
active=True,
roles=['user'],
join_default_channels=True,
require_password_change=False,
send_welcome_email=False,
verified=False,
customFields=None)
api.delete_user('user_id')
api.delete_public_room('room_id')

api.upload_file(room_id='room_id',
file='file',
description='File description',
message='Example message')

check /rocketchat/calls/api.py for more.

Expand All @@ -80,7 +118,6 @@ check /rocketchat/calls/api.py for more.

##### Sending a message

You'll first need to get the _id of the room you want to send a message to. Currently, Rocket
can only send messages to *public* rooms.
You'll first need to get the `_id` of the room you want to send a message to.

api.send_message('Your message', room_id)
16 changes: 16 additions & 0 deletions docs/rocketchat.calls.channels.rst
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,14 @@ rocketchat.calls.channels.get\_history module
:undoc-members:
:show-inheritance:

rocketchat.calls.channels.invite\_public\_room module
---------------------------------------------

.. automodule:: rocketchat.calls.channels.invite_public_room
:members:
:undoc-members:
:show-inheritance:

rocketchat.calls.channels.get\_public\_rooms module
---------------------------------------------------

Expand All @@ -36,6 +44,14 @@ rocketchat.calls.channels.get\_public\_rooms module
:undoc-members:
:show-inheritance:

rocketchat.calls.channels.get\_public\_room\_id module
------------------------------------------------------

.. automodule:: rocketchat.calls.channels.get_public_room_id
:members:
:undoc-members:
:show-inheritance:

rocketchat.calls.channels.get\_room\_info module
------------------------------------------------

Expand Down
24 changes: 24 additions & 0 deletions docs/rocketchat.calls.groups.rst
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,14 @@ rocketchat.calls.groups package
Submodules
----------

rocketchat.calls.groups.create\_private\_room module
----------------------------------------------------------

.. automodule:: rocketchat.calls.groups.create_private_room
:members:
:undoc-members:
:show-inheritance:

rocketchat.calls.groups.get\_private\_room\_history module
----------------------------------------------------------

Expand All @@ -12,6 +20,14 @@ rocketchat.calls.groups.get\_private\_room\_history module
:undoc-members:
:show-inheritance:

rocketchat.calls.groups.invite\_private\_room module
----------------------------------------------------------

.. automodule:: rocketchat.calls.groups.invite_private_room
:members:
:undoc-members:
:show-inheritance:

rocketchat.calls.groups.get\_private\_room\_info module
-------------------------------------------------------

Expand Down Expand Up @@ -44,6 +60,14 @@ rocketchat.calls.groups.upload\_file module
:undoc-members:
:show-inheritance:

rocketchat.calls.groups.upload\_remote\_file module
---------------------------------------------------

.. automodule:: rocketchat.calls.groups.upload_remote_file
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------
Expand Down
54 changes: 54 additions & 0 deletions docs/rocketchat.calls.im.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
rocketchat.calls.im package
===========================

Submodules
----------

rocketchat.calls.im.close\_room module
--------------------------------------

.. automodule:: rocketchat.calls.im.close_room
:members:
:undoc-members:
:show-inheritance:

rocketchat.calls.im.create\_room module
---------------------------------------

.. automodule:: rocketchat.calls.im.create_room
:members:
:undoc-members:
:show-inheritance:

rocketchat.calls.im.get\_history module
---------------------------------------

.. automodule:: rocketchat.calls.im.get_history
:members:
:undoc-members:
:show-inheritance:

rocketchat.calls.im.get\_rooms module
-------------------------------------

.. automodule:: rocketchat.calls.im.get_rooms
:members:
:undoc-members:
:show-inheritance:

rocketchat.calls.im.open\_room module
-------------------------------------

.. automodule:: rocketchat.calls.im.open_room
:members:
:undoc-members:
:show-inheritance:


Module contents
---------------

.. automodule:: rocketchat.calls.im
:members:
:undoc-members:
:show-inheritance:
8 changes: 8 additions & 0 deletions docs/rocketchat.calls.users.rst
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,14 @@ rocketchat.calls.users.delete\_user module
:undoc-members:
:show-inheritance:

rocketchat.calls.users.get\_user\_id module
-------------------------------------------

.. automodule:: rocketchat.calls.users.get_user_id
:members:
:undoc-members:
:show-inheritance:

rocketchat.calls.users.get\_user\_info module
---------------------------------------------

Expand Down
Loading

0 comments on commit 4f88851

Please sign in to comment.