Skip to content

Commit

Permalink
Update to v0.5.11 and extend SignalContact attributes
Browse files Browse the repository at this point in the history
Updated the version from 0.5.10.9 to 0.5.11 in setup.cfg and pyproject.toml. Added new attributes to SignalContact such as nick_name, nick_given_name, nick_family_name, is_hidden, note, and profile_sharing. This extends the functionality for handling contact details.
  • Loading branch information
pnearing committed Sep 14, 2024
1 parent da72111 commit 89bce1e
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 3 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ build-backend = "setuptools.build_meta"

[project]
name = "SignalCliAPi"
version = "0.5.10.9"
version = "0.5.11"
authors = [
{ name="Peter Nearing", email="[email protected]" }
]
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[metadata]
name = SignalCliApi
version = 0.5.10.9
version = 0.5.11
author = Peter Nearing
author_email = [email protected]
description = A python interface to the signal-cli found at https://github.com/AsamK/signal-cli
Expand Down
2 changes: 1 addition & 1 deletion src/signal_cli_api/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
File: __init__.py
Description: A python3 interface to signal-cli.
"""
__version__: str = '0.5.10.9'
__version__: str = '0.5.11'
__author__: str = 'Peter Nearing'
__email__: str = '[email protected]'

Expand Down
33 changes: 33 additions & 0 deletions src/signal_cli_api/signal_contact.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,6 +125,18 @@ def __init__(self,
"""The UUID of the contact."""
self.username: Optional[str] = None
"""The username of the contact."""
self.nick_name: Optional[str] = None
"""The nickname of the contact."""
self.nick_given_name: Optional[str] = None
"""The nick given name of the contact."""
self.nick_family_name: Optional[str] = None
"""The nick family name of the contact."""
self.is_hidden: bool = False
"""Whether this contact is hidden."""
self.note: Optional[str] = None
"""The note of the contact."""
self.profile_sharing: bool = False
"""Whether this contact is profile sharing."""
self.profile: Optional[SignalProfile] = None
"""The profile of the contact."""
self.devices: Optional[SignalDevices] = None
Expand Down Expand Up @@ -199,6 +211,15 @@ def __from_raw_contact__(self, raw_contact: dict[str, Any]) -> None:
self.number = raw_contact['number']
self.uuid = raw_contact['uuid']
self.username = raw_contact['username']


self.nick_name = raw_contact['nickName']
self.nick_given_name = raw_contact['nickGivenName']
self.nick_family_name = raw_contact['nickFamilyName']
self.is_hidden = raw_contact['isHidden']
self.note = raw_contact['note']
self.profile_sharing = raw_contact['profileSharing']

self.is_blocked = raw_contact['isBlocked']
self.color = raw_contact['color']
if raw_contact['messageExpirationTime'] == 0:
Expand Down Expand Up @@ -253,6 +274,12 @@ def __to_dict__(self) -> dict[str, Any]:
'number': self.number,
'uuid': self.uuid,
'username': self.username,
'nick_name': self.nick_name,
'nick_given_name': self.nick_given_name,
'nick_family_name': self.nick_family_name,
'is_hidden': self.is_hidden,
'note': self.note,
'profile_sharing': self.profile_sharing,
'profile': None,
'devices': None,
'isBlocked': self.is_blocked,
Expand Down Expand Up @@ -293,6 +320,12 @@ def __from_dict__(self, from_dict: dict[str, Any]) -> None:
self.number = from_dict['number']
self.uuid = from_dict['uuid']
self.username = from_dict['username']
self.nick_name = from_dict['nick_name']
self.nick_given_name = from_dict['nick_given_name']
self.nick_family_name = from_dict['nick_family_name']
self.is_hidden = from_dict['is_hidden']
self.note = from_dict['note']
self.profile_sharing = from_dict['profile_sharing']
self.is_blocked = from_dict['isBlocked']
self.is_typing = from_dict['isTyping']
self.expiration = None
Expand Down

0 comments on commit 89bce1e

Please sign in to comment.