Skip to content

Commit

Permalink
Implement /team/{teamId}/pm-all endpoint (#56)
Browse files Browse the repository at this point in the history
* Update berserk/clients/teams.py

Co-authored-by: Benedikt Werner <[email protected]>

* Update README.rst

* Update teams.py

---------

Co-authored-by: Benedikt Werner <[email protected]>
  • Loading branch information
Anupya and benediktwerner authored Oct 29, 2023
1 parent ec778ce commit fa0286c
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 0 deletions.
1 change: 1 addition & 0 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions berserk/clients/teams.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)

0 comments on commit fa0286c

Please sign in to comment.