diff --git a/sdk/eventgrid/eventgrid/CHANGELOG.md b/sdk/eventgrid/eventgrid/CHANGELOG.md index a22c14414ab8..1e5eaeda88a3 100644 --- a/sdk/eventgrid/eventgrid/CHANGELOG.md +++ b/sdk/eventgrid/eventgrid/CHANGELOG.md @@ -2,6 +2,7 @@ ## 3.0.0-beta.2 (Unreleased) +- Added support for system events sent by the Azure Communication Services. ## 3.0.0-beta.1 (2020-09-08) diff --git a/sdk/eventgrid/eventgrid/review/eventgrid.api.md b/sdk/eventgrid/eventgrid/review/eventgrid.api.md index 8455b7ee664b..e8c3edb7eabb 100644 --- a/sdk/eventgrid/eventgrid/review/eventgrid.api.md +++ b/sdk/eventgrid/eventgrid/review/eventgrid.api.md @@ -10,6 +10,117 @@ import { KeyCredential } from '@azure/core-auth'; import { OperationOptions } from '@azure/core-http'; import { PipelineOptions } from '@azure/core-http'; +// @public +export interface ACSChatEventBase { + recipientId?: string; + threadId?: string; + transactionId?: string; +} + +// @public +export type ACSChatMemberAddedToThreadWithUserEventData = ACSChatThreadEventBase & { + time?: Date; + addedBy?: string; + memberAdded?: ACSChatThreadMember; +}; + +// @public +export type ACSChatMemberRemovedFromThreadWithUserEventData = ACSChatThreadEventBase & { + time?: Date; + removedBy?: string; + memberRemoved?: ACSChatThreadMember; +}; + +// @public +export type ACSChatMessageDeletedEventData = ACSChatMessageEventBase & { + deleteTime?: Date; +}; + +// @public +export type ACSChatMessageEditedEventData = ACSChatMessageEventBase & { + messageBody?: string; + editTime?: Date; +}; + +// @public +export type ACSChatMessageEventBase = ACSChatEventBase & { + messageId?: string; + senderId?: string; + senderDisplayName?: string; + composeTime?: Date; + type?: string; + version?: number; +}; + +// @public +export type ACSChatMessageReceivedEventData = ACSChatMessageEventBase & { + messageBody?: string; +}; + +// @public +export type ACSChatThreadCreatedWithUserEventData = ACSChatThreadEventBase & { + createdBy?: string; + properties?: { + [propertyName: string]: any; + }; + members?: ACSChatThreadMember[]; +}; + +// @public +export type ACSChatThreadEventBase = ACSChatEventBase & { + createTime?: Date; + version?: number; +}; + +// @public +export interface ACSChatThreadMember { + displayName?: string; + memberId?: string; +} + +// @public +export type ACSChatThreadPropertiesUpdatedPerUserEventData = ACSChatThreadEventBase & { + editedBy?: string; + editTime?: Date; + properties?: { + [propertyName: string]: any; + }; +}; + +// @public +export type ACSChatThreadWithUserDeletedEventData = ACSChatThreadEventBase & { + deletedBy?: string; + deleteTime?: Date; +}; + +// @public +export interface AcssmsDeliveryAttempt { + segmentsFailed?: number; + segmentsSucceeded?: number; + timestamp?: Date; +} + +// @public +export type AcssmsDeliveryReportReceivedEventData = AcssmsEventBase & { + deliveryStatus?: string; + deliveryStatusDetails?: string; + deliveryAttempts?: AcssmsDeliveryAttempt[]; + receivedTimestamp?: Date; +}; + +// @public +export interface AcssmsEventBase { + from?: string; + messageId?: string; + to?: string; +} + +// @public +export type AcssmsReceivedEventData = AcssmsEventBase & { + message?: string; + receivedTimestamp?: Date; +}; + // @public export type AppAction = "Restarted" | "Stopped" | "ChangedAppSettings" | "Started" | "Completed" | "Failed"; @@ -293,7 +404,7 @@ export function isSystemEvent(eventType: T, eve export function isSystemEvent(eventType: T, event: CloudEvent): event is CloudEvent; // @public -export type KnownSystemEventTypes = "Microsoft.AppConfiguration.KeyValueDeleted" | "Microsoft.AppConfiguration.KeyValueModified" | "Microsoft.ContainerRegistry.ImagePushed" | "Microsoft.ContainerRegistry.ImageDeleted" | "Microsoft.ContainerRegistry.ChartDeleted" | "Microsoft.ContainerRegistry.ChartPushed" | "Microsoft.Devices.DeviceCreated" | "Microsoft.Devices.DeviceDeleted" | "Microsoft.Devices.DeviceConnected" | "Microsoft.Devices.DeviceDisconnected" | "Microsoft.Devices.DeviceTelemetry" | "Microsoft.EventGrid.SubscriptionValidationEvent" | "Microsoft.EventGrid.SubscriptionDeletedEvent" | "Microsoft.EventHub.CaptureFileCreated" | "Microsoft.MachineLearningServices.DatasetDriftDetected" | "Microsoft.MachineLearningServices.ModelDeployed" | "Microsoft.MachineLearningServices.ModelRegistered" | "Microsoft.MachineLearningServices.RunCompleted" | "Microsoft.MachineLearningServices.RunStatusChanged" | "Microsoft.Maps.GeofenceEntered" | "Microsoft.Maps.GeofenceExited" | "Microsoft.Maps.GeofenceResult" | "Microsoft.Media.JobStateChange" | "Microsoft.Media.JobOutputStateChange" | "Microsoft.Media.JobScheduled" | "Microsoft.Media.JobProcessing" | "Microsoft.Media.JobCanceling" | "Microsoft.Media.JobFinished" | "Microsoft.Media.JobCanceled" | "Microsoft.Media.JobErrored" | "Microsoft.Media.JobOutputCanceled" | "Microsoft.Media.JobOutputCanceling" | "Microsoft.Media.JobOutputErrored" | "Microsoft.Media.JobOutputFinished" | "Microsoft.Media.JobOutputProcessing" | "Microsoft.Media.JobOutputScheduled" | "Microsoft.Media.JobOutputProgress" | "Microsoft.Media.LiveEventEncoderConnected" | "Microsoft.Media.LiveEventConnectionRejected" | "Microsoft.Media.LiveEventEncoderDisconnected" | "Microsoft.Media.LiveEventIncomingStreamReceived" | "Microsoft.Media.LiveEventIncomingStreamsOutOfSync" | "Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync" | "Microsoft.Media.LiveEventIncomingDataChunkDropped" | "Microsoft.Media.LiveEventIngestHeartbeat" | "Microsoft.Media.LiveEventTrackDiscontinuityDetected" | "Microsoft.Resources.ResourceWriteSuccess" | "Microsoft.Resources.ResourceWriteFailure" | "Microsoft.Resources.ResourceWriteCancel" | "Microsoft.Resources.ResourceDeleteSuccess" | "Microsoft.Resources.ResourceDeleteFailure" | "Microsoft.Resources.ResourceDeleteCancel" | "Microsoft.Resources.ResourceActionSuccess" | "Microsoft.Resources.ResourceActionFailure" | "Microsoft.Resources.ResourceActionCancel" | "Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners" | "Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListener" | "Microsoft.Storage.BlobCreated" | "Microsoft.Storage.BlobDeleted" | "Microsoft.Storage.BlobRenamed" | "Microsoft.Storage.DirectoryCreated" | "Microsoft.Storage.DirectoryDeleted" | "Microsoft.Storage.DirectoryRenamed" | "Microsoft.Storage.LifecyclePolicyCompleted" | "Microsoft.Web.AppUpdated" | "Microsoft.Web.BackupOperationStarted" | "Microsoft.Web.BackupOperationCompleted" | "Microsoft.Web.BackupOperationFailed" | "Microsoft.Web.RestoreOperationStarted" | "Microsoft.Web.RestoreOperationCompleted" | "Microsoft.Web.RestoreOperationFailed" | "Microsoft.Web.SlotSwapStarted" | "Microsoft.Web.SlotSwapCompleted" | "Microsoft.Web.SlotSwapFailed" | "Microsoft.Web.SlotSwapWithPreviewStarted" | "Microsoft.Web.SlotSwapWithPreviewCancelled" | "Microsoft.Web.AppServicePlanUpdated"; +export type KnownSystemEventTypes = "Microsoft.AppConfiguration.KeyValueDeleted" | "Microsoft.AppConfiguration.KeyValueModified" | "Microsoft.Communication.ChatMessageReceived" | "Microsoft.Communication.ChatMessageEdited" | "Microsoft.Communication.ChatMessageDeleted" | "Microsoft.Communication.ChatThreadCreatedWithUser" | "Microsoft.Communication.ChatThreadWithUserDeleted" | "Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser" | "Microsoft.Communication.ChatMemberAddedToThreadWithUser" | "Microsoft.Communication.ChatMemberRemovedFromThreadWithUser" | "Microsoft.Communication.SMSDeliveryReportReceived" | "Microsoft.Communication.SMSReceived" | "Microsoft.ContainerRegistry.ImagePushed" | "Microsoft.ContainerRegistry.ImageDeleted" | "Microsoft.ContainerRegistry.ChartDeleted" | "Microsoft.ContainerRegistry.ChartPushed" | "Microsoft.Devices.DeviceCreated" | "Microsoft.Devices.DeviceDeleted" | "Microsoft.Devices.DeviceConnected" | "Microsoft.Devices.DeviceDisconnected" | "Microsoft.Devices.DeviceTelemetry" | "Microsoft.EventGrid.SubscriptionValidationEvent" | "Microsoft.EventGrid.SubscriptionDeletedEvent" | "Microsoft.EventHub.CaptureFileCreated" | "Microsoft.MachineLearningServices.DatasetDriftDetected" | "Microsoft.MachineLearningServices.ModelDeployed" | "Microsoft.MachineLearningServices.ModelRegistered" | "Microsoft.MachineLearningServices.RunCompleted" | "Microsoft.MachineLearningServices.RunStatusChanged" | "Microsoft.Maps.GeofenceEntered" | "Microsoft.Maps.GeofenceExited" | "Microsoft.Maps.GeofenceResult" | "Microsoft.Media.JobStateChange" | "Microsoft.Media.JobOutputStateChange" | "Microsoft.Media.JobScheduled" | "Microsoft.Media.JobProcessing" | "Microsoft.Media.JobCanceling" | "Microsoft.Media.JobFinished" | "Microsoft.Media.JobCanceled" | "Microsoft.Media.JobErrored" | "Microsoft.Media.JobOutputCanceled" | "Microsoft.Media.JobOutputCanceling" | "Microsoft.Media.JobOutputErrored" | "Microsoft.Media.JobOutputFinished" | "Microsoft.Media.JobOutputProcessing" | "Microsoft.Media.JobOutputScheduled" | "Microsoft.Media.JobOutputProgress" | "Microsoft.Media.LiveEventEncoderConnected" | "Microsoft.Media.LiveEventConnectionRejected" | "Microsoft.Media.LiveEventEncoderDisconnected" | "Microsoft.Media.LiveEventIncomingStreamReceived" | "Microsoft.Media.LiveEventIncomingStreamsOutOfSync" | "Microsoft.Media.LiveEventIncomingVideoStreamsOutOfSync" | "Microsoft.Media.LiveEventIncomingDataChunkDropped" | "Microsoft.Media.LiveEventIngestHeartbeat" | "Microsoft.Media.LiveEventTrackDiscontinuityDetected" | "Microsoft.Resources.ResourceWriteSuccess" | "Microsoft.Resources.ResourceWriteFailure" | "Microsoft.Resources.ResourceWriteCancel" | "Microsoft.Resources.ResourceDeleteSuccess" | "Microsoft.Resources.ResourceDeleteFailure" | "Microsoft.Resources.ResourceDeleteCancel" | "Microsoft.Resources.ResourceActionSuccess" | "Microsoft.Resources.ResourceActionFailure" | "Microsoft.Resources.ResourceActionCancel" | "Microsoft.ServiceBus.ActiveMessagesAvailableWithNoListeners" | "Microsoft.ServiceBus.DeadletterMessagesAvailableWithNoListener" | "Microsoft.Storage.BlobCreated" | "Microsoft.Storage.BlobDeleted" | "Microsoft.Storage.BlobRenamed" | "Microsoft.Storage.DirectoryCreated" | "Microsoft.Storage.DirectoryDeleted" | "Microsoft.Storage.DirectoryRenamed" | "Microsoft.Storage.LifecyclePolicyCompleted" | "Microsoft.Web.AppUpdated" | "Microsoft.Web.BackupOperationStarted" | "Microsoft.Web.BackupOperationCompleted" | "Microsoft.Web.BackupOperationFailed" | "Microsoft.Web.RestoreOperationStarted" | "Microsoft.Web.RestoreOperationCompleted" | "Microsoft.Web.RestoreOperationFailed" | "Microsoft.Web.SlotSwapStarted" | "Microsoft.Web.SlotSwapCompleted" | "Microsoft.Web.SlotSwapFailed" | "Microsoft.Web.SlotSwapWithPreviewStarted" | "Microsoft.Web.SlotSwapWithPreviewCancelled" | "Microsoft.Web.AppServicePlanUpdated"; // @public export interface MachineLearningServicesDatasetDriftDetectedEventData { @@ -878,6 +989,16 @@ export interface SubscriptionValidationEventData { export interface SystemEventNameToEventData { "Microsoft.AppConfiguration.KeyValueDeleted": AppConfigurationKeyValueDeletedEventData; "Microsoft.AppConfiguration.KeyValueModified": AppConfigurationKeyValueModifiedEventData; + "Microsoft.Communication.ChatMemberAddedToThreadWithUser": ACSChatMemberAddedToThreadWithUserEventData; + "Microsoft.Communication.ChatMemberRemovedFromThreadWithUser": ACSChatMemberRemovedFromThreadWithUserEventData; + "Microsoft.Communication.ChatMessageDeleted": ACSChatMessageDeletedEventData; + "Microsoft.Communication.ChatMessageEdited": ACSChatMessageEditedEventData; + "Microsoft.Communication.ChatMessageReceived": ACSChatMessageReceivedEventData; + "Microsoft.Communication.ChatThreadCreatedWithUser": ACSChatThreadCreatedWithUserEventData; + "Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser": ACSChatThreadPropertiesUpdatedPerUserEventData; + "Microsoft.Communication.ChatThreadWithUserDeleted": ACSChatThreadWithUserDeletedEventData; + "Microsoft.Communication.SMSDeliveryReportReceived": AcssmsDeliveryReportReceivedEventData; + "Microsoft.Communication.SMSReceived": AcssmsReceivedEventData; "Microsoft.ContainerRegistry.ChartDeleted": ContainerRegistryChartDeletedEventData; "Microsoft.ContainerRegistry.ChartPushed": ContainerRegistryChartPushedEventData; "Microsoft.ContainerRegistry.ImageDeleted": ContainerRegistryImageDeletedEventData; diff --git a/sdk/eventgrid/eventgrid/src/generated/models/index.ts b/sdk/eventgrid/eventgrid/src/generated/models/index.ts index 386fbe28d891..34d4885fb8c9 100644 --- a/sdk/eventgrid/eventgrid/src/generated/models/index.ts +++ b/sdk/eventgrid/eventgrid/src/generated/models/index.ts @@ -3039,6 +3039,273 @@ export interface WebAppServicePlanUpdatedEventDataSku { capacity?: string; } +/** + * Schema of common properties of all chat events + */ +export interface ACSChatEventBase { + /** + * The MRI of the target user + */ + recipientId?: string; + /** + * The transaction id will be used as co-relation vector + */ + transactionId?: string; + /** + * The chat thread id + */ + threadId?: string; +} + +/** + * Schema of common properties of all chat message events + */ +export type ACSChatMessageEventBase = ACSChatEventBase & { + /** + * The chat message id + */ + messageId?: string; + /** + * The MRI of the sender + */ + senderId?: string; + /** + * The display name of the sender + */ + senderDisplayName?: string; + /** + * The original compose time of the message + */ + composeTime?: Date; + /** + * The type of the message + */ + type?: string; + /** + * The version of the message + */ + version?: number; +}; + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Communication.ChatMessageReceived event. + */ +export type ACSChatMessageReceivedEventData = ACSChatMessageEventBase & { + /** + * The body of the chat message + */ + messageBody?: string; +}; + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Communication.ChatMessageEdited event. + */ +export type ACSChatMessageEditedEventData = ACSChatMessageEventBase & { + /** + * The body of the chat message + */ + messageBody?: string; + /** + * The time at which the message was edited + */ + editTime?: Date; +}; + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Communication.ChatMessageDeleted event. + */ +export type ACSChatMessageDeletedEventData = ACSChatMessageEventBase & { + /** + * The time at which the message was deleted + */ + deleteTime?: Date; +}; + +/** + * Schema of common properties of all chat thread events + */ +export type ACSChatThreadEventBase = ACSChatEventBase & { + /** + * The original creation time of the thread + */ + createTime?: Date; + /** + * The version of the thread + */ + version?: number; +}; + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Communication.ChatThreadCreatedWithUser event. + */ +export type ACSChatThreadCreatedWithUserEventData = ACSChatThreadEventBase & { + /** + * The MRI of the creator of the thread + */ + createdBy?: string; + /** + * The thread properties + */ + properties?: { [propertyName: string]: any }; + /** + * The list of properties of users who are part of the thread + */ + members?: ACSChatThreadMember[]; +}; + +/** + * Schema of the chat thread member + */ +export interface ACSChatThreadMember { + /** + * The name of the user + */ + displayName?: string; + /** + * The MRI of the user + */ + memberId?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Communication.ChatThreadWithUserDeleted event. + */ +export type ACSChatThreadWithUserDeletedEventData = ACSChatThreadEventBase & { + /** + * The MRI of the user who deleted the thread + */ + deletedBy?: string; + /** + * The deletion time of the thread + */ + deleteTime?: Date; +}; + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser event. + */ +export type ACSChatThreadPropertiesUpdatedPerUserEventData = ACSChatThreadEventBase & { + /** + * The MRI of the user who updated the thread properties + */ + editedBy?: string; + /** + * The time at which the properties of the thread were updated + */ + editTime?: Date; + /** + * The updated thread properties + */ + properties?: { [propertyName: string]: any }; +}; + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Communication.ChatMemberAddedToThreadWithUser event. + */ +export type ACSChatMemberAddedToThreadWithUserEventData = ACSChatThreadEventBase & { + /** + * The time at which the user was added to the thread + */ + time?: Date; + /** + * The MRI of the user who added the user + */ + addedBy?: string; + /** + * The details of the user who was added + */ + memberAdded?: ACSChatThreadMember; +}; + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Communication.ChatMemberRemovedFromThreadWithUser event. + */ +export type ACSChatMemberRemovedFromThreadWithUserEventData = ACSChatThreadEventBase & { + /** + * The time at which the user was removed to the thread + */ + time?: Date; + /** + * The MRI of the user who removed the user + */ + removedBy?: string; + /** + * The details of the user who was removed + */ + memberRemoved?: ACSChatThreadMember; +}; + +/** + * Schema of common properties of all SMS events + */ +export interface AcssmsEventBase { + /** + * The identity of the SMS message + */ + messageId?: string; + /** + * The identity of SMS message sender + */ + from?: string; + /** + * The identity of SMS message receiver + */ + to?: string; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Communication.SMSDeliveryReportReceived event. + */ +export type AcssmsDeliveryReportReceivedEventData = AcssmsEventBase & { + /** + * Status of Delivery + */ + deliveryStatus?: string; + /** + * Details about Delivery Status + */ + deliveryStatusDetails?: string; + /** + * List of details of delivery attempts made + */ + deliveryAttempts?: AcssmsDeliveryAttempt[]; + /** + * The time at which the SMS delivery report was received + */ + receivedTimestamp?: Date; +}; + +/** + * Schema for details of a delivery attempt + */ +export interface AcssmsDeliveryAttempt { + /** + * TimeStamp when delivery was attempted + */ + timestamp?: Date; + /** + * Number of segments that were successfully delivered + */ + segmentsSucceeded?: number; + /** + * Number of segments whose delivery failed + */ + segmentsFailed?: number; +} + +/** + * Schema of the Data property of an EventGridEvent for an Microsoft.Communication.SMSReceived event. + */ +export type AcssmsReceivedEventData = AcssmsEventBase & { + /** + * The SMS content + */ + message?: string; + /** + * The time at which the SMS was received + */ + receivedTimestamp?: Date; +}; /** * Defines values for AppAction. */ diff --git a/sdk/eventgrid/eventgrid/src/generated/models/mappers.ts b/sdk/eventgrid/eventgrid/src/generated/models/mappers.ts index d28a0c5687f2..68a5ffadadd3 100644 --- a/sdk/eventgrid/eventgrid/src/generated/models/mappers.ts +++ b/sdk/eventgrid/eventgrid/src/generated/models/mappers.ts @@ -4807,6 +4807,430 @@ export const WebAppServicePlanUpdatedEventDataSku: coreHttp.CompositeMapper = { } }; +export const ACSChatEventBase: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ACSChatEventBase", + modelProperties: { + recipientId: { + serializedName: "recipientId", + type: { + name: "String" + } + }, + transactionId: { + serializedName: "transactionId", + type: { + name: "String" + } + }, + threadId: { + serializedName: "threadId", + type: { + name: "String" + } + } + } + } +}; + +export const ACSChatMessageEventBase: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ACSChatMessageEventBase", + modelProperties: { + ...ACSChatEventBase.type.modelProperties, + messageId: { + serializedName: "messageId", + type: { + name: "String" + } + }, + senderId: { + serializedName: "senderId", + type: { + name: "String" + } + }, + senderDisplayName: { + serializedName: "senderDisplayName", + type: { + name: "String" + } + }, + composeTime: { + serializedName: "composeTime", + type: { + name: "DateTime" + } + }, + type: { + serializedName: "type", + type: { + name: "String" + } + }, + version: { + serializedName: "version", + type: { + name: "Number" + } + } + } + } +}; + +export const ACSChatMessageReceivedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ACSChatMessageReceivedEventData", + modelProperties: { + ...ACSChatMessageEventBase.type.modelProperties, + messageBody: { + serializedName: "messageBody", + type: { + name: "String" + } + } + } + } +}; + +export const ACSChatMessageEditedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ACSChatMessageEditedEventData", + modelProperties: { + ...ACSChatMessageEventBase.type.modelProperties, + messageBody: { + serializedName: "messageBody", + type: { + name: "String" + } + }, + editTime: { + serializedName: "editTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const ACSChatMessageDeletedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ACSChatMessageDeletedEventData", + modelProperties: { + ...ACSChatMessageEventBase.type.modelProperties, + deleteTime: { + serializedName: "deleteTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const ACSChatThreadEventBase: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ACSChatThreadEventBase", + modelProperties: { + ...ACSChatEventBase.type.modelProperties, + createTime: { + serializedName: "createTime", + type: { + name: "DateTime" + } + }, + version: { + serializedName: "version", + type: { + name: "Number" + } + } + } + } +}; + +export const ACSChatThreadCreatedWithUserEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ACSChatThreadCreatedWithUserEventData", + modelProperties: { + ...ACSChatThreadEventBase.type.modelProperties, + createdBy: { + serializedName: "createdBy", + type: { + name: "String" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + }, + members: { + serializedName: "members", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "ACSChatThreadMember" } + } + } + } + } + } +}; + +export const ACSChatThreadMember: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ACSChatThreadMember", + modelProperties: { + displayName: { + serializedName: "displayName", + type: { + name: "String" + } + }, + memberId: { + serializedName: "memberId", + type: { + name: "String" + } + } + } + } +}; + +export const ACSChatThreadWithUserDeletedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ACSChatThreadWithUserDeletedEventData", + modelProperties: { + ...ACSChatThreadEventBase.type.modelProperties, + deletedBy: { + serializedName: "deletedBy", + type: { + name: "String" + } + }, + deleteTime: { + serializedName: "deleteTime", + type: { + name: "DateTime" + } + } + } + } +}; + +export const ACSChatThreadPropertiesUpdatedPerUserEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ACSChatThreadPropertiesUpdatedPerUserEventData", + modelProperties: { + ...ACSChatThreadEventBase.type.modelProperties, + editedBy: { + serializedName: "editedBy", + type: { + name: "String" + } + }, + editTime: { + serializedName: "editTime", + type: { + name: "DateTime" + } + }, + properties: { + serializedName: "properties", + type: { + name: "Dictionary", + value: { type: { name: "any" } } + } + } + } + } +}; + +export const ACSChatMemberAddedToThreadWithUserEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ACSChatMemberAddedToThreadWithUserEventData", + modelProperties: { + ...ACSChatThreadEventBase.type.modelProperties, + time: { + serializedName: "time", + type: { + name: "DateTime" + } + }, + addedBy: { + serializedName: "addedBy", + type: { + name: "String" + } + }, + memberAdded: { + serializedName: "memberAdded", + type: { + name: "Composite", + className: "ACSChatThreadMember" + } + } + } + } +}; + +export const ACSChatMemberRemovedFromThreadWithUserEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "ACSChatMemberRemovedFromThreadWithUserEventData", + modelProperties: { + ...ACSChatThreadEventBase.type.modelProperties, + time: { + serializedName: "time", + type: { + name: "DateTime" + } + }, + removedBy: { + serializedName: "removedBy", + type: { + name: "String" + } + }, + memberRemoved: { + serializedName: "memberRemoved", + type: { + name: "Composite", + className: "ACSChatThreadMember" + } + } + } + } +}; + +export const AcssmsEventBase: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AcssmsEventBase", + modelProperties: { + messageId: { + serializedName: "messageId", + type: { + name: "String" + } + }, + from: { + serializedName: "from", + type: { + name: "String" + } + }, + to: { + serializedName: "to", + type: { + name: "String" + } + } + } + } +}; + +export const AcssmsDeliveryReportReceivedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AcssmsDeliveryReportReceivedEventData", + modelProperties: { + ...AcssmsEventBase.type.modelProperties, + deliveryStatus: { + serializedName: "deliveryStatus", + type: { + name: "String" + } + }, + deliveryStatusDetails: { + serializedName: "deliveryStatusDetails", + type: { + name: "String" + } + }, + deliveryAttempts: { + serializedName: "deliveryAttempts", + type: { + name: "Sequence", + element: { + type: { name: "Composite", className: "AcssmsDeliveryAttempt" } + } + } + }, + receivedTimestamp: { + serializedName: "receivedTimestamp", + type: { + name: "DateTime" + } + } + } + } +}; + +export const AcssmsDeliveryAttempt: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AcssmsDeliveryAttempt", + modelProperties: { + timestamp: { + serializedName: "timestamp", + type: { + name: "DateTime" + } + }, + segmentsSucceeded: { + serializedName: "segmentsSucceeded", + type: { + name: "Number" + } + }, + segmentsFailed: { + serializedName: "segmentsFailed", + type: { + name: "Number" + } + } + } + } +}; + +export const AcssmsReceivedEventData: coreHttp.CompositeMapper = { + type: { + name: "Composite", + className: "AcssmsReceivedEventData", + modelProperties: { + ...AcssmsEventBase.type.modelProperties, + message: { + serializedName: "message", + type: { + name: "String" + } + }, + receivedTimestamp: { + serializedName: "receivedTimestamp", + type: { + name: "DateTime" + } + } + } + } +}; + export let discriminators = { MediaJobOutput: MediaJobOutput, "MediaJobOutput.#Microsoft.Media.JobOutputAsset": MediaJobOutputAsset diff --git a/sdk/eventgrid/eventgrid/src/index.ts b/sdk/eventgrid/eventgrid/src/index.ts index 0b9eb253d07b..ed357cb676e7 100644 --- a/sdk/eventgrid/eventgrid/src/index.ts +++ b/sdk/eventgrid/eventgrid/src/index.ts @@ -34,6 +34,22 @@ export { export { isSystemEvent, KnownSystemEventTypes, SystemEventNameToEventData } from "./predicates"; export { + ACSChatEventBase, + ACSChatMemberAddedToThreadWithUserEventData, + ACSChatMemberRemovedFromThreadWithUserEventData, + ACSChatMessageDeletedEventData, + ACSChatMessageEditedEventData, + ACSChatMessageEventBase, + ACSChatMessageReceivedEventData, + ACSChatThreadCreatedWithUserEventData, + ACSChatThreadEventBase, + ACSChatThreadMember, + ACSChatThreadPropertiesUpdatedPerUserEventData, + ACSChatThreadWithUserDeletedEventData, + AcssmsDeliveryAttempt, + AcssmsDeliveryReportReceivedEventData, + AcssmsEventBase, + AcssmsReceivedEventData, AppConfigurationKeyValueDeletedEventData, AppConfigurationKeyValueModifiedEventData, AppEventTypeDetail, diff --git a/sdk/eventgrid/eventgrid/src/predicates.ts b/sdk/eventgrid/eventgrid/src/predicates.ts index 805e9844e910..fe9f4fe486aa 100644 --- a/sdk/eventgrid/eventgrid/src/predicates.ts +++ b/sdk/eventgrid/eventgrid/src/predicates.ts @@ -2,6 +2,16 @@ // Licensed under the MIT license. import { + ACSChatMessageReceivedEventData, + ACSChatMessageEditedEventData, + ACSChatMessageDeletedEventData, + ACSChatThreadCreatedWithUserEventData, + ACSChatThreadWithUserDeletedEventData, + ACSChatThreadPropertiesUpdatedPerUserEventData, + ACSChatMemberAddedToThreadWithUserEventData, + ACSChatMemberRemovedFromThreadWithUserEventData, + AcssmsDeliveryReportReceivedEventData, + AcssmsReceivedEventData, AppConfigurationKeyValueDeletedEventData, AppConfigurationKeyValueModifiedEventData, ContainerRegistryImagePushedEventData, @@ -90,6 +100,16 @@ import { CloudEvent, EventGridEvent } from "./models"; export type KnownSystemEventTypes = | "Microsoft.AppConfiguration.KeyValueDeleted" | "Microsoft.AppConfiguration.KeyValueModified" + | "Microsoft.Communication.ChatMessageReceived" + | "Microsoft.Communication.ChatMessageEdited" + | "Microsoft.Communication.ChatMessageDeleted" + | "Microsoft.Communication.ChatThreadCreatedWithUser" + | "Microsoft.Communication.ChatThreadWithUserDeleted" + | "Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser" + | "Microsoft.Communication.ChatMemberAddedToThreadWithUser" + | "Microsoft.Communication.ChatMemberRemovedFromThreadWithUser" + | "Microsoft.Communication.SMSDeliveryReportReceived" + | "Microsoft.Communication.SMSReceived" | "Microsoft.ContainerRegistry.ImagePushed" | "Microsoft.ContainerRegistry.ImageDeleted" | "Microsoft.ContainerRegistry.ChartDeleted" @@ -172,6 +192,26 @@ export type KnownSystemEventTypes = * @ignore */ export interface SystemEventNameToEventData { + /** An interface for the event data of a "Microsoft.Communication.ChatMessageReceived" event. */ + "Microsoft.Communication.ChatMessageReceived": ACSChatMessageReceivedEventData; + /** An interface for the event data of a "Microsoft.Communication.ChatMessageEdited" event. */ + "Microsoft.Communication.ChatMessageEdited": ACSChatMessageEditedEventData; + /** An interface for the event data of a "Microsoft.Communication.ChatMessageDeleted" event. */ + "Microsoft.Communication.ChatMessageDeleted": ACSChatMessageDeletedEventData; + /** An interface for the event data of a "Microsoft.Communication.ChatThreadCreatedWithUser" event. */ + "Microsoft.Communication.ChatThreadCreatedWithUser": ACSChatThreadCreatedWithUserEventData; + /** An interface for the event data of a "Microsoft.Communication.ChatThreadWithUserDeleted" event. */ + "Microsoft.Communication.ChatThreadWithUserDeleted": ACSChatThreadWithUserDeletedEventData; + /** An interface for the event data of a "Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser" event. */ + "Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser": ACSChatThreadPropertiesUpdatedPerUserEventData; + /** An interface for the event data of a "Microsoft.Communication.ChatMemberAddedToThreadWithUser" event. */ + "Microsoft.Communication.ChatMemberAddedToThreadWithUser": ACSChatMemberAddedToThreadWithUserEventData; + /** An interface for the event data of a "Microsoft.Communication.ChatMemberRemovedFromThreadWithUser" event. */ + "Microsoft.Communication.ChatMemberRemovedFromThreadWithUser": ACSChatMemberRemovedFromThreadWithUserEventData; + /** An interface for the event data of a "Microsoft.Communication.SMSDeliveryReportReceived" event. */ + "Microsoft.Communication.SMSDeliveryReportReceived": AcssmsDeliveryReportReceivedEventData; + /** An interface for the event data of a "Microsoft.Communication.SMSReceived" event. */ + "Microsoft.Communication.SMSReceived": AcssmsReceivedEventData; /** An interface for the event data of a "Microsoft.AppConfiguration.KeyValueDeleted" event. */ "Microsoft.AppConfiguration.KeyValueDeleted": AppConfigurationKeyValueDeletedEventData; /** An interface for the event data of a "Microsoft.AppConfiguration.KeyValueModified" event. */ diff --git a/sdk/eventgrid/eventgrid/src/systemEventDecoders.ts b/sdk/eventgrid/eventgrid/src/systemEventDecoders.ts index 73e25ef0a48d..73ed6637afbc 100644 --- a/sdk/eventgrid/eventgrid/src/systemEventDecoders.ts +++ b/sdk/eventgrid/eventgrid/src/systemEventDecoders.ts @@ -4,6 +4,21 @@ import { Mapper, Serializer } from "@azure/core-http"; import { CustomEventDataDeserializer } from "./models"; import { + ACSChatMessageReceivedEventData, + ACSChatMessageEditedEventData, + ACSChatMessageDeletedEventData, + ACSChatThreadCreatedWithUserEventData, + ACSChatThreadWithUserDeletedEventData, + ACSChatThreadPropertiesUpdatedPerUserEventData, + ACSChatMemberAddedToThreadWithUserEventData, + ACSChatMemberRemovedFromThreadWithUserEventData, + AcssmsDeliveryReportReceivedEventData, + AcssmsReceivedEventData, + ACSChatMessageEventBase, + ACSChatEventBase, + ACSChatThreadMember, + AcssmsEventBase, + AcssmsDeliveryAttempt, AppConfigurationKeyValueDeletedEventData, AppConfigurationKeyValueModifiedEventData, AppEventTypeDetail, @@ -126,6 +141,21 @@ import { } from "./generated/models/mappers"; const serializer = new Serializer({ + ACSChatMessageReceivedEventData: ACSChatMessageReceivedEventData, + ACSChatMessageEditedEventData: ACSChatMessageEditedEventData, + ACSChatMessageDeletedEventData: ACSChatMessageDeletedEventData, + ACSChatThreadCreatedWithUserEventData: ACSChatThreadCreatedWithUserEventData, + ACSChatThreadWithUserDeletedEventData: ACSChatThreadWithUserDeletedEventData, + ACSChatThreadPropertiesUpdatedPerUserEventData: ACSChatThreadPropertiesUpdatedPerUserEventData, + ACSChatMemberAddedToThreadWithUserEventData: ACSChatMemberAddedToThreadWithUserEventData, + ACSChatMemberRemovedFromThreadWithUserEventData: ACSChatMemberRemovedFromThreadWithUserEventData, + AcssmsDeliveryReportReceivedEventData: AcssmsDeliveryReportReceivedEventData, + AcssmsReceivedEventData: AcssmsReceivedEventData, + ACSChatMessageEventBase: ACSChatMessageEventBase, + ACSChatEventBase: ACSChatEventBase, + ACSChatThreadMember: ACSChatThreadMember, + AcssmsEventBase: AcssmsEventBase, + AcssmsDeliveryAttempt: AcssmsDeliveryAttempt, AppConfigurationKeyValueDeletedEventData: AppConfigurationKeyValueDeletedEventData, AppConfigurationKeyValueModifiedEventData: AppConfigurationKeyValueModifiedEventData, AppEventTypeDetail: AppEventTypeDetail, @@ -281,6 +311,34 @@ export const systemDeserializers: Record = "Microsoft.AppConfiguration.KeyValueModified": makeDeserializerFromMapper( AppConfigurationKeyValueModifiedEventData ), + "Microsoft.Communication.ChatMessageReceived": makeDeserializerFromMapper( + ACSChatMessageReceivedEventData + ), + "Microsoft.Communication.ChatMessageEdited": makeDeserializerFromMapper( + ACSChatMessageEditedEventData + ), + "Microsoft.Communication.ChatMessageDeleted": makeDeserializerFromMapper( + ACSChatMessageDeletedEventData + ), + "Microsoft.Communication.ChatThreadCreatedWithUser": makeDeserializerFromMapper( + ACSChatThreadCreatedWithUserEventData + ), + "Microsoft.Communication.ChatThreadWithUserDeleted": makeDeserializerFromMapper( + ACSChatThreadWithUserDeletedEventData + ), + "Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser": makeDeserializerFromMapper( + ACSChatThreadPropertiesUpdatedPerUserEventData + ), + "Microsoft.Communication.ChatMemberAddedToThreadWithUser": makeDeserializerFromMapper( + ACSChatMemberAddedToThreadWithUserEventData + ), + "Microsoft.Communication.ChatMemberRemovedFromThreadWithUser": makeDeserializerFromMapper( + ACSChatMemberRemovedFromThreadWithUserEventData + ), + "Microsoft.Communication.SMSDeliveryReportReceived": makeDeserializerFromMapper( + AcssmsDeliveryReportReceivedEventData + ), + "Microsoft.Communication.SMSReceived": makeDeserializerFromMapper(AcssmsReceivedEventData), "Microsoft.ContainerRegistry.ChartDeleted": makeDeserializerFromMapper( ContainerRegistryEventData, [jsonParseDeserializer] diff --git a/sdk/eventgrid/eventgrid/swagger/README.md b/sdk/eventgrid/eventgrid/swagger/README.md index e7715dff4dd6..0e8df5a9df91 100644 --- a/sdk/eventgrid/eventgrid/swagger/README.md +++ b/sdk/eventgrid/eventgrid/swagger/README.md @@ -6,6 +6,7 @@ ```yaml package-name: "@azure/eventgrid" +package-version: "3.0.0-beta.2" title: GeneratedClient description: EventGrid Client generate-metadata: false @@ -14,21 +15,22 @@ license-header: MICROSOFT_MIT_NO_VERSION output-folder: ../ source-code-folder-path: ./src/generated input-file: -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Storage/stable/2018-01-01/Storage.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.EventHub/stable/2018-01-01/EventHub.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Resources/stable/2018-01-01/Resources.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.EventGrid/stable/2018-01-01/EventGrid.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Devices/stable/2018-01-01/IotHub.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.ContainerRegistry/stable/2018-01-01/ContainerRegistry.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.ServiceBus/stable/2018-01-01/ServiceBus.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Media/stable/2018-01-01/MediaServices.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Maps/stable/2018-01-01/Maps.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.AppConfiguration/stable/2018-01-01/AppConfiguration.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.SignalRService/stable/2018-01-01/SignalRService.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.KeyVault/stable/2018-01-01/KeyVault.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.MachineLearningServices/stable/2018-01-01/MachineLearningServices.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Cache/stable/2018-01-01/RedisCache.json -- https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Web/stable/2018-01-01/Web.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Storage/stable/2018-01-01/Storage.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.EventHub/stable/2018-01-01/EventHub.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Resources/stable/2018-01-01/Resources.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.EventGrid/stable/2018-01-01/EventGrid.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Devices/stable/2018-01-01/IotHub.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.ContainerRegistry/stable/2018-01-01/ContainerRegistry.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.ServiceBus/stable/2018-01-01/ServiceBus.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Media/stable/2018-01-01/MediaServices.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Maps/stable/2018-01-01/Maps.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.AppConfiguration/stable/2018-01-01/AppConfiguration.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.SignalRService/stable/2018-01-01/SignalRService.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.KeyVault/stable/2018-01-01/KeyVault.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.MachineLearningServices/stable/2018-01-01/MachineLearningServices.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Cache/stable/2018-01-01/RedisCache.json + - https://raw.githubusercontent.com/ellismg/azure-rest-api-specs/dev-eventgrid-Microsoft.EventGrid-2018-01-01/specification/eventgrid/data-plane/Microsoft.Web/stable/2018-01-01/Web.json + - https://raw.githubusercontent.com/Azure/azure-rest-api-specs/master/specification/eventgrid/data-plane/Microsoft.Communication/stable/2018-01-01/AzureCommunicationServices.json use-extension: "@autorest/typescript": "6.0.0-dev.20200618.1" ``` @@ -50,3 +52,17 @@ directive: }); }); ``` + +### Remove the "Properties" suffix from some Azure Communication Services types + +```yaml +directive: + - from: swagger-document + where: $.definitions + transform: > + ["ACSChatThreadEventBase", "ACSChatMessageEventBase", "ACSChatEventBase", "ACSChatThreadMember", "ACSSMSEventBase", "ACSSMSDeliveryAttempt"].forEach(cleanName => { + if ($[`${cleanName}Properties`]) { + $[`${cleanName}Properties`]["x-ms-client-name"] = cleanName; + } + }); +```