From fa0286c8d0cf960a89f80376bbb3abe2533dcdca Mon Sep 17 00:00:00 2001 From: Anupya Pamidimukkala Date: Sun, 29 Oct 2023 15:39:41 -0400 Subject: [PATCH] Implement `/team/{teamId}/pm-all` endpoint (#56) * Update berserk/clients/teams.py Co-authored-by: Benedikt Werner <1benediktwerner@gmail.com> * Update README.rst * Update teams.py --------- Co-authored-by: Benedikt Werner <1benediktwerner@gmail.com> --- README.rst | 1 + berserk/clients/teams.py | 10 ++++++++++ 2 files changed, 11 insertions(+) diff --git a/README.rst b/README.rst index 766a6dd..8b8be5b 100644 --- a/README.rst +++ b/README.rst @@ -172,6 +172,7 @@ Most of the API is available: client.teams.teams_of_player client.teams.get_popular client.teams.search + client.teams.message_all_members client.tournaments.get client.tournaments.get_tournament diff --git a/berserk/clients/teams.py b/berserk/clients/teams.py index ac3e971..ee27a5f 100644 --- a/berserk/clients/teams.py +++ b/berserk/clients/teams.py @@ -121,3 +121,13 @@ def search(self, text: str, page: int = 1) -> PaginatedTeams: path = "/api/team/search" params: Params = {"text": text, "page": page} return cast(PaginatedTeams, self._r.get(path, params=params)) + + def message_all_members(self, team_id: str, message: str) -> None: + """Send a private message to all members of a team. You must be the team leader with the "Messages" permission. + + :param team_id: team ID + :param message: message to send all team members + """ + path = f"/team/{team_id}/pm-all" + payload = {"message": message} + self._r.post(path=path, payload=payload)