@@ -16,61 +16,99 @@ Python API wrapper for the [Rocket chat API](https://rocket.chat/docs/developer-
1616#### Usage
1717
1818Initialize the client with a username and password or token and user_id.
19- This user * must * have Admin privs:
19+ Currently no 2FA is supported.
2020
2121 from rocketchat.api import RocketChatAPI
2222
2323 api = RocketChatAPI(settings={'username': 'someuser', 'password': 'somepassword',
24- 'domain': 'https://myrockethchatdomain .com'})
24+ 'domain': 'https://myrocketchatdomain .com'})
2525 # or
2626 api = RocketChatAPI(settings={'token': 'sometoken', 'user_id': 'someuserid',
27- 'domain': 'https://myrockethchatdomain .com'})
27+ 'domain': 'https://myrocketchatdomain .com'})
2828
2929##### Available Calls
30+
31+ ###### Messages / Rooms general functions
3032 api.send_message('message', 'room_id')
3133
34+ api.upload_file(room_id='room_id',
35+ file='file',
36+ description='File description',
37+ message='Example message')
38+
39+ api.upload_remote_file(room_id='room_id',
40+ url='url',
41+ description='File description',
42+ message='Example message')
43+
44+ ###### Users
45+ api.create_user('email',
46+ 'name',
47+ 'password',
48+ 'username',
49+ active=True,
50+ roles=['user'],
51+ join_default_channels=True,
52+ require_password_change=False,
53+ send_welcome_email=False,
54+ verified=False,
55+ customFields=None)
56+
57+ api.delete_user('user_id')
58+
59+ api.get_user_id('user_name')
60+
61+ api.get_users()
62+
63+ api.get_user_info('user_id')
64+
65+ api.get_my_info()
66+
67+ ###### Direct Messages
68+ api.create_im_room('username')
69+
70+ api.close_room('room_id')
71+
72+ api.open_room('room_id')
73+
74+ api.get_im_room_history('room_id', oldest=date)
75+
76+ api.get_im_rooms()
77+
78+ ###### Groups / Private Rooms
79+ api.create_private_room('room_name',
80+ members=[],
81+ read_only=False)
82+
83+ api.invite_private_room('room_id', 'user_id')
84+
3285 api.get_private_rooms()
3386
3487 api.get_private_room_history('room_id', oldest=date)
3588
36- api.get_public_rooms()
37-
38- api.get_room_info('room_id')
89+ api.get_room_id('room_name')
3990
4091 api.get_private_room_info('room_id')
4192
42- api.get_room_history('room_id')
93+ api.set_room_topic('topic', 'room_id')
94+
95+ ###### Channels / Public Rooms
96+ api.get_public_rooms()
4397
4498 api.create_public_room('room_name',
4599 members=[],
46100 read_only=False)
47101
48- api.delete_public_room ('room_id')
102+ api.invite_public_room ('room_id', 'user_id ')
49103
50- api.get_my_info( )
104+ api.get_room_info('room_id' )
51105
52- api.get_users( )
106+ api.get_public_room_id('room_name' )
53107
54- api.get_user_info('user_id ')
108+ api.get_room_history('room_id ')
55109
56- api.create_user('email',
57- 'name',
58- 'password',
59- 'username',
60- active=True,
61- roles=['user'],
62- join_default_channels=True,
63- require_password_change=False,
64- send_welcome_email=False,
65- verified=False,
66- customFields=None)
67-
68- api.delete_user('user_id')
110+ api.delete_public_room('room_id')
69111
70- api.upload_file(room_id='room_id',
71- file='file',
72- description='File description',
73- message='Example message')
74112
75113check /rocketchat/calls/api.py for more.
76114
@@ -80,7 +118,6 @@ check /rocketchat/calls/api.py for more.
80118
81119##### Sending a message
82120
83- You'll first need to get the _ id of the room you want to send a message to. Currently, Rocket
84- can only send messages to * public* rooms.
121+ You'll first need to get the ` _id ` of the room you want to send a message to.
85122
86123 api.send_message('Your message', room_id)
0 commit comments