rocketchat-API 3.6.0__tar.gz → 3.7.0__tar.gz

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (87) hide show
  1. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.github/workflows/lint.yml +1 -1
  2. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.github/workflows/release.yml +1 -1
  3. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.github/workflows/test.yml +2 -2
  4. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.github/workflows/test_latest.yml +1 -1
  5. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.github/workflows/test_manually.yml +1 -1
  6. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/PKG-INFO +1 -1
  7. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APIExceptions/RocketExceptions.py +3 -0
  8. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/dm.py +3 -3
  9. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/teams.py +1 -3
  10. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/users.py +31 -6
  11. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API.egg-info/PKG-INFO +1 -1
  12. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_dms.py +1 -1
  13. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_user.py +43 -0
  14. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.coveragerc +0 -0
  15. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.deepsource.toml +0 -0
  16. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.editorconfig +0 -0
  17. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  18. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  19. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.github/actions/test_rocketchat/action.yml +0 -0
  20. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.github/dependabot.yml +0 -0
  21. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/.gitignore +0 -0
  22. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/CONTRIBUTING.md +0 -0
  23. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/LICENSE.txt +0 -0
  24. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/README.md +0 -0
  25. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/bandit.yml +0 -0
  26. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/docker-compose.yml +0 -0
  27. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/pyproject.toml +0 -0
  28. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/qodana.yaml +0 -0
  29. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APIExceptions/__init__.py +0 -0
  30. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/__init__.py +0 -0
  31. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/assets.py +0 -0
  32. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/banners.py +0 -0
  33. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/base.py +0 -0
  34. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/channels.py +0 -0
  35. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/chat.py +0 -0
  36. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/custom_emoji.py +0 -0
  37. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/custom_sounds.py +0 -0
  38. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/custom_user_status.py +0 -0
  39. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/groups.py +0 -0
  40. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/integrations.py +0 -0
  41. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/invites.py +0 -0
  42. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/licenses.py +0 -0
  43. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/livechat.py +0 -0
  44. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/miscellaneous.py +0 -0
  45. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/moderation.py +0 -0
  46. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/permissions.py +0 -0
  47. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/roles.py +0 -0
  48. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/rooms.py +0 -0
  49. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/settings.py +0 -0
  50. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/statistics.py +0 -0
  51. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/subscriptions.py +0 -0
  52. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/APISections/users_engagement.py +0 -0
  53. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/__init__.py +0 -0
  54. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API/rocketchat.py +0 -0
  55. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API.egg-info/SOURCES.txt +0 -0
  56. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API.egg-info/dependency_links.txt +0 -0
  57. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API.egg-info/requires.txt +0 -0
  58. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/rocketchat_API.egg-info/top_level.txt +0 -0
  59. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/setup.cfg +0 -0
  60. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/__init__.py +0 -0
  61. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/assets/avatar.png +0 -0
  62. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/assets/avatar.svg +0 -0
  63. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/assets/logo.png +0 -0
  64. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/conftest.py +0 -0
  65. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_assets.py +0 -0
  66. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_banners.py +0 -0
  67. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_channels.py +0 -0
  68. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_chat.py +0 -0
  69. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_custom_emoji.py +0 -0
  70. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_custom_sounds.py +0 -0
  71. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_custom_user_status.py +0 -0
  72. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_exceptions.py +0 -0
  73. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_groups.py +0 -0
  74. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_integrations.py +0 -0
  75. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_invites.py +0 -0
  76. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_licenses.py +0 -0
  77. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_livechat.py +0 -0
  78. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_moderation.py +0 -0
  79. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_paginated.py +0 -0
  80. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_permissions.py +0 -0
  81. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_roles.py +0 -0
  82. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_rooms.py +0 -0
  83. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_server.py +0 -0
  84. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_settings.py +0 -0
  85. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_subscriptions.py +0 -0
  86. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_teams.py +0 -0
  87. {rocketchat_api-3.6.0 → rocketchat_api-3.7.0}/tests/test_users_engagement.py +0 -0
@@ -12,7 +12,7 @@ jobs:
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
14
  - name: Checkout
15
- uses: actions/checkout@v6.0.2
15
+ uses: actions/checkout@v6.0.3
16
16
  with:
17
17
  fetch-depth: 0
18
18
  - name: Set up Python
@@ -14,7 +14,7 @@ jobs:
14
14
  id-token: write
15
15
  steps:
16
16
  - name: Checkout
17
- uses: actions/checkout@v6.0.2
17
+ uses: actions/checkout@v6.0.3
18
18
  - name: Set up Python 3.14
19
19
  uses: actions/setup-python@v6
20
20
  with:
@@ -15,10 +15,10 @@ jobs:
15
15
  fail-fast: false
16
16
  matrix:
17
17
  python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
18
- rocket-chat-version: [ '7.11.6', '7.12.6', '7.13.5' , '8.0.3', '8.1.2', '8.2.1', '8.3.1']
18
+ rocket-chat-version: [ '8.0.5', '8.1.5', '8.2.5', '8.3.5', '8.4.3', '8.5.0']
19
19
  steps:
20
20
  - name: Checkout
21
- uses: actions/checkout@v6.0.2
21
+ uses: actions/checkout@v6.0.3
22
22
  - name: Test
23
23
  uses: ./.github/actions/test_rocketchat
24
24
  with:
@@ -12,7 +12,7 @@ jobs:
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
14
  - name: Checkout
15
- uses: actions/checkout@v6.0.2
15
+ uses: actions/checkout@v6.0.3
16
16
  - name: Test
17
17
  uses: ./.github/actions/test_rocketchat
18
18
  with:
@@ -19,7 +19,7 @@ jobs:
19
19
  runs-on: ubuntu-latest
20
20
  steps:
21
21
  - name: Checkout
22
- uses: actions/checkout@v6.0.2
22
+ uses: actions/checkout@v6.0.3
23
23
  - name: Test
24
24
  uses: ./.github/actions/test_rocketchat
25
25
  with:
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rocketchat_API
3
- Version: 3.6.0
3
+ Version: 3.7.0
4
4
  Summary: Python API wrapper for Rocket.Chat
5
5
  Author-email: "Jorge Alberto Díaz Orozco (Akiel)" <diazorozcoj@gmail.com>
6
6
  Maintainer-email: "Jorge Alberto Díaz Orozco (Akiel)" <diazorozcoj@gmail.com>
@@ -5,6 +5,9 @@ ROOM_ID_OR_NAME_REQUIRED = "room_id or room_name required"
5
5
  ROOM_ID_OR_GROUP_REQUIRED = "room_id or group required"
6
6
  ROOM_ID_OR_CHANNEL_REQUIRED = "room_id or channel required"
7
7
  USER_ID_OR_USERNAME_REQUIRED = "user_id or username required"
8
+ USER_INFO_LOOKUP_REQUIRED = (
9
+ "user_id, username, import_id, email or free_switch_extension required"
10
+ )
8
11
  ROOM_ID_OR_USERNAME_REQUIRED = "room_id or username required"
9
12
  MESSAGE_RID_REQUIRED = "message.rid required"
10
13
  TEAM_ID_OR_TEAM_NAME_REQUIRED = "team_id or team_name required"
@@ -78,10 +78,10 @@ class RocketChatDM(RocketChatBase):
78
78
  return self.call_api_get("dm.files", username=user_name, kwargs=kwargs)
79
79
  raise RocketMissingParamException(ROOM_ID_OR_USERNAME_REQUIRED)
80
80
 
81
- def dm_counters(self, room_id, user_name=None):
81
+ def dm_counters(self, room_id, user_id=None):
82
82
  """Gets counters of direct messages."""
83
- if user_name:
84
- return self.call_api_get("dm.counters", roomId=room_id, username=user_name)
83
+ if user_id:
84
+ return self.call_api_get("dm.counters", roomId=room_id, userId=user_id)
85
85
  return self.call_api_get("dm.counters", roomId=room_id)
86
86
 
87
87
  def dm_delete(self, room_id, **kwargs):
@@ -173,7 +173,7 @@ class RocketChatTeams(RocketChatBase):
173
173
 
174
174
  @paginated("rooms")
175
175
  def teams_list_rooms_of_user(
176
- self, team_id=None, team_name=None, user_id=None, can_add=False, **kwargs
176
+ self, team_id=None, team_name=None, user_id=None, **kwargs
177
177
  ):
178
178
  """
179
179
  Lists only the team's rooms that a particular user has joined.
@@ -184,7 +184,6 @@ class RocketChatTeams(RocketChatBase):
184
184
  "teams.listRoomsOfUser",
185
185
  teamId=team_id,
186
186
  userId=user_id,
187
- canAdd=can_add,
188
187
  kwargs=kwargs,
189
188
  )
190
189
  if team_name:
@@ -192,7 +191,6 @@ class RocketChatTeams(RocketChatBase):
192
191
  "teams.listRoomsOfUser",
193
192
  teamName=team_name,
194
193
  userId=user_id,
195
- canAdd=can_add,
196
194
  kwargs=kwargs,
197
195
  )
198
196
  raise RocketMissingParamException(TEAM_ID_OR_TEAM_NAME_REQUIRED)
@@ -3,6 +3,7 @@ import os
3
3
 
4
4
  from rocketchat_API.APIExceptions.RocketExceptions import (
5
5
  USER_ID_OR_USERNAME_REQUIRED,
6
+ USER_INFO_LOOKUP_REQUIRED,
6
7
  RocketMissingParamException,
7
8
  )
8
9
  from rocketchat_API.APISections.base import (
@@ -10,19 +11,43 @@ from rocketchat_API.APISections.base import (
10
11
  paginated,
11
12
  )
12
13
 
14
+ USERS_INFO = "users.info"
15
+
13
16
 
14
17
  class RocketChatUsers(RocketChatBase):
15
18
  def me(self, **kwargs):
16
19
  """Displays information about the authenticated user."""
17
20
  return self.call_api_get("me", kwargs=kwargs)
18
21
 
19
- def users_info(self, user_id=None, username=None, **kwargs):
20
- """Gets a user's information, limited to the caller's permissions."""
22
+ def users_info(
23
+ self,
24
+ user_id=None,
25
+ username=None,
26
+ import_id=None,
27
+ email=None,
28
+ free_switch_extension=None,
29
+ **kwargs,
30
+ ):
31
+ """Gets a user's information, limited to the caller's permissions.
32
+
33
+ Exactly one lookup parameter must be provided. ``email`` requires
34
+ Rocket.Chat >= 8.4.0 and ``free_switch_extension`` requires >= 8.5.0.
35
+ """
21
36
  if user_id:
22
- return self.call_api_get("users.info", userId=user_id, kwargs=kwargs)
37
+ return self.call_api_get(USERS_INFO, userId=user_id, kwargs=kwargs)
23
38
  if username:
24
- return self.call_api_get("users.info", username=username, kwargs=kwargs)
25
- raise RocketMissingParamException(USER_ID_OR_USERNAME_REQUIRED)
39
+ return self.call_api_get(USERS_INFO, username=username, kwargs=kwargs)
40
+ if import_id:
41
+ return self.call_api_get(USERS_INFO, importId=import_id, kwargs=kwargs)
42
+ if email:
43
+ return self.call_api_get(USERS_INFO, email=email, kwargs=kwargs)
44
+ if free_switch_extension:
45
+ return self.call_api_get(
46
+ USERS_INFO,
47
+ freeSwitchExtension=free_switch_extension,
48
+ kwargs=kwargs,
49
+ )
50
+ raise RocketMissingParamException(USER_INFO_LOOKUP_REQUIRED)
26
51
 
27
52
  @paginated("users")
28
53
  def users_list(self, **kwargs):
@@ -129,7 +154,7 @@ class RocketChatUsers(RocketChatBase):
129
154
 
130
155
  def users_forgot_password(self, email, **kwargs):
131
156
  """Send email to reset your password."""
132
- return self.call_api_post("users.forgotPassword", email=email, data=kwargs)
157
+ return self.call_api_post("users.forgotPassword", email=email, kwargs=kwargs)
133
158
 
134
159
  def users_get_preferences(self, **kwargs):
135
160
  """Gets all preferences of user."""
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rocketchat_API
3
- Version: 3.6.0
3
+ Version: 3.7.0
4
4
  Summary: Python API wrapper for Rocket.Chat
5
5
  Author-email: "Jorge Alberto Díaz Orozco (Akiel)" <diazorozcoj@gmail.com>
6
6
  Maintainer-email: "Jorge Alberto Díaz Orozco (Akiel)" <diazorozcoj@gmail.com>
@@ -146,7 +146,7 @@ def test_dm_counters(logged_rocket, recipient_user):
146
146
 
147
147
  dm_counters = logged_rocket.dm_counters(
148
148
  room_id=dm_create.get("room").get("_id"),
149
- user_name=logged_rocket.me().get("_id"),
149
+ user_id=logged_rocket.me().get("_id"),
150
150
  )
151
151
  assert all(
152
152
  key in dm_counters
@@ -7,6 +7,7 @@ from rocketchat_API.APIExceptions.RocketExceptions import (
7
7
  RocketMissingParamException,
8
8
  RocketApiException,
9
9
  )
10
+ from tests.conftest import get_tests_passowrd
10
11
 
11
12
 
12
13
  def test_login(logged_rocket, user):
@@ -55,6 +56,48 @@ def test_users_info(logged_rocket, user):
55
56
  logged_rocket.users_info()
56
57
 
57
58
 
59
+ def test_users_info_by_email(logged_rocket, skip_if_version_under):
60
+ skip_if_version_under("8.4.0")
61
+ email = f"{uuid.uuid4().hex}@domain.com"
62
+ username = f"info_email_{uuid.uuid4().hex[:8]}"
63
+
64
+ # No user has this email yet, so the lookup must fail.
65
+ with pytest.raises(RocketApiException):
66
+ logged_rocket.users_info(email=email)
67
+
68
+ created = logged_rocket.users_create(
69
+ email, username, get_tests_passowrd(), username
70
+ )
71
+ user_id = created.get("user").get("_id")
72
+ try:
73
+ users_info_by_email = logged_rocket.users_info(email=email)
74
+ assert users_info_by_email.get("user").get("_id") == user_id
75
+ finally:
76
+ logged_rocket.users_delete(user_id)
77
+
78
+
79
+ def test_users_info_by_import_id(logged_rocket):
80
+ # An importId can only be set while importing users (CSV, Slack, ...), which
81
+ # is not exposed through the API, so the success path cannot be set up from
82
+ # code. We only assert the parameter reaches the server: the API answering
83
+ # with a "user not found" error (rather than the wrapper raising a
84
+ # missing-param error) proves importId was sent as a query parameter.
85
+ with pytest.raises(RocketApiException):
86
+ logged_rocket.users_info(import_id="nonexistent")
87
+
88
+
89
+ def test_users_info_by_free_switch_extension(logged_rocket, skip_if_version_under):
90
+ skip_if_version_under("8.5.0")
91
+ # Assigning a freeSwitchExtension requires a configured FreeSwitch server
92
+ # (VoIP_TeamCollab), which is part of the deployment rather than something we
93
+ # can set up from code, so the success path cannot be exercised here. We only
94
+ # assert the parameter reaches the server: the API answering with a "user not
95
+ # found" error (rather than the wrapper raising a missing-param error) proves
96
+ # freeSwitchExtension was sent as a query parameter.
97
+ with pytest.raises(RocketApiException):
98
+ logged_rocket.users_info(free_switch_extension="0000")
99
+
100
+
58
101
  def test_users_get_presence(logged_rocket, user):
59
102
  login = logged_rocket.login(user.name, user.password)
60
103
  users_get_presence = logged_rocket.users_get_presence(
File without changes
File without changes