diff --git a/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/__init__.py b/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/__init__.py index 5a3c0ca85620..eea4119d9489 100644 --- a/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/__init__.py +++ b/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/__init__.py @@ -22,9 +22,13 @@ from ._models_py3 import ChatThreadsInfoCollection from ._models_py3 import CommunicationError from ._models_py3 import CommunicationErrorResponse + from ._models_py3 import CommunicationIdentifierModel + from ._models_py3 import CommunicationUserIdentifierModel from ._models_py3 import CreateChatThreadErrors from ._models_py3 import CreateChatThreadRequest from ._models_py3 import CreateChatThreadResult + from ._models_py3 import MicrosoftTeamsUserIdentifierModel + from ._models_py3 import PhoneNumberIdentifierModel from ._models_py3 import SendChatMessageRequest from ._models_py3 import SendChatMessageResult from ._models_py3 import SendReadReceiptRequest @@ -46,9 +50,13 @@ from ._models import ChatThreadsInfoCollection # type: ignore from ._models import CommunicationError # type: ignore from ._models import CommunicationErrorResponse # type: ignore + from ._models import CommunicationIdentifierModel # type: ignore + from ._models import CommunicationUserIdentifierModel # type: ignore from ._models import CreateChatThreadErrors # type: ignore from ._models import CreateChatThreadRequest # type: ignore from ._models import CreateChatThreadResult # type: ignore + from ._models import MicrosoftTeamsUserIdentifierModel # type: ignore + from ._models import PhoneNumberIdentifierModel # type: ignore from ._models import SendChatMessageRequest # type: ignore from ._models import SendChatMessageResult # type: ignore from ._models import SendReadReceiptRequest # type: ignore @@ -57,6 +65,7 @@ from ._azure_communication_chat_service_enums import ( ChatMessageType, + CommunicationCloudEnvironmentModel, ) __all__ = [ @@ -75,13 +84,18 @@ 'ChatThreadsInfoCollection', 'CommunicationError', 'CommunicationErrorResponse', + 'CommunicationIdentifierModel', + 'CommunicationUserIdentifierModel', 'CreateChatThreadErrors', 'CreateChatThreadRequest', 'CreateChatThreadResult', + 'MicrosoftTeamsUserIdentifierModel', + 'PhoneNumberIdentifierModel', 'SendChatMessageRequest', 'SendChatMessageResult', 'SendReadReceiptRequest', 'UpdateChatMessageRequest', 'UpdateChatThreadRequest', 'ChatMessageType', + 'CommunicationCloudEnvironmentModel', ] diff --git a/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/_azure_communication_chat_service_enums.py b/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/_azure_communication_chat_service_enums.py index 9370f9fec0d7..0a32c53074ba 100644 --- a/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/_azure_communication_chat_service_enums.py +++ b/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/_azure_communication_chat_service_enums.py @@ -35,3 +35,11 @@ class ChatMessageType(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): TOPIC_UPDATED = "topicUpdated" PARTICIPANT_ADDED = "participantAdded" PARTICIPANT_REMOVED = "participantRemoved" + +class CommunicationCloudEnvironmentModel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): + """The cloud that the identifier belongs to. + """ + + PUBLIC = "public" + DOD = "dod" + GCCH = "gcch" diff --git a/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/_models.py b/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/_models.py index 999437af07cb..8ebf1b140cd7 100644 --- a/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/_models.py +++ b/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/_models.py @@ -294,6 +294,10 @@ class ChatParticipant(msrest.serialization.Model): :param id: Required. The id of the chat participant. :type id: str + :param identifier: Identifies a participant in Azure Communication services. A participant is, + for example, a phone number or an Azure communication user. This model must be interpreted as a + union: Apart from rawId, at most one further property may be set. + :type identifier: ~azure.communication.chat.models.CommunicationIdentifierModel :param display_name: Display name for the chat participant. :type display_name: str :param share_history_time: Time from which the chat history is shared with the participant. The @@ -307,6 +311,7 @@ class ChatParticipant(msrest.serialization.Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'share_history_time': {'key': 'shareHistoryTime', 'type': 'iso-8601'}, } @@ -317,6 +322,7 @@ def __init__( ): super(ChatParticipant, self).__init__(**kwargs) self.id = kwargs['id'] + self.identifier = kwargs.get('identifier', None) self.display_name = kwargs.get('display_name', None) self.share_history_time = kwargs.get('share_history_time', None) @@ -548,6 +554,62 @@ def __init__( self.error = kwargs['error'] +class CommunicationIdentifierModel(msrest.serialization.Model): + """Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. + + :param raw_id: Raw Id of the identifier. Optional in requests, required in responses. + :type raw_id: str + :param communication_user: The communication user. + :type communication_user: ~azure.communication.chat.models.CommunicationUserIdentifierModel + :param phone_number: The phone number. + :type phone_number: ~azure.communication.chat.models.PhoneNumberIdentifierModel + :param microsoft_teams_user: The Microsoft Teams user. + :type microsoft_teams_user: ~azure.communication.chat.models.MicrosoftTeamsUserIdentifierModel + """ + + _attribute_map = { + 'raw_id': {'key': 'rawId', 'type': 'str'}, + 'communication_user': {'key': 'communicationUser', 'type': 'CommunicationUserIdentifierModel'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'PhoneNumberIdentifierModel'}, + 'microsoft_teams_user': {'key': 'microsoftTeamsUser', 'type': 'MicrosoftTeamsUserIdentifierModel'}, + } + + def __init__( + self, + **kwargs + ): + super(CommunicationIdentifierModel, self).__init__(**kwargs) + self.raw_id = kwargs.get('raw_id', None) + self.communication_user = kwargs.get('communication_user', None) + self.phone_number = kwargs.get('phone_number', None) + self.microsoft_teams_user = kwargs.get('microsoft_teams_user', None) + + +class CommunicationUserIdentifierModel(msrest.serialization.Model): + """A user that got created with an Azure Communication Services resource. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The Id of the communication user. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(CommunicationUserIdentifierModel, self).__init__(**kwargs) + self.id = kwargs['id'] + + class CreateChatThreadErrors(msrest.serialization.Model): """Errors encountered during the creation of the chat thread. @@ -626,6 +688,67 @@ def __init__( self.errors = kwargs.get('errors', None) +class MicrosoftTeamsUserIdentifierModel(msrest.serialization.Model): + """A Microsoft Teams user. + + All required parameters must be populated in order to send to Azure. + + :param user_id: Required. The Id of the Microsoft Teams user. If not anonymous, this is the AAD + object Id of the user. + :type user_id: str + :param is_anonymous: True if the Microsoft Teams user is anonymous. By default false if + missing. + :type is_anonymous: bool + :param cloud: The cloud that the Microsoft Teams user belongs to. By default 'public' if + missing. Possible values include: "public", "dod", "gcch". + :type cloud: str or ~azure.communication.chat.models.CommunicationCloudEnvironmentModel + """ + + _validation = { + 'user_id': {'required': True}, + } + + _attribute_map = { + 'user_id': {'key': 'userId', 'type': 'str'}, + 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, + 'cloud': {'key': 'cloud', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(MicrosoftTeamsUserIdentifierModel, self).__init__(**kwargs) + self.user_id = kwargs['user_id'] + self.is_anonymous = kwargs.get('is_anonymous', None) + self.cloud = kwargs.get('cloud', None) + + +class PhoneNumberIdentifierModel(msrest.serialization.Model): + """A phone number. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The phone number in E.164 format. + :type value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + **kwargs + ): + super(PhoneNumberIdentifierModel, self).__init__(**kwargs) + self.value = kwargs['value'] + + class SendChatMessageRequest(msrest.serialization.Model): """Details of the message to send. diff --git a/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/_models_py3.py b/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/_models_py3.py index 8da8a31bc35c..95e1db633d98 100644 --- a/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/_models_py3.py +++ b/sdk/communication/azure-communication-chat/azure/communication/chat/_generated/models/_models_py3.py @@ -329,6 +329,10 @@ class ChatParticipant(msrest.serialization.Model): :param id: Required. The id of the chat participant. :type id: str + :param identifier: Identifies a participant in Azure Communication services. A participant is, + for example, a phone number or an Azure communication user. This model must be interpreted as a + union: Apart from rawId, at most one further property may be set. + :type identifier: ~azure.communication.chat.models.CommunicationIdentifierModel :param display_name: Display name for the chat participant. :type display_name: str :param share_history_time: Time from which the chat history is shared with the participant. The @@ -342,6 +346,7 @@ class ChatParticipant(msrest.serialization.Model): _attribute_map = { 'id': {'key': 'id', 'type': 'str'}, + 'identifier': {'key': 'identifier', 'type': 'CommunicationIdentifierModel'}, 'display_name': {'key': 'displayName', 'type': 'str'}, 'share_history_time': {'key': 'shareHistoryTime', 'type': 'iso-8601'}, } @@ -350,12 +355,14 @@ def __init__( self, *, id: str, + identifier: Optional["CommunicationIdentifierModel"] = None, display_name: Optional[str] = None, share_history_time: Optional[datetime.datetime] = None, **kwargs ): super(ChatParticipant, self).__init__(**kwargs) self.id = id + self.identifier = identifier self.display_name = display_name self.share_history_time = share_history_time @@ -606,6 +613,69 @@ def __init__( self.error = error +class CommunicationIdentifierModel(msrest.serialization.Model): + """Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. + + :param raw_id: Raw Id of the identifier. Optional in requests, required in responses. + :type raw_id: str + :param communication_user: The communication user. + :type communication_user: ~azure.communication.chat.models.CommunicationUserIdentifierModel + :param phone_number: The phone number. + :type phone_number: ~azure.communication.chat.models.PhoneNumberIdentifierModel + :param microsoft_teams_user: The Microsoft Teams user. + :type microsoft_teams_user: ~azure.communication.chat.models.MicrosoftTeamsUserIdentifierModel + """ + + _attribute_map = { + 'raw_id': {'key': 'rawId', 'type': 'str'}, + 'communication_user': {'key': 'communicationUser', 'type': 'CommunicationUserIdentifierModel'}, + 'phone_number': {'key': 'phoneNumber', 'type': 'PhoneNumberIdentifierModel'}, + 'microsoft_teams_user': {'key': 'microsoftTeamsUser', 'type': 'MicrosoftTeamsUserIdentifierModel'}, + } + + def __init__( + self, + *, + raw_id: Optional[str] = None, + communication_user: Optional["CommunicationUserIdentifierModel"] = None, + phone_number: Optional["PhoneNumberIdentifierModel"] = None, + microsoft_teams_user: Optional["MicrosoftTeamsUserIdentifierModel"] = None, + **kwargs + ): + super(CommunicationIdentifierModel, self).__init__(**kwargs) + self.raw_id = raw_id + self.communication_user = communication_user + self.phone_number = phone_number + self.microsoft_teams_user = microsoft_teams_user + + +class CommunicationUserIdentifierModel(msrest.serialization.Model): + """A user that got created with an Azure Communication Services resource. + + All required parameters must be populated in order to send to Azure. + + :param id: Required. The Id of the communication user. + :type id: str + """ + + _validation = { + 'id': {'required': True}, + } + + _attribute_map = { + 'id': {'key': 'id', 'type': 'str'}, + } + + def __init__( + self, + *, + id: str, + **kwargs + ): + super(CommunicationUserIdentifierModel, self).__init__(**kwargs) + self.id = id + + class CreateChatThreadErrors(msrest.serialization.Model): """Errors encountered during the creation of the chat thread. @@ -690,6 +760,73 @@ def __init__( self.errors = errors +class MicrosoftTeamsUserIdentifierModel(msrest.serialization.Model): + """A Microsoft Teams user. + + All required parameters must be populated in order to send to Azure. + + :param user_id: Required. The Id of the Microsoft Teams user. If not anonymous, this is the AAD + object Id of the user. + :type user_id: str + :param is_anonymous: True if the Microsoft Teams user is anonymous. By default false if + missing. + :type is_anonymous: bool + :param cloud: The cloud that the Microsoft Teams user belongs to. By default 'public' if + missing. Possible values include: "public", "dod", "gcch". + :type cloud: str or ~azure.communication.chat.models.CommunicationCloudEnvironmentModel + """ + + _validation = { + 'user_id': {'required': True}, + } + + _attribute_map = { + 'user_id': {'key': 'userId', 'type': 'str'}, + 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, + 'cloud': {'key': 'cloud', 'type': 'str'}, + } + + def __init__( + self, + *, + user_id: str, + is_anonymous: Optional[bool] = None, + cloud: Optional[Union[str, "CommunicationCloudEnvironmentModel"]] = None, + **kwargs + ): + super(MicrosoftTeamsUserIdentifierModel, self).__init__(**kwargs) + self.user_id = user_id + self.is_anonymous = is_anonymous + self.cloud = cloud + + +class PhoneNumberIdentifierModel(msrest.serialization.Model): + """A phone number. + + All required parameters must be populated in order to send to Azure. + + :param value: Required. The phone number in E.164 format. + :type value: str + """ + + _validation = { + 'value': {'required': True}, + } + + _attribute_map = { + 'value': {'key': 'value', 'type': 'str'}, + } + + def __init__( + self, + *, + value: str, + **kwargs + ): + super(PhoneNumberIdentifierModel, self).__init__(**kwargs) + self.value = value + + class SendChatMessageRequest(msrest.serialization.Model): """Details of the message to send. diff --git a/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/__init__.py b/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/__init__.py index 5c8510f6128a..e69de29bb2d1 100644 --- a/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/__init__.py +++ b/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/__init__.py @@ -1,34 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6369, generator: {generator}) -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- - -try: - from ._models_py3 import CommunicationError - from ._models_py3 import CommunicationErrorResponse - from ._models_py3 import CommunicationIdentifierModel - from ._models_py3 import CommunicationUserIdentifierModel - from ._models_py3 import MicrosoftTeamsUserIdentifierModel - from ._models_py3 import PhoneNumberIdentifierModel -except (SyntaxError, ImportError): - from .models import CommunicationError # type: ignore - from .models import CommunicationErrorResponse # type: ignore - from .models import CommunicationIdentifierModel # type: ignore - from .models import CommunicationUserIdentifierModel # type: ignore - from .models import MicrosoftTeamsUserIdentifierModel # type: ignore - from .models import PhoneNumberIdentifierModel # type: ignore - -from .models import ( - CommunicationCloudEnvironmentModel, -) - -__all__ = [ - 'CommunicationError', - 'CommunicationErrorResponse', - 'CommunicationIdentifierModel', - 'CommunicationUserIdentifierModel', - 'MicrosoftTeamsUserIdentifierModel', - 'PhoneNumberIdentifierModel', - 'CommunicationCloudEnvironmentModel', -] diff --git a/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/_models_py3.py b/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/_models_py3.py deleted file mode 100644 index 9fda61e303f5..000000000000 --- a/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/_models_py3.py +++ /dev/null @@ -1,219 +0,0 @@ -# coding=utf-8 -# -------------------------------------------------------------------------- -# Code generated by Microsoft (R) AutoRest Code Generator (autorest: 3.0.6369, generator: {generator}) -# Changes may cause incorrect behavior and will be lost if the code is regenerated. -# -------------------------------------------------------------------------- -# pylint: skip-file - -from typing import Optional, Union - -import msrest.serialization - -from ._communication_enums import * - - -class CommunicationError(msrest.serialization.Model): - """The Communication Services error. - - Variables are only populated by the server, and will be ignored when sending a request. - - All required parameters must be populated in order to send to Azure. - - :param code: Required. The error code. - :type code: str - :param message: Required. The error message. - :type message: str - :ivar target: The error target. - :vartype target: str - :ivar details: Further details about specific errors that led to this error. - :vartype details: list[~communication.models.CommunicationError] - :ivar inner_error: The inner error if any. - :vartype inner_error: ~communication.models.CommunicationError - """ - - _validation = { - 'code': {'required': True}, - 'message': {'required': True}, - 'target': {'readonly': True}, - 'details': {'readonly': True}, - 'inner_error': {'readonly': True}, - } - - _attribute_map = { - 'code': {'key': 'code', 'type': 'str'}, - 'message': {'key': 'message', 'type': 'str'}, - 'target': {'key': 'target', 'type': 'str'}, - 'details': {'key': 'details', 'type': '[CommunicationError]'}, - 'inner_error': {'key': 'innererror', 'type': 'CommunicationError'}, - } - - def __init__( - self, - *, - code: str, - message: str, - **kwargs - ): - super(CommunicationError, self).__init__(**kwargs) - self.code = code - self.message = message - self.target = None - self.details = None - self.inner_error = None - - -class CommunicationErrorResponse(msrest.serialization.Model): - """The Communication Services error. - - All required parameters must be populated in order to send to Azure. - - :param error: Required. The Communication Services error. - :type error: ~communication.models.CommunicationError - """ - - _validation = { - 'error': {'required': True}, - } - - _attribute_map = { - 'error': {'key': 'error', 'type': 'CommunicationError'}, - } - - def __init__( - self, - *, - error: "CommunicationError", - **kwargs - ): - super(CommunicationErrorResponse, self).__init__(**kwargs) - self.error = error - - -class CommunicationIdentifierModel(msrest.serialization.Model): - """Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. - - :param raw_id: Raw Id of the identifier. Optional in requests, required in responses. - :type raw_id: str - :param communication_user: The communication user. - :type communication_user: ~communication.models.CommunicationUserIdentifierModel - :param phone_number: The phone number. - :type phone_number: ~communication.models.PhoneNumberIdentifierModel - :param microsoft_teams_user: The Microsoft Teams user. - :type microsoft_teams_user: ~communication.models.MicrosoftTeamsUserIdentifierModel - """ - - _attribute_map = { - 'raw_id': {'key': 'rawId', 'type': 'str'}, - 'communication_user': {'key': 'communicationUser', 'type': 'CommunicationUserIdentifierModel'}, - 'phone_number': {'key': 'phoneNumber', 'type': 'PhoneNumberIdentifierModel'}, - 'microsoft_teams_user': {'key': 'microsoftTeamsUser', 'type': 'MicrosoftTeamsUserIdentifierModel'}, - } - - def __init__( - self, - *, - raw_id: Optional[str] = None, - communication_user: Optional["CommunicationUserIdentifierModel"] = None, - phone_number: Optional["PhoneNumberIdentifierModel"] = None, - microsoft_teams_user: Optional["MicrosoftTeamsUserIdentifierModel"] = None, - **kwargs - ): - super(CommunicationIdentifierModel, self).__init__(**kwargs) - self.raw_id = raw_id - self.communication_user = communication_user - self.phone_number = phone_number - self.microsoft_teams_user = microsoft_teams_user - - -class CommunicationUserIdentifierModel(msrest.serialization.Model): - """A user that got created with an Azure Communication Services resource. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The Id of the communication user. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - *, - id: str, - **kwargs - ): - super(CommunicationUserIdentifierModel, self).__init__(**kwargs) - self.id = id - - -class MicrosoftTeamsUserIdentifierModel(msrest.serialization.Model): - """A Microsoft Teams user. - - All required parameters must be populated in order to send to Azure. - - :param user_id: Required. The Id of the Microsoft Teams user. If not anonymous, this is the AAD - object Id of the user. - :type user_id: str - :param is_anonymous: True if the Microsoft Teams user is anonymous. By default false if - missing. - :type is_anonymous: bool - :param cloud: The cloud that the Microsoft Teams user belongs to. By default 'public' if - missing. Possible values include: "public", "dod", "gcch". - :type cloud: str or ~communication.models.CommunicationCloudEnvironmentModel - """ - - _validation = { - 'user_id': {'required': True}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, - 'cloud': {'key': 'cloud', 'type': 'str'}, - } - - def __init__( - self, - *, - user_id: str, - is_anonymous: Optional[bool] = None, - cloud: Optional[Union[str, "CommunicationCloudEnvironmentModel"]] = None, - **kwargs - ): - super(MicrosoftTeamsUserIdentifierModel, self).__init__(**kwargs) - self.user_id = user_id - self.is_anonymous = is_anonymous - self.cloud = cloud - - -class PhoneNumberIdentifierModel(msrest.serialization.Model): - """A phone number. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The phone number in E.164 format. - :type value: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - *, - value: str, - **kwargs - ): - super(PhoneNumberIdentifierModel, self).__init__(**kwargs) - self.value = value diff --git a/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/models.py b/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/models.py index 4508542d92ae..4aff60e0c4df 100644 --- a/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/models.py +++ b/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/models.py @@ -116,121 +116,6 @@ class UnknownIdentifier(object): def __init__(self, identifier): self.identifier = identifier -class CommunicationIdentifierModel(msrest.serialization.Model): - """Identifies a participant in Azure Communication services. A participant is, for example, a phone number or an Azure communication user. This model must be interpreted as a union: Apart from rawId, at most one further property may be set. - - :param raw_id: Raw Id of the identifier. Optional in requests, required in responses. - :type raw_id: str - :param communication_user: The communication user. - :type communication_user: ~communication.models.CommunicationUserIdentifierModel - :param phone_number: The phone number. - :type phone_number: ~communication.models.PhoneNumberIdentifierModel - :param microsoft_teams_user: The Microsoft Teams user. - :type microsoft_teams_user: ~communication.models.MicrosoftTeamsUserIdentifierModel - """ - - _attribute_map = { - 'raw_id': {'key': 'rawId', 'type': 'str'}, - 'communication_user': {'key': 'communicationUser', 'type': 'CommunicationUserIdentifierModel'}, - 'phone_number': {'key': 'phoneNumber', 'type': 'PhoneNumberIdentifierModel'}, - 'microsoft_teams_user': {'key': 'microsoftTeamsUser', 'type': 'MicrosoftTeamsUserIdentifierModel'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunicationIdentifierModel, self).__init__(**kwargs) - self.raw_id = kwargs.get('raw_id', None) - self.communication_user = kwargs.get('communication_user', None) - self.phone_number = kwargs.get('phone_number', None) - self.microsoft_teams_user = kwargs.get('microsoft_teams_user', None) - -class CommunicationUserIdentifierModel(msrest.serialization.Model): - """A user that got created with an Azure Communication Services resource. - - All required parameters must be populated in order to send to Azure. - - :param id: Required. The Id of the communication user. - :type id: str - """ - - _validation = { - 'id': {'required': True}, - } - - _attribute_map = { - 'id': {'key': 'id', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunicationUserIdentifierModel, self).__init__(**kwargs) - self.id = kwargs['id'] - - -class MicrosoftTeamsUserIdentifierModel(msrest.serialization.Model): - """A Microsoft Teams user. - - All required parameters must be populated in order to send to Azure. - - :param user_id: Required. The Id of the Microsoft Teams user. If not anonymous, this is the AAD - object Id of the user. - :type user_id: str - :param is_anonymous: True if the Microsoft Teams user is anonymous. By default false if - missing. - :type is_anonymous: bool - :param cloud: The cloud that the Microsoft Teams user belongs to. By default 'public' if - missing. Possible values include: "public", "dod", "gcch". - :type cloud: str or ~communication.models.CommunicationCloudEnvironmentModel - """ - - _validation = { - 'user_id': {'required': True}, - } - - _attribute_map = { - 'user_id': {'key': 'userId', 'type': 'str'}, - 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, - 'cloud': {'key': 'cloud', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(MicrosoftTeamsUserIdentifierModel, self).__init__(**kwargs) - self.user_id = kwargs['user_id'] - self.is_anonymous = kwargs.get('is_anonymous', None) - self.cloud = kwargs.get('cloud', None) - - -class PhoneNumberIdentifierModel(msrest.serialization.Model): - """A phone number. - - All required parameters must be populated in order to send to Azure. - - :param value: Required. The phone number in E.164 format. - :type value: str - """ - - _validation = { - 'value': {'required': True}, - } - - _attribute_map = { - 'value': {'key': 'value', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(PhoneNumberIdentifierModel, self).__init__(**kwargs) - self.value = kwargs['value'] - class _CaseInsensitiveEnumMeta(EnumMeta): def __getitem__(self, name): return super().__getitem__(name.upper()) @@ -247,14 +132,6 @@ def __getattr__(cls, name): except KeyError: raise AttributeError(name) -class CommunicationCloudEnvironmentModel(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): - """The cloud that the identifier belongs to. - """ - - PUBLIC = "public" - DOD = "dod" - GCCH = "gcch" - class CommunicationCloudEnvironment(with_metaclass(_CaseInsensitiveEnumMeta, str, Enum)): """ The cloud enviornment that the identifier belongs to diff --git a/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/communication_identifier_serializer.py b/sdk/communication/azure-communication-chat/azure/communication/chat/communication_identifier_serializer.py similarity index 98% rename from sdk/communication/azure-communication-chat/azure/communication/chat/_shared/communication_identifier_serializer.py rename to sdk/communication/azure-communication-chat/azure/communication/chat/communication_identifier_serializer.py index 1081930782bf..972716b833be 100644 --- a/sdk/communication/azure-communication-chat/azure/communication/chat/_shared/communication_identifier_serializer.py +++ b/sdk/communication/azure-communication-chat/azure/communication/chat/communication_identifier_serializer.py @@ -4,15 +4,17 @@ # license information. # -------------------------------------------------------------------------- -from .models import ( +from ._generated.models import ( CommunicationIdentifierModel, + CommunicationUserIdentifierModel, + PhoneNumberIdentifierModel, + MicrosoftTeamsUserIdentifierModel +) +from ._shared.models import ( CommunicationUserIdentifier, PhoneNumberIdentifier, MicrosoftTeamsUserIdentifier, UnknownIdentifier, - CommunicationUserIdentifierModel, - PhoneNumberIdentifierModel, - MicrosoftTeamsUserIdentifierModel ) class CommunicationUserIdentifierSerializer(object): diff --git a/sdk/communication/azure-communication-chat/tests/_shared/test_communication_identifier_serializer.py b/sdk/communication/azure-communication-chat/tests/_shared/test_communication_identifier_serializer.py index 16b521218906..64bf4e403851 100644 --- a/sdk/communication/azure-communication-chat/tests/_shared/test_communication_identifier_serializer.py +++ b/sdk/communication/azure-communication-chat/tests/_shared/test_communication_identifier_serializer.py @@ -4,17 +4,19 @@ # license information. # ------------------------------------------------------------------------- import unittest -from azure.communication.chat._shared.communication_identifier_serializer import CommunicationUserIdentifierSerializer -from azure.communication.chat._shared.models import( +from azure.communication.chat.communication_identifier_serializer import CommunicationUserIdentifierSerializer +from azure.communication.chat._generated.models import( CommunicationIdentifierModel, + MicrosoftTeamsUserIdentifierModel, + CommunicationUserIdentifierModel, + PhoneNumberIdentifierModel +) +from azure.communication.chat._shared.models import( CommunicationUserIdentifier, CommunicationCloudEnvironment, UnknownIdentifier, PhoneNumberIdentifier, - MicrosoftTeamsUserIdentifier, - MicrosoftTeamsUserIdentifierModel, - CommunicationUserIdentifierModel, - PhoneNumberIdentifierModel + MicrosoftTeamsUserIdentifier ) class CommunicationUserIdentifierSerializerTest(unittest.TestCase): diff --git a/sdk/communication/azure-communication-identity/azure/communication/identity/_shared/models.py b/sdk/communication/azure-communication-identity/azure/communication/identity/_shared/models.py index 2e64b18dc068..83bab3945635 100644 --- a/sdk/communication/azure-communication-identity/azure/communication/identity/_shared/models.py +++ b/sdk/communication/azure-communication-identity/azure/communication/identity/_shared/models.py @@ -45,50 +45,6 @@ class UnknownIdentifier(object): def __init__(self, identifier): self.identifier = identifier -class CommunicationIdentifierModel(msrest.serialization.Model): - """Communication Identifier Model. - - All required parameters must be populated in order to send to Azure. - - :param kind: Required. Kind of Communication Identifier. - :type kind: CommunicationIdentifierKind - :param id: Full id of the identifier. - :type id: str - :param phone_number: phone number in case the identifier is a phone number. - :type phone_number: str - :param is_anonymous: True if the identifier is anonymous. - :type is_anonymous: bool - :param microsoft_teams_user_id: Microsoft Teams user id. - :type microsoft_teams_user_id: str - :param communication_cloud_environment: Cloud environment that the user belongs to. - :type communication_cloud_environment: CommunicationCloudEnvironment - """ - - _validation = { - 'kind': {'required': True}, - } - - _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, - 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, - 'microsoft_teams_user_id': {'key': 'microsoftTeamsUserId', 'type': 'str'}, - 'communication_cloud_environment': {'key': 'communicationCloudEnvironment', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunicationIdentifierModel, self).__init__(**kwargs) - self.kind = kwargs['kind'] - self.id = kwargs.get('id', None) - self.phone_number = kwargs.get('phone_number', None) - self.is_anonymous = kwargs.get('is_anonymous', None) - self.microsoft_teams_user_id = kwargs.get('microsoft_teams_user_id', None) - self.communication_cloud_environment = kwargs.get('communication_cloud_environment', None) - class _CaseInsensitiveEnumMeta(EnumMeta): def __getitem__(cls, name): return super().__getitem__(name.upper()) diff --git a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_shared/models.py b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_shared/models.py index 2e64b18dc068..83bab3945635 100644 --- a/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_shared/models.py +++ b/sdk/communication/azure-communication-phonenumbers/azure/communication/phonenumbers/_shared/models.py @@ -45,50 +45,6 @@ class UnknownIdentifier(object): def __init__(self, identifier): self.identifier = identifier -class CommunicationIdentifierModel(msrest.serialization.Model): - """Communication Identifier Model. - - All required parameters must be populated in order to send to Azure. - - :param kind: Required. Kind of Communication Identifier. - :type kind: CommunicationIdentifierKind - :param id: Full id of the identifier. - :type id: str - :param phone_number: phone number in case the identifier is a phone number. - :type phone_number: str - :param is_anonymous: True if the identifier is anonymous. - :type is_anonymous: bool - :param microsoft_teams_user_id: Microsoft Teams user id. - :type microsoft_teams_user_id: str - :param communication_cloud_environment: Cloud environment that the user belongs to. - :type communication_cloud_environment: CommunicationCloudEnvironment - """ - - _validation = { - 'kind': {'required': True}, - } - - _attribute_map = { - 'kind': {'key': 'kind', 'type': 'str'}, - 'id': {'key': 'id', 'type': 'str'}, - 'phone_number': {'key': 'phoneNumber', 'type': 'str'}, - 'is_anonymous': {'key': 'isAnonymous', 'type': 'bool'}, - 'microsoft_teams_user_id': {'key': 'microsoftTeamsUserId', 'type': 'str'}, - 'communication_cloud_environment': {'key': 'communicationCloudEnvironment', 'type': 'str'}, - } - - def __init__( - self, - **kwargs - ): - super(CommunicationIdentifierModel, self).__init__(**kwargs) - self.kind = kwargs['kind'] - self.id = kwargs.get('id', None) - self.phone_number = kwargs.get('phone_number', None) - self.is_anonymous = kwargs.get('is_anonymous', None) - self.microsoft_teams_user_id = kwargs.get('microsoft_teams_user_id', None) - self.communication_cloud_environment = kwargs.get('communication_cloud_environment', None) - class _CaseInsensitiveEnumMeta(EnumMeta): def __getitem__(cls, name): return super().__getitem__(name.upper())