-
Notifications
You must be signed in to change notification settings - Fork 27
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
capitalize "admin API" as "Admin API"
Fixes: #132
- Loading branch information
1 parent
5bd5e3c
commit ae26ecf
Showing
4 changed files
with
48 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,7 +15,7 @@ | |
# You should have received a copy of the GNU General Public License | ||
# along with this program. If not, see <http://www.gnu.org/licenses/>. | ||
|
||
"""Synapse admin API and regular Matrix API clients | ||
"""Synapse Admin API and regular Matrix API clients | ||
Most API calls defined in this module respect the API's defaults and only pass | ||
what's necessary in the request body. | ||
|
@@ -24,7 +24,7 @@ | |
often is a domain name only, e.g @[email protected] | ||
See https://github.com/matrix-org/synapse/tree/master/docs/admin_api for | ||
documentation of the Synapse admin APIs and the Matrix spec at | ||
documentation of the Synapse Admin APIs and the Matrix spec at | ||
https://matrix.org/docs/spec/#matrix-apis. | ||
""" | ||
|
||
|
@@ -382,7 +382,7 @@ def server_name_keys_api(self, server_server_uri): | |
|
||
|
||
class SynapseAdmin(ApiRequest): | ||
"""Synapse admin API client | ||
"""Synapse Admin API client | ||
Inheritance: | ||
ApiRequest (object): parent class containing general properties and | ||
|
@@ -424,7 +424,7 @@ def user_list(self, _from, _limit, _guests, _deactivated, | |
_guests (bool): enable/disable fetching of guest users | ||
_deactivated (bool): enable/disable fetching of deactivated users | ||
_name (string): user name localpart to search for, see Synapse | ||
admin API docs for details | ||
Admin API docs for details | ||
_user_id (string): fully qualified Matrix user ID to search for | ||
_admin (bool or None): whether to filter for admins. a None | ||
does not filter. | ||
|
@@ -457,13 +457,13 @@ def user_list_paginate(self, _limit, _guests, _deactivated, | |
_deactivated (bool): Enable/disable fetching of deactivated | ||
users. | ||
_name (string): User name localpart to search for, see Synapse | ||
admin API docs for details. | ||
Admin API docs for details. | ||
_user_id (string): Fully qualified Matrix user ID to search for. | ||
_from (string): Offsets user list by this number, used for | ||
pagination. | ||
Yields: | ||
dict: The admin API response for listing accounts. | ||
dict: The Admin API response for listing accounts. | ||
https://element-hq.github.io/synapse/latest/admin_api/user_admin_api.html#list-accounts | ||
""" | ||
while _from is not None: | ||
|
@@ -483,8 +483,8 @@ def user_membership(self, user_id, return_aliases, matrix_api): | |
passes as we need some Matrix API functionality here. | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
|
||
rooms = self.query("get", "v1/users/{user_id}/joined_rooms", | ||
|
@@ -503,11 +503,11 @@ def user_deactivate(self, user_id, gdpr_erase): | |
Args: | ||
user_id (string): fully qualified Matrix user ID | ||
gdpr_erase (bool): enable/disable gdpr-erasing the user, see | ||
Synapse admin API docs for details. | ||
Synapse Admin API docs for details. | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
return self.query("post", "v1/deactivate/{user_id}", data={ | ||
"erase": gdpr_erase | ||
|
@@ -520,12 +520,12 @@ def user_password(self, user_id, password, no_logout): | |
user_id (string): fully qualified Matrix user ID | ||
password (string): new password that should be set | ||
no_logout (bool): the API defaults to logging out the user after | ||
password reset via the admin API, this option can be used to | ||
password reset via the Admin API, this option can be used to | ||
disable this behaviour. | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
data = {"new_password": password} | ||
if no_logout: | ||
|
@@ -536,15 +536,15 @@ def user_password(self, user_id, password, no_logout): | |
def user_details(self, user_id): | ||
"""Get information about a given user | ||
Note that the admin API docs describe this function as "Query User | ||
Note that the Admin API docs describe this function as "Query User | ||
Account". | ||
Args: | ||
user_id (string): fully qualified Matrix user ID | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
return self.query("get", "v2/users/{user_id}", user_id=user_id) | ||
|
@@ -569,8 +569,8 @@ def user_login(self, user_id, expire_days, expire, _expire_ts): | |
_expire_ts (int): token should expire after this date/time - a | ||
unix timestamp in ms. | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
expire_ts = None | ||
if expire_days: | ||
|
@@ -646,8 +646,8 @@ def user_devices(self, user_id): | |
user_id (string): Fully qualified Matrix user ID. | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
return self.query("get", "v2/users/{user_id}/devices", | ||
user_id=user_id) | ||
|
@@ -791,8 +791,8 @@ def room_state(self, room_id): | |
room_id (string) | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
return self.query("get", "v1/rooms/{room_id}/state", room_id=room_id) | ||
|
||
|
@@ -807,8 +807,8 @@ def room_power_levels(self, from_, limit, name, order_by, reverse, | |
room_id (string): If left out, all rooms are fetched. | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
if room_id: | ||
# We use the "name search" possibility of the room list API to get | ||
|
@@ -902,8 +902,8 @@ def block_room(self, room_id, block): | |
block (boolean): Whether to block or unblock a room. | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occurred. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occurred. See Synapse Admin API docs for details. | ||
""" | ||
# TODO prevent usage on versions before 1.48 | ||
data = { | ||
|
@@ -919,8 +919,8 @@ def room_block_status(self, room_id): | |
room_id (string): Fully qualified Matrix room ID. | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
# TODO prevent usage on versions before 1.48 | ||
return self.query("get", "v1/rooms/{room_id}/block", room_id=room_id) | ||
|
@@ -1151,8 +1151,8 @@ def regtok_list(self, valid, readable_expiry): | |
timestamp. | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
result = self.query("get", "v1/registration_tokens", params={ | ||
|
@@ -1184,8 +1184,8 @@ def regtok_details(self, token, readable_expiry): | |
timestamp. | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
result = self.query("get", "v1/registration_tokens/{t}", | ||
|
@@ -1220,8 +1220,8 @@ def regtok_new(self, token, length, uses_allowed, expiry_ts, expire_at): | |
is valid. | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
data = { | ||
|
@@ -1258,8 +1258,8 @@ def regtok_update(self, token, uses_allowed, expiry_ts, expire_at): | |
is valid. | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
# If uses_allowed or expiry time were not provided by the user, | ||
|
@@ -1294,8 +1294,8 @@ def regtok_delete(self, token): | |
token (string): The registration token to delete | ||
Returns: | ||
string: JSON string containing the admin API's response or None if | ||
an exception occured. See Synapse admin API docs for details. | ||
string: JSON string containing the Admin API's response or None if | ||
an exception occured. See Synapse Admin API docs for details. | ||
""" | ||
# t because query also accepts token when we want it for the | ||
|
@@ -1335,8 +1335,8 @@ def notice_send(self, receivers, content_plain, content_html, paginate, | |
Returns: | ||
list: A list of dictionaries, each containing the response of | ||
what a single notice admin API call returned. Usually that is | ||
an event ID or an error. See Synapse admin API docs for | ||
what a single notice Admin API call returned. Usually that is | ||
an event ID or an error. See Synapse Admin API docs for | ||
details. | ||
""" | ||
data = { | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters