Skip to content

Commit 252dcbb

Browse files
author
SDKAuto
committed
CodeGen from PR 32475 in Azure/azure-rest-api-specs
Merge 0fb7ec89a31887a71abf89f3ff95c798f0791536 into fcd1c4977ad31417ab298205e87727c4cc8474f1
1 parent a6f978c commit 252dcbb

File tree

53 files changed

+630
-1545
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

53 files changed

+630
-1545
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "40904c4fa0c964f8b11c91a2b5afd9ae83cd6c4d",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/communication/Communication.Messages",
5+
"@azure-tools/typespec-python": "0.38.4"
6+
}
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
{
2+
"CrossLanguagePackageId": "Azure.Communication.MessagesService",
3+
"CrossLanguageDefinitionId": {
4+
"azure.communication.messages.models.ActionBindings": "Azure.Communication.MessagesService.ActionBindings",
5+
"azure.communication.messages.models.ActionGroup": "Azure.Communication.MessagesService.ActionGroup",
6+
"azure.communication.messages.models.MessageContent": "Azure.Communication.MessagesService.MessageContent",
7+
"azure.communication.messages.models.ActionGroupContent": "Azure.Communication.MessagesService.ActionGroupContent",
8+
"azure.communication.messages.models.ActionGroupItem": "Azure.Communication.MessagesService.ActionGroupItem",
9+
"azure.communication.messages.models.NotificationContent": "Azure.Communication.MessagesService.NotificationContent",
10+
"azure.communication.messages.models.AudioNotificationContent": "Azure.Communication.MessagesService.AudioNotificationContent",
11+
"azure.communication.messages.models.ButtonContent": "Azure.Communication.MessagesService.ButtonContent",
12+
"azure.communication.messages.models.ButtonSetContent": "Azure.Communication.MessagesService.ButtonSetContent",
13+
"azure.communication.messages.models.DocumentMessageContent": "Azure.Communication.MessagesService.DocumentMessageContent",
14+
"azure.communication.messages.models.DocumentNotificationContent": "Azure.Communication.MessagesService.DocumentNotificationContent",
15+
"azure.communication.messages.models.ImageMessageContent": "Azure.Communication.MessagesService.ImageMessageContent",
16+
"azure.communication.messages.models.ImageNotificationContent": "Azure.Communication.MessagesService.ImageNotificationContent",
17+
"azure.communication.messages.models.InteractiveMessage": "Azure.Communication.MessagesService.InteractiveMessage",
18+
"azure.communication.messages.models.InteractiveNotificationContent": "Azure.Communication.MessagesService.InteractiveNotificationContent",
19+
"azure.communication.messages.models.LinkContent": "Azure.Communication.MessagesService.LinkContent",
20+
"azure.communication.messages.models.MediaNotificationContent": "Azure.Communication.MessagesService.MediaNotificationContent",
21+
"azure.communication.messages.models.MessageReceipt": "Azure.Communication.MessagesService.MessageReceipt",
22+
"azure.communication.messages.models.MessageTemplate": "Azure.Communication.MessagesService.MessageTemplate",
23+
"azure.communication.messages.models.MessageTemplateBindings": "Azure.Communication.MessagesService.MessageTemplateBindings",
24+
"azure.communication.messages.models.MessageTemplateValue": "Azure.Communication.MessagesService.MessageTemplateValue",
25+
"azure.communication.messages.models.MessageTemplateDocument": "Azure.Communication.MessagesService.MessageTemplateDocument",
26+
"azure.communication.messages.models.MessageTemplateImage": "Azure.Communication.MessagesService.MessageTemplateImage",
27+
"azure.communication.messages.models.MessageTemplateItem": "Azure.Communication.MessagesService.MessageTemplateItem",
28+
"azure.communication.messages.models.MessageTemplateLocation": "Azure.Communication.MessagesService.MessageTemplateLocation",
29+
"azure.communication.messages.models.MessageTemplateQuickAction": "Azure.Communication.MessagesService.MessageTemplateQuickAction",
30+
"azure.communication.messages.models.MessageTemplateText": "Azure.Communication.MessagesService.MessageTemplateText",
31+
"azure.communication.messages.models.MessageTemplateVideo": "Azure.Communication.MessagesService.MessageTemplateVideo",
32+
"azure.communication.messages.models.ReactionNotificationContent": "Azure.Communication.MessagesService.ReactionNotificationContent",
33+
"azure.communication.messages.models.SendMessageResult": "Azure.Communication.MessagesService.SendMessageResult",
34+
"azure.communication.messages.models.StickerNotificationContent": "Azure.Communication.MessagesService.StickerNotificationContent",
35+
"azure.communication.messages.models.TemplateNotificationContent": "Azure.Communication.MessagesService.TemplateNotificationContent",
36+
"azure.communication.messages.models.TextMessageContent": "Azure.Communication.MessagesService.TextMessageContent",
37+
"azure.communication.messages.models.TextNotificationContent": "Azure.Communication.MessagesService.TextNotificationContent",
38+
"azure.communication.messages.models.VideoMessageContent": "Azure.Communication.MessagesService.VideoMessageContent",
39+
"azure.communication.messages.models.VideoNotificationContent": "Azure.Communication.MessagesService.VideoNotificationContent",
40+
"azure.communication.messages.models.WhatsAppButtonActionBindings": "Azure.Communication.MessagesService.WhatsAppButtonActionBindings",
41+
"azure.communication.messages.models.WhatsAppListActionBindings": "Azure.Communication.MessagesService.WhatsAppListActionBindings",
42+
"azure.communication.messages.models.WhatsAppMessageTemplateBindings": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindings",
43+
"azure.communication.messages.models.WhatsAppMessageTemplateBindingsButton": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindingsButton",
44+
"azure.communication.messages.models.WhatsAppMessageTemplateBindingsComponent": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindingsComponent",
45+
"azure.communication.messages.models.WhatsAppMessageTemplateItem": "Azure.Communication.MessagesService.WhatsAppMessageTemplateItem",
46+
"azure.communication.messages.models.WhatsAppUrlActionBindings": "Azure.Communication.MessagesService.WhatsAppUrlActionBindings",
47+
"azure.communication.messages.models.RepeatabilityResult": "Azure.Core.RepeatabilityResult",
48+
"azure.communication.messages.models.CommunicationMessageKind": "Azure.Communication.MessagesService.CommunicationMessageKind",
49+
"azure.communication.messages.models.MessageContentKind": "Azure.Communication.MessagesService.MessageContentKind",
50+
"azure.communication.messages.models.MessageActionBindingKind": "Azure.Communication.MessagesService.MessageActionBindingKind",
51+
"azure.communication.messages.models.MessageTemplateValueKind": "Azure.Communication.MessagesService.MessageTemplateValueKind",
52+
"azure.communication.messages.models.MessageTemplateBindingsKind": "Azure.Communication.MessagesService.MessageTemplateBindingsKind",
53+
"azure.communication.messages.models.WhatsAppMessageButtonSubType": "Azure.Communication.MessagesService.WhatsAppMessageButtonSubType",
54+
"azure.communication.messages.models.MessageTemplateStatus": "Azure.Communication.MessagesService.MessageTemplateStatus",
55+
"azure.communication.messages.models.CommunicationMessagesChannel": "Azure.Communication.MessagesService.CommunicationMessagesChannel",
56+
"azure.communication.messages.NotificationMessagesClient.send": "Azure.Communication.MessagesService.NotificationMessagesClient.send",
57+
"azure.communication.messages.NotificationMessagesClient.download_media": "ClientForAcsMessages.NotificationMessagesClient.downloadMedia",
58+
"azure.communication.messages.MessageTemplateClient.list_templates": "Azure.Communication.MessagesService.MessageTemplateClient.listTemplates"
59+
}
60+
}

sdk/communication/azure-communication-messages/azure/communication/messages/_api_versions.py

Lines changed: 0 additions & 17 deletions
This file was deleted.

sdk/communication/azure-communication-messages/azure/communication/messages/_client.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class NotificationMessagesClient(NotificationMessagesClientOperationsMixin):
3030
https://my-resource.communication.azure.com. Required.
3131
:type endpoint: str
3232
:param credential: Credential used to authenticate requests to the service. Is either a token
33-
credential type or a AzureKeyCredential type. Required.
33+
credential type or a key credential type. Required.
3434
:type credential: ~azure.core.credentials.TokenCredential or
3535
~azure.core.credentials.AzureKeyCredential
3636
:keyword api_version: The API version to use for this operation. Default value is
@@ -109,7 +109,7 @@ class MessageTemplateClient(MessageTemplateClientOperationsMixin):
109109
https://my-resource.communication.azure.com. Required.
110110
:type endpoint: str
111111
:param credential: Credential used to authenticate requests to the service. Is either a token
112-
credential type or a AzureKeyCredential type. Required.
112+
credential type or a key credential type. Required.
113113
:type credential: ~azure.core.credentials.TokenCredential or
114114
~azure.core.credentials.AzureKeyCredential
115115
:keyword api_version: The API version to use for this operation. Default value is

sdk/communication/azure-communication-messages/azure/communication/messages/_configuration.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ class NotificationMessagesClientConfiguration: # pylint: disable=too-many-insta
2727
https://my-resource.communication.azure.com. Required.
2828
:type endpoint: str
2929
:param credential: Credential used to authenticate requests to the service. Is either a token
30-
credential type or a AzureKeyCredential type. Required.
30+
credential type or a key credential type. Required.
3131
:type credential: ~azure.core.credentials.TokenCredential or
3232
~azure.core.credentials.AzureKeyCredential
3333
:keyword api_version: The API version to use for this operation. Default value is
@@ -83,7 +83,7 @@ class MessageTemplateClientConfiguration: # pylint: disable=too-many-instance-a
8383
https://my-resource.communication.azure.com. Required.
8484
:type endpoint: str
8585
:param credential: Credential used to authenticate requests to the service. Is either a token
86-
credential type or a AzureKeyCredential type. Required.
86+
credential type or a key credential type. Required.
8787
:type credential: ~azure.core.credentials.TokenCredential or
8888
~azure.core.credentials.AzureKeyCredential
8989
:keyword api_version: The API version to use for this operation. Default value is

sdk/communication/azure-communication-messages/azure/communication/messages/_model_base.py

Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -373,15 +373,34 @@ def __ne__(self, other: typing.Any) -> bool:
373373
return not self.__eq__(other)
374374

375375
def keys(self) -> typing.KeysView[str]:
376+
"""
377+
:returns: a set-like object providing a view on D's keys
378+
:rtype: ~typing.KeysView
379+
"""
376380
return self._data.keys()
377381

378382
def values(self) -> typing.ValuesView[typing.Any]:
383+
"""
384+
:returns: an object providing a view on D's values
385+
:rtype: ~typing.ValuesView
386+
"""
379387
return self._data.values()
380388

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

384396
def get(self, key: str, default: typing.Any = None) -> typing.Any:
397+
"""
398+
Get the value for key if key is in the dictionary, else default.
399+
:param str key: The key to look up.
400+
:param any default: The value to return if key is not in the dictionary. Defaults to None
401+
:returns: D[k] if k in D, else d.
402+
:rtype: any
403+
"""
385404
try:
386405
return self[key]
387406
except KeyError:
@@ -397,17 +416,38 @@ def pop(self, key: str, default: _T) -> _T: ...
397416
def pop(self, key: str, default: typing.Any) -> typing.Any: ...
398417

399418
def pop(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
419+
"""
420+
Removes specified key and return the corresponding value.
421+
:param str key: The key to pop.
422+
:param any default: The value to return if key is not in the dictionary
423+
:returns: The value corresponding to the key.
424+
:rtype: any
425+
:raises KeyError: If key is not found and default is not given.
426+
"""
400427
if default is _UNSET:
401428
return self._data.pop(key)
402429
return self._data.pop(key, default)
403430

404431
def popitem(self) -> typing.Tuple[str, typing.Any]:
432+
"""
433+
Removes and returns some (key, value) pair
434+
:returns: The (key, value) pair.
435+
:rtype: tuple
436+
:raises KeyError: if D is empty.
437+
"""
405438
return self._data.popitem()
406439

407440
def clear(self) -> None:
441+
"""
442+
Remove all items from D.
443+
"""
408444
self._data.clear()
409445

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

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

419459
def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
460+
"""
461+
Same as calling D.get(k, d), and setting D[k]=d if k not found
462+
:param str key: The key to look up.
463+
:param any default: The value to set if key is not in the dictionary
464+
:returns: D[k] if k in D, else d.
465+
:rtype: any
466+
"""
420467
if default is _UNSET:
421468
return self._data.setdefault(key)
422469
return self._data.setdefault(key, default)
@@ -910,6 +957,19 @@ def _failsafe_deserialize(
910957
return None
911958

912959

960+
def _failsafe_deserialize_xml(
961+
deserializer: typing.Any,
962+
value: typing.Any,
963+
) -> typing.Any:
964+
try:
965+
return _deserialize_xml(deserializer, value)
966+
except DeserializationError:
967+
_LOGGER.warning(
968+
"Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True
969+
)
970+
return None
971+
972+
913973
class _RestField:
914974
def __init__(
915975
self,

sdk/communication/azure-communication-messages/azure/communication/messages/_operations/_operations.py

Lines changed: 3 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -74,22 +74,15 @@ def build_notification_messages_send_request(**kwargs: Any) -> HttpRequest:
7474
return HttpRequest(method="POST", url=_url, params=_params, headers=_headers, **kwargs)
7575

7676

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

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

8684
# Construct URL
87-
_url = "/messages/streams/{id}"
88-
path_format_arguments = {
89-
"id": _SERIALIZER.url("id", id, "str"),
90-
}
91-
92-
_url: str = _url.format(**path_format_arguments) # type: ignore
85+
_url = "/"
9386

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

259252
@distributed_trace
260-
def download_media(self, id: str, **kwargs: Any) -> Iterator[bytes]:
253+
def download_media(self, **kwargs: Any) -> Iterator[bytes]:
261254
"""Download the Media payload from a User to Business message.
262255
263-
:param id: The stream ID. Required.
264-
:type id: str
265256
:return: Iterator[bytes]
266257
:rtype: Iterator[bytes]
267258
:raises ~azure.core.exceptions.HttpResponseError:
@@ -280,7 +271,6 @@ def download_media(self, id: str, **kwargs: Any) -> Iterator[bytes]:
280271
cls: ClsType[Iterator[bytes]] = kwargs.pop("cls", None)
281272

282273
_request = build_notification_messages_download_media_request(
283-
id=id,
284274
api_version=self._config.api_version,
285275
headers=_headers,
286276
params=_params,

0 commit comments

Comments
 (0)