Skip to content

Commit 89af89a

Browse files
author
SDKAuto
committed
CodeGen from PR 33348 in Azure/azure-rest-api-specs
Merge e8a5688659580426014c61677819ac0bc88d0793 into bc79b816272c7e12d79e8bc63d689327fc37d11f
1 parent 7656cf2 commit 89af89a

File tree

53 files changed

+651
-1625
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

+651
-1625
lines changed
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "a2bd6a405683c01ba4bf92b47380d20e2306d991",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/communication/Communication.Messages",
5+
"@azure-tools/typespec-python": "0.40.0"
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: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,10 +27,11 @@ class NotificationMessagesClient(NotificationMessagesClientOperationsMixin):
2727
"""NotificationMessagesClient.
2828
2929
:param endpoint: The communication resource, for example
30-
https://my-resource.communication.azure.com. Required.
30+
`https://my-resource.communication.azure.com <https://my-resource.communication.azure.com>`_.
31+
Required.
3132
:type endpoint: str
3233
:param credential: Credential used to authenticate requests to the service. Is either a token
33-
credential type or a AzureKeyCredential type. Required.
34+
credential type or a key credential type. Required.
3435
:type credential: ~azure.core.credentials.TokenCredential or
3536
~azure.core.credentials.AzureKeyCredential
3637
:keyword api_version: The API version to use for this operation. Default value is
@@ -106,10 +107,11 @@ class MessageTemplateClient(MessageTemplateClientOperationsMixin):
106107
"""MessageTemplateClient.
107108
108109
:param endpoint: The communication resource, for example
109-
https://my-resource.communication.azure.com. Required.
110+
`https://my-resource.communication.azure.com <https://my-resource.communication.azure.com>`_.
111+
Required.
110112
:type endpoint: str
111113
:param credential: Credential used to authenticate requests to the service. Is either a token
112-
credential type or a AzureKeyCredential type. Required.
114+
credential type or a key credential type. Required.
113115
:type credential: ~azure.core.credentials.TokenCredential or
114116
~azure.core.credentials.AzureKeyCredential
115117
: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: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,11 @@ class NotificationMessagesClientConfiguration: # pylint: disable=too-many-insta
2424
attributes.
2525
2626
:param endpoint: The communication resource, for example
27-
https://my-resource.communication.azure.com. Required.
27+
`https://my-resource.communication.azure.com <https://my-resource.communication.azure.com>`_.
28+
Required.
2829
:type endpoint: str
2930
:param credential: Credential used to authenticate requests to the service. Is either a token
30-
credential type or a AzureKeyCredential type. Required.
31+
credential type or a key credential type. Required.
3132
:type credential: ~azure.core.credentials.TokenCredential or
3233
~azure.core.credentials.AzureKeyCredential
3334
:keyword api_version: The API version to use for this operation. Default value is
@@ -80,10 +81,11 @@ class MessageTemplateClientConfiguration: # pylint: disable=too-many-instance-a
8081
attributes.
8182
8283
:param endpoint: The communication resource, for example
83-
https://my-resource.communication.azure.com. Required.
84+
`https://my-resource.communication.azure.com <https://my-resource.communication.azure.com>`_.
85+
Required.
8486
:type endpoint: str
8587
:param credential: Credential used to authenticate requests to the service. Is either a token
86-
credential type or a AzureKeyCredential type. Required.
88+
credential type or a key credential type. Required.
8789
:type credential: ~azure.core.credentials.TokenCredential or
8890
~azure.core.credentials.AzureKeyCredential
8991
: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: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -387,7 +387,7 @@ def prepare_request(next_link=None):
387387

388388
def extract_data(pipeline_response):
389389
deserialized = pipeline_response.http_response.json()
390-
list_of_elem = _deserialize(List[_models.MessageTemplateItem], deserialized["value"])
390+
list_of_elem = _deserialize(List[_models.MessageTemplateItem], deserialized.get("value", []))
391391
if cls:
392392
list_of_elem = cls(list_of_elem) # type: ignore
393393
return deserialized.get("nextLink") or None, iter(list_of_elem)

0 commit comments

Comments
 (0)