This repository was archived by the owner on Jan 5, 2026. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 493
Fix class structure for meeting notification feature extensibility #6579
Merged
Merged
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
libraries/Microsoft.Bot.Schema/Converters/SurfaceConverter.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,90 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System; | ||
| using Microsoft.Bot.Schema.Teams; | ||
| using Newtonsoft.Json; | ||
| using Newtonsoft.Json.Linq; | ||
|
|
||
| namespace Microsoft.Bot.Schema.Converters | ||
| { | ||
| /// <summary> | ||
| /// Converter which allows json to be expression to object or static object. | ||
| /// </summary> | ||
| public class SurfaceConverter : JsonConverter | ||
| { | ||
| /// <summary> | ||
| /// Gets a value indicating whether this Converter can write JSON. | ||
| /// </summary> | ||
| /// <value>true if this Converter can write JSON; otherwise, false.</value> | ||
| public override bool CanWrite => false; | ||
|
|
||
| /// <summary> | ||
| /// Gets a value indicating whether this Converter can read JSON. | ||
| /// </summary> | ||
| /// <value>true if this Converter can read JSON; otherwise, false.</value> | ||
| public override bool CanRead => true; | ||
|
|
||
| /// <summary> | ||
| /// Determines whether this instance can convert the specified object type. | ||
| /// </summary> | ||
| /// <param name="objectType">Type of the object.</param> | ||
| /// <returns> | ||
| /// <c>true</c> if this instance can convert the specified object type; otherwise, <c>false</c>. | ||
| /// </returns> | ||
| public override bool CanConvert(Type objectType) | ||
| { | ||
| return objectType == typeof(Surface); | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Reads the JSON representation of the object. | ||
| /// </summary> | ||
| /// <param name="reader">The <see cref="JsonReader"/> to read from.</param> | ||
| /// <param name="objectType">Type of the object.</param> | ||
| /// <param name="existingValue">The existing value of object being read.</param> | ||
| /// <param name="serializer">The calling serializer.</param> | ||
| /// <returns>The object value.</returns> | ||
| public override object ReadJson(JsonReader reader, Type objectType, object existingValue, JsonSerializer serializer) | ||
| { | ||
| var jsonObject = JObject.Load(reader); | ||
| var surfaceType = jsonObject.GetValue("surface", StringComparison.OrdinalIgnoreCase)?.ToObject<SurfaceType>(); | ||
|
|
||
| Surface parsedSurface; | ||
| switch (surfaceType) | ||
| { | ||
| case SurfaceType.MeetingStage: | ||
| var contentType = jsonObject.GetValue("contentType", StringComparison.OrdinalIgnoreCase)?.ToObject<ContentType>(); | ||
| parsedSurface = CreateMeetingStageSurfaceWithContentType(contentType); | ||
| break; | ||
| default: | ||
| throw new ArgumentException($"Invalid surface type: {surfaceType}"); | ||
| } | ||
|
|
||
| serializer.Populate(jsonObject.CreateReader(), parsedSurface); | ||
| return parsedSurface; | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Writes the JSON representation of the object. | ||
| /// </summary> | ||
| /// <param name="writer">The Newtonsoft.Json.JsonWriter to write to.</param> | ||
| /// <param name="value">The value.</param> | ||
| /// <param name="serializer">The calling serializer.</param> | ||
| public override void WriteJson(JsonWriter writer, object value, JsonSerializer serializer) | ||
| { | ||
| throw new NotSupportedException(); | ||
| } | ||
|
|
||
| private static Surface CreateMeetingStageSurfaceWithContentType(ContentType? contentType) | ||
| { | ||
| switch (contentType) | ||
| { | ||
| case ContentType.Task: | ||
| return new MeetingStageSurface<TaskModuleContinueResponse>(); | ||
| default: | ||
| throw new ArgumentException($"Invalid content type: {contentType}"); | ||
| } | ||
| } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,21 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.Bot.Schema.Teams | ||
| { | ||
| /// <summary> | ||
| /// Defines content type. Depending on contentType, content field will have a different structure. | ||
| /// </summary> | ||
| public enum ContentType | ||
| { | ||
| /// <summary> | ||
| /// Content type is Unknown. | ||
| /// </summary> | ||
| Unknown, | ||
|
|
||
| /// <summary> | ||
| /// Content type is Task. | ||
| /// </summary> | ||
| Task | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
libraries/Microsoft.Bot.Schema/Teams/MeetingNotification.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.Bot.Schema.Teams | ||
| { | ||
| using Newtonsoft.Json; | ||
|
|
||
| /// <summary> | ||
| /// Specifies Bot meeting notification including meeting notification value. | ||
| /// </summary> | ||
| /// <typeparam name="T">The first generic type parameter.</typeparam>. | ||
| public class MeetingNotification<T> : MeetingNotificationBase | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="MeetingNotification{T}"/> class. | ||
| /// </summary> | ||
| protected MeetingNotification() | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets Teams Bot meeting notification value. | ||
| /// </summary> | ||
| /// <value> | ||
| /// Teams Bot meeting notification value. | ||
| /// </value> | ||
| [JsonProperty(PropertyName = "value")] | ||
| public T Value { get; set; } | ||
| } | ||
| } |
29 changes: 29 additions & 0 deletions
29
libraries/Microsoft.Bot.Schema/Teams/MeetingNotificationBase.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using Newtonsoft.Json; | ||
|
|
||
| namespace Microsoft.Bot.Schema.Teams | ||
| { | ||
| /// <summary> | ||
| /// Specifies Bot meeting notification base including channel data and type. | ||
| /// </summary> | ||
| public class MeetingNotificationBase | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="MeetingNotificationBase"/> class. | ||
| /// </summary> | ||
| protected MeetingNotificationBase() | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets type of Bot meeting notification. | ||
| /// </summary> | ||
| /// <value> | ||
| /// Bot meeting notification type. | ||
| /// </value> | ||
| [JsonProperty("type")] | ||
| public string Type { get; set; } | ||
| } | ||
| } |
30 changes: 30 additions & 0 deletions
30
libraries/Microsoft.Bot.Schema/Teams/MeetingNotificationChannelData.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,30 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.Bot.Schema.Teams | ||
| { | ||
| using System.Collections.Generic; | ||
| using Newtonsoft.Json; | ||
|
|
||
| /// <summary> | ||
| /// Specify Teams Bot meeting notification channel data. | ||
| /// </summary> | ||
| public class MeetingNotificationChannelData | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="MeetingNotificationChannelData"/> class. | ||
| /// </summary> | ||
| public MeetingNotificationChannelData() | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the OnBehalfOf list for user attribution. | ||
| /// </summary> | ||
| /// <value>The Teams Bot meeting notification's OnBehalfOf list.</value> | ||
| #pragma warning disable CA2227 // Collection properties should be read only (we can't change this without breaking binary compat)> | ||
| [JsonProperty(PropertyName = "OnBehalfOf")] | ||
| public IList<OnBehalfOf> OnBehalfOfList { get; set; } | ||
| #pragma warning restore CA2227 // Collection properties should be read only | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
31 changes: 31 additions & 0 deletions
31
libraries/Microsoft.Bot.Schema/Teams/MeetingNotificationResponse.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,31 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| using System.Collections.Generic; | ||
| using Newtonsoft.Json; | ||
|
|
||
| namespace Microsoft.Bot.Schema.Teams | ||
| { | ||
| /// <summary> | ||
| /// Specifies Bot meeting notification response. | ||
| /// Contains list of <see cref="MeetingNotificationRecipientFailureInfo"/>. | ||
| /// </summary> | ||
| public class MeetingNotificationResponse | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="MeetingNotificationResponse"/> class. | ||
| /// </summary> | ||
| public MeetingNotificationResponse() | ||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the list of <see cref="MeetingNotificationRecipientFailureInfo"/>. | ||
| /// </summary> | ||
| /// <value>The list of <see cref="MeetingNotificationRecipientFailureInfo"/>.</value> | ||
| [JsonProperty(PropertyName = "recipientsFailureInfo")] | ||
| #pragma warning disable CA2227 // Collection properties should be read only (we can't change this without breaking binary compat)> | ||
| public IList<MeetingNotificationRecipientFailureInfo> RecipientsFailureInfo { get; set; } | ||
| #pragma warning restore CA2227 // Collection properties should be read only | ||
| } | ||
| } |
42 changes: 42 additions & 0 deletions
42
libraries/Microsoft.Bot.Schema/Teams/MeetingStageSurface.cs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,42 @@ | ||
| // Copyright (c) Microsoft Corporation. All rights reserved. | ||
| // Licensed under the MIT License. | ||
|
|
||
| namespace Microsoft.Bot.Schema.Teams | ||
| { | ||
| using Newtonsoft.Json; | ||
| using Newtonsoft.Json.Converters; | ||
|
|
||
| /// <summary> | ||
| /// Specifies meeting stage surface. | ||
| /// </summary> | ||
| /// <typeparam name="T">The first generic type parameter.</typeparam>. | ||
| public class MeetingStageSurface<T> : Surface | ||
| { | ||
| /// <summary> | ||
| /// Initializes a new instance of the <see cref="MeetingStageSurface{T}"/> class. | ||
| /// </summary> | ||
| public MeetingStageSurface() | ||
| : base(SurfaceType.MeetingStage) | ||
yingduyingdu marked this conversation as resolved.
Show resolved
Hide resolved
|
||
| { | ||
| } | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the content type of this <see cref="MeetingStageSurface{T}"/>. | ||
| /// </summary> | ||
| /// <value> | ||
| /// The content type of this <see cref="MeetingStageSurface{T}"/>. | ||
| /// </value> | ||
| [JsonConverter(typeof(StringEnumConverter))] | ||
| [JsonProperty(PropertyName = "contentType")] | ||
| public ContentType ContentType { get; set; } = ContentType.Task; | ||
|
|
||
| /// <summary> | ||
| /// Gets or sets the content for this <see cref="MeetingStageSurface{T}"/>. | ||
| /// </summary> | ||
| /// <value> | ||
| /// The content of this <see cref="MeetingStageSurface{T}"/>. | ||
| /// </value> | ||
| [JsonProperty(PropertyName = "content")] | ||
| public T Content { get; set; } | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.