From 89d2582bf70dca67599c42b5788c2321f128bba3 Mon Sep 17 00:00:00 2001 From: lemoer Date: Sat, 21 Dec 2024 00:35:28 +0100 Subject: [PATCH] SignalAPI: return updated group members in update_group_members() --- apitypes.py | 4 ++++ main.py | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/apitypes.py b/apitypes.py index a3568c5..357549c 100644 --- a/apitypes.py +++ b/apitypes.py @@ -61,6 +61,10 @@ class CreateGroupRequest(BaseModel): class CreateGroupResponse(BaseModel): id: str +class UpdateGroupResult(BaseModel): + members_added: List[str] + members_removed: List[str] + def test_reaction_message(): data = """{ "envelope": { diff --git a/main.py b/main.py index 4afd2a1..a3983ec 100644 --- a/main.py +++ b/main.py @@ -93,7 +93,7 @@ class SignalAPI: print("Failed to remove group members") print(r.json()) - def update_group_members(self, group_id: str, other_members: List[str]) -> Result[None, str]: + def update_group_members(self, group_id: str, other_members: List[str]) -> Result[UpdateGroupResult, str]: group = self.get_group(group_id) if is_err(group): return Err(group.unwrap_err()) @@ -121,7 +121,7 @@ class SignalAPI: if remove_result.is_err(): return Err(remove_result.unwrap_err()) - return Ok(None) + return Ok(UpdateGroupResult(members_added=members_to_add, members_removed=members_to_remove)) def get_identities(self) -> Result[List[IdentityEntry], str]: r = requests.get(f"{self.apiurl}/v1/identities/{self.number}")