Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Communication chat preview4 #16905

Merged
merged 16 commits into from
Mar 3, 2021
Merged
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
pylint-changes
sarkar-rajarshi committed Feb 24, 2021
commit 0f19fdb8df9e438b4993c695d94bf722933c41eb
Original file line number Diff line number Diff line change
@@ -575,8 +575,7 @@ def remove_participant(

return self._client.chat_thread.remove_chat_participant(
chat_thread_id=self._thread_id,
participant_communication_identifier=CommunicationUserIdentifierConverter._to_identifier_model(user),
# pylint:disable=protected-access
participant_communication_identifier=CommunicationUserIdentifierConverter.to_identifier_model(user),
**kwargs)

def close(self):
Original file line number Diff line number Diff line change
@@ -5,10 +5,12 @@
# ------------------------------------

from ._generated.models import ChatParticipant as ChatParticipantAutorest
from ._shared.models import CommunicationUserIdentifier
from ._generated.models import ChatMessageType
from ._utils import CommunicationUserIdentifierConverter

# pylint: disable=unused-import,ungrouped-imports
from ._shared.models import CommunicationUserIdentifier

class ChatThreadParticipant(object):
"""A participant of the chat thread.

@@ -36,16 +38,15 @@ def __init__(
@classmethod
def _from_generated(cls, chat_thread_participant):
return cls(
user=CommunicationUserIdentifierConverter._from_identifier_model(
chat_thread_participant.communication_identifier), # pylint:disable=protected-access
user=CommunicationUserIdentifierConverter.from_identifier_model(
chat_thread_participant.communication_identifier),
display_name=chat_thread_participant.display_name,
share_history_time=chat_thread_participant.share_history_time
)

def _to_generated(self):
return ChatParticipantAutorest(
communication_identifier=CommunicationUserIdentifierConverter._to_identifier_model(self.user),
# pylint:disable=protected-access
communication_identifier=CommunicationUserIdentifierConverter.to_identifier_model(self.user),
display_name=self.display_name,
share_history_time=self.share_history_time
)
@@ -113,8 +114,8 @@ def _from_generated(cls, chat_message):

sender_communication_identifier = chat_message.sender_communication_identifier
if sender_communication_identifier is not None:
sender_communication_identifier = CommunicationUserIdentifierConverter._from_identifier_model(
chat_message.sender_communication_identifier) # pylint:disable=protected-access
sender_communication_identifier = CommunicationUserIdentifierConverter.from_identifier_model(
chat_message.sender_communication_identifier)

return cls(
id=chat_message.id,
@@ -168,8 +169,8 @@ def _from_generated(cls, chat_message_content):
initiator = chat_message_content.initiator_communication_identifier
# check if initiator is populated
if initiator is not None:
initiator = CommunicationUserIdentifierConverter._from_identifier_model(
chat_message_content.initiator_communication_identifier) # pylint:disable=protected-access
initiator = CommunicationUserIdentifierConverter.from_identifier_model(
chat_message_content.initiator_communication_identifier)

return cls(
message=chat_message_content.message,
@@ -212,8 +213,8 @@ def _from_generated(cls, chat_thread):

created_by = chat_thread.created_by_communication_identifier
if created_by is not None:
created_by = CommunicationUserIdentifierConverter._from_identifier_model(
chat_thread.created_by_communication_identifier) # pylint:disable=protected-access
created_by = CommunicationUserIdentifierConverter.from_identifier_model(
chat_thread.created_by_communication_identifier)

return cls(
id=chat_thread.id,
@@ -252,8 +253,8 @@ def _from_generated(cls, read_receipt):

sender = read_receipt.sender_communication_identifier
if sender is not None:
sender = CommunicationUserIdentifierConverter._from_identifier_model(
read_receipt.sender_communication_identifier) # pylint:disable=protected-access
sender = CommunicationUserIdentifierConverter.from_identifier_model(
read_receipt.sender_communication_identifier)

return cls(
sender=sender,
Original file line number Diff line number Diff line change
@@ -17,7 +17,7 @@ class CommunicationUserIdentifierConverter(object):

"""
@classmethod
def _to_identifier_model(cls, communicationIdentifier):
def to_identifier_model(cls, communicationIdentifier):
"""
Util function to convert the Communication identifier into CommunicationIdentifierModel

@@ -31,7 +31,7 @@ def _to_identifier_model(cls, communicationIdentifier):
return CommunicationUserIdentifierSerializer.serialize(communicationIdentifier)

@classmethod
def _from_identifier_model(cls, identifierModel):
def from_identifier_model(cls, identifierModel):
"""
Util function to convert the CommunicationIdentifierModel into Communication Identifier

@@ -41,4 +41,4 @@ def _from_identifier_model(cls, identifierModel):
:rtype: Union[CommunicationUserIdentifier, CommunicationPhoneNumberIdentifier]
:rasies: ValueError
"""
return CommunicationUserIdentifierSerializer.deserialize(identifierModel)
return CommunicationUserIdentifierSerializer.deserialize(identifierModel)
Original file line number Diff line number Diff line change
@@ -560,8 +560,7 @@ async def remove_participant(

return await self._client.chat_thread.remove_chat_participant(
chat_thread_id=self._thread_id,
participant_communication_identifier=CommunicationUserIdentifierConverter._to_identifier_model(user),
# pylint:disable=protected-access
participant_communication_identifier=CommunicationUserIdentifierConverter.to_identifier_model(user),
**kwargs)

async def close(self) -> None: