SignalAPI: return updated group members in update_group_members()

This commit is contained in:
lemoer 2024-12-21 00:35:28 +01:00
parent 6870d274b5
commit 89d2582bf7
2 changed files with 6 additions and 2 deletions

View File

@ -61,6 +61,10 @@ class CreateGroupRequest(BaseModel):
class CreateGroupResponse(BaseModel): class CreateGroupResponse(BaseModel):
id: str id: str
class UpdateGroupResult(BaseModel):
members_added: List[str]
members_removed: List[str]
def test_reaction_message(): def test_reaction_message():
data = """{ data = """{
"envelope": { "envelope": {

View File

@ -93,7 +93,7 @@ class SignalAPI:
print("Failed to remove group members") print("Failed to remove group members")
print(r.json()) 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) group = self.get_group(group_id)
if is_err(group): if is_err(group):
return Err(group.unwrap_err()) return Err(group.unwrap_err())
@ -121,7 +121,7 @@ class SignalAPI:
if remove_result.is_err(): if remove_result.is_err():
return Err(remove_result.unwrap_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]: def get_identities(self) -> Result[List[IdentityEntry], str]:
r = requests.get(f"{self.apiurl}/v1/identities/{self.number}") r = requests.get(f"{self.apiurl}/v1/identities/{self.number}")