Skip to content

Commit

Permalink
capitalize "admin API" as "Admin API"
Browse files Browse the repository at this point in the history
Fixes: #132
  • Loading branch information
JacksonChen666 committed Mar 26, 2024
1 parent 5bd5e3c commit ae26ecf
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 48 deletions.
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@

## About

A CLI tool to help admins of [Matrix-Synapse homeservers](https://github.com/matrix-org/synapse) conveniently issue commands available via its [admin API](https://element-hq.github.io/synapse/develop/usage/administration/admin_api/index.html#the-admin-api).
A CLI tool to help admins of [Matrix-Synapse homeservers](https://github.com/matrix-org/synapse) conveniently issue commands available via its [Admin API](https://element-hq.github.io/synapse/develop/usage/administration/admin_api/index.html#the-admin-api).



Expand All @@ -36,7 +36,7 @@ A CLI tool to help admins of [Matrix-Synapse homeservers](https://github.com/mat
- an admin-enabled user on the instance
- the admin user's access token

`synadm` is designed to run either directly on the host running the Synapse instance or on a remote machine able to access Synapse's API port. Synapse's default admin API endpoint address usually is http://localhost:8008/_synapse/admin or https://localhost:8448/_synapse/admin.
`synadm` is designed to run either directly on the host running the Synapse instance or on a remote machine able to access Synapse's API port. Synapse's default Admin API endpoint address usually is http://localhost:8008/_synapse/admin or https://localhost:8448/_synapse/admin.



Expand Down
2 changes: 1 addition & 1 deletion doc/source/synadm.module.rst
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Synadm Package
==============

The :code:`synadm` package contains the :mod:`synadm.api` module which is
responsible for accessing the Synapse admin API endpoints and the regular Matrix
responsible for accessing the Synapse Admin API endpoints and the regular Matrix
API endpoints. Also some helper methods, e.g to calculate time-related things
are to be found in this module:

Expand Down
82 changes: 41 additions & 41 deletions synadm/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -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.
Expand All @@ -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.
"""

Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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.
Expand Down Expand Up @@ -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:
Expand All @@ -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",
Expand All @@ -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
Expand All @@ -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:
Expand All @@ -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)
Expand All @@ -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:
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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)

Expand All @@ -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
Expand Down Expand Up @@ -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 = {
Expand All @@ -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)
Expand Down Expand Up @@ -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={
Expand Down Expand Up @@ -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}",
Expand Down Expand Up @@ -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 = {
Expand Down Expand Up @@ -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,
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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 = {
Expand Down
8 changes: 4 additions & 4 deletions synadm/cli/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -75,19 +75,19 @@ def root(ctx, verbose, no_confirm, output, config_file):
@root.command(name="config")
@click.option(
"--user", "-u", "user_", type=str,
help="Admin user allowed to access the Synapse admin API's.")
help="Admin user allowed to access the Synapse Admin API's.")
@click.option(
"--token", "-t", type=str,
help="The Admin user's access token.")
@click.option(
"--base-url", "-b", type=str,
help="""The base URL Synapse is running on. Typically this is
https://localhost:8008 or https://localhost:8448. If Synapse is
configured to expose its admin API's to the outside world it might as
configured to expose its Admin API's to the outside world it might as
well be something like this: https://example.org:8448""")
@click.option(
"--admin-path", "-p", type=str,
help="""The path Synapse provides its admin API's, usually the default fits
help="""The path Synapse provides its Admin API's, usually the default fits
most installations.""")
@click.option(
"--matrix-path", "-m", type=str,
Expand Down Expand Up @@ -190,7 +190,7 @@ def get_redacted_token_prompt(cli_token):
default=base_url if base_url else helper.config.get(
"base_url", base_url)),
"admin_path": click.prompt(
"Synapse admin API path",
"Synapse Admin API path",
default=admin_path if admin_path else helper.config.get(
"admin_path", admin_path)),
"matrix_path": click.prompt(
Expand Down

0 comments on commit ae26ecf

Please sign in to comment.