From 415b6dbd876fe6eaf9d1428de52ae4dc38a92088 Mon Sep 17 00:00:00 2001 From: SDKAuto Date: Mon, 6 Mar 2023 19:20:04 +0000 Subject: [PATCH] CodeGen from PR 22935 in Azure/azure-rest-api-specs Merge 577124a0494aca1ad9744873d426613748e19109 into 8539fe23e90aff363869fd21321b775ce2ccca8b --- ...zure.Messaging.EventGrid.netstandard2.0.cs | 61 +++++++++++++ .../src/Generated/EventGridModelFactory.cs | 26 ++++++ ...ryReportReceivedEventData.Serialization.cs | 84 +++++++++++++++++ ...AcsEmailDeliveryReportReceivedEventData.cs | 47 ++++++++++ .../Models/AcsEmailDeliveryReportStatus.cs | 57 ++++++++++++ ...ngReportReceivedEventData.Serialization.cs | 90 +++++++++++++++++++ ...gagementTrackingReportReceivedEventData.cs | 51 +++++++++++ .../src/Generated/Models/AcsUserEngagement.cs | 51 +++++++++++ .../Azure.Messaging.EventGrid/src/autorest.md | 5 +- 9 files changed, 471 insertions(+), 1 deletion(-) create mode 100644 sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailDeliveryReportReceivedEventData.Serialization.cs create mode 100644 sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailDeliveryReportReceivedEventData.cs create mode 100644 sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailDeliveryReportStatus.cs create mode 100644 sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.Serialization.cs create mode 100644 sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.cs create mode 100644 sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsUserEngagement.cs diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/api/Azure.Messaging.EventGrid.netstandard2.0.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/api/Azure.Messaging.EventGrid.netstandard2.0.cs index 6ad896b5380b..26028ebed1ca 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/api/Azure.Messaging.EventGrid.netstandard2.0.cs +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/api/Azure.Messaging.EventGrid.netstandard2.0.cs @@ -56,6 +56,8 @@ public static partial class EventGridModelFactory public static Azure.Messaging.EventGrid.SystemEvents.AcsChatThreadPropertiesUpdatedEventData AcsChatThreadPropertiesUpdatedEventData(string transactionId = null, string threadId = null, System.DateTimeOffset? createTime = default(System.DateTimeOffset?), long? version = default(long?), Azure.Messaging.EventGrid.SystemEvents.CommunicationIdentifierModel editedByCommunicationIdentifier = null, System.DateTimeOffset? editTime = default(System.DateTimeOffset?), System.Collections.Generic.IReadOnlyDictionary properties = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.AcsChatThreadPropertiesUpdatedPerUserEventData AcsChatThreadPropertiesUpdatedPerUserEventData(Azure.Messaging.EventGrid.SystemEvents.CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, System.DateTimeOffset? createTime = default(System.DateTimeOffset?), long? version = default(long?), Azure.Messaging.EventGrid.SystemEvents.CommunicationIdentifierModel editedByCommunicationIdentifier = null, System.DateTimeOffset? editTime = default(System.DateTimeOffset?), System.Collections.Generic.IReadOnlyDictionary properties = null) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.AcsChatThreadWithUserDeletedEventData AcsChatThreadWithUserDeletedEventData(Azure.Messaging.EventGrid.SystemEvents.CommunicationIdentifierModel recipientCommunicationIdentifier = null, string transactionId = null, string threadId = null, System.DateTimeOffset? createTime = default(System.DateTimeOffset?), long? version = default(long?), Azure.Messaging.EventGrid.SystemEvents.CommunicationIdentifierModel deletedByCommunicationIdentifier = null, System.DateTimeOffset? deleteTime = default(System.DateTimeOffset?)) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.AcsEmailDeliveryReportReceivedEventData AcsEmailDeliveryReportReceivedEventData(string sender = null, string recipient = null, string messageId = null, Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus? status = default(Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus?), System.DateTimeOffset? deliveryAttemptTimestamp = default(System.DateTimeOffset?)) { throw null; } + public static Azure.Messaging.EventGrid.SystemEvents.AcsEmailEngagementTrackingReportReceivedEventData AcsEmailEngagementTrackingReportReceivedEventData(string sender = null, string messageId = null, System.DateTimeOffset? userActionTimestamp = default(System.DateTimeOffset?), string engagementContext = null, string userAgent = null, Azure.Messaging.EventGrid.Models.AcsUserEngagement? engagement = default(Azure.Messaging.EventGrid.Models.AcsUserEngagement?)) { throw null; } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] public static Azure.Messaging.EventGrid.SystemEvents.AcsRecordingChunkInfoProperties AcsRecordingChunkInfoProperties(string documentId, long? index, string endReason, string metadataLocation, string contentLocation) { throw null; } public static Azure.Messaging.EventGrid.SystemEvents.AcsRecordingChunkInfoProperties AcsRecordingChunkInfoProperties(string documentId = null, long? index = default(long?), string endReason = null, string metadataLocation = null, string contentLocation = null, string deleteLocation = null) { throw null; } @@ -327,6 +329,8 @@ public static partial class SystemEventNames public const string AcsChatThreadPropertiesUpdated = "Microsoft.Communication.ChatThreadPropertiesUpdated"; public const string AcsChatThreadPropertiesUpdatedPerUser = "Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser"; public const string AcsChatThreadWithUserDeleted = "Microsoft.Communication.ChatThreadWithUserDeleted"; + public const string AcsEmailDeliveryReportReceived = "Microsoft.Communication.EmailDeliveryReportReceived"; + public const string AcsEmailEngagementTrackingReportReceived = "Microsoft.Communication.EmailEngagementTrackingReportReceived"; public const string AcsRecordingFileStatusUpdated = "Microsoft.Communication.RecordingFileStatusUpdated"; public const string AcsSmsDeliveryReportReceived = "Microsoft.Communication.SMSDeliveryReportReceived"; public const string AcsSmsReceived = "Microsoft.Communication.SMSReceived"; @@ -472,6 +476,44 @@ public static partial class SystemEventNames } namespace Azure.Messaging.EventGrid.Models { + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AcsEmailDeliveryReportStatus : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AcsEmailDeliveryReportStatus(string value) { throw null; } + public static Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus Delivered { get { throw null; } } + public static Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus Failed { get { throw null; } } + public static Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus FilteredSpam { get { throw null; } } + public static Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus Quarantined { get { throw null; } } + public bool Equals(Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus left, Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus right) { throw null; } + public static implicit operator Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus (string value) { throw null; } + public static bool operator !=(Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus left, Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus right) { throw null; } + public override string ToString() { throw null; } + } + [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] + public readonly partial struct AcsUserEngagement : System.IEquatable + { + private readonly object _dummy; + private readonly int _dummyPrimitive; + public AcsUserEngagement(string value) { throw null; } + public static Azure.Messaging.EventGrid.Models.AcsUserEngagement Click { get { throw null; } } + public static Azure.Messaging.EventGrid.Models.AcsUserEngagement View { get { throw null; } } + public bool Equals(Azure.Messaging.EventGrid.Models.AcsUserEngagement other) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override bool Equals(object obj) { throw null; } + [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] + public override int GetHashCode() { throw null; } + public static bool operator ==(Azure.Messaging.EventGrid.Models.AcsUserEngagement left, Azure.Messaging.EventGrid.Models.AcsUserEngagement right) { throw null; } + public static implicit operator Azure.Messaging.EventGrid.Models.AcsUserEngagement (string value) { throw null; } + public static bool operator !=(Azure.Messaging.EventGrid.Models.AcsUserEngagement left, Azure.Messaging.EventGrid.Models.AcsUserEngagement right) { throw null; } + public override string ToString() { throw null; } + } [System.ComponentModel.EditorBrowsableAttribute(System.ComponentModel.EditorBrowsableState.Never)] [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct RecordingChannelType : System.IEquatable @@ -690,6 +732,25 @@ internal AcsChatThreadWithUserDeletedEventData() { } public Azure.Messaging.EventGrid.SystemEvents.CommunicationIdentifierModel DeletedByCommunicationIdentifier { get { throw null; } } public System.DateTimeOffset? DeleteTime { get { throw null; } } } + public partial class AcsEmailDeliveryReportReceivedEventData + { + internal AcsEmailDeliveryReportReceivedEventData() { } + public System.DateTimeOffset? DeliveryAttemptTimestamp { get { throw null; } } + public string MessageId { get { throw null; } } + public string Recipient { get { throw null; } } + public string Sender { get { throw null; } } + public Azure.Messaging.EventGrid.Models.AcsEmailDeliveryReportStatus? Status { get { throw null; } } + } + public partial class AcsEmailEngagementTrackingReportReceivedEventData + { + internal AcsEmailEngagementTrackingReportReceivedEventData() { } + public Azure.Messaging.EventGrid.Models.AcsUserEngagement? Engagement { get { throw null; } } + public string EngagementContext { get { throw null; } } + public string MessageId { get { throw null; } } + public string Sender { get { throw null; } } + public System.DateTimeOffset? UserActionTimestamp { get { throw null; } } + public string UserAgent { get { throw null; } } + } [System.Runtime.InteropServices.StructLayoutAttribute(System.Runtime.InteropServices.LayoutKind.Sequential)] public readonly partial struct AcsRecordingChannelType : System.IEquatable { diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs index 385af9ff81d7..62796b6d817f 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/EventGridModelFactory.cs @@ -8,6 +8,7 @@ using System; using System.Collections.Generic; using System.Linq; +using Azure.Messaging.EventGrid.Models; using Azure.Messaging.EventGrid.SystemEvents; namespace Azure.Messaging.EventGrid @@ -2035,6 +2036,31 @@ public static AcsRecordingChunkInfoProperties AcsRecordingChunkInfoProperties(st return new AcsRecordingChunkInfoProperties(documentId, index, endReason, metadataLocation, contentLocation, deleteLocation); } + /// Initializes a new instance of AcsEmailDeliveryReportReceivedEventData. + /// The Sender Email Address. + /// The recipient Email Address. + /// The Id of the email been sent. + /// The status of the email. + /// The time at which the email delivery report received timestamp. + /// A new instance for mocking. + public static AcsEmailDeliveryReportReceivedEventData AcsEmailDeliveryReportReceivedEventData(string sender = null, string recipient = null, string messageId = null, AcsEmailDeliveryReportStatus? status = null, DateTimeOffset? deliveryAttemptTimestamp = null) + { + return new AcsEmailDeliveryReportReceivedEventData(sender, recipient, messageId, status, deliveryAttemptTimestamp); + } + + /// Initializes a new instance of AcsEmailEngagementTrackingReportReceivedEventData. + /// The Sender Email Address. + /// The Id of the email that has been sent. + /// The time at which the user interacted with the email. + /// The context of the type of engagement user had with email. + /// The user agent interacting with the email. + /// The type of engagement user have with email. + /// A new instance for mocking. + public static AcsEmailEngagementTrackingReportReceivedEventData AcsEmailEngagementTrackingReportReceivedEventData(string sender = null, string messageId = null, DateTimeOffset? userActionTimestamp = null, string engagementContext = null, string userAgent = null, AcsUserEngagement? engagement = null) + { + return new AcsEmailEngagementTrackingReportReceivedEventData(sender, messageId, userActionTimestamp, engagementContext, userAgent, engagement); + } + /// Initializes a new instance of PolicyInsightsPolicyStateCreatedEventData. /// The time that the resource was scanned by Azure Policy in the Universal ISO 8601 DateTime format yyyy-MM-ddTHH:mm:ss.fffffffZ. /// The resource ID of the policy assignment. diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailDeliveryReportReceivedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailDeliveryReportReceivedEventData.Serialization.cs new file mode 100644 index 000000000000..6c5c48fb41e7 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailDeliveryReportReceivedEventData.Serialization.cs @@ -0,0 +1,84 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Text.Json.Serialization; +using Azure.Core; +using Azure.Messaging.EventGrid.Models; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + [JsonConverter(typeof(AcsEmailDeliveryReportReceivedEventDataConverter))] + public partial class AcsEmailDeliveryReportReceivedEventData + { + internal static AcsEmailDeliveryReportReceivedEventData DeserializeAcsEmailDeliveryReportReceivedEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sender = default; + Optional recipient = default; + Optional messageId = default; + Optional status = default; + Optional deliveryAttemptTimeStamp = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sender"u8)) + { + sender = property.Value.GetString(); + continue; + } + if (property.NameEquals("recipient"u8)) + { + recipient = property.Value.GetString(); + continue; + } + if (property.NameEquals("messageId"u8)) + { + messageId = property.Value.GetString(); + continue; + } + if (property.NameEquals("status"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + status = new AcsEmailDeliveryReportStatus(property.Value.GetString()); + continue; + } + if (property.NameEquals("deliveryAttemptTimeStamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + deliveryAttemptTimeStamp = property.Value.GetDateTimeOffset("O"); + continue; + } + } + return new AcsEmailDeliveryReportReceivedEventData(sender.Value, recipient.Value, messageId.Value, Optional.ToNullable(status), Optional.ToNullable(deliveryAttemptTimeStamp)); + } + + internal partial class AcsEmailDeliveryReportReceivedEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, AcsEmailDeliveryReportReceivedEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override AcsEmailDeliveryReportReceivedEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeAcsEmailDeliveryReportReceivedEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailDeliveryReportReceivedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailDeliveryReportReceivedEventData.cs new file mode 100644 index 000000000000..380a2ccb7445 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailDeliveryReportReceivedEventData.cs @@ -0,0 +1,47 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Messaging.EventGrid.Models; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.EmailDeliveryReportReceived event. + public partial class AcsEmailDeliveryReportReceivedEventData + { + /// Initializes a new instance of AcsEmailDeliveryReportReceivedEventData. + internal AcsEmailDeliveryReportReceivedEventData() + { + } + + /// Initializes a new instance of AcsEmailDeliveryReportReceivedEventData. + /// The Sender Email Address. + /// The recipient Email Address. + /// The Id of the email been sent. + /// The status of the email. + /// The time at which the email delivery report received timestamp. + internal AcsEmailDeliveryReportReceivedEventData(string sender, string recipient, string messageId, AcsEmailDeliveryReportStatus? status, DateTimeOffset? deliveryAttemptTimestamp) + { + Sender = sender; + Recipient = recipient; + MessageId = messageId; + Status = status; + DeliveryAttemptTimestamp = deliveryAttemptTimestamp; + } + + /// The Sender Email Address. + public string Sender { get; } + /// The recipient Email Address. + public string Recipient { get; } + /// The Id of the email been sent. + public string MessageId { get; } + /// The status of the email. + public AcsEmailDeliveryReportStatus? Status { get; } + /// The time at which the email delivery report received timestamp. + public DateTimeOffset? DeliveryAttemptTimestamp { get; } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailDeliveryReportStatus.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailDeliveryReportStatus.cs new file mode 100644 index 000000000000..4163a8a10cb1 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailDeliveryReportStatus.cs @@ -0,0 +1,57 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.ComponentModel; + +namespace Azure.Messaging.EventGrid.Models +{ + /// The status of the email. + public readonly partial struct AcsEmailDeliveryReportStatus : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AcsEmailDeliveryReportStatus(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string FailedValue = "Failed"; + private const string DeliveredValue = "Delivered"; + private const string FilteredSpamValue = "FilteredSpam"; + private const string QuarantinedValue = "Quarantined"; + + /// Failed. + public static AcsEmailDeliveryReportStatus Failed { get; } = new AcsEmailDeliveryReportStatus(FailedValue); + /// Delivered. + public static AcsEmailDeliveryReportStatus Delivered { get; } = new AcsEmailDeliveryReportStatus(DeliveredValue); + /// FilteredSpam. + public static AcsEmailDeliveryReportStatus FilteredSpam { get; } = new AcsEmailDeliveryReportStatus(FilteredSpamValue); + /// Quarantined. + public static AcsEmailDeliveryReportStatus Quarantined { get; } = new AcsEmailDeliveryReportStatus(QuarantinedValue); + /// Determines if two values are the same. + public static bool operator ==(AcsEmailDeliveryReportStatus left, AcsEmailDeliveryReportStatus right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AcsEmailDeliveryReportStatus left, AcsEmailDeliveryReportStatus right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AcsEmailDeliveryReportStatus(string value) => new AcsEmailDeliveryReportStatus(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AcsEmailDeliveryReportStatus other && Equals(other); + /// + public bool Equals(AcsEmailDeliveryReportStatus other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.Serialization.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.Serialization.cs new file mode 100644 index 000000000000..2025cf94fd7d --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.Serialization.cs @@ -0,0 +1,90 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using System.Text.Json; +using System.Text.Json.Serialization; +using Azure.Core; +using Azure.Messaging.EventGrid.Models; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + [JsonConverter(typeof(AcsEmailEngagementTrackingReportReceivedEventDataConverter))] + public partial class AcsEmailEngagementTrackingReportReceivedEventData + { + internal static AcsEmailEngagementTrackingReportReceivedEventData DeserializeAcsEmailEngagementTrackingReportReceivedEventData(JsonElement element) + { + if (element.ValueKind == JsonValueKind.Null) + { + return null; + } + Optional sender = default; + Optional messageId = default; + Optional userActionTimeStamp = default; + Optional engagementContext = default; + Optional userAgent = default; + Optional engagementType = default; + foreach (var property in element.EnumerateObject()) + { + if (property.NameEquals("sender"u8)) + { + sender = property.Value.GetString(); + continue; + } + if (property.NameEquals("messageId"u8)) + { + messageId = property.Value.GetString(); + continue; + } + if (property.NameEquals("userActionTimeStamp"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + userActionTimeStamp = property.Value.GetDateTimeOffset("O"); + continue; + } + if (property.NameEquals("engagementContext"u8)) + { + engagementContext = property.Value.GetString(); + continue; + } + if (property.NameEquals("userAgent"u8)) + { + userAgent = property.Value.GetString(); + continue; + } + if (property.NameEquals("engagementType"u8)) + { + if (property.Value.ValueKind == JsonValueKind.Null) + { + property.ThrowNonNullablePropertyIsNull(); + continue; + } + engagementType = new AcsUserEngagement(property.Value.GetString()); + continue; + } + } + return new AcsEmailEngagementTrackingReportReceivedEventData(sender.Value, messageId.Value, Optional.ToNullable(userActionTimeStamp), engagementContext.Value, userAgent.Value, Optional.ToNullable(engagementType)); + } + + internal partial class AcsEmailEngagementTrackingReportReceivedEventDataConverter : JsonConverter + { + public override void Write(Utf8JsonWriter writer, AcsEmailEngagementTrackingReportReceivedEventData model, JsonSerializerOptions options) + { + throw new NotImplementedException(); + } + public override AcsEmailEngagementTrackingReportReceivedEventData Read(ref Utf8JsonReader reader, Type typeToConvert, JsonSerializerOptions options) + { + using var document = JsonDocument.ParseValue(ref reader); + return DeserializeAcsEmailEngagementTrackingReportReceivedEventData(document.RootElement); + } + } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.cs new file mode 100644 index 000000000000..011b3c3e05b7 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsEmailEngagementTrackingReportReceivedEventData.cs @@ -0,0 +1,51 @@ +// Copyright (c) Microsoft Corporation. All rights reserved. +// Licensed under the MIT License. + +// + +#nullable disable + +using System; +using Azure.Messaging.EventGrid.Models; + +namespace Azure.Messaging.EventGrid.SystemEvents +{ + /// Schema of the Data property of an EventGridEvent for a Microsoft.Communication.EmailEngagementTrackingReportReceived event. + public partial class AcsEmailEngagementTrackingReportReceivedEventData + { + /// Initializes a new instance of AcsEmailEngagementTrackingReportReceivedEventData. + internal AcsEmailEngagementTrackingReportReceivedEventData() + { + } + + /// Initializes a new instance of AcsEmailEngagementTrackingReportReceivedEventData. + /// The Sender Email Address. + /// The Id of the email that has been sent. + /// The time at which the user interacted with the email. + /// The context of the type of engagement user had with email. + /// The user agent interacting with the email. + /// The type of engagement user have with email. + internal AcsEmailEngagementTrackingReportReceivedEventData(string sender, string messageId, DateTimeOffset? userActionTimestamp, string engagementContext, string userAgent, AcsUserEngagement? engagement) + { + Sender = sender; + MessageId = messageId; + UserActionTimestamp = userActionTimestamp; + EngagementContext = engagementContext; + UserAgent = userAgent; + Engagement = engagement; + } + + /// The Sender Email Address. + public string Sender { get; } + /// The Id of the email that has been sent. + public string MessageId { get; } + /// The time at which the user interacted with the email. + public DateTimeOffset? UserActionTimestamp { get; } + /// The context of the type of engagement user had with email. + public string EngagementContext { get; } + /// The user agent interacting with the email. + public string UserAgent { get; } + /// The type of engagement user have with email. + public AcsUserEngagement? Engagement { get; } + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsUserEngagement.cs b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsUserEngagement.cs new file mode 100644 index 000000000000..929c34aff207 --- /dev/null +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/Generated/Models/AcsUserEngagement.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.Messaging.EventGrid.Models +{ + /// The type of engagement user have with email. + public readonly partial struct AcsUserEngagement : IEquatable + { + private readonly string _value; + + /// Initializes a new instance of . + /// is null. + public AcsUserEngagement(string value) + { + _value = value ?? throw new ArgumentNullException(nameof(value)); + } + + private const string ViewValue = "view"; + private const string ClickValue = "click"; + + /// view. + public static AcsUserEngagement View { get; } = new AcsUserEngagement(ViewValue); + /// click. + public static AcsUserEngagement Click { get; } = new AcsUserEngagement(ClickValue); + /// Determines if two values are the same. + public static bool operator ==(AcsUserEngagement left, AcsUserEngagement right) => left.Equals(right); + /// Determines if two values are not the same. + public static bool operator !=(AcsUserEngagement left, AcsUserEngagement right) => !left.Equals(right); + /// Converts a string to a . + public static implicit operator AcsUserEngagement(string value) => new AcsUserEngagement(value); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override bool Equals(object obj) => obj is AcsUserEngagement other && Equals(other); + /// + public bool Equals(AcsUserEngagement other) => string.Equals(_value, other._value, StringComparison.InvariantCultureIgnoreCase); + + /// + [EditorBrowsable(EditorBrowsableState.Never)] + public override int GetHashCode() => _value?.GetHashCode() ?? 0; + /// + public override string ToString() => _value; + } +} diff --git a/sdk/eventgrid/Azure.Messaging.EventGrid/src/autorest.md b/sdk/eventgrid/Azure.Messaging.EventGrid/src/autorest.md index 99dc258deda6..0bbc39300d71 100644 --- a/sdk/eventgrid/Azure.Messaging.EventGrid/src/autorest.md +++ b/sdk/eventgrid/Azure.Messaging.EventGrid/src/autorest.md @@ -4,7 +4,9 @@ Run `dotnet build /t:GenerateCode` to generate code. ``` yaml title: EventGridClient -require: https://github.com/Azure/azure-rest-api-specs/blob/8ba5121a93e44a6ab53e4bc12a56f96829e47a91/specification/eventgrid/data-plane/readme.md +require: +- /mnt/vss/_work/1/s/azure-rest-api-specs/specification/eventgrid/data-plane/readme.md + generation1-convenience-client: true model-factory-for-hlc: - MediaJobOutputAsset @@ -159,3 +161,4 @@ directive: $.MediaLiveEventIngestHeartbeatEventData["properties"]["ingestDriftValue"]["x-ms-client-name"] = "IngestDriftValueInternal"; $.MediaLiveEventIngestHeartbeatEventData["properties"]["lastFragmentArrivalTime"]["format"] = "date-time"; ``` +