Skip to content

Commit

Permalink
Merge pull request #1 from Anupya/Anupya/add-message-all-members-endp…
Browse files Browse the repository at this point in the history
…oint

Implement `/team/{teamId}/pm-all`
  • Loading branch information
Anupya authored Oct 22, 2023
2 parents c65d17c + e03ece1 commit 26bebad
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
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(self, team_id: str, message: str):
"""Send a private message to all members of a team. You must own the team.
: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 26bebad

Please sign in to comment.