Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
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
6 changes: 6 additions & 0 deletions sdk/communication/azure-communication-messages/_meta.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
{
"commit": "40904c4fa0c964f8b11c91a2b5afd9ae83cd6c4d",
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
"typespec_src": "specification/communication/Communication.Messages",
"@azure-tools/typespec-python": "0.38.4"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
{
"CrossLanguagePackageId": "Azure.Communication.MessagesService",
"CrossLanguageDefinitionId": {
"azure.communication.messages.models.ActionBindings": "Azure.Communication.MessagesService.ActionBindings",
"azure.communication.messages.models.ActionGroup": "Azure.Communication.MessagesService.ActionGroup",
"azure.communication.messages.models.MessageContent": "Azure.Communication.MessagesService.MessageContent",
"azure.communication.messages.models.ActionGroupContent": "Azure.Communication.MessagesService.ActionGroupContent",
"azure.communication.messages.models.ActionGroupItem": "Azure.Communication.MessagesService.ActionGroupItem",
"azure.communication.messages.models.NotificationContent": "Azure.Communication.MessagesService.NotificationContent",
"azure.communication.messages.models.AudioNotificationContent": "Azure.Communication.MessagesService.AudioNotificationContent",
"azure.communication.messages.models.ButtonContent": "Azure.Communication.MessagesService.ButtonContent",
"azure.communication.messages.models.ButtonSetContent": "Azure.Communication.MessagesService.ButtonSetContent",
"azure.communication.messages.models.DocumentMessageContent": "Azure.Communication.MessagesService.DocumentMessageContent",
"azure.communication.messages.models.DocumentNotificationContent": "Azure.Communication.MessagesService.DocumentNotificationContent",
"azure.communication.messages.models.ImageMessageContent": "Azure.Communication.MessagesService.ImageMessageContent",
"azure.communication.messages.models.ImageNotificationContent": "Azure.Communication.MessagesService.ImageNotificationContent",
"azure.communication.messages.models.InteractiveMessage": "Azure.Communication.MessagesService.InteractiveMessage",
"azure.communication.messages.models.InteractiveNotificationContent": "Azure.Communication.MessagesService.InteractiveNotificationContent",
"azure.communication.messages.models.LinkContent": "Azure.Communication.MessagesService.LinkContent",
"azure.communication.messages.models.MediaNotificationContent": "Azure.Communication.MessagesService.MediaNotificationContent",
"azure.communication.messages.models.MessageReceipt": "Azure.Communication.MessagesService.MessageReceipt",
"azure.communication.messages.models.MessageTemplate": "Azure.Communication.MessagesService.MessageTemplate",
"azure.communication.messages.models.MessageTemplateBindings": "Azure.Communication.MessagesService.MessageTemplateBindings",
"azure.communication.messages.models.MessageTemplateValue": "Azure.Communication.MessagesService.MessageTemplateValue",
"azure.communication.messages.models.MessageTemplateDocument": "Azure.Communication.MessagesService.MessageTemplateDocument",
"azure.communication.messages.models.MessageTemplateImage": "Azure.Communication.MessagesService.MessageTemplateImage",
"azure.communication.messages.models.MessageTemplateItem": "Azure.Communication.MessagesService.MessageTemplateItem",
"azure.communication.messages.models.MessageTemplateLocation": "Azure.Communication.MessagesService.MessageTemplateLocation",
"azure.communication.messages.models.MessageTemplateQuickAction": "Azure.Communication.MessagesService.MessageTemplateQuickAction",
"azure.communication.messages.models.MessageTemplateText": "Azure.Communication.MessagesService.MessageTemplateText",
"azure.communication.messages.models.MessageTemplateVideo": "Azure.Communication.MessagesService.MessageTemplateVideo",
"azure.communication.messages.models.ReactionNotificationContent": "Azure.Communication.MessagesService.ReactionNotificationContent",
"azure.communication.messages.models.SendMessageResult": "Azure.Communication.MessagesService.SendMessageResult",
"azure.communication.messages.models.StickerNotificationContent": "Azure.Communication.MessagesService.StickerNotificationContent",
"azure.communication.messages.models.TemplateNotificationContent": "Azure.Communication.MessagesService.TemplateNotificationContent",
"azure.communication.messages.models.TextMessageContent": "Azure.Communication.MessagesService.TextMessageContent",
"azure.communication.messages.models.TextNotificationContent": "Azure.Communication.MessagesService.TextNotificationContent",
"azure.communication.messages.models.VideoMessageContent": "Azure.Communication.MessagesService.VideoMessageContent",
"azure.communication.messages.models.VideoNotificationContent": "Azure.Communication.MessagesService.VideoNotificationContent",
"azure.communication.messages.models.WhatsAppButtonActionBindings": "Azure.Communication.MessagesService.WhatsAppButtonActionBindings",
"azure.communication.messages.models.WhatsAppListActionBindings": "Azure.Communication.MessagesService.WhatsAppListActionBindings",
"azure.communication.messages.models.WhatsAppMessageTemplateBindings": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindings",
"azure.communication.messages.models.WhatsAppMessageTemplateBindingsButton": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindingsButton",
"azure.communication.messages.models.WhatsAppMessageTemplateBindingsComponent": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindingsComponent",
"azure.communication.messages.models.WhatsAppMessageTemplateItem": "Azure.Communication.MessagesService.WhatsAppMessageTemplateItem",
"azure.communication.messages.models.WhatsAppUrlActionBindings": "Azure.Communication.MessagesService.WhatsAppUrlActionBindings",
"azure.communication.messages.models.RepeatabilityResult": "Azure.Core.RepeatabilityResult",
"azure.communication.messages.models.CommunicationMessageKind": "Azure.Communication.MessagesService.CommunicationMessageKind",
"azure.communication.messages.models.MessageContentKind": "Azure.Communication.MessagesService.MessageContentKind",
"azure.communication.messages.models.MessageActionBindingKind": "Azure.Communication.MessagesService.MessageActionBindingKind",
"azure.communication.messages.models.MessageTemplateValueKind": "Azure.Communication.MessagesService.MessageTemplateValueKind",
"azure.communication.messages.models.MessageTemplateBindingsKind": "Azure.Communication.MessagesService.MessageTemplateBindingsKind",
"azure.communication.messages.models.WhatsAppMessageButtonSubType": "Azure.Communication.MessagesService.WhatsAppMessageButtonSubType",
"azure.communication.messages.models.MessageTemplateStatus": "Azure.Communication.MessagesService.MessageTemplateStatus",
"azure.communication.messages.models.CommunicationMessagesChannel": "Azure.Communication.MessagesService.CommunicationMessagesChannel",
"azure.communication.messages.NotificationMessagesClient.send": "Azure.Communication.MessagesService.NotificationMessagesClient.send",
"azure.communication.messages.NotificationMessagesClient.download_media": "ClientForAcsMessages.NotificationMessagesClient.downloadMedia",
"azure.communication.messages.MessageTemplateClient.list_templates": "Azure.Communication.MessagesService.MessageTemplateClient.listTemplates"
}
}

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ class NotificationMessagesClient(NotificationMessagesClientOperationsMixin):
https://my-resource.communication.azure.com. Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Is either a token
credential type or a AzureKeyCredential type. Required.
credential type or a key credential type. Required.
:type credential: ~azure.core.credentials.TokenCredential or
~azure.core.credentials.AzureKeyCredential
:keyword api_version: The API version to use for this operation. Default value is
Expand Down Expand Up @@ -109,7 +109,7 @@ class MessageTemplateClient(MessageTemplateClientOperationsMixin):
https://my-resource.communication.azure.com. Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Is either a token
credential type or a AzureKeyCredential type. Required.
credential type or a key credential type. Required.
:type credential: ~azure.core.credentials.TokenCredential or
~azure.core.credentials.AzureKeyCredential
:keyword api_version: The API version to use for this operation. Default value is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ class NotificationMessagesClientConfiguration: # pylint: disable=too-many-insta
https://my-resource.communication.azure.com. Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Is either a token
credential type or a AzureKeyCredential type. Required.
credential type or a key credential type. Required.
:type credential: ~azure.core.credentials.TokenCredential or
~azure.core.credentials.AzureKeyCredential
:keyword api_version: The API version to use for this operation. Default value is
Expand Down Expand Up @@ -83,7 +83,7 @@ class MessageTemplateClientConfiguration: # pylint: disable=too-many-instance-a
https://my-resource.communication.azure.com. Required.
:type endpoint: str
:param credential: Credential used to authenticate requests to the service. Is either a token
credential type or a AzureKeyCredential type. Required.
credential type or a key credential type. Required.
:type credential: ~azure.core.credentials.TokenCredential or
~azure.core.credentials.AzureKeyCredential
:keyword api_version: The API version to use for this operation. Default value is
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -373,15 +373,34 @@ def __ne__(self, other: typing.Any) -> bool:
return not self.__eq__(other)

def keys(self) -> typing.KeysView[str]:
"""
:returns: a set-like object providing a view on D's keys
:rtype: ~typing.KeysView
"""
return self._data.keys()

def values(self) -> typing.ValuesView[typing.Any]:
"""
:returns: an object providing a view on D's values
:rtype: ~typing.ValuesView
"""
return self._data.values()

def items(self) -> typing.ItemsView[str, typing.Any]:
"""
:returns: set-like object providing a view on D's items
:rtype: ~typing.ItemsView
"""
return self._data.items()

def get(self, key: str, default: typing.Any = None) -> typing.Any:
"""
Get the value for key if key is in the dictionary, else default.
:param str key: The key to look up.
:param any default: The value to return if key is not in the dictionary. Defaults to None
:returns: D[k] if k in D, else d.
:rtype: any
"""
try:
return self[key]
except KeyError:
Expand All @@ -397,17 +416,38 @@ def pop(self, key: str, default: _T) -> _T: ...
def pop(self, key: str, default: typing.Any) -> typing.Any: ...

def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
"""
Removes specified key and return the corresponding value.
:param str key: The key to pop.
:param any default: The value to return if key is not in the dictionary
:returns: The value corresponding to the key.
:rtype: any
:raises KeyError: If key is not found and default is not given.
"""
if default is _UNSET:
return self._data.pop(key)
return self._data.pop(key, default)

def popitem(self) -> typing.Tuple[str, typing.Any]:
"""
Removes and returns some (key, value) pair
:returns: The (key, value) pair.
:rtype: tuple
:raises KeyError: if D is empty.
"""
return self._data.popitem()

def clear(self) -> None:
"""
Remove all items from D.
"""
self._data.clear()

def update(self, *args: typing.Any, **kwargs: typing.Any) -> None:
"""
Updates D from mapping/iterable E and F.
:param any args: Either a mapping object or an iterable of key-value pairs.
"""
self._data.update(*args, **kwargs)

@typing.overload
Expand All @@ -417,6 +457,13 @@ def setdefault(self, key: str, default: None = None) -> None: ...
def setdefault(self, key: str, default: typing.Any) -> typing.Any: ...

def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
"""
Same as calling D.get(k, d), and setting D[k]=d if k not found
:param str key: The key to look up.
:param any default: The value to set if key is not in the dictionary
:returns: D[k] if k in D, else d.
:rtype: any
"""
if default is _UNSET:
return self._data.setdefault(key)
return self._data.setdefault(key, default)
Expand Down Expand Up @@ -910,6 +957,19 @@ def _failsafe_deserialize(
return None


def _failsafe_deserialize_xml(
deserializer: typing.Any,
value: typing.Any,
) -> typing.Any:
try:
return _deserialize_xml(deserializer, value)
except DeserializationError:
_LOGGER.warning(
"Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True
)
return None


class _RestField:
def __init__(
self,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -74,22 +74,15 @@ def build_notification_messages_send_request(**kwargs: Any) -> HttpRequest:
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)


def build_notification_messages_download_media_request( # pylint: disable=name-too-long
id: str, **kwargs: Any
) -> HttpRequest:
def build_notification_messages_download_media_request(**kwargs: Any) -> HttpRequest: # pylint: disable=name-too-long
_headers = case_insensitive_dict(kwargs.pop("headers", {}) or {})
_params = case_insensitive_dict(kwargs.pop("params", {}) or {})

api_version: str = kwargs.pop("api_version", _params.pop("api-version", "2025-01-15-preview"))
accept = _headers.pop("Accept", "application/octet-stream")

# Construct URL
_url = "/messages/streams/{id}"
path_format_arguments = {
"id": _SERIALIZER.url("id", id, "str"),
}

_url: str = _url.format(**path_format_arguments) # type: ignore
_url = "/"

# Construct parameters
_params["api-version"] = _SERIALIZER.query("api_version", api_version, "str")
Expand Down Expand Up @@ -257,11 +250,9 @@ def send(
return deserialized # type: ignore

@distributed_trace
def download_media(self, id: str, **kwargs: Any) -> Iterator[bytes]:
def download_media(self, **kwargs: Any) -> Iterator[bytes]:
"""Download the Media payload from a User to Business message.

:param id: The stream ID. Required.
:type id: str
:return: Iterator[bytes]
:rtype: Iterator[bytes]
:raises ~azure.core.exceptions.HttpResponseError:
Expand All @@ -280,7 +271,6 @@ def download_media(self, id: str, **kwargs: Any) -> Iterator[bytes]:
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)

_request = build_notification_messages_download_media_request(
id=id,
api_version=self._config.api_version,
headers=_headers,
params=_params,
Expand Down
Loading