From 89bce1e9e93eb9f5b1eccb519042796db4ae0052 Mon Sep 17 00:00:00 2001 From: Peter Nearing Date: Sat, 14 Sep 2024 09:30:04 -0400 Subject: [PATCH] Update to v0.5.11 and extend SignalContact attributes 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. --- pyproject.toml | 2 +- setup.cfg | 2 +- src/signal_cli_api/__init__.py | 2 +- src/signal_cli_api/signal_contact.py | 33 ++++++++++++++++++++++++++++ 4 files changed, 36 insertions(+), 3 deletions(-) diff --git a/pyproject.toml b/pyproject.toml index 157d165..ad3a222 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -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="me@peternearing.ca" } ] diff --git a/setup.cfg b/setup.cfg index 61b94cc..781220d 100644 --- a/setup.cfg +++ b/setup.cfg @@ -1,6 +1,6 @@ [metadata] name = SignalCliApi -version = 0.5.10.9 +version = 0.5.11 author = Peter Nearing author_email = me@peternearing.ca description = A python interface to the signal-cli found at https://github.com/AsamK/signal-cli diff --git a/src/signal_cli_api/__init__.py b/src/signal_cli_api/__init__.py index 7aad85d..5d95215 100644 --- a/src/signal_cli_api/__init__.py +++ b/src/signal_cli_api/__init__.py @@ -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 = 'me@peternearing.ca' diff --git a/src/signal_cli_api/signal_contact.py b/src/signal_cli_api/signal_contact.py index fed8d84..f5b78a5 100644 --- a/src/signal_cli_api/signal_contact.py +++ b/src/signal_cli_api/signal_contact.py @@ -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 @@ -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: @@ -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, @@ -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