Skip to content

Commit

Permalink
[EventGrid] Fix ACS Event Names
Browse files Browse the repository at this point in the history
The Azure Communication Services team noticed that some of their event
shapes were wrong and have [updated the
swagger](Azure/azure-rest-api-specs#13485) to
address this.

This commit pulls these changes into our SDK.

Fixes Azure#14345
  • Loading branch information
ellismg committed Mar 22, 2021
1 parent 9e0d3a8 commit e2c47af
Show file tree
Hide file tree
Showing 7 changed files with 162 additions and 8 deletions.
3 changes: 3 additions & 0 deletions sdk/eventgrid/eventgrid/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@

## 4.0.1 (Unreleased)

- Add `Microsoft.Communication.ChatThreadParticipantAdded` and `Microsoft.Communication.ChatThreadParticipantRemoved` to the list of System Event types. These replace
`Microsoft.Communication.ChatParticipantAddedToThread` and `Microsoft.Communication.ChatParticipantRemovedFromThread` respectively. Azure Communication Services no
longer sends events with these older names.

## 4.0.0 (2021-03-17)

Expand Down
4 changes: 2 additions & 2 deletions sdk/eventgrid/eventgrid/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@
"//metadata": {
"constantPaths": [
{
"path": "src/generated/generatedClientContext.ts",
"prefix": "packageVersion"
"path": "swagger/README.md",
"prefix": "package-version"
},
{
"path": "src/constants.ts",
Expand Down
6 changes: 6 additions & 0 deletions sdk/eventgrid/eventgrid/review/eventgrid.api.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@ export interface AcsChatEventBase {
// @public
export interface AcsChatEventInThreadBase {
threadId: string;
transactionId: string;
}

// @public
Expand Down Expand Up @@ -128,6 +129,7 @@ export type AcsSmsDeliveryReportReceivedEventData = AcsSmsEventBase & {
deliveryStatusDetails: string;
deliveryAttempts: AcsSmsDeliveryAttempt[];
receivedTimestamp: string;
tag: string;
};

// @public
Expand Down Expand Up @@ -1172,11 +1174,15 @@ export interface SystemEventNameToEventData {
"Microsoft.Communication.ChatMessageDeleted": AcsChatMessageDeletedEventData;
"Microsoft.Communication.ChatMessageEdited": AcsChatMessageEditedEventData;
"Microsoft.Communication.ChatMessageReceived": AcsChatMessageReceivedEventData;
// @deprecated
"Microsoft.Communication.ChatParticipantAddedToThread": AcsChatParticipantAddedToThreadEventData;
"Microsoft.Communication.ChatParticipantAddedToThreadWithUser": AcsChatParticipantAddedToThreadWithUserEventData;
// @deprecated
"Microsoft.Communication.ChatParticipantRemovedFromThread": AcsChatParticipantRemovedFromThreadEventData;
"Microsoft.Communication.ChatParticipantRemovedFromThreadWithUser": AcsChatParticipantRemovedFromThreadWithUserEventData;
"Microsoft.Communication.ChatThreadCreatedWithUser": AcsChatThreadCreatedWithUserEventData;
"Microsoft.Communication.ChatThreadParticipantAdded": AcsChatParticipantAddedToThreadEventData;
"Microsoft.Communication.ChatThreadParticipantRemoved": AcsChatParticipantRemovedFromThreadEventData;
"Microsoft.Communication.ChatThreadPropertiesUpdatedPerUser": AcsChatThreadPropertiesUpdatedPerUserEventData;
"Microsoft.Communication.ChatThreadWithUserDeleted": AcsChatThreadWithUserDeletedEventData;
"Microsoft.Communication.SMSDeliveryReportReceived": AcsSmsDeliveryReportReceivedEventData;
Expand Down
36 changes: 34 additions & 2 deletions sdk/eventgrid/eventgrid/src/generated/models/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -1864,6 +1864,8 @@ export interface AcsChatEventBase {

/** Schema of common properties of all thread-level chat events */
export interface AcsChatEventInThreadBase {
/** The transaction id will be used as co-relation vector */
transactionId: string;
/** The chat thread id */
threadId: string;
}
Expand Down Expand Up @@ -1896,6 +1898,34 @@ export interface AcsSmsEventBase {
to: string;
}

/** Schema of the Data property of an EventGridEvent for an Microsoft.Communication.RecordingFileStatusUpdated event. */
export interface AcsRecordingFileStatusUpdatedEventData {
/** The details of recording storage information */
recordingStorageInfo: AcsRecordingStorageInfo;
/** The time at which the recording started */
recordingStartTime: string;
/** The recording duration in milliseconds */
recordingDurationMs: number;
/** The reason for ending recording session */
sessionEndReason: string;
}

/** Schema for all properties of Recording Storage Information. */
export interface AcsRecordingStorageInfo {
/** List of details of recording chunks information */
recordingChunks: AcsRecordingChunkInfo[];
}

/** Schema for all properties of Recording Chunk Information. */
export interface AcsRecordingChunkInfo {
/** The documentId of the recording chunk */
documentId: string;
/** The index of the recording chunk */
index: number;
/** The reason for ending the recording chunk */
endReason: string;
}

/** Event data for Microsoft.Devices.DeviceCreated event. */
export type IotHubDeviceCreatedEventData = DeviceLifeCycleEvent & {};

Expand Down Expand Up @@ -2033,7 +2063,7 @@ export type AcsChatThreadEventInThreadBase = AcsChatEventInThreadBase & {
version: number;
};

/** Schema of the Data property of an EventGridEvent for an Microsoft.Communication.ChatParticipantAddedToThread event. */
/** Schema of the Data property of an EventGridEvent for an Microsoft.Communication.ChatThreadParticipantAdded event. */
export type AcsChatParticipantAddedToThreadEventData = AcsChatEventInThreadBase & {
/** The time at which the user was added to the thread */
time: string;
Expand All @@ -2045,7 +2075,7 @@ export type AcsChatParticipantAddedToThreadEventData = AcsChatEventInThreadBase
version: number;
};

/** Schema of the Data property of an EventGridEvent for an Microsoft.Communication.ChatParticipantRemovedFromThread event. */
/** Schema of the Data property of an EventGridEvent for an Microsoft.Communication.ChatThreadParticipantRemoved event. */
export type AcsChatParticipantRemovedFromThreadEventData = AcsChatEventInThreadBase & {
/** The time at which the user was removed to the thread */
time: string;
Expand All @@ -2067,6 +2097,8 @@ export type AcsSmsDeliveryReportReceivedEventData = AcsSmsEventBase & {
deliveryAttempts: AcsSmsDeliveryAttempt[];
/** The time at which the SMS delivery report was received */
receivedTimestamp: string;
/** Customer Content */
tag: string;
};

/** Schema of the Data property of an EventGridEvent for an Microsoft.Communication.SMSReceived event. */
Expand Down
103 changes: 103 additions & 0 deletions sdk/eventgrid/eventgrid/src/generated/models/mappers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5350,6 +5350,13 @@ export const AcsChatEventInThreadBase: CompositeMapper = {
name: "Composite",
className: "AcsChatEventInThreadBase",
modelProperties: {
transactionId: {
serializedName: "transactionId",
required: true,
type: {
name: "String"
}
},
threadId: {
serializedName: "threadId",
required: true,
Expand Down Expand Up @@ -5444,6 +5451,95 @@ export const AcsSmsEventBase: CompositeMapper = {
}
};

export const AcsRecordingFileStatusUpdatedEventData: CompositeMapper = {
type: {
name: "Composite",
className: "AcsRecordingFileStatusUpdatedEventData",
modelProperties: {
recordingStorageInfo: {
serializedName: "recordingStorageInfo",
type: {
name: "Composite",
className: "AcsRecordingStorageInfo"
}
},
recordingStartTime: {
serializedName: "recordingStartTime",
required: true,
type: {
name: "String"
}
},
recordingDurationMs: {
serializedName: "recordingDurationMs",
required: true,
type: {
name: "Number"
}
},
sessionEndReason: {
serializedName: "sessionEndReason",
required: true,
type: {
name: "String"
}
}
}
}
};

export const AcsRecordingStorageInfo: CompositeMapper = {
type: {
name: "Composite",
className: "AcsRecordingStorageInfo",
modelProperties: {
recordingChunks: {
serializedName: "recordingChunks",
required: true,
type: {
name: "Sequence",
element: {
type: {
name: "Composite",
className: "AcsRecordingChunkInfo"
}
}
}
}
}
}
};

export const AcsRecordingChunkInfo: CompositeMapper = {
type: {
name: "Composite",
className: "AcsRecordingChunkInfo",
modelProperties: {
documentId: {
serializedName: "documentId",
required: true,
type: {
name: "String"
}
},
index: {
serializedName: "index",
required: true,
type: {
name: "Number"
}
},
endReason: {
serializedName: "endReason",
required: true,
type: {
name: "String"
}
}
}
}
};

export const IotHubDeviceCreatedEventData: CompositeMapper = {
type: {
name: "Composite",
Expand Down Expand Up @@ -6022,6 +6118,13 @@ export const AcsSmsDeliveryReportReceivedEventData: CompositeMapper = {
type: {
name: "String"
}
},
tag: {
serializedName: "tag",
required: true,
type: {
name: "String"
}
}
}
}
Expand Down
14 changes: 12 additions & 2 deletions sdk/eventgrid/eventgrid/src/predicates.ts
Original file line number Diff line number Diff line change
Expand Up @@ -127,12 +127,22 @@ export interface SystemEventNameToEventData {
"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.ChatParticipantAddedToThread" event. */
/** An interface for the event data of a "Microsoft.Communication.ChatParticipantAddedToThread" event.
*
* @deprecated since 4.0.1. Azure Communication Services no longer uses this event name. Please use Microsoft.Communication.ChatThreadParticipantAdded instead.
*/
"Microsoft.Communication.ChatParticipantAddedToThread": AcsChatParticipantAddedToThreadEventData;
/** An interface for the event data of a "Microsoft.Communication.ChatThreadParticipantAdded" event. */
"Microsoft.Communication.ChatThreadParticipantAdded": AcsChatParticipantAddedToThreadEventData;
/** An interface for the event data of a "Microsoft.Communication.ChatParticipantAddedToThreadWithUser" event. */
"Microsoft.Communication.ChatParticipantAddedToThreadWithUser": AcsChatParticipantAddedToThreadWithUserEventData;
/** An interface for the event data of a "Microsoft.Communication.ChatParticipantRemovedFromThread" event. */
/** An interface for the event data of a "Microsoft.Communication.ChatParticipantRemovedFromThread" event.
*
* @deprecated since 4.0.1. Azure Communication Services no longer uses this event name. Please use Microsoft.Communication.ChatThreadParticipantRemoved instead.
*/
"Microsoft.Communication.ChatParticipantRemovedFromThread": AcsChatParticipantRemovedFromThreadEventData;
/** An interface for the event data of a "Microsoft.Communication.ChatThreadParticipantRemoved" event. */
"Microsoft.Communication.ChatThreadParticipantRemoved": AcsChatParticipantRemovedFromThreadEventData;
/** An interface for the event data of a "Microsoft.Communication.ChatParticipantRemovedFromThreadWithUser" event. */
"Microsoft.Communication.ChatParticipantRemovedFromThreadWithUser": AcsChatParticipantRemovedFromThreadWithUserEventData;
/** An interface for the event data of a "Microsoft.Communication.SMSDeliveryReportReceived" event. */
Expand Down
4 changes: 2 additions & 2 deletions sdk/eventgrid/eventgrid/swagger/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@
## Configuration

```yaml
require: "https://github.com/Azure/azure-rest-api-specs/blob/bd75cbc7ae9c997f39362ac9d19d557219720bbd/specification/eventgrid/data-plane/readme.md"
require: "https://github.com/Azure/azure-rest-api-specs/blob/cf9d9c44d990d82a763cf8c23a324de337e387a5/specification/eventgrid/data-plane/readme.md"
package-name: "@azure/eventgrid"
package-version: "4.0.0"
package-version: "4.0.1"
title: GeneratedClient
description: EventGrid Client
generate-metadata: false
Expand Down

0 comments on commit e2c47af

Please sign in to comment.