rocketchat-API 3.7.0__tar.gz → 3.8.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 (90) hide show
  1. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.github/actions/test_rocketchat/action.yml +2 -2
  2. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.github/workflows/lint.yml +3 -3
  3. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.github/workflows/release.yml +4 -4
  4. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.github/workflows/test.yml +3 -3
  5. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.github/workflows/test_latest.yml +1 -1
  6. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.github/workflows/test_manually.yml +2 -2
  7. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/PKG-INFO +3 -9
  8. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/README.md +1 -8
  9. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/pyproject.toml +2 -1
  10. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/chat.py +0 -1
  11. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/integrations.py +2 -2
  12. rocketchat_api-3.8.0/rocketchat_API/APISections/users.py +370 -0
  13. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API.egg-info/PKG-INFO +3 -9
  14. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API.egg-info/SOURCES.txt +2 -0
  15. rocketchat_api-3.8.0/rocketchat_API.egg-info/scm_file_list.json +84 -0
  16. rocketchat_api-3.8.0/rocketchat_API.egg-info/scm_version.json +8 -0
  17. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/conftest.py +40 -8
  18. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_chat.py +3 -1
  19. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_livechat.py +4 -2
  20. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_user.py +209 -1
  21. rocketchat_api-3.7.0/rocketchat_API/APISections/users.py +0 -171
  22. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.coveragerc +0 -0
  23. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.deepsource.toml +0 -0
  24. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.editorconfig +0 -0
  25. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.github/ISSUE_TEMPLATE/bug_report.md +0 -0
  26. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.github/ISSUE_TEMPLATE/feature_request.md +0 -0
  27. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.github/dependabot.yml +0 -0
  28. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/.gitignore +0 -0
  29. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/CONTRIBUTING.md +0 -0
  30. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/LICENSE.txt +0 -0
  31. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/bandit.yml +0 -0
  32. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/docker-compose.yml +0 -0
  33. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/qodana.yaml +0 -0
  34. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APIExceptions/RocketExceptions.py +0 -0
  35. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APIExceptions/__init__.py +0 -0
  36. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/__init__.py +0 -0
  37. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/assets.py +0 -0
  38. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/banners.py +0 -0
  39. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/base.py +0 -0
  40. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/channels.py +0 -0
  41. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/custom_emoji.py +0 -0
  42. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/custom_sounds.py +0 -0
  43. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/custom_user_status.py +0 -0
  44. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/dm.py +0 -0
  45. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/groups.py +0 -0
  46. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/invites.py +0 -0
  47. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/licenses.py +0 -0
  48. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/livechat.py +0 -0
  49. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/miscellaneous.py +0 -0
  50. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/moderation.py +0 -0
  51. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/permissions.py +0 -0
  52. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/roles.py +0 -0
  53. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/rooms.py +0 -0
  54. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/settings.py +0 -0
  55. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/statistics.py +0 -0
  56. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/subscriptions.py +0 -0
  57. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/teams.py +0 -0
  58. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/APISections/users_engagement.py +0 -0
  59. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/__init__.py +0 -0
  60. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API/rocketchat.py +0 -0
  61. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API.egg-info/dependency_links.txt +0 -0
  62. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API.egg-info/requires.txt +0 -0
  63. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/rocketchat_API.egg-info/top_level.txt +0 -0
  64. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/setup.cfg +0 -0
  65. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/__init__.py +0 -0
  66. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/assets/avatar.png +0 -0
  67. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/assets/avatar.svg +0 -0
  68. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/assets/logo.png +0 -0
  69. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_assets.py +0 -0
  70. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_banners.py +0 -0
  71. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_channels.py +0 -0
  72. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_custom_emoji.py +0 -0
  73. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_custom_sounds.py +0 -0
  74. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_custom_user_status.py +0 -0
  75. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_dms.py +0 -0
  76. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_exceptions.py +0 -0
  77. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_groups.py +0 -0
  78. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_integrations.py +0 -0
  79. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_invites.py +0 -0
  80. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_licenses.py +0 -0
  81. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_moderation.py +0 -0
  82. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_paginated.py +0 -0
  83. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_permissions.py +0 -0
  84. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_roles.py +0 -0
  85. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_rooms.py +0 -0
  86. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_server.py +0 -0
  87. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_settings.py +0 -0
  88. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_subscriptions.py +0 -0
  89. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_teams.py +0 -0
  90. {rocketchat_api-3.7.0 → rocketchat_api-3.8.0}/tests/test_users_engagement.py +0 -0
@@ -4,7 +4,7 @@ description: 'Run tests on the Rocket.Chat server'
4
4
  inputs:
5
5
  python-version:
6
6
  description: 'The version of Python to use'
7
- default: '3.14'
7
+ default: '3.15'
8
8
  required: true
9
9
  rocket-chat-version:
10
10
  description: 'The version of Rocket.Chat to use'
@@ -35,7 +35,7 @@ runs:
35
35
  run: pip install .[test]
36
36
  - name: Wait for rocket.chat server to be online
37
37
  shell: bash
38
- run: until curl --silent http://localhost:3000/api/info/; do sleep 15; echo "waiting for Rocket.Chat server to start"; done;
38
+ run: until curl --silent http://localhost:3000/api/info; do sleep 15; echo "waiting for Rocket.Chat server to start"; done;
39
39
  - name: Run tests
40
40
  shell: bash
41
41
  run: pytest tests rocketchat_API --cov-report xml --cov=./
@@ -12,13 +12,13 @@ jobs:
12
12
  runs-on: ubuntu-latest
13
13
  steps:
14
14
  - name: Checkout
15
- uses: actions/checkout@v6.0.3
15
+ uses: actions/checkout@v7.0.1
16
16
  with:
17
17
  fetch-depth: 0
18
18
  - name: Set up Python
19
- uses: actions/setup-python@v6
19
+ uses: actions/setup-python@v7
20
20
  with:
21
- python-version: "3.14"
21
+ python-version: "3.15"
22
22
  - name: Install black
23
23
  run: |
24
24
  pip install black
@@ -14,11 +14,11 @@ jobs:
14
14
  id-token: write
15
15
  steps:
16
16
  - name: Checkout
17
- uses: actions/checkout@v6.0.3
18
- - name: Set up Python 3.14
19
- uses: actions/setup-python@v6
17
+ uses: actions/checkout@v7.0.1
18
+ - name: Set up Python 3.15
19
+ uses: actions/setup-python@v7
20
20
  with:
21
- python-version: '3.14'
21
+ python-version: '3.15'
22
22
  - name: Install dependencies
23
23
  run: |
24
24
  python -m pip install --upgrade pip
@@ -14,11 +14,11 @@ jobs:
14
14
  strategy:
15
15
  fail-fast: false
16
16
  matrix:
17
- python-version: [ '3.10', '3.11', '3.12', '3.13', '3.14' ]
18
- rocket-chat-version: [ '8.0.5', '8.1.5', '8.2.5', '8.3.5', '8.4.3', '8.5.0']
17
+ python-version: [ '3.11', '3.12', '3.13', '3.14', '3.15' ]
18
+ rocket-chat-version: [ '8.5.5', '8.6.4', '8.7.1', '8.8.2', '8.9.1']
19
19
  steps:
20
20
  - name: Checkout
21
- uses: actions/checkout@v6.0.3
21
+ uses: actions/checkout@v7.0.1
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.3
15
+ uses: actions/checkout@v7.0.1
16
16
  - name: Test
17
17
  uses: ./.github/actions/test_rocketchat
18
18
  with:
@@ -10,7 +10,7 @@ on:
10
10
  python-version:
11
11
  description: 'The version of Python to use'
12
12
  required: true
13
- default: '3.14'
13
+ default: '3.15'
14
14
 
15
15
  jobs:
16
16
  test:
@@ -19,7 +19,7 @@ jobs:
19
19
  runs-on: ubuntu-latest
20
20
  steps:
21
21
  - name: Checkout
22
- uses: actions/checkout@v6.0.3
22
+ uses: actions/checkout@v7.0.1
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.7.0
3
+ Version: 3.8.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>
@@ -8,6 +8,7 @@ License-Expression: MIT
8
8
  Project-URL: Homepage, https://github.com/jadolg/rocketchat_API
9
9
  Project-URL: Issues, https://github.com/jadolg/rocketchat_API/issues
10
10
  Keywords: rocketchat,api,wrapper,rest
11
+ Requires-Python: >=3.11
11
12
  Description-Content-Type: text/markdown
12
13
  License-File: LICENSE.txt
13
14
  Requires-Dist: requests
@@ -47,7 +48,7 @@ pip install .
47
48
 
48
49
  ## Requirements
49
50
 
50
- - Python 3.10 or higher
51
+ - Python 3.11 or higher
51
52
  - [requests](https://github.com/kennethreitz/requests)
52
53
 
53
54
 
@@ -182,10 +183,3 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to contribute to th
182
183
  ## License
183
184
 
184
185
  This project is licensed under the MIT License. See [LICENSE.txt](LICENSE.txt) for details.
185
-
186
-
187
- ## Supporters
188
-
189
- [![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://jb.gg/OpenSourceSupport)
190
-
191
- [JetBrains](https://www.jetbrains.com/) supports this project by providing licenses for their development tools.
@@ -24,7 +24,7 @@ pip install .
24
24
 
25
25
  ## Requirements
26
26
 
27
- - Python 3.10 or higher
27
+ - Python 3.11 or higher
28
28
  - [requests](https://github.com/kennethreitz/requests)
29
29
 
30
30
 
@@ -159,10 +159,3 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to contribute to th
159
159
  ## License
160
160
 
161
161
  This project is licensed under the MIT License. See [LICENSE.txt](LICENSE.txt) for details.
162
-
163
-
164
- ## Supporters
165
-
166
- [![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://jb.gg/OpenSourceSupport)
167
-
168
- [JetBrains](https://www.jetbrains.com/) supports this project by providing licenses for their development tools.
@@ -1,6 +1,6 @@
1
1
  [build-system]
2
2
  requires = [
3
- "setuptools",
3
+ "setuptools>=61",
4
4
  "setuptools_scm",
5
5
  ]
6
6
  build-backend = "setuptools.build_meta"
@@ -9,6 +9,7 @@ build-backend = "setuptools.build_meta"
9
9
  name = "rocketchat_API"
10
10
  dynamic = ["version"]
11
11
  description = "Python API wrapper for Rocket.Chat"
12
+ requires-python = ">=3.11"
12
13
 
13
14
  dependencies = [
14
15
  "requests",
@@ -72,7 +72,6 @@ class RocketChatChat(RocketChatBase):
72
72
  "chat.search", roomId=room_id, searchText=search_text, kwargs=kwargs
73
73
  )
74
74
 
75
- @paginated("receipts")
76
75
  def chat_get_message_read_receipts(self, message_id, **kwargs):
77
76
  """Get Message Read Receipts"""
78
77
  return self.call_api_get(
@@ -16,7 +16,7 @@ class RocketChatIntegrations(RocketChatBase):
16
16
  script_enabled,
17
17
  event=None,
18
18
  urls=None,
19
- **kwargs
19
+ **kwargs,
20
20
  ):
21
21
  """Creates an integration."""
22
22
  if integrations_type == "webhook-outgoing":
@@ -82,7 +82,7 @@ class RocketChatIntegrations(RocketChatBase):
82
82
  channel,
83
83
  script_enabled,
84
84
  integration_id,
85
- **kwargs
85
+ **kwargs,
86
86
  ):
87
87
  """Updates an existing integration."""
88
88
  return self.call_api_put(
@@ -0,0 +1,370 @@
1
+ import hashlib
2
+ import mimetypes
3
+ import os
4
+
5
+ from rocketchat_API.APIExceptions.RocketExceptions import (
6
+ USER_ID_OR_USERNAME_REQUIRED,
7
+ USER_INFO_LOOKUP_REQUIRED,
8
+ RocketMissingParamException,
9
+ )
10
+ from rocketchat_API.APISections.base import (
11
+ RocketChatBase,
12
+ paginated,
13
+ )
14
+
15
+ USERS_GET_STATUS = "users.getStatus"
16
+
17
+ USERS_INFO = "users.info"
18
+
19
+
20
+ class RocketChatUsers(RocketChatBase):
21
+ def me(self, **kwargs):
22
+ """Displays information about the authenticated user."""
23
+ return self.call_api_get("me", kwargs=kwargs)
24
+
25
+ def users_info(
26
+ self,
27
+ user_id=None,
28
+ username=None,
29
+ import_id=None,
30
+ email=None,
31
+ free_switch_extension=None,
32
+ **kwargs,
33
+ ):
34
+ """Gets a user's information, limited to the caller's permissions.
35
+
36
+ Exactly one lookup parameter must be provided. ``email`` requires
37
+ Rocket.Chat >= 8.4.0 and ``free_switch_extension`` requires >= 8.5.0.
38
+ """
39
+ if user_id:
40
+ return self.call_api_get(USERS_INFO, userId=user_id, kwargs=kwargs)
41
+ if username:
42
+ return self.call_api_get(USERS_INFO, username=username, kwargs=kwargs)
43
+ if import_id:
44
+ return self.call_api_get(USERS_INFO, importId=import_id, kwargs=kwargs)
45
+ if email:
46
+ return self.call_api_get(USERS_INFO, email=email, kwargs=kwargs)
47
+ if free_switch_extension:
48
+ return self.call_api_get(
49
+ USERS_INFO,
50
+ freeSwitchExtension=free_switch_extension,
51
+ kwargs=kwargs,
52
+ )
53
+ raise RocketMissingParamException(USER_INFO_LOOKUP_REQUIRED)
54
+
55
+ @paginated("users")
56
+ def users_list(self, **kwargs):
57
+ """All of the users and their information, limited to permissions."""
58
+ return self.call_api_get("users.list", kwargs=kwargs)
59
+
60
+ def users_get_presence(self, user_id=None, username=None, **kwargs):
61
+ """Gets the online presence of the a user."""
62
+ if user_id:
63
+ return self.call_api_get("users.getPresence", userId=user_id, kwargs=kwargs)
64
+ if username:
65
+ return self.call_api_get(
66
+ "users.getPresence", username=username, kwargs=kwargs
67
+ )
68
+ raise RocketMissingParamException(USER_ID_OR_USERNAME_REQUIRED)
69
+
70
+ def users_create(self, email, name, password, username, **kwargs):
71
+ """Creates a user"""
72
+ return self.call_api_post(
73
+ "users.create",
74
+ email=email,
75
+ name=name,
76
+ password=password,
77
+ username=username,
78
+ kwargs=kwargs,
79
+ )
80
+
81
+ def users_delete(self, user_id, **kwargs):
82
+ """Deletes a user"""
83
+ return self.call_api_post("users.delete", userId=user_id, **kwargs)
84
+
85
+ def users_register(self, email, name, password, username, **kwargs):
86
+ """Register a new user."""
87
+ return self.call_api_post(
88
+ "users.register",
89
+ email=email,
90
+ name=name,
91
+ password=password,
92
+ username=username,
93
+ kwargs=kwargs,
94
+ )
95
+
96
+ def users_get_avatar(self, user_id=None, username=None, **kwargs):
97
+ """Gets the URL for a user's avatar."""
98
+ if user_id:
99
+ return self.call_api_get("users.getAvatar", userId=user_id, kwargs=kwargs)
100
+ if username:
101
+ return self.call_api_get(
102
+ "users.getAvatar", username=username, kwargs=kwargs
103
+ )
104
+ raise RocketMissingParamException(USER_ID_OR_USERNAME_REQUIRED)
105
+
106
+ def users_set_avatar(self, avatar_url, **kwargs):
107
+ """Set a user's avatar"""
108
+ if avatar_url.startswith(("http://", "https://")):
109
+ return self.call_api_post(
110
+ "users.setAvatar", avatarUrl=avatar_url, kwargs=kwargs
111
+ )
112
+
113
+ avatar_file = {
114
+ "image": (
115
+ os.path.basename(avatar_url),
116
+ open(avatar_url, "rb"),
117
+ mimetypes.guess_type(avatar_url)[0],
118
+ ),
119
+ }
120
+
121
+ return self.call_api_post("users.setAvatar", files=avatar_file, kwargs=kwargs)
122
+
123
+ def users_reset_avatar(self, user_id=None, username=None, **kwargs):
124
+ """
125
+ Reset a user's avatar to the default icon. By default, icons contain the user's initials. Permissions required, if the setting AllowUserAvatarChange is enabled:
126
+ - edit-other-user-avatar: Permission to change other user's avatar
127
+ - manage-moderation-actions: Permission to manage moderation actions, perform actions on reported users
128
+ """
129
+ if user_id:
130
+ return self.call_api_post(
131
+ "users.resetAvatar", userId=user_id, kwargs=kwargs
132
+ )
133
+ if username:
134
+ return self.call_api_post(
135
+ "users.resetAvatar", username=username, kwargs=kwargs
136
+ )
137
+ raise RocketMissingParamException(USER_ID_OR_USERNAME_REQUIRED)
138
+
139
+ def users_create_token(self, user_id, secret, **kwargs):
140
+ """Create a user authentication token."""
141
+ return self.call_api_post(
142
+ "users.createToken", userId=user_id, secret=secret, kwargs=kwargs
143
+ )
144
+
145
+ def users_update(self, user_id, **kwargs):
146
+ """Update an existing user."""
147
+ return self.call_api_post("users.update", userId=user_id, data=kwargs)
148
+
149
+ def users_set_active_status(self, user_id, active_status, **kwargs):
150
+ """Update user active status."""
151
+ return self.call_api_post(
152
+ "users.setActiveStatus",
153
+ userId=user_id,
154
+ activeStatus=active_status,
155
+ kwargs=kwargs,
156
+ )
157
+
158
+ def users_forgot_password(self, email, **kwargs):
159
+ """Send email to reset your password."""
160
+ return self.call_api_post("users.forgotPassword", email=email, kwargs=kwargs)
161
+
162
+ def users_get_preferences(self, **kwargs):
163
+ """Gets all preferences of user."""
164
+ return self.call_api_get("users.getPreferences", kwargs=kwargs)
165
+
166
+ def users_set_preferences(self, user_id, data, **kwargs):
167
+ """Set user's preferences."""
168
+ return self.call_api_post(
169
+ "users.setPreferences", userId=user_id, data=data, kwargs=kwargs
170
+ )
171
+
172
+ def users_set_status(self, message, **kwargs):
173
+ """Sets a user Status when the status message and state is given."""
174
+ return self.call_api_post("users.setStatus", message=message, kwargs=kwargs)
175
+
176
+ @paginated("users")
177
+ def users_list_by_status(self, **kwargs):
178
+ """Lists users filtered by status, role or search term.
179
+
180
+ Accepts ``status`` (active or deactivated), ``hasLoggedIn``, ``type``,
181
+ ``roles``, ``searchTerm`` and ``inactiveReason``. Requires ``view-d-room``,
182
+ and ``view-outside-room`` when Apply_permission_view-outside-room is on.
183
+ """
184
+ return self.call_api_get("users.listByStatus", kwargs=kwargs)
185
+
186
+ def users_get_username_suggestion(self, **kwargs):
187
+ """Gets a free username suggestion for the authenticated user."""
188
+ return self.call_api_get("users.getUsernameSuggestion", kwargs=kwargs)
189
+
190
+ def users_get_avatar_suggestion(self, **kwargs):
191
+ """Gets avatar suggestions from the user's connected OAuth services."""
192
+ return self.call_api_get("users.getAvatarSuggestion", kwargs=kwargs)
193
+
194
+ def users_check_username_availability(self, username, **kwargs):
195
+ """Checks whether a username is available."""
196
+ return self.call_api_get(
197
+ "users.checkUsernameAvailability", username=username, kwargs=kwargs
198
+ )
199
+
200
+ def users_presence(self, **kwargs):
201
+ """Gets the presence of users.
202
+
203
+ Accepts ``ids`` and ``from`` (ISO 8601 datetime). Without ``from``, the
204
+ presence of all users is returned.
205
+ """
206
+ return self.call_api_get("users.presence", kwargs=kwargs)
207
+
208
+ def users_autocomplete(self, selector, **kwargs):
209
+ """Autocompletes users. ``selector`` is a JSON string, e.g. ``{"term": "ab"}``."""
210
+ return self.call_api_get("users.autocomplete", selector=selector, kwargs=kwargs)
211
+
212
+ def users_get_status(self, user_id=None, username=None, **kwargs):
213
+ """Gets the status of a user by ``user_id`` or ``username``.
214
+
215
+ Returns the authenticated user's status if neither is given.
216
+ """
217
+ if user_id:
218
+ return self.call_api_get(USERS_GET_STATUS, userId=user_id, kwargs=kwargs)
219
+ if username:
220
+ return self.call_api_get(USERS_GET_STATUS, username=username, kwargs=kwargs)
221
+ return self.call_api_get(USERS_GET_STATUS, kwargs=kwargs)
222
+
223
+ def users_list_teams(self, user_id, **kwargs):
224
+ """Lists the teams a user belongs to. Seeing all of them needs view-all-teams."""
225
+ return self.call_api_get("users.listTeams", userId=user_id, kwargs=kwargs)
226
+
227
+ def users_generate_personal_access_token(self, token_name, **kwargs):
228
+ """Generates a personal access token. Accepts ``bypassTwoFactor``.
229
+
230
+ Requires ``create-personal-access-tokens`` and 2FA.
231
+ """
232
+ return self.call_api_post(
233
+ "users.generatePersonalAccessToken", tokenName=token_name, kwargs=kwargs
234
+ )
235
+
236
+ def users_regenerate_personal_access_token(self, token_name, **kwargs):
237
+ """Regenerates an existing personal access token.
238
+
239
+ Requires ``create-personal-access-tokens`` and 2FA.
240
+ """
241
+ return self.call_api_post(
242
+ "users.regeneratePersonalAccessToken", tokenName=token_name, kwargs=kwargs
243
+ )
244
+
245
+ def users_get_personal_access_tokens(self, **kwargs):
246
+ """Lists the personal access tokens of the authenticated user.
247
+
248
+ Requires ``create-personal-access-tokens``.
249
+ """
250
+ return self.call_api_get("users.getPersonalAccessTokens", kwargs=kwargs)
251
+
252
+ def users_remove_personal_access_token(self, token_name, **kwargs):
253
+ """Removes a personal access token.
254
+
255
+ Requires ``create-personal-access-tokens`` and 2FA.
256
+ """
257
+ return self.call_api_post(
258
+ "users.removePersonalAccessToken", tokenName=token_name, kwargs=kwargs
259
+ )
260
+
261
+ def users_request_data_download(self, full_export=False, **kwargs):
262
+ """Requests an export of the authenticated user's data.
263
+
264
+ The User Data Download feature must be configured in the workspace.
265
+ """
266
+ return self.call_api_get(
267
+ "users.requestDataDownload",
268
+ fullExport=str(full_export).lower(),
269
+ kwargs=kwargs,
270
+ )
271
+
272
+ def users_deactivate_idle(self, days_idle, **kwargs):
273
+ """Deactivates users idle for ``days_idle`` days. Accepts ``role``.
274
+
275
+ Requires ``edit-other-user-active-status``.
276
+ """
277
+ return self.call_api_post(
278
+ "users.deactivateIdle", daysIdle=days_idle, kwargs=kwargs
279
+ )
280
+
281
+ def users_send_confirmation_email(self, email, **kwargs):
282
+ """Sends the email verification again. Rate limited to one per 60 seconds."""
283
+ return self.call_api_post(
284
+ "users.sendConfirmationEmail", email=email, kwargs=kwargs
285
+ )
286
+
287
+ def users_update_own_basic_info(self, data, **kwargs):
288
+ """Updates the authenticated user's own profile. Accepts ``customFields``."""
289
+ return self.call_api_post("users.updateOwnBasicInfo", data=data, kwargs=kwargs)
290
+
291
+ def users_2fa_send_email_code(self, email_or_username, **kwargs):
292
+ """Sends an email 2FA code to the user."""
293
+ return self.call_api_post(
294
+ "users.2fa.sendEmailCode", emailOrUsername=email_or_username, kwargs=kwargs
295
+ )
296
+
297
+ def users_2fa_enable_email(self, **kwargs):
298
+ """Enables email 2FA. The user must have a verified email."""
299
+ return self.call_api_post("users.2fa.enableEmail", kwargs=kwargs)
300
+
301
+ def users_2fa_disable_email(self, **kwargs):
302
+ """Disables email 2FA. Requires a 2FA code."""
303
+ return self.call_api_post("users.2fa.disableEmail", kwargs=kwargs)
304
+
305
+ def users_enable_totp(self, **kwargs):
306
+ """Starts TOTP setup, returns the ``secret`` and a ``url`` for the QR code.
307
+
308
+ Finish it with ``users_validate_totp``. Requires 2FA.
309
+ """
310
+ return self.call_api_post("users.enableTotp", kwargs=kwargs)
311
+
312
+ def users_validate_totp(self, code, **kwargs):
313
+ """Finishes TOTP setup with a code from the app, returns the backup codes."""
314
+ return self.call_api_post("users.validateTotp", code=code, kwargs=kwargs)
315
+
316
+ def users_disable_totp(self, code, **kwargs):
317
+ """Disables TOTP."""
318
+ return self.call_api_post("users.disableTotp", code=code, kwargs=kwargs)
319
+
320
+ def users_regenerate_totp_codes(self, code, **kwargs):
321
+ """Regenerates the TOTP backup codes. The previous ones stop working."""
322
+ return self.call_api_post("users.regenerateTotpCodes", code=code, kwargs=kwargs)
323
+
324
+ def users_totp_codes_remaining(self, **kwargs):
325
+ """Gets how many TOTP backup codes are left."""
326
+ return self.call_api_get("users.totpCodesRemaining", kwargs=kwargs)
327
+
328
+ def users_reset_totp(self, **kwargs):
329
+ """Resets TOTP of a user (``userId`` or ``username``), or your own if omitted.
330
+
331
+ Resetting another user's needs ``edit-other-user-totp``.
332
+ """
333
+ return self.call_api_post("users.resetTOTP", kwargs=kwargs)
334
+
335
+ def users_reset_e2e_key(self, **kwargs):
336
+ """Resets E2E key of a user (``userId`` or ``username``), or your own if omitted.
337
+
338
+ Resetting another user's needs ``edit-other-user-e2ee``.
339
+ """
340
+ return self.call_api_post("users.resetE2EKey", kwargs=kwargs)
341
+
342
+ def users_logout(self, **kwargs):
343
+ """Logs out the given user (``userId``), or yourself if omitted.
344
+
345
+ Logging out another user needs ``logout-other-user``.
346
+ """
347
+ return self.call_api_post("users.logout", kwargs=kwargs)
348
+
349
+ def users_logout_other_clients(self, **kwargs):
350
+ """Logs out all other sessions of the authenticated user."""
351
+ return self.call_api_post("users.logoutOtherClients", kwargs=kwargs)
352
+
353
+ def users_remove_other_tokens(self, **kwargs):
354
+ """Removes all login tokens except the current one."""
355
+ return self.call_api_post("users.removeOtherTokens", kwargs=kwargs)
356
+
357
+ def users_delete_own_account(self, password, **kwargs):
358
+ """Deletes the authenticated user's account.
359
+
360
+ Requires the Accounts_AllowDeleteOwnAccount setting. Accepts
361
+ ``confirmRelinquish`` to delete it even if it is the last owner of a room.
362
+ """
363
+ return self.call_api_post(
364
+ "users.deleteOwnAccount",
365
+ body={
366
+ # Rocket.Chat expects the password as a SHA-256 hex digest
367
+ "password": hashlib.sha256(password.encode()).hexdigest(),
368
+ **kwargs,
369
+ },
370
+ )
@@ -1,6 +1,6 @@
1
1
  Metadata-Version: 2.4
2
2
  Name: rocketchat_API
3
- Version: 3.7.0
3
+ Version: 3.8.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>
@@ -8,6 +8,7 @@ License-Expression: MIT
8
8
  Project-URL: Homepage, https://github.com/jadolg/rocketchat_API
9
9
  Project-URL: Issues, https://github.com/jadolg/rocketchat_API/issues
10
10
  Keywords: rocketchat,api,wrapper,rest
11
+ Requires-Python: >=3.11
11
12
  Description-Content-Type: text/markdown
12
13
  License-File: LICENSE.txt
13
14
  Requires-Dist: requests
@@ -47,7 +48,7 @@ pip install .
47
48
 
48
49
  ## Requirements
49
50
 
50
- - Python 3.10 or higher
51
+ - Python 3.11 or higher
51
52
  - [requests](https://github.com/kennethreitz/requests)
52
53
 
53
54
 
@@ -182,10 +183,3 @@ See [CONTRIBUTING.md](CONTRIBUTING.md) for guidelines on how to contribute to th
182
183
  ## License
183
184
 
184
185
  This project is licensed under the MIT License. See [LICENSE.txt](LICENSE.txt) for details.
185
-
186
-
187
- ## Supporters
188
-
189
- [![JetBrains logo.](https://resources.jetbrains.com/storage/products/company/brand/logos/jetbrains.svg)](https://jb.gg/OpenSourceSupport)
190
-
191
- [JetBrains](https://www.jetbrains.com/) supports this project by providing licenses for their development tools.
@@ -24,6 +24,8 @@ rocketchat_API.egg-info/PKG-INFO
24
24
  rocketchat_API.egg-info/SOURCES.txt
25
25
  rocketchat_API.egg-info/dependency_links.txt
26
26
  rocketchat_API.egg-info/requires.txt
27
+ rocketchat_API.egg-info/scm_file_list.json
28
+ rocketchat_API.egg-info/scm_version.json
27
29
  rocketchat_API.egg-info/top_level.txt
28
30
  rocketchat_API/APIExceptions/RocketExceptions.py
29
31
  rocketchat_API/APIExceptions/__init__.py