diff --git a/sdk/communication/Azure.Communication.Messages/Configuration.json b/sdk/communication/Azure.Communication.Messages/Configuration.json index 3da66e7d2823..6547b4419260 100644 --- a/sdk/communication/Azure.Communication.Messages/Configuration.json +++ b/sdk/communication/Azure.Communication.Messages/Configuration.json @@ -8,5 +8,6 @@ "shared-source-folders": [ "../../TempTypeSpecFiles/node_modules/@autorest/csharp/Generator.Shared", "../../TempTypeSpecFiles/node_modules/@autorest/csharp/Azure.Core.Shared" - ] + ], + "use-write-core": true } diff --git a/sdk/communication/Azure.Communication.Messages/api/Azure.Communication.Messages.netstandard2.0.cs b/sdk/communication/Azure.Communication.Messages/api/Azure.Communication.Messages.netstandard2.0.cs index 549564b53314..d93a3a55747a 100644 --- a/sdk/communication/Azure.Communication.Messages/api/Azure.Communication.Messages.netstandard2.0.cs +++ b/sdk/communication/Azure.Communication.Messages/api/Azure.Communication.Messages.netstandard2.0.cs @@ -4,6 +4,7 @@ public partial class AudioNotificationContent : Azure.Communication.Messages.Not { public AudioNotificationContent(System.Guid channelRegistrationId, System.Collections.Generic.IEnumerable to, System.Uri mediaUri) : base (default(System.Guid), default(System.Collections.Generic.IEnumerable)) { } public System.Uri MediaUri { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.AudioNotificationContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.AudioNotificationContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -47,6 +48,7 @@ public partial class DocumentNotificationContent : Azure.Communication.Messages. public string Caption { get { throw null; } set { } } public string FileName { get { throw null; } set { } } public System.Uri MediaUri { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.DocumentNotificationContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.DocumentNotificationContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -58,6 +60,7 @@ public partial class ImageNotificationContent : Azure.Communication.Messages.Not public ImageNotificationContent(System.Guid channelRegistrationId, System.Collections.Generic.IEnumerable to, System.Uri mediaUri) : base (default(System.Guid), default(System.Collections.Generic.IEnumerable)) { } public string Caption { get { throw null; } set { } } public System.Uri MediaUri { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.ImageNotificationContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.ImageNotificationContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -70,6 +73,7 @@ public partial class MediaNotificationContent : Azure.Communication.Messages.Not public MediaNotificationContent(System.Guid channelRegistrationId, System.Collections.Generic.IEnumerable to, System.Uri mediaUri) : base (default(System.Guid), default(System.Collections.Generic.IEnumerable)) { } public string Content { get { throw null; } set { } } public System.Uri MediaUri { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MediaNotificationContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MediaNotificationContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -81,6 +85,7 @@ public partial class MessageReceipt : System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageReceipt System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -94,6 +99,7 @@ public MessageTemplate(string name, string language) { } public string Language { get { throw null; } } public string Name { get { throw null; } } public System.Collections.Generic.IList Values { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplate System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplate System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -103,6 +109,7 @@ public MessageTemplate(string name, string language) { } public abstract partial class MessageTemplateBindings : System.ClientModel.Primitives.IJsonModel, System.ClientModel.Primitives.IPersistableModel { protected MessageTemplateBindings() { } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateBindings System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateBindings System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -130,6 +137,7 @@ public MessageTemplateDocument(string name, System.Uri uri) : base (default(stri public string Caption { get { throw null; } set { } } public string FileName { get { throw null; } set { } } public System.Uri Uri { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateDocument System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateDocument System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -142,6 +150,7 @@ public MessageTemplateImage(string name, System.Uri uri) : base (default(string) public string Caption { get { throw null; } set { } } public string FileName { get { throw null; } set { } } public System.Uri Uri { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateImage System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateImage System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -154,6 +163,7 @@ protected MessageTemplateItem(string language, Azure.Communication.Messages.Mess public string Language { get { throw null; } } public string Name { get { throw null; } } public Azure.Communication.Messages.MessageTemplateStatus Status { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateItem System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateItem System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -166,6 +176,7 @@ public MessageTemplateLocation(string name) : base (default(string)) { } public string Address { get { throw null; } set { } } public string LocationName { get { throw null; } set { } } public Azure.Core.GeoJson.GeoPosition Position { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateLocation System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateLocation System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -177,6 +188,7 @@ public partial class MessageTemplateQuickAction : Azure.Communication.Messages.M public MessageTemplateQuickAction(string name) : base (default(string)) { } public string Payload { get { throw null; } set { } } public string Text { get { throw null; } set { } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateQuickAction System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateQuickAction System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -207,6 +219,7 @@ public partial class MessageTemplateText : Azure.Communication.Messages.MessageT { public MessageTemplateText(string name, string text) : base (default(string)) { } public string Text { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateText System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateText System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -217,6 +230,7 @@ public abstract partial class MessageTemplateValue : System.ClientModel.Primitiv { protected MessageTemplateValue(string name) { } public string Name { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateValue System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateValue System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -229,6 +243,7 @@ public MessageTemplateVideo(string name, System.Uri uri) : base (default(string) public string Caption { get { throw null; } set { } } public string FileName { get { throw null; } set { } } public System.Uri Uri { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateVideo System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.MessageTemplateVideo System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -240,6 +255,7 @@ public abstract partial class NotificationContent : System.ClientModel.Primitive protected NotificationContent(System.Guid channelRegistrationId, System.Collections.Generic.IEnumerable to) { } public System.Guid ChannelRegistrationId { get { throw null; } } public System.Collections.Generic.IList To { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.NotificationContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.NotificationContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -271,6 +287,7 @@ public partial class SendMessageResult : System.ClientModel.Primitives.IJsonMode { internal SendMessageResult() { } public System.Collections.Generic.IReadOnlyList Receipts { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.SendMessageResult System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.SendMessageResult System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -281,6 +298,7 @@ public partial class TemplateNotificationContent : Azure.Communication.Messages. { public TemplateNotificationContent(System.Guid channelRegistrationId, System.Collections.Generic.IEnumerable to, Azure.Communication.Messages.MessageTemplate template) : base (default(System.Guid), default(System.Collections.Generic.IEnumerable)) { } public Azure.Communication.Messages.MessageTemplate Template { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.TemplateNotificationContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.TemplateNotificationContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -291,6 +309,7 @@ public partial class TextNotificationContent : Azure.Communication.Messages.Noti { public TextNotificationContent(System.Guid channelRegistrationId, System.Collections.Generic.IEnumerable to, string content) : base (default(System.Guid), default(System.Collections.Generic.IEnumerable)) { } public string Content { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.TextNotificationContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.TextNotificationContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -302,6 +321,7 @@ public partial class VideoNotificationContent : Azure.Communication.Messages.Not public VideoNotificationContent(System.Guid channelRegistrationId, System.Collections.Generic.IEnumerable to, System.Uri mediaUri) : base (default(System.Guid), default(System.Collections.Generic.IEnumerable)) { } public string Caption { get { throw null; } set { } } public System.Uri MediaUri { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.VideoNotificationContent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.VideoNotificationContent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -336,6 +356,7 @@ public WhatsAppMessageTemplateBindings() { } public System.Collections.Generic.IList Buttons { get { throw null; } } public System.Collections.Generic.IList Footer { get { throw null; } } public System.Collections.Generic.IList Header { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.Models.Channels.WhatsAppMessageTemplateBindings System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.Models.Channels.WhatsAppMessageTemplateBindings System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -347,6 +368,7 @@ public partial class WhatsAppMessageTemplateBindingsButton : System.ClientModel. public WhatsAppMessageTemplateBindingsButton(string subType, string refValue) { } public string RefValue { get { throw null; } } public string SubType { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.Models.Channels.WhatsAppMessageTemplateBindingsButton System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.Models.Channels.WhatsAppMessageTemplateBindingsButton System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -357,6 +379,7 @@ public partial class WhatsAppMessageTemplateBindingsComponent : System.ClientMod { public WhatsAppMessageTemplateBindingsComponent(string refValue) { } public string RefValue { get { throw null; } } + protected virtual void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.Models.Channels.WhatsAppMessageTemplateBindingsComponent System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.Models.Channels.WhatsAppMessageTemplateBindingsComponent System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } @@ -367,6 +390,7 @@ public partial class WhatsAppMessageTemplateItem : Azure.Communication.Messages. { internal WhatsAppMessageTemplateItem() : base (default(string), default(Azure.Communication.Messages.MessageTemplateStatus)) { } public System.BinaryData Content { get { throw null; } } + protected override void JsonModelWriteCore(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.Models.Channels.WhatsAppMessageTemplateItem System.ClientModel.Primitives.IJsonModel.Create(ref System.Text.Json.Utf8JsonReader reader, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } void System.ClientModel.Primitives.IJsonModel.Write(System.Text.Json.Utf8JsonWriter writer, System.ClientModel.Primitives.ModelReaderWriterOptions options) { } Azure.Communication.Messages.Models.Channels.WhatsAppMessageTemplateItem System.ClientModel.Primitives.IPersistableModel.Create(System.BinaryData data, System.ClientModel.Primitives.ModelReaderWriterOptions options) { throw null; } diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/AudioNotificationContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/AudioNotificationContent.Serialization.cs index fd632d942d5c..5a35c83072c5 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/AudioNotificationContent.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/AudioNotificationContent.Serialization.cs @@ -18,6 +18,15 @@ public partial class AudioNotificationContent : IUtf8JsonSerializable, IJsonMode void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,36 +34,9 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead throw new FormatException($"The model {nameof(AudioNotificationContent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("mediaUri"u8); writer.WriteStringValue(MediaUri.AbsoluteUri); - writer.WritePropertyName("channelRegistrationId"u8); - writer.WriteStringValue(ChannelRegistrationId); - writer.WritePropertyName("to"u8); - writer.WriteStartArray(); - foreach (var item in To) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } AudioNotificationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentNotificationContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentNotificationContent.Serialization.cs index 1db461c8fe66..b08b04024067 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentNotificationContent.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentNotificationContent.Serialization.cs @@ -18,6 +18,15 @@ public partial class DocumentNotificationContent : IUtf8JsonSerializable, IJsonM void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR throw new FormatException($"The model {nameof(DocumentNotificationContent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Caption)) { writer.WritePropertyName("caption"u8); @@ -38,33 +47,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR } writer.WritePropertyName("mediaUri"u8); writer.WriteStringValue(MediaUri.AbsoluteUri); - writer.WritePropertyName("channelRegistrationId"u8); - writer.WriteStringValue(ChannelRegistrationId); - writer.WritePropertyName("to"u8); - writer.WriteStartArray(); - foreach (var item in To) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } DocumentNotificationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ImageNotificationContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ImageNotificationContent.Serialization.cs index db5ee3353a02..6b3b6924a426 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/ImageNotificationContent.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ImageNotificationContent.Serialization.cs @@ -18,6 +18,15 @@ public partial class ImageNotificationContent : IUtf8JsonSerializable, IJsonMode void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead throw new FormatException($"The model {nameof(ImageNotificationContent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Caption)) { writer.WritePropertyName("caption"u8); @@ -33,33 +42,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead } writer.WritePropertyName("mediaUri"u8); writer.WriteStringValue(MediaUri.AbsoluteUri); - writer.WritePropertyName("channelRegistrationId"u8); - writer.WriteStringValue(ChannelRegistrationId); - writer.WritePropertyName("to"u8); - writer.WriteStartArray(); - foreach (var item in To) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } ImageNotificationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MediaNotificationContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MediaNotificationContent.Serialization.cs index 0d62f6c63b9c..2f0e39c8eba0 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MediaNotificationContent.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MediaNotificationContent.Serialization.cs @@ -18,6 +18,15 @@ public partial class MediaNotificationContent : IUtf8JsonSerializable, IJsonMode void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead throw new FormatException($"The model {nameof(MediaNotificationContent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Content)) { writer.WritePropertyName("content"u8); @@ -33,33 +42,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead } writer.WritePropertyName("mediaUri"u8); writer.WriteStringValue(MediaUri.AbsoluteUri); - writer.WritePropertyName("channelRegistrationId"u8); - writer.WriteStringValue(ChannelRegistrationId); - writer.WritePropertyName("to"u8); - writer.WriteStartArray(); - foreach (var item in To) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } MediaNotificationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageReceipt.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageReceipt.Serialization.cs index c7f6947657dd..059afa5ae7bf 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageReceipt.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageReceipt.Serialization.cs @@ -18,6 +18,15 @@ public partial class MessageReceipt : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp throw new FormatException($"The model {nameof(MessageReceipt)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("messageId"u8); writer.WriteStringValue(MessageId); writer.WritePropertyName("to"u8); @@ -45,7 +53,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOp #endif } } - writer.WriteEndObject(); } MessageReceipt IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplate.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplate.Serialization.cs index 2b78a8bba539..ee42a2b7fc25 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplate.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplate.Serialization.cs @@ -18,6 +18,15 @@ public partial class MessageTemplate : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO throw new FormatException($"The model {nameof(MessageTemplate)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("language"u8); @@ -60,7 +68,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterO #endif } } - writer.WriteEndObject(); } MessageTemplate IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateBindings.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateBindings.Serialization.cs index 6e7723ebc6c4..7c84e59b3489 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateBindings.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateBindings.Serialization.cs @@ -19,6 +19,15 @@ public partial class MessageTemplateBindings : IUtf8JsonSerializable, IJsonModel void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(MessageTemplateBindings)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("kind"u8); writer.WriteStringValue(Kind.ToString()); if (options.Format != "W" && _serializedAdditionalRawData != null) @@ -44,7 +52,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade #endif } } - writer.WriteEndObject(); } MessageTemplateBindings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateDocument.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateDocument.Serialization.cs index a35eef26c854..99f2b62f77a1 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateDocument.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateDocument.Serialization.cs @@ -18,6 +18,15 @@ public partial class MessageTemplateDocument : IUtf8JsonSerializable, IJsonModel void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(MessageTemplateDocument)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("url"u8); writer.WriteStringValue(Uri.AbsoluteUri); if (Optional.IsDefined(Caption)) @@ -38,26 +47,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade writer.WritePropertyName("fileName"u8); writer.WriteStringValue(FileName); } - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } MessageTemplateDocument IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateImage.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateImage.Serialization.cs index 632afec19d5c..5e2b97bfe6b5 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateImage.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateImage.Serialization.cs @@ -18,6 +18,15 @@ public partial class MessageTemplateImage : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr throw new FormatException($"The model {nameof(MessageTemplateImage)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("url"u8); writer.WriteStringValue(Uri.AbsoluteUri); if (Optional.IsDefined(Caption)) @@ -38,26 +47,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr writer.WritePropertyName("fileName"u8); writer.WriteStringValue(FileName); } - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } MessageTemplateImage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateItem.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateItem.Serialization.cs index 08286bf1208b..bdfc4d075867 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateItem.Serialization.cs @@ -19,6 +19,15 @@ public partial class MessageTemplateItem : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -26,7 +35,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri throw new FormatException($"The model {nameof(MessageTemplateItem)} does not support writing '{format}' format."); } - writer.WriteStartObject(); if (options.Format != "W") { writer.WritePropertyName("name"u8); @@ -53,7 +61,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri #endif } } - writer.WriteEndObject(); } MessageTemplateItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateLocation.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateLocation.Serialization.cs index 1125a56f954b..9115f3245ab3 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateLocation.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateLocation.Serialization.cs @@ -18,6 +18,15 @@ public partial class MessageTemplateLocation : IUtf8JsonSerializable, IJsonModel void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(MessageTemplateLocation)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(LocationName)) { writer.WritePropertyName("locationName"u8); @@ -40,26 +49,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade writer.WriteNumberValue(LatitudeInternal); writer.WritePropertyName("longitude"u8); writer.WriteNumberValue(LongitudeInternal); - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } MessageTemplateLocation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateQuickAction.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateQuickAction.Serialization.cs index 90b2a5ac78a3..b6ba6967f38c 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateQuickAction.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateQuickAction.Serialization.cs @@ -18,6 +18,15 @@ public partial class MessageTemplateQuickAction : IUtf8JsonSerializable, IJsonMo void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe throw new FormatException($"The model {nameof(MessageTemplateQuickAction)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Text)) { writer.WritePropertyName("text"u8); @@ -36,26 +45,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRe writer.WritePropertyName("payload"u8); writer.WriteStringValue(Payload); } - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } MessageTemplateQuickAction IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateText.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateText.Serialization.cs index 2468baa6e20f..6d590ef8c870 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateText.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateText.Serialization.cs @@ -18,6 +18,15 @@ public partial class MessageTemplateText : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,29 +34,9 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri throw new FormatException($"The model {nameof(MessageTemplateText)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("text"u8); writer.WriteStringValue(Text); - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } MessageTemplateText IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateValue.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateValue.Serialization.cs index 5f4ce08fc2f7..fadb0a25ef69 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateValue.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateValue.Serialization.cs @@ -18,6 +18,15 @@ public partial class MessageTemplateValue : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr throw new FormatException($"The model {nameof(MessageTemplateValue)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("name"u8); writer.WriteStringValue(Name); writer.WritePropertyName("kind"u8); @@ -45,7 +53,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr #endif } } - writer.WriteEndObject(); } MessageTemplateValue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateVideo.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateVideo.Serialization.cs index 93abcb02e4fe..fd7a2b45bf3a 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateVideo.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateVideo.Serialization.cs @@ -18,6 +18,15 @@ public partial class MessageTemplateVideo : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr throw new FormatException($"The model {nameof(MessageTemplateVideo)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("url"u8); writer.WriteStringValue(Uri.AbsoluteUri); if (Optional.IsDefined(Caption)) @@ -38,26 +47,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr writer.WritePropertyName("fileName"u8); writer.WriteStringValue(FileName); } - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } MessageTemplateVideo IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/NotificationContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/NotificationContent.Serialization.cs index 25e6680f3123..08fa5ff8452e 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/NotificationContent.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/NotificationContent.Serialization.cs @@ -18,6 +18,15 @@ public partial class NotificationContent : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri throw new FormatException($"The model {nameof(NotificationContent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("channelRegistrationId"u8); writer.WriteStringValue(ChannelRegistrationId); writer.WritePropertyName("to"u8); @@ -52,7 +60,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri #endif } } - writer.WriteEndObject(); } NotificationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/SendMessageResult.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/SendMessageResult.Serialization.cs index fb267b1a95f7..a30e71519c43 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/SendMessageResult.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/SendMessageResult.Serialization.cs @@ -18,6 +18,15 @@ public partial class SendMessageResult : IUtf8JsonSerializable, IJsonModel ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite throw new FormatException($"The model {nameof(SendMessageResult)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("receipts"u8); writer.WriteStartArray(); foreach (var item in Receipts) @@ -48,7 +56,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWrite #endif } } - writer.WriteEndObject(); } SendMessageResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateNotificationContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateNotificationContent.Serialization.cs index ee5386ba058a..af83a587de9c 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateNotificationContent.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateNotificationContent.Serialization.cs @@ -18,6 +18,15 @@ public partial class TemplateNotificationContent : IUtf8JsonSerializable, IJsonM void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,36 +34,9 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR throw new FormatException($"The model {nameof(TemplateNotificationContent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("template"u8); writer.WriteObjectValue(Template, options); - writer.WritePropertyName("channelRegistrationId"u8); - writer.WriteStringValue(ChannelRegistrationId); - writer.WritePropertyName("to"u8); - writer.WriteStartArray(); - foreach (var item in To) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } TemplateNotificationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/TextNotificationContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/TextNotificationContent.Serialization.cs index ea9b782c2faa..8be5eede9613 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/TextNotificationContent.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/TextNotificationContent.Serialization.cs @@ -18,6 +18,15 @@ public partial class TextNotificationContent : IUtf8JsonSerializable, IJsonModel void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,36 +34,9 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(TextNotificationContent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); writer.WritePropertyName("content"u8); writer.WriteStringValue(Content); - writer.WritePropertyName("channelRegistrationId"u8); - writer.WriteStringValue(ChannelRegistrationId); - writer.WritePropertyName("to"u8); - writer.WriteStartArray(); - foreach (var item in To) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } TextNotificationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownMessageTemplateBindings.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownMessageTemplateBindings.Serialization.cs index 3d0a92505a83..5066cfc424c3 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownMessageTemplateBindings.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownMessageTemplateBindings.Serialization.cs @@ -18,6 +18,15 @@ internal partial class UnknownMessageTemplateBindings : IUtf8JsonSerializable, I void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,25 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReade throw new FormatException($"The model {nameof(MessageTemplateBindings)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); + base.JsonModelWriteCore(writer, options); } MessageTemplateBindings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownMessageTemplateItem.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownMessageTemplateItem.Serialization.cs index 9986695c3cf5..6890c8dfd100 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownMessageTemplateItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownMessageTemplateItem.Serialization.cs @@ -18,6 +18,15 @@ internal partial class UnknownMessageTemplateItem : IUtf8JsonSerializable, IJson void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,34 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri throw new FormatException($"The model {nameof(MessageTemplateItem)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - writer.WritePropertyName("language"u8); - writer.WriteStringValue(Language); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); + base.JsonModelWriteCore(writer, options); } MessageTemplateItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownMessageTemplateValue.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownMessageTemplateValue.Serialization.cs index 18de3dc349a2..1ae9e8756eb0 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownMessageTemplateValue.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownMessageTemplateValue.Serialization.cs @@ -18,6 +18,15 @@ internal partial class UnknownMessageTemplateValue : IUtf8JsonSerializable, IJso void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,27 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWr throw new FormatException($"The model {nameof(MessageTemplateValue)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); + base.JsonModelWriteCore(writer, options); } MessageTemplateValue IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownNotificationContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownNotificationContent.Serialization.cs index 8759c4831d14..79a95cc634b1 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownNotificationContent.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownNotificationContent.Serialization.cs @@ -18,6 +18,15 @@ internal partial class UnknownNotificationContent : IUtf8JsonSerializable, IJson void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,34 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWri throw new FormatException($"The model {nameof(NotificationContent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); - writer.WritePropertyName("channelRegistrationId"u8); - writer.WriteStringValue(ChannelRegistrationId); - writer.WritePropertyName("to"u8); - writer.WriteStartArray(); - foreach (var item in To) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); + base.JsonModelWriteCore(writer, options); } NotificationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/VideoNotificationContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/VideoNotificationContent.Serialization.cs index cf6e676ed1c4..bbe8731bb4a1 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/VideoNotificationContent.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/VideoNotificationContent.Serialization.cs @@ -18,6 +18,15 @@ public partial class VideoNotificationContent : IUtf8JsonSerializable, IJsonMode void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead throw new FormatException($"The model {nameof(VideoNotificationContent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Caption)) { writer.WritePropertyName("caption"u8); @@ -33,33 +42,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelRead } writer.WritePropertyName("mediaUri"u8); writer.WriteStringValue(MediaUri.AbsoluteUri); - writer.WritePropertyName("channelRegistrationId"u8); - writer.WriteStringValue(ChannelRegistrationId); - writer.WritePropertyName("to"u8); - writer.WriteStartArray(); - foreach (var item in To) - { - writer.WriteStringValue(item); - } - writer.WriteEndArray(); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } VideoNotificationContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindings.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindings.Serialization.cs index f1e94b691a40..9c6a7152b7fc 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindings.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindings.Serialization.cs @@ -18,6 +18,15 @@ public partial class WhatsAppMessageTemplateBindings : IUtf8JsonSerializable, IJ void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo throw new FormatException($"The model {nameof(WhatsAppMessageTemplateBindings)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsCollectionDefined(Header)) { writer.WritePropertyName("header"u8); @@ -66,24 +75,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, Mo } writer.WriteEndArray(); } - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } WhatsAppMessageTemplateBindings IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsButton.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsButton.Serialization.cs index e22eda0da063..1429326f6739 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsButton.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsButton.Serialization.cs @@ -18,6 +18,15 @@ public partial class WhatsAppMessageTemplateBindingsButton : IUtf8JsonSerializab void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter writ throw new FormatException($"The model {nameof(WhatsAppMessageTemplateBindingsButton)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("subType"u8); writer.WriteStringValue(SubType); writer.WritePropertyName("refValue"u8); @@ -45,7 +53,6 @@ void IJsonModel.Write(Utf8JsonWriter writ #endif } } - writer.WriteEndObject(); } WhatsAppMessageTemplateBindingsButton IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsComponent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsComponent.Serialization.cs index 368824457cfa..f314c3774c65 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsComponent.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsComponent.Serialization.cs @@ -18,6 +18,15 @@ public partial class WhatsAppMessageTemplateBindingsComponent : IUtf8JsonSeriali void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected virtual void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,6 @@ void IJsonModel.Write(Utf8JsonWriter w throw new FormatException($"The model {nameof(WhatsAppMessageTemplateBindingsComponent)} does not support writing '{format}' format."); } - writer.WriteStartObject(); writer.WritePropertyName("refValue"u8); writer.WriteStringValue(RefValue); if (options.Format != "W" && _serializedAdditionalRawData != null) @@ -43,7 +51,6 @@ void IJsonModel.Write(Utf8JsonWriter w #endif } } - writer.WriteEndObject(); } WhatsAppMessageTemplateBindingsComponent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateItem.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateItem.Serialization.cs index 9da5a4adfd01..b5a859d6a03d 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateItem.Serialization.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateItem.Serialization.cs @@ -18,6 +18,15 @@ public partial class WhatsAppMessageTemplateItem : IUtf8JsonSerializable, IJsonM void IUtf8JsonSerializable.Write(Utf8JsonWriter writer) => ((IJsonModel)this).Write(writer, ModelSerializationExtensions.WireOptions); void IJsonModel.Write(Utf8JsonWriter writer, ModelReaderWriterOptions options) + { + writer.WriteStartObject(); + JsonModelWriteCore(writer, options); + writer.WriteEndObject(); + } + + /// The JSON writer. + /// The client options for reading and writing models. + protected override void JsonModelWriteCore(Utf8JsonWriter writer, ModelReaderWriterOptions options) { var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; if (format != "J") @@ -25,7 +34,7 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR throw new FormatException($"The model {nameof(WhatsAppMessageTemplateItem)} does not support writing '{format}' format."); } - writer.WriteStartObject(); + base.JsonModelWriteCore(writer, options); if (Optional.IsDefined(Content)) { writer.WritePropertyName("content"u8); @@ -38,33 +47,6 @@ void IJsonModel.Write(Utf8JsonWriter writer, ModelR } #endif } - if (options.Format != "W") - { - writer.WritePropertyName("name"u8); - writer.WriteStringValue(Name); - } - writer.WritePropertyName("language"u8); - writer.WriteStringValue(Language); - writer.WritePropertyName("status"u8); - writer.WriteStringValue(Status.ToString()); - writer.WritePropertyName("kind"u8); - writer.WriteStringValue(Kind.ToString()); - if (options.Format != "W" && _serializedAdditionalRawData != null) - { - foreach (var item in _serializedAdditionalRawData) - { - writer.WritePropertyName(item.Key); -#if NET6_0_OR_GREATER - writer.WriteRawValue(item.Value); -#else - using (JsonDocument document = JsonDocument.Parse(item.Value)) - { - JsonSerializer.Serialize(writer, document.RootElement); - } -#endif - } - } - writer.WriteEndObject(); } WhatsAppMessageTemplateItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) diff --git a/sdk/communication/Azure.Communication.Messages/tsp-location.yaml b/sdk/communication/Azure.Communication.Messages/tsp-location.yaml index 9c9e66f49dcd..93de2c235764 100644 --- a/sdk/communication/Azure.Communication.Messages/tsp-location.yaml +++ b/sdk/communication/Azure.Communication.Messages/tsp-location.yaml @@ -1,4 +1,4 @@ -commit: abe3209e7c6924a58ab560ebab2349bc8fde6aa7 directory: specification/communication/Communication.Messages -additionalDirectories: [] +commit: e161f256c54821517e2649445731663170694073 repo: Azure/azure-rest-api-specs +additionalDirectories: