Skip to content

Commit d58066c

Browse files
author
SDKAuto
committed
CodeGen from PR 33698 in Azure/azure-rest-api-specs
Merge 0426bf3308b9582c418b145b910798e0a53050cc into abb839b726184aa10f8d1eaac8e9fe590833619c
1 parent 7f8d21c commit d58066c

File tree

58 files changed

+686
-1672
lines changed

Some content is hidden

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

58 files changed

+686
-1672
lines changed

sdk/communication/azure-communication-messages/MANIFEST.in

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@ include azure/communication/messages/py.typed
44
recursive-include tests *.py
55
recursive-include samples *.py *.md
66
include azure/__init__.py
7-
include azure/communication/__init__.py
7+
include azure/communication/__init__.py
Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"commit": "5b8b9e16f73291ccad4972febd28ca32ff908cd1",
3+
"repository_url": "https://github.com/Azure/azure-rest-api-specs",
4+
"typespec_src": "specification/communication/Communication.Messages",
5+
"@azure-tools/typespec-python": "0.42.2"
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: 63 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,9 @@
22
# coding=utf-8
33
# --------------------------------------------------------------------------
44
# Copyright (c) Microsoft Corporation. All rights reserved.
5-
# Licensed under the MIT License. See License.txt in the project root for
6-
# license information.
5+
# Licensed under the MIT License. See License.txt in the project root for license information.
6+
# Code generated by Microsoft (R) Python Code Generator.
7+
# Changes may cause incorrect behavior and will be lost if the code is regenerated.
78
# --------------------------------------------------------------------------
89
# pylint: disable=protected-access, broad-except
910

@@ -373,15 +374,34 @@ def __ne__(self, other: typing.Any) -> bool:
373374
return not self.__eq__(other)
374375

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

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

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

384397
def get(self, key: str, default: typing.Any = None) -> typing.Any:
398+
"""
399+
Get the value for key if key is in the dictionary, else default.
400+
:param str key: The key to look up.
401+
:param any default: The value to return if key is not in the dictionary. Defaults to None
402+
:returns: D[k] if k in D, else d.
403+
:rtype: any
404+
"""
385405
try:
386406
return self[key]
387407
except KeyError:
@@ -397,17 +417,38 @@ def pop(self, key: str, default: _T) -> _T: ...
397417
def pop(self, key: str, default: typing.Any) -> typing.Any: ...
398418

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

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

407441
def clear(self) -> None:
442+
"""
443+
Remove all items from D.
444+
"""
408445
self._data.clear()
409446

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

413454
@typing.overload
@@ -417,6 +458,13 @@ def setdefault(self, key: str, default: None = None) -> None: ...
417458
def setdefault(self, key: str, default: typing.Any) -> typing.Any: ...
418459

419460
def setdefault(self, key: str, default: typing.Any = _UNSET) -> typing.Any:
461+
"""
462+
Same as calling D.get(k, d), and setting D[k]=d if k not found
463+
:param str key: The key to look up.
464+
:param any default: The value to set if key is not in the dictionary
465+
:returns: D[k] if k in D, else d.
466+
:rtype: any
467+
"""
420468
if default is _UNSET:
421469
return self._data.setdefault(key)
422470
return self._data.setdefault(key, default)
@@ -910,6 +958,19 @@ def _failsafe_deserialize(
910958
return None
911959

912960

961+
def _failsafe_deserialize_xml(
962+
deserializer: typing.Any,
963+
value: typing.Any,
964+
) -> typing.Any:
965+
try:
966+
return _deserialize_xml(deserializer, value)
967+
except DeserializationError:
968+
_LOGGER.warning(
969+
"Ran into a deserialization error. Ignoring since this is failsafe deserialization", exc_info=True
970+
)
971+
return None
972+
973+
913974
class _RestField:
914975
def __init__(
915976
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)

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

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
1-
# ------------------------------------
2-
# Copyright (c) Microsoft Corporation.
3-
# Licensed under the MIT License.
4-
# ------------------------------------
1+
# coding=utf-8
2+
# --------------------------------------------------------------------------
3+
# Copyright (c) Microsoft Corporation. All rights reserved.
4+
# Licensed under the MIT License. See License.txt in the project root for license information.
5+
# --------------------------------------------------------------------------
56
"""Customize generated code here.
67
78
Follow our quickstart for examples: https://aka.ms/azsdk/python/dpcodegen/python/customize

0 commit comments

Comments
 (0)