diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/AddParticipantsOptions.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/AddParticipantsOptions.Serialization.cs new file mode 100644 index 000000000000..77031de59769 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/AddParticipantsOptions.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class AddParticipantsOptions : 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") + { + throw new FormatException($"The model {nameof(AddParticipantsOptions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("participants"u8); + writer.WriteStartArray(); + foreach (var item in Participants) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AddParticipantsOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AddParticipantsOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAddParticipantsOptions(document.RootElement, options); + } + + internal static AddParticipantsOptions DeserializeAddParticipantsOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList participants = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("participants"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationParticipant.DeserializeConversationParticipant(item, options)); + } + participants = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AddParticipantsOptions(participants, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AddParticipantsOptions)} does not support writing '{options.Format}' format."); + } + } + + AddParticipantsOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAddParticipantsOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AddParticipantsOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AddParticipantsOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAddParticipantsOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/AddParticipantsOptions.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/AddParticipantsOptions.cs new file mode 100644 index 000000000000..4ddd8a8c034f --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/AddParticipantsOptions.cs @@ -0,0 +1,88 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Communication.Messages +{ + /// Request payload for adding participants to a conversation. + public partial class AddParticipantsOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// List of participants to add. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// is null. + public AddParticipantsOptions(IEnumerable participants) + { + Argument.AssertNotNull(participants, nameof(participants)); + + Participants = participants.ToList(); + } + + /// Initializes a new instance of . + /// + /// List of participants to add. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Keeps track of any properties unknown to the library. + internal AddParticipantsOptions(IList participants, IDictionary serializedAdditionalRawData) + { + Participants = participants; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AddParticipantsOptions() + { + } + + /// + /// List of participants to add. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IList Participants { get; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/AddParticipantsResult.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/AddParticipantsResult.Serialization.cs new file mode 100644 index 000000000000..e2e58afa863e --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/AddParticipantsResult.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class AddParticipantsResult : 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") + { + throw new FormatException($"The model {nameof(AddParticipantsResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("invalidParticipants"u8); + writer.WriteStartArray(); + foreach (var item in InvalidParticipants) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + AddParticipantsResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AddParticipantsResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAddParticipantsResult(document.RootElement, options); + } + + internal static AddParticipantsResult DeserializeAddParticipantsResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList invalidParticipants = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("invalidParticipants"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(UpdateParticipantsResult.DeserializeUpdateParticipantsResult(item, options)); + } + invalidParticipants = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AddParticipantsResult(invalidParticipants, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AddParticipantsResult)} does not support writing '{options.Format}' format."); + } + } + + AddParticipantsResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAddParticipantsResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AddParticipantsResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static AddParticipantsResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAddParticipantsResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/AddParticipantsResult.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/AddParticipantsResult.cs new file mode 100644 index 000000000000..4abe4b2343a6 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/AddParticipantsResult.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Communication.Messages +{ + /// Response for the add participants operation. + public partial class AddParticipantsResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// List of Ids with Errors if failed to be added. + /// is null. + internal AddParticipantsResult(IEnumerable invalidParticipants) + { + Argument.AssertNotNull(invalidParticipants, nameof(invalidParticipants)); + + InvalidParticipants = invalidParticipants.ToList(); + } + + /// Initializes a new instance of . + /// List of Ids with Errors if failed to be added. + /// Keeps track of any properties unknown to the library. + internal AddParticipantsResult(IReadOnlyList invalidParticipants, IDictionary serializedAdditionalRawData) + { + InvalidParticipants = invalidParticipants; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal AddParticipantsResult() + { + } + + /// List of Ids with Errors if failed to be added. + public IReadOnlyList InvalidParticipants { get; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/AudioConversationMessageContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/AudioConversationMessageContent.Serialization.cs new file mode 100644 index 000000000000..6f7ed711b00a --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/AudioConversationMessageContent.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class AudioConversationMessageContent : 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") + { + throw new FormatException($"The model {nameof(AudioConversationMessageContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("mediaUri"u8); + writer.WriteStringValue(MediaUri.AbsoluteUri); + } + + AudioConversationMessageContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(AudioConversationMessageContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeAudioConversationMessageContent(document.RootElement, options); + } + + internal static AudioConversationMessageContent DeserializeAudioConversationMessageContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Uri mediaUri = default; + CommunicationMessageKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("mediaUri"u8)) + { + mediaUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new CommunicationMessageKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new AudioConversationMessageContent(kind, serializedAdditionalRawData, mediaUri); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(AudioConversationMessageContent)} does not support writing '{options.Format}' format."); + } + } + + AudioConversationMessageContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAudioConversationMessageContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(AudioConversationMessageContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new AudioConversationMessageContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeAudioConversationMessageContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/AudioConversationMessageContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/AudioConversationMessageContent.cs new file mode 100644 index 000000000000..45727d927894 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/AudioConversationMessageContent.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// A request to send an audio conversation message. + public partial class AudioConversationMessageContent : ConversationMessageContent + { + /// Initializes a new instance of . + /// A media url for the file. Required if the type is one of the supported media types, e.g. image. + /// is null. + public AudioConversationMessageContent(Uri mediaUri) + { + Argument.AssertNotNull(mediaUri, nameof(mediaUri)); + + Kind = CommunicationMessageKind.Audio; + MediaUri = mediaUri; + } + + /// Initializes a new instance of . + /// The type discriminator describing a message type. + /// Keeps track of any properties unknown to the library. + /// A media url for the file. Required if the type is one of the supported media types, e.g. image. + internal AudioConversationMessageContent(CommunicationMessageKind kind, IDictionary serializedAdditionalRawData, Uri mediaUri) : base(kind, serializedAdditionalRawData) + { + MediaUri = mediaUri; + } + + /// Initializes a new instance of for deserialization. + internal AudioConversationMessageContent() + { + } + + /// A media url for the file. Required if the type is one of the supported media types, e.g. image. + public Uri MediaUri { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/AudioNotificationContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/AudioNotificationContent.cs index 653d644d43db..c5609d2078ac 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/AudioNotificationContent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/AudioNotificationContent.cs @@ -30,7 +30,7 @@ public AudioNotificationContent(Guid channelRegistrationId, IEnumerable /// Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// Keeps track of any properties unknown to the library. /// A media url for the file. Required if the type is one of the supported media types, e.g. image. internal AudioNotificationContent(Guid channelRegistrationId, IList to, CommunicationMessageKind kind, IDictionary serializedAdditionalRawData, Uri mediaUri) : base(channelRegistrationId, to, kind, serializedAdditionalRawData) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/BotContact.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/BotContact.Serialization.cs new file mode 100644 index 000000000000..7503c10f0b09 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/BotContact.Serialization.cs @@ -0,0 +1,140 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class BotContact : 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") + { + throw new FormatException($"The model {nameof(BotContact)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("botAppId"u8); + writer.WriteStringValue(BotAppId); + } + + BotContact IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(BotContact)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeBotContact(document.RootElement, options); + } + + internal static BotContact DeserializeBotContact(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string botAppId = default; + string id = default; + MessagePlatformKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("botAppId"u8)) + { + botAppId = property.Value.GetString(); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new MessagePlatformKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new BotContact(id, kind, serializedAdditionalRawData, botAppId); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(BotContact)} does not support writing '{options.Format}' format."); + } + } + + BotContact IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBotContact(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(BotContact)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new BotContact FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeBotContact(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/BotContact.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/BotContact.cs new file mode 100644 index 000000000000..fe9f8ea215cb --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/BotContact.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// Bot Contact. + public partial class BotContact : ConversationContact + { + /// Initializes a new instance of . + /// External platform identifier. + /// Bot App Id of the Bot Contact. + /// or is null. + public BotContact(string id, string botAppId) : base(id) + { + Argument.AssertNotNull(id, nameof(id)); + Argument.AssertNotNull(botAppId, nameof(botAppId)); + + Kind = MessagePlatformKind.Bot; + BotAppId = botAppId; + } + + /// Initializes a new instance of . + /// External platform identifier. + /// Type of message platform (e.g., WhatsApp). + /// Keeps track of any properties unknown to the library. + /// Bot App Id of the Bot Contact. + internal BotContact(string id, MessagePlatformKind kind, IDictionary serializedAdditionalRawData, string botAppId) : base(id, kind, serializedAdditionalRawData) + { + BotAppId = botAppId; + } + + /// Initializes a new instance of for deserialization. + internal BotContact() + { + } + + /// Bot App Id of the Bot Contact. + public string BotAppId { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationContact.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationContact.Serialization.cs new file mode 100644 index 000000000000..869bc9c72eeb --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationContact.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class CommunicationContact : 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") + { + throw new FormatException($"The model {nameof(CommunicationContact)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + CommunicationContact IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CommunicationContact)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationContact(document.RootElement, options); + } + + internal static CommunicationContact DeserializeCommunicationContact(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + MessagePlatformKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new MessagePlatformKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CommunicationContact(id, kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CommunicationContact)} does not support writing '{options.Format}' format."); + } + } + + CommunicationContact IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCommunicationContact(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CommunicationContact)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new CommunicationContact FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCommunicationContact(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationContact.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationContact.cs new file mode 100644 index 000000000000..41b2101542d9 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationContact.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// Communication Contact. + public partial class CommunicationContact : ConversationContact + { + /// Initializes a new instance of . + /// External platform identifier. + /// is null. + public CommunicationContact(string id) : base(id) + { + Argument.AssertNotNull(id, nameof(id)); + + Kind = MessagePlatformKind.Communication; + } + + /// Initializes a new instance of . + /// External platform identifier. + /// Type of message platform (e.g., WhatsApp). + /// Keeps track of any properties unknown to the library. + internal CommunicationContact(string id, MessagePlatformKind kind, IDictionary serializedAdditionalRawData) : base(id, kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal CommunicationContact() + { + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationConversation.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationConversation.Serialization.cs new file mode 100644 index 000000000000..da128e485f4c --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationConversation.Serialization.cs @@ -0,0 +1,227 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class CommunicationConversation : 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") + { + throw new FormatException($"The model {nameof(CommunicationConversation)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(Topic)) + { + writer.WritePropertyName("topic"u8); + writer.WriteStringValue(Topic); + } + if (Optional.IsCollectionDefined(DeliveryChannelIds)) + { + writer.WritePropertyName("deliveryChannelIds"u8); + writer.WriteStartArray(); + foreach (var item in DeliveryChannelIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + } + if (Optional.IsDefined(OutboundDeliveryStrategy)) + { + writer.WritePropertyName("outboundDeliveryStrategy"u8); + writer.WriteStringValue(OutboundDeliveryStrategy.Value.ToString()); + } + if (Optional.IsCollectionDefined(Participants)) + { + writer.WritePropertyName("participants"u8); + writer.WriteStartArray(); + foreach (var item in Participants) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CommunicationConversation IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CommunicationConversation)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCommunicationConversation(document.RootElement, options); + } + + internal static CommunicationConversation DeserializeCommunicationConversation(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string topic = default; + IList deliveryChannelIds = default; + OutboundDeliveryStrategyKind? outboundDeliveryStrategy = default; + IList participants = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("topic"u8)) + { + topic = property.Value.GetString(); + continue; + } + if (property.NameEquals("deliveryChannelIds"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + deliveryChannelIds = array; + continue; + } + if (property.NameEquals("outboundDeliveryStrategy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + outboundDeliveryStrategy = new OutboundDeliveryStrategyKind(property.Value.GetString()); + continue; + } + if (property.NameEquals("participants"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationParticipant.DeserializeConversationParticipant(item, options)); + } + participants = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CommunicationConversation( + id, + topic, + deliveryChannelIds ?? new ChangeTrackingList(), + outboundDeliveryStrategy, + participants ?? new ChangeTrackingList(), + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CommunicationConversation)} does not support writing '{options.Format}' format."); + } + } + + CommunicationConversation IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCommunicationConversation(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CommunicationConversation)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CommunicationConversation FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCommunicationConversation(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationConversation.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationConversation.cs new file mode 100644 index 000000000000..ec4bbea7166f --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationConversation.cs @@ -0,0 +1,91 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// A conversation. + public partial class CommunicationConversation + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + public CommunicationConversation() + { + DeliveryChannelIds = new ChangeTrackingList(); + Participants = new ChangeTrackingList(); + } + + /// Initializes a new instance of . + /// The conversation ID. + /// The conversation topic. + /// List of delivery channel IDs. + /// Outbound delivery strategy for the conversation. + /// + /// List of participants involved in the conversation. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// Keeps track of any properties unknown to the library. + internal CommunicationConversation(string id, string topic, IList deliveryChannelIds, OutboundDeliveryStrategyKind? outboundDeliveryStrategy, IList participants, IDictionary serializedAdditionalRawData) + { + Id = id; + Topic = topic; + DeliveryChannelIds = deliveryChannelIds; + OutboundDeliveryStrategy = outboundDeliveryStrategy; + Participants = participants; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The conversation ID. + public string Id { get; } + /// The conversation topic. + public string Topic { get; set; } + /// List of delivery channel IDs. + public IList DeliveryChannelIds { get; } + /// Outbound delivery strategy for the conversation. + public OutboundDeliveryStrategyKind? OutboundDeliveryStrategy { get; set; } + /// + /// List of participants involved in the conversation. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public IList Participants { get; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationMessagesClientBuilderExtensions.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationMessagesClientBuilderExtensions.cs index ed2d8514d8be..281cc15e785d 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationMessagesClientBuilderExtensions.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationMessagesClientBuilderExtensions.cs @@ -12,7 +12,7 @@ namespace Microsoft.Extensions.Azure { - /// Extension methods to add , to client builder. + /// Extension methods to add , , , to client builder. public static partial class CommunicationMessagesClientBuilderExtensions { /// Registers a instance. @@ -53,6 +53,44 @@ public static IAzureClientBuilder((options, cred) => new MessageTemplateClient(endpoint, cred, options)); } + /// Registers a instance. + /// The builder to register with. + /// The communication resource, for example https://my-resource.communication.azure.com. + /// A credential used to authenticate to an Azure Service. + public static IAzureClientBuilder AddConversationAdministrationClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new ConversationAdministrationClient(endpoint, credential, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The communication resource, for example https://my-resource.communication.azure.com. + public static IAzureClientBuilder AddConversationAdministrationClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new ConversationAdministrationClient(endpoint, cred, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The communication resource, for example https://my-resource.communication.azure.com. + /// A credential used to authenticate to an Azure Service. + public static IAzureClientBuilder AddConversationThreadClient(this TBuilder builder, Uri endpoint, AzureKeyCredential credential) + where TBuilder : IAzureClientFactoryBuilder + { + return builder.RegisterClientFactory((options) => new ConversationThreadClient(endpoint, credential, options)); + } + + /// Registers a instance. + /// The builder to register with. + /// The communication resource, for example https://my-resource.communication.azure.com. + public static IAzureClientBuilder AddConversationThreadClient(this TBuilder builder, Uri endpoint) + where TBuilder : IAzureClientFactoryBuilderWithCredential + { + return builder.RegisterClientFactory((options, cred) => new ConversationThreadClient(endpoint, cred, options)); + } + /// Registers a instance. /// The builder to register with. /// The configuration values. @@ -69,5 +107,21 @@ public static IAzureClientBuilder(configuration); } + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddConversationAdministrationClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } + /// Registers a instance. + /// The builder to register with. + /// The configuration values. + public static IAzureClientBuilder AddConversationThreadClient(this TBuilder builder, TConfiguration configuration) + where TBuilder : IAzureClientFactoryBuilderWithConfiguration + { + return builder.RegisterClientFactory(configuration); + } } } diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationMessagesClientOptions.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationMessagesClientOptions.cs index 9322a32fee38..9ffc2e4af50d 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationMessagesClientOptions.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationMessagesClientOptions.cs @@ -13,7 +13,7 @@ namespace Azure.Communication.Messages /// Client options for Azure.Communication.Messages library clients. public partial class CommunicationMessagesClientOptions : ClientOptions { - private const ServiceVersion LatestVersion = ServiceVersion.V2025_01_15_Preview; + private const ServiceVersion LatestVersion = ServiceVersion.V2025_04_01_Preview; /// The version of the service to use. public enum ServiceVersion @@ -24,6 +24,8 @@ public enum ServiceVersion V2024_08_30 = 2, /// Service version "2025-01-15-preview". V2025_01_15_Preview = 3, + /// Service version "2025-04-01-preview". + V2025_04_01_Preview = 4, } internal string Version { get; } @@ -36,6 +38,7 @@ public CommunicationMessagesClientOptions(ServiceVersion version = LatestVersion ServiceVersion.V2024_02_01 => "2024-02-01", ServiceVersion.V2024_08_30 => "2024-08-30", ServiceVersion.V2025_01_15_Preview => "2025-01-15-preview", + ServiceVersion.V2025_04_01_Preview => "2025-04-01-preview", _ => throw new NotSupportedException() }; } diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationMessagesModelFactory.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationMessagesModelFactory.cs index 75228e42aea8..57c7476958cc 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationMessagesModelFactory.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/CommunicationMessagesModelFactory.cs @@ -18,7 +18,7 @@ public static partial class CommunicationMessagesModelFactory /// Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// A new instance for mocking. public static NotificationContent NotificationContent(Guid channelRegistrationId = default, IEnumerable to = null, string kind = null) { @@ -260,106 +260,6 @@ public static TemplateNotificationContent TemplateNotificationContent(Guid chann return new TemplateNotificationContent(channelRegistrationId, to?.ToList(), CommunicationMessageKind.Template, serializedAdditionalRawData: null, template); } - /// Initializes a new instance of . - /// Name of the template. - /// The template's language, in the ISO 639 format, consist of a two-letter language code followed by an optional two-letter country code, e.g., 'en' or 'en_US'. - /// - /// The template values. - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include , , , , and . - /// - /// - /// The binding object to link values to the template specific locations - /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. - /// The available derived classes include . - /// - /// A new instance for mocking. - public static MessageTemplate MessageTemplate(string name = null, string language = null, IEnumerable values = null, MessageTemplateBindings bindings = null) - { - values ??= new List(); - - return new MessageTemplate(name, language, values?.ToList(), bindings, serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Template binding reference name. - /// The type discriminator describing a template parameter type. - /// A new instance for mocking. - public static MessageTemplateValue MessageTemplateValue(string name = null, string kind = null) - { - return new UnknownMessageTemplateValue(name, kind == null ? default : new MessageTemplateValueKind(kind), serializedAdditionalRawData: null); - } - - /// Initializes a new instance of . - /// Template binding reference name. - /// The text value. - /// A new instance for mocking. - public static MessageTemplateText MessageTemplateText(string name = null, string text = null) - { - return new MessageTemplateText(name, MessageTemplateValueKind.Text, serializedAdditionalRawData: null, text); - } - - /// Initializes a new instance of . - /// Template binding reference name. - /// The (public) URL of the media. - /// The [optional] caption of the media object. - /// The [optional] filename of the media file. - /// A new instance for mocking. - public static MessageTemplateImage MessageTemplateImage(string name = null, Uri uri = null, string caption = null, string fileName = null) - { - return new MessageTemplateImage( - name, - MessageTemplateValueKind.Image, - serializedAdditionalRawData: null, - uri, - caption, - fileName); - } - - /// Initializes a new instance of . - /// Template binding reference name. - /// The (public) URL of the media. - /// The [optional] caption of the media object. - /// The [optional] filename of the media file. - /// A new instance for mocking. - public static MessageTemplateDocument MessageTemplateDocument(string name = null, Uri uri = null, string caption = null, string fileName = null) - { - return new MessageTemplateDocument( - name, - MessageTemplateValueKind.Document, - serializedAdditionalRawData: null, - uri, - caption, - fileName); - } - - /// Initializes a new instance of . - /// Template binding reference name. - /// The (public) URL of the media. - /// The [optional] caption of the media object. - /// The [optional] filename of the media file. - /// A new instance for mocking. - public static MessageTemplateVideo MessageTemplateVideo(string name = null, Uri uri = null, string caption = null, string fileName = null) - { - return new MessageTemplateVideo( - name, - MessageTemplateValueKind.Video, - serializedAdditionalRawData: null, - uri, - caption, - fileName); - } - - /// Initializes a new instance of . - /// Template binding reference name. - /// The [Optional] quick action text. - /// The [Optional] quick action payload. - /// A new instance for mocking. - public static MessageTemplateQuickAction MessageTemplateQuickAction(string name = null, string text = null, string payload = null) - { - return new MessageTemplateQuickAction(name, MessageTemplateValueKind.QuickAction, serializedAdditionalRawData: null, text, payload); - } - /// Initializes a new instance of . /// Receipts of the send message operation. /// A new instance for mocking. @@ -406,5 +306,155 @@ public static WhatsAppMessageTemplateItem WhatsAppMessageTemplateItem(string nam serializedAdditionalRawData: null, content); } + + /// Initializes a new instance of . + /// The conversation ID. + /// The conversation topic. + /// List of delivery channel IDs. + /// Outbound delivery strategy for the conversation. + /// + /// List of participants involved in the conversation. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + /// A new instance for mocking. + public static CommunicationConversation CommunicationConversation(string id = null, string topic = null, IEnumerable deliveryChannelIds = null, OutboundDeliveryStrategyKind? outboundDeliveryStrategy = null, IEnumerable participants = null) + { + deliveryChannelIds ??= new List(); + participants ??= new List(); + + return new CommunicationConversation( + id, + topic, + deliveryChannelIds?.ToList(), + outboundDeliveryStrategy, + participants?.ToList(), + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Participant Identifier. + /// Participant display name. + /// The type discriminator describing a participant type. + /// A new instance for mocking. + public static ConversationParticipant ConversationParticipant(string id = null, string displayName = null, string kind = null) + { + return new UnknownConversationParticipant(id, displayName, kind == null ? default : new ParticipantKind(kind), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Participant Identifier. + /// Participant display name. + /// + /// The internal platform identifiers for the participant. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// A new instance for mocking. + public static InternalConversationParticipant InternalConversationParticipant(string id = null, string displayName = null, ConversationContact contact = null) + { + return new InternalConversationParticipant(id, displayName, ParticipantKind.Internal, serializedAdditionalRawData: null, contact); + } + + /// Initializes a new instance of . + /// Participant Identifier. + /// Participant display name. + /// + /// List of external platform identifiers for the participant. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// A new instance for mocking. + public static ExternalConversationParticipant ExternalConversationParticipant(string id = null, string displayName = null, IEnumerable contacts = null) + { + contacts ??= new List(); + + return new ExternalConversationParticipant(id, displayName, ParticipantKind.External, serializedAdditionalRawData: null, contacts?.ToList()); + } + + /// Initializes a new instance of . + /// Message ID. + /// Message sequence ID. + /// + /// Payload of a threaded conversation message. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , and . + /// + /// The display name of the message sender. + /// The communication identifier of the message sender. + /// Timestamp when the message is sent. + /// A new instance for mocking. + public static ConversationMessageItem ConversationMessageItem(string id = null, long? sequenceId = null, ConversationMessageContent message = null, string senderDisplayName = null, string senderCommunicationIdentifier = null, DateTimeOffset createdOn = default) + { + return new ConversationMessageItem( + id, + sequenceId, + message, + senderDisplayName, + senderCommunicationIdentifier, + createdOn, + serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of Ids with Errors if failed to be added. + /// A new instance for mocking. + public static AddParticipantsResult AddParticipantsResult(IEnumerable invalidParticipants = null) + { + invalidParticipants ??= new List(); + + return new AddParticipantsResult(invalidParticipants?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// Participant User Id. + /// Error of the participant operation. + /// A new instance for mocking. + public static UpdateParticipantsResult UpdateParticipantsResult(string id = null, ResponseError error = null) + { + return new UpdateParticipantsResult(id, error, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// List of Ids with Errors if failed to be added. + /// A new instance for mocking. + public static RemoveParticipantsResult RemoveParticipantsResult(IEnumerable invalidParticipants = null) + { + invalidParticipants ??= new List(); + + return new RemoveParticipantsResult(invalidParticipants?.ToList(), serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// The AI summary of the conversation messages. + /// A new instance for mocking. + public static GetConversationThreadAnalysisResult GetConversationThreadAnalysisResult(string summary = null) + { + return new GetConversationThreadAnalysisResult(summary, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// + /// Details of a send conversation message request. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , and . + /// + /// + /// The options of the outbound delivery strategy for messages sent by participants in a conversation. + /// Supports internalOnly, allChannels. + /// + /// A new instance for mocking. + public static SendConversationMessageOptions SendConversationMessageOptions(ConversationMessageContent request = null, OutboundDeliveryStrategyKind? outboundDeliveryStrategy = null) + { + return new SendConversationMessageOptions(request, outboundDeliveryStrategy, serializedAdditionalRawData: null); + } + + /// Initializes a new instance of . + /// A server-generated Advanced Messaging conversation message id. + /// A new instance for mocking. + public static SendConversationMessageResult SendConversationMessageResult(string messageId = null) + { + return new SendConversationMessageResult(messageId, serializedAdditionalRawData: null); + } } } diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationAdministrationClient.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationAdministrationClient.cs new file mode 100644 index 000000000000..f11a5132d23b --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationAdministrationClient.cs @@ -0,0 +1,1216 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Communication.Messages +{ + // Data plane generated client. + /// The ConversationAdministration service client. + public partial class ConversationAdministrationClient + { + private const string AuthorizationHeader = "Authorization"; + private readonly AzureKeyCredential _keyCredential; + private const string AuthorizationApiKeyPrefix = "Bearer"; + private static readonly string[] AuthorizationScopes = new string[] { "https://communication.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of ConversationAdministrationClient for mocking. + protected ConversationAdministrationClient() + { + } + + /// Initializes a new instance of ConversationAdministrationClient. + /// The communication resource, for example https://my-resource.communication.azure.com. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public ConversationAdministrationClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new CommunicationMessagesClientOptions()) + { + } + + /// Initializes a new instance of ConversationAdministrationClient. + /// The communication resource, for example https://my-resource.communication.azure.com. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public ConversationAdministrationClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new CommunicationMessagesClientOptions()) + { + } + + /// Initializes a new instance of ConversationAdministrationClient. + /// The communication resource, for example https://my-resource.communication.azure.com. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public ConversationAdministrationClient(Uri endpoint, AzureKeyCredential credential, CommunicationMessagesClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new CommunicationMessagesClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _keyCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader, AuthorizationApiKeyPrefix) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// Initializes a new instance of ConversationAdministrationClient. + /// The communication resource, for example https://my-resource.communication.azure.com. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public ConversationAdministrationClient(Uri endpoint, TokenCredential credential, CommunicationMessagesClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new CommunicationMessagesClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// Creates a new conversation. This is only for create operation. + /// The conversation details. + /// An initial message within the conversation. + /// The cancellation token to use. + /// is null. + /// + public virtual async Task> CreateConversationAsync(CommunicationConversation conversation, ConversationMessage initialMessage = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(conversation, nameof(conversation)); + + CreateConversationRequest1 createConversationRequest1 = new CreateConversationRequest1(conversation, initialMessage, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await CreateConversationAsync(createConversationRequest1.ToRequestContent(), context).ConfigureAwait(false); + return Response.FromValue(CommunicationConversation.FromResponse(response), response); + } + + /// Creates a new conversation. This is only for create operation. + /// The conversation details. + /// An initial message within the conversation. + /// The cancellation token to use. + /// is null. + /// + public virtual Response CreateConversation(CommunicationConversation conversation, ConversationMessage initialMessage = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNull(conversation, nameof(conversation)); + + CreateConversationRequest1 createConversationRequest1 = new CreateConversationRequest1(conversation, initialMessage, null); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = CreateConversation(createConversationRequest1.ToRequestContent(), context); + return Response.FromValue(CommunicationConversation.FromResponse(response), response); + } + + /// + /// [Protocol Method] Creates a new conversation. This is only for create operation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task CreateConversationAsync(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.CreateConversation"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateConversationRequest(content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Creates a new conversation. This is only for create operation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response CreateConversation(RequestContent content, RequestContext context = null) + { + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.CreateConversation"); + scope.Start(); + try + { + using HttpMessage message = CreateCreateConversationRequest(content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Gets the details of a specific conversation. + /// The conversation ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> GetConversationAsync(string conversationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await GetConversationAsync(conversationId, context).ConfigureAwait(false); + return Response.FromValue(CommunicationConversation.FromResponse(response), response); + } + + /// Gets the details of a specific conversation. + /// The conversation ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response GetConversation(string conversationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = GetConversation(conversationId, context); + return Response.FromValue(CommunicationConversation.FromResponse(response), response); + } + + /// + /// [Protocol Method] Gets the details of a specific conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task GetConversationAsync(string conversationId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.GetConversation"); + scope.Start(); + try + { + using HttpMessage message = CreateGetConversationRequest(conversationId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Gets the details of a specific conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response GetConversation(string conversationId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.GetConversation"); + scope.Start(); + try + { + using HttpMessage message = CreateGetConversationRequest(conversationId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Deletes a specific conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The conversation ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task DeleteConversationAsync(string conversationId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.DeleteConversation"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteConversationRequest(conversationId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Deletes a specific conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The conversation ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response DeleteConversation(string conversationId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.DeleteConversation"); + scope.Start(); + try + { + using HttpMessage message = CreateDeleteConversationRequest(conversationId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Terminates a specific conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The conversation ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task TerminateConversationAsync(string conversationId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.TerminateConversation"); + scope.Start(); + try + { + using HttpMessage message = CreateTerminateConversationRequest(conversationId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + // The convenience method is omitted here because it has exactly the same parameter list as the corresponding protocol method + /// + /// [Protocol Method] Terminates a specific conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// The conversation ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response TerminateConversation(string conversationId, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.TerminateConversation"); + scope.Start(); + try + { + using HttpMessage message = CreateTerminateConversationRequest(conversationId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Adds participants to a specific conversation. + /// The conversation ID. + /// Details of the payload for adding participants to a conversation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> AddParticipantsAsync(string conversationId, AddParticipantsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(options, nameof(options)); + + using RequestContent content = options.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await AddParticipantsAsync(conversationId, content, context).ConfigureAwait(false); + return Response.FromValue(AddParticipantsResult.FromResponse(response), response); + } + + /// Adds participants to a specific conversation. + /// The conversation ID. + /// Details of the payload for adding participants to a conversation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response AddParticipants(string conversationId, AddParticipantsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(options, nameof(options)); + + using RequestContent content = options.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = AddParticipants(conversationId, content, context); + return Response.FromValue(AddParticipantsResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Adds participants to a specific conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task AddParticipantsAsync(string conversationId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.AddParticipants"); + scope.Start(); + try + { + using HttpMessage message = CreateAddParticipantsRequest(conversationId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Adds participants to a specific conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response AddParticipants(string conversationId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.AddParticipants"); + scope.Start(); + try + { + using HttpMessage message = CreateAddParticipantsRequest(conversationId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// remove a participant from a conversation. + /// The conversation ID. + /// Details of the request body for removing participants from a conversation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> RemoveParticipantsAsync(string conversationId, RemoveParticipantsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(options, nameof(options)); + + using RequestContent content = options.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await RemoveParticipantsAsync(conversationId, content, context).ConfigureAwait(false); + return Response.FromValue(RemoveParticipantsResult.FromResponse(response), response); + } + + /// remove a participant from a conversation. + /// The conversation ID. + /// Details of the request body for removing participants from a conversation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response RemoveParticipants(string conversationId, RemoveParticipantsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(options, nameof(options)); + + using RequestContent content = options.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = RemoveParticipants(conversationId, content, context); + return Response.FromValue(RemoveParticipantsResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] remove a participant from a conversation + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task RemoveParticipantsAsync(string conversationId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.RemoveParticipants"); + scope.Start(); + try + { + using HttpMessage message = CreateRemoveParticipantsRequest(conversationId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] remove a participant from a conversation + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response RemoveParticipants(string conversationId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.RemoveParticipants"); + scope.Start(); + try + { + using HttpMessage message = CreateRemoveParticipantsRequest(conversationId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get AI Analysis of a conversation. + /// The conversation ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> AnalyzeConversationAsync(string conversationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await AnalyzeConversationAsync(conversationId, context).ConfigureAwait(false); + return Response.FromValue(GetConversationThreadAnalysisResult.FromResponse(response), response); + } + + /// Get AI Analysis of a conversation. + /// The conversation ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response AnalyzeConversation(string conversationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = AnalyzeConversation(conversationId, context); + return Response.FromValue(GetConversationThreadAnalysisResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get AI Analysis of a conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task AnalyzeConversationAsync(string conversationId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.AnalyzeConversation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeConversationRequest(conversationId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get AI Analysis of a conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response AnalyzeConversation(string conversationId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + using var scope = ClientDiagnostics.CreateScope("ConversationAdministrationClient.AnalyzeConversation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeConversationRequest(conversationId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves list of conversations. + /// Number of objects to return per page. + /// The participant user ID. + /// The id of channel. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetConversationsAsync(int? maxPageSize = null, string participantId = null, Guid? channelId = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConversationsRequest(maxPageSize, participantId, channelId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConversationsNextPageRequest(nextLink, maxPageSize, participantId, channelId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => CommunicationConversation.DeserializeCommunicationConversation(e), ClientDiagnostics, _pipeline, "ConversationAdministrationClient.GetConversations", "value", "nextLink", context); + } + + /// Retrieves list of conversations. + /// Number of objects to return per page. + /// The participant user ID. + /// The id of channel. + /// The cancellation token to use. + /// + public virtual Pageable GetConversations(int? maxPageSize = null, string participantId = null, Guid? channelId = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConversationsRequest(maxPageSize, participantId, channelId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConversationsNextPageRequest(nextLink, maxPageSize, participantId, channelId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => CommunicationConversation.DeserializeCommunicationConversation(e), ClientDiagnostics, _pipeline, "ConversationAdministrationClient.GetConversations", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves list of conversations. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Number of objects to return per page. + /// The participant user ID. + /// The id of channel. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetConversationsAsync(int? maxPageSize, string participantId, Guid? channelId, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConversationsRequest(maxPageSize, participantId, channelId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConversationsNextPageRequest(nextLink, maxPageSize, participantId, channelId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAdministrationClient.GetConversations", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves list of conversations. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Number of objects to return per page. + /// The participant user ID. + /// The id of channel. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetConversations(int? maxPageSize, string participantId, Guid? channelId, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConversationsRequest(maxPageSize, participantId, channelId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConversationsNextPageRequest(nextLink, maxPageSize, participantId, channelId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAdministrationClient.GetConversations", "value", "nextLink", context); + } + + /// Retrieves list of conversation messages. + /// The conversation ID. + /// Number of objects to return per page. + /// The participant user ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetMessagesAsync(string conversationId, int? maxPageSize = null, string participantId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMessagesRequest(conversationId, maxPageSize, participantId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMessagesNextPageRequest(nextLink, conversationId, maxPageSize, participantId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ConversationMessageItem.DeserializeConversationMessageItem(e), ClientDiagnostics, _pipeline, "ConversationAdministrationClient.GetMessages", "value", "nextLink", context); + } + + /// Retrieves list of conversation messages. + /// The conversation ID. + /// Number of objects to return per page. + /// The participant user ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetMessages(string conversationId, int? maxPageSize = null, string participantId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMessagesRequest(conversationId, maxPageSize, participantId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMessagesNextPageRequest(nextLink, conversationId, maxPageSize, participantId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ConversationMessageItem.DeserializeConversationMessageItem(e), ClientDiagnostics, _pipeline, "ConversationAdministrationClient.GetMessages", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves list of conversation messages. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// Number of objects to return per page. + /// The participant user ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetMessagesAsync(string conversationId, int? maxPageSize, string participantId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMessagesRequest(conversationId, maxPageSize, participantId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMessagesNextPageRequest(nextLink, conversationId, maxPageSize, participantId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAdministrationClient.GetMessages", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves list of conversation messages. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// Number of objects to return per page. + /// The participant user ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetMessages(string conversationId, int? maxPageSize, string participantId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMessagesRequest(conversationId, maxPageSize, participantId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMessagesNextPageRequest(nextLink, conversationId, maxPageSize, participantId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationAdministrationClient.GetMessages", "value", "nextLink", context); + } + + internal HttpMessage CreateCreateConversationRequest(RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier201); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetConversationRequest(string conversationId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations/", false); + uri.AppendPath(conversationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateDeleteConversationRequest(string conversationId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier204); + var request = message.Request; + request.Method = RequestMethod.Delete; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations/", false); + uri.AppendPath(conversationId, true); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + return message; + } + + internal HttpMessage CreateTerminateConversationRequest(string conversationId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations/", false); + uri.AppendPath(conversationId, true); + uri.AppendPath(":terminate", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + return message; + } + + internal HttpMessage CreateGetConversationsRequest(int? maxPageSize, string participantId, Guid? channelId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxPageSize != null) + { + uri.AppendQuery("maxPageSize", maxPageSize.Value, true); + } + if (participantId != null) + { + uri.AppendQuery("participantId", participantId, true); + } + if (channelId != null) + { + uri.AppendQuery("channelId", channelId.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetMessagesRequest(string conversationId, int? maxPageSize, string participantId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations/", false); + uri.AppendPath(conversationId, true); + uri.AppendPath("/messages", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxPageSize != null) + { + uri.AppendQuery("maxPageSize", maxPageSize.Value, true); + } + if (participantId != null) + { + uri.AppendQuery("participantId", participantId, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateAddParticipantsRequest(string conversationId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier207); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations/", false); + uri.AppendPath(conversationId, true); + uri.AppendPath("/participants:add", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateRemoveParticipantsRequest(string conversationId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier207); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations/", false); + uri.AppendPath(conversationId, true); + uri.AppendPath("/participants:remove", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateAnalyzeConversationRequest(string conversationId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations/", false); + uri.AppendPath(conversationId, true); + uri.AppendPath(":analyze", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + return message; + } + + internal HttpMessage CreateGetConversationsNextPageRequest(string nextLink, int? maxPageSize, string participantId, Guid? channelId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetMessagesNextPageRequest(string nextLink, string conversationId, int? maxPageSize, string participantId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier201; + private static ResponseClassifier ResponseClassifier201 => _responseClassifier201 ??= new StatusCodeClassifier(stackalloc ushort[] { 201 }); + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + private static ResponseClassifier _responseClassifier204; + private static ResponseClassifier ResponseClassifier204 => _responseClassifier204 ??= new StatusCodeClassifier(stackalloc ushort[] { 204 }); + private static ResponseClassifier _responseClassifier207; + private static ResponseClassifier ResponseClassifier207 => _responseClassifier207 ??= new StatusCodeClassifier(stackalloc ushort[] { 207 }); + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationContact.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationContact.Serialization.cs new file mode 100644 index 000000000000..93c9e0f28832 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationContact.Serialization.cs @@ -0,0 +1,137 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + [PersistableModelProxy(typeof(UnknownConversationContact))] + public partial class ConversationContact : 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") + { + throw new FormatException($"The model {nameof(ConversationContact)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ConversationContact IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationContact)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationContact(document.RootElement, options); + } + + internal static ConversationContact DeserializeConversationContact(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "bot": return BotContact.DeserializeBotContact(element, options); + case "communication": return CommunicationContact.DeserializeCommunicationContact(element, options); + case "whatsApp": return WhatsAppContact.DeserializeWhatsAppContact(element, options); + } + } + return UnknownConversationContact.DeserializeUnknownConversationContact(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConversationContact)} does not support writing '{options.Format}' format."); + } + } + + ConversationContact IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationContact(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationContact)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ConversationContact FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationContact(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationContact.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationContact.cs new file mode 100644 index 000000000000..81d3958af8a9 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationContact.cs @@ -0,0 +1,83 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// + /// Details of an external platform contact. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public abstract partial class ConversationContact + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// External platform identifier. + /// is null. + protected ConversationContact(string id) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + } + + /// Initializes a new instance of . + /// External platform identifier. + /// Type of message platform (e.g., WhatsApp). + /// Keeps track of any properties unknown to the library. + internal ConversationContact(string id, MessagePlatformKind kind, IDictionary serializedAdditionalRawData) + { + Id = id; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationContact() + { + } + + /// External platform identifier. + public string Id { get; set; } + /// Type of message platform (e.g., WhatsApp). + internal MessagePlatformKind Kind { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessage.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessage.Serialization.cs new file mode 100644 index 000000000000..35608d073f84 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessage.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class ConversationMessage : 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") + { + throw new FormatException($"The model {nameof(ConversationMessage)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ConversationMessage IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationMessage)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationMessage(document.RootElement, options); + } + + internal static ConversationMessage DeserializeConversationMessage(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string content = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("content"u8)) + { + content = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationMessage(content, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConversationMessage)} does not support writing '{options.Format}' format."); + } + } + + ConversationMessage IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationMessage(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationMessage)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ConversationMessage FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationMessage(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessage.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessage.cs new file mode 100644 index 000000000000..a1303fc67bbb --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessage.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// Details of a message. + public partial class ConversationMessage + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Content of the message. + /// is null. + public ConversationMessage(string content) + { + Argument.AssertNotNull(content, nameof(content)); + + Content = content; + } + + /// Initializes a new instance of . + /// Content of the message. + /// Keeps track of any properties unknown to the library. + internal ConversationMessage(string content, IDictionary serializedAdditionalRawData) + { + Content = content; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationMessage() + { + } + + /// Content of the message. + public string Content { get; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessageContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessageContent.Serialization.cs new file mode 100644 index 000000000000..00c7862b9bdc --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessageContent.Serialization.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + [PersistableModelProxy(typeof(UnknownConversationMessageContent))] + public partial class ConversationMessageContent : 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") + { + throw new FormatException($"The model {nameof(ConversationMessageContent)} does not support writing '{format}' format."); + } + + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ConversationMessageContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationMessageContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationMessageContent(document.RootElement, options); + } + + internal static ConversationMessageContent DeserializeConversationMessageContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "audio": return AudioConversationMessageContent.DeserializeAudioConversationMessageContent(element, options); + case "document": return DocumentConversationMessageContent.DeserializeDocumentConversationMessageContent(element, options); + case "image": return ImageConversationMessageContent.DeserializeImageConversationMessageContent(element, options); + case "template": return TemplateConversationMessageContent.DeserializeTemplateConversationMessageContent(element, options); + case "text": return TextConversationMessageContent.DeserializeTextConversationMessageContent(element, options); + case "video": return VideoConversationMessageContent.DeserializeVideoConversationMessageContent(element, options); + } + } + return UnknownConversationMessageContent.DeserializeUnknownConversationMessageContent(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConversationMessageContent)} does not support writing '{options.Format}' format."); + } + } + + ConversationMessageContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationMessageContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationMessageContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ConversationMessageContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationMessageContent(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessageContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessageContent.cs new file mode 100644 index 000000000000..8f1d32828735 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessageContent.cs @@ -0,0 +1,69 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// + /// Details of the conversation message content. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , and . + /// + public abstract partial class ConversationMessageContent + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected ConversationMessageContent() + { + } + + /// Initializes a new instance of . + /// The type discriminator describing a message type. + /// Keeps track of any properties unknown to the library. + internal ConversationMessageContent(CommunicationMessageKind kind, IDictionary serializedAdditionalRawData) + { + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// The type discriminator describing a message type. + internal CommunicationMessageKind Kind { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessageItem.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessageItem.Serialization.cs new file mode 100644 index 000000000000..de3b463164ce --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessageItem.Serialization.cs @@ -0,0 +1,202 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class ConversationMessageItem : 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") + { + throw new FormatException($"The model {nameof(ConversationMessageItem)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(SequenceId)) + { + writer.WritePropertyName("sequenceId"u8); + writer.WriteNumberValue(SequenceId.Value); + } + writer.WritePropertyName("message"u8); + writer.WriteObjectValue(Message, options); + if (Optional.IsDefined(SenderDisplayName)) + { + writer.WritePropertyName("senderDisplayName"u8); + writer.WriteStringValue(SenderDisplayName); + } + writer.WritePropertyName("senderCommunicationIdentifier"u8); + writer.WriteStringValue(SenderCommunicationIdentifier); + writer.WritePropertyName("createdOn"u8); + writer.WriteStringValue(CreatedOn, "O"); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ConversationMessageItem IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationMessageItem)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationMessageItem(document.RootElement, options); + } + + internal static ConversationMessageItem DeserializeConversationMessageItem(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + long? sequenceId = default; + ConversationMessageContent message = default; + string senderDisplayName = default; + string senderCommunicationIdentifier = default; + DateTimeOffset createdOn = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("sequenceId"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + sequenceId = property.Value.GetInt64(); + continue; + } + if (property.NameEquals("message"u8)) + { + message = ConversationMessageContent.DeserializeConversationMessageContent(property.Value, options); + continue; + } + if (property.NameEquals("senderDisplayName"u8)) + { + senderDisplayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("senderCommunicationIdentifier"u8)) + { + senderCommunicationIdentifier = property.Value.GetString(); + continue; + } + if (property.NameEquals("createdOn"u8)) + { + createdOn = property.Value.GetDateTimeOffset("O"); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ConversationMessageItem( + id, + sequenceId, + message, + senderDisplayName, + senderCommunicationIdentifier, + createdOn, + serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConversationMessageItem)} does not support writing '{options.Format}' format."); + } + } + + ConversationMessageItem IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationMessageItem(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationMessageItem)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ConversationMessageItem FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationMessageItem(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessageItem.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessageItem.cs new file mode 100644 index 000000000000..0a263823bc3e --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationMessageItem.cs @@ -0,0 +1,112 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// The conversation message as returned from the service. + public partial class ConversationMessageItem + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// Payload of a threaded conversation message. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , and . + /// + /// The communication identifier of the message sender. + /// Timestamp when the message is sent. + /// or is null. + internal ConversationMessageItem(ConversationMessageContent message, string senderCommunicationIdentifier, DateTimeOffset createdOn) + { + Argument.AssertNotNull(message, nameof(message)); + Argument.AssertNotNull(senderCommunicationIdentifier, nameof(senderCommunicationIdentifier)); + + Message = message; + SenderCommunicationIdentifier = senderCommunicationIdentifier; + CreatedOn = createdOn; + } + + /// Initializes a new instance of . + /// Message ID. + /// Message sequence ID. + /// + /// Payload of a threaded conversation message. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , and . + /// + /// The display name of the message sender. + /// The communication identifier of the message sender. + /// Timestamp when the message is sent. + /// Keeps track of any properties unknown to the library. + internal ConversationMessageItem(string id, long? sequenceId, ConversationMessageContent message, string senderDisplayName, string senderCommunicationIdentifier, DateTimeOffset createdOn, IDictionary serializedAdditionalRawData) + { + Id = id; + SequenceId = sequenceId; + Message = message; + SenderDisplayName = senderDisplayName; + SenderCommunicationIdentifier = senderCommunicationIdentifier; + CreatedOn = createdOn; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal ConversationMessageItem() + { + } + + /// Message ID. + public string Id { get; } + /// Message sequence ID. + public long? SequenceId { get; } + /// + /// Payload of a threaded conversation message. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , and . + /// + public ConversationMessageContent Message { get; } + /// The display name of the message sender. + public string SenderDisplayName { get; } + /// The communication identifier of the message sender. + public string SenderCommunicationIdentifier { get; } + /// Timestamp when the message is sent. + public DateTimeOffset CreatedOn { get; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationParticipant.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationParticipant.Serialization.cs new file mode 100644 index 000000000000..4789c4fda2fb --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationParticipant.Serialization.cs @@ -0,0 +1,144 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + [PersistableModelProxy(typeof(UnknownConversationParticipant))] + public partial class ConversationParticipant : 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") + { + throw new FormatException($"The model {nameof(ConversationParticipant)} does not support writing '{format}' format."); + } + + if (options.Format != "W") + { + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + } + if (Optional.IsDefined(DisplayName)) + { + writer.WritePropertyName("displayName"u8); + writer.WriteStringValue(DisplayName); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + ConversationParticipant IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationParticipant)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationParticipant(document.RootElement, options); + } + + internal static ConversationParticipant DeserializeConversationParticipant(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + if (element.TryGetProperty("kind", out JsonElement discriminator)) + { + switch (discriminator.GetString()) + { + case "external": return ExternalConversationParticipant.DeserializeExternalConversationParticipant(element, options); + case "internal": return InternalConversationParticipant.DeserializeInternalConversationParticipant(element, options); + } + } + return UnknownConversationParticipant.DeserializeUnknownConversationParticipant(element, options); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConversationParticipant)} does not support writing '{options.Format}' format."); + } + } + + ConversationParticipant IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationParticipant(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationParticipant)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static ConversationParticipant FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationParticipant(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationParticipant.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationParticipant.cs new file mode 100644 index 000000000000..a77f813fb033 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationParticipant.cs @@ -0,0 +1,77 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// + /// Advanced Messaging conversation participant. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include and . + /// + public abstract partial class ConversationParticipant + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private protected IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + protected ConversationParticipant() + { + } + + /// Initializes a new instance of . + /// Participant Identifier. + /// Participant display name. + /// The type discriminator describing a participant type. + /// Keeps track of any properties unknown to the library. + internal ConversationParticipant(string id, string displayName, ParticipantKind kind, IDictionary serializedAdditionalRawData) + { + Id = id; + DisplayName = displayName; + Kind = kind; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Participant Identifier. + public string Id { get; } + /// Participant display name. + public string DisplayName { get; set; } + /// The type discriminator describing a participant type. + internal ParticipantKind Kind { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationThreadClient.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationThreadClient.cs new file mode 100644 index 000000000000..676f7e11b808 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ConversationThreadClient.cs @@ -0,0 +1,921 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Threading; +using System.Threading.Tasks; +using Autorest.CSharp.Core; +using Azure.Core; +using Azure.Core.Pipeline; + +namespace Azure.Communication.Messages +{ + // Data plane generated client. + /// The ConversationThread service client. + public partial class ConversationThreadClient + { + private const string AuthorizationHeader = "Authorization"; + private readonly AzureKeyCredential _keyCredential; + private const string AuthorizationApiKeyPrefix = "Bearer"; + private static readonly string[] AuthorizationScopes = new string[] { "https://communication.azure.com/.default" }; + private readonly TokenCredential _tokenCredential; + private readonly HttpPipeline _pipeline; + private readonly Uri _endpoint; + private readonly string _apiVersion; + + /// The ClientDiagnostics is used to provide tracing support for the client library. + internal ClientDiagnostics ClientDiagnostics { get; } + + /// The HTTP pipeline for sending and receiving REST requests and responses. + public virtual HttpPipeline Pipeline => _pipeline; + + /// Initializes a new instance of ConversationThreadClient for mocking. + protected ConversationThreadClient() + { + } + + /// Initializes a new instance of ConversationThreadClient. + /// The communication resource, for example https://my-resource.communication.azure.com. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public ConversationThreadClient(Uri endpoint, AzureKeyCredential credential) : this(endpoint, credential, new CommunicationMessagesClientOptions()) + { + } + + /// Initializes a new instance of ConversationThreadClient. + /// The communication resource, for example https://my-resource.communication.azure.com. + /// A credential used to authenticate to an Azure Service. + /// or is null. + public ConversationThreadClient(Uri endpoint, TokenCredential credential) : this(endpoint, credential, new CommunicationMessagesClientOptions()) + { + } + + /// Initializes a new instance of ConversationThreadClient. + /// The communication resource, for example https://my-resource.communication.azure.com. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public ConversationThreadClient(Uri endpoint, AzureKeyCredential credential, CommunicationMessagesClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new CommunicationMessagesClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _keyCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new AzureKeyCredentialPolicy(_keyCredential, AuthorizationHeader, AuthorizationApiKeyPrefix) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// Initializes a new instance of ConversationThreadClient. + /// The communication resource, for example https://my-resource.communication.azure.com. + /// A credential used to authenticate to an Azure Service. + /// The options for configuring the client. + /// or is null. + public ConversationThreadClient(Uri endpoint, TokenCredential credential, CommunicationMessagesClientOptions options) + { + Argument.AssertNotNull(endpoint, nameof(endpoint)); + Argument.AssertNotNull(credential, nameof(credential)); + options ??= new CommunicationMessagesClientOptions(); + + ClientDiagnostics = new ClientDiagnostics(options, true); + _tokenCredential = credential; + _pipeline = HttpPipelineBuilder.Build(options, Array.Empty(), new HttpPipelinePolicy[] { new BearerTokenAuthenticationPolicy(_tokenCredential, AuthorizationScopes) }, new ResponseClassifier()); + _endpoint = endpoint; + _apiVersion = options.Version; + } + + /// Adds participants to a specific conversation. + /// The conversation ID. + /// Details of the payload for adding participants to a conversation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> AddParticipantsAsync(string conversationId, AddParticipantsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(options, nameof(options)); + + using RequestContent content = options.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await AddParticipantsAsync(conversationId, content, context).ConfigureAwait(false); + return Response.FromValue(AddParticipantsResult.FromResponse(response), response); + } + + /// Adds participants to a specific conversation. + /// The conversation ID. + /// Details of the payload for adding participants to a conversation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response AddParticipants(string conversationId, AddParticipantsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(options, nameof(options)); + + using RequestContent content = options.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = AddParticipants(conversationId, content, context); + return Response.FromValue(AddParticipantsResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Adds participants to a specific conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task AddParticipantsAsync(string conversationId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ConversationThreadClient.AddParticipants"); + scope.Start(); + try + { + using HttpMessage message = CreateAddParticipantsRequest(conversationId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Adds participants to a specific conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response AddParticipants(string conversationId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ConversationThreadClient.AddParticipants"); + scope.Start(); + try + { + using HttpMessage message = CreateAddParticipantsRequest(conversationId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// remove a participant from a conversation. + /// The conversation ID. + /// Details of the request body for removing participants from a conversation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> RemoveParticipantsAsync(string conversationId, RemoveParticipantsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(options, nameof(options)); + + using RequestContent content = options.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await RemoveParticipantsAsync(conversationId, content, context).ConfigureAwait(false); + return Response.FromValue(RemoveParticipantsResult.FromResponse(response), response); + } + + /// remove a participant from a conversation. + /// The conversation ID. + /// Details of the request body for removing participants from a conversation. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response RemoveParticipants(string conversationId, RemoveParticipantsOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(options, nameof(options)); + + using RequestContent content = options.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = RemoveParticipants(conversationId, content, context); + return Response.FromValue(RemoveParticipantsResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] remove a participant from a conversation + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task RemoveParticipantsAsync(string conversationId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ConversationThreadClient.RemoveParticipants"); + scope.Start(); + try + { + using HttpMessage message = CreateRemoveParticipantsRequest(conversationId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] remove a participant from a conversation + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response RemoveParticipants(string conversationId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ConversationThreadClient.RemoveParticipants"); + scope.Start(); + try + { + using HttpMessage message = CreateRemoveParticipantsRequest(conversationId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Sends a conversation message from Business to User. + /// The conversation ID. + /// Details of the conversation message to send. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> SendMessageAsync(string conversationId, SendConversationMessageOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(options, nameof(options)); + + using RequestContent content = options.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await SendMessageAsync(conversationId, content, context).ConfigureAwait(false); + return Response.FromValue(SendConversationMessageResult.FromResponse(response), response); + } + + /// Sends a conversation message from Business to User. + /// The conversation ID. + /// Details of the conversation message to send. + /// The cancellation token to use. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response SendMessage(string conversationId, SendConversationMessageOptions options, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(options, nameof(options)); + + using RequestContent content = options.ToRequestContent(); + RequestContext context = FromCancellationToken(cancellationToken); + Response response = SendMessage(conversationId, content, context); + return Response.FromValue(SendConversationMessageResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Sends a conversation message from Business to User. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task SendMessageAsync(string conversationId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ConversationThreadClient.SendMessage"); + scope.Start(); + try + { + using HttpMessage message = CreateSendMessageRequest(conversationId, content, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Sends a conversation message from Business to User. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The content to send as the body of the request. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// or is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response SendMessage(string conversationId, RequestContent content, RequestContext context = null) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + Argument.AssertNotNull(content, nameof(content)); + + using var scope = ClientDiagnostics.CreateScope("ConversationThreadClient.SendMessage"); + scope.Start(); + try + { + using HttpMessage message = CreateSendMessageRequest(conversationId, content, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Get AI Analysis of a conversation. + /// The conversation ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual async Task> AnalyzeConversationAsync(string conversationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = await AnalyzeConversationAsync(conversationId, context).ConfigureAwait(false); + return Response.FromValue(GetConversationThreadAnalysisResult.FromResponse(response), response); + } + + /// Get AI Analysis of a conversation. + /// The conversation ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Response AnalyzeConversation(string conversationId, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + RequestContext context = FromCancellationToken(cancellationToken); + Response response = AnalyzeConversation(conversationId, context); + return Response.FromValue(GetConversationThreadAnalysisResult.FromResponse(response), response); + } + + /// + /// [Protocol Method] Get AI Analysis of a conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual async Task AnalyzeConversationAsync(string conversationId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + using var scope = ClientDiagnostics.CreateScope("ConversationThreadClient.AnalyzeConversation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeConversationRequest(conversationId, context); + return await _pipeline.ProcessMessageAsync(message, context).ConfigureAwait(false); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// + /// [Protocol Method] Get AI Analysis of a conversation. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The response returned from the service. + /// + public virtual Response AnalyzeConversation(string conversationId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + using var scope = ClientDiagnostics.CreateScope("ConversationThreadClient.AnalyzeConversation"); + scope.Start(); + try + { + using HttpMessage message = CreateAnalyzeConversationRequest(conversationId, context); + return _pipeline.ProcessMessage(message, context); + } + catch (Exception e) + { + scope.Failed(e); + throw; + } + } + + /// Retrieves list of conversations. + /// Number of objects to return per page. + /// The participant user ID. + /// The id of channel. + /// The cancellation token to use. + /// + public virtual AsyncPageable GetConversationsAsync(int? maxPageSize = null, string participantId = null, Guid? channelId = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConversationsRequest(maxPageSize, participantId, channelId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConversationsNextPageRequest(nextLink, maxPageSize, participantId, channelId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => CommunicationConversation.DeserializeCommunicationConversation(e), ClientDiagnostics, _pipeline, "ConversationThreadClient.GetConversations", "value", "nextLink", context); + } + + /// Retrieves list of conversations. + /// Number of objects to return per page. + /// The participant user ID. + /// The id of channel. + /// The cancellation token to use. + /// + public virtual Pageable GetConversations(int? maxPageSize = null, string participantId = null, Guid? channelId = null, CancellationToken cancellationToken = default) + { + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConversationsRequest(maxPageSize, participantId, channelId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConversationsNextPageRequest(nextLink, maxPageSize, participantId, channelId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => CommunicationConversation.DeserializeCommunicationConversation(e), ClientDiagnostics, _pipeline, "ConversationThreadClient.GetConversations", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves list of conversations. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Number of objects to return per page. + /// The participant user ID. + /// The id of channel. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetConversationsAsync(int? maxPageSize, string participantId, Guid? channelId, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConversationsRequest(maxPageSize, participantId, channelId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConversationsNextPageRequest(nextLink, maxPageSize, participantId, channelId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationThreadClient.GetConversations", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves list of conversations. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// Number of objects to return per page. + /// The participant user ID. + /// The id of channel. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetConversations(int? maxPageSize, string participantId, Guid? channelId, RequestContext context) + { + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetConversationsRequest(maxPageSize, participantId, channelId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetConversationsNextPageRequest(nextLink, maxPageSize, participantId, channelId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationThreadClient.GetConversations", "value", "nextLink", context); + } + + /// Retrieves list of conversation messages. + /// The conversation ID. + /// Number of objects to return per page. + /// The participant user ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual AsyncPageable GetMessagesAsync(string conversationId, int? maxPageSize = null, string participantId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMessagesRequest(conversationId, maxPageSize, participantId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMessagesNextPageRequest(nextLink, conversationId, maxPageSize, participantId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => ConversationMessageItem.DeserializeConversationMessageItem(e), ClientDiagnostics, _pipeline, "ConversationThreadClient.GetMessages", "value", "nextLink", context); + } + + /// Retrieves list of conversation messages. + /// The conversation ID. + /// Number of objects to return per page. + /// The participant user ID. + /// The cancellation token to use. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// + public virtual Pageable GetMessages(string conversationId, int? maxPageSize = null, string participantId = null, CancellationToken cancellationToken = default) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMessagesRequest(conversationId, maxPageSize, participantId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMessagesNextPageRequest(nextLink, conversationId, maxPageSize, participantId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => ConversationMessageItem.DeserializeConversationMessageItem(e), ClientDiagnostics, _pipeline, "ConversationThreadClient.GetMessages", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves list of conversation messages. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// Number of objects to return per page. + /// The participant user ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual AsyncPageable GetMessagesAsync(string conversationId, int? maxPageSize, string participantId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMessagesRequest(conversationId, maxPageSize, participantId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMessagesNextPageRequest(nextLink, conversationId, maxPageSize, participantId, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationThreadClient.GetMessages", "value", "nextLink", context); + } + + /// + /// [Protocol Method] Retrieves list of conversation messages. + /// + /// + /// + /// This protocol method allows explicit creation of the request and processing of the response for advanced scenarios. + /// + /// + /// + /// + /// Please try the simpler convenience overload with strongly typed models first. + /// + /// + /// + /// + /// The conversation ID. + /// Number of objects to return per page. + /// The participant user ID. + /// The request context, which can override default behaviors of the client pipeline on a per-call basis. + /// is null. + /// is an empty string, and was expected to be non-empty. + /// Service returned a non-success status code. + /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. + /// + public virtual Pageable GetMessages(string conversationId, int? maxPageSize, string participantId, RequestContext context) + { + Argument.AssertNotNullOrEmpty(conversationId, nameof(conversationId)); + + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetMessagesRequest(conversationId, maxPageSize, participantId, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetMessagesNextPageRequest(nextLink, conversationId, maxPageSize, participantId, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "ConversationThreadClient.GetMessages", "value", "nextLink", context); + } + + internal HttpMessage CreateAddParticipantsRequest(string conversationId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier207); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations/", false); + uri.AppendPath(conversationId, true); + uri.AppendPath("/participants:add", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateRemoveParticipantsRequest(string conversationId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier207); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations/", false); + uri.AppendPath(conversationId, true); + uri.AppendPath("/participants:remove", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateGetConversationsRequest(int? maxPageSize, string participantId, Guid? channelId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxPageSize != null) + { + uri.AppendQuery("maxPageSize", maxPageSize.Value, true); + } + if (participantId != null) + { + uri.AppendQuery("participantId", participantId, true); + } + if (channelId != null) + { + uri.AppendQuery("channelId", channelId.Value, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetMessagesRequest(string conversationId, int? maxPageSize, string participantId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations/", false); + uri.AppendPath(conversationId, true); + uri.AppendPath("/messages", false); + uri.AppendQuery("api-version", _apiVersion, true); + if (maxPageSize != null) + { + uri.AppendQuery("maxPageSize", maxPageSize.Value, true); + } + if (participantId != null) + { + uri.AppendQuery("participantId", participantId, true); + } + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateSendMessageRequest(string conversationId, RequestContent content, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations/", false); + uri.AppendPath(conversationId, true); + uri.AppendPath("/messages:send", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + request.Headers.Add("Content-Type", "application/json"); + request.Content = content; + return message; + } + + internal HttpMessage CreateAnalyzeConversationRequest(string conversationId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Post; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendPath("/messages/conversations/", false); + uri.AppendPath(conversationId, true); + uri.AppendPath(":analyze", false); + uri.AppendQuery("api-version", _apiVersion, true); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + request.Headers.Add("Repeatability-Request-ID", Guid.NewGuid()); + request.Headers.Add("Repeatability-First-Sent", DateTimeOffset.Now, "R"); + return message; + } + + internal HttpMessage CreateGetConversationsNextPageRequest(string nextLink, int? maxPageSize, string participantId, Guid? channelId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + internal HttpMessage CreateGetMessagesNextPageRequest(string nextLink, string conversationId, int? maxPageSize, string participantId, RequestContext context) + { + var message = _pipeline.CreateMessage(context, ResponseClassifier200); + var request = message.Request; + request.Method = RequestMethod.Get; + var uri = new RawRequestUriBuilder(); + uri.Reset(_endpoint); + uri.AppendRawNextLink(nextLink, false); + request.Uri = uri; + request.Headers.Add("Accept", "application/json"); + return message; + } + + private static RequestContext DefaultRequestContext = new RequestContext(); + internal static RequestContext FromCancellationToken(CancellationToken cancellationToken = default) + { + if (!cancellationToken.CanBeCanceled) + { + return DefaultRequestContext; + } + + return new RequestContext() { CancellationToken = cancellationToken }; + } + + private static ResponseClassifier _responseClassifier207; + private static ResponseClassifier ResponseClassifier207 => _responseClassifier207 ??= new StatusCodeClassifier(stackalloc ushort[] { 207 }); + private static ResponseClassifier _responseClassifier200; + private static ResponseClassifier ResponseClassifier200 => _responseClassifier200 ??= new StatusCodeClassifier(stackalloc ushort[] { 200 }); + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/CreateConversationRequest1.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/CreateConversationRequest1.Serialization.cs new file mode 100644 index 000000000000..e715153e0dc5 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/CreateConversationRequest1.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + internal partial class CreateConversationRequest1 : 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") + { + throw new FormatException($"The model {nameof(CreateConversationRequest1)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("conversation"u8); + writer.WriteObjectValue(Conversation, options); + if (Optional.IsDefined(InitialMessage)) + { + writer.WritePropertyName("initialMessage"u8); + writer.WriteObjectValue(InitialMessage, options); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + CreateConversationRequest1 IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(CreateConversationRequest1)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeCreateConversationRequest1(document.RootElement, options); + } + + internal static CreateConversationRequest1 DeserializeCreateConversationRequest1(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CommunicationConversation conversation = default; + ConversationMessage initialMessage = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("conversation"u8)) + { + conversation = CommunicationConversation.DeserializeCommunicationConversation(property.Value, options); + continue; + } + if (property.NameEquals("initialMessage"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + initialMessage = ConversationMessage.DeserializeConversationMessage(property.Value, options); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new CreateConversationRequest1(conversation, initialMessage, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(CreateConversationRequest1)} does not support writing '{options.Format}' format."); + } + } + + CreateConversationRequest1 IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateConversationRequest1(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(CreateConversationRequest1)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static CreateConversationRequest1 FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeCreateConversationRequest1(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/CreateConversationRequest1.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/CreateConversationRequest1.cs new file mode 100644 index 000000000000..69b07fb5554e --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/CreateConversationRequest1.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// The CreateConversationRequest1. + internal partial class CreateConversationRequest1 + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The conversation details. + /// is null. + internal CreateConversationRequest1(CommunicationConversation conversation) + { + Argument.AssertNotNull(conversation, nameof(conversation)); + + Conversation = conversation; + } + + /// Initializes a new instance of . + /// The conversation details. + /// An initial message within the conversation. + /// Keeps track of any properties unknown to the library. + internal CreateConversationRequest1(CommunicationConversation conversation, ConversationMessage initialMessage, IDictionary serializedAdditionalRawData) + { + Conversation = conversation; + InitialMessage = initialMessage; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal CreateConversationRequest1() + { + } + + /// The conversation details. + public CommunicationConversation Conversation { get; } + /// An initial message within the conversation. + public ConversationMessage InitialMessage { get; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/ConversationAdministrationClient.xml b/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/ConversationAdministrationClient.xml new file mode 100644 index 000000000000..f2aa4c56e197 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/ConversationAdministrationClient.xml @@ -0,0 +1,757 @@ + + + + + +This sample shows how to call CreateConversationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +CommunicationConversation conversation = new CommunicationConversation(); +Response response = await client.CreateConversationAsync(conversation); +]]> +This sample shows how to call CreateConversationAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +CommunicationConversation conversation = new CommunicationConversation +{ + Topic = "", + DeliveryChannelIds = { "" }, + OutboundDeliveryStrategy = OutboundDeliveryStrategyKind.InternalOnly, + Participants = {new InternalConversationParticipant(new CommunicationContact("")) + { + DisplayName = "", + }}, +}; +ConversationMessage initialMessage = new ConversationMessage(""); +Response response = await client.CreateConversationAsync(conversation, initialMessage: initialMessage); +]]> + + + +This sample shows how to call CreateConversation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +CommunicationConversation conversation = new CommunicationConversation(); +Response response = client.CreateConversation(conversation); +]]> +This sample shows how to call CreateConversation with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +CommunicationConversation conversation = new CommunicationConversation +{ + Topic = "", + DeliveryChannelIds = { "" }, + OutboundDeliveryStrategy = OutboundDeliveryStrategyKind.InternalOnly, + Participants = {new InternalConversationParticipant(new CommunicationContact("")) + { + DisplayName = "", + }}, +}; +ConversationMessage initialMessage = new ConversationMessage(""); +Response response = client.CreateConversation(conversation, initialMessage: initialMessage); +]]> + + + +This sample shows how to call CreateConversationAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + conversation = new object(), +}); +Response response = await client.CreateConversationAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call CreateConversationAsync with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + conversation = new + { + topic = "", + deliveryChannelIds = new object[] + { + "" + }, + outboundDeliveryStrategy = "internalOnly", + participants = new object[] + { + new + { + kind = "internal", + contact = new + { + kind = "communication", + id = "", + }, + displayName = "", + } + }, + }, + initialMessage = new + { + content = "", + }, +}); +Response response = await client.CreateConversationAsync(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("topic").ToString()); +Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString()); +Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString()); +Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString()); +]]> + + + +This sample shows how to call CreateConversation and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + conversation = new object(), +}); +Response response = client.CreateConversation(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call CreateConversation with all request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + conversation = new + { + topic = "", + deliveryChannelIds = new object[] + { + "" + }, + outboundDeliveryStrategy = "internalOnly", + participants = new object[] + { + new + { + kind = "internal", + contact = new + { + kind = "communication", + id = "", + }, + displayName = "", + } + }, + }, + initialMessage = new + { + content = "", + }, +}); +Response response = client.CreateConversation(content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("topic").ToString()); +Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString()); +Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString()); +Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString()); +]]> + + + +This sample shows how to call GetConversationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = await client.GetConversationAsync(""); +]]> +This sample shows how to call GetConversationAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = await client.GetConversationAsync(""); +]]> + + + +This sample shows how to call GetConversation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = client.GetConversation(""); +]]> +This sample shows how to call GetConversation with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = client.GetConversation(""); +]]> + + + +This sample shows how to call GetConversationAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = await client.GetConversationAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetConversationAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = await client.GetConversationAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("topic").ToString()); +Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString()); +Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString()); +Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString()); +]]> + + + +This sample shows how to call GetConversation and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = client.GetConversation("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +]]> +This sample shows how to call GetConversation with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = client.GetConversation("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("topic").ToString()); +Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString()); +Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString()); +Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString()); +Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString()); +]]> + + + +This sample shows how to call DeleteConversationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = await client.DeleteConversationAsync(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteConversationAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = await client.DeleteConversationAsync(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call DeleteConversation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = client.DeleteConversation(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call DeleteConversation with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = client.DeleteConversation(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call TerminateConversationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = await client.TerminateConversationAsync(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call TerminateConversationAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = await client.TerminateConversationAsync(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call TerminateConversation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = client.TerminateConversation(""); + +Console.WriteLine(response.Status); +]]> +This sample shows how to call TerminateConversation with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = client.TerminateConversation(""); + +Console.WriteLine(response.Status); +]]> + + + +This sample shows how to call AddParticipantsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +AddParticipantsOptions options = new AddParticipantsOptions(new ConversationParticipant[] +{ + new ExternalConversationParticipant(new ConversationContact[] + { + new WhatsAppContact("12345678901") + }) + { + DisplayName = "Customer", + }, + new InternalConversationParticipant(new CommunicationContact("8:acs:uuid1")) + { + DisplayName = "Support", + } +}); +Response response = await client.AddParticipantsAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", options); +]]> + + + +This sample shows how to call AddParticipants. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +AddParticipantsOptions options = new AddParticipantsOptions(new ConversationParticipant[] +{ + new ExternalConversationParticipant(new ConversationContact[] + { + new WhatsAppContact("12345678901") + }) + { + DisplayName = "Customer", + }, + new InternalConversationParticipant(new CommunicationContact("8:acs:uuid1")) + { + DisplayName = "Support", + } +}); +Response response = client.AddParticipants("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", options); +]]> + + + +This sample shows how to call AddParticipantsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + participants = new object[] + { + new + { + displayName = "Customer", + kind = "external", + contacts = new object[] + { + new + { + id = "12345678901", + kind = "whatsApp", + } + }, + }, + new + { + displayName = "Support", + kind = "internal", + contact = new + { + id = "8:acs:uuid1", + kind = "communication", + }, + } + }, +}); +Response response = await client.AddParticipantsAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); +]]> + + + +This sample shows how to call AddParticipants and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + participants = new object[] + { + new + { + displayName = "Customer", + kind = "external", + contacts = new object[] + { + new + { + id = "12345678901", + kind = "whatsApp", + } + }, + }, + new + { + displayName = "Support", + kind = "internal", + contact = new + { + id = "8:acs:uuid1", + kind = "communication", + }, + } + }, +}); +Response response = client.AddParticipants("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); +]]> + + + +This sample shows how to call RemoveParticipantsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "8:acs:uuid2" }); +Response response = await client.RemoveParticipantsAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", options); +]]> + + + +This sample shows how to call RemoveParticipants. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "8:acs:uuid2" }); +Response response = client.RemoveParticipants("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", options); +]]> + + + +This sample shows how to call RemoveParticipantsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + participantIds = new object[] + { + "8:acs:uuid2" + }, +}); +Response response = await client.RemoveParticipantsAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); +]]> + + + +This sample shows how to call RemoveParticipants and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + participantIds = new object[] + { + "8:acs:uuid2" + }, +}); +Response response = client.RemoveParticipants("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); +]]> + + + +This sample shows how to call AnalyzeConversationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = await client.AnalyzeConversationAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2"); +]]> + + + +This sample shows how to call AnalyzeConversation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = client.AnalyzeConversation("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2"); +]]> + + + +This sample shows how to call AnalyzeConversationAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = await client.AnalyzeConversationAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("summary").ToString()); +]]> + + + +This sample shows how to call AnalyzeConversation and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +Response response = client.AnalyzeConversation("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("summary").ToString()); +]]> + + + +This sample shows how to call GetConversationsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +await foreach (CommunicationConversation item in client.GetConversationsAsync()) +{ +} +]]> + + + +This sample shows how to call GetConversations. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +foreach (CommunicationConversation item in client.GetConversations()) +{ +} +]]> + + + +This sample shows how to call GetConversationsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +await foreach (BinaryData item in client.GetConversationsAsync(25, null, Guid.Parse("0f0eb78e-a576-1dfc-b414-0f0756de3338"), null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); +} +]]> + + + +This sample shows how to call GetConversations and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +foreach (BinaryData item in client.GetConversations(25, null, Guid.Parse("0f0eb78e-a576-1dfc-b414-0f0756de3338"), null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); +} +]]> + + + +This sample shows how to call GetMessagesAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +await foreach (ConversationMessageItem item in client.GetMessagesAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2")) +{ +} +]]> + + + +This sample shows how to call GetMessages. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +foreach (ConversationMessageItem item in client.GetMessages("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2")) +{ +} +]]> + + + +This sample shows how to call GetMessagesAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +await foreach (BinaryData item in client.GetMessagesAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("message").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("senderCommunicationIdentifier").ToString()); + Console.WriteLine(result.GetProperty("createdOn").ToString()); +} +]]> + + + +This sample shows how to call GetMessages and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + +foreach (BinaryData item in client.GetMessages("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("message").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("senderCommunicationIdentifier").ToString()); + Console.WriteLine(result.GetProperty("createdOn").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/ConversationThreadClient.xml b/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/ConversationThreadClient.xml new file mode 100644 index 000000000000..cb02b6711933 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/ConversationThreadClient.xml @@ -0,0 +1,761 @@ + + + + + +This sample shows how to call AddParticipantsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +AddParticipantsOptions options = new AddParticipantsOptions(new ConversationParticipant[] +{ + new InternalConversationParticipant(new CommunicationContact("")) +}); +Response response = await client.AddParticipantsAsync("", options); +]]> +This sample shows how to call AddParticipantsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +AddParticipantsOptions options = new AddParticipantsOptions(new ConversationParticipant[] +{ + new InternalConversationParticipant(new CommunicationContact("")) + { + DisplayName = "", + } +}); +Response response = await client.AddParticipantsAsync("", options); +]]> + + + +This sample shows how to call AddParticipants. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +AddParticipantsOptions options = new AddParticipantsOptions(new ConversationParticipant[] +{ + new InternalConversationParticipant(new CommunicationContact("")) +}); +Response response = client.AddParticipants("", options); +]]> +This sample shows how to call AddParticipants with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +AddParticipantsOptions options = new AddParticipantsOptions(new ConversationParticipant[] +{ + new InternalConversationParticipant(new CommunicationContact("")) + { + DisplayName = "", + } +}); +Response response = client.AddParticipants("", options); +]]> + + + +This sample shows how to call AddParticipantsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + participants = new object[] + { + new + { + kind = "internal", + contact = new + { + kind = "communication", + id = "", + }, + } + }, +}); +Response response = await client.AddParticipantsAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); +]]> +This sample shows how to call AddParticipantsAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + participants = new object[] + { + new + { + kind = "internal", + contact = new + { + kind = "communication", + id = "", + }, + displayName = "", + } + }, +}); +Response response = await client.AddParticipantsAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); +]]> + + + +This sample shows how to call AddParticipants and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + participants = new object[] + { + new + { + kind = "internal", + contact = new + { + kind = "communication", + id = "", + }, + } + }, +}); +Response response = client.AddParticipants("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); +]]> +This sample shows how to call AddParticipants with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + participants = new object[] + { + new + { + kind = "internal", + contact = new + { + kind = "communication", + id = "", + }, + displayName = "", + } + }, +}); +Response response = client.AddParticipants("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); +]]> + + + +This sample shows how to call RemoveParticipantsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "" }); +Response response = await client.RemoveParticipantsAsync("", options); +]]> +This sample shows how to call RemoveParticipantsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "" }); +Response response = await client.RemoveParticipantsAsync("", options); +]]> + + + +This sample shows how to call RemoveParticipants. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "" }); +Response response = client.RemoveParticipants("", options); +]]> +This sample shows how to call RemoveParticipants with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "" }); +Response response = client.RemoveParticipants("", options); +]]> + + + +This sample shows how to call RemoveParticipantsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + participantIds = new object[] + { + "" + }, +}); +Response response = await client.RemoveParticipantsAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); +]]> +This sample shows how to call RemoveParticipantsAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + participantIds = new object[] + { + "" + }, +}); +Response response = await client.RemoveParticipantsAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); +]]> + + + +This sample shows how to call RemoveParticipants and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + participantIds = new object[] + { + "" + }, +}); +Response response = client.RemoveParticipants("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); +]]> +This sample shows how to call RemoveParticipants with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + participantIds = new object[] + { + "" + }, +}); +Response response = client.RemoveParticipants("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("code").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("message").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("target").ToString()); +Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); +]]> + + + +This sample shows how to call SendMessageAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +SendConversationMessageOptions options = new SendConversationMessageOptions(new TextConversationMessageContent("")); +Response response = await client.SendMessageAsync("", options); +]]> +This sample shows how to call SendMessageAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +SendConversationMessageOptions options = new SendConversationMessageOptions(new TextConversationMessageContent("")) +{ + OutboundDeliveryStrategy = OutboundDeliveryStrategyKind.InternalOnly, +}; +Response response = await client.SendMessageAsync("", options); +]]> + + + +This sample shows how to call SendMessage. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +SendConversationMessageOptions options = new SendConversationMessageOptions(new TextConversationMessageContent("")); +Response response = client.SendMessage("", options); +]]> +This sample shows how to call SendMessage with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +SendConversationMessageOptions options = new SendConversationMessageOptions(new TextConversationMessageContent("")) +{ + OutboundDeliveryStrategy = OutboundDeliveryStrategyKind.InternalOnly, +}; +Response response = client.SendMessage("", options); +]]> + + + +This sample shows how to call SendMessageAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + request = new + { + kind = "text", + content = "", + }, +}); +Response response = await client.SendMessageAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("messageId").ToString()); +]]> +This sample shows how to call SendMessageAsync with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + request = new + { + kind = "text", + content = "", + }, + outboundDeliveryStrategy = "internalOnly", +}); +Response response = await client.SendMessageAsync("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("messageId").ToString()); +]]> + + + +This sample shows how to call SendMessage and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + request = new + { + kind = "text", + content = "", + }, +}); +Response response = client.SendMessage("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("messageId").ToString()); +]]> +This sample shows how to call SendMessage with all parameters and request content and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +using RequestContent content = RequestContent.Create(new +{ + request = new + { + kind = "text", + content = "", + }, + outboundDeliveryStrategy = "internalOnly", +}); +Response response = client.SendMessage("", content); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("messageId").ToString()); +]]> + + + +This sample shows how to call AnalyzeConversationAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +Response response = await client.AnalyzeConversationAsync(""); +]]> +This sample shows how to call AnalyzeConversationAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +Response response = await client.AnalyzeConversationAsync(""); +]]> + + + +This sample shows how to call AnalyzeConversation. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +Response response = client.AnalyzeConversation(""); +]]> +This sample shows how to call AnalyzeConversation with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +Response response = client.AnalyzeConversation(""); +]]> + + + +This sample shows how to call AnalyzeConversationAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +Response response = await client.AnalyzeConversationAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("summary").ToString()); +]]> +This sample shows how to call AnalyzeConversationAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +Response response = await client.AnalyzeConversationAsync("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("summary").ToString()); +]]> + + + +This sample shows how to call AnalyzeConversation and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +Response response = client.AnalyzeConversation("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("summary").ToString()); +]]> +This sample shows how to call AnalyzeConversation with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +Response response = client.AnalyzeConversation("", null); + +JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; +Console.WriteLine(result.GetProperty("summary").ToString()); +]]> + + + +This sample shows how to call GetConversationsAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +await foreach (CommunicationConversation item in client.GetConversationsAsync()) +{ +} +]]> +This sample shows how to call GetConversationsAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +await foreach (CommunicationConversation item in client.GetConversationsAsync(maxPageSize: 1234, participantId: "", channelId: Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"))) +{ +} +]]> + + + +This sample shows how to call GetConversations. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +foreach (CommunicationConversation item in client.GetConversations()) +{ +} +]]> +This sample shows how to call GetConversations with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +foreach (CommunicationConversation item in client.GetConversations(maxPageSize: 1234, participantId: "", channelId: Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"))) +{ +} +]]> + + + +This sample shows how to call GetConversationsAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +await foreach (BinaryData item in client.GetConversationsAsync(null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); +} +]]> +This sample shows how to call GetConversationsAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +await foreach (BinaryData item in client.GetConversationsAsync(1234, "", Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("topic").ToString()); + Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString()); + Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString()); +} +]]> + + + +This sample shows how to call GetConversations and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +foreach (BinaryData item in client.GetConversations(null, null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); +} +]]> +This sample shows how to call GetConversations with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +foreach (BinaryData item in client.GetConversations(1234, "", Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("topic").ToString()); + Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString()); + Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString()); +} +]]> + + + +This sample shows how to call GetMessagesAsync. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +await foreach (ConversationMessageItem item in client.GetMessagesAsync("")) +{ +} +]]> +This sample shows how to call GetMessagesAsync with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +await foreach (ConversationMessageItem item in client.GetMessagesAsync("", maxPageSize: 1234, participantId: "")) +{ +} +]]> + + + +This sample shows how to call GetMessages. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +foreach (ConversationMessageItem item in client.GetMessages("")) +{ +} +]]> +This sample shows how to call GetMessages with all parameters. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +foreach (ConversationMessageItem item in client.GetMessages("", maxPageSize: 1234, participantId: "")) +{ +} +]]> + + + +This sample shows how to call GetMessagesAsync and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +await foreach (BinaryData item in client.GetMessagesAsync("", null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("message").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("senderCommunicationIdentifier").ToString()); + Console.WriteLine(result.GetProperty("createdOn").ToString()); +} +]]> +This sample shows how to call GetMessagesAsync with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +await foreach (BinaryData item in client.GetMessagesAsync("", 1234, "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("sequenceId").ToString()); + Console.WriteLine(result.GetProperty("message").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("senderDisplayName").ToString()); + Console.WriteLine(result.GetProperty("senderCommunicationIdentifier").ToString()); + Console.WriteLine(result.GetProperty("createdOn").ToString()); +} +]]> + + + +This sample shows how to call GetMessages and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +foreach (BinaryData item in client.GetMessages("", null, null, null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("message").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("senderCommunicationIdentifier").ToString()); + Console.WriteLine(result.GetProperty("createdOn").ToString()); +} +]]> +This sample shows how to call GetMessages with all parameters and parse the result. +"); +AzureKeyCredential credential = new AzureKeyCredential(""); +ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + +foreach (BinaryData item in client.GetMessages("", 1234, "", null)) +{ + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("sequenceId").ToString()); + Console.WriteLine(result.GetProperty("message").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("senderDisplayName").ToString()); + Console.WriteLine(result.GetProperty("senderCommunicationIdentifier").ToString()); + Console.WriteLine(result.GetProperty("createdOn").ToString()); +} +]]> + + + \ No newline at end of file diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/MessageTemplateClient.xml b/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/MessageTemplateClient.xml index 36b2ba72b7c1..f2528a819b1b 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/MessageTemplateClient.xml +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/Docs/MessageTemplateClient.xml @@ -15,7 +15,7 @@ This sample shows how to call GetTemplatesAsync with all parameters. @@ -34,7 +34,7 @@ This sample shows how to call GetTemplates with all parameters. diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentConversationMessageContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentConversationMessageContent.Serialization.cs new file mode 100644 index 000000000000..35df4bfe75c4 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentConversationMessageContent.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class DocumentConversationMessageContent : 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") + { + throw new FormatException($"The model {nameof(DocumentConversationMessageContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Caption)) + { + writer.WritePropertyName("caption"u8); + writer.WriteStringValue(Caption); + } + if (Optional.IsDefined(FileName)) + { + writer.WritePropertyName("fileName"u8); + writer.WriteStringValue(FileName); + } + writer.WritePropertyName("mediaUri"u8); + writer.WriteStringValue(MediaUri.AbsoluteUri); + } + + DocumentConversationMessageContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(DocumentConversationMessageContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeDocumentConversationMessageContent(document.RootElement, options); + } + + internal static DocumentConversationMessageContent DeserializeDocumentConversationMessageContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string caption = default; + string fileName = default; + Uri mediaUri = default; + CommunicationMessageKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("caption"u8)) + { + caption = property.Value.GetString(); + continue; + } + if (property.NameEquals("fileName"u8)) + { + fileName = property.Value.GetString(); + continue; + } + if (property.NameEquals("mediaUri"u8)) + { + mediaUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new CommunicationMessageKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new DocumentConversationMessageContent(kind, serializedAdditionalRawData, caption, fileName, mediaUri); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(DocumentConversationMessageContent)} does not support writing '{options.Format}' format."); + } + } + + DocumentConversationMessageContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDocumentConversationMessageContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(DocumentConversationMessageContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new DocumentConversationMessageContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeDocumentConversationMessageContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentConversationMessageContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentConversationMessageContent.cs new file mode 100644 index 000000000000..086bd8371917 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentConversationMessageContent.cs @@ -0,0 +1,52 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// A request to send a document conversation message. + public partial class DocumentConversationMessageContent : ConversationMessageContent + { + /// Initializes a new instance of . + /// A media url for the file. Required if the type is one of the supported media types, e.g. image. + /// is null. + public DocumentConversationMessageContent(Uri mediaUri) + { + Argument.AssertNotNull(mediaUri, nameof(mediaUri)); + + Kind = CommunicationMessageKind.Document; + MediaUri = mediaUri; + } + + /// Initializes a new instance of . + /// The type discriminator describing a message type. + /// Keeps track of any properties unknown to the library. + /// Optional text content. + /// Optional name for the file. + /// A media url for the file. Required if the type is one of the supported media types, e.g. image. + internal DocumentConversationMessageContent(CommunicationMessageKind kind, IDictionary serializedAdditionalRawData, string caption, string fileName, Uri mediaUri) : base(kind, serializedAdditionalRawData) + { + Caption = caption; + FileName = fileName; + MediaUri = mediaUri; + } + + /// Initializes a new instance of for deserialization. + internal DocumentConversationMessageContent() + { + } + + /// Optional text content. + public string Caption { get; set; } + /// Optional name for the file. + public string FileName { get; set; } + /// A media url for the file. Required if the type is one of the supported media types, e.g. image. + public Uri MediaUri { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentNotificationContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentNotificationContent.cs index b0df98032fa7..ae3f8395cd3d 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentNotificationContent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/DocumentNotificationContent.cs @@ -30,7 +30,7 @@ public DocumentNotificationContent(Guid channelRegistrationId, IEnumerable Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// Keeps track of any properties unknown to the library. /// Optional text content. /// Optional name for the file. diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ExternalConversationParticipant.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ExternalConversationParticipant.Serialization.cs new file mode 100644 index 000000000000..2fcf67c93a15 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ExternalConversationParticipant.Serialization.cs @@ -0,0 +1,156 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class ExternalConversationParticipant : 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") + { + throw new FormatException($"The model {nameof(ExternalConversationParticipant)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("contacts"u8); + writer.WriteStartArray(); + foreach (var item in Contacts) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + } + + ExternalConversationParticipant IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ExternalConversationParticipant)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeExternalConversationParticipant(document.RootElement, options); + } + + internal static ExternalConversationParticipant DeserializeExternalConversationParticipant(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList contacts = default; + string id = default; + string displayName = default; + ParticipantKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("contacts"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(ConversationContact.DeserializeConversationContact(item, options)); + } + contacts = array; + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new ParticipantKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ExternalConversationParticipant(id, displayName, kind, serializedAdditionalRawData, contacts); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ExternalConversationParticipant)} does not support writing '{options.Format}' format."); + } + } + + ExternalConversationParticipant IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeExternalConversationParticipant(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ExternalConversationParticipant)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ExternalConversationParticipant FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeExternalConversationParticipant(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ExternalConversationParticipant.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ExternalConversationParticipant.cs new file mode 100644 index 000000000000..34831b097d98 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ExternalConversationParticipant.cs @@ -0,0 +1,59 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Communication.Messages +{ + /// External conversation participant. + public partial class ExternalConversationParticipant : ConversationParticipant + { + /// Initializes a new instance of . + /// + /// List of external platform identifiers for the participant. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// is null. + public ExternalConversationParticipant(IEnumerable contacts) + { + Argument.AssertNotNull(contacts, nameof(contacts)); + + Kind = ParticipantKind.External; + Contacts = contacts.ToList(); + } + + /// Initializes a new instance of . + /// Participant Identifier. + /// Participant display name. + /// The type discriminator describing a participant type. + /// Keeps track of any properties unknown to the library. + /// + /// List of external platform identifiers for the participant. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + internal ExternalConversationParticipant(string id, string displayName, ParticipantKind kind, IDictionary serializedAdditionalRawData, IList contacts) : base(id, displayName, kind, serializedAdditionalRawData) + { + Contacts = contacts; + } + + /// Initializes a new instance of for deserialization. + internal ExternalConversationParticipant() + { + } + + /// + /// List of external platform identifiers for the participant. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public IList Contacts { get; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/GetConversationThreadAnalysisResult.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/GetConversationThreadAnalysisResult.Serialization.cs new file mode 100644 index 000000000000..808af2ad609f --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/GetConversationThreadAnalysisResult.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class GetConversationThreadAnalysisResult : 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") + { + throw new FormatException($"The model {nameof(GetConversationThreadAnalysisResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("summary"u8); + writer.WriteStringValue(Summary); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + GetConversationThreadAnalysisResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(GetConversationThreadAnalysisResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeGetConversationThreadAnalysisResult(document.RootElement, options); + } + + internal static GetConversationThreadAnalysisResult DeserializeGetConversationThreadAnalysisResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string summary = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("summary"u8)) + { + summary = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new GetConversationThreadAnalysisResult(summary, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(GetConversationThreadAnalysisResult)} does not support writing '{options.Format}' format."); + } + } + + GetConversationThreadAnalysisResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGetConversationThreadAnalysisResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(GetConversationThreadAnalysisResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static GetConversationThreadAnalysisResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeGetConversationThreadAnalysisResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/GetConversationThreadAnalysisResult.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/GetConversationThreadAnalysisResult.cs new file mode 100644 index 000000000000..64d5c5bd5dce --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/GetConversationThreadAnalysisResult.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// Result of the get conversation messages AI Analysis operation. + public partial class GetConversationThreadAnalysisResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The AI summary of the conversation messages. + /// is null. + internal GetConversationThreadAnalysisResult(string summary) + { + Argument.AssertNotNull(summary, nameof(summary)); + + Summary = summary; + } + + /// Initializes a new instance of . + /// The AI summary of the conversation messages. + /// Keeps track of any properties unknown to the library. + internal GetConversationThreadAnalysisResult(string summary, IDictionary serializedAdditionalRawData) + { + Summary = summary; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal GetConversationThreadAnalysisResult() + { + } + + /// The AI summary of the conversation messages. + public string Summary { get; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ImageConversationMessageContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ImageConversationMessageContent.Serialization.cs new file mode 100644 index 000000000000..327e2f69e946 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ImageConversationMessageContent.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class ImageConversationMessageContent : 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") + { + throw new FormatException($"The model {nameof(ImageConversationMessageContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Caption)) + { + writer.WritePropertyName("caption"u8); + writer.WriteStringValue(Caption); + } + writer.WritePropertyName("mediaUri"u8); + writer.WriteStringValue(MediaUri.AbsoluteUri); + } + + ImageConversationMessageContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ImageConversationMessageContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeImageConversationMessageContent(document.RootElement, options); + } + + internal static ImageConversationMessageContent DeserializeImageConversationMessageContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string caption = default; + Uri mediaUri = default; + CommunicationMessageKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("caption"u8)) + { + caption = property.Value.GetString(); + continue; + } + if (property.NameEquals("mediaUri"u8)) + { + mediaUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new CommunicationMessageKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new ImageConversationMessageContent(kind, serializedAdditionalRawData, caption, mediaUri); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ImageConversationMessageContent)} does not support writing '{options.Format}' format."); + } + } + + ImageConversationMessageContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeImageConversationMessageContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ImageConversationMessageContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new ImageConversationMessageContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeImageConversationMessageContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ImageConversationMessageContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ImageConversationMessageContent.cs new file mode 100644 index 000000000000..318f856277a8 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ImageConversationMessageContent.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// A request to send an image conversation message. + public partial class ImageConversationMessageContent : ConversationMessageContent + { + /// Initializes a new instance of . + /// A media url for the file. Required if the type is one of the supported media types, e.g. image. + /// is null. + public ImageConversationMessageContent(Uri mediaUri) + { + Argument.AssertNotNull(mediaUri, nameof(mediaUri)); + + Kind = CommunicationMessageKind.Image; + MediaUri = mediaUri; + } + + /// Initializes a new instance of . + /// The type discriminator describing a message type. + /// Keeps track of any properties unknown to the library. + /// Optional text content. + /// A media url for the file. Required if the type is one of the supported media types, e.g. image. + internal ImageConversationMessageContent(CommunicationMessageKind kind, IDictionary serializedAdditionalRawData, string caption, Uri mediaUri) : base(kind, serializedAdditionalRawData) + { + Caption = caption; + MediaUri = mediaUri; + } + + /// Initializes a new instance of for deserialization. + internal ImageConversationMessageContent() + { + } + + /// Optional text content. + public string Caption { get; set; } + /// A media url for the file. Required if the type is one of the supported media types, e.g. image. + public Uri MediaUri { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ImageNotificationContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ImageNotificationContent.cs index 491a9660efe2..355f1614f007 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/ImageNotificationContent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ImageNotificationContent.cs @@ -30,7 +30,7 @@ public ImageNotificationContent(Guid channelRegistrationId, IEnumerable /// Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// Keeps track of any properties unknown to the library. /// Optional text content. /// A media url for the file. Required if the type is one of the supported media types, e.g. image. diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/InteractiveNotificationContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/InteractiveNotificationContent.cs index c7c60c7fbdc1..631c9c876060 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/InteractiveNotificationContent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/InteractiveNotificationContent.cs @@ -30,7 +30,7 @@ public InteractiveNotificationContent(Guid channelRegistrationId, IEnumerable Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// Keeps track of any properties unknown to the library. /// The interactive message content. internal InteractiveNotificationContent(Guid channelRegistrationId, IList to, CommunicationMessageKind kind, IDictionary serializedAdditionalRawData, InteractiveMessage interactiveMessage) : base(channelRegistrationId, to, kind, serializedAdditionalRawData) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/InternalConversationParticipant.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/InternalConversationParticipant.Serialization.cs new file mode 100644 index 000000000000..430f6fdac257 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/InternalConversationParticipant.Serialization.cs @@ -0,0 +1,146 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class InternalConversationParticipant : 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") + { + throw new FormatException($"The model {nameof(InternalConversationParticipant)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("contact"u8); + writer.WriteObjectValue(Contact, options); + } + + InternalConversationParticipant IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(InternalConversationParticipant)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeInternalConversationParticipant(document.RootElement, options); + } + + internal static InternalConversationParticipant DeserializeInternalConversationParticipant(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConversationContact contact = default; + string id = default; + string displayName = default; + ParticipantKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("contact"u8)) + { + contact = ConversationContact.DeserializeConversationContact(property.Value, options); + continue; + } + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new ParticipantKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new InternalConversationParticipant(id, displayName, kind, serializedAdditionalRawData, contact); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(InternalConversationParticipant)} does not support writing '{options.Format}' format."); + } + } + + InternalConversationParticipant IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalConversationParticipant(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(InternalConversationParticipant)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new InternalConversationParticipant FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeInternalConversationParticipant(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/InternalConversationParticipant.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/InternalConversationParticipant.cs new file mode 100644 index 000000000000..985e90ac7ffa --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/InternalConversationParticipant.cs @@ -0,0 +1,58 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// Internal conversation participant. + public partial class InternalConversationParticipant : ConversationParticipant + { + /// Initializes a new instance of . + /// + /// The internal platform identifiers for the participant. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + /// is null. + public InternalConversationParticipant(ConversationContact contact) + { + Argument.AssertNotNull(contact, nameof(contact)); + + Kind = ParticipantKind.Internal; + Contact = contact; + } + + /// Initializes a new instance of . + /// Participant Identifier. + /// Participant display name. + /// The type discriminator describing a participant type. + /// Keeps track of any properties unknown to the library. + /// + /// The internal platform identifiers for the participant. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + internal InternalConversationParticipant(string id, string displayName, ParticipantKind kind, IDictionary serializedAdditionalRawData, ConversationContact contact) : base(id, displayName, kind, serializedAdditionalRawData) + { + Contact = contact; + } + + /// Initializes a new instance of for deserialization. + internal InternalConversationParticipant() + { + } + + /// + /// The internal platform identifiers for the participant. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , and . + /// + public ConversationContact Contact { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MediaNotificationContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MediaNotificationContent.cs index 36dbed204ede..c4e432f014c3 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MediaNotificationContent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MediaNotificationContent.cs @@ -31,7 +31,7 @@ public MediaNotificationContent(Guid channelRegistrationId, IEnumerable /// Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// Keeps track of any properties unknown to the library. /// Optional text content. /// A media url for the file. Required if the type is one of the supported media types, e.g. image. diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessagePlatformKind.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessagePlatformKind.cs new file mode 100644 index 000000000000..f3420c269b3d --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessagePlatformKind.cs @@ -0,0 +1,54 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Communication.Messages +{ + /// Defines the type of message platform. + internal readonly partial struct MessagePlatformKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public MessagePlatformKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string CommunicationValue = "communication"; + private const string BotValue = "bot"; + private const string WhatsAppValue = "whatsApp"; + + /// Azure Communication platform. + public static MessagePlatformKind Communication { get; } = new MessagePlatformKind(CommunicationValue); + /// Bot platform. + public static MessagePlatformKind Bot { get; } = new MessagePlatformKind(BotValue); + /// WhatsApp platform. + public static MessagePlatformKind WhatsApp { get; } = new MessagePlatformKind(WhatsAppValue); + /// Determines if two values are the same. + public static bool operator ==(MessagePlatformKind left, MessagePlatformKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(MessagePlatformKind left, MessagePlatformKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator MessagePlatformKind(string value) => new MessagePlatformKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is MessagePlatformKind other && Equals(other); + /// + public bool Equals(MessagePlatformKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplate.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplate.cs index 8094cd04eb22..9d65f902cfcb 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplate.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplate.cs @@ -89,9 +89,9 @@ internal MessageTemplate() } /// Name of the template. - public string Name { get; } + public string Name { get; set; } /// The template's language, in the ISO 639 format, consist of a two-letter language code followed by an optional two-letter country code, e.g., 'en' or 'en_US'. - public string Language { get; } + public string Language { get; set; } /// /// The template values. /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateClient.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateClient.cs index f37504e31358..b5e38ca781ea 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateClient.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateClient.cs @@ -19,6 +19,7 @@ public partial class MessageTemplateClient { private const string AuthorizationHeader = "Authorization"; private readonly AzureKeyCredential _keyCredential; + private const string AuthorizationApiKeyPrefix = "Bearer"; private static readonly string[] AuthorizationScopes = new string[] { "https://communication.azure.com/.default" }; private readonly TokenCredential _tokenCredential; private readonly HttpPipeline _pipeline; @@ -67,28 +68,28 @@ public MessageTemplateClient(Uri endpoint, TokenCredential credential, Communica /// List all templates for given Azure Communication Services channel. /// The registration ID of the channel. - /// Number of objects to return per page. + /// Number of objects to return per page. /// The cancellation token to use. /// - public virtual AsyncPageable GetTemplatesAsync(Guid channelId, int? maxpagesize = null, CancellationToken cancellationToken = default) + public virtual AsyncPageable GetTemplatesAsync(Guid channelId, int? maxPageSize = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTemplatesRequest(channelId, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTemplatesNextPageRequest(nextLink, channelId, pageSizeHint, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => MessageTemplateItem.DeserializeMessageTemplateItem(e), ClientDiagnostics, _pipeline, "MessageTemplateClient.GetTemplates", "value", "nextLink", maxpagesize, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTemplatesRequest(channelId, maxPageSize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTemplatesNextPageRequest(nextLink, channelId, maxPageSize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => MessageTemplateItem.DeserializeMessageTemplateItem(e), ClientDiagnostics, _pipeline, "MessageTemplateClient.GetTemplates", "value", "nextLink", context); } /// List all templates for given Azure Communication Services channel. /// The registration ID of the channel. - /// Number of objects to return per page. + /// Number of objects to return per page. /// The cancellation token to use. /// - public virtual Pageable GetTemplates(Guid channelId, int? maxpagesize = null, CancellationToken cancellationToken = default) + public virtual Pageable GetTemplates(Guid channelId, int? maxPageSize = null, CancellationToken cancellationToken = default) { RequestContext context = cancellationToken.CanBeCanceled ? new RequestContext { CancellationToken = cancellationToken } : null; - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTemplatesRequest(channelId, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTemplatesNextPageRequest(nextLink, channelId, pageSizeHint, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => MessageTemplateItem.DeserializeMessageTemplateItem(e), ClientDiagnostics, _pipeline, "MessageTemplateClient.GetTemplates", "value", "nextLink", maxpagesize, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTemplatesRequest(channelId, maxPageSize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTemplatesNextPageRequest(nextLink, channelId, maxPageSize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => MessageTemplateItem.DeserializeMessageTemplateItem(e), ClientDiagnostics, _pipeline, "MessageTemplateClient.GetTemplates", "value", "nextLink", context); } /// @@ -107,16 +108,16 @@ public virtual Pageable GetTemplates(Guid channelId, int? m /// /// /// The registration ID of the channel. - /// Number of objects to return per page. + /// Number of objects to return per page. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. /// - public virtual AsyncPageable GetTemplatesAsync(Guid channelId, int? maxpagesize, RequestContext context) + public virtual AsyncPageable GetTemplatesAsync(Guid channelId, int? maxPageSize, RequestContext context) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTemplatesRequest(channelId, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTemplatesNextPageRequest(nextLink, channelId, pageSizeHint, context); - return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "MessageTemplateClient.GetTemplates", "value", "nextLink", maxpagesize, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTemplatesRequest(channelId, maxPageSize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTemplatesNextPageRequest(nextLink, channelId, maxPageSize, context); + return GeneratorPageableHelpers.CreateAsyncPageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "MessageTemplateClient.GetTemplates", "value", "nextLink", context); } /// @@ -135,19 +136,19 @@ public virtual AsyncPageable GetTemplatesAsync(Guid channelId, int? /// /// /// The registration ID of the channel. - /// Number of objects to return per page. + /// Number of objects to return per page. /// The request context, which can override default behaviors of the client pipeline on a per-call basis. /// Service returned a non-success status code. /// The from the service containing a list of objects. Details of the body schema for each item in the collection are in the Remarks section below. /// - public virtual Pageable GetTemplates(Guid channelId, int? maxpagesize, RequestContext context) + public virtual Pageable GetTemplates(Guid channelId, int? maxPageSize, RequestContext context) { - HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTemplatesRequest(channelId, pageSizeHint, context); - HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTemplatesNextPageRequest(nextLink, channelId, pageSizeHint, context); - return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "MessageTemplateClient.GetTemplates", "value", "nextLink", maxpagesize, context); + HttpMessage FirstPageRequest(int? pageSizeHint) => CreateGetTemplatesRequest(channelId, maxPageSize, context); + HttpMessage NextPageRequest(int? pageSizeHint, string nextLink) => CreateGetTemplatesNextPageRequest(nextLink, channelId, maxPageSize, context); + return GeneratorPageableHelpers.CreatePageable(FirstPageRequest, NextPageRequest, e => BinaryData.FromString(e.GetRawText()), ClientDiagnostics, _pipeline, "MessageTemplateClient.GetTemplates", "value", "nextLink", context); } - internal HttpMessage CreateGetTemplatesRequest(Guid channelId, int? maxpagesize, RequestContext context) + internal HttpMessage CreateGetTemplatesRequest(Guid channelId, int? maxPageSize, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; @@ -158,16 +159,16 @@ internal HttpMessage CreateGetTemplatesRequest(Guid channelId, int? maxpagesize, uri.AppendPath(channelId, true); uri.AppendPath("/templates", false); uri.AppendQuery("api-version", _apiVersion, true); - if (maxpagesize != null) + if (maxPageSize != null) { - uri.AppendQuery("maxpagesize", maxpagesize.Value, true); + uri.AppendQuery("maxPageSize", maxPageSize.Value, true); } request.Uri = uri; request.Headers.Add("Accept", "application/json"); return message; } - internal HttpMessage CreateGetTemplatesNextPageRequest(string nextLink, Guid channelId, int? maxpagesize, RequestContext context) + internal HttpMessage CreateGetTemplatesNextPageRequest(string nextLink, Guid channelId, int? maxPageSize, RequestContext context) { var message = _pipeline.CreateMessage(context, ResponseClassifier200); var request = message.Request; diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateDocument.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateDocument.cs index 772ad6515b5c..b12ebac1a04b 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateDocument.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateDocument.cs @@ -46,7 +46,7 @@ internal MessageTemplateDocument() } /// The (public) URL of the media. - public Uri Uri { get; } + public Uri Uri { get; set; } /// The [optional] caption of the media object. public string Caption { get; set; } /// The [optional] filename of the media file. diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateImage.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateImage.cs index e8367535db19..96fa1d2ccb71 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateImage.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateImage.cs @@ -46,7 +46,7 @@ internal MessageTemplateImage() } /// The (public) URL of the media. - public Uri Uri { get; } + public Uri Uri { get; set; } /// The [optional] caption of the media object. public string Caption { get; set; } /// The [optional] filename of the media file. diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateText.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateText.cs index f6e15f72526f..f6549c2fdaca 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateText.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateText.cs @@ -42,6 +42,6 @@ internal MessageTemplateText() } /// The text value. - public string Text { get; } + public string Text { get; set; } } } diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateValue.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateValue.cs index 73b63aa77d13..1f0cc4bfa705 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateValue.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateValue.cs @@ -76,7 +76,7 @@ internal MessageTemplateValue() } /// Template binding reference name. - public string Name { get; } + public string Name { get; set; } /// The type discriminator describing a template parameter type. internal MessageTemplateValueKind Kind { get; set; } } diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateVideo.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateVideo.cs index 312f68f6d7e2..3d5da2a05d3a 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateVideo.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/MessageTemplateVideo.cs @@ -46,7 +46,7 @@ internal MessageTemplateVideo() } /// The (public) URL of the media. - public Uri Uri { get; } + public Uri Uri { get; set; } /// The [optional] caption of the media object. public string Caption { get; set; } /// The [optional] filename of the media file. diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/NotificationContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/NotificationContent.cs index dfc45e35fc3f..3f1099f71b7e 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/NotificationContent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/NotificationContent.cs @@ -65,7 +65,7 @@ protected NotificationContent(Guid channelRegistrationId, IEnumerable to /// Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// Keeps track of any properties unknown to the library. internal NotificationContent(Guid channelRegistrationId, IList to, CommunicationMessageKind kind, IDictionary serializedAdditionalRawData) { @@ -84,7 +84,7 @@ internal NotificationContent() public Guid ChannelRegistrationId { get; } /// The native external platform user identifiers of the recipient. public IList To { get; } - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. internal CommunicationMessageKind Kind { get; set; } } } diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/NotificationMessagesClient.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/NotificationMessagesClient.cs index 696c5609b70f..d5eead072111 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/NotificationMessagesClient.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/NotificationMessagesClient.cs @@ -19,6 +19,7 @@ public partial class NotificationMessagesClient { private const string AuthorizationHeader = "Authorization"; private readonly AzureKeyCredential _keyCredential; + private const string AuthorizationApiKeyPrefix = "Bearer"; private static readonly string[] AuthorizationScopes = new string[] { "https://communication.azure.com/.default" }; private readonly TokenCredential _tokenCredential; private readonly HttpPipeline _pipeline; diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/OutboundDeliveryStrategyKind.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/OutboundDeliveryStrategyKind.cs new file mode 100644 index 000000000000..2b7b73fdce4b --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/OutboundDeliveryStrategyKind.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Communication.Messages +{ + /// The options of the outbound delivery strategy for messages sent by participants in a conversation. + public readonly partial struct OutboundDeliveryStrategyKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public OutboundDeliveryStrategyKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InternalOnlyValue = "internalOnly"; + private const string AllParticipantsValue = "allParticipants"; + + /// Delivery strategy for internal only. + public static OutboundDeliveryStrategyKind InternalOnly { get; } = new OutboundDeliveryStrategyKind(InternalOnlyValue); + /// Delivery strategy for all participants. + public static OutboundDeliveryStrategyKind AllParticipants { get; } = new OutboundDeliveryStrategyKind(AllParticipantsValue); + /// Determines if two values are the same. + public static bool operator ==(OutboundDeliveryStrategyKind left, OutboundDeliveryStrategyKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(OutboundDeliveryStrategyKind left, OutboundDeliveryStrategyKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator OutboundDeliveryStrategyKind(string value) => new OutboundDeliveryStrategyKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is OutboundDeliveryStrategyKind other && Equals(other); + /// + public bool Equals(OutboundDeliveryStrategyKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ParticipantKind.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ParticipantKind.cs new file mode 100644 index 000000000000..09ce6795d2bb --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ParticipantKind.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Communication.Messages +{ + /// The type of a participant in a threaded conversation. + internal readonly partial struct ParticipantKind : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public ParticipantKind(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string InternalValue = "internal"; + private const string ExternalValue = "external"; + + /// A participant internal to Azure Communication Services. + public static ParticipantKind Internal { get; } = new ParticipantKind(InternalValue); + /// A participant on other platforms. + public static ParticipantKind External { get; } = new ParticipantKind(ExternalValue); + /// Determines if two values are the same. + public static bool operator ==(ParticipantKind left, ParticipantKind right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(ParticipantKind left, ParticipantKind right) => !left.Equals(right); + /// Converts a to a . + public static implicit operator ParticipantKind(string value) => new ParticipantKind(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is ParticipantKind other && Equals(other); + /// + public bool Equals(ParticipantKind other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value != null ? StringComparer.InvariantCultureIgnoreCase.GetHashCode(_value) : 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/ReactionNotificationContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/ReactionNotificationContent.cs index a06858477fbe..0453a6765fde 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/ReactionNotificationContent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/ReactionNotificationContent.cs @@ -33,7 +33,7 @@ public ReactionNotificationContent(Guid channelRegistrationId, IEnumerable Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// Keeps track of any properties unknown to the library. /// emoji content like \uD83D\uDE00. /// ID of the previous message you want to reply to. diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/RemoveParticipantsOptions.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/RemoveParticipantsOptions.Serialization.cs new file mode 100644 index 000000000000..c802af44b32c --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/RemoveParticipantsOptions.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class RemoveParticipantsOptions : 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") + { + throw new FormatException($"The model {nameof(RemoveParticipantsOptions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("participantIds"u8); + writer.WriteStartArray(); + foreach (var item in ParticipantIds) + { + writer.WriteStringValue(item); + } + writer.WriteEndArray(); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RemoveParticipantsOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RemoveParticipantsOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRemoveParticipantsOptions(document.RootElement, options); + } + + internal static RemoveParticipantsOptions DeserializeRemoveParticipantsOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IList participantIds = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("participantIds"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(item.GetString()); + } + participantIds = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RemoveParticipantsOptions(participantIds, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RemoveParticipantsOptions)} does not support writing '{options.Format}' format."); + } + } + + RemoveParticipantsOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRemoveParticipantsOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RemoveParticipantsOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RemoveParticipantsOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRemoveParticipantsOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/RemoveParticipantsOptions.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/RemoveParticipantsOptions.cs new file mode 100644 index 000000000000..e6385d910922 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/RemoveParticipantsOptions.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Communication.Messages +{ + /// Request payload for removing participants from a conversation. + public partial class RemoveParticipantsOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// The participant IDs to remove. + /// is null. + public RemoveParticipantsOptions(IEnumerable participantIds) + { + Argument.AssertNotNull(participantIds, nameof(participantIds)); + + ParticipantIds = participantIds.ToList(); + } + + /// Initializes a new instance of . + /// The participant IDs to remove. + /// Keeps track of any properties unknown to the library. + internal RemoveParticipantsOptions(IList participantIds, IDictionary serializedAdditionalRawData) + { + ParticipantIds = participantIds; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RemoveParticipantsOptions() + { + } + + /// The participant IDs to remove. + public IList ParticipantIds { get; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/RemoveParticipantsResult.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/RemoveParticipantsResult.Serialization.cs new file mode 100644 index 000000000000..e1758f9048b4 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/RemoveParticipantsResult.Serialization.cs @@ -0,0 +1,152 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class RemoveParticipantsResult : 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") + { + throw new FormatException($"The model {nameof(RemoveParticipantsResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("invalidParticipants"u8); + writer.WriteStartArray(); + foreach (var item in InvalidParticipants) + { + writer.WriteObjectValue(item, options); + } + writer.WriteEndArray(); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + RemoveParticipantsResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(RemoveParticipantsResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeRemoveParticipantsResult(document.RootElement, options); + } + + internal static RemoveParticipantsResult DeserializeRemoveParticipantsResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + IReadOnlyList invalidParticipants = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("invalidParticipants"u8)) + { + List array = new List(); + foreach (var item in property.Value.EnumerateArray()) + { + array.Add(UpdateParticipantsResult.DeserializeUpdateParticipantsResult(item, options)); + } + invalidParticipants = array; + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new RemoveParticipantsResult(invalidParticipants, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(RemoveParticipantsResult)} does not support writing '{options.Format}' format."); + } + } + + RemoveParticipantsResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRemoveParticipantsResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(RemoveParticipantsResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static RemoveParticipantsResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeRemoveParticipantsResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/RemoveParticipantsResult.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/RemoveParticipantsResult.cs new file mode 100644 index 000000000000..faed3d9548f7 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/RemoveParticipantsResult.cs @@ -0,0 +1,76 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; +using System.Linq; + +namespace Azure.Communication.Messages +{ + /// Response for the remove participants operation. + public partial class RemoveParticipantsResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// List of Ids with Errors if failed to be added. + /// is null. + internal RemoveParticipantsResult(IEnumerable invalidParticipants) + { + Argument.AssertNotNull(invalidParticipants, nameof(invalidParticipants)); + + InvalidParticipants = invalidParticipants.ToList(); + } + + /// Initializes a new instance of . + /// List of Ids with Errors if failed to be added. + /// Keeps track of any properties unknown to the library. + internal RemoveParticipantsResult(IReadOnlyList invalidParticipants, IDictionary serializedAdditionalRawData) + { + InvalidParticipants = invalidParticipants; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal RemoveParticipantsResult() + { + } + + /// List of Ids with Errors if failed to be added. + public IReadOnlyList InvalidParticipants { get; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/SendConversationMessageOptions.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/SendConversationMessageOptions.Serialization.cs new file mode 100644 index 000000000000..6237bf3195e8 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/SendConversationMessageOptions.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class SendConversationMessageOptions : 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") + { + throw new FormatException($"The model {nameof(SendConversationMessageOptions)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("request"u8); + writer.WriteObjectValue(Request, options); + if (Optional.IsDefined(OutboundDeliveryStrategy)) + { + writer.WritePropertyName("outboundDeliveryStrategy"u8); + writer.WriteStringValue(OutboundDeliveryStrategy.Value.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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SendConversationMessageOptions IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SendConversationMessageOptions)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSendConversationMessageOptions(document.RootElement, options); + } + + internal static SendConversationMessageOptions DeserializeSendConversationMessageOptions(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + ConversationMessageContent request = default; + OutboundDeliveryStrategyKind? outboundDeliveryStrategy = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("request"u8)) + { + request = ConversationMessageContent.DeserializeConversationMessageContent(property.Value, options); + continue; + } + if (property.NameEquals("outboundDeliveryStrategy"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + outboundDeliveryStrategy = new OutboundDeliveryStrategyKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SendConversationMessageOptions(request, outboundDeliveryStrategy, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SendConversationMessageOptions)} does not support writing '{options.Format}' format."); + } + } + + SendConversationMessageOptions IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSendConversationMessageOptions(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SendConversationMessageOptions)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SendConversationMessageOptions FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSendConversationMessageOptions(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/SendConversationMessageOptions.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/SendConversationMessageOptions.cs new file mode 100644 index 000000000000..9f605618d136 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/SendConversationMessageOptions.cs @@ -0,0 +1,97 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// Request payload for sending a conversation message. + public partial class SendConversationMessageOptions + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// + /// Details of a send conversation message request. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , and . + /// + /// is null. + public SendConversationMessageOptions(ConversationMessageContent request) + { + Argument.AssertNotNull(request, nameof(request)); + + Request = request; + } + + /// Initializes a new instance of . + /// + /// Details of a send conversation message request. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , and . + /// + /// + /// The options of the outbound delivery strategy for messages sent by participants in a conversation. + /// Supports internalOnly, allChannels. + /// + /// Keeps track of any properties unknown to the library. + internal SendConversationMessageOptions(ConversationMessageContent request, OutboundDeliveryStrategyKind? outboundDeliveryStrategy, IDictionary serializedAdditionalRawData) + { + Request = request; + OutboundDeliveryStrategy = outboundDeliveryStrategy; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SendConversationMessageOptions() + { + } + + /// + /// Details of a send conversation message request. + /// Please note is the base class. According to the scenario, a derived class of the base class might need to be assigned here, or this property needs to be casted to one of the possible derived classes. + /// The available derived classes include , , , , and . + /// + public ConversationMessageContent Request { get; } + /// + /// The options of the outbound delivery strategy for messages sent by participants in a conversation. + /// Supports internalOnly, allChannels. + /// + public OutboundDeliveryStrategyKind? OutboundDeliveryStrategy { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/SendConversationMessageResult.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/SendConversationMessageResult.Serialization.cs new file mode 100644 index 000000000000..b07b671ec2e5 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/SendConversationMessageResult.Serialization.cs @@ -0,0 +1,142 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class SendConversationMessageResult : 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") + { + throw new FormatException($"The model {nameof(SendConversationMessageResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("messageId"u8); + writer.WriteStringValue(MessageId); + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + SendConversationMessageResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(SendConversationMessageResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeSendConversationMessageResult(document.RootElement, options); + } + + internal static SendConversationMessageResult DeserializeSendConversationMessageResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string messageId = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("messageId"u8)) + { + messageId = property.Value.GetString(); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new SendConversationMessageResult(messageId, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(SendConversationMessageResult)} does not support writing '{options.Format}' format."); + } + } + + SendConversationMessageResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSendConversationMessageResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(SendConversationMessageResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static SendConversationMessageResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeSendConversationMessageResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/SendConversationMessageResult.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/SendConversationMessageResult.cs new file mode 100644 index 000000000000..9cedbe0633e2 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/SendConversationMessageResult.cs @@ -0,0 +1,75 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// Result of the send conversation message operation. + public partial class SendConversationMessageResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// A server-generated Advanced Messaging conversation message id. + /// is null. + internal SendConversationMessageResult(string messageId) + { + Argument.AssertNotNull(messageId, nameof(messageId)); + + MessageId = messageId; + } + + /// Initializes a new instance of . + /// A server-generated Advanced Messaging conversation message id. + /// Keeps track of any properties unknown to the library. + internal SendConversationMessageResult(string messageId, IDictionary serializedAdditionalRawData) + { + MessageId = messageId; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal SendConversationMessageResult() + { + } + + /// A server-generated Advanced Messaging conversation message id. + public string MessageId { get; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/StickerNotificationContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/StickerNotificationContent.cs index b90c6584db92..f214eda4ce3e 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/StickerNotificationContent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/StickerNotificationContent.cs @@ -30,7 +30,7 @@ public StickerNotificationContent(Guid channelRegistrationId, IEnumerable Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// Keeps track of any properties unknown to the library. /// A media url for the file. Required if the type is one of the supported media types, e.g. image. internal StickerNotificationContent(Guid channelRegistrationId, IList to, CommunicationMessageKind kind, IDictionary serializedAdditionalRawData, Uri mediaUri) : base(channelRegistrationId, to, kind, serializedAdditionalRawData) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateConversationMessageContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateConversationMessageContent.Serialization.cs new file mode 100644 index 000000000000..2d0bb2cb6309 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateConversationMessageContent.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class TemplateConversationMessageContent : 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") + { + throw new FormatException($"The model {nameof(TemplateConversationMessageContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("template"u8); + writer.WriteObjectValue(Template, options); + } + + TemplateConversationMessageContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TemplateConversationMessageContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTemplateConversationMessageContent(document.RootElement, options); + } + + internal static TemplateConversationMessageContent DeserializeTemplateConversationMessageContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + MessageTemplate template = default; + CommunicationMessageKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("template"u8)) + { + template = MessageTemplate.DeserializeMessageTemplate(property.Value, options); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new CommunicationMessageKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TemplateConversationMessageContent(kind, serializedAdditionalRawData, template); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TemplateConversationMessageContent)} does not support writing '{options.Format}' format."); + } + } + + TemplateConversationMessageContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTemplateConversationMessageContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TemplateConversationMessageContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TemplateConversationMessageContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTemplateConversationMessageContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateConversationMessageContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateConversationMessageContent.cs new file mode 100644 index 000000000000..6bbe26b57162 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateConversationMessageContent.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// A request to send a template conversation message. + public partial class TemplateConversationMessageContent : ConversationMessageContent + { + /// Initializes a new instance of . + /// The template object used to create templates. + /// is null. + public TemplateConversationMessageContent(MessageTemplate template) + { + Argument.AssertNotNull(template, nameof(template)); + + Kind = CommunicationMessageKind.Template; + Template = template; + } + + /// Initializes a new instance of . + /// The type discriminator describing a message type. + /// Keeps track of any properties unknown to the library. + /// The template object used to create templates. + internal TemplateConversationMessageContent(CommunicationMessageKind kind, IDictionary serializedAdditionalRawData, MessageTemplate template) : base(kind, serializedAdditionalRawData) + { + Template = template; + } + + /// Initializes a new instance of for deserialization. + internal TemplateConversationMessageContent() + { + } + + /// The template object used to create templates. + public MessageTemplate Template { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateNotificationContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateNotificationContent.cs index a967d3b11f34..0162f0ed190e 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateNotificationContent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/TemplateNotificationContent.cs @@ -30,7 +30,7 @@ public TemplateNotificationContent(Guid channelRegistrationId, IEnumerable Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// Keeps track of any properties unknown to the library. /// The template object used to create templates. internal TemplateNotificationContent(Guid channelRegistrationId, IList to, CommunicationMessageKind kind, IDictionary serializedAdditionalRawData, MessageTemplate template) : base(channelRegistrationId, to, kind, serializedAdditionalRawData) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/TextConversationMessageContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/TextConversationMessageContent.Serialization.cs new file mode 100644 index 000000000000..999c26707fd5 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/TextConversationMessageContent.Serialization.cs @@ -0,0 +1,134 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class TextConversationMessageContent : 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") + { + throw new FormatException($"The model {nameof(TextConversationMessageContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + writer.WritePropertyName("content"u8); + writer.WriteStringValue(Content); + } + + TextConversationMessageContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(TextConversationMessageContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeTextConversationMessageContent(document.RootElement, options); + } + + internal static TextConversationMessageContent DeserializeTextConversationMessageContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string content = default; + CommunicationMessageKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("content"u8)) + { + content = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new CommunicationMessageKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new TextConversationMessageContent(kind, serializedAdditionalRawData, content); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(TextConversationMessageContent)} does not support writing '{options.Format}' format."); + } + } + + TextConversationMessageContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTextConversationMessageContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(TextConversationMessageContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new TextConversationMessageContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeTextConversationMessageContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/TextConversationMessageContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/TextConversationMessageContent.cs new file mode 100644 index 000000000000..ba6a69d080b8 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/TextConversationMessageContent.cs @@ -0,0 +1,44 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// A request to send a text conversation message. + public partial class TextConversationMessageContent : ConversationMessageContent + { + /// Initializes a new instance of . + /// Message content. + /// is null. + public TextConversationMessageContent(string content) + { + Argument.AssertNotNull(content, nameof(content)); + + Kind = CommunicationMessageKind.Text; + Content = content; + } + + /// Initializes a new instance of . + /// The type discriminator describing a message type. + /// Keeps track of any properties unknown to the library. + /// Message content. + internal TextConversationMessageContent(CommunicationMessageKind kind, IDictionary serializedAdditionalRawData, string content) : base(kind, serializedAdditionalRawData) + { + Content = content; + } + + /// Initializes a new instance of for deserialization. + internal TextConversationMessageContent() + { + } + + /// Message content. + public string Content { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/TextNotificationContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/TextNotificationContent.cs index 02466c654309..78ae6bd5ecb4 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/TextNotificationContent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/TextNotificationContent.cs @@ -30,7 +30,7 @@ public TextNotificationContent(Guid channelRegistrationId, IEnumerable t /// Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// Keeps track of any properties unknown to the library. /// Message content. internal TextNotificationContent(Guid channelRegistrationId, IList to, CommunicationMessageKind kind, IDictionary serializedAdditionalRawData, string content) : base(channelRegistrationId, to, kind, serializedAdditionalRawData) diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationContact.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationContact.Serialization.cs new file mode 100644 index 000000000000..f59af354b942 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationContact.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + internal partial class UnknownConversationContact : 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") + { + throw new FormatException($"The model {nameof(ConversationContact)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + ConversationContact IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationContact)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationContact(document.RootElement, options); + } + + internal static UnknownConversationContact DeserializeUnknownConversationContact(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + MessagePlatformKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new MessagePlatformKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownConversationContact(id, kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConversationContact)} does not support writing '{options.Format}' format."); + } + } + + ConversationContact IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationContact(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationContact)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownConversationContact FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownConversationContact(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationContact.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationContact.cs new file mode 100644 index 000000000000..3f274ce2c363 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationContact.cs @@ -0,0 +1,29 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// Unknown version of ConversationContact. + internal partial class UnknownConversationContact : ConversationContact + { + /// Initializes a new instance of . + /// External platform identifier. + /// Type of message platform (e.g., WhatsApp). + /// Keeps track of any properties unknown to the library. + internal UnknownConversationContact(string id, MessagePlatformKind kind, IDictionary serializedAdditionalRawData) : base(id, kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownConversationContact() + { + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationMessageContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationMessageContent.Serialization.cs new file mode 100644 index 000000000000..681e5ffe3e59 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationMessageContent.Serialization.cs @@ -0,0 +1,126 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + internal partial class UnknownConversationMessageContent : 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") + { + throw new FormatException($"The model {nameof(ConversationMessageContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + ConversationMessageContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationMessageContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationMessageContent(document.RootElement, options); + } + + internal static UnknownConversationMessageContent DeserializeUnknownConversationMessageContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + CommunicationMessageKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("kind"u8)) + { + kind = new CommunicationMessageKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownConversationMessageContent(kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConversationMessageContent)} does not support writing '{options.Format}' format."); + } + } + + ConversationMessageContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationMessageContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationMessageContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownConversationMessageContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownConversationMessageContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationMessageContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationMessageContent.cs new file mode 100644 index 000000000000..a7d200aef4b5 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationMessageContent.cs @@ -0,0 +1,28 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// Unknown version of ConversationMessageContent. + internal partial class UnknownConversationMessageContent : ConversationMessageContent + { + /// Initializes a new instance of . + /// The type discriminator describing a message type. + /// Keeps track of any properties unknown to the library. + internal UnknownConversationMessageContent(CommunicationMessageKind kind, IDictionary serializedAdditionalRawData) : base(kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownConversationMessageContent() + { + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationParticipant.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationParticipant.Serialization.cs new file mode 100644 index 000000000000..60fc3ef2d778 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationParticipant.Serialization.cs @@ -0,0 +1,138 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + internal partial class UnknownConversationParticipant : 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") + { + throw new FormatException($"The model {nameof(ConversationParticipant)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + ConversationParticipant IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(ConversationParticipant)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeConversationParticipant(document.RootElement, options); + } + + internal static UnknownConversationParticipant DeserializeUnknownConversationParticipant(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + string displayName = default; + ParticipantKind kind = "Unknown"; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("displayName"u8)) + { + displayName = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new ParticipantKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UnknownConversationParticipant(id, displayName, kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(ConversationParticipant)} does not support writing '{options.Format}' format."); + } + } + + ConversationParticipant IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeConversationParticipant(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(ConversationParticipant)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new UnknownConversationParticipant FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUnknownConversationParticipant(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationParticipant.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationParticipant.cs new file mode 100644 index 000000000000..a7e78fc63eeb --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownConversationParticipant.cs @@ -0,0 +1,30 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// Unknown version of ConversationParticipant. + internal partial class UnknownConversationParticipant : ConversationParticipant + { + /// Initializes a new instance of . + /// Participant Identifier. + /// Participant display name. + /// The type discriminator describing a participant type. + /// Keeps track of any properties unknown to the library. + internal UnknownConversationParticipant(string id, string displayName, ParticipantKind kind, IDictionary serializedAdditionalRawData) : base(id, displayName, kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal UnknownConversationParticipant() + { + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownNotificationContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownNotificationContent.cs index 05589e6e5967..2a6437f28c13 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownNotificationContent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UnknownNotificationContent.cs @@ -16,7 +16,7 @@ internal partial class UnknownNotificationContent : NotificationContent /// Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// Keeps track of any properties unknown to the library. internal UnknownNotificationContent(Guid channelRegistrationId, IList to, CommunicationMessageKind kind, IDictionary serializedAdditionalRawData) : base(channelRegistrationId, to, kind, serializedAdditionalRawData) { diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UpdateParticipantsResult.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UpdateParticipantsResult.Serialization.cs new file mode 100644 index 000000000000..8f442b7da0f3 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UpdateParticipantsResult.Serialization.cs @@ -0,0 +1,157 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class UpdateParticipantsResult : 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") + { + throw new FormatException($"The model {nameof(UpdateParticipantsResult)} does not support writing '{format}' format."); + } + + writer.WritePropertyName("id"u8); + writer.WriteStringValue(Id); + if (Optional.IsDefined(Error)) + { + writer.WritePropertyName("error"u8); + JsonSerializer.Serialize(writer, Error); + } + 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, ModelSerializationExtensions.JsonDocumentOptions)) + { + JsonSerializer.Serialize(writer, document.RootElement); + } +#endif + } + } + } + + UpdateParticipantsResult IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(UpdateParticipantsResult)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeUpdateParticipantsResult(document.RootElement, options); + } + + internal static UpdateParticipantsResult DeserializeUpdateParticipantsResult(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + ResponseError error = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("error"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + continue; + } + error = JsonSerializer.Deserialize(property.Value.GetRawText()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new UpdateParticipantsResult(id, error, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(UpdateParticipantsResult)} does not support writing '{options.Format}' format."); + } + } + + UpdateParticipantsResult IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateParticipantsResult(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(UpdateParticipantsResult)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static UpdateParticipantsResult FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeUpdateParticipantsResult(document.RootElement); + } + + /// Convert into a . + internal virtual RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/UpdateParticipantsResult.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/UpdateParticipantsResult.cs new file mode 100644 index 000000000000..6ecfb2d390fe --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/UpdateParticipantsResult.cs @@ -0,0 +1,79 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// Response for the remove participants operation. + public partial class UpdateParticipantsResult + { + /// + /// Keeps track of any properties unknown to the library. + /// + /// To assign an object to the value of this property use . + /// + /// + /// To assign an already formatted json string to this property use . + /// + /// + /// Examples: + /// + /// + /// BinaryData.FromObjectAsJson("foo") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromString("\"foo\"") + /// Creates a payload of "foo". + /// + /// + /// BinaryData.FromObjectAsJson(new { key = "value" }) + /// Creates a payload of { "key": "value" }. + /// + /// + /// BinaryData.FromString("{\"key\": \"value\"}") + /// Creates a payload of { "key": "value" }. + /// + /// + /// + /// + private IDictionary _serializedAdditionalRawData; + + /// Initializes a new instance of . + /// Participant User Id. + /// is null. + internal UpdateParticipantsResult(string id) + { + Argument.AssertNotNull(id, nameof(id)); + + Id = id; + } + + /// Initializes a new instance of . + /// Participant User Id. + /// Error of the participant operation. + /// Keeps track of any properties unknown to the library. + internal UpdateParticipantsResult(string id, ResponseError error, IDictionary serializedAdditionalRawData) + { + Id = id; + Error = error; + _serializedAdditionalRawData = serializedAdditionalRawData; + } + + /// Initializes a new instance of for deserialization. + internal UpdateParticipantsResult() + { + } + + /// Participant User Id. + public string Id { get; } + /// Error of the participant operation. + public ResponseError Error { get; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/VideoConversationMessageContent.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/VideoConversationMessageContent.Serialization.cs new file mode 100644 index 000000000000..19a6151f02cb --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/VideoConversationMessageContent.Serialization.cs @@ -0,0 +1,145 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class VideoConversationMessageContent : 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") + { + throw new FormatException($"The model {nameof(VideoConversationMessageContent)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + if (Optional.IsDefined(Caption)) + { + writer.WritePropertyName("caption"u8); + writer.WriteStringValue(Caption); + } + writer.WritePropertyName("mediaUri"u8); + writer.WriteStringValue(MediaUri.AbsoluteUri); + } + + VideoConversationMessageContent IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(VideoConversationMessageContent)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeVideoConversationMessageContent(document.RootElement, options); + } + + internal static VideoConversationMessageContent DeserializeVideoConversationMessageContent(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string caption = default; + Uri mediaUri = default; + CommunicationMessageKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("caption"u8)) + { + caption = property.Value.GetString(); + continue; + } + if (property.NameEquals("mediaUri"u8)) + { + mediaUri = new Uri(property.Value.GetString()); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new CommunicationMessageKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new VideoConversationMessageContent(kind, serializedAdditionalRawData, caption, mediaUri); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(VideoConversationMessageContent)} does not support writing '{options.Format}' format."); + } + } + + VideoConversationMessageContent IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVideoConversationMessageContent(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(VideoConversationMessageContent)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new VideoConversationMessageContent FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeVideoConversationMessageContent(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/VideoConversationMessageContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/VideoConversationMessageContent.cs new file mode 100644 index 000000000000..4f80349d654d --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/VideoConversationMessageContent.cs @@ -0,0 +1,48 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// A request to send a video conversation message. + public partial class VideoConversationMessageContent : ConversationMessageContent + { + /// Initializes a new instance of . + /// A media url for the file. Required if the type is one of the supported media types, e.g. image. + /// is null. + public VideoConversationMessageContent(Uri mediaUri) + { + Argument.AssertNotNull(mediaUri, nameof(mediaUri)); + + Kind = CommunicationMessageKind.Video; + MediaUri = mediaUri; + } + + /// Initializes a new instance of . + /// The type discriminator describing a message type. + /// Keeps track of any properties unknown to the library. + /// Optional text content. + /// A media url for the file. Required if the type is one of the supported media types, e.g. image. + internal VideoConversationMessageContent(CommunicationMessageKind kind, IDictionary serializedAdditionalRawData, string caption, Uri mediaUri) : base(kind, serializedAdditionalRawData) + { + Caption = caption; + MediaUri = mediaUri; + } + + /// Initializes a new instance of for deserialization. + internal VideoConversationMessageContent() + { + } + + /// Optional text content. + public string Caption { get; set; } + /// A media url for the file. Required if the type is one of the supported media types, e.g. image. + public Uri MediaUri { get; set; } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/VideoNotificationContent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/VideoNotificationContent.cs index d78ee546a59a..f392d38b8d15 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/VideoNotificationContent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/VideoNotificationContent.cs @@ -30,7 +30,7 @@ public VideoNotificationContent(Guid channelRegistrationId, IEnumerable /// Initializes a new instance of . /// The Channel Registration ID for the Business Identifier. /// The native external platform user identifiers of the recipient. - /// The type discriminator describing a notification type. + /// The type discriminator describing a message type. /// Keeps track of any properties unknown to the library. /// Optional text content. /// A media url for the file. Required if the type is one of the supported media types, e.g. image. diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppContact.Serialization.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppContact.Serialization.cs new file mode 100644 index 000000000000..64a3f904f9f4 --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppContact.Serialization.cs @@ -0,0 +1,132 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ClientModel.Primitives; +using System.Collections.Generic; +using System.Text.Json; +using Azure.Core; + +namespace Azure.Communication.Messages +{ + public partial class WhatsAppContact : 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") + { + throw new FormatException($"The model {nameof(WhatsAppContact)} does not support writing '{format}' format."); + } + + base.JsonModelWriteCore(writer, options); + } + + WhatsAppContact IJsonModel.Create(ref Utf8JsonReader reader, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + if (format != "J") + { + throw new FormatException($"The model {nameof(WhatsAppContact)} does not support reading '{format}' format."); + } + + using JsonDocument document = JsonDocument.ParseValue(ref reader); + return DeserializeWhatsAppContact(document.RootElement, options); + } + + internal static WhatsAppContact DeserializeWhatsAppContact(JsonElement element, ModelReaderWriterOptions options = null) + { + options ??= ModelSerializationExtensions.WireOptions; + + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + string id = default; + MessagePlatformKind kind = default; + IDictionary serializedAdditionalRawData = default; + Dictionary rawDataDictionary = new Dictionary(); + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("id"u8)) + { + id = property.Value.GetString(); + continue; + } + if (property.NameEquals("kind"u8)) + { + kind = new MessagePlatformKind(property.Value.GetString()); + continue; + } + if (options.Format != "W") + { + rawDataDictionary.Add(property.Name, BinaryData.FromString(property.Value.GetRawText())); + } + } + serializedAdditionalRawData = rawDataDictionary; + return new WhatsAppContact(id, kind, serializedAdditionalRawData); + } + + BinaryData IPersistableModel.Write(ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + return ModelReaderWriter.Write(this, options); + default: + throw new FormatException($"The model {nameof(WhatsAppContact)} does not support writing '{options.Format}' format."); + } + } + + WhatsAppContact IPersistableModel.Create(BinaryData data, ModelReaderWriterOptions options) + { + var format = options.Format == "W" ? ((IPersistableModel)this).GetFormatFromOptions(options) : options.Format; + + switch (format) + { + case "J": + { + using JsonDocument document = JsonDocument.Parse(data, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeWhatsAppContact(document.RootElement, options); + } + default: + throw new FormatException($"The model {nameof(WhatsAppContact)} does not support reading '{options.Format}' format."); + } + } + + string IPersistableModel.GetFormatFromOptions(ModelReaderWriterOptions options) => "J"; + + /// Deserializes the model from a raw response. + /// The response to deserialize the model from. + internal static new WhatsAppContact FromResponse(Response response) + { + using var document = JsonDocument.Parse(response.Content, ModelSerializationExtensions.JsonDocumentOptions); + return DeserializeWhatsAppContact(document.RootElement); + } + + /// Convert into a . + internal override RequestContent ToRequestContent() + { + var content = new Utf8JsonRequestContent(); + content.JsonWriter.WriteObjectValue(this, ModelSerializationExtensions.WireOptions); + return content; + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppContact.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppContact.cs new file mode 100644 index 000000000000..9cc52ecf48dc --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppContact.cs @@ -0,0 +1,39 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Collections.Generic; + +namespace Azure.Communication.Messages +{ + /// WhatsApp Contact. + public partial class WhatsAppContact : ConversationContact + { + /// Initializes a new instance of . + /// External platform identifier. + /// is null. + public WhatsAppContact(string id) : base(id) + { + Argument.AssertNotNull(id, nameof(id)); + + Kind = MessagePlatformKind.WhatsApp; + } + + /// Initializes a new instance of . + /// External platform identifier. + /// Type of message platform (e.g., WhatsApp). + /// Keeps track of any properties unknown to the library. + internal WhatsAppContact(string id, MessagePlatformKind kind, IDictionary serializedAdditionalRawData) : base(id, kind, serializedAdditionalRawData) + { + } + + /// Initializes a new instance of for deserialization. + internal WhatsAppContact() + { + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsButton.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsButton.cs index 699bc967f77e..e144fd0d77ee 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsButton.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsButton.cs @@ -74,6 +74,6 @@ internal WhatsAppMessageTemplateBindingsButton() { } /// The name of the referenced item in the template values. - public string RefValue { get; } + public string RefValue { get; set; } } } diff --git a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsComponent.cs b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsComponent.cs index 3aa7bfa31af9..4be0a179c677 100644 --- a/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsComponent.cs +++ b/sdk/communication/Azure.Communication.Messages/src/Generated/WhatsAppMessageTemplateBindingsComponent.cs @@ -70,6 +70,6 @@ internal WhatsAppMessageTemplateBindingsComponent() } /// The name of the referenced item in the template values. - public string RefValue { get; } + public string RefValue { get; set; } } } diff --git a/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_ConversationAdministrationClient.cs b/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_ConversationAdministrationClient.cs new file mode 100644 index 000000000000..4cd97abec62b --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_ConversationAdministrationClient.cs @@ -0,0 +1,807 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Communication.Messages.Samples +{ + public partial class Samples_ConversationAdministrationClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_CreateConversation_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + conversation = new object(), + }); + Response response = client.CreateConversation(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_CreateConversation_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + conversation = new object(), + }); + Response response = await client.CreateConversationAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_CreateConversation_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + CommunicationConversation conversation = new CommunicationConversation(); + Response response = client.CreateConversation(conversation); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_CreateConversation_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + CommunicationConversation conversation = new CommunicationConversation(); + Response response = await client.CreateConversationAsync(conversation); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_CreateConversation_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + conversation = new + { + topic = "", + deliveryChannelIds = new object[] + { +"" + }, + outboundDeliveryStrategy = "internalOnly", + participants = new object[] + { +new +{ +kind = "internal", +contact = new +{ +kind = "communication", +id = "", +}, +displayName = "", +} + }, + }, + initialMessage = new + { + content = "", + }, + }); + Response response = client.CreateConversation(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("topic").ToString()); + Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString()); + Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_CreateConversation_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + conversation = new + { + topic = "", + deliveryChannelIds = new object[] + { +"" + }, + outboundDeliveryStrategy = "internalOnly", + participants = new object[] + { +new +{ +kind = "internal", +contact = new +{ +kind = "communication", +id = "", +}, +displayName = "", +} + }, + }, + initialMessage = new + { + content = "", + }, + }); + Response response = await client.CreateConversationAsync(content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("topic").ToString()); + Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString()); + Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_CreateConversation_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + CommunicationConversation conversation = new CommunicationConversation + { + Topic = "", + DeliveryChannelIds = { "" }, + OutboundDeliveryStrategy = OutboundDeliveryStrategyKind.InternalOnly, + Participants = {new InternalConversationParticipant(new CommunicationContact("")) +{ +DisplayName = "", +}}, + }; + ConversationMessage initialMessage = new ConversationMessage(""); + Response response = client.CreateConversation(conversation, initialMessage: initialMessage); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_CreateConversation_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + CommunicationConversation conversation = new CommunicationConversation + { + Topic = "", + DeliveryChannelIds = { "" }, + OutboundDeliveryStrategy = OutboundDeliveryStrategyKind.InternalOnly, + Participants = {new InternalConversationParticipant(new CommunicationContact("")) +{ +DisplayName = "", +}}, + }; + ConversationMessage initialMessage = new ConversationMessage(""); + Response response = await client.CreateConversationAsync(conversation, initialMessage: initialMessage); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_GetConversation_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = client.GetConversation("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_GetConversation_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = await client.GetConversationAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_GetConversation_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = client.GetConversation(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_GetConversation_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = await client.GetConversationAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_GetConversation_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = client.GetConversation("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("topic").ToString()); + Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString()); + Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_GetConversation_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = await client.GetConversationAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("topic").ToString()); + Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString()); + Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_GetConversation_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = client.GetConversation(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_GetConversation_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = await client.GetConversationAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_DeleteConversation_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = client.DeleteConversation(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_DeleteConversation_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = await client.DeleteConversationAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_DeleteConversation_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = client.DeleteConversation(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_DeleteConversation_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = await client.DeleteConversationAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationAdministrationClient_TerminateConversation_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = client.TerminateConversation(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationAdministrationClient_TerminateConversation_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = await client.TerminateConversationAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationAdministrationClient_TerminateConversation_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = client.TerminateConversation(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationAdministrationClient_TerminateConversation_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = await client.TerminateConversationAsync(""); + + Console.WriteLine(response.Status); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationAdministrationClient_AddParticipants_AddsParticipantsToASpecificConversation() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + participants = new object[] + { +new +{ +displayName = "Customer", +kind = "external", +contacts = new object[] +{ +new +{ +id = "12345678901", +kind = "whatsApp", +} +}, +}, +new +{ +displayName = "Support", +kind = "internal", +contact = new +{ +id = "8:acs:uuid1", +kind = "communication", +}, +} + }, + }); + Response response = client.AddParticipants("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationAdministrationClient_AddParticipants_AddsParticipantsToASpecificConversation_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + participants = new object[] + { +new +{ +displayName = "Customer", +kind = "external", +contacts = new object[] +{ +new +{ +id = "12345678901", +kind = "whatsApp", +} +}, +}, +new +{ +displayName = "Support", +kind = "internal", +contact = new +{ +id = "8:acs:uuid1", +kind = "communication", +}, +} + }, + }); + Response response = await client.AddParticipantsAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationAdministrationClient_AddParticipants_AddsParticipantsToASpecificConversation_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + AddParticipantsOptions options = new AddParticipantsOptions(new ConversationParticipant[] + { +new ExternalConversationParticipant(new ConversationContact[] +{ +new WhatsAppContact("12345678901") +}) +{ +DisplayName = "Customer", +}, +new InternalConversationParticipant(new CommunicationContact("8:acs:uuid1")) +{ +DisplayName = "Support", +} + }); + Response response = client.AddParticipants("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationAdministrationClient_AddParticipants_AddsParticipantsToASpecificConversation_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + AddParticipantsOptions options = new AddParticipantsOptions(new ConversationParticipant[] + { +new ExternalConversationParticipant(new ConversationContact[] +{ +new WhatsAppContact("12345678901") +}) +{ +DisplayName = "Customer", +}, +new InternalConversationParticipant(new CommunicationContact("8:acs:uuid1")) +{ +DisplayName = "Support", +} + }); + Response response = await client.AddParticipantsAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationAdministrationClient_RemoveParticipants_RemoveAParticipantFromAConversation() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + participantIds = new object[] + { +"8:acs:uuid2" + }, + }); + Response response = client.RemoveParticipants("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationAdministrationClient_RemoveParticipants_RemoveAParticipantFromAConversation_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + participantIds = new object[] + { +"8:acs:uuid2" + }, + }); + Response response = await client.RemoveParticipantsAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationAdministrationClient_RemoveParticipants_RemoveAParticipantFromAConversation_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "8:acs:uuid2" }); + Response response = client.RemoveParticipants("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationAdministrationClient_RemoveParticipants_RemoveAParticipantFromAConversation_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "8:acs:uuid2" }); + Response response = await client.RemoveParticipantsAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationAdministrationClient_AnalyzeConversation_GetAIAnalysisOfAConversation() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = client.AnalyzeConversation("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("summary").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationAdministrationClient_AnalyzeConversation_GetAIAnalysisOfAConversation_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = await client.AnalyzeConversationAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("summary").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationAdministrationClient_AnalyzeConversation_GetAIAnalysisOfAConversation_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = client.AnalyzeConversation("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationAdministrationClient_AnalyzeConversation_GetAIAnalysisOfAConversation_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + Response response = await client.AnalyzeConversationAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2"); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_GetConversations_RetrievesListOfConversations() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + foreach (BinaryData item in client.GetConversations(25, null, Guid.Parse("0f0eb78e-a576-1dfc-b414-0f0756de3338"), null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_GetConversations_RetrievesListOfConversations_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + await foreach (BinaryData item in client.GetConversationsAsync(25, null, Guid.Parse("0f0eb78e-a576-1dfc-b414-0f0756de3338"), null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_GetConversations_RetrievesListOfConversations_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + foreach (CommunicationConversation item in client.GetConversations()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_GetConversations_RetrievesListOfConversations_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + await foreach (CommunicationConversation item in client.GetConversationsAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationMessageItem_GetMessages_RetrievesListOfConversationMessages() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + foreach (BinaryData item in client.GetMessages("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("message").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("senderCommunicationIdentifier").ToString()); + Console.WriteLine(result.GetProperty("createdOn").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationMessageItem_GetMessages_RetrievesListOfConversationMessages_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + await foreach (BinaryData item in client.GetMessagesAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2", null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("message").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("senderCommunicationIdentifier").ToString()); + Console.WriteLine(result.GetProperty("createdOn").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationMessageItem_GetMessages_RetrievesListOfConversationMessages_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + foreach (ConversationMessageItem item in client.GetMessages("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationMessageItem_GetMessages_RetrievesListOfConversationMessages_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationAdministrationClient client = new ConversationAdministrationClient(endpoint, credential); + + await foreach (ConversationMessageItem item in client.GetMessagesAsync("19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2")) + { + } + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_ConversationThreadClient.cs b/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_ConversationThreadClient.cs new file mode 100644 index 000000000000..26b2230339ee --- /dev/null +++ b/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_ConversationThreadClient.cs @@ -0,0 +1,847 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Threading.Tasks; +using Azure.Core; +using Azure.Identity; +using NUnit.Framework; + +namespace Azure.Communication.Messages.Samples +{ + public partial class Samples_ConversationThreadClient + { + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_AddParticipants_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + participants = new object[] + { +new +{ +kind = "internal", +contact = new +{ +kind = "communication", +id = "", +}, +} + }, + }); + Response response = client.AddParticipants("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_AddParticipants_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + participants = new object[] + { +new +{ +kind = "internal", +contact = new +{ +kind = "communication", +id = "", +}, +} + }, + }); + Response response = await client.AddParticipantsAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_AddParticipants_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + AddParticipantsOptions options = new AddParticipantsOptions(new ConversationParticipant[] + { +new InternalConversationParticipant(new CommunicationContact("")) + }); + Response response = client.AddParticipants("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_AddParticipants_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + AddParticipantsOptions options = new AddParticipantsOptions(new ConversationParticipant[] + { +new InternalConversationParticipant(new CommunicationContact("")) + }); + Response response = await client.AddParticipantsAsync("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_AddParticipants_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + participants = new object[] + { +new +{ +kind = "internal", +contact = new +{ +kind = "communication", +id = "", +}, +displayName = "", +} + }, + }); + Response response = client.AddParticipants("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_AddParticipants_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + participants = new object[] + { +new +{ +kind = "internal", +contact = new +{ +kind = "communication", +id = "", +}, +displayName = "", +} + }, + }); + Response response = await client.AddParticipantsAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_AddParticipants_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + AddParticipantsOptions options = new AddParticipantsOptions(new ConversationParticipant[] + { +new InternalConversationParticipant(new CommunicationContact("")) +{ +DisplayName = "", +} + }); + Response response = client.AddParticipants("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_AddParticipants_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + AddParticipantsOptions options = new AddParticipantsOptions(new ConversationParticipant[] + { +new InternalConversationParticipant(new CommunicationContact("")) +{ +DisplayName = "", +} + }); + Response response = await client.AddParticipantsAsync("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_RemoveParticipants_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + participantIds = new object[] + { +"" + }, + }); + Response response = client.RemoveParticipants("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_RemoveParticipants_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + participantIds = new object[] + { +"" + }, + }); + Response response = await client.RemoveParticipantsAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_RemoveParticipants_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "" }); + Response response = client.RemoveParticipants("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_RemoveParticipants_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "" }); + Response response = await client.RemoveParticipantsAsync("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_RemoveParticipants_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + participantIds = new object[] + { +"" + }, + }); + Response response = client.RemoveParticipants("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_RemoveParticipants_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + participantIds = new object[] + { +"" + }, + }); + Response response = await client.RemoveParticipantsAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("code").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("message").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("target").ToString()); + Console.WriteLine(result.GetProperty("invalidParticipants")[0].GetProperty("error").GetProperty("innererror").GetProperty("code").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_RemoveParticipants_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "" }); + Response response = client.RemoveParticipants("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_RemoveParticipants_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + RemoveParticipantsOptions options = new RemoveParticipantsOptions(new string[] { "" }); + Response response = await client.RemoveParticipantsAsync("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_SendMessage_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + request = new + { + kind = "text", + content = "", + }, + }); + Response response = client.SendMessage("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("messageId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_SendMessage_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + request = new + { + kind = "text", + content = "", + }, + }); + Response response = await client.SendMessageAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("messageId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_SendMessage_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + SendConversationMessageOptions options = new SendConversationMessageOptions(new TextConversationMessageContent("")); + Response response = client.SendMessage("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_SendMessage_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + SendConversationMessageOptions options = new SendConversationMessageOptions(new TextConversationMessageContent("")); + Response response = await client.SendMessageAsync("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_SendMessage_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + request = new + { + kind = "text", + content = "", + }, + outboundDeliveryStrategy = "internalOnly", + }); + Response response = client.SendMessage("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("messageId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_SendMessage_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + using RequestContent content = RequestContent.Create(new + { + request = new + { + kind = "text", + content = "", + }, + outboundDeliveryStrategy = "internalOnly", + }); + Response response = await client.SendMessageAsync("", content); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("messageId").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_SendMessage_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + SendConversationMessageOptions options = new SendConversationMessageOptions(new TextConversationMessageContent("")) + { + OutboundDeliveryStrategy = OutboundDeliveryStrategyKind.InternalOnly, + }; + Response response = client.SendMessage("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_SendMessage_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + SendConversationMessageOptions options = new SendConversationMessageOptions(new TextConversationMessageContent("")) + { + OutboundDeliveryStrategy = OutboundDeliveryStrategyKind.InternalOnly, + }; + Response response = await client.SendMessageAsync("", options); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_AnalyzeConversation_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + Response response = client.AnalyzeConversation("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("summary").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_AnalyzeConversation_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + Response response = await client.AnalyzeConversationAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("summary").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_AnalyzeConversation_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + Response response = client.AnalyzeConversation(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_AnalyzeConversation_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + Response response = await client.AnalyzeConversationAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_AnalyzeConversation_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + Response response = client.AnalyzeConversation("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("summary").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_AnalyzeConversation_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + Response response = await client.AnalyzeConversationAsync("", null); + + JsonElement result = JsonDocument.Parse(response.ContentStream).RootElement; + Console.WriteLine(result.GetProperty("summary").ToString()); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationThreadClient_AnalyzeConversation_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + Response response = client.AnalyzeConversation(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationThreadClient_AnalyzeConversation_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + Response response = await client.AnalyzeConversationAsync(""); + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_GetConversations_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + foreach (BinaryData item in client.GetConversations(null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_GetConversations_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + await foreach (BinaryData item in client.GetConversationsAsync(null, null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_GetConversations_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + foreach (CommunicationConversation item in client.GetConversations()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_GetConversations_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + await foreach (CommunicationConversation item in client.GetConversationsAsync()) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_GetConversations_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + foreach (BinaryData item in client.GetConversations(1234, "", Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("topic").ToString()); + Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString()); + Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_GetConversations_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + await foreach (BinaryData item in client.GetConversationsAsync(1234, "", Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("topic").ToString()); + Console.WriteLine(result.GetProperty("deliveryChannelIds")[0].ToString()); + Console.WriteLine(result.GetProperty("outboundDeliveryStrategy").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("displayName").ToString()); + Console.WriteLine(result.GetProperty("participants")[0].GetProperty("kind").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_Conversation_GetConversations_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + foreach (CommunicationConversation item in client.GetConversations(maxPageSize: 1234, participantId: "", channelId: Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"))) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_Conversation_GetConversations_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + await foreach (CommunicationConversation item in client.GetConversationsAsync(maxPageSize: 1234, participantId: "", channelId: Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"))) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationMessageItem_GetMessages_ShortVersion() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + foreach (BinaryData item in client.GetMessages("", null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("message").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("senderCommunicationIdentifier").ToString()); + Console.WriteLine(result.GetProperty("createdOn").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationMessageItem_GetMessages_ShortVersion_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + await foreach (BinaryData item in client.GetMessagesAsync("", null, null, null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("message").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("senderCommunicationIdentifier").ToString()); + Console.WriteLine(result.GetProperty("createdOn").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationMessageItem_GetMessages_ShortVersion_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + foreach (ConversationMessageItem item in client.GetMessages("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationMessageItem_GetMessages_ShortVersion_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + await foreach (ConversationMessageItem item in client.GetMessagesAsync("")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationMessageItem_GetMessages_AllParameters() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + foreach (BinaryData item in client.GetMessages("", 1234, "", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("sequenceId").ToString()); + Console.WriteLine(result.GetProperty("message").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("senderDisplayName").ToString()); + Console.WriteLine(result.GetProperty("senderCommunicationIdentifier").ToString()); + Console.WriteLine(result.GetProperty("createdOn").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationMessageItem_GetMessages_AllParameters_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + await foreach (BinaryData item in client.GetMessagesAsync("", 1234, "", null)) + { + JsonElement result = JsonDocument.Parse(item.ToStream()).RootElement; + Console.WriteLine(result.GetProperty("id").ToString()); + Console.WriteLine(result.GetProperty("sequenceId").ToString()); + Console.WriteLine(result.GetProperty("message").GetProperty("kind").ToString()); + Console.WriteLine(result.GetProperty("senderDisplayName").ToString()); + Console.WriteLine(result.GetProperty("senderCommunicationIdentifier").ToString()); + Console.WriteLine(result.GetProperty("createdOn").ToString()); + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public void Example_ConversationMessageItem_GetMessages_AllParameters_Convenience() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + foreach (ConversationMessageItem item in client.GetMessages("", maxPageSize: 1234, participantId: "")) + { + } + } + + [Test] + [Ignore("Only validating compilation of examples")] + public async Task Example_ConversationMessageItem_GetMessages_AllParameters_Convenience_Async() + { + Uri endpoint = new Uri(""); + AzureKeyCredential credential = new AzureKeyCredential(""); + ConversationThreadClient client = new ConversationThreadClient(endpoint, credential); + + await foreach (ConversationMessageItem item in client.GetMessagesAsync("", maxPageSize: 1234, participantId: "")) + { + } + } + } +} diff --git a/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_MessageTemplateClient.cs b/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_MessageTemplateClient.cs index 9764df93a9db..9b83b68ec6c2 100644 --- a/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_MessageTemplateClient.cs +++ b/sdk/communication/Azure.Communication.Messages/tests/Generated/Samples/Samples_MessageTemplateClient.cs @@ -107,7 +107,7 @@ public void Example_MessageTemplateItem_GetTemplates_AllParameters_Convenience() { MessageTemplateClient client = new MessageTemplateClient((string)null); - foreach (MessageTemplateItem item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), maxpagesize: 1234)) + foreach (MessageTemplateItem item in client.GetTemplates(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), maxPageSize: 1234)) { } } @@ -118,7 +118,7 @@ public async Task Example_MessageTemplateItem_GetTemplates_AllParameters_Conveni { MessageTemplateClient client = new MessageTemplateClient((string)null); - await foreach (MessageTemplateItem item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), maxpagesize: 1234)) + await foreach (MessageTemplateItem item in client.GetTemplatesAsync(Guid.Parse("73f411fe-4f43-4b4b-9cbd-6828d8f4cf9a"), maxPageSize: 1234)) { } } diff --git a/sdk/communication/Azure.Communication.Messages/tsp-location.yaml b/sdk/communication/Azure.Communication.Messages/tsp-location.yaml index 7039e1880d9b..722e36c00618 100644 --- a/sdk/communication/Azure.Communication.Messages/tsp-location.yaml +++ b/sdk/communication/Azure.Communication.Messages/tsp-location.yaml @@ -1,4 +1,4 @@ -commit: 462574dbd02088c209bb1da3eef0d93f699e8de2 directory: specification/communication/Communication.Messages -additionalDirectories: [] +commit: 12d094b44e8a62d55456c0afc374f0a72c93aebf repo: Azure/azure-rest-api-specs +additionalDirectories: diff --git a/sdk/communication/Azure.Communication.Messages/tspCodeModel.json b/sdk/communication/Azure.Communication.Messages/tspCodeModel.json index f5d5eff7dfc9..7451006bc0b6 100644 --- a/sdk/communication/Azure.Communication.Messages/tspCodeModel.json +++ b/sdk/communication/Azure.Communication.Messages/tspCodeModel.json @@ -4,7 +4,8 @@ "apiVersions": [ "2024-02-01", "2024-08-30", - "2025-01-15-preview" + "2025-01-15-preview", + "2025-04-01-preview" ], "enums": [ { @@ -205,7 +206,7 @@ "doc": "The type of message.", "isFixed": false, "isFlags": false, - "usage": "Input,Json", + "usage": "Input,Output,Json", "decorators": [] }, { @@ -556,7 +557,7 @@ "doc": "The type of the template parameter.", "isFixed": false, "isFlags": false, - "usage": "Input,Json", + "usage": "Input,Output,Json", "decorators": [] }, { @@ -595,7 +596,7 @@ "doc": "The type of the message template.", "isFixed": false, "isFlags": false, - "usage": "Input,Json", + "usage": "Input,Output,Json", "decorators": [] }, { @@ -652,7 +653,7 @@ "doc": "The WhatsApp button sub type.", "isFixed": false, "isFlags": false, - "usage": "Input,Json", + "usage": "Input,Output,Json", "decorators": [] }, { @@ -721,6 +722,24 @@ }, "doc": "Azure Communication Messages 2025-01-15-preview api version", "decorators": [] + }, + { + "$id": "80", + "kind": "enumvalue", + "name": "c2025_04_01_Preview", + "value": "2025-04-01-preview", + "valueType": { + "$id": "81", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "72" + }, + "doc": "Azure Communication Messages 2025-04-01-preview api version", + "decorators": [] } ], "namespace": "Azure.Communication.Messages", @@ -731,12 +750,12 @@ "decorators": [] }, { - "$id": "80", + "$id": "82", "kind": "enum", "name": "MessageTemplateStatus", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateStatus", "valueType": { - "$id": "81", + "$id": "83", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -744,73 +763,73 @@ }, "values": [ { - "$id": "82", + "$id": "84", "kind": "enumvalue", "name": "approved", "value": "approved", "valueType": { - "$id": "83", + "$id": "85", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "enumType": { - "$ref": "80" + "$ref": "82" }, "doc": "Message template is approved.", "decorators": [] }, { - "$id": "84", + "$id": "86", "kind": "enumvalue", "name": "rejected", "value": "rejected", "valueType": { - "$id": "85", + "$id": "87", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "enumType": { - "$ref": "80" + "$ref": "82" }, "doc": "Message template is rejected.", "decorators": [] }, { - "$id": "86", + "$id": "88", "kind": "enumvalue", "name": "pending", "value": "pending", "valueType": { - "$id": "87", + "$id": "89", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "enumType": { - "$ref": "80" + "$ref": "82" }, "doc": "Message template is pending.", "decorators": [] }, { - "$id": "88", + "$id": "90", "kind": "enumvalue", "name": "paused", "value": "paused", "valueType": { - "$id": "89", + "$id": "91", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "enumType": { - "$ref": "80" + "$ref": "82" }, "doc": "Message template is paused.", "decorators": [] @@ -824,12 +843,12 @@ "decorators": [] }, { - "$id": "90", + "$id": "92", "kind": "enum", "name": "CommunicationMessagesChannel", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.CommunicationMessagesChannel", "valueType": { - "$id": "91", + "$id": "93", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -837,19 +856,19 @@ }, "values": [ { - "$id": "92", + "$id": "94", "kind": "enumvalue", "name": "whatsApp", "value": "whatsApp", "valueType": { - "$id": "93", + "$id": "95", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "enumType": { - "$ref": "90" + "$ref": "92" }, "doc": "The WhatsApp communication messages channel type.", "decorators": [] @@ -863,12 +882,201 @@ "decorators": [] }, { - "$id": "94", + "$id": "96", + "kind": "enum", + "name": "OutboundDeliveryStrategyKind", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.OutboundDeliveryStrategyKind", + "valueType": { + "$id": "97", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "98", + "kind": "enumvalue", + "name": "internalOnly", + "value": "internalOnly", + "valueType": { + "$id": "99", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "96" + }, + "doc": "Delivery strategy for internal only.", + "decorators": [] + }, + { + "$id": "100", + "kind": "enumvalue", + "name": "allParticipants", + "value": "allParticipants", + "valueType": { + "$id": "101", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "96" + }, + "doc": "Delivery strategy for all participants.", + "decorators": [] + } + ], + "namespace": "Azure.Communication.Messages", + "doc": "The options of the outbound delivery strategy for messages sent by participants in a conversation.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json", + "decorators": [] + }, + { + "$id": "102", + "kind": "enum", + "name": "ParticipantKind", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ParticipantKind", + "valueType": { + "$id": "103", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "104", + "kind": "enumvalue", + "name": "internal", + "value": "internal", + "valueType": { + "$id": "105", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "102" + }, + "doc": "A participant internal to Azure Communication Services.", + "decorators": [] + }, + { + "$id": "106", + "kind": "enumvalue", + "name": "external", + "value": "external", + "valueType": { + "$id": "107", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "102" + }, + "doc": "A participant on other platforms", + "decorators": [] + } + ], + "namespace": "Azure.Communication.Messages", + "doc": "The type of a participant in a threaded conversation.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json", + "decorators": [] + }, + { + "$id": "108", + "kind": "enum", + "name": "MessagePlatformKind", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessagePlatformKind", + "valueType": { + "$id": "109", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "values": [ + { + "$id": "110", + "kind": "enumvalue", + "name": "communication", + "value": "communication", + "valueType": { + "$id": "111", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "108" + }, + "doc": "Azure Communication platform.", + "decorators": [] + }, + { + "$id": "112", + "kind": "enumvalue", + "name": "bot", + "value": "bot", + "valueType": { + "$id": "113", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "108" + }, + "doc": "Bot platform.", + "decorators": [] + }, + { + "$id": "114", + "kind": "enumvalue", + "name": "whatsApp", + "value": "whatsApp", + "valueType": { + "$id": "115", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "enumType": { + "$ref": "108" + }, + "doc": "WhatsApp platform.", + "decorators": [] + } + ], + "namespace": "Azure.Communication.Messages", + "doc": "Defines the type of message platform.", + "isFixed": false, + "isFlags": false, + "usage": "Input,Output,Json", + "decorators": [] + }, + { + "$id": "116", "kind": "enum", "name": "RepeatabilityResult", "crossLanguageDefinitionId": "Azure.Core.RepeatabilityResult", "valueType": { - "$id": "95", + "$id": "117", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -876,37 +1084,37 @@ }, "values": [ { - "$id": "96", + "$id": "118", "kind": "enumvalue", "name": "accepted", "value": "accepted", "valueType": { - "$id": "97", + "$id": "119", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "enumType": { - "$ref": "94" + "$ref": "116" }, "doc": "If the request was accepted and the server guarantees that the server state reflects a single execution of the operation.", "decorators": [] }, { - "$id": "98", + "$id": "120", "kind": "enumvalue", "name": "rejected", "value": "rejected", "valueType": { - "$id": "99", + "$id": "121", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "enumType": { - "$ref": "94" + "$ref": "116" }, "doc": "If the request was rejected because the combination of Repeatability-First-Sent and Repeatability-Request-ID were invalid\nor because the Repeatability-First-Sent value was outside the range of values held by the server.", "decorators": [] @@ -922,7 +1130,7 @@ ], "models": [ { - "$id": "100", + "$id": "122", "kind": "model", "name": "NotificationContent", "namespace": "Azure.Communication.Messages", @@ -931,11 +1139,11 @@ "doc": "Details of the message to send.", "decorators": [], "discriminatorProperty": { - "$id": "101", + "$id": "123", "kind": "property", "name": "kind", "serializedName": "kind", - "doc": "The type discriminator describing a notification type.", + "doc": "The type discriminator describing a message type.", "type": { "$ref": "2" }, @@ -946,27 +1154,27 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.NotificationContent.kind", "serializationOptions": { - "$id": "102", + "$id": "124", "json": { - "$id": "103", + "$id": "125", "name": "kind" } } }, "properties": [ { - "$id": "104", + "$id": "126", "kind": "property", "name": "channelRegistrationId", "serializedName": "channelRegistrationId", "doc": "The Channel Registration ID for the Business Identifier.", "type": { - "$id": "105", + "$id": "127", "kind": "string", "name": "uuid", "crossLanguageDefinitionId": "Azure.Core.uuid", "baseType": { - "$id": "106", + "$id": "128", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -981,25 +1189,25 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.NotificationContent.channelRegistrationId", "serializationOptions": { - "$id": "107", + "$id": "129", "json": { - "$id": "108", + "$id": "130", "name": "channelRegistrationId" } } }, { - "$id": "109", + "$id": "131", "kind": "property", "name": "to", "serializedName": "to", "doc": "The native external platform user identifiers of the recipient.", "type": { - "$id": "110", + "$id": "132", "kind": "array", "name": "Array", "valueType": { - "$id": "111", + "$id": "133", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1015,21 +1223,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.NotificationContent.to", "serializationOptions": { - "$id": "112", + "$id": "134", "json": { - "$id": "113", + "$id": "135", "name": "to" } } }, { - "$ref": "101" + "$ref": "123" } ], "discriminatedSubtypes": { - "$id": "114", + "$id": "136", "text": { - "$id": "115", + "$id": "137", "kind": "model", "name": "TextNotificationContent", "namespace": "Azure.Communication.Messages", @@ -1039,20 +1247,20 @@ "discriminatorValue": "text", "decorators": [], "baseModel": { - "$ref": "100" + "$ref": "122" }, "properties": [ { - "$id": "116", + "$id": "138", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message notification type is text.", "type": { - "$id": "117", + "$id": "139", "kind": "constant", "valueType": { - "$id": "118", + "$id": "140", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1068,21 +1276,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.TextNotificationContent.kind", "serializationOptions": { - "$id": "119", + "$id": "141", "json": { - "$id": "120", + "$id": "142", "name": "kind" } } }, { - "$id": "121", + "$id": "143", "kind": "property", "name": "content", "serializedName": "content", "doc": "Message content.", "type": { - "$id": "122", + "$id": "144", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1095,9 +1303,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.TextNotificationContent.content", "serializationOptions": { - "$id": "123", + "$id": "145", "json": { - "$id": "124", + "$id": "146", "name": "content" } } @@ -1105,7 +1313,7 @@ ] }, "image_v0": { - "$id": "125", + "$id": "147", "kind": "model", "name": "MediaNotificationContent", "namespace": "Azure.Communication.Messages", @@ -1116,20 +1324,20 @@ "discriminatorValue": "image_v0", "decorators": [], "baseModel": { - "$ref": "100" + "$ref": "122" }, "properties": [ { - "$id": "126", + "$id": "148", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message notification type is image.", "type": { - "$id": "127", + "$id": "149", "kind": "constant", "valueType": { - "$id": "128", + "$id": "150", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1145,21 +1353,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MediaNotificationContent.kind", "serializationOptions": { - "$id": "129", + "$id": "151", "json": { - "$id": "130", + "$id": "152", "name": "kind" } } }, { - "$id": "131", + "$id": "153", "kind": "property", "name": "content", "serializedName": "content", "doc": "Optional text content.", "type": { - "$id": "132", + "$id": "154", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1172,21 +1380,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MediaNotificationContent.content", "serializationOptions": { - "$id": "133", + "$id": "155", "json": { - "$id": "134", + "$id": "156", "name": "content" } } }, { - "$id": "135", + "$id": "157", "kind": "property", "name": "mediaUri", "serializedName": "mediaUri", "doc": "A media url for the file. Required if the type is one of the supported media types, e.g. image", "type": { - "$id": "136", + "$id": "158", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -1199,9 +1407,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MediaNotificationContent.mediaUri", "serializationOptions": { - "$id": "137", + "$id": "159", "json": { - "$id": "138", + "$id": "160", "name": "mediaUri" } } @@ -1209,7 +1417,7 @@ ] }, "image": { - "$id": "139", + "$id": "161", "kind": "model", "name": "ImageNotificationContent", "namespace": "Azure.Communication.Messages", @@ -1219,20 +1427,20 @@ "discriminatorValue": "image", "decorators": [], "baseModel": { - "$ref": "100" + "$ref": "122" }, "properties": [ { - "$id": "140", + "$id": "162", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message notification type is image.", "type": { - "$id": "141", + "$id": "163", "kind": "constant", "valueType": { - "$id": "142", + "$id": "164", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1248,21 +1456,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ImageNotificationContent.kind", "serializationOptions": { - "$id": "143", + "$id": "165", "json": { - "$id": "144", + "$id": "166", "name": "kind" } } }, { - "$id": "145", + "$id": "167", "kind": "property", "name": "caption", "serializedName": "caption", "doc": "Optional text content.", "type": { - "$id": "146", + "$id": "168", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1275,21 +1483,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ImageNotificationContent.caption", "serializationOptions": { - "$id": "147", + "$id": "169", "json": { - "$id": "148", + "$id": "170", "name": "caption" } } }, { - "$id": "149", + "$id": "171", "kind": "property", "name": "mediaUri", "serializedName": "mediaUri", "doc": "A media url for the file. Required if the type is one of the supported media types, e.g. image", "type": { - "$id": "150", + "$id": "172", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -1302,9 +1510,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ImageNotificationContent.mediaUri", "serializationOptions": { - "$id": "151", + "$id": "173", "json": { - "$id": "152", + "$id": "174", "name": "mediaUri" } } @@ -1312,7 +1520,7 @@ ] }, "document": { - "$id": "153", + "$id": "175", "kind": "model", "name": "DocumentNotificationContent", "namespace": "Azure.Communication.Messages", @@ -1322,20 +1530,20 @@ "discriminatorValue": "document", "decorators": [], "baseModel": { - "$ref": "100" + "$ref": "122" }, "properties": [ { - "$id": "154", + "$id": "176", "kind": "property", "name": "kind", "serializedName": "kind", - "doc": "Message notification type is image.", + "doc": "Message notification type is document.", "type": { - "$id": "155", + "$id": "177", "kind": "constant", "valueType": { - "$id": "156", + "$id": "178", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1351,21 +1559,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.DocumentNotificationContent.kind", "serializationOptions": { - "$id": "157", + "$id": "179", "json": { - "$id": "158", + "$id": "180", "name": "kind" } } }, { - "$id": "159", + "$id": "181", "kind": "property", "name": "caption", "serializedName": "caption", "doc": "Optional text content.", "type": { - "$id": "160", + "$id": "182", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1378,21 +1586,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.DocumentNotificationContent.caption", "serializationOptions": { - "$id": "161", + "$id": "183", "json": { - "$id": "162", + "$id": "184", "name": "caption" } } }, { - "$id": "163", + "$id": "185", "kind": "property", "name": "fileName", "serializedName": "fileName", "doc": "Optional name for the file.", "type": { - "$id": "164", + "$id": "186", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1405,21 +1613,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.DocumentNotificationContent.fileName", "serializationOptions": { - "$id": "165", + "$id": "187", "json": { - "$id": "166", + "$id": "188", "name": "fileName" } } }, { - "$id": "167", + "$id": "189", "kind": "property", "name": "mediaUri", "serializedName": "mediaUri", "doc": "A media url for the file. Required if the type is one of the supported media types, e.g. image", "type": { - "$id": "168", + "$id": "190", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -1432,9 +1640,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.DocumentNotificationContent.mediaUri", "serializationOptions": { - "$id": "169", + "$id": "191", "json": { - "$id": "170", + "$id": "192", "name": "mediaUri" } } @@ -1442,7 +1650,7 @@ ] }, "video": { - "$id": "171", + "$id": "193", "kind": "model", "name": "VideoNotificationContent", "namespace": "Azure.Communication.Messages", @@ -1452,20 +1660,20 @@ "discriminatorValue": "video", "decorators": [], "baseModel": { - "$ref": "100" + "$ref": "122" }, "properties": [ { - "$id": "172", + "$id": "194", "kind": "property", "name": "kind", "serializedName": "kind", - "doc": "Message notification type is image.", + "doc": "Message notification type is video.", "type": { - "$id": "173", + "$id": "195", "kind": "constant", "valueType": { - "$id": "174", + "$id": "196", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1481,21 +1689,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.VideoNotificationContent.kind", "serializationOptions": { - "$id": "175", + "$id": "197", "json": { - "$id": "176", + "$id": "198", "name": "kind" } } }, { - "$id": "177", + "$id": "199", "kind": "property", "name": "caption", "serializedName": "caption", "doc": "Optional text content.", "type": { - "$id": "178", + "$id": "200", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1508,21 +1716,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.VideoNotificationContent.caption", "serializationOptions": { - "$id": "179", + "$id": "201", "json": { - "$id": "180", + "$id": "202", "name": "caption" } } }, { - "$id": "181", + "$id": "203", "kind": "property", "name": "mediaUri", "serializedName": "mediaUri", "doc": "A media url for the file. Required if the type is one of the supported media types, e.g. image", "type": { - "$id": "182", + "$id": "204", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -1535,9 +1743,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.VideoNotificationContent.mediaUri", "serializationOptions": { - "$id": "183", + "$id": "205", "json": { - "$id": "184", + "$id": "206", "name": "mediaUri" } } @@ -1545,7 +1753,7 @@ ] }, "audio": { - "$id": "185", + "$id": "207", "kind": "model", "name": "AudioNotificationContent", "namespace": "Azure.Communication.Messages", @@ -1555,20 +1763,20 @@ "discriminatorValue": "audio", "decorators": [], "baseModel": { - "$ref": "100" + "$ref": "122" }, "properties": [ { - "$id": "186", + "$id": "208", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message notification type is audio.", "type": { - "$id": "187", + "$id": "209", "kind": "constant", "valueType": { - "$id": "188", + "$id": "210", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1584,21 +1792,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.AudioNotificationContent.kind", "serializationOptions": { - "$id": "189", + "$id": "211", "json": { - "$id": "190", + "$id": "212", "name": "kind" } } }, { - "$id": "191", + "$id": "213", "kind": "property", "name": "mediaUri", "serializedName": "mediaUri", "doc": "A media url for the file. Required if the type is one of the supported media types, e.g. image", "type": { - "$id": "192", + "$id": "214", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -1611,9 +1819,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.AudioNotificationContent.mediaUri", "serializationOptions": { - "$id": "193", + "$id": "215", "json": { - "$id": "194", + "$id": "216", "name": "mediaUri" } } @@ -1621,7 +1829,7 @@ ] }, "reaction": { - "$id": "195", + "$id": "217", "kind": "model", "name": "ReactionNotificationContent", "namespace": "Azure.Communication.Messages", @@ -1631,20 +1839,20 @@ "discriminatorValue": "reaction", "decorators": [], "baseModel": { - "$ref": "100" + "$ref": "122" }, "properties": [ { - "$id": "196", + "$id": "218", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message notification type is reaction.", "type": { - "$id": "197", + "$id": "219", "kind": "constant", "valueType": { - "$id": "198", + "$id": "220", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1660,21 +1868,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ReactionNotificationContent.kind", "serializationOptions": { - "$id": "199", + "$id": "221", "json": { - "$id": "200", + "$id": "222", "name": "kind" } } }, { - "$id": "201", + "$id": "223", "kind": "property", "name": "emoji", "serializedName": "emoji", "doc": "emoji content like \\uD83D\\uDE00.", "type": { - "$id": "202", + "$id": "224", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1687,21 +1895,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ReactionNotificationContent.emoji", "serializationOptions": { - "$id": "203", + "$id": "225", "json": { - "$id": "204", + "$id": "226", "name": "emoji" } } }, { - "$id": "205", + "$id": "227", "kind": "property", "name": "messageId", "serializedName": "messageId", "doc": "ID of the previous message you want to reply to.", "type": { - "$id": "206", + "$id": "228", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1714,9 +1922,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ReactionNotificationContent.messageId", "serializationOptions": { - "$id": "207", + "$id": "229", "json": { - "$id": "208", + "$id": "230", "name": "messageId" } } @@ -1724,7 +1932,7 @@ ] }, "sticker": { - "$id": "209", + "$id": "231", "kind": "model", "name": "StickerNotificationContent", "namespace": "Azure.Communication.Messages", @@ -1734,20 +1942,20 @@ "discriminatorValue": "sticker", "decorators": [], "baseModel": { - "$ref": "100" + "$ref": "122" }, "properties": [ { - "$id": "210", + "$id": "232", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message notification type is sticker.", "type": { - "$id": "211", + "$id": "233", "kind": "constant", "valueType": { - "$id": "212", + "$id": "234", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1763,21 +1971,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.StickerNotificationContent.kind", "serializationOptions": { - "$id": "213", + "$id": "235", "json": { - "$id": "214", + "$id": "236", "name": "kind" } } }, { - "$id": "215", + "$id": "237", "kind": "property", "name": "mediaUri", "serializedName": "mediaUri", "doc": "A media url for the file. Required if the type is one of the supported media types, e.g. image", "type": { - "$id": "216", + "$id": "238", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -1790,9 +1998,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.StickerNotificationContent.mediaUri", "serializationOptions": { - "$id": "217", + "$id": "239", "json": { - "$id": "218", + "$id": "240", "name": "mediaUri" } } @@ -1800,7 +2008,7 @@ ] }, "interactive": { - "$id": "219", + "$id": "241", "kind": "model", "name": "InteractiveNotificationContent", "namespace": "Azure.Communication.Messages", @@ -1810,20 +2018,20 @@ "discriminatorValue": "interactive", "decorators": [], "baseModel": { - "$ref": "100" + "$ref": "122" }, "properties": [ { - "$id": "220", + "$id": "242", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message notification type is Interactive.", "type": { - "$id": "221", + "$id": "243", "kind": "constant", "valueType": { - "$id": "222", + "$id": "244", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1839,21 +2047,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.InteractiveNotificationContent.kind", "serializationOptions": { - "$id": "223", + "$id": "245", "json": { - "$id": "224", + "$id": "246", "name": "kind" } } }, { - "$id": "225", + "$id": "247", "kind": "property", "name": "interactiveMessage", "serializedName": "interactiveMessage", "doc": "The interactive message content.", "type": { - "$id": "226", + "$id": "248", "kind": "model", "name": "InteractiveMessage", "namespace": "Azure.Communication.Messages", @@ -1863,13 +2071,13 @@ "decorators": [], "properties": [ { - "$id": "227", + "$id": "249", "kind": "property", "name": "header", "serializedName": "header", "doc": "Gets or Sets Header content. Supports the following types:text, images etc.", "type": { - "$id": "228", + "$id": "250", "kind": "model", "name": "MessageContent", "namespace": "Azure.Communication.Messages", @@ -1878,7 +2086,7 @@ "doc": "The message content object used to create interactive messages components.", "decorators": [], "discriminatorProperty": { - "$id": "229", + "$id": "251", "kind": "property", "name": "kind", "serializedName": "kind", @@ -1893,22 +2101,22 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageContent.kind", "serializationOptions": { - "$id": "230", + "$id": "252", "json": { - "$id": "231", + "$id": "253", "name": "kind" } } }, "properties": [ { - "$ref": "229" + "$ref": "251" } ], "discriminatedSubtypes": { - "$id": "232", + "$id": "254", "text": { - "$id": "233", + "$id": "255", "kind": "model", "name": "TextMessageContent", "namespace": "Azure.Communication.Messages", @@ -1918,20 +2126,20 @@ "discriminatorValue": "text", "decorators": [], "baseModel": { - "$ref": "228" + "$ref": "250" }, "properties": [ { - "$id": "234", + "$id": "256", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message content kind is text.", "type": { - "$id": "235", + "$id": "257", "kind": "constant", "valueType": { - "$id": "236", + "$id": "258", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1947,21 +2155,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.TextMessageContent.kind", "serializationOptions": { - "$id": "237", + "$id": "259", "json": { - "$id": "238", + "$id": "260", "name": "kind" } } }, { - "$id": "239", + "$id": "261", "kind": "property", "name": "text", "serializedName": "text", "doc": "The text value.", "type": { - "$id": "240", + "$id": "262", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -1974,9 +2182,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.TextMessageContent.text", "serializationOptions": { - "$id": "241", + "$id": "263", "json": { - "$id": "242", + "$id": "264", "name": "text" } } @@ -1984,7 +2192,7 @@ ] }, "document": { - "$id": "243", + "$id": "265", "kind": "model", "name": "DocumentMessageContent", "namespace": "Azure.Communication.Messages", @@ -1994,20 +2202,20 @@ "discriminatorValue": "document", "decorators": [], "baseModel": { - "$ref": "228" + "$ref": "250" }, "properties": [ { - "$id": "244", + "$id": "266", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message content kind is document.", "type": { - "$id": "245", + "$id": "267", "kind": "constant", "valueType": { - "$id": "246", + "$id": "268", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2023,21 +2231,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.DocumentMessageContent.kind", "serializationOptions": { - "$id": "247", + "$id": "269", "json": { - "$id": "248", + "$id": "270", "name": "kind" } } }, { - "$id": "249", + "$id": "271", "kind": "property", "name": "mediaUri", "serializedName": "mediaUri", "doc": "MediaUri of the media content.", "type": { - "$id": "250", + "$id": "272", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -2050,9 +2258,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.DocumentMessageContent.mediaUri", "serializationOptions": { - "$id": "251", + "$id": "273", "json": { - "$id": "252", + "$id": "274", "name": "mediaUri" } } @@ -2060,7 +2268,7 @@ ] }, "image": { - "$id": "253", + "$id": "275", "kind": "model", "name": "ImageMessageContent", "namespace": "Azure.Communication.Messages", @@ -2070,20 +2278,20 @@ "discriminatorValue": "image", "decorators": [], "baseModel": { - "$ref": "228" + "$ref": "250" }, "properties": [ { - "$id": "254", + "$id": "276", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message content kind is image.", "type": { - "$id": "255", + "$id": "277", "kind": "constant", "valueType": { - "$id": "256", + "$id": "278", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2099,21 +2307,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ImageMessageContent.kind", "serializationOptions": { - "$id": "257", + "$id": "279", "json": { - "$id": "258", + "$id": "280", "name": "kind" } } }, { - "$id": "259", + "$id": "281", "kind": "property", "name": "mediaUri", "serializedName": "mediaUri", "doc": "MediaUri of the media content.", "type": { - "$id": "260", + "$id": "282", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -2126,9 +2334,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ImageMessageContent.mediaUri", "serializationOptions": { - "$id": "261", + "$id": "283", "json": { - "$id": "262", + "$id": "284", "name": "mediaUri" } } @@ -2136,7 +2344,7 @@ ] }, "video": { - "$id": "263", + "$id": "285", "kind": "model", "name": "VideoMessageContent", "namespace": "Azure.Communication.Messages", @@ -2146,20 +2354,20 @@ "discriminatorValue": "video", "decorators": [], "baseModel": { - "$ref": "228" + "$ref": "250" }, "properties": [ { - "$id": "264", + "$id": "286", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message content kind is video.", "type": { - "$id": "265", + "$id": "287", "kind": "constant", "valueType": { - "$id": "266", + "$id": "288", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2175,21 +2383,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.VideoMessageContent.kind", "serializationOptions": { - "$id": "267", + "$id": "289", "json": { - "$id": "268", + "$id": "290", "name": "kind" } } }, { - "$id": "269", + "$id": "291", "kind": "property", "name": "mediaUri", "serializedName": "mediaUri", "doc": "MediaUri of the media content.", "type": { - "$id": "270", + "$id": "292", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -2202,9 +2410,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.VideoMessageContent.mediaUri", "serializationOptions": { - "$id": "271", + "$id": "293", "json": { - "$id": "272", + "$id": "294", "name": "mediaUri" } } @@ -2212,7 +2420,7 @@ ] }, "buttonSet": { - "$id": "273", + "$id": "295", "kind": "model", "name": "ButtonSetContent", "namespace": "Azure.Communication.Messages", @@ -2222,20 +2430,20 @@ "discriminatorValue": "buttonSet", "decorators": [], "baseModel": { - "$ref": "228" + "$ref": "250" }, "properties": [ { - "$id": "274", + "$id": "296", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message content kind is Button.", "type": { - "$id": "275", + "$id": "297", "kind": "constant", "valueType": { - "$id": "276", + "$id": "298", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2251,25 +2459,25 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ButtonSetContent.kind", "serializationOptions": { - "$id": "277", + "$id": "299", "json": { - "$id": "278", + "$id": "300", "name": "kind" } } }, { - "$id": "279", + "$id": "301", "kind": "property", "name": "buttons", "serializedName": "buttons", "doc": "Unique Id of the button content.", "type": { - "$id": "280", + "$id": "302", "kind": "array", "name": "ArrayButtonContent", "valueType": { - "$id": "281", + "$id": "303", "kind": "model", "name": "ButtonContent", "namespace": "Azure.Communication.Messages", @@ -2279,13 +2487,13 @@ "decorators": [], "properties": [ { - "$id": "282", + "$id": "304", "kind": "property", "name": "id", "serializedName": "id", "doc": "Unique Id of the button content.", "type": { - "$id": "283", + "$id": "305", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2298,21 +2506,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ButtonContent.id", "serializationOptions": { - "$id": "284", + "$id": "306", "json": { - "$id": "285", + "$id": "307", "name": "id" } } }, { - "$id": "286", + "$id": "308", "kind": "property", "name": "title", "serializedName": "title", "doc": "Title of the button content.", "type": { - "$id": "287", + "$id": "309", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2325,9 +2533,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ButtonContent.title", "serializationOptions": { - "$id": "288", + "$id": "310", "json": { - "$id": "289", + "$id": "311", "name": "title" } } @@ -2344,9 +2552,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ButtonSetContent.buttons", "serializationOptions": { - "$id": "290", + "$id": "312", "json": { - "$id": "291", + "$id": "313", "name": "buttons" } } @@ -2354,7 +2562,7 @@ ] }, "url": { - "$id": "292", + "$id": "314", "kind": "model", "name": "LinkContent", "namespace": "Azure.Communication.Messages", @@ -2364,20 +2572,20 @@ "discriminatorValue": "url", "decorators": [], "baseModel": { - "$ref": "228" + "$ref": "250" }, "properties": [ { - "$id": "293", + "$id": "315", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message content kind is url.", "type": { - "$id": "294", + "$id": "316", "kind": "constant", "valueType": { - "$id": "295", + "$id": "317", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2393,21 +2601,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.LinkContent.kind", "serializationOptions": { - "$id": "296", + "$id": "318", "json": { - "$id": "297", + "$id": "319", "name": "kind" } } }, { - "$id": "298", + "$id": "320", "kind": "property", "name": "title", "serializedName": "title", "doc": "Title of the url content.", "type": { - "$id": "299", + "$id": "321", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2420,21 +2628,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.LinkContent.title", "serializationOptions": { - "$id": "300", + "$id": "322", "json": { - "$id": "301", + "$id": "323", "name": "title" } } }, { - "$id": "302", + "$id": "324", "kind": "property", "name": "uri", "serializedName": "url", "doc": "The url in the content.", "type": { - "$id": "303", + "$id": "325", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -2447,9 +2655,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.LinkContent.url", "serializationOptions": { - "$id": "304", + "$id": "326", "json": { - "$id": "305", + "$id": "327", "name": "url" } } @@ -2457,7 +2665,7 @@ ] }, "group": { - "$id": "306", + "$id": "328", "kind": "model", "name": "ActionGroupContent", "namespace": "Azure.Communication.Messages", @@ -2467,20 +2675,20 @@ "discriminatorValue": "group", "decorators": [], "baseModel": { - "$ref": "228" + "$ref": "250" }, "properties": [ { - "$id": "307", + "$id": "329", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message content kind is actionGroup.", "type": { - "$id": "308", + "$id": "330", "kind": "constant", "valueType": { - "$id": "309", + "$id": "331", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2496,21 +2704,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ActionGroupContent.kind", "serializationOptions": { - "$id": "310", + "$id": "332", "json": { - "$id": "311", + "$id": "333", "name": "kind" } } }, { - "$id": "312", + "$id": "334", "kind": "property", "name": "title", "serializedName": "title", "doc": "Title of the actionGroup content.", "type": { - "$id": "313", + "$id": "335", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2523,25 +2731,25 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ActionGroupContent.title", "serializationOptions": { - "$id": "314", + "$id": "336", "json": { - "$id": "315", + "$id": "337", "name": "title" } } }, { - "$id": "316", + "$id": "338", "kind": "property", "name": "groups", "serializedName": "groups", "doc": "Set or group of actions.", "type": { - "$id": "317", + "$id": "339", "kind": "array", "name": "ArrayActionGroup", "valueType": { - "$id": "318", + "$id": "340", "kind": "model", "name": "ActionGroup", "namespace": "Azure.Communication.Messages", @@ -2551,13 +2759,13 @@ "decorators": [], "properties": [ { - "$id": "319", + "$id": "341", "kind": "property", "name": "title", "serializedName": "title", "doc": "Title of the ActionGroup.", "type": { - "$id": "320", + "$id": "342", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2570,25 +2778,25 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ActionGroup.title", "serializationOptions": { - "$id": "321", + "$id": "343", "json": { - "$id": "322", + "$id": "344", "name": "title" } } }, { - "$id": "323", + "$id": "345", "kind": "property", "name": "items", "serializedName": "items", "doc": "Array of items in ActionGroup.", "type": { - "$id": "324", + "$id": "346", "kind": "array", "name": "ArrayActionGroupItem", "valueType": { - "$id": "325", + "$id": "347", "kind": "model", "name": "ActionGroupItem", "namespace": "Azure.Communication.Messages", @@ -2598,13 +2806,13 @@ "decorators": [], "properties": [ { - "$id": "326", + "$id": "348", "kind": "property", "name": "id", "serializedName": "id", "doc": "Id of the Item.", "type": { - "$id": "327", + "$id": "349", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2617,21 +2825,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ActionGroupItem.id", "serializationOptions": { - "$id": "328", + "$id": "350", "json": { - "$id": "329", + "$id": "351", "name": "id" } } }, { - "$id": "330", + "$id": "352", "kind": "property", "name": "title", "serializedName": "title", "doc": "Title of the Item.", "type": { - "$id": "331", + "$id": "353", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2644,21 +2852,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ActionGroupItem.title", "serializationOptions": { - "$id": "332", + "$id": "354", "json": { - "$id": "333", + "$id": "355", "name": "title" } } }, { - "$id": "334", + "$id": "356", "kind": "property", "name": "description", "serializedName": "description", "doc": "Description of the Item.", "type": { - "$id": "335", + "$id": "357", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2671,9 +2879,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ActionGroupItem.description", "serializationOptions": { - "$id": "336", + "$id": "358", "json": { - "$id": "337", + "$id": "359", "name": "description" } } @@ -2690,9 +2898,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ActionGroup.items", "serializationOptions": { - "$id": "338", + "$id": "360", "json": { - "$id": "339", + "$id": "361", "name": "items" } } @@ -2709,9 +2917,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ActionGroupContent.groups", "serializationOptions": { - "$id": "340", + "$id": "362", "json": { - "$id": "341", + "$id": "363", "name": "groups" } } @@ -2727,21 +2935,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.InteractiveMessage.header", "serializationOptions": { - "$id": "342", + "$id": "364", "json": { - "$id": "343", + "$id": "365", "name": "header" } } }, { - "$id": "344", + "$id": "366", "kind": "property", "name": "body", "serializedName": "body", "doc": "Gets or Sets Message body content. Emojis, markdown, and links are supported.", "type": { - "$ref": "233" + "$ref": "255" }, "optional": false, "readOnly": false, @@ -2750,21 +2958,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.InteractiveMessage.body", "serializationOptions": { - "$id": "345", + "$id": "367", "json": { - "$id": "346", + "$id": "368", "name": "body" } } }, { - "$id": "347", + "$id": "369", "kind": "property", "name": "footer", "serializedName": "footer", "doc": "Gets or Sets Message footer content. Emojis, markdown, and links are supported.", "type": { - "$ref": "233" + "$ref": "255" }, "optional": true, "readOnly": false, @@ -2773,21 +2981,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.InteractiveMessage.footer", "serializationOptions": { - "$id": "348", + "$id": "370", "json": { - "$id": "349", + "$id": "371", "name": "footer" } } }, { - "$id": "350", + "$id": "372", "kind": "property", "name": "action", "serializedName": "action", "doc": "The binding object to get or set Action which describes options user have to respond to message.", "type": { - "$id": "351", + "$id": "373", "kind": "model", "name": "ActionBindings", "namespace": "Azure.Communication.Messages", @@ -2796,7 +3004,7 @@ "doc": "Binding actions to the interactive message.", "decorators": [], "discriminatorProperty": { - "$id": "352", + "$id": "374", "kind": "property", "name": "kind", "serializedName": "kind", @@ -2811,22 +3019,22 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ActionBindings.kind", "serializationOptions": { - "$id": "353", + "$id": "375", "json": { - "$id": "354", + "$id": "376", "name": "kind" } } }, "properties": [ { - "$ref": "352" + "$ref": "374" } ], "discriminatedSubtypes": { - "$id": "355", + "$id": "377", "whatsAppListAction": { - "$id": "356", + "$id": "378", "kind": "model", "name": "WhatsAppListActionBindings", "namespace": "Azure.Communication.Messages", @@ -2836,20 +3044,20 @@ "discriminatorValue": "whatsAppListAction", "decorators": [], "baseModel": { - "$ref": "351" + "$ref": "373" }, "properties": [ { - "$id": "357", + "$id": "379", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message action binding type is WhatsAppListAction.", "type": { - "$id": "358", + "$id": "380", "kind": "constant", "valueType": { - "$id": "359", + "$id": "381", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2865,21 +3073,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppListActionBindings.kind", "serializationOptions": { - "$id": "360", + "$id": "382", "json": { - "$id": "361", + "$id": "383", "name": "kind" } } }, { - "$id": "362", + "$id": "384", "kind": "property", "name": "content", "serializedName": "content", "doc": "Action content of Interactive message.", "type": { - "$ref": "306" + "$ref": "328" }, "optional": false, "readOnly": false, @@ -2888,9 +3096,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppListActionBindings.content", "serializationOptions": { - "$id": "363", + "$id": "385", "json": { - "$id": "364", + "$id": "386", "name": "content" } } @@ -2898,7 +3106,7 @@ ] }, "whatsAppButtonAction": { - "$id": "365", + "$id": "387", "kind": "model", "name": "WhatsAppButtonActionBindings", "namespace": "Azure.Communication.Messages", @@ -2908,20 +3116,20 @@ "discriminatorValue": "whatsAppButtonAction", "decorators": [], "baseModel": { - "$ref": "351" + "$ref": "373" }, "properties": [ { - "$id": "366", + "$id": "388", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message action binding type is WhatsAppButtonAction.", "type": { - "$id": "367", + "$id": "389", "kind": "constant", "valueType": { - "$id": "368", + "$id": "390", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -2937,21 +3145,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppButtonActionBindings.kind", "serializationOptions": { - "$id": "369", + "$id": "391", "json": { - "$id": "370", + "$id": "392", "name": "kind" } } }, { - "$id": "371", + "$id": "393", "kind": "property", "name": "content", "serializedName": "content", "doc": "Action content of Interactive message.", "type": { - "$ref": "273" + "$ref": "295" }, "optional": false, "readOnly": false, @@ -2960,9 +3168,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppButtonActionBindings.content", "serializationOptions": { - "$id": "372", + "$id": "394", "json": { - "$id": "373", + "$id": "395", "name": "content" } } @@ -2970,7 +3178,7 @@ ] }, "whatsAppUrlAction": { - "$id": "374", + "$id": "396", "kind": "model", "name": "WhatsAppUrlActionBindings", "namespace": "Azure.Communication.Messages", @@ -2980,20 +3188,20 @@ "discriminatorValue": "whatsAppUrlAction", "decorators": [], "baseModel": { - "$ref": "351" + "$ref": "373" }, "properties": [ { - "$id": "375", + "$id": "397", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message action binding type is WhatsAppUrlAction.", "type": { - "$id": "376", + "$id": "398", "kind": "constant", "valueType": { - "$id": "377", + "$id": "399", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3009,21 +3217,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppUrlActionBindings.kind", "serializationOptions": { - "$id": "378", + "$id": "400", "json": { - "$id": "379", + "$id": "401", "name": "kind" } } }, { - "$id": "380", + "$id": "402", "kind": "property", "name": "content", "serializedName": "content", "doc": "Action content of Interactive message.", "type": { - "$ref": "292" + "$ref": "314" }, "optional": false, "readOnly": false, @@ -3032,9 +3240,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppUrlActionBindings.content", "serializationOptions": { - "$id": "381", + "$id": "403", "json": { - "$id": "382", + "$id": "404", "name": "content" } } @@ -3050,9 +3258,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.InteractiveMessage.action", "serializationOptions": { - "$id": "383", + "$id": "405", "json": { - "$id": "384", + "$id": "406", "name": "action" } } @@ -3066,9 +3274,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.InteractiveNotificationContent.interactiveMessage", "serializationOptions": { - "$id": "385", + "$id": "407", "json": { - "$id": "386", + "$id": "408", "name": "interactiveMessage" } } @@ -3076,7 +3284,7 @@ ] }, "template": { - "$id": "387", + "$id": "409", "kind": "model", "name": "TemplateNotificationContent", "namespace": "Azure.Communication.Messages", @@ -3086,20 +3294,20 @@ "discriminatorValue": "template", "decorators": [], "baseModel": { - "$ref": "100" + "$ref": "122" }, "properties": [ { - "$id": "388", + "$id": "410", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message notification type is template.", "type": { - "$id": "389", + "$id": "411", "kind": "constant", "valueType": { - "$id": "390", + "$id": "412", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3115,37 +3323,37 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.TemplateNotificationContent.kind", "serializationOptions": { - "$id": "391", + "$id": "413", "json": { - "$id": "392", + "$id": "414", "name": "kind" } } }, { - "$id": "393", + "$id": "415", "kind": "property", "name": "template", "serializedName": "template", "doc": "The template object used to create templates.", "type": { - "$id": "394", + "$id": "416", "kind": "model", "name": "MessageTemplate", "namespace": "Azure.Communication.Messages", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplate", - "usage": "Input,Json", + "usage": "Input,Output,Json", "doc": "The template object used to create templates.", "decorators": [], "properties": [ { - "$id": "395", + "$id": "417", "kind": "property", "name": "name", "serializedName": "name", "doc": "Name of the template.", "type": { - "$id": "396", + "$id": "418", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3158,21 +3366,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplate.name", "serializationOptions": { - "$id": "397", + "$id": "419", "json": { - "$id": "398", + "$id": "420", "name": "name" } } }, { - "$id": "399", + "$id": "421", "kind": "property", "name": "language", "serializedName": "language", "doc": "The template's language, in the ISO 639 format, consist of a two-letter language code followed by an optional two-letter country code, e.g., 'en' or 'en_US'.", "type": { - "$id": "400", + "$id": "422", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3185,34 +3393,34 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplate.language", "serializationOptions": { - "$id": "401", + "$id": "423", "json": { - "$id": "402", + "$id": "424", "name": "language" } } }, { - "$id": "403", + "$id": "425", "kind": "property", "name": "values", "serializedName": "values", "doc": "The template values.", "type": { - "$id": "404", + "$id": "426", "kind": "array", "name": "ArrayMessageTemplateValue", "valueType": { - "$id": "405", + "$id": "427", "kind": "model", "name": "MessageTemplateValue", "namespace": "Azure.Communication.Messages", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateValue", - "usage": "Input,Json", + "usage": "Input,Output,Json", "doc": "The class describes a parameter of a template.", "decorators": [], "discriminatorProperty": { - "$id": "406", + "$id": "428", "kind": "property", "name": "kind", "serializedName": "kind", @@ -3227,22 +3435,22 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateValue.kind", "serializationOptions": { - "$id": "407", + "$id": "429", "json": { - "$id": "408", + "$id": "430", "name": "kind" } } }, "properties": [ { - "$id": "409", + "$id": "431", "kind": "property", "name": "name", "serializedName": "name", "doc": "Template binding reference name", "type": { - "$id": "410", + "$id": "432", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3255,44 +3463,44 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateValue.name", "serializationOptions": { - "$id": "411", + "$id": "433", "json": { - "$id": "412", + "$id": "434", "name": "name" } } }, { - "$ref": "406" + "$ref": "428" } ], "discriminatedSubtypes": { - "$id": "413", + "$id": "435", "text": { - "$id": "414", + "$id": "436", "kind": "model", "name": "MessageTemplateText", "namespace": "Azure.Communication.Messages", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateText", - "usage": "Input,Json", + "usage": "Input,Output,Json", "doc": "The message template's text value information.", "discriminatorValue": "text", "decorators": [], "baseModel": { - "$ref": "405" + "$ref": "427" }, "properties": [ { - "$id": "415", + "$id": "437", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message parameter type is text.", "type": { - "$id": "416", + "$id": "438", "kind": "constant", "valueType": { - "$id": "417", + "$id": "439", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3308,21 +3516,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateText.kind", "serializationOptions": { - "$id": "418", + "$id": "440", "json": { - "$id": "419", + "$id": "441", "name": "kind" } } }, { - "$id": "420", + "$id": "442", "kind": "property", "name": "text", "serializedName": "text", "doc": "The text value.", "type": { - "$id": "421", + "$id": "443", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3335,9 +3543,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateText.text", "serializationOptions": { - "$id": "422", + "$id": "444", "json": { - "$id": "423", + "$id": "445", "name": "text" } } @@ -3345,30 +3553,30 @@ ] }, "image": { - "$id": "424", + "$id": "446", "kind": "model", "name": "MessageTemplateImage", "namespace": "Azure.Communication.Messages", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateImage", - "usage": "Input,Json", + "usage": "Input,Output,Json", "doc": "The message template's image value information.", "discriminatorValue": "image", "decorators": [], "baseModel": { - "$ref": "405" + "$ref": "427" }, "properties": [ { - "$id": "425", + "$id": "447", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message parameter type is image.", "type": { - "$id": "426", + "$id": "448", "kind": "constant", "valueType": { - "$id": "427", + "$id": "449", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3384,21 +3592,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateImage.kind", "serializationOptions": { - "$id": "428", + "$id": "450", "json": { - "$id": "429", + "$id": "451", "name": "kind" } } }, { - "$id": "430", + "$id": "452", "kind": "property", "name": "uri", "serializedName": "url", "doc": "The (public) URL of the media.", "type": { - "$id": "431", + "$id": "453", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -3411,21 +3619,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateImage.url", "serializationOptions": { - "$id": "432", + "$id": "454", "json": { - "$id": "433", + "$id": "455", "name": "url" } } }, { - "$id": "434", + "$id": "456", "kind": "property", "name": "caption", "serializedName": "caption", "doc": "The [optional] caption of the media object.", "type": { - "$id": "435", + "$id": "457", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3438,21 +3646,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateImage.caption", "serializationOptions": { - "$id": "436", + "$id": "458", "json": { - "$id": "437", + "$id": "459", "name": "caption" } } }, { - "$id": "438", + "$id": "460", "kind": "property", "name": "fileName", "serializedName": "fileName", "doc": "The [optional] filename of the media file.", "type": { - "$id": "439", + "$id": "461", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3465,9 +3673,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateImage.fileName", "serializationOptions": { - "$id": "440", + "$id": "462", "json": { - "$id": "441", + "$id": "463", "name": "fileName" } } @@ -3475,30 +3683,30 @@ ] }, "document": { - "$id": "442", + "$id": "464", "kind": "model", "name": "MessageTemplateDocument", "namespace": "Azure.Communication.Messages", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateDocument", - "usage": "Input,Json", + "usage": "Input,Output,Json", "doc": "The message template's document value information.", "discriminatorValue": "document", "decorators": [], "baseModel": { - "$ref": "405" + "$ref": "427" }, "properties": [ { - "$id": "443", + "$id": "465", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message parameter type is document.", "type": { - "$id": "444", + "$id": "466", "kind": "constant", "valueType": { - "$id": "445", + "$id": "467", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3514,21 +3722,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateDocument.kind", "serializationOptions": { - "$id": "446", + "$id": "468", "json": { - "$id": "447", + "$id": "469", "name": "kind" } } }, { - "$id": "448", + "$id": "470", "kind": "property", "name": "uri", "serializedName": "url", "doc": "The (public) URL of the media.", "type": { - "$id": "449", + "$id": "471", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -3541,21 +3749,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateDocument.url", "serializationOptions": { - "$id": "450", + "$id": "472", "json": { - "$id": "451", + "$id": "473", "name": "url" } } }, { - "$id": "452", + "$id": "474", "kind": "property", "name": "caption", "serializedName": "caption", "doc": "The [optional] caption of the media object.", "type": { - "$id": "453", + "$id": "475", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3568,21 +3776,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateDocument.caption", "serializationOptions": { - "$id": "454", + "$id": "476", "json": { - "$id": "455", + "$id": "477", "name": "caption" } } }, { - "$id": "456", + "$id": "478", "kind": "property", "name": "fileName", "serializedName": "fileName", "doc": "The [optional] filename of the media file.", "type": { - "$id": "457", + "$id": "479", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3595,9 +3803,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateDocument.fileName", "serializationOptions": { - "$id": "458", + "$id": "480", "json": { - "$id": "459", + "$id": "481", "name": "fileName" } } @@ -3605,30 +3813,30 @@ ] }, "video": { - "$id": "460", + "$id": "482", "kind": "model", "name": "MessageTemplateVideo", "namespace": "Azure.Communication.Messages", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateVideo", - "usage": "Input,Json", + "usage": "Input,Output,Json", "doc": "The message template's video value information.", "discriminatorValue": "video", "decorators": [], "baseModel": { - "$ref": "405" + "$ref": "427" }, "properties": [ { - "$id": "461", + "$id": "483", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message parameter type is video.", "type": { - "$id": "462", + "$id": "484", "kind": "constant", "valueType": { - "$id": "463", + "$id": "485", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3644,21 +3852,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateVideo.kind", "serializationOptions": { - "$id": "464", + "$id": "486", "json": { - "$id": "465", + "$id": "487", "name": "kind" } } }, { - "$id": "466", + "$id": "488", "kind": "property", "name": "uri", "serializedName": "url", "doc": "The (public) URL of the media.", "type": { - "$id": "467", + "$id": "489", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url", @@ -3671,21 +3879,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateVideo.url", "serializationOptions": { - "$id": "468", + "$id": "490", "json": { - "$id": "469", + "$id": "491", "name": "url" } } }, { - "$id": "470", + "$id": "492", "kind": "property", "name": "caption", "serializedName": "caption", "doc": "The [optional] caption of the media object.", "type": { - "$id": "471", + "$id": "493", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3698,21 +3906,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateVideo.caption", "serializationOptions": { - "$id": "472", + "$id": "494", "json": { - "$id": "473", + "$id": "495", "name": "caption" } } }, { - "$id": "474", + "$id": "496", "kind": "property", "name": "fileName", "serializedName": "fileName", "doc": "The [optional] filename of the media file.", "type": { - "$id": "475", + "$id": "497", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3725,9 +3933,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateVideo.fileName", "serializationOptions": { - "$id": "476", + "$id": "498", "json": { - "$id": "477", + "$id": "499", "name": "fileName" } } @@ -3735,30 +3943,30 @@ ] }, "location": { - "$id": "478", + "$id": "500", "kind": "model", "name": "MessageTemplateLocation", "namespace": "Azure.Communication.Messages", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateLocation", - "usage": "Input,Json", + "usage": "Input,Output,Json", "doc": "The message template's location value information.", "discriminatorValue": "location", "decorators": [], "baseModel": { - "$ref": "405" + "$ref": "427" }, "properties": [ { - "$id": "479", + "$id": "501", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message parameter type is location.", "type": { - "$id": "480", + "$id": "502", "kind": "constant", "valueType": { - "$id": "481", + "$id": "503", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3774,21 +3982,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateLocation.kind", "serializationOptions": { - "$id": "482", + "$id": "504", "json": { - "$id": "483", + "$id": "505", "name": "kind" } } }, { - "$id": "484", + "$id": "506", "kind": "property", "name": "locationName", "serializedName": "locationName", "doc": "The [Optional] name of the location.", "type": { - "$id": "485", + "$id": "507", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3801,21 +4009,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateLocation.locationName", "serializationOptions": { - "$id": "486", + "$id": "508", "json": { - "$id": "487", + "$id": "509", "name": "locationName" } } }, { - "$id": "488", + "$id": "510", "kind": "property", "name": "address", "serializedName": "address", "doc": "The [Optional] address of the location.", "type": { - "$id": "489", + "$id": "511", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3828,21 +4036,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateLocation.address", "serializationOptions": { - "$id": "490", + "$id": "512", "json": { - "$id": "491", + "$id": "513", "name": "address" } } }, { - "$id": "492", + "$id": "514", "kind": "property", "name": "latitude", "serializedName": "latitude", "doc": "The latitude of the location.", "type": { - "$id": "493", + "$id": "515", "kind": "float64", "name": "float64", "crossLanguageDefinitionId": "TypeSpec.float64", @@ -3855,21 +4063,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateLocation.latitude", "serializationOptions": { - "$id": "494", + "$id": "516", "json": { - "$id": "495", + "$id": "517", "name": "latitude" } } }, { - "$id": "496", + "$id": "518", "kind": "property", "name": "longitude", "serializedName": "longitude", "doc": "The longitude of the location.", "type": { - "$id": "497", + "$id": "519", "kind": "float64", "name": "float64", "crossLanguageDefinitionId": "TypeSpec.float64", @@ -3882,9 +4090,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateLocation.longitude", "serializationOptions": { - "$id": "498", + "$id": "520", "json": { - "$id": "499", + "$id": "521", "name": "longitude" } } @@ -3892,30 +4100,30 @@ ] }, "quickAction": { - "$id": "500", + "$id": "522", "kind": "model", "name": "MessageTemplateQuickAction", "namespace": "Azure.Communication.Messages", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateQuickAction", - "usage": "Input,Json", + "usage": "Input,Output,Json", "doc": "The message template's quick action value information.", "discriminatorValue": "quickAction", "decorators": [], "baseModel": { - "$ref": "405" + "$ref": "427" }, "properties": [ { - "$id": "501", + "$id": "523", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message parameter type is quick action.", "type": { - "$id": "502", + "$id": "524", "kind": "constant", "valueType": { - "$id": "503", + "$id": "525", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3931,21 +4139,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateQuickAction.kind", "serializationOptions": { - "$id": "504", + "$id": "526", "json": { - "$id": "505", + "$id": "527", "name": "kind" } } }, { - "$id": "506", + "$id": "528", "kind": "property", "name": "text", "serializedName": "text", "doc": "The [Optional] quick action text", "type": { - "$id": "507", + "$id": "529", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3958,21 +4166,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateQuickAction.text", "serializationOptions": { - "$id": "508", + "$id": "530", "json": { - "$id": "509", + "$id": "531", "name": "text" } } }, { - "$id": "510", + "$id": "532", "kind": "property", "name": "payload", "serializedName": "payload", "doc": "The [Optional] quick action payload", "type": { - "$id": "511", + "$id": "533", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -3985,9 +4193,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateQuickAction.payload", "serializationOptions": { - "$id": "512", + "$id": "534", "json": { - "$id": "513", + "$id": "535", "name": "payload" } } @@ -4006,30 +4214,30 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplate.values", "serializationOptions": { - "$id": "514", + "$id": "536", "json": { - "$id": "515", + "$id": "537", "name": "values" } } }, { - "$id": "516", + "$id": "538", "kind": "property", "name": "bindings", "serializedName": "bindings", "doc": "The binding object to link values to the template specific locations", "type": { - "$id": "517", + "$id": "539", "kind": "model", "name": "MessageTemplateBindings", "namespace": "Azure.Communication.Messages", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateBindings", - "usage": "Input,Json", + "usage": "Input,Output,Json", "doc": "The binding object to link values to the template specific locations", "decorators": [], "discriminatorProperty": { - "$id": "518", + "$id": "540", "kind": "property", "name": "kind", "serializedName": "kind", @@ -4044,45 +4252,45 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateBindings.kind", "serializationOptions": { - "$id": "519", + "$id": "541", "json": { - "$id": "520", + "$id": "542", "name": "kind" } } }, "properties": [ { - "$ref": "518" + "$ref": "540" } ], "discriminatedSubtypes": { - "$id": "521", + "$id": "543", "whatsApp": { - "$id": "522", + "$id": "544", "kind": "model", "name": "WhatsAppMessageTemplateBindings", "namespace": "Azure.Communication.Messages", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindings", - "usage": "Input,Json", + "usage": "Input,Output,Json", "doc": "The template bindings for WhatsApp", "discriminatorValue": "whatsApp", "decorators": [], "baseModel": { - "$ref": "517" + "$ref": "539" }, "properties": [ { - "$id": "523", + "$id": "545", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "MessageTemplateBindings is whatsApp", "type": { - "$id": "524", + "$id": "546", "kind": "constant", "valueType": { - "$id": "525", + "$id": "547", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4098,41 +4306,41 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindings.kind", "serializationOptions": { - "$id": "526", + "$id": "548", "json": { - "$id": "527", + "$id": "549", "name": "kind" } } }, { - "$id": "528", + "$id": "550", "kind": "property", "name": "header", "serializedName": "header", "doc": "The header template bindings", "type": { - "$id": "529", + "$id": "551", "kind": "array", "name": "ArrayWhatsAppMessageTemplateBindingsComponent", "valueType": { - "$id": "530", + "$id": "552", "kind": "model", "name": "WhatsAppMessageTemplateBindingsComponent", "namespace": "Azure.Communication.Messages", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindingsComponent", - "usage": "Input,Json", + "usage": "Input,Output,Json", "doc": "The template bindings component for WhatsApp", "decorators": [], "properties": [ { - "$id": "531", + "$id": "553", "kind": "property", "name": "refValue", "serializedName": "refValue", "doc": "The name of the referenced item in the template values.", "type": { - "$id": "532", + "$id": "554", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4145,9 +4353,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindingsComponent.refValue", "serializationOptions": { - "$id": "533", + "$id": "555", "json": { - "$id": "534", + "$id": "556", "name": "refValue" } } @@ -4164,25 +4372,25 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindings.header", "serializationOptions": { - "$id": "535", + "$id": "557", "json": { - "$id": "536", + "$id": "558", "name": "header" } } }, { - "$id": "537", + "$id": "559", "kind": "property", "name": "body", "serializedName": "body", "doc": "The body template bindings", "type": { - "$id": "538", + "$id": "560", "kind": "array", "name": "ArrayWhatsAppMessageTemplateBindingsComponent", "valueType": { - "$ref": "530" + "$ref": "552" }, "crossLanguageDefinitionId": "TypeSpec.Array", "decorators": [] @@ -4194,25 +4402,25 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindings.body", "serializationOptions": { - "$id": "539", + "$id": "561", "json": { - "$id": "540", + "$id": "562", "name": "body" } } }, { - "$id": "541", + "$id": "563", "kind": "property", "name": "footer", "serializedName": "footer", "doc": "The footer template bindings", "type": { - "$id": "542", + "$id": "564", "kind": "array", "name": "ArrayWhatsAppMessageTemplateBindingsComponent", "valueType": { - "$ref": "530" + "$ref": "552" }, "crossLanguageDefinitionId": "TypeSpec.Array", "decorators": [] @@ -4224,35 +4432,35 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindings.footer", "serializationOptions": { - "$id": "543", + "$id": "565", "json": { - "$id": "544", + "$id": "566", "name": "footer" } } }, { - "$id": "545", + "$id": "567", "kind": "property", "name": "buttons", "serializedName": "buttons", "doc": "The button template bindings", "type": { - "$id": "546", + "$id": "568", "kind": "array", "name": "ArrayWhatsAppMessageTemplateBindingsButton", "valueType": { - "$id": "547", + "$id": "569", "kind": "model", "name": "WhatsAppMessageTemplateBindingsButton", "namespace": "Azure.Communication.Messages", "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindingsButton", - "usage": "Input,Json", + "usage": "Input,Output,Json", "doc": "The template bindings component button for WhatsApp", "decorators": [], "properties": [ { - "$id": "548", + "$id": "570", "kind": "property", "name": "subType", "serializedName": "subType", @@ -4267,21 +4475,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindingsButton.subType", "serializationOptions": { - "$id": "549", + "$id": "571", "json": { - "$id": "550", + "$id": "572", "name": "subType" } } }, { - "$id": "551", + "$id": "573", "kind": "property", "name": "refValue", "serializedName": "refValue", "doc": "The name of the referenced item in the template values.", "type": { - "$id": "552", + "$id": "574", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4294,9 +4502,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindingsButton.refValue", "serializationOptions": { - "$id": "553", + "$id": "575", "json": { - "$id": "554", + "$id": "576", "name": "refValue" } } @@ -4313,9 +4521,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateBindings.buttons", "serializationOptions": { - "$id": "555", + "$id": "577", "json": { - "$id": "556", + "$id": "578", "name": "buttons" } } @@ -4331,9 +4539,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplate.bindings", "serializationOptions": { - "$id": "557", + "$id": "579", "json": { - "$id": "558", + "$id": "580", "name": "bindings" } } @@ -4347,9 +4555,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.TemplateNotificationContent.template", "serializationOptions": { - "$id": "559", + "$id": "581", "json": { - "$id": "560", + "$id": "582", "name": "template" } } @@ -4359,121 +4567,121 @@ } }, { - "$ref": "115" + "$ref": "137" }, { - "$ref": "125" + "$ref": "147" }, { - "$ref": "139" + "$ref": "161" }, { - "$ref": "153" + "$ref": "175" }, { - "$ref": "171" + "$ref": "193" }, { - "$ref": "185" + "$ref": "207" }, { - "$ref": "195" + "$ref": "217" }, { - "$ref": "209" + "$ref": "231" }, { - "$ref": "219" + "$ref": "241" }, { - "$ref": "226" + "$ref": "248" }, { - "$ref": "228" + "$ref": "250" }, { - "$ref": "233" + "$ref": "255" }, { - "$ref": "243" + "$ref": "265" }, { - "$ref": "253" + "$ref": "275" }, { - "$ref": "263" + "$ref": "285" }, { - "$ref": "273" + "$ref": "295" }, { - "$ref": "281" + "$ref": "303" }, { - "$ref": "292" + "$ref": "314" }, { - "$ref": "306" + "$ref": "328" }, { - "$ref": "318" + "$ref": "340" }, { - "$ref": "325" + "$ref": "347" }, { - "$ref": "351" + "$ref": "373" }, { - "$ref": "356" + "$ref": "378" }, { - "$ref": "365" + "$ref": "387" }, { - "$ref": "374" + "$ref": "396" }, { - "$ref": "387" + "$ref": "409" }, { - "$ref": "394" + "$ref": "416" }, { - "$ref": "405" + "$ref": "427" }, { - "$ref": "414" + "$ref": "436" }, { - "$ref": "424" + "$ref": "446" }, { - "$ref": "442" + "$ref": "464" }, { - "$ref": "460" + "$ref": "482" }, { - "$ref": "478" + "$ref": "500" }, { - "$ref": "500" + "$ref": "522" }, { - "$ref": "517" + "$ref": "539" }, { - "$ref": "522" + "$ref": "544" }, { - "$ref": "530" + "$ref": "552" }, { - "$ref": "547" + "$ref": "569" }, { - "$id": "561", + "$id": "583", "kind": "model", "name": "SendMessageResult", "namespace": "Azure.Communication.Messages", @@ -4483,17 +4691,17 @@ "decorators": [], "properties": [ { - "$id": "562", + "$id": "584", "kind": "property", "name": "receipts", "serializedName": "receipts", "doc": "Receipts of the send message operation.", "type": { - "$id": "563", + "$id": "585", "kind": "array", "name": "ArrayMessageReceipt", "valueType": { - "$id": "564", + "$id": "586", "kind": "model", "name": "MessageReceipt", "namespace": "Azure.Communication.Messages", @@ -4503,13 +4711,13 @@ "decorators": [], "properties": [ { - "$id": "565", + "$id": "587", "kind": "property", "name": "messageId", "serializedName": "messageId", "doc": "The message id.", "type": { - "$id": "566", + "$id": "588", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4522,21 +4730,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageReceipt.messageId", "serializationOptions": { - "$id": "567", + "$id": "589", "json": { - "$id": "568", + "$id": "590", "name": "messageId" } } }, { - "$id": "569", + "$id": "591", "kind": "property", "name": "to", "serializedName": "to", "doc": "The native external platform user identifier of the recipient.", "type": { - "$id": "570", + "$id": "592", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4549,9 +4757,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageReceipt.to", "serializationOptions": { - "$id": "571", + "$id": "593", "json": { - "$id": "572", + "$id": "594", "name": "to" } } @@ -4568,9 +4776,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.SendMessageResult.receipts", "serializationOptions": { - "$id": "573", + "$id": "595", "json": { - "$id": "574", + "$id": "596", "name": "receipts" } } @@ -4578,10 +4786,10 @@ ] }, { - "$ref": "564" + "$ref": "586" }, { - "$id": "575", + "$id": "597", "kind": "model", "name": "MessageTemplateItem", "namespace": "Azure.Communication.Messages", @@ -4590,13 +4798,13 @@ "doc": "The message template as returned from the service.", "decorators": [], "discriminatorProperty": { - "$id": "576", + "$id": "598", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "The type discriminator describing a template type.", "type": { - "$ref": "90" + "$ref": "92" }, "optional": false, "readOnly": false, @@ -4605,22 +4813,22 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateItem.kind", "serializationOptions": { - "$id": "577", + "$id": "599", "json": { - "$id": "578", + "$id": "600", "name": "kind" } } }, "properties": [ { - "$id": "579", + "$id": "601", "kind": "property", "name": "name", "serializedName": "name", "doc": "The template's name.", "type": { - "$id": "580", + "$id": "602", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4633,21 +4841,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateItem.name", "serializationOptions": { - "$id": "581", + "$id": "603", "json": { - "$id": "582", + "$id": "604", "name": "name" } } }, { - "$id": "583", + "$id": "605", "kind": "property", "name": "language", "serializedName": "language", "doc": "The template's language, in the ISO 639 format, consist of a two-letter language code followed by an optional two-letter country code, e.g., 'en' or 'en_US'.", "type": { - "$id": "584", + "$id": "606", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4660,21 +4868,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateItem.language", "serializationOptions": { - "$id": "585", + "$id": "607", "json": { - "$id": "586", + "$id": "608", "name": "language" } } }, { - "$id": "587", + "$id": "609", "kind": "property", "name": "status", "serializedName": "status", "doc": "The aggregated template status.", "type": { - "$ref": "80" + "$ref": "82" }, "optional": false, "readOnly": false, @@ -4683,21 +4891,21 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateItem.status", "serializationOptions": { - "$id": "588", + "$id": "610", "json": { - "$id": "589", + "$id": "611", "name": "status" } } }, { - "$ref": "576" + "$ref": "598" } ], "discriminatedSubtypes": { - "$id": "590", + "$id": "612", "whatsApp": { - "$id": "591", + "$id": "613", "kind": "model", "name": "WhatsAppMessageTemplateItem", "namespace": "Azure.Communication.Messages", @@ -4707,17 +4915,17 @@ "discriminatorValue": "whatsApp", "decorators": [], "baseModel": { - "$ref": "575" + "$ref": "597" }, "properties": [ { - "$id": "592", + "$id": "614", "kind": "property", "name": "content", "serializedName": "content", "doc": "WhatsApp platform's template content. This is the payload returned from WhatsApp API.", "type": { - "$id": "593", + "$id": "615", "kind": "unknown", "name": "unknown", "crossLanguageDefinitionId": "", @@ -4730,24 +4938,24 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateItem.content", "serializationOptions": { - "$id": "594", + "$id": "616", "json": { - "$id": "595", + "$id": "617", "name": "content" } } }, { - "$id": "596", + "$id": "618", "kind": "property", "name": "kind", "serializedName": "kind", "doc": "Message template response type is whatsApp.", "type": { - "$id": "597", + "$id": "619", "kind": "constant", "valueType": { - "$id": "598", + "$id": "620", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4763,9 +4971,9 @@ "decorators": [], "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppMessageTemplateItem.kind", "serializationOptions": { - "$id": "599", + "$id": "621", "json": { - "$id": "600", + "$id": "622", "name": "kind" } } @@ -4775,66 +4983,90 @@ } }, { - "$ref": "591" + "$ref": "613" }, { - "$id": "601", + "$id": "623", "kind": "model", - "name": "PagedMessageTemplateItem", + "name": "CommunicationConversation", "namespace": "Azure.Communication.Messages", - "crossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage", - "usage": "Output,Json", - "doc": "Paged collection of MessageTemplateItem items", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.Conversation", + "usage": "Input,Output,Json", + "doc": "A conversation.", "decorators": [], "properties": [ { - "$id": "602", + "$id": "624", "kind": "property", - "name": "value", - "serializedName": "value", - "doc": "The MessageTemplateItem items on this page", + "name": "id", + "serializedName": "id", + "doc": "The conversation ID.", "type": { - "$id": "603", - "kind": "array", - "name": "ArrayMessageTemplateItem", - "valueType": { - "$ref": "575" - }, - "crossLanguageDefinitionId": "TypeSpec.Array", + "$id": "625", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.Conversation.id", + "serializationOptions": { + "$id": "626", + "json": { + "$id": "627", + "name": "id" + } + } + }, + { + "$id": "628", + "kind": "property", + "name": "topic", + "serializedName": "topic", + "doc": "The conversation topic.", + "type": { + "$id": "629", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, "readOnly": false, "discriminator": false, "flatten": false, "decorators": [], - "crossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage.value", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.Conversation.topic", "serializationOptions": { - "$id": "604", + "$id": "630", "json": { - "$id": "605", - "name": "value" + "$id": "631", + "name": "topic" } } }, { - "$id": "606", + "$id": "632", "kind": "property", - "name": "nextLink", - "serializedName": "nextLink", - "doc": "The link to the next page of items", + "name": "deliveryChannelIds", + "serializedName": "deliveryChannelIds", + "doc": "List of delivery channel IDs.", "type": { - "$id": "607", - "kind": "url", - "name": "ResourceLocation", - "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", - "baseType": { - "$id": "608", - "kind": "url", - "name": "url", - "crossLanguageDefinitionId": "TypeSpec.url", + "$id": "633", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "634", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, + "crossLanguageDefinitionId": "TypeSpec.Array", "decorators": [] }, "optional": true, @@ -4842,71 +5074,6437 @@ "discriminator": false, "flatten": false, "decorators": [], - "crossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage.nextLink", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.Conversation.deliveryChannelIds", "serializationOptions": { - "$id": "609", + "$id": "635", "json": { - "$id": "610", - "name": "nextLink" + "$id": "636", + "name": "deliveryChannelIds" } } - } - ] - } - ], - "clients": [ - { - "$id": "611", - "kind": "client", - "name": "NotificationMessagesClient", - "namespace": "Azure.Communication.Messages", - "operations": [ + }, { - "$id": "612", - "name": "send", - "resourceName": "NotificationMessagesClient", - "doc": "Sends a notification message from Business to User.", - "accessibility": "public", - "parameters": [ - { - "$id": "613", - "name": "apiVersion", - "nameInRequest": "api-version", - "doc": "The API version to use for this operation.", - "type": { - "$id": "614", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", - "decorators": [] - }, - "location": "Query", - "isApiVersion": true, - "isContentType": false, - "isEndpoint": false, - "explode": false, - "isRequired": true, - "kind": "Client", - "defaultValue": { - "$id": "615", + "$id": "637", + "kind": "property", + "name": "outboundDeliveryStrategy", + "serializedName": "outboundDeliveryStrategy", + "doc": "Outbound delivery strategy for the conversation.", + "type": { + "$ref": "96" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.Conversation.outboundDeliveryStrategy", + "serializationOptions": { + "$id": "638", + "json": { + "$id": "639", + "name": "outboundDeliveryStrategy" + } + } + }, + { + "$id": "640", + "kind": "property", + "name": "participants", + "serializedName": "participants", + "doc": "List of participants involved in the conversation.", + "type": { + "$id": "641", + "kind": "array", + "name": "ArrayConversationParticipant", + "valueType": { + "$id": "642", + "kind": "model", + "name": "ConversationParticipant", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationParticipant", + "usage": "Input,Output,Json", + "doc": "Advanced Messaging conversation participant.", + "decorators": [], + "discriminatorProperty": { + "$id": "643", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "The type discriminator describing a participant type.", "type": { - "$id": "616", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string" + "$ref": "102" }, - "value": "2025-01-15-preview" + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationParticipant.kind", + "serializationOptions": { + "$id": "644", + "json": { + "$id": "645", + "name": "kind" + } + } }, - "decorators": [], - "skipUrlEncoding": false + "properties": [ + { + "$id": "646", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "Participant Identifier.", + "type": { + "$id": "647", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationParticipant.id", + "serializationOptions": { + "$id": "648", + "json": { + "$id": "649", + "name": "id" + } + } + }, + { + "$id": "650", + "kind": "property", + "name": "displayName", + "serializedName": "displayName", + "doc": "Participant display name.", + "type": { + "$id": "651", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationParticipant.displayName", + "serializationOptions": { + "$id": "652", + "json": { + "$id": "653", + "name": "displayName" + } + } + }, + { + "$ref": "643" + } + ], + "discriminatedSubtypes": { + "$id": "654", + "internal": { + "$id": "655", + "kind": "model", + "name": "InternalConversationParticipant", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.InternalConversationParticipant", + "usage": "Input,Output,Json", + "doc": "Internal conversation participant.", + "discriminatorValue": "internal", + "decorators": [], + "baseModel": { + "$ref": "642" + }, + "properties": [ + { + "$id": "656", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "Participant type is internal.", + "type": { + "$id": "657", + "kind": "constant", + "valueType": { + "$id": "658", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "internal", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.InternalConversationParticipant.kind", + "serializationOptions": { + "$id": "659", + "json": { + "$id": "660", + "name": "kind" + } + } + }, + { + "$id": "661", + "kind": "property", + "name": "contact", + "serializedName": "contact", + "doc": "The internal platform identifiers for the participant.", + "type": { + "$id": "662", + "kind": "model", + "name": "ConversationContact", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.Contact", + "usage": "Input,Output,Json", + "doc": "Details of an external platform contact.", + "decorators": [], + "discriminatorProperty": { + "$id": "663", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "Type of message platform (e.g., WhatsApp).", + "type": { + "$ref": "108" + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.Contact.kind", + "serializationOptions": { + "$id": "664", + "json": { + "$id": "665", + "name": "kind" + } + } + }, + "properties": [ + { + "$id": "666", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "External platform identifier.", + "type": { + "$id": "667", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.Contact.id", + "serializationOptions": { + "$id": "668", + "json": { + "$id": "669", + "name": "id" + } + } + }, + { + "$ref": "663" + } + ], + "discriminatedSubtypes": { + "$id": "670", + "communication": { + "$id": "671", + "kind": "model", + "name": "CommunicationContact", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.CommunicationContact", + "usage": "Input,Output,Json", + "doc": "Communication Contact.", + "discriminatorValue": "communication", + "decorators": [], + "baseModel": { + "$ref": "662" + }, + "properties": [ + { + "$id": "672", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "Contact type is communication.", + "type": { + "$id": "673", + "kind": "constant", + "valueType": { + "$id": "674", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "communication", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.CommunicationContact.kind", + "serializationOptions": { + "$id": "675", + "json": { + "$id": "676", + "name": "kind" + } + } + } + ] + }, + "bot": { + "$id": "677", + "kind": "model", + "name": "BotContact", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.BotContact", + "usage": "Input,Output,Json", + "doc": "Bot Contact.", + "discriminatorValue": "bot", + "decorators": [], + "baseModel": { + "$ref": "662" + }, + "properties": [ + { + "$id": "678", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "Contact type is bot.", + "type": { + "$id": "679", + "kind": "constant", + "valueType": { + "$id": "680", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "bot", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.BotContact.kind", + "serializationOptions": { + "$id": "681", + "json": { + "$id": "682", + "name": "kind" + } + } + }, + { + "$id": "683", + "kind": "property", + "name": "botAppId", + "serializedName": "botAppId", + "doc": "Bot App Id of the Bot Contact.", + "type": { + "$id": "684", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.BotContact.botAppId", + "serializationOptions": { + "$id": "685", + "json": { + "$id": "686", + "name": "botAppId" + } + } + } + ] + }, + "whatsApp": { + "$id": "687", + "kind": "model", + "name": "WhatsAppContact", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppContact", + "usage": "Input,Output,Json", + "doc": "WhatsApp Contact.", + "discriminatorValue": "whatsApp", + "decorators": [], + "baseModel": { + "$ref": "662" + }, + "properties": [ + { + "$id": "688", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "Contact type is whatsApp.", + "type": { + "$id": "689", + "kind": "constant", + "valueType": { + "$id": "690", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "whatsApp", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.WhatsAppContact.kind", + "serializationOptions": { + "$id": "691", + "json": { + "$id": "692", + "name": "kind" + } + } + } + ] + } + } + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.InternalConversationParticipant.contact", + "serializationOptions": { + "$id": "693", + "json": { + "$id": "694", + "name": "contact" + } + } + } + ] + }, + "external": { + "$id": "695", + "kind": "model", + "name": "ExternalConversationParticipant", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ExternalConversationParticipant", + "usage": "Input,Output,Json", + "doc": "External conversation participant.", + "discriminatorValue": "external", + "decorators": [], + "baseModel": { + "$ref": "642" + }, + "properties": [ + { + "$id": "696", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "Participant type is external.", + "type": { + "$id": "697", + "kind": "constant", + "valueType": { + "$id": "698", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "external", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ExternalConversationParticipant.kind", + "serializationOptions": { + "$id": "699", + "json": { + "$id": "700", + "name": "kind" + } + } + }, + { + "$id": "701", + "kind": "property", + "name": "contacts", + "serializedName": "contacts", + "doc": "List of external platform identifiers for the participant.", + "type": { + "$id": "702", + "kind": "array", + "name": "ArrayContact", + "valueType": { + "$ref": "662" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ExternalConversationParticipant.contacts", + "serializationOptions": { + "$id": "703", + "json": { + "$id": "704", + "name": "contacts" + } + } + } + ] + } + } + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.Conversation.participants", + "serializationOptions": { + "$id": "705", + "json": { + "$id": "706", + "name": "participants" + } + } + } + ] + }, + { + "$ref": "642" + }, + { + "$ref": "655" + }, + { + "$ref": "662" + }, + { + "$ref": "671" + }, + { + "$ref": "677" + }, + { + "$ref": "687" + }, + { + "$ref": "695" + }, + { + "$id": "707", + "kind": "model", + "name": "ConversationMessage", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.Message", + "usage": "Input,Json", + "doc": "Details of a message.", + "decorators": [], + "properties": [ + { + "$id": "708", + "kind": "property", + "name": "content", + "serializedName": "content", + "doc": "Content of the message.", + "type": { + "$id": "709", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.Message.content", + "serializationOptions": { + "$id": "710", + "json": { + "$id": "711", + "name": "content" + } + } + } + ] + }, + { + "$id": "712", + "kind": "model", + "name": "CreateConversationRequest1", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.createConversation.Request.anonymous", + "usage": "Spread,Json", + "decorators": [], + "properties": [ + { + "$id": "713", + "kind": "property", + "name": "conversation", + "serializedName": "conversation", + "doc": "The conversation details.", + "type": { + "$ref": "623" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "createConversation.Request.anonymous.conversation", + "serializationOptions": { + "$id": "714", + "json": { + "$id": "715", + "name": "conversation" + } + } + }, + { + "$id": "716", + "kind": "property", + "name": "initialMessage", + "serializedName": "initialMessage", + "doc": "An initial message within the conversation.", + "type": { + "$ref": "707" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "createConversation.Request.anonymous.initialMessage", + "serializationOptions": { + "$id": "717", + "json": { + "$id": "718", + "name": "initialMessage" + } + } + } + ] + }, + { + "$id": "719", + "kind": "model", + "name": "ConversationMessageItem", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationMessageItem", + "usage": "Output,Json", + "doc": "The conversation message as returned from the service.", + "decorators": [], + "properties": [ + { + "$id": "720", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "Message ID.", + "type": { + "$id": "721", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": true, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationMessageItem.id", + "serializationOptions": { + "$id": "722", + "json": { + "$id": "723", + "name": "id" + } + } + }, + { + "$id": "724", + "kind": "property", + "name": "sequenceId", + "serializedName": "sequenceId", + "doc": "Message sequence ID.", + "type": { + "$id": "725", + "kind": "int64", + "name": "int64", + "crossLanguageDefinitionId": "TypeSpec.int64", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationMessageItem.sequenceId", + "serializationOptions": { + "$id": "726", + "json": { + "$id": "727", + "name": "sequenceId" + } + } + }, + { + "$id": "728", + "kind": "property", + "name": "message", + "serializedName": "message", + "doc": "Payload of a threaded conversation message.", + "type": { + "$id": "729", + "kind": "model", + "name": "ConversationMessageContent", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationMessageContent", + "usage": "Input,Output,Json", + "doc": "Details of the conversation message content.", + "decorators": [], + "discriminatorProperty": { + "$id": "730", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "The type discriminator describing a message type.", + "type": { + "$ref": "2" + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationMessageContent.kind", + "serializationOptions": { + "$id": "731", + "json": { + "$id": "732", + "name": "kind" + } + } + }, + "properties": [ + { + "$ref": "730" + } + ], + "discriminatedSubtypes": { + "$id": "733", + "text": { + "$id": "734", + "kind": "model", + "name": "TextConversationMessageContent", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.TextConversationMessageContent", + "usage": "Input,Output,Json", + "doc": "A request to send a text conversation message.", + "discriminatorValue": "text", + "decorators": [], + "baseModel": { + "$ref": "729" + }, + "properties": [ + { + "$id": "735", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "Message notification type is text.", + "type": { + "$ref": "139" + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.TextConversationMessageContent.kind", + "serializationOptions": { + "$id": "736", + "json": { + "$id": "737", + "name": "kind" + } + } + }, + { + "$id": "738", + "kind": "property", + "name": "content", + "serializedName": "content", + "doc": "Message content.", + "type": { + "$id": "739", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.TextConversationMessageContent.content", + "serializationOptions": { + "$id": "740", + "json": { + "$id": "741", + "name": "content" + } + } + } + ] + }, + "image": { + "$id": "742", + "kind": "model", + "name": "ImageConversationMessageContent", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ImageConversationMessageContent", + "usage": "Input,Output,Json", + "doc": "A request to send an image conversation message.", + "discriminatorValue": "image", + "decorators": [], + "baseModel": { + "$ref": "729" + }, + "properties": [ + { + "$id": "743", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "Message notification type is image.", + "type": { + "$ref": "163" + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ImageConversationMessageContent.kind", + "serializationOptions": { + "$id": "744", + "json": { + "$id": "745", + "name": "kind" + } + } + }, + { + "$id": "746", + "kind": "property", + "name": "caption", + "serializedName": "caption", + "doc": "Optional text content.", + "type": { + "$id": "747", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ImageConversationMessageContent.caption", + "serializationOptions": { + "$id": "748", + "json": { + "$id": "749", + "name": "caption" + } + } + }, + { + "$id": "750", + "kind": "property", + "name": "mediaUri", + "serializedName": "mediaUri", + "doc": "A media url for the file. Required if the type is one of the supported media types, e.g. image", + "type": { + "$id": "751", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ImageConversationMessageContent.mediaUri", + "serializationOptions": { + "$id": "752", + "json": { + "$id": "753", + "name": "mediaUri" + } + } + } + ] + }, + "document": { + "$id": "754", + "kind": "model", + "name": "DocumentConversationMessageContent", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.DocumentConversationMessageContent", + "usage": "Input,Output,Json", + "doc": "A request to send a document conversation message.", + "discriminatorValue": "document", + "decorators": [], + "baseModel": { + "$ref": "729" + }, + "properties": [ + { + "$id": "755", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "Message notification type is document.", + "type": { + "$ref": "177" + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.DocumentConversationMessageContent.kind", + "serializationOptions": { + "$id": "756", + "json": { + "$id": "757", + "name": "kind" + } + } + }, + { + "$id": "758", + "kind": "property", + "name": "caption", + "serializedName": "caption", + "doc": "Optional text content.", + "type": { + "$id": "759", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.DocumentConversationMessageContent.caption", + "serializationOptions": { + "$id": "760", + "json": { + "$id": "761", + "name": "caption" + } + } + }, + { + "$id": "762", + "kind": "property", + "name": "fileName", + "serializedName": "fileName", + "doc": "Optional name for the file.", + "type": { + "$id": "763", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.DocumentConversationMessageContent.fileName", + "serializationOptions": { + "$id": "764", + "json": { + "$id": "765", + "name": "fileName" + } + } + }, + { + "$id": "766", + "kind": "property", + "name": "mediaUri", + "serializedName": "mediaUri", + "doc": "A media url for the file. Required if the type is one of the supported media types, e.g. image", + "type": { + "$id": "767", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.DocumentConversationMessageContent.mediaUri", + "serializationOptions": { + "$id": "768", + "json": { + "$id": "769", + "name": "mediaUri" + } + } + } + ] + }, + "video": { + "$id": "770", + "kind": "model", + "name": "VideoConversationMessageContent", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.VideoConversationMessageContent", + "usage": "Input,Output,Json", + "doc": "A request to send a video conversation message.", + "discriminatorValue": "video", + "decorators": [], + "baseModel": { + "$ref": "729" + }, + "properties": [ + { + "$id": "771", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "Message notification type is video.", + "type": { + "$ref": "195" + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.VideoConversationMessageContent.kind", + "serializationOptions": { + "$id": "772", + "json": { + "$id": "773", + "name": "kind" + } + } + }, + { + "$id": "774", + "kind": "property", + "name": "caption", + "serializedName": "caption", + "doc": "Optional text content.", + "type": { + "$id": "775", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.VideoConversationMessageContent.caption", + "serializationOptions": { + "$id": "776", + "json": { + "$id": "777", + "name": "caption" + } + } + }, + { + "$id": "778", + "kind": "property", + "name": "mediaUri", + "serializedName": "mediaUri", + "doc": "A media url for the file. Required if the type is one of the supported media types, e.g. image", + "type": { + "$id": "779", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.VideoConversationMessageContent.mediaUri", + "serializationOptions": { + "$id": "780", + "json": { + "$id": "781", + "name": "mediaUri" + } + } + } + ] + }, + "audio": { + "$id": "782", + "kind": "model", + "name": "AudioConversationMessageContent", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.AudioConversationMessageContent", + "usage": "Input,Output,Json", + "doc": "A request to send an audio conversation message.", + "discriminatorValue": "audio", + "decorators": [], + "baseModel": { + "$ref": "729" + }, + "properties": [ + { + "$id": "783", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "Message notification type is audio.", + "type": { + "$ref": "209" + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.AudioConversationMessageContent.kind", + "serializationOptions": { + "$id": "784", + "json": { + "$id": "785", + "name": "kind" + } + } + }, + { + "$id": "786", + "kind": "property", + "name": "mediaUri", + "serializedName": "mediaUri", + "doc": "A media url for the file. Required if the type is one of the supported media types, e.g. image", + "type": { + "$id": "787", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.AudioConversationMessageContent.mediaUri", + "serializationOptions": { + "$id": "788", + "json": { + "$id": "789", + "name": "mediaUri" + } + } + } + ] + }, + "template": { + "$id": "790", + "kind": "model", + "name": "TemplateConversationMessageContent", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.TemplateConversationMessageContent", + "usage": "Input,Output,Json", + "doc": "A request to send a template conversation message.", + "discriminatorValue": "template", + "decorators": [], + "baseModel": { + "$ref": "729" + }, + "properties": [ + { + "$id": "791", + "kind": "property", + "name": "kind", + "serializedName": "kind", + "doc": "Message notification type is template.", + "type": { + "$ref": "411" + }, + "optional": false, + "readOnly": false, + "discriminator": true, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.TemplateConversationMessageContent.kind", + "serializationOptions": { + "$id": "792", + "json": { + "$id": "793", + "name": "kind" + } + } + }, + { + "$id": "794", + "kind": "property", + "name": "template", + "serializedName": "template", + "doc": "The template object used to create templates.", + "type": { + "$ref": "416" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.TemplateConversationMessageContent.template", + "serializationOptions": { + "$id": "795", + "json": { + "$id": "796", + "name": "template" + } + } + } + ] + } + } + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationMessageItem.message", + "serializationOptions": { + "$id": "797", + "json": { + "$id": "798", + "name": "message" + } + } + }, + { + "$id": "799", + "kind": "property", + "name": "senderDisplayName", + "serializedName": "senderDisplayName", + "doc": "The display name of the message sender.", + "type": { + "$id": "800", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationMessageItem.senderDisplayName", + "serializationOptions": { + "$id": "801", + "json": { + "$id": "802", + "name": "senderDisplayName" + } + } + }, + { + "$id": "803", + "kind": "property", + "name": "senderCommunicationIdentifier", + "serializedName": "senderCommunicationIdentifier", + "doc": "The communication identifier of the message sender.", + "type": { + "$id": "804", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationMessageItem.senderCommunicationIdentifier", + "serializationOptions": { + "$id": "805", + "json": { + "$id": "806", + "name": "senderCommunicationIdentifier" + } + } + }, + { + "$id": "807", + "kind": "property", + "name": "createdOn", + "serializedName": "createdOn", + "doc": "Timestamp when the message is sent.", + "type": { + "$id": "808", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc3339", + "wireType": { + "$id": "809", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationMessageItem.createdOn", + "serializationOptions": { + "$id": "810", + "json": { + "$id": "811", + "name": "createdOn" + } + } + } + ] + }, + { + "$ref": "729" + }, + { + "$ref": "734" + }, + { + "$ref": "742" + }, + { + "$ref": "754" + }, + { + "$ref": "770" + }, + { + "$ref": "782" + }, + { + "$ref": "790" + }, + { + "$id": "812", + "kind": "model", + "name": "AddParticipantsOptions", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.AddParticipantsOptions", + "usage": "Input,Json", + "doc": "Request payload for adding participants to a conversation.", + "decorators": [], + "properties": [ + { + "$id": "813", + "kind": "property", + "name": "participants", + "serializedName": "participants", + "doc": "List of participants to add.", + "type": { + "$id": "814", + "kind": "array", + "name": "ArrayConversationParticipant", + "valueType": { + "$ref": "642" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.AddParticipantsOptions.participants", + "serializationOptions": { + "$id": "815", + "json": { + "$id": "816", + "name": "participants" + } + } + } + ] + }, + { + "$id": "817", + "kind": "model", + "name": "AddParticipantsResult", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.AddParticipantsResult", + "usage": "Output,Json", + "doc": "Response for the add participants operation.", + "decorators": [], + "properties": [ + { + "$id": "818", + "kind": "property", + "name": "invalidParticipants", + "serializedName": "invalidParticipants", + "doc": "List of Ids with Errors if failed to be added", + "type": { + "$id": "819", + "kind": "array", + "name": "ArrayUpdateParticipantsResult", + "valueType": { + "$id": "820", + "kind": "model", + "name": "UpdateParticipantsResult", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.UpdateParticipantsResult", + "usage": "Output,Json", + "doc": "Response for the remove participants operation.", + "decorators": [], + "properties": [ + { + "$id": "821", + "kind": "property", + "name": "id", + "serializedName": "id", + "doc": "Participant User Id.", + "type": { + "$id": "822", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.UpdateParticipantsResult.id", + "serializationOptions": { + "$id": "823", + "json": { + "$id": "824", + "name": "id" + } + } + }, + { + "$id": "825", + "kind": "property", + "name": "error", + "serializedName": "error", + "doc": "Error of the participant operation.", + "type": { + "$id": "826", + "kind": "model", + "name": "Error", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Core.Foundations.Error", + "usage": "Output,Json,Exception", + "doc": "The error object.", + "decorators": [], + "properties": [ + { + "$id": "827", + "kind": "property", + "name": "code", + "serializedName": "code", + "doc": "One of a server-defined set of error codes.", + "type": { + "$id": "828", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.Error.code", + "serializationOptions": { + "$id": "829", + "json": { + "$id": "830", + "name": "code" + } + } + }, + { + "$id": "831", + "kind": "property", + "name": "message", + "serializedName": "message", + "doc": "A human-readable representation of the error.", + "type": { + "$id": "832", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.Error.message", + "serializationOptions": { + "$id": "833", + "json": { + "$id": "834", + "name": "message" + } + } + }, + { + "$id": "835", + "kind": "property", + "name": "target", + "serializedName": "target", + "doc": "The target of the error.", + "type": { + "$id": "836", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.Error.target", + "serializationOptions": { + "$id": "837", + "json": { + "$id": "838", + "name": "target" + } + } + }, + { + "$id": "839", + "kind": "property", + "name": "details", + "serializedName": "details", + "doc": "An array of details about specific errors that led to this reported error.", + "type": { + "$id": "840", + "kind": "array", + "name": "ArrayError", + "valueType": { + "$ref": "826" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.Error.details", + "serializationOptions": { + "$id": "841", + "json": { + "$id": "842", + "name": "details" + } + } + }, + { + "$id": "843", + "kind": "property", + "name": "innererror", + "serializedName": "innererror", + "doc": "An object containing more specific information than the current object about the error.", + "type": { + "$id": "844", + "kind": "model", + "name": "InnerError", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Core.Foundations.InnerError", + "usage": "Output,Json,Exception", + "doc": "An object containing more specific information about the error. As per Microsoft One API guidelines - https://github.com/Microsoft/api-guidelines/blob/vNext/Guidelines.md#7102-error-condition-responses.", + "decorators": [], + "properties": [ + { + "$id": "845", + "kind": "property", + "name": "code", + "serializedName": "code", + "doc": "One of a server-defined set of error codes.", + "type": { + "$id": "846", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.InnerError.code", + "serializationOptions": { + "$id": "847", + "json": { + "$id": "848", + "name": "code" + } + } + }, + { + "$id": "849", + "kind": "property", + "name": "innererror", + "serializedName": "innererror", + "doc": "Inner error.", + "type": { + "$ref": "844" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.InnerError.innererror", + "serializationOptions": { + "$id": "850", + "json": { + "$id": "851", + "name": "innererror" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.Error.innererror", + "serializationOptions": { + "$id": "852", + "json": { + "$id": "853", + "name": "innererror" + } + } + } + ] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.UpdateParticipantsResult.error", + "serializationOptions": { + "$id": "854", + "json": { + "$id": "855", + "name": "error" + } + } + } + ] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.AddParticipantsResult.invalidParticipants", + "serializationOptions": { + "$id": "856", + "json": { + "$id": "857", + "name": "invalidParticipants" + } + } + } + ] + }, + { + "$ref": "820" + }, + { + "$ref": "826" + }, + { + "$ref": "844" + }, + { + "$id": "858", + "kind": "model", + "name": "RemoveParticipantsOptions", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.RemoveParticipantsOptions", + "usage": "Input,Json", + "doc": "Request payload for removing participants from a conversation.", + "decorators": [], + "properties": [ + { + "$id": "859", + "kind": "property", + "name": "participantIds", + "serializedName": "participantIds", + "doc": "The participant IDs to remove.", + "type": { + "$id": "860", + "kind": "array", + "name": "Array", + "valueType": { + "$id": "861", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.RemoveParticipantsOptions.participantIds", + "serializationOptions": { + "$id": "862", + "json": { + "$id": "863", + "name": "participantIds" + } + } + } + ] + }, + { + "$id": "864", + "kind": "model", + "name": "RemoveParticipantsResult", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.RemoveParticipantsResult", + "usage": "Output,Json", + "doc": "Response for the remove participants operation.", + "decorators": [], + "properties": [ + { + "$id": "865", + "kind": "property", + "name": "invalidParticipants", + "serializedName": "invalidParticipants", + "doc": "List of Ids with Errors if failed to be added", + "type": { + "$id": "866", + "kind": "array", + "name": "ArrayUpdateParticipantsResult", + "valueType": { + "$ref": "820" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.RemoveParticipantsResult.invalidParticipants", + "serializationOptions": { + "$id": "867", + "json": { + "$id": "868", + "name": "invalidParticipants" + } + } + } + ] + }, + { + "$id": "869", + "kind": "model", + "name": "GetConversationThreadAnalysisResult", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.GetConversationThreadAnalysisResult", + "usage": "Output,Json", + "doc": "Result of the get conversation messages AI Analysis operation.", + "decorators": [], + "properties": [ + { + "$id": "870", + "kind": "property", + "name": "summary", + "serializedName": "summary", + "doc": "The AI summary of the conversation messages.", + "type": { + "$id": "871", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.GetConversationThreadAnalysisResult.summary", + "serializationOptions": { + "$id": "872", + "json": { + "$id": "873", + "name": "summary" + } + } + } + ] + }, + { + "$id": "874", + "kind": "model", + "name": "SendConversationMessageOptions", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.SendConversationMessageOptions", + "usage": "Input,Json", + "doc": "Request payload for sending a conversation message.", + "decorators": [], + "properties": [ + { + "$id": "875", + "kind": "property", + "name": "request", + "serializedName": "request", + "doc": "Details of a send conversation message request.", + "type": { + "$ref": "729" + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.SendConversationMessageOptions.request", + "serializationOptions": { + "$id": "876", + "json": { + "$id": "877", + "name": "request" + } + } + }, + { + "$id": "878", + "kind": "property", + "name": "outboundDeliveryStrategy", + "serializedName": "outboundDeliveryStrategy", + "doc": "The options of the outbound delivery strategy for messages sent by participants in a conversation.\r\nSupports internalOnly, allChannels.", + "type": { + "$ref": "96" + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.SendConversationMessageOptions.outboundDeliveryStrategy", + "serializationOptions": { + "$id": "879", + "json": { + "$id": "880", + "name": "outboundDeliveryStrategy" + } + } + } + ] + }, + { + "$id": "881", + "kind": "model", + "name": "SendConversationMessageResult", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.SendConversationMessageResult", + "usage": "Output,Json", + "doc": "Result of the send conversation message operation.", + "decorators": [], + "properties": [ + { + "$id": "882", + "kind": "property", + "name": "messageId", + "serializedName": "messageId", + "doc": "A server-generated Advanced Messaging conversation message id.", + "type": { + "$id": "883", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.SendConversationMessageResult.messageId", + "serializationOptions": { + "$id": "884", + "json": { + "$id": "885", + "name": "messageId" + } + } + } + ] + }, + { + "$id": "886", + "kind": "model", + "name": "PagedMessageTemplateItem", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage", + "usage": "Output,Json", + "doc": "Paged collection of MessageTemplateItem items", + "decorators": [], + "properties": [ + { + "$id": "887", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The MessageTemplateItem items on this page", + "type": { + "$id": "888", + "kind": "array", + "name": "ArrayMessageTemplateItem", + "valueType": { + "$ref": "597" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage.value", + "serializationOptions": { + "$id": "889", + "json": { + "$id": "890", + "name": "value" + } + } + }, + { + "$id": "891", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "892", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "893", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage.nextLink", + "serializationOptions": { + "$id": "894", + "json": { + "$id": "895", + "name": "nextLink" + } + } + } + ] + }, + { + "$id": "896", + "kind": "model", + "name": "PagedConversation", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage", + "usage": "Output,Json", + "doc": "Paged collection of Conversation items", + "decorators": [], + "properties": [ + { + "$id": "897", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The Conversation items on this page", + "type": { + "$id": "898", + "kind": "array", + "name": "ArrayConversation", + "valueType": { + "$ref": "623" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage.value", + "serializationOptions": { + "$id": "899", + "json": { + "$id": "900", + "name": "value" + } + } + }, + { + "$id": "901", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "902", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "903", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage.nextLink", + "serializationOptions": { + "$id": "904", + "json": { + "$id": "905", + "name": "nextLink" + } + } + } + ] + }, + { + "$id": "906", + "kind": "model", + "name": "PagedConversationMessageItem", + "namespace": "Azure.Communication.Messages", + "crossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage", + "usage": "Output,Json", + "doc": "Paged collection of ConversationMessageItem items", + "decorators": [], + "properties": [ + { + "$id": "907", + "kind": "property", + "name": "value", + "serializedName": "value", + "doc": "The ConversationMessageItem items on this page", + "type": { + "$id": "908", + "kind": "array", + "name": "ArrayConversationMessageItem", + "valueType": { + "$ref": "719" + }, + "crossLanguageDefinitionId": "TypeSpec.Array", + "decorators": [] + }, + "optional": false, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage.value", + "serializationOptions": { + "$id": "909", + "json": { + "$id": "910", + "name": "value" + } + } + }, + { + "$id": "911", + "kind": "property", + "name": "nextLink", + "serializedName": "nextLink", + "doc": "The link to the next page of items", + "type": { + "$id": "912", + "kind": "url", + "name": "ResourceLocation", + "crossLanguageDefinitionId": "TypeSpec.Rest.ResourceLocation", + "baseType": { + "$id": "913", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url", + "decorators": [] + }, + "decorators": [] + }, + "optional": true, + "readOnly": false, + "discriminator": false, + "flatten": false, + "decorators": [], + "crossLanguageDefinitionId": "Azure.Core.Foundations.CustomPage.nextLink", + "serializationOptions": { + "$id": "914", + "json": { + "$id": "915", + "name": "nextLink" + } + } + } + ] + } + ], + "clients": [ + { + "$id": "916", + "kind": "client", + "name": "NotificationMessagesClient", + "namespace": "Azure.Communication.Messages", + "operations": [ + { + "$id": "917", + "name": "send", + "resourceName": "NotificationMessagesClient", + "doc": "Sends a notification message from Business to User.", + "accessibility": "public", + "parameters": [ + { + "$id": "918", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "919", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "920", + "type": { + "$id": "921", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "922", + "name": "repeatabilityRequestId", + "nameInRequest": "Repeatability-Request-ID", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "923", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "924", + "name": "repeatabilityFirstSent", + "nameInRequest": "Repeatability-First-Sent", + "doc": "Specifies the date and time at which the request was first created.", + "type": { + "$id": "925", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc7231", + "wireType": { + "$id": "926", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "927", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "928", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "929", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "930", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "931", + "kind": "constant", + "valueType": { + "$id": "932", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "933", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "934", + "kind": "constant", + "valueType": { + "$id": "935", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "936", + "name": "notificationContent", + "nameInRequest": "notificationContent", + "doc": "Details of the message to send.", + "type": { + "$ref": "122" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "937", + "statusCodes": [ + 202 + ], + "bodyType": { + "$ref": "583" + }, + "headers": [ + { + "$id": "938", + "name": "repeatabilityResult", + "nameInResponse": "Repeatability-Result", + "doc": "Indicates whether the repeatable request was accepted or rejected.", + "type": { + "$ref": "116" + } + }, + { + "$id": "939", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "940", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "941", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/messages/notifications:send", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.NotificationMessagesClient.send", + "decorators": [] + }, + { + "$id": "942", + "name": "downloadMediaInternal", + "resourceName": "MessageDataStream", + "doc": "Download the Media payload from a User to Business message.", + "accessibility": "internal", + "parameters": [ + { + "$id": "943", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "944", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "945", + "type": { + "$id": "946", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "947", + "name": "id", + "nameInRequest": "id", + "doc": "The stream ID.", + "type": { + "$id": "948", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "949", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "950", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "951", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "952", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "953", + "kind": "constant", + "valueType": { + "$id": "954", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/octet-stream", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "955", + "statusCodes": [ + 200 + ], + "bodyType": { + "$id": "956", + "kind": "bytes", + "name": "bytes", + "crossLanguageDefinitionId": "TypeSpec.bytes", + "decorators": [] + }, + "headers": [ + { + "$id": "957", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "958", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "959", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + }, + { + "$id": "960", + "name": "contentType", + "nameInResponse": "content-type", + "doc": "The stream content type.", + "type": { + "$id": "961", + "kind": "constant", + "valueType": { + "$id": "962", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/octet-stream", + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/octet-stream" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/messages/streams/{id}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "ClientForAcsMessages.NotificationMessagesClient.downloadMedia", + "decorators": [], + "examples": [ + { + "$id": "963", + "kind": "http", + "name": "Download media", + "description": "Download media", + "filePath": "2025-04-01-preview/Stream_GetMedia.json", + "parameters": [ + { + "$id": "964", + "parameter": { + "$ref": "943" + }, + "value": { + "$id": "965", + "kind": "string", + "type": { + "$ref": "944" + }, + "value": "2025-04-01-preview" + } + }, + { + "$id": "966", + "parameter": { + "$ref": "947" + }, + "value": { + "$id": "967", + "kind": "string", + "type": { + "$ref": "948" + }, + "value": "d19e68ec-bdd6-4a50-8dfb-cbb1642df6ab" + } + } + ], + "responses": [ + { + "$id": "968", + "response": { + "$ref": "955" + }, + "statusCode": 200, + "bodyValue": { + "$id": "969", + "kind": "string", + "type": { + "$ref": "956" + }, + "value": "" + } + } + ] + } + ] + } + ], + "parameters": [ + { + "$id": "970", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "The communication resource, for example https://my-resource.communication.azure.com", + "type": { + "$id": "971", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client" + } + ], + "decorators": [], + "crossLanguageDefinitionId": "ClientForAcsMessages.NotificationMessagesClient", + "apiVersions": [ + "2024-02-01", + "2024-08-30", + "2025-01-15-preview", + "2025-04-01-preview" + ] + }, + { + "$id": "972", + "kind": "client", + "name": "MessageTemplateClient", + "namespace": "Azure.Communication.Messages", + "operations": [ + { + "$id": "973", + "name": "getTemplates", + "resourceName": "MessageTemplateItem", + "doc": "List all templates for given Azure Communication Services channel", + "accessibility": "public", + "parameters": [ + { + "$id": "974", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "975", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "976", + "type": { + "$id": "977", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "978", + "name": "channelId", + "nameInRequest": "channelId", + "doc": "The registration ID of the channel.", + "type": { + "$id": "979", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "980", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "981", + "name": "maxPageSize", + "nameInRequest": "maxPageSize", + "doc": "Number of objects to return per page.", + "type": { + "$id": "982", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "983", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "984", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "985", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "986", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "987", + "kind": "constant", + "valueType": { + "$id": "988", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "989", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "886" + }, + "headers": [ + { + "$id": "990", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "991", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "992", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/messages/channels/{channelId}/templates", + "bufferResponse": true, + "paging": { + "$id": "993", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "994", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateClient.listTemplates", + "decorators": [] + } + ], + "parameters": [ + { + "$id": "995", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "The communication resource, for example https://my-resource.communication.azure.com", + "type": { + "$id": "996", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client" + } + ], + "decorators": [], + "crossLanguageDefinitionId": "ClientForAcsMessages.MessageTemplateClient", + "apiVersions": [ + "2024-02-01", + "2024-08-30", + "2025-01-15-preview", + "2025-04-01-preview" + ] + }, + { + "$id": "997", + "kind": "client", + "name": "ConversationAdministrationClient", + "namespace": "Azure.Communication.Messages", + "operations": [ + { + "$id": "998", + "name": "createConversation", + "resourceName": "Conversation", + "doc": "Creates a new conversation. This is only for create operation.", + "accessibility": "public", + "parameters": [ + { + "$id": "999", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1000", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1001", + "type": { + "$id": "1002", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1003", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1004", + "kind": "constant", + "valueType": { + "$id": "1005", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1006", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1007", + "kind": "constant", + "valueType": { + "$id": "1008", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1009", + "name": "createConversationRequest1", + "nameInRequest": "createConversationRequest1", + "type": { + "$ref": "712" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Spread", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1010", + "statusCodes": [ + 201 + ], + "bodyType": { + "$ref": "623" + }, + "headers": [], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/messages/conversations", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationAdministrationClient.createConversation", + "decorators": [] + }, + { + "$id": "1011", + "name": "getConversation", + "resourceName": "Conversation", + "doc": "Gets the details of a specific conversation.", + "accessibility": "public", + "parameters": [ + { + "$id": "1012", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1013", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1014", + "type": { + "$id": "1015", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1016", + "name": "conversationId", + "nameInRequest": "conversationId", + "doc": "The conversation ID.", + "type": { + "$id": "1017", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1018", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1019", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1020", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1021", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1022", + "kind": "constant", + "valueType": { + "$id": "1023", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1024", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "623" + }, + "headers": [ + { + "$id": "1025", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1026", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1027", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/messages/conversations/{conversationId}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationAdministrationClient.getConversation", + "decorators": [] + }, + { + "$id": "1028", + "name": "deleteConversation", + "resourceName": "Conversation", + "doc": "Deletes a specific conversation.", + "accessibility": "public", + "parameters": [ + { + "$id": "1029", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1030", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1031", + "type": { + "$id": "1032", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1033", + "name": "conversationId", + "nameInRequest": "conversationId", + "doc": "The conversation ID.", + "type": { + "$id": "1034", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1035", + "name": "repeatabilityRequestId", + "nameInRequest": "Repeatability-Request-ID", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1036", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1037", + "name": "repeatabilityFirstSent", + "nameInRequest": "Repeatability-First-Sent", + "doc": "Specifies the date and time at which the request was first created.", + "type": { + "$id": "1038", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc7231", + "wireType": { + "$id": "1039", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1040", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1041", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1042", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1043", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1044", + "kind": "constant", + "valueType": { + "$id": "1045", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1046", + "statusCodes": [ + 204 + ], + "headers": [ + { + "$id": "1047", + "name": "repeatabilityResult", + "nameInResponse": "Repeatability-Result", + "doc": "Indicates whether the repeatable request was accepted or rejected.", + "type": { + "$ref": "116" + } + }, + { + "$id": "1048", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1049", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1050", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false + } + ], + "httpMethod": "DELETE", + "uri": "{endpoint}", + "path": "/messages/conversations/{conversationId}", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationAdministrationClient.deleteConversation", + "decorators": [] + }, + { + "$id": "1051", + "name": "terminateConversation", + "resourceName": "ConversationAdministrationClient", + "doc": "Terminates a specific conversation.", + "accessibility": "public", + "parameters": [ + { + "$id": "1052", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1053", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1054", + "type": { + "$id": "1055", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1056", + "name": "conversationId", + "nameInRequest": "conversationId", + "doc": "The conversation ID.", + "type": { + "$id": "1057", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1058", + "name": "repeatabilityRequestId", + "nameInRequest": "Repeatability-Request-ID", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1059", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1060", + "name": "repeatabilityFirstSent", + "nameInRequest": "Repeatability-First-Sent", + "doc": "Specifies the date and time at which the request was first created.", + "type": { + "$id": "1061", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc7231", + "wireType": { + "$id": "1062", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1063", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1064", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1065", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1066", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1067", + "kind": "constant", + "valueType": { + "$id": "1068", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1069", + "statusCodes": [ + 200 + ], + "headers": [ + { + "$id": "1070", + "name": "repeatabilityResult", + "nameInResponse": "Repeatability-Result", + "doc": "Indicates whether the repeatable request was accepted or rejected.", + "type": { + "$ref": "116" + } + }, + { + "$id": "1071", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1072", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1073", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/messages/conversations/{conversationId}:terminate", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationAdministrationClient.terminateConversation", + "decorators": [] + }, + { + "$id": "1074", + "name": "listConversations", + "resourceName": "Conversation", + "doc": "Retrieves list of conversations.", + "accessibility": "public", + "parameters": [ + { + "$id": "1075", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1076", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1077", + "type": { + "$id": "1078", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1079", + "name": "maxPageSize", + "nameInRequest": "maxPageSize", + "doc": "Number of objects to return per page.", + "type": { + "$id": "1080", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1081", + "name": "participantId", + "nameInRequest": "participantId", + "doc": "The participant user ID", + "type": { + "$id": "1082", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1083", + "name": "channelId", + "nameInRequest": "channelId", + "doc": "The id of channel", + "type": { + "$id": "1084", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1085", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1086", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1087", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1088", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1089", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1090", + "kind": "constant", + "valueType": { + "$id": "1091", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1092", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "896" + }, + "headers": [ + { + "$id": "1093", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1094", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1095", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/messages/conversations", + "bufferResponse": true, + "paging": { + "$id": "1096", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "1097", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "ClientForAcsMessages.ConversationAdministrationClient.listConversations", + "decorators": [], + "examples": [ + { + "$id": "1098", + "kind": "http", + "name": "Retrieves list of conversations", + "description": "Retrieves list of conversations", + "filePath": "2025-04-01-preview/ConversationThread_ListConversations.json", + "parameters": [ + { + "$id": "1099", + "parameter": { + "$ref": "1075" + }, + "value": { + "$id": "1100", + "kind": "string", + "type": { + "$ref": "1076" + }, + "value": "2025-04-01-preview" + } + }, + { + "$id": "1101", + "parameter": { + "$ref": "1079" + }, + "value": { + "$id": "1102", + "kind": "number", + "type": { + "$ref": "1080" + }, + "value": 25 + } + }, + { + "$id": "1103", + "parameter": { + "$ref": "1083" + }, + "value": { + "$id": "1104", + "kind": "string", + "type": { + "$ref": "1084" + }, + "value": "0f0eb78e-a576-1dfc-b414-0f0756de3338" + } + } + ], + "responses": [ + { + "$id": "1105", + "response": { + "$ref": "1092" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1106", + "kind": "model", + "type": { + "$ref": "896" + }, + "value": { + "$id": "1107", + "value": { + "$id": "1108", + "kind": "array", + "type": { + "$ref": "898" + }, + "value": [ + { + "$id": "1109", + "kind": "model", + "type": { + "$ref": "623" + }, + "value": { + "$id": "1110", + "id": { + "$id": "1111", + "kind": "string", + "type": { + "$ref": "625" + }, + "value": "19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2" + }, + "topic": { + "$id": "1112", + "kind": "string", + "type": { + "$ref": "629" + }, + "value": "Test" + }, + "deliveryChannelIds": { + "$id": "1113", + "kind": "array", + "type": { + "$ref": "633" + }, + "value": [ + { + "$id": "1114", + "kind": "string", + "type": { + "$ref": "634" + }, + "value": "0f0eb78e-a576-1dfc-b414-0f0756de3338" + } + ] + }, + "outboundDeliveryStrategy": { + "$id": "1115", + "kind": "string", + "type": { + "$ref": "96" + }, + "value": "allParticipants" + }, + "participants": { + "$id": "1116", + "kind": "array", + "type": { + "$ref": "641" + }, + "value": [ + { + "$id": "1117", + "kind": "model", + "type": { + "$ref": "695" + }, + "value": { + "$id": "1118", + "id": { + "$id": "1119", + "kind": "string", + "type": { + "$ref": "647" + }, + "value": "8:acs:uuid2" + }, + "displayName": { + "$id": "1120", + "kind": "string", + "type": { + "$ref": "651" + }, + "value": "Customer" + }, + "kind": { + "$id": "1121", + "kind": "string", + "type": { + "$ref": "697" + }, + "value": "external" + }, + "contacts": { + "$id": "1122", + "kind": "array", + "type": { + "$ref": "702" + }, + "value": [ + { + "$id": "1123", + "kind": "model", + "type": { + "$ref": "687" + }, + "value": { + "$id": "1124", + "id": { + "$id": "1125", + "kind": "string", + "type": { + "$ref": "667" + }, + "value": "12345678901" + }, + "kind": { + "$id": "1126", + "kind": "string", + "type": { + "$ref": "689" + }, + "value": "whatsApp" + } + } + }, + { + "$id": "1127", + "kind": "model", + "type": { + "$ref": "671" + }, + "value": { + "$id": "1128", + "id": { + "$id": "1129", + "kind": "string", + "type": { + "$ref": "667" + }, + "value": "8:acs:uuid2" + }, + "kind": { + "$id": "1130", + "kind": "string", + "type": { + "$ref": "673" + }, + "value": "communication" + } + } + } + ] + } + } + }, + { + "$id": "1131", + "kind": "model", + "type": { + "$ref": "655" + }, + "value": { + "$id": "1132", + "id": { + "$id": "1133", + "kind": "string", + "type": { + "$ref": "647" + }, + "value": "8:acs:uuid1" + }, + "displayName": { + "$id": "1134", + "kind": "string", + "type": { + "$ref": "651" + }, + "value": "Support" + }, + "kind": { + "$id": "1135", + "kind": "string", + "type": { + "$ref": "657" + }, + "value": "internal" + }, + "contact": { + "$id": "1136", + "kind": "model", + "type": { + "$ref": "671" + }, + "value": { + "$id": "1137", + "id": { + "$id": "1138", + "kind": "string", + "type": { + "$ref": "667" + }, + "value": "8:acs:uuid1" + }, + "kind": { + "$id": "1139", + "kind": "string", + "type": { + "$ref": "673" + }, + "value": "communication" + } + } + } + } + } + ] + } + } + }, + { + "$id": "1140", + "kind": "model", + "type": { + "$ref": "623" + }, + "value": { + "$id": "1141", + "id": { + "$id": "1142", + "kind": "string", + "type": { + "$ref": "625" + }, + "value": "19:111dfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2" + }, + "topic": { + "$id": "1143", + "kind": "string", + "type": { + "$ref": "629" + }, + "value": "Test" + }, + "deliveryChannelIds": { + "$id": "1144", + "kind": "array", + "type": { + "$ref": "633" + }, + "value": [ + { + "$id": "1145", + "kind": "string", + "type": { + "$ref": "634" + }, + "value": "0f0eb78e-a576-1dfc-b414-0f0756de3338" + } + ] + }, + "outboundDeliveryStrategy": { + "$id": "1146", + "kind": "string", + "type": { + "$ref": "96" + }, + "value": "allParticipants" + }, + "participants": { + "$id": "1147", + "kind": "array", + "type": { + "$ref": "641" + }, + "value": [ + { + "$id": "1148", + "kind": "model", + "type": { + "$ref": "695" + }, + "value": { + "$id": "1149", + "id": { + "$id": "1150", + "kind": "string", + "type": { + "$ref": "647" + }, + "value": "8:acs:uuid3" + }, + "displayName": { + "$id": "1151", + "kind": "string", + "type": { + "$ref": "651" + }, + "value": "Customer" + }, + "kind": { + "$id": "1152", + "kind": "string", + "type": { + "$ref": "697" + }, + "value": "external" + }, + "contacts": { + "$id": "1153", + "kind": "array", + "type": { + "$ref": "702" + }, + "value": [ + { + "$id": "1154", + "kind": "model", + "type": { + "$ref": "687" + }, + "value": { + "$id": "1155", + "id": { + "$id": "1156", + "kind": "string", + "type": { + "$ref": "667" + }, + "value": "12331112222" + }, + "kind": { + "$id": "1157", + "kind": "string", + "type": { + "$ref": "689" + }, + "value": "whatsApp" + } + } + }, + { + "$id": "1158", + "kind": "model", + "type": { + "$ref": "671" + }, + "value": { + "$id": "1159", + "id": { + "$id": "1160", + "kind": "string", + "type": { + "$ref": "667" + }, + "value": "8:acs:uuid3" + }, + "kind": { + "$id": "1161", + "kind": "string", + "type": { + "$ref": "673" + }, + "value": "communication" + } + } + } + ] + } + } + }, + { + "$id": "1162", + "kind": "model", + "type": { + "$ref": "655" + }, + "value": { + "$id": "1163", + "id": { + "$id": "1164", + "kind": "string", + "type": { + "$ref": "647" + }, + "value": "8:acs:uuid3" + }, + "displayName": { + "$id": "1165", + "kind": "string", + "type": { + "$ref": "651" + }, + "value": "Support" + }, + "kind": { + "$id": "1166", + "kind": "string", + "type": { + "$ref": "657" + }, + "value": "internal" + }, + "contact": { + "$id": "1167", + "kind": "model", + "type": { + "$ref": "671" + }, + "value": { + "$id": "1168", + "id": { + "$id": "1169", + "kind": "string", + "type": { + "$ref": "667" + }, + "value": "8:acs:uuid3" + }, + "kind": { + "$id": "1170", + "kind": "string", + "type": { + "$ref": "673" + }, + "value": "communication" + } + } + } + } + } + ] + } + } + } + ] + } + } + } + } + ] + } + ] + }, + { + "$id": "1171", + "name": "listMessages", + "resourceName": "ConversationMessageItem", + "doc": "Retrieves list of conversation messages.", + "accessibility": "public", + "parameters": [ + { + "$id": "1172", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1173", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1174", + "type": { + "$id": "1175", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1176", + "name": "conversationId", + "nameInRequest": "conversationId", + "doc": "The conversation ID.", + "type": { + "$id": "1177", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1178", + "name": "maxPageSize", + "nameInRequest": "maxPageSize", + "doc": "Number of objects to return per page.", + "type": { + "$id": "1179", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1180", + "name": "participantId", + "nameInRequest": "participantId", + "doc": "The participant user ID", + "type": { + "$id": "1181", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1182", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1183", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1184", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1185", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1186", + "kind": "constant", + "valueType": { + "$id": "1187", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1188", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "906" + }, + "headers": [ + { + "$id": "1189", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1190", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1191", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/messages/conversations/{conversationId}/messages", + "bufferResponse": true, + "paging": { + "$id": "1192", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "1193", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "ClientForAcsMessages.ConversationAdministrationClient.listMessages", + "decorators": [], + "examples": [ + { + "$id": "1194", + "kind": "http", + "name": "Retrieves list of conversation messages", + "description": "Retrieves list of conversation messages", + "filePath": "2025-04-01-preview/ConversationThread_ListMessages.json", + "parameters": [ + { + "$id": "1195", + "parameter": { + "$ref": "1172" + }, + "value": { + "$id": "1196", + "kind": "string", + "type": { + "$ref": "1173" + }, + "value": "2025-04-01-preview" + } + }, + { + "$id": "1197", + "parameter": { + "$ref": "1176" + }, + "value": { + "$id": "1198", + "kind": "string", + "type": { + "$ref": "1177" + }, + "value": "19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2" + } + } + ], + "responses": [ + { + "$id": "1199", + "response": { + "$ref": "1188" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1200", + "kind": "model", + "type": { + "$ref": "906" + }, + "value": { + "$id": "1201", + "value": { + "$id": "1202", + "kind": "array", + "type": { + "$ref": "908" + }, + "value": [ + { + "$id": "1203", + "kind": "model", + "type": { + "$ref": "719" + }, + "value": { + "$id": "1204", + "id": { + "$id": "1205", + "kind": "string", + "type": { + "$ref": "721" + }, + "value": "1593108077690" + }, + "sequenceId": { + "$id": "1206", + "kind": "number", + "type": { + "$ref": "725" + }, + "value": 6 + }, + "message": { + "$id": "1207", + "kind": "model", + "type": { + "$ref": "734" + }, + "value": { + "$id": "1208", + "kind": { + "$id": "1209", + "kind": "string", + "type": { + "$ref": "139" + }, + "value": "text" + }, + "content": { + "$id": "1210", + "kind": "string", + "type": { + "$ref": "739" + }, + "value": "My order did not arrive" + } + } + }, + "senderDisplayName": { + "$id": "1211", + "kind": "string", + "type": { + "$ref": "800" + }, + "value": "Jane" + }, + "createdOn": { + "$id": "1212", + "kind": "string", + "type": { + "$ref": "808" + }, + "value": "2020-06-25T18:01:17.6900000Z" + }, + "senderCommunicationIdentifier": { + "$id": "1213", + "kind": "string", + "type": { + "$ref": "804" + }, + "value": "8:acs:8540c0de-899f-5cce-acb5-3ec493af3800_0e59221d-0c1d-46ae-9544-c963ce56c10b" + } + } + }, + { + "$id": "1214", + "kind": "model", + "type": { + "$ref": "719" + }, + "value": { + "$id": "1215", + "id": { + "$id": "1216", + "kind": "string", + "type": { + "$ref": "721" + }, + "value": "1593107077690" + }, + "sequenceId": { + "$id": "1217", + "kind": "number", + "type": { + "$ref": "725" + }, + "value": 5 + }, + "message": { + "$id": "1218", + "kind": "model", + "type": { + "$ref": "734" + }, + "value": { + "$id": "1219", + "kind": { + "$id": "1220", + "kind": "string", + "type": { + "$ref": "139" + }, + "value": "text" + }, + "content": { + "$id": "1221", + "kind": "string", + "type": { + "$ref": "739" + }, + "value": "Hi I need help" + } + } + }, + "senderDisplayName": { + "$id": "1222", + "kind": "string", + "type": { + "$ref": "800" + }, + "value": "Jane" + }, + "createdOn": { + "$id": "1223", + "kind": "string", + "type": { + "$ref": "808" + }, + "value": "2020-06-25T17:44:37.6830000Z" + }, + "senderCommunicationIdentifier": { + "$id": "1224", + "kind": "string", + "type": { + "$ref": "804" + }, + "value": "8540c0de-899f-5cce-acb5-3ec493af3800_0e59221d-0c1d-46ae-9544-c963ce56c10b" + } + } + } + ] + } + } + } + } + ] + } + ] + }, + { + "$id": "1225", + "name": "addParticipants", + "resourceName": "ConversationAdministrationClient", + "doc": "Adds participants to a specific conversation.", + "accessibility": "public", + "parameters": [ + { + "$id": "1226", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1227", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1228", + "type": { + "$id": "1229", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1230", + "name": "conversationId", + "nameInRequest": "conversationId", + "doc": "The conversation ID.", + "type": { + "$id": "1231", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1232", + "name": "repeatabilityRequestId", + "nameInRequest": "Repeatability-Request-ID", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1233", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1234", + "name": "repeatabilityFirstSent", + "nameInRequest": "Repeatability-First-Sent", + "doc": "Specifies the date and time at which the request was first created.", + "type": { + "$id": "1235", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc7231", + "wireType": { + "$id": "1236", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1237", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1238", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1239", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1240", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1241", + "kind": "constant", + "valueType": { + "$id": "1242", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1243", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1244", + "kind": "constant", + "valueType": { + "$id": "1245", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1246", + "name": "options", + "nameInRequest": "options", + "doc": "Details of the payload for adding participants to a conversation.", + "type": { + "$ref": "812" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1247", + "statusCodes": [ + 207 + ], + "bodyType": { + "$ref": "817" + }, + "headers": [ + { + "$id": "1248", + "name": "repeatabilityResult", + "nameInResponse": "Repeatability-Result", + "doc": "Indicates whether the repeatable request was accepted or rejected.", + "type": { + "$ref": "116" + } + }, + { + "$id": "1249", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1250", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1251", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/messages/conversations/{conversationId}/participants:add", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "ClientForAcsMessages.ConversationAdministrationClient.addParticipants", + "decorators": [], + "examples": [ + { + "$id": "1252", + "kind": "http", + "name": "Adds participants to a specific conversation", + "description": "Adds participants to a specific conversation", + "filePath": "2025-04-01-preview/ConversationThread_AddParticipants.json", + "parameters": [ + { + "$id": "1253", + "parameter": { + "$ref": "1226" + }, + "value": { + "$id": "1254", + "kind": "string", + "type": { + "$ref": "1227" + }, + "value": "2025-04-01-preview" + } + }, + { + "$id": "1255", + "parameter": { + "$ref": "1230" + }, + "value": { + "$id": "1256", + "kind": "string", + "type": { + "$ref": "1231" + }, + "value": "19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2" + } + }, + { + "$id": "1257", + "parameter": { + "$ref": "1246" + }, + "value": { + "$id": "1258", + "kind": "model", + "type": { + "$ref": "812" + }, + "value": { + "$id": "1259", + "participants": { + "$id": "1260", + "kind": "array", + "type": { + "$ref": "814" + }, + "value": [ + { + "$id": "1261", + "kind": "model", + "type": { + "$ref": "695" + }, + "value": { + "$id": "1262", + "displayName": { + "$id": "1263", + "kind": "string", + "type": { + "$ref": "651" + }, + "value": "Customer" + }, + "kind": { + "$id": "1264", + "kind": "string", + "type": { + "$ref": "697" + }, + "value": "external" + }, + "contacts": { + "$id": "1265", + "kind": "array", + "type": { + "$ref": "702" + }, + "value": [ + { + "$id": "1266", + "kind": "model", + "type": { + "$ref": "687" + }, + "value": { + "$id": "1267", + "id": { + "$id": "1268", + "kind": "string", + "type": { + "$ref": "667" + }, + "value": "12345678901" + }, + "kind": { + "$id": "1269", + "kind": "string", + "type": { + "$ref": "689" + }, + "value": "whatsApp" + } + } + } + ] + } + } + }, + { + "$id": "1270", + "kind": "model", + "type": { + "$ref": "655" + }, + "value": { + "$id": "1271", + "displayName": { + "$id": "1272", + "kind": "string", + "type": { + "$ref": "651" + }, + "value": "Support" + }, + "kind": { + "$id": "1273", + "kind": "string", + "type": { + "$ref": "657" + }, + "value": "internal" + }, + "contact": { + "$id": "1274", + "kind": "model", + "type": { + "$ref": "671" + }, + "value": { + "$id": "1275", + "id": { + "$id": "1276", + "kind": "string", + "type": { + "$ref": "667" + }, + "value": "8:acs:uuid1" + }, + "kind": { + "$id": "1277", + "kind": "string", + "type": { + "$ref": "673" + }, + "value": "communication" + } + } + } + } + } + ] + } + } + } + } + ], + "responses": [ + { + "$id": "1278", + "response": { + "$ref": "1247" + }, + "statusCode": 207, + "bodyValue": { + "$id": "1279", + "kind": "model", + "type": { + "$ref": "817" + }, + "value": { + "$id": "1280", + "invalidParticipants": { + "$id": "1281", + "kind": "array", + "type": { + "$ref": "819" + }, + "value": [] + } + } + } + } + ] + } + ] + }, + { + "$id": "1282", + "name": "removeParticipants", + "resourceName": "ConversationAdministrationClient", + "doc": "remove a participant from a conversation", + "accessibility": "public", + "parameters": [ + { + "$id": "1283", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1284", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1285", + "type": { + "$id": "1286", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1287", + "name": "conversationId", + "nameInRequest": "conversationId", + "doc": "The conversation ID.", + "type": { + "$id": "1288", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1289", + "name": "repeatabilityRequestId", + "nameInRequest": "Repeatability-Request-ID", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1290", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1291", + "name": "repeatabilityFirstSent", + "nameInRequest": "Repeatability-First-Sent", + "doc": "Specifies the date and time at which the request was first created.", + "type": { + "$id": "1292", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc7231", + "wireType": { + "$id": "1293", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1294", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1295", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1296", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1297", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1298", + "kind": "constant", + "valueType": { + "$id": "1299", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1300", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1301", + "kind": "constant", + "valueType": { + "$id": "1302", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1303", + "name": "options", + "nameInRequest": "options", + "doc": "Details of the request body for removing participants from a conversation.", + "type": { + "$ref": "858" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1304", + "statusCodes": [ + 207 + ], + "bodyType": { + "$ref": "864" + }, + "headers": [ + { + "$id": "1305", + "name": "repeatabilityResult", + "nameInResponse": "Repeatability-Result", + "doc": "Indicates whether the repeatable request was accepted or rejected.", + "type": { + "$ref": "116" + } + }, + { + "$id": "1306", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1307", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1308", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/messages/conversations/{conversationId}/participants:remove", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "ClientForAcsMessages.ConversationAdministrationClient.removeParticipants", + "decorators": [], + "examples": [ + { + "$id": "1309", + "kind": "http", + "name": "remove a participant from a conversation", + "description": "remove a participant from a conversation", + "filePath": "2025-04-01-preview/ConversationThread_RemoveParticipants.json", + "parameters": [ + { + "$id": "1310", + "parameter": { + "$ref": "1283" + }, + "value": { + "$id": "1311", + "kind": "string", + "type": { + "$ref": "1284" + }, + "value": "2025-04-01-preview" + } + }, + { + "$id": "1312", + "parameter": { + "$ref": "1287" + }, + "value": { + "$id": "1313", + "kind": "string", + "type": { + "$ref": "1288" + }, + "value": "19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2" + } + }, + { + "$id": "1314", + "parameter": { + "$ref": "1303" + }, + "value": { + "$id": "1315", + "kind": "model", + "type": { + "$ref": "858" + }, + "value": { + "$id": "1316", + "participantIds": { + "$id": "1317", + "kind": "array", + "type": { + "$ref": "860" + }, + "value": [ + { + "$id": "1318", + "kind": "string", + "type": { + "$ref": "861" + }, + "value": "8:acs:uuid2" + } + ] + } + } + } + } + ], + "responses": [ + { + "$id": "1319", + "response": { + "$ref": "1304" + }, + "statusCode": 207, + "bodyValue": { + "$id": "1320", + "kind": "model", + "type": { + "$ref": "864" + }, + "value": { + "$id": "1321", + "invalidParticipants": { + "$id": "1322", + "kind": "array", + "type": { + "$ref": "866" + }, + "value": [] + } + } + } + } + ] + } + ] + }, + { + "$id": "1323", + "name": "analyzeConversation", + "resourceName": "ConversationAdministrationClient", + "doc": "Get AI Analysis of a conversation.", + "accessibility": "public", + "parameters": [ + { + "$id": "1324", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1325", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1326", + "type": { + "$id": "1327", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1328", + "name": "conversationId", + "nameInRequest": "conversationId", + "doc": "The conversation ID.", + "type": { + "$id": "1329", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1330", + "name": "repeatabilityRequestId", + "nameInRequest": "Repeatability-Request-ID", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1331", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1332", + "name": "repeatabilityFirstSent", + "nameInRequest": "Repeatability-First-Sent", + "doc": "Specifies the date and time at which the request was first created.", + "type": { + "$id": "1333", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc7231", + "wireType": { + "$id": "1334", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1335", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1336", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1337", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1338", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1339", + "kind": "constant", + "valueType": { + "$id": "1340", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1341", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "869" + }, + "headers": [ + { + "$id": "1342", + "name": "repeatabilityResult", + "nameInResponse": "Repeatability-Result", + "doc": "Indicates whether the repeatable request was accepted or rejected.", + "type": { + "$ref": "116" + } + }, + { + "$id": "1343", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1344", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1345", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/messages/conversations/{conversationId}:analyze", + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "ClientForAcsMessages.ConversationAdministrationClient.analyzeConversation", + "decorators": [], + "examples": [ + { + "$id": "1346", + "kind": "http", + "name": "Get AI Analysis of a conversation", + "description": "Get AI Analysis of a conversation", + "filePath": "2025-04-01-preview/ConversationThread_AnalyzeConversation.json", + "parameters": [ + { + "$id": "1347", + "parameter": { + "$ref": "1324" + }, + "value": { + "$id": "1348", + "kind": "string", + "type": { + "$ref": "1325" + }, + "value": "2025-04-01-preview" + } + }, + { + "$id": "1349", + "parameter": { + "$ref": "1328" + }, + "value": { + "$id": "1350", + "kind": "string", + "type": { + "$ref": "1329" + }, + "value": "19:34adfa4f-cedf-4dc0-ba29-b6d1a69ab345@thread.v2" + } + } + ], + "responses": [ + { + "$id": "1351", + "response": { + "$ref": "1341" + }, + "statusCode": 200, + "bodyValue": { + "$id": "1352", + "kind": "model", + "type": { + "$ref": "869" + }, + "value": { + "$id": "1353", + "summary": { + "$id": "1354", + "kind": "string", + "type": { + "$ref": "871" + }, + "value": "The customer needs help." + } + } + } + } + ] + } + ] + } + ], + "parameters": [ + { + "$id": "1355", + "name": "endpoint", + "nameInRequest": "endpoint", + "doc": "The communication resource, for example https://my-resource.communication.azure.com", + "type": { + "$id": "1356", + "kind": "url", + "name": "url", + "crossLanguageDefinitionId": "TypeSpec.url" + }, + "location": "Uri", + "isApiVersion": false, + "isContentType": false, + "isRequired": true, + "isEndpoint": true, + "skipUrlEncoding": false, + "explode": false, + "kind": "Client" + } + ], + "decorators": [], + "crossLanguageDefinitionId": "ClientForAcsMessages.ConversationAdministrationClient", + "apiVersions": [ + "2025-04-01-preview" + ] + }, + { + "$id": "1357", + "kind": "client", + "name": "ConversationThreadClient", + "namespace": "Azure.Communication.Messages", + "operations": [ + { + "$id": "1358", + "name": "addParticipants", + "resourceName": "ConversationThreadClient", + "doc": "Adds participants to a specific conversation.", + "accessibility": "public", + "parameters": [ + { + "$id": "1359", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1360", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1361", + "type": { + "$id": "1362", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1363", + "name": "conversationId", + "nameInRequest": "conversationId", + "doc": "The conversation ID.", + "type": { + "$id": "1364", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1365", + "name": "repeatabilityRequestId", + "nameInRequest": "Repeatability-Request-ID", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1366", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1367", + "name": "repeatabilityFirstSent", + "nameInRequest": "Repeatability-First-Sent", + "doc": "Specifies the date and time at which the request was first created.", + "type": { + "$id": "1368", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc7231", + "wireType": { + "$id": "1369", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1370", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1371", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1372", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1373", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1374", + "kind": "constant", + "valueType": { + "$id": "1375", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1376", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1377", + "kind": "constant", + "valueType": { + "$id": "1378", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1379", + "name": "options", + "nameInRequest": "options", + "doc": "Details of the payload for adding participants to a conversation.", + "type": { + "$ref": "812" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1380", + "statusCodes": [ + 207 + ], + "bodyType": { + "$ref": "817" + }, + "headers": [ + { + "$id": "1381", + "name": "repeatabilityResult", + "nameInResponse": "Repeatability-Result", + "doc": "Indicates whether the repeatable request was accepted or rejected.", + "type": { + "$ref": "116" + } + }, + { + "$id": "1382", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1383", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1384", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/messages/conversations/{conversationId}/participants:add", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationThreadClient.addParticipants", + "decorators": [] + }, + { + "$id": "1385", + "name": "removeParticipants", + "resourceName": "ConversationThreadClient", + "doc": "remove a participant from a conversation", + "accessibility": "public", + "parameters": [ + { + "$id": "1386", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1387", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1388", + "type": { + "$id": "1389", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1390", + "name": "conversationId", + "nameInRequest": "conversationId", + "doc": "The conversation ID.", + "type": { + "$id": "1391", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false }, { - "$id": "617", + "$id": "1392", "name": "repeatabilityRequestId", "nameInRequest": "Repeatability-Request-ID", "doc": "An opaque, globally-unique, client-generated string identifier for the request.", "type": { - "$id": "618", + "$id": "1393", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4923,26 +11521,299 @@ "skipUrlEncoding": false }, { - "$id": "619", + "$id": "1394", "name": "repeatabilityFirstSent", "nameInRequest": "Repeatability-First-Sent", "doc": "Specifies the date and time at which the request was first created.", "type": { - "$id": "620", + "$id": "1395", "kind": "utcDateTime", "name": "utcDateTime", "encode": "rfc7231", "wireType": { - "$id": "621", + "$id": "1396", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1397", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1398", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1399", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1400", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1401", + "kind": "constant", + "valueType": { + "$id": "1402", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1403", + "name": "accept", + "nameInRequest": "Accept", + "type": { + "$id": "1404", + "kind": "constant", + "valueType": { + "$id": "1405", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1406", + "name": "options", + "nameInRequest": "options", + "doc": "Details of the request body for removing participants from a conversation.", + "type": { + "$ref": "858" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1407", + "statusCodes": [ + 207 + ], + "bodyType": { + "$ref": "864" + }, + "headers": [ + { + "$id": "1408", + "name": "repeatabilityResult", + "nameInResponse": "Repeatability-Result", + "doc": "Indicates whether the repeatable request was accepted or rejected.", + "type": { + "$ref": "116" + } + }, + { + "$id": "1409", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1410", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1411", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "POST", + "uri": "{endpoint}", + "path": "/messages/conversations/{conversationId}/participants:remove", + "requestMediaTypes": [ + "application/json" + ], + "bufferResponse": true, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationThreadClient.removeParticipants", + "decorators": [] + }, + { + "$id": "1412", + "name": "listConversations", + "resourceName": "Conversation", + "doc": "Retrieves list of conversations.", + "accessibility": "public", + "parameters": [ + { + "$id": "1413", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1414", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1415", + "type": { + "$id": "1416", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1417", + "name": "maxPageSize", + "nameInRequest": "maxPageSize", + "doc": "Number of objects to return per page.", + "type": { + "$id": "1418", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1419", + "name": "participantId", + "nameInRequest": "participantId", + "doc": "The participant user ID", + "type": { + "$id": "1420", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1421", + "name": "channelId", + "nameInRequest": "channelId", + "doc": "The id of channel", + "type": { + "$id": "1422", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1423", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "crossLanguageDefinitionId": "TypeSpec.utcDateTime", "decorators": [] }, - "location": "Header", + "location": "Query", "isApiVersion": false, "isContentType": false, "isEndpoint": false, @@ -4953,17 +11824,17 @@ "skipUrlEncoding": false }, { - "$id": "622", + "$id": "1424", "name": "clientRequestId", "nameInRequest": "x-ms-client-request-id", "doc": "An opaque, globally-unique, client-generated string identifier for the request.", "type": { - "$id": "623", + "$id": "1425", "kind": "string", "name": "uuid", "crossLanguageDefinitionId": "Azure.Core.uuid", "baseType": { - "$id": "624", + "$id": "1426", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -4982,15 +11853,14 @@ "skipUrlEncoding": false }, { - "$id": "625", - "name": "contentType", - "nameInRequest": "Content-Type", - "doc": "Body parameter's content type. Known values are application/json", + "$id": "1427", + "name": "accept", + "nameInRequest": "Accept", "type": { - "$id": "626", + "$id": "1428", "kind": "constant", "valueType": { - "$id": "627", + "$id": "1429", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5001,29 +11871,196 @@ }, "location": "Header", "isApiVersion": false, - "isContentType": true, + "isContentType": false, "isEndpoint": false, "explode": false, "isRequired": true, "kind": "Constant", "decorators": [], "skipUrlEncoding": false + } + ], + "responses": [ + { + "$id": "1430", + "statusCodes": [ + 200 + ], + "bodyType": { + "$ref": "896" + }, + "headers": [ + { + "$id": "1431", + "name": "clientRequestId", + "nameInResponse": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1432", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1433", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "decorators": [] + } + } + ], + "isErrorResponse": false, + "contentTypes": [ + "application/json" + ] + } + ], + "httpMethod": "GET", + "uri": "{endpoint}", + "path": "/messages/conversations", + "bufferResponse": true, + "paging": { + "$id": "1434", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "1435", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, + "generateProtocolMethod": true, + "generateConvenienceMethod": true, + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationThreadClient.listConversations", + "decorators": [] + }, + { + "$id": "1436", + "name": "listMessages", + "resourceName": "ConversationMessageItem", + "doc": "Retrieves list of conversation messages.", + "accessibility": "public", + "parameters": [ + { + "$id": "1437", + "name": "apiVersion", + "nameInRequest": "api-version", + "doc": "The API version to use for this operation.", + "type": { + "$id": "1438", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": true, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Client", + "defaultValue": { + "$id": "1439", + "type": { + "$id": "1440", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string" + }, + "value": "2025-04-01-preview" + }, + "decorators": [], + "skipUrlEncoding": false }, { - "$id": "628", - "name": "accept", - "nameInRequest": "Accept", + "$id": "1441", + "name": "conversationId", + "nameInRequest": "conversationId", + "doc": "The conversation ID.", "type": { - "$id": "629", - "kind": "constant", - "valueType": { - "$id": "630", + "$id": "1442", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1443", + "name": "maxPageSize", + "nameInRequest": "maxPageSize", + "doc": "Number of objects to return per page.", + "type": { + "$id": "1444", + "kind": "int32", + "name": "int32", + "crossLanguageDefinitionId": "TypeSpec.int32", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1445", + "name": "participantId", + "nameInRequest": "participantId", + "doc": "The participant user ID", + "type": { + "$id": "1446", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Query", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1447", + "name": "clientRequestId", + "nameInRequest": "x-ms-client-request-id", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1448", + "kind": "string", + "name": "uuid", + "crossLanguageDefinitionId": "Azure.Core.uuid", + "baseType": { + "$id": "1449", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "application/json", "decorators": [] }, "location": "Header", @@ -5031,61 +12068,61 @@ "isContentType": false, "isEndpoint": false, "explode": false, - "isRequired": true, - "kind": "Constant", + "isRequired": false, + "kind": "Method", "decorators": [], "skipUrlEncoding": false }, { - "$id": "631", - "name": "notificationContent", - "nameInRequest": "notificationContent", - "doc": "Details of the message to send.", + "$id": "1450", + "name": "accept", + "nameInRequest": "Accept", "type": { - "$ref": "100" + "$id": "1451", + "kind": "constant", + "valueType": { + "$id": "1452", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] }, - "location": "Body", + "location": "Header", "isApiVersion": false, "isContentType": false, "isEndpoint": false, "explode": false, "isRequired": true, - "kind": "Method", + "kind": "Constant", "decorators": [], "skipUrlEncoding": false } ], "responses": [ { - "$id": "632", + "$id": "1453", "statusCodes": [ - 202 + 200 ], "bodyType": { - "$ref": "561" + "$ref": "906" }, "headers": [ { - "$id": "633", - "name": "repeatabilityResult", - "nameInResponse": "Repeatability-Result", - "doc": "Indicates whether the repeatable request was accepted or rejected.", - "type": { - "$ref": "94" - } - }, - { - "$id": "634", + "$id": "1454", "name": "clientRequestId", "nameInResponse": "x-ms-client-request-id", "doc": "An opaque, globally-unique, client-generated string identifier for the request.", "type": { - "$id": "635", + "$id": "1455", "kind": "string", "name": "uuid", "crossLanguageDefinitionId": "Azure.Core.uuid", "baseType": { - "$id": "636", + "$id": "1456", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5101,32 +12138,42 @@ ] } ], - "httpMethod": "POST", + "httpMethod": "GET", "uri": "{endpoint}", - "path": "/messages/notifications:send", - "requestMediaTypes": [ - "application/json" - ], + "path": "/messages/conversations/{conversationId}/messages", "bufferResponse": true, + "paging": { + "$id": "1457", + "itemPropertySegments": [ + "value" + ], + "nextLink": { + "$id": "1458", + "responseSegments": [ + "nextLink" + ], + "responseLocation": "Body" + } + }, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Azure.Communication.MessagesService.NotificationMessagesClient.send", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationThreadClient.listMessages", "decorators": [] }, { - "$id": "637", - "name": "downloadMediaInternal", - "resourceName": "MessageDataStream", - "doc": "Download the Media payload from a User to Business message.", - "accessibility": "internal", + "$id": "1459", + "name": "sendMessage", + "resourceName": "ConversationThreadClient", + "doc": "Sends a conversation message from Business to User.", + "accessibility": "public", "parameters": [ { - "$id": "638", + "$id": "1460", "name": "apiVersion", "nameInRequest": "api-version", "doc": "The API version to use for this operation.", "type": { - "$id": "639", + "$id": "1461", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5140,52 +12187,104 @@ "isRequired": true, "kind": "Client", "defaultValue": { - "$id": "640", + "$id": "1462", "type": { - "$id": "641", + "$id": "1463", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, - "value": "2025-01-15-preview" + "value": "2025-04-01-preview" }, "decorators": [], "skipUrlEncoding": false }, { - "$id": "642", - "name": "id", - "nameInRequest": "id", - "doc": "The stream ID.", + "$id": "1464", + "name": "conversationId", + "nameInRequest": "conversationId", + "doc": "The conversation ID.", + "type": { + "$id": "1465", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Path", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1466", + "name": "repeatabilityRequestId", + "nameInRequest": "Repeatability-Request-ID", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", + "type": { + "$id": "1467", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1468", + "name": "repeatabilityFirstSent", + "nameInRequest": "Repeatability-First-Sent", + "doc": "Specifies the date and time at which the request was first created.", "type": { - "$id": "643", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", + "$id": "1469", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc7231", + "wireType": { + "$id": "1470", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", "decorators": [] }, - "location": "Path", + "location": "Header", "isApiVersion": false, "isContentType": false, "isEndpoint": false, "explode": false, - "isRequired": true, + "isRequired": false, "kind": "Method", "decorators": [], "skipUrlEncoding": false }, { - "$id": "644", + "$id": "1471", "name": "clientRequestId", "nameInRequest": "x-ms-client-request-id", "doc": "An opaque, globally-unique, client-generated string identifier for the request.", "type": { - "$id": "645", + "$id": "1472", "kind": "string", "name": "uuid", "crossLanguageDefinitionId": "Azure.Core.uuid", "baseType": { - "$id": "646", + "$id": "1473", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5204,20 +12303,48 @@ "skipUrlEncoding": false }, { - "$id": "647", + "$id": "1474", + "name": "contentType", + "nameInRequest": "Content-Type", + "doc": "Body parameter's content type. Known values are application/json", + "type": { + "$id": "1475", + "kind": "constant", + "valueType": { + "$id": "1476", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "value": "application/json", + "decorators": [] + }, + "location": "Header", + "isApiVersion": false, + "isContentType": true, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Constant", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1477", "name": "accept", "nameInRequest": "Accept", "type": { - "$id": "648", + "$id": "1478", "kind": "constant", "valueType": { - "$id": "649", + "$id": "1479", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "application/octet-stream", + "value": "application/json", "decorators": [] }, "location": "Header", @@ -5229,184 +12356,98 @@ "kind": "Constant", "decorators": [], "skipUrlEncoding": false + }, + { + "$id": "1480", + "name": "options", + "nameInRequest": "options", + "doc": "Details of the conversation message to send.", + "type": { + "$ref": "874" + }, + "location": "Body", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": true, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false } ], "responses": [ { - "$id": "650", + "$id": "1481", "statusCodes": [ 200 ], "bodyType": { - "$id": "651", - "kind": "bytes", - "name": "bytes", - "crossLanguageDefinitionId": "TypeSpec.bytes", - "decorators": [] + "$ref": "881" }, "headers": [ { - "$id": "652", + "$id": "1482", + "name": "repeatabilityResult", + "nameInResponse": "Repeatability-Result", + "doc": "Indicates whether the repeatable request was accepted or rejected.", + "type": { + "$ref": "116" + } + }, + { + "$id": "1483", "name": "clientRequestId", "nameInResponse": "x-ms-client-request-id", "doc": "An opaque, globally-unique, client-generated string identifier for the request.", "type": { - "$id": "653", + "$id": "1484", "kind": "string", "name": "uuid", "crossLanguageDefinitionId": "Azure.Core.uuid", "baseType": { - "$id": "654", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", - "decorators": [] - }, - "decorators": [] - } - }, - { - "$id": "655", - "name": "contentType", - "nameInResponse": "content-type", - "doc": "The stream content type.", - "type": { - "$id": "656", - "kind": "constant", - "valueType": { - "$id": "657", + "$id": "1485", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "value": "application/octet-stream", "decorators": [] } } ], "isErrorResponse": false, "contentTypes": [ - "application/octet-stream" + "application/json" ] } ], - "httpMethod": "GET", + "httpMethod": "POST", "uri": "{endpoint}", - "path": "/messages/streams/{id}", + "path": "/messages/conversations/{conversationId}/messages:send", + "requestMediaTypes": [ + "application/json" + ], "bufferResponse": true, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "ClientForAcsMessages.NotificationMessagesClient.downloadMedia", - "decorators": [], - "examples": [ - { - "$id": "658", - "kind": "http", - "name": "Download media", - "description": "Download media", - "filePath": "2025-01-15-preview/Stream_GetMedia.json", - "parameters": [ - { - "$id": "659", - "parameter": { - "$ref": "638" - }, - "value": { - "$id": "660", - "kind": "string", - "type": { - "$ref": "639" - }, - "value": "2025-01-15-preview" - } - }, - { - "$id": "661", - "parameter": { - "$ref": "642" - }, - "value": { - "$id": "662", - "kind": "string", - "type": { - "$ref": "643" - }, - "value": "d19e68ec-bdd6-4a50-8dfb-cbb1642df6ab" - } - } - ], - "responses": [ - { - "$id": "663", - "response": { - "$ref": "650" - }, - "statusCode": 200, - "bodyValue": { - "$id": "664", - "kind": "string", - "type": { - "$ref": "651" - }, - "value": "" - } - } - ] - } - ] - } - ], - "parameters": [ - { - "$id": "665", - "name": "endpoint", - "nameInRequest": "endpoint", - "doc": "The communication resource, for example https://my-resource.communication.azure.com", - "type": { - "$id": "666", - "kind": "url", - "name": "url", - "crossLanguageDefinitionId": "TypeSpec.url" - }, - "location": "Uri", - "isApiVersion": false, - "isContentType": false, - "isRequired": true, - "isEndpoint": true, - "skipUrlEncoding": false, - "explode": false, - "kind": "Client" - } - ], - "decorators": [], - "crossLanguageDefinitionId": "ClientForAcsMessages.NotificationMessagesClient", - "apiVersions": [ - "2024-02-01", - "2024-08-30", - "2025-01-15-preview" - ] - }, - { - "$id": "667", - "kind": "client", - "name": "MessageTemplateClient", - "namespace": "Azure.Communication.Messages", - "operations": [ + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationThreadClient.sendMessage", + "decorators": [] + }, { - "$id": "668", - "name": "getTemplates", - "resourceName": "MessageTemplateItem", - "doc": "List all templates for given Azure Communication Services channel", + "$id": "1486", + "name": "analyzeConversation", + "resourceName": "ConversationThreadClient", + "doc": "Get AI Analysis of a conversation.", "accessibility": "public", "parameters": [ { - "$id": "669", + "$id": "1487", "name": "apiVersion", "nameInRequest": "api-version", "doc": "The API version to use for this operation.", "type": { - "$id": "670", + "$id": "1488", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5420,35 +12461,28 @@ "isRequired": true, "kind": "Client", "defaultValue": { - "$id": "671", + "$id": "1489", "type": { - "$id": "672", + "$id": "1490", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string" }, - "value": "2025-01-15-preview" + "value": "2025-04-01-preview" }, "decorators": [], "skipUrlEncoding": false }, { - "$id": "673", - "name": "channelId", - "nameInRequest": "channelId", - "doc": "The registration ID of the channel.", + "$id": "1491", + "name": "conversationId", + "nameInRequest": "conversationId", + "doc": "The conversation ID.", "type": { - "$id": "674", + "$id": "1492", "kind": "string", - "name": "uuid", - "crossLanguageDefinitionId": "Azure.Core.uuid", - "baseType": { - "$id": "675", - "kind": "string", - "name": "string", - "crossLanguageDefinitionId": "TypeSpec.string", - "decorators": [] - }, + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, "location": "Path", @@ -5462,18 +12496,48 @@ "skipUrlEncoding": false }, { - "$id": "676", - "name": "maxpagesize", - "nameInRequest": "maxpagesize", - "doc": "Number of objects to return per page.", + "$id": "1493", + "name": "repeatabilityRequestId", + "nameInRequest": "Repeatability-Request-ID", + "doc": "An opaque, globally-unique, client-generated string identifier for the request.", "type": { - "$id": "677", - "kind": "int32", - "name": "int32", - "crossLanguageDefinitionId": "TypeSpec.int32", + "$id": "1494", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", "decorators": [] }, - "location": "Query", + "location": "Header", + "isApiVersion": false, + "isContentType": false, + "isEndpoint": false, + "explode": false, + "isRequired": false, + "kind": "Method", + "decorators": [], + "skipUrlEncoding": false + }, + { + "$id": "1495", + "name": "repeatabilityFirstSent", + "nameInRequest": "Repeatability-First-Sent", + "doc": "Specifies the date and time at which the request was first created.", + "type": { + "$id": "1496", + "kind": "utcDateTime", + "name": "utcDateTime", + "encode": "rfc7231", + "wireType": { + "$id": "1497", + "kind": "string", + "name": "string", + "crossLanguageDefinitionId": "TypeSpec.string", + "decorators": [] + }, + "crossLanguageDefinitionId": "TypeSpec.utcDateTime", + "decorators": [] + }, + "location": "Header", "isApiVersion": false, "isContentType": false, "isEndpoint": false, @@ -5484,17 +12548,17 @@ "skipUrlEncoding": false }, { - "$id": "678", + "$id": "1498", "name": "clientRequestId", "nameInRequest": "x-ms-client-request-id", "doc": "An opaque, globally-unique, client-generated string identifier for the request.", "type": { - "$id": "679", + "$id": "1499", "kind": "string", "name": "uuid", "crossLanguageDefinitionId": "Azure.Core.uuid", "baseType": { - "$id": "680", + "$id": "1500", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5513,14 +12577,14 @@ "skipUrlEncoding": false }, { - "$id": "681", + "$id": "1501", "name": "accept", "nameInRequest": "Accept", "type": { - "$id": "682", + "$id": "1502", "kind": "constant", "valueType": { - "$id": "683", + "$id": "1503", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5542,26 +12606,35 @@ ], "responses": [ { - "$id": "684", + "$id": "1504", "statusCodes": [ 200 ], "bodyType": { - "$ref": "601" + "$ref": "869" }, "headers": [ { - "$id": "685", + "$id": "1505", + "name": "repeatabilityResult", + "nameInResponse": "Repeatability-Result", + "doc": "Indicates whether the repeatable request was accepted or rejected.", + "type": { + "$ref": "116" + } + }, + { + "$id": "1506", "name": "clientRequestId", "nameInResponse": "x-ms-client-request-id", "doc": "An opaque, globally-unique, client-generated string identifier for the request.", "type": { - "$id": "686", + "$id": "1507", "kind": "string", "name": "uuid", "crossLanguageDefinitionId": "Azure.Core.uuid", "baseType": { - "$id": "687", + "$id": "1508", "kind": "string", "name": "string", "crossLanguageDefinitionId": "TypeSpec.string", @@ -5577,37 +12650,24 @@ ] } ], - "httpMethod": "GET", + "httpMethod": "POST", "uri": "{endpoint}", - "path": "/messages/channels/{channelId}/templates", + "path": "/messages/conversations/{conversationId}:analyze", "bufferResponse": true, - "paging": { - "$id": "688", - "itemPropertySegments": [ - "value" - ], - "nextLink": { - "$id": "689", - "responseSegments": [ - "nextLink" - ], - "responseLocation": "Body" - } - }, "generateProtocolMethod": true, "generateConvenienceMethod": true, - "crossLanguageDefinitionId": "Azure.Communication.MessagesService.MessageTemplateClient.listTemplates", + "crossLanguageDefinitionId": "Azure.Communication.MessagesService.ConversationThreadClient.analyzeConversation", "decorators": [] } ], "parameters": [ { - "$id": "690", + "$id": "1509", "name": "endpoint", "nameInRequest": "endpoint", "doc": "The communication resource, for example https://my-resource.communication.azure.com", "type": { - "$id": "691", + "$id": "1510", "kind": "url", "name": "url", "crossLanguageDefinitionId": "TypeSpec.url" @@ -5623,26 +12683,25 @@ } ], "decorators": [], - "crossLanguageDefinitionId": "ClientForAcsMessages.MessageTemplateClient", + "crossLanguageDefinitionId": "ClientForAcsMessages.ConversationThreadClient", "apiVersions": [ - "2024-02-01", - "2024-08-30", - "2025-01-15-preview" + "2025-04-01-preview" ] } ], "auth": { - "$id": "692", + "$id": "1511", "oAuth2": { - "$id": "693", + "$id": "1512", "scopes": [ "https://communication.azure.com/.default" ] }, "apiKey": { - "$id": "694", + "$id": "1513", "name": "Authorization", - "in": "header" + "in": "header", + "prefix": "Bearer" } } }