tags)
31 | {
32 | string result = "";
33 | if (tags.Contains(node.Name))
34 | {
35 | result += node.OuterHtml;
36 | }
37 | else
38 | {
39 | foreach (HtmlNode childNode in node.ChildNodes)
40 | {
41 | if (childNode.NodeType == HtmlNodeType.Text)
42 | {
43 | result += childNode.InnerText;
44 | }
45 | else
46 | {
47 | result += StripHtmlTags(childNode, tags);
48 | }
49 | }
50 | }
51 | return result;
52 | }
53 | }
54 | }
55 |
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Abstractions.Teams/ConversationUpdate/TeamEventBase.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Licensed under the MIT License.
3 | //
4 |
5 | namespace Microsoft.Bot.Builder.Abstractions.Teams.ConversationUpdate
6 | {
7 | using Microsoft.Bot.Schema.Teams;
8 |
9 | ///
10 | /// Type of team event.
11 | ///
12 | public enum TeamEventType
13 | {
14 | ///
15 | /// Members added.
16 | ///
17 | MembersAdded,
18 |
19 | ///
20 | /// Members removed.
21 | ///
22 | MembersRemoved,
23 |
24 | ///
25 | /// New channel created in a team.
26 | ///
27 | ChannelCreated,
28 |
29 | ///
30 | /// Channel deleted from a team.
31 | ///
32 | ChannelDeleted,
33 |
34 | ///
35 | /// Channel was renamed.
36 | ///
37 | ChannelRenamed,
38 |
39 | ///
40 | /// Team was renamed.
41 | ///
42 | TeamRenamed,
43 | }
44 |
45 | ///
46 | /// Base class for events generated for teams.
47 | ///
48 | public abstract class TeamEventBase
49 | {
50 | ///
51 | /// Gets the event type.
52 | ///
53 | public abstract TeamEventType EventType { get; }
54 |
55 | ///
56 | /// Gets the team for the event.
57 | ///
58 | public TeamInfo Team { get; internal set; }
59 |
60 | ///
61 | /// Gets the tenant for the team.
62 | ///
63 | public TenantInfo Tenant { get; internal set; }
64 |
65 | ///
66 | /// Gets the original activity.
67 | ///
68 | public ITurnContext TurnContext { get; internal set; }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/ChannelInfo.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// A channel info object which describes the channel.
18 | ///
19 | public partial class ChannelInfo
20 | {
21 | ///
22 | /// Initializes a new instance of the ChannelInfo class.
23 | ///
24 | public ChannelInfo()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the ChannelInfo class.
31 | ///
32 | /// Unique identifier representing a channel
33 | /// Name of the channel
34 | public ChannelInfo(string id = default(string), string name = default(string))
35 | {
36 | Id = id;
37 | Name = name;
38 | CustomInit();
39 | }
40 |
41 | ///
42 | /// An initialization method that performs custom operations like setting defaults
43 | ///
44 | partial void CustomInit();
45 |
46 | ///
47 | /// Gets or sets unique identifier representing a channel
48 | ///
49 | [JsonProperty(PropertyName = "id")]
50 | public string Id { get; set; }
51 |
52 | ///
53 | /// Gets or sets name of the channel
54 | ///
55 | [JsonProperty(PropertyName = "name")]
56 | public string Name { get; set; }
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/Jsons/SampleActivity2AtMentions.json:
--------------------------------------------------------------------------------
1 | {
2 | "text": "Test Bot 1 TestBot2 TestMessage",
3 | "textFormat": "plain",
4 | "attachments": [
5 | {
6 | "contentType": "text/html",
7 | "content": "Test Bot 1 TestBot2 TestMessage
"
8 | }
9 | ],
10 | "type": "message",
11 | "timestamp": "2017-04-25T22:14:10.626Z",
12 | "id": "1493158451219",
13 | "channelId": "msteams",
14 | "serviceUrl": "https://smba.trafficmanager.net/amer-client-ss.msg/",
15 | "from": {
16 | "id": "29:15WjgbDbuckdlwGz_Maqg6r0H3tKwOhZaj9VCKO4O20VD-hULRlwweUaiXT_dimbE6tEjtkfJPhav6pC8Eh9tbQ",
17 | "name": "Test"
18 | },
19 | "conversation": {
20 | "isGroup": true,
21 | "id": "19:ChannelID@thread.skype;messageid=1493158451000"
22 | },
23 | "recipient": {
24 | "id": "28:310f9d19-f5e7-4b13-a535-75f25f36232e",
25 | "name": "TestBot2"
26 | },
27 | "entities": [
28 | {
29 | "mentioned": {
30 | "id": "28:e2f318df-469d-4494-8efd-d6e16da873be",
31 | "name": "Test Bot 1"
32 | },
33 | "text": "Test Bot 1",
34 | "type": "mention"
35 | },
36 | {
37 | "mentioned": {
38 | "id": "28:310f9d19-f5e7-4b13-a535-75f25f36232e",
39 | "name": "TestBot2"
40 | },
41 | "text": "TestBot2",
42 | "type": "mention"
43 | },
44 | {
45 | "locale": "en-US",
46 | "country": "US",
47 | "platform": "Windows",
48 | "type": "clientInfo"
49 | }
50 | ],
51 | "channelData": {
52 | "channel": {
53 | "id": "19:ChannelID@thread.skype"
54 | },
55 | "team": {
56 | "id": "19:TeamID@thread.skype"
57 | },
58 | "tenant": {
59 | "id": "b401cedf-7465-4c41-8f52-9b31a19f6826"
60 | }
61 | }
62 | }
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.RemindMeBot/Microsoft.Bot.Builder.Teams.RemindMeBot.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 |
6 |
7 |
8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset
9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml
10 | Full
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | all
24 | runtime; build; native; contentfiles; analyzers
25 |
26 |
27 |
28 |
29 |
30 | all
31 | runtime; build; native; contentfiles; analyzers
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 | PreserveNewest
42 |
43 |
44 |
45 |
46 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardFact.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// O365 connector card fact
18 | ///
19 | public partial class O365ConnectorCardFact
20 | {
21 | ///
22 | /// Initializes a new instance of the O365ConnectorCardFact class.
23 | ///
24 | public O365ConnectorCardFact()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the O365ConnectorCardFact class.
31 | ///
32 | /// Display name of the fact
33 | /// Display value for the fact
34 | public O365ConnectorCardFact(string name = default(string), string value = default(string))
35 | {
36 | Name = name;
37 | Value = value;
38 | CustomInit();
39 | }
40 |
41 | ///
42 | /// An initialization method that performs custom operations like setting defaults
43 | ///
44 | partial void CustomInit();
45 |
46 | ///
47 | /// Gets or sets display name of the fact
48 | ///
49 | [JsonProperty(PropertyName = "name")]
50 | public string Name { get; set; }
51 |
52 | ///
53 | /// Gets or sets display value for the fact
54 | ///
55 | [JsonProperty(PropertyName = "value")]
56 | public string Value { get; set; }
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/FileBot.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Licensed under the MIT License.
3 | //
4 |
5 | namespace Microsoft.Bot.Builder.Teams.FileBot
6 | {
7 | using System.Threading;
8 | using System.Threading.Tasks;
9 | using Microsoft.Bot.Builder.Abstractions;
10 |
11 | ///
12 | /// Wikipedia messaging extension.
13 | ///
14 | ///
15 | public class FileBot : IBot
16 | {
17 | ///
18 | /// The activity processor.
19 | ///
20 | private readonly IActivityProcessor activityProcessor;
21 |
22 | ///
23 | /// Initializes a new instance of the class.
24 | ///
25 | /// The activity processor.
26 | public FileBot(IActivityProcessor activityProcessor)
27 | {
28 | this.activityProcessor = activityProcessor;
29 | }
30 |
31 | ///
32 | /// When implemented in a bot, handles an incoming activity.
33 | ///
34 | /// The context object for this turn.
35 | /// The cancellation token.
36 | ///
37 | /// A task that represents the work queued to execute.
38 | ///
39 | ///
40 | /// The provides information about the
41 | /// incoming activity, and other data needed to process the activity.
42 | ///
43 | ///
44 | ///
45 | public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
46 | {
47 | await this.activityProcessor.ProcessIncomingActivityAsync(turnContext).ConfigureAwait(false);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardImage.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// O365 connector card image
18 | ///
19 | public partial class O365ConnectorCardImage
20 | {
21 | ///
22 | /// Initializes a new instance of the O365ConnectorCardImage class.
23 | ///
24 | public O365ConnectorCardImage()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the O365ConnectorCardImage class.
31 | ///
32 | /// URL for the image
33 | /// Alternative text for the image
34 | public O365ConnectorCardImage(string image = default(string), string title = default(string))
35 | {
36 | Image = image;
37 | Title = title;
38 | CustomInit();
39 | }
40 |
41 | ///
42 | /// An initialization method that performs custom operations like setting defaults
43 | ///
44 | partial void CustomInit();
45 |
46 | ///
47 | /// Gets or sets URL for the image
48 | ///
49 | [JsonProperty(PropertyName = "image")]
50 | public string Image { get; set; }
51 |
52 | ///
53 | /// Gets or sets alternative text for the image
54 | ///
55 | [JsonProperty(PropertyName = "title")]
56 | public string Title { get; set; }
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/AuditBot.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Licensed under the MIT License.
3 | //
4 |
5 | namespace Microsoft.Bot.Builder.Teams.AuditBot
6 | {
7 | using System.Threading;
8 | using System.Threading.Tasks;
9 | using Microsoft.Bot.Builder.Abstractions;
10 |
11 | ///
12 | /// Teams Team operation audit bot.
13 | ///
14 | ///
15 | public class AuditBot : IBot
16 | {
17 | ///
18 | /// The incoming activity processor.
19 | ///
20 | private readonly IActivityProcessor activityProcessor;
21 |
22 | ///
23 | /// Initializes a new instance of the class.
24 | ///
25 | /// The incoming activity processor.
26 | public AuditBot(IActivityProcessor activityProcessor)
27 | {
28 | this.activityProcessor = activityProcessor;
29 | }
30 |
31 | ///
32 | /// When implemented in a bot, handles an incoming activity.
33 | ///
34 | /// The context object for this turn.
35 | /// The cancellation token.
36 | ///
37 | /// A task that represents the work queued to execute.
38 | ///
39 | ///
40 | /// The provides information about the
41 | /// incoming activity, and other data needed to process the activity.
42 | ///
43 | ///
44 | ///
45 | public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
46 | {
47 | await this.activityProcessor.ProcessIncomingActivityAsync(turnContext).ConfigureAwait(false);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/MessagingExtensionParameter.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// Messaging extension query parameters
18 | ///
19 | public partial class MessagingExtensionParameter
20 | {
21 | ///
22 | /// Initializes a new instance of the MessagingExtensionParameter
23 | /// class.
24 | ///
25 | public MessagingExtensionParameter()
26 | {
27 | CustomInit();
28 | }
29 |
30 | ///
31 | /// Initializes a new instance of the MessagingExtensionParameter
32 | /// class.
33 | ///
34 | /// Name of the parameter
35 | /// Value of the parameter
36 | public MessagingExtensionParameter(string name = default(string), object value = default(object))
37 | {
38 | Name = name;
39 | Value = value;
40 | CustomInit();
41 | }
42 |
43 | ///
44 | /// An initialization method that performs custom operations like setting defaults
45 | ///
46 | partial void CustomInit();
47 |
48 | ///
49 | /// Gets or sets name of the parameter
50 | ///
51 | [JsonProperty(PropertyName = "name")]
52 | public string Name { get; set; }
53 |
54 | ///
55 | /// Gets or sets value of the parameter
56 | ///
57 | [JsonProperty(PropertyName = "value")]
58 | public object Value { get; set; }
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/TaskModuleMessageResponse.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// Task Module response with message action.
18 | ///
19 | public partial class TaskModuleMessageResponse : TaskModuleResponseBase
20 | {
21 | ///
22 | /// Initializes a new instance of the TaskModuleMessageResponse class.
23 | ///
24 | public TaskModuleMessageResponse()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the TaskModuleMessageResponse class.
31 | ///
32 | /// Choice of action options when responding to the
33 | /// task/submit message. Possible values include: 'message',
34 | /// 'continue'
35 | /// Teams will display the value of value in a
36 | /// popup message box.
37 | public TaskModuleMessageResponse(string type = default(string), string value = default(string))
38 | : base(type)
39 | {
40 | Value = value;
41 | CustomInit();
42 | }
43 |
44 | ///
45 | /// An initialization method that performs custom operations like setting defaults
46 | ///
47 | partial void CustomInit();
48 |
49 | ///
50 | /// Gets or sets teams will display the value of value in a popup
51 | /// message box.
52 | ///
53 | [JsonProperty(PropertyName = "value")]
54 | public string Value { get; set; }
55 |
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.TeamEchoBot/EchoStateAccessor.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Licensed under the MIT License.
3 | //
4 |
5 | namespace Microsoft.Bot.Builder.Teams.TeamEchoBot
6 | {
7 | using System;
8 | using Microsoft.Bot.Builder.Teams.StateStorage;
9 |
10 | ///
11 | /// Echo state accessor.
12 | ///
13 | public class EchoStateAccessor
14 | {
15 | ///
16 | /// Initializes a new instance of the class.
17 | /// Contains the and associated .
18 | ///
19 | /// The state object that stores the counter.
20 | public EchoStateAccessor(TeamSpecificConversationState conversationState)
21 | {
22 | this.ConversationState = conversationState ?? throw new ArgumentNullException(nameof(conversationState));
23 | }
24 |
25 | ///
26 | /// Gets the name used for the accessor.
27 | ///
28 | /// Accessors require a unique name.
29 | /// The accessor name for the counter accessor.
30 | public static string CounterStateName { get; } = $"{nameof(EchoStateAccessor)}.EchoState";
31 |
32 | ///
33 | /// Gets or sets the for EchoState.
34 | ///
35 | ///
36 | /// The accessor stores the turn count for the conversation.
37 | ///
38 | public IStatePropertyAccessor CounterState { get; set; }
39 |
40 | ///
41 | /// Gets the object for the conversation.
42 | ///
43 | /// The object.
44 | public TeamSpecificConversationState ConversationState { get; }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/MessagingExtensionQueryOptions.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// Messaging extension query options
18 | ///
19 | public partial class MessagingExtensionQueryOptions
20 | {
21 | ///
22 | /// Initializes a new instance of the MessagingExtensionQueryOptions
23 | /// class.
24 | ///
25 | public MessagingExtensionQueryOptions()
26 | {
27 | CustomInit();
28 | }
29 |
30 | ///
31 | /// Initializes a new instance of the MessagingExtensionQueryOptions
32 | /// class.
33 | ///
34 | /// Number of entities to skip
35 | /// Number of entities to fetch
36 | public MessagingExtensionQueryOptions(int? skip = default(int?), int? count = default(int?))
37 | {
38 | Skip = skip;
39 | Count = count;
40 | CustomInit();
41 | }
42 |
43 | ///
44 | /// An initialization method that performs custom operations like setting defaults
45 | ///
46 | partial void CustomInit();
47 |
48 | ///
49 | /// Gets or sets number of entities to skip
50 | ///
51 | [JsonProperty(PropertyName = "skip")]
52 | public int? Skip { get; set; }
53 |
54 | ///
55 | /// Gets or sets number of entities to fetch
56 | ///
57 | [JsonProperty(PropertyName = "count")]
58 | public int? Count { get; set; }
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.MessagingExtensionBot/MessagingExtensionBot.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Licensed under the MIT License.
3 | //
4 |
5 | namespace Microsoft.Bot.Builder.Teams.MessagingExtensionBot
6 | {
7 | using System.Threading;
8 | using System.Threading.Tasks;
9 | using Microsoft.Bot.Builder.Abstractions;
10 |
11 | ///
12 | /// Wikipedia messaging extension.
13 | ///
14 | ///
15 | public class MessagingExtensionBot : IBot
16 | {
17 | ///
18 | /// The activity processor.
19 | ///
20 | private readonly IActivityProcessor activityProcessor;
21 |
22 | ///
23 | /// Initializes a new instance of the class.
24 | ///
25 | /// The activity processor.
26 | public MessagingExtensionBot(IActivityProcessor activityProcessor)
27 | {
28 | this.activityProcessor = activityProcessor;
29 | }
30 |
31 | ///
32 | /// When implemented in a bot, handles an incoming activity.
33 | ///
34 | /// The context object for this turn.
35 | /// The cancellation token.
36 | ///
37 | /// A task that represents the work queued to execute.
38 | ///
39 | ///
40 | /// The provides information about the
41 | /// incoming activity, and other data needed to process the activity.
42 | ///
43 | ///
44 | ///
45 | public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
46 | {
47 | await this.activityProcessor.ProcessIncomingActivityAsync(turnContext).ConfigureAwait(false);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/AuditLogAccessor.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Licensed under the MIT License.
3 | //
4 |
5 | namespace Microsoft.Bot.Builder.Teams.AuditBot
6 | {
7 | using System;
8 | using Microsoft.Bot.Builder.Teams.StateStorage;
9 |
10 | ///
11 | /// Accessor to read and write audit logs to storage.
12 | ///
13 | public class AuditLogAccessor
14 | {
15 | ///
16 | /// Initializes a new instance of the class.
17 | /// Contains the and associated .
18 | ///
19 | /// The state object that stores the logs.
20 | public AuditLogAccessor(TeamSpecificConversationState conversationState)
21 | {
22 | this.ConversationState = conversationState ?? throw new ArgumentNullException(nameof(conversationState));
23 | }
24 |
25 | ///
26 | /// Gets the name used for the accessor.
27 | ///
28 | /// Accessors require a unique name.
29 | /// The accessor name for the counter accessor.
30 | public static string AuditLogName { get; } = $"{nameof(AuditLogAccessor)}.AuditLog";
31 |
32 | ///
33 | /// Gets or sets the for EchoState.
34 | ///
35 | ///
36 | /// The accessor stores the turn count for the conversation.
37 | ///
38 | public IStatePropertyAccessor AuditLog { get; set; }
39 |
40 | ///
41 | /// Gets the object for the conversation.
42 | ///
43 | /// The object.
44 | public TeamSpecificConversationState ConversationState { get; }
45 | }
46 | }
47 |
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.FileBot/Microsoft.Bot.Builder.Teams.FileBot.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 |
6 |
7 |
8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset
9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml
10 | Full
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | all
24 | runtime; build; native; contentfiles; analyzers
25 |
26 |
27 |
28 |
29 |
30 | all
31 | runtime; build; native; contentfiles; analyzers
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | PreserveNewest
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Builder.Teams/StateStorage/TeamSpecificConversationState.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Licensed under the MIT License.
3 | //
4 |
5 | namespace Microsoft.Bot.Builder.Teams.StateStorage
6 | {
7 | using Microsoft.Bot.Schema.Teams;
8 |
9 | ///
10 | /// Teams specific conversation state management.
11 | ///
12 | ///
13 | public class TeamSpecificConversationState : BotState
14 | {
15 | ///
16 | /// The key to use to read and write this conversation state object to storage.
17 | ///
18 | private static string propertyName = $"TeamSpecificConversationState:{typeof(TeamSpecificConversationState).Namespace}.{typeof(TeamSpecificConversationState).Name}";
19 |
20 | ///
21 | /// Initializes a new instance of the class.
22 | /// Creates a new object.
23 | ///
24 | /// The storage provider to use.
25 | public TeamSpecificConversationState(IStorage storage)
26 | : base(storage, propertyName)
27 | {
28 | }
29 |
30 | ///
31 | /// Gets the key to use when reading and writing state to and from storage.
32 | ///
33 | /// The context object for this turn.
34 | /// The storage key.
35 | protected override string GetStorageKey(ITurnContext turnContext)
36 | {
37 | TeamsChannelData teamsChannelData = turnContext.Activity.GetChannelData();
38 |
39 | if (string.IsNullOrEmpty(teamsChannelData.Team?.Id))
40 | {
41 | return $"chat/{turnContext.Activity.ChannelId}/{turnContext.Activity.Conversation.Id}";
42 | }
43 | else
44 | {
45 | return $"team/{turnContext.Activity.ChannelId}/{teamsChannelData.Team.Id}";
46 | }
47 | }
48 | }
49 | }
50 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/TaskModuleContinueResponse.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// Task Module Response with continue action.
18 | ///
19 | public partial class TaskModuleContinueResponse : TaskModuleResponseBase
20 | {
21 | ///
22 | /// Initializes a new instance of the TaskModuleContinueResponse class.
23 | ///
24 | public TaskModuleContinueResponse()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the TaskModuleContinueResponse class.
31 | ///
32 | /// Choice of action options when responding to the
33 | /// task/submit message. Possible values include: 'message',
34 | /// 'continue'
35 | /// The JSON for the Adaptive card to appear in the
36 | /// task module.
37 | public TaskModuleContinueResponse(string type = default(string), TaskModuleTaskInfo value = default(TaskModuleTaskInfo))
38 | : base(type)
39 | {
40 | Value = value;
41 | CustomInit();
42 | }
43 |
44 | ///
45 | /// An initialization method that performs custom operations like setting defaults
46 | ///
47 | partial void CustomInit();
48 |
49 | ///
50 | /// Gets or sets the JSON for the Adaptive card to appear in the task
51 | /// module.
52 | ///
53 | [JsonProperty(PropertyName = "value")]
54 | public TaskModuleTaskInfo Value { get; set; }
55 |
56 | }
57 | }
58 |
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/ReadMe.md:
--------------------------------------------------------------------------------
1 | ### Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension
2 |
3 | This sample showcases how to build a Messaging extension with new v4 SDK.
4 |
5 | ##### Setup
6 | ###### WebApiConfig.cs
7 | Startup.cs sets up the bot. Since this bot only works in Channels in Microsoft Teams, we will be adding following 3 middlewares
8 | - **DropNonTeamsActivitiesMiddleware** - To drop all activities not coming from Microsoft Teams
9 | - **TeamsMiddleware** - To access Microsoft Teams's constructs
10 |
11 | Optionally to simplify handling Messaging extensions only we are utilizing following 3 constructs
12 |
13 | ```cs
14 | // Process all incoming activities and figure out which ones are for invoke activities
15 | services.AddTransient();
16 |
17 | // Process all invokes and then figure out the ones which have messaging extension payload.
18 | services.AddTransient();
19 |
20 | // Call into Wikipedia and get the required details.
21 | services.AddSingleton();
22 | ```
23 |
24 | ##### Code execution
25 | ###### WikipediaSearchHandler
26 | Handles contacting Wikipedia and gives back a Messaging extension result.
27 |
28 | ###### TeamsInvokeActivityHandler
29 | Handles incoming invoke activities and sends back responses. Invoke handler returns an ```InvokeResponse``` object
30 | ```cs
31 | return new InvokeResponse
32 | {
33 | Body = new MessagingExtensionResponse
34 | {
35 | ComposeExtension = await this.searchHandler.GetSearchResultAsync(messagingExtensionAction).ConfigureAwait(false),
36 | },
37 | Status = 200,
38 | };
39 | ```
40 | this is then sent to ```TeamsActivityProcessor``` which then sends it over the wire
41 | ```cs
42 | await turnContext.SendActivityAsync(
43 | new Activity
44 | {
45 | Value = invokeResponse,
46 | Type = ActivityTypesEx.InvokeResponse,
47 | }).ConfigureAwait(false);
48 | ```
49 |
50 | #### How to test
51 | Use the [sample manifest](TeamsAppManifest/manifest.json) and change the botId at --YOURBOTIDHERE-- and use your bot Id.
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.MessagingExtensionBot/Microsoft.Bot.Builder.Teams.MessagingExtensionBot.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 |
6 |
7 |
8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset
9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml
10 | Full
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | all
24 | runtime; build; native; contentfiles; analyzers
25 |
26 |
27 |
28 |
29 |
30 | all
31 | runtime; build; native; contentfiles; analyzers
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | PreserveNewest
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/SigninStateVerificationQuery.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// Signin state (part of signin action auth flow) verification invoke
18 | /// query
19 | ///
20 | public partial class SigninStateVerificationQuery
21 | {
22 | ///
23 | /// Initializes a new instance of the SigninStateVerificationQuery
24 | /// class.
25 | ///
26 | public SigninStateVerificationQuery()
27 | {
28 | CustomInit();
29 | }
30 |
31 | ///
32 | /// Initializes a new instance of the SigninStateVerificationQuery
33 | /// class.
34 | ///
35 | /// The state string originally received when the
36 | /// signin web flow is finished with a state posted back to client via
37 | /// tab SDK microsoftTeams.authentication.notifySuccess(state)
38 | public SigninStateVerificationQuery(string state = default(string))
39 | {
40 | State = state;
41 | CustomInit();
42 | }
43 |
44 | ///
45 | /// An initialization method that performs custom operations like setting defaults
46 | ///
47 | partial void CustomInit();
48 |
49 | ///
50 | /// Gets or sets The state string originally received when the signin
51 | /// web flow is finished with a state posted back to client via tab SDK
52 | /// microsoftTeams.authentication.notifySuccess(state)
53 | ///
54 | [JsonProperty(PropertyName = "state")]
55 | public string State { get; set; }
56 |
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/WikipediaMessagingExtensionBot.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Licensed under the MIT License.
3 | //
4 |
5 | namespace Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension
6 | {
7 | using System.Threading;
8 | using System.Threading.Tasks;
9 | using Microsoft.Bot.Builder.Abstractions;
10 |
11 | ///
12 | /// Wikipedia messaging extension.
13 | ///
14 | ///
15 | public class WikipediaMessagingExtensionBot : IBot
16 | {
17 | ///
18 | /// The activity processor.
19 | ///
20 | private readonly IActivityProcessor activityProcessor;
21 |
22 | ///
23 | /// Initializes a new instance of the class.
24 | ///
25 | /// The activity processor.
26 | public WikipediaMessagingExtensionBot(IActivityProcessor activityProcessor)
27 | {
28 | this.activityProcessor = activityProcessor;
29 | }
30 |
31 | ///
32 | /// When implemented in a bot, handles an incoming activity.
33 | ///
34 | /// The context object for this turn.
35 | /// The cancellation token.
36 | ///
37 | /// A task that represents the work queued to execute.
38 | ///
39 | ///
40 | /// The provides information about the
41 | /// incoming activity, and other data needed to process the activity.
42 | ///
43 | ///
44 | ///
45 | public async Task OnTurnAsync(ITurnContext turnContext, CancellationToken cancellationToken = default(CancellationToken))
46 | {
47 | await this.activityProcessor.ProcessIncomingActivityAsync(turnContext).ConfigureAwait(false);
48 | }
49 | }
50 | }
51 |
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 |
6 |
7 |
8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset
9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml
10 | Full
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | all
24 | runtime; build; native; contentfiles; analyzers
25 |
26 |
27 |
28 |
29 |
30 | all
31 | runtime; build; native; contentfiles; analyzers
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 | PreserveNewest
43 |
44 |
45 |
46 |
47 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/TaskModuleRequest.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// Task module invoke request value payload
18 | ///
19 | public partial class TaskModuleRequest
20 | {
21 | ///
22 | /// Initializes a new instance of the TaskModuleRequest class.
23 | ///
24 | public TaskModuleRequest()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the TaskModuleRequest class.
31 | ///
32 | /// User input data. Free payload with key-value
33 | /// pairs.
34 | /// Current user context, i.e., the current
35 | /// theme
36 | public TaskModuleRequest(object data = default(object), TaskModuleRequestContext context = default(TaskModuleRequestContext))
37 | {
38 | Data = data;
39 | Context = context;
40 | CustomInit();
41 | }
42 |
43 | ///
44 | /// An initialization method that performs custom operations like setting defaults
45 | ///
46 | partial void CustomInit();
47 |
48 | ///
49 | /// Gets or sets user input data. Free payload with key-value pairs.
50 | ///
51 | [JsonProperty(PropertyName = "data")]
52 | public object Data { get; set; }
53 |
54 | ///
55 | /// Gets or sets current user context, i.e., the current theme
56 | ///
57 | [JsonProperty(PropertyName = "context")]
58 | public TaskModuleRequestContext Context { get; set; }
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardOpenUriTarget.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// O365 connector card OpenUri target
18 | ///
19 | public partial class O365ConnectorCardOpenUriTarget
20 | {
21 | ///
22 | /// Initializes a new instance of the O365ConnectorCardOpenUriTarget
23 | /// class.
24 | ///
25 | public O365ConnectorCardOpenUriTarget()
26 | {
27 | CustomInit();
28 | }
29 |
30 | ///
31 | /// Initializes a new instance of the O365ConnectorCardOpenUriTarget
32 | /// class.
33 | ///
34 | /// Target operating system. Possible values include:
35 | /// 'default', 'iOS', 'android', 'windows'
36 | /// Target url
37 | public O365ConnectorCardOpenUriTarget(string os = default(string), string uri = default(string))
38 | {
39 | Os = os;
40 | Uri = uri;
41 | CustomInit();
42 | }
43 |
44 | ///
45 | /// An initialization method that performs custom operations like setting defaults
46 | ///
47 | partial void CustomInit();
48 |
49 | ///
50 | /// Gets or sets target operating system. Possible values include:
51 | /// 'default', 'iOS', 'android', 'windows'
52 | ///
53 | [JsonProperty(PropertyName = "os")]
54 | public string Os { get; set; }
55 |
56 | ///
57 | /// Gets or sets target url
58 | ///
59 | [JsonProperty(PropertyName = "uri")]
60 | public string Uri { get; set; }
61 |
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardMultichoiceInputChoice.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// O365O365 connector card multiple choice input item
18 | ///
19 | public partial class O365ConnectorCardMultichoiceInputChoice
20 | {
21 | ///
22 | /// Initializes a new instance of the
23 | /// O365ConnectorCardMultichoiceInputChoice class.
24 | ///
25 | public O365ConnectorCardMultichoiceInputChoice()
26 | {
27 | CustomInit();
28 | }
29 |
30 | ///
31 | /// Initializes a new instance of the
32 | /// O365ConnectorCardMultichoiceInputChoice class.
33 | ///
34 | /// The text rendered on ActionCard.
35 | /// The value received as results.
36 | public O365ConnectorCardMultichoiceInputChoice(string display = default(string), string value = default(string))
37 | {
38 | Display = display;
39 | Value = value;
40 | CustomInit();
41 | }
42 |
43 | ///
44 | /// An initialization method that performs custom operations like setting defaults
45 | ///
46 | partial void CustomInit();
47 |
48 | ///
49 | /// Gets or sets the text rendered on ActionCard.
50 | ///
51 | [JsonProperty(PropertyName = "display")]
52 | public string Display { get; set; }
53 |
54 | ///
55 | /// Gets or sets the value received as results.
56 | ///
57 | [JsonProperty(PropertyName = "value")]
58 | public string Value { get; set; }
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/MessageActionsPayloadBody.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// Plaintext/HTML representation of the content of the message.
18 | ///
19 | public partial class MessageActionsPayloadBody
20 | {
21 | ///
22 | /// Initializes a new instance of the MessageActionsPayloadBody class.
23 | ///
24 | public MessageActionsPayloadBody()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the MessageActionsPayloadBody class.
31 | ///
32 | /// Type of the content. Possible values
33 | /// include: 'html', 'text'
34 | /// The content of the body.
35 | public MessageActionsPayloadBody(string contentType = default(string), string content = default(string))
36 | {
37 | ContentType = contentType;
38 | Content = content;
39 | CustomInit();
40 | }
41 |
42 | ///
43 | /// An initialization method that performs custom operations like setting defaults
44 | ///
45 | partial void CustomInit();
46 |
47 | ///
48 | /// Gets or sets type of the content. Possible values include: 'html',
49 | /// 'text'
50 | ///
51 | [JsonProperty(PropertyName = "contentType")]
52 | public string ContentType { get; set; }
53 |
54 | ///
55 | /// Gets or sets the content of the body.
56 | ///
57 | [JsonProperty(PropertyName = "content")]
58 | public string Content { get; set; }
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardHttpPOST.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// O365 connector card HttpPOST action
18 | ///
19 | public partial class O365ConnectorCardHttpPOST : O365ConnectorCardActionBase
20 | {
21 | ///
22 | /// Initializes a new instance of the O365ConnectorCardHttpPOST class.
23 | ///
24 | public O365ConnectorCardHttpPOST()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the O365ConnectorCardHttpPOST class.
31 | ///
32 | /// Type of the action. Possible values include:
33 | /// 'ViewAction', 'OpenUri', 'HttpPOST', 'ActionCard'
34 | /// Name of the action that will be used as button
35 | /// title
36 | /// Action Id
37 | /// Content to be posted back to bots via
38 | /// invoke
39 | public O365ConnectorCardHttpPOST(string type = default(string), string name = default(string), string id = default(string), string body = default(string))
40 | : base(type, name, id)
41 | {
42 | Body = body;
43 | CustomInit();
44 | }
45 |
46 | ///
47 | /// An initialization method that performs custom operations like setting defaults
48 | ///
49 | partial void CustomInit();
50 |
51 | ///
52 | /// Gets or sets content to be posted back to bots via invoke
53 | ///
54 | [JsonProperty(PropertyName = "body")]
55 | public string Body { get; set; }
56 |
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.AuditBot/Microsoft.Bot.Builder.Teams.AuditBot.csproj:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 | netcoreapp2.1
5 |
6 |
7 |
8 | $([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), Microsoft.Bot.Builder.Teams.sln))\Build\Analyzer.ruleset
9 | bin\$(Configuration)\$(Platform)\$(AssemblyName).xml
10 | Full
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
20 |
21 |
22 |
23 | all
24 | runtime; build; native; contentfiles; analyzers
25 |
26 |
27 |
28 |
29 |
30 | all
31 | runtime; build; native; contentfiles; analyzers
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 | PreserveNewest
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/MessagingExtensionActionResponse.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// Response of messaging extension action
18 | ///
19 | public partial class MessagingExtensionActionResponse
20 | {
21 | ///
22 | /// Initializes a new instance of the MessagingExtensionActionResponse
23 | /// class.
24 | ///
25 | public MessagingExtensionActionResponse()
26 | {
27 | CustomInit();
28 | }
29 |
30 | ///
31 | /// Initializes a new instance of the MessagingExtensionActionResponse
32 | /// class.
33 | ///
34 | /// The JSON for the Adaptive card to appear in the
35 | /// task module.
36 | public MessagingExtensionActionResponse(TaskModuleResponseBase task = default(TaskModuleResponseBase), MessagingExtensionResult composeExtension = default(MessagingExtensionResult))
37 | {
38 | Task = task;
39 | ComposeExtension = composeExtension;
40 | CustomInit();
41 | }
42 |
43 | ///
44 | /// An initialization method that performs custom operations like setting defaults
45 | ///
46 | partial void CustomInit();
47 |
48 | ///
49 | /// Gets or sets the JSON for the Adaptive card to appear in the task
50 | /// module.
51 | ///
52 | [JsonProperty(PropertyName = "task")]
53 | public TaskModuleResponseBase Task { get; set; }
54 |
55 | ///
56 | ///
57 | [JsonProperty(PropertyName = "composeExtension")]
58 | public MessagingExtensionResult ComposeExtension { get; set; }
59 |
60 | }
61 | }
62 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/FileInfoCard.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// File info card.
18 | ///
19 | public partial class FileInfoCard
20 | {
21 | ///
22 | /// Initializes a new instance of the FileInfoCard class.
23 | ///
24 | public FileInfoCard()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the FileInfoCard class.
31 | ///
32 | /// Unique Id for the file.
33 | /// Type of file.
34 | /// ETag for the file.
35 | public FileInfoCard(string uniqueId = default(string), string fileType = default(string), object etag = default(object))
36 | {
37 | UniqueId = uniqueId;
38 | FileType = fileType;
39 | Etag = etag;
40 | CustomInit();
41 | }
42 |
43 | ///
44 | /// An initialization method that performs custom operations like setting defaults
45 | ///
46 | partial void CustomInit();
47 |
48 | ///
49 | /// Gets or sets unique Id for the file.
50 | ///
51 | [JsonProperty(PropertyName = "uniqueId")]
52 | public string UniqueId { get; set; }
53 |
54 | ///
55 | /// Gets or sets type of file.
56 | ///
57 | [JsonProperty(PropertyName = "fileType")]
58 | public string FileType { get; set; }
59 |
60 | ///
61 | /// Gets or sets eTag for the file.
62 | ///
63 | [JsonProperty(PropertyName = "etag")]
64 | public object Etag { get; set; }
65 |
66 | }
67 | }
68 |
--------------------------------------------------------------------------------
/CSharp/UnitTests/Microsoft.Bot.Builder.Teams.Tests/SigninAuthTests.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Licensed under the MIT License.
3 | //
4 |
5 | namespace Microsoft.Bot.Builder.Teams.Tests
6 | {
7 | using System.IO;
8 | using System.Threading.Tasks;
9 | using Microsoft.Bot.Schema;
10 | using Microsoft.VisualStudio.TestTools.UnitTesting;
11 | using Newtonsoft.Json;
12 |
13 | ///
14 | /// Signin card auth flow tests.
15 | ///
16 | [TestClass]
17 | public class SigninAuthTests
18 | {
19 | ///
20 | /// Tests IsRequestSigninStateVerificationQuery logic by providing a file where the invoke payload is valid.
21 | ///
22 | /// Task tracking operation.
23 | [TestMethod]
24 | public async Task SigninAuthTests_IsSigninAuthValidStateVerificationInvokeAsync()
25 | {
26 | Activity sampleActivity = JsonConvert.DeserializeObject(File.ReadAllText(@"Jsons\SampleActivitySigninAuthStateVerification.json"));
27 | await TestHelpers.RunTestPipelineWithActivityAsync(
28 | sampleActivity,
29 | (teamsContext) =>
30 | {
31 | Assert.IsTrue(teamsContext.IsRequestSigninStateVerificationQuery());
32 | return Task.CompletedTask;
33 | }).ConfigureAwait(false);
34 | }
35 |
36 | ///
37 | /// Tests IsRequestSigninStateVerificationQuery logic by providing a file where the invoke payload is invalid.
38 | ///
39 | /// Task tracking operation.
40 | [TestMethod]
41 | public async Task SigninAuthTests_IsSigninAuthInvalidStateVerificationInvokeAsync()
42 | {
43 | Activity sampleActivity = JsonConvert.DeserializeObject(File.ReadAllText(@"Jsons\SampleActivityInvoke.json"));
44 | await TestHelpers.RunTestPipelineWithActivityAsync(
45 | sampleActivity,
46 | (teamsContext) =>
47 | {
48 | Assert.IsFalse(teamsContext.IsRequestSigninStateVerificationQuery());
49 | return Task.CompletedTask;
50 | }).ConfigureAwait(false);
51 | }
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/MessagingExtensionAttachment.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// Messaging extension attachment.
18 | ///
19 | public partial class MessagingExtensionAttachment : Attachment
20 | {
21 | ///
22 | /// Initializes a new instance of the MessagingExtensionAttachment
23 | /// class.
24 | ///
25 | public MessagingExtensionAttachment()
26 | {
27 | CustomInit();
28 | }
29 |
30 | ///
31 | /// Initializes a new instance of the MessagingExtensionAttachment
32 | /// class.
33 | ///
34 | /// mimetype/Contenttype for the file
35 | /// Content Url
36 | /// Embedded content
37 | /// (OPTIONAL) The name of the attachment
38 | /// (OPTIONAL) Thumbnail associated with
39 | /// attachment
40 | public MessagingExtensionAttachment(string contentType = default(string), string contentUrl = default(string), object content = default(object), string name = default(string), string thumbnailUrl = default(string), Attachment preview = default(Attachment))
41 | : base(contentType, contentUrl, content, name, thumbnailUrl)
42 | {
43 | Preview = preview;
44 | CustomInit();
45 | }
46 |
47 | ///
48 | /// An initialization method that performs custom operations like setting defaults
49 | ///
50 | partial void CustomInit();
51 |
52 | ///
53 | ///
54 | [JsonProperty(PropertyName = "preview")]
55 | public Attachment Preview { get; set; }
56 |
57 | }
58 | }
59 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardOpenUri.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Collections;
15 | using System.Collections.Generic;
16 | using System.Linq;
17 |
18 | ///
19 | /// O365 connector card OpenUri action
20 | ///
21 | public partial class O365ConnectorCardOpenUri : O365ConnectorCardActionBase
22 | {
23 | ///
24 | /// Initializes a new instance of the O365ConnectorCardOpenUri class.
25 | ///
26 | public O365ConnectorCardOpenUri()
27 | {
28 | CustomInit();
29 | }
30 |
31 | ///
32 | /// Initializes a new instance of the O365ConnectorCardOpenUri class.
33 | ///
34 | /// Type of the action. Possible values include:
35 | /// 'ViewAction', 'OpenUri', 'HttpPOST', 'ActionCard'
36 | /// Name of the action that will be used as button
37 | /// title
38 | /// Action Id
39 | /// Target os / urls
40 | public O365ConnectorCardOpenUri(string type = default(string), string name = default(string), string id = default(string), IList targets = default(IList))
41 | : base(type, name, id)
42 | {
43 | Targets = targets;
44 | CustomInit();
45 | }
46 |
47 | ///
48 | /// An initialization method that performs custom operations like setting defaults
49 | ///
50 | partial void CustomInit();
51 |
52 | ///
53 | /// Gets or sets target os / urls
54 | ///
55 | [JsonProperty(PropertyName = "targets")]
56 | public IList Targets { get; set; }
57 |
58 | }
59 | }
60 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Builder.Teams/Middlewares/DropNonTeamsActivitiesMiddleware.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Licensed under the MIT License.
3 | //
4 |
5 | namespace Microsoft.Bot.Builder.Teams.Middlewares
6 | {
7 | using System;
8 | using System.Threading;
9 | using System.Threading.Tasks;
10 | using Microsoft.Bot.Connector;
11 |
12 | ///
13 | /// Automatically drop all messages received from any channel except Microsoft Teams.
14 | ///
15 | public class DropNonTeamsActivitiesMiddleware : IMiddleware
16 | {
17 | ///
18 | /// When implemented in middleware, processess an incoming activity.
19 | ///
20 | /// The context object for this turn.
21 | /// The delegate to call to continue the bot middleware pipeline.
22 | /// A cancellation token that can be used by other objects
23 | /// or threads to receive notice of cancellation.
24 | ///
25 | /// A task that represents the work queued to execute.
26 | ///
27 | ///
28 | /// Middleware calls the delegate to pass control to
29 | /// the next middleware in the pipeline. If middleware doesn’t call the next delegate,
30 | /// the adapter does not call any of the subsequent middleware’s request handlers or the
31 | /// bot’s receive handler, and the pipeline short circuits.
32 | /// The provides information about the
33 | /// incoming activity, and other data needed to process the activity.
34 | ///
35 | ///
36 | ///
37 | public async Task OnTurnAsync(ITurnContext turnContext, NextDelegate next, CancellationToken cancellationToken = default(CancellationToken))
38 | {
39 | BotAssert.ContextNotNull(turnContext);
40 |
41 | if (turnContext.Activity.ChannelId.Equals(Channels.Msteams, StringComparison.OrdinalIgnoreCase))
42 | {
43 | await next(cancellationToken).ConfigureAwait(false);
44 | }
45 | }
46 | }
47 | }
48 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/TeamDetails.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// Details related to a team
18 | ///
19 | public partial class TeamDetails
20 | {
21 | ///
22 | /// Initializes a new instance of the TeamDetails class.
23 | ///
24 | public TeamDetails()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the TeamDetails class.
31 | ///
32 | /// Unique identifier representing a team
33 | /// Name of team.
34 | /// Azure Active Directory (AAD) Group Id for
35 | /// the team.
36 | public TeamDetails(string id = default(string), string name = default(string), string aadGroupId = default(string))
37 | {
38 | Id = id;
39 | Name = name;
40 | AadGroupId = aadGroupId;
41 | CustomInit();
42 | }
43 |
44 | ///
45 | /// An initialization method that performs custom operations like setting defaults
46 | ///
47 | partial void CustomInit();
48 |
49 | ///
50 | /// Gets or sets unique identifier representing a team
51 | ///
52 | [JsonProperty(PropertyName = "id")]
53 | public string Id { get; set; }
54 |
55 | ///
56 | /// Gets or sets name of team.
57 | ///
58 | [JsonProperty(PropertyName = "name")]
59 | public string Name { get; set; }
60 |
61 | ///
62 | /// Gets or sets azure Active Directory (AAD) Group Id for the team.
63 | ///
64 | [JsonProperty(PropertyName = "aadGroupId")]
65 | public string AadGroupId { get; set; }
66 |
67 | }
68 | }
69 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardViewAction.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Collections;
15 | using System.Collections.Generic;
16 | using System.Linq;
17 |
18 | ///
19 | /// O365 connector card ViewAction action
20 | ///
21 | public partial class O365ConnectorCardViewAction : O365ConnectorCardActionBase
22 | {
23 | ///
24 | /// Initializes a new instance of the O365ConnectorCardViewAction
25 | /// class.
26 | ///
27 | public O365ConnectorCardViewAction()
28 | {
29 | CustomInit();
30 | }
31 |
32 | ///
33 | /// Initializes a new instance of the O365ConnectorCardViewAction
34 | /// class.
35 | ///
36 | /// Type of the action. Possible values include:
37 | /// 'ViewAction', 'OpenUri', 'HttpPOST', 'ActionCard'
38 | /// Name of the action that will be used as button
39 | /// title
40 | /// Action Id
41 | /// Target urls, only the first url effective for
42 | /// card button
43 | public O365ConnectorCardViewAction(string type = default(string), string name = default(string), string id = default(string), IList target = default(IList))
44 | : base(type, name, id)
45 | {
46 | Target = target;
47 | CustomInit();
48 | }
49 |
50 | ///
51 | /// An initialization method that performs custom operations like setting defaults
52 | ///
53 | partial void CustomInit();
54 |
55 | ///
56 | /// Gets or sets target urls, only the first url effective for card
57 | /// button
58 | ///
59 | [JsonProperty(PropertyName = "target")]
60 | public IList Target { get; set; }
61 |
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardActionQuery.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// O365 connector card HttpPOST invoke query
18 | ///
19 | public partial class O365ConnectorCardActionQuery
20 | {
21 | ///
22 | /// Initializes a new instance of the O365ConnectorCardActionQuery
23 | /// class.
24 | ///
25 | public O365ConnectorCardActionQuery()
26 | {
27 | CustomInit();
28 | }
29 |
30 | ///
31 | /// Initializes a new instance of the O365ConnectorCardActionQuery
32 | /// class.
33 | ///
34 | /// The results of body string defined in
35 | /// IO365ConnectorCardHttpPOST with substituted input values
36 | /// Action Id associated with the HttpPOST
37 | /// action button triggered, defined in
38 | /// O365ConnectorCardActionBase.
39 | public O365ConnectorCardActionQuery(string body = default(string), string actionId = default(string))
40 | {
41 | Body = body;
42 | ActionId = actionId;
43 | CustomInit();
44 | }
45 |
46 | ///
47 | /// An initialization method that performs custom operations like setting defaults
48 | ///
49 | partial void CustomInit();
50 |
51 | ///
52 | /// Gets or sets the results of body string defined in
53 | /// IO365ConnectorCardHttpPOST with substituted input values
54 | ///
55 | [JsonProperty(PropertyName = "body")]
56 | public string Body { get; set; }
57 |
58 | ///
59 | /// Gets or sets action Id associated with the HttpPOST action button
60 | /// triggered, defined in O365ConnectorCardActionBase.
61 | ///
62 | [JsonProperty(PropertyName = "actionId")]
63 | public string ActionId { get; set; }
64 |
65 | }
66 | }
67 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardActionBase.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// O365 connector card action base
18 | ///
19 | public partial class O365ConnectorCardActionBase
20 | {
21 | ///
22 | /// Initializes a new instance of the O365ConnectorCardActionBase
23 | /// class.
24 | ///
25 | public O365ConnectorCardActionBase()
26 | {
27 | CustomInit();
28 | }
29 |
30 | ///
31 | /// Initializes a new instance of the O365ConnectorCardActionBase
32 | /// class.
33 | ///
34 | /// Type of the action. Possible values include:
35 | /// 'ViewAction', 'OpenUri', 'HttpPOST', 'ActionCard'
36 | /// Name of the action that will be used as button
37 | /// title
38 | /// Action Id
39 | public O365ConnectorCardActionBase(string type = default(string), string name = default(string), string id = default(string))
40 | {
41 | Type = type;
42 | Name = name;
43 | Id = id;
44 | CustomInit();
45 | }
46 |
47 | ///
48 | /// An initialization method that performs custom operations like setting defaults
49 | ///
50 | partial void CustomInit();
51 |
52 | ///
53 | /// Gets or sets type of the action. Possible values include:
54 | /// 'ViewAction', 'OpenUri', 'HttpPOST', 'ActionCard'
55 | ///
56 | [JsonProperty(PropertyName = "@type")]
57 | public string Type { get; set; }
58 |
59 | ///
60 | /// Gets or sets name of the action that will be used as button title
61 | ///
62 | [JsonProperty(PropertyName = "name")]
63 | public string Name { get; set; }
64 |
65 | ///
66 | /// Gets or sets action Id
67 | ///
68 | [JsonProperty(PropertyName = "@id")]
69 | public string Id { get; set; }
70 |
71 | }
72 | }
73 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/O365ConnectorCardDateInput.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// O365 connector card date input
18 | ///
19 | public partial class O365ConnectorCardDateInput : O365ConnectorCardInputBase
20 | {
21 | ///
22 | /// Initializes a new instance of the O365ConnectorCardDateInput class.
23 | ///
24 | public O365ConnectorCardDateInput()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the O365ConnectorCardDateInput class.
31 | ///
32 | /// Input type name. Possible values include:
33 | /// 'textInput', 'dateInput', 'multichoiceInput'
34 | /// Input Id. It must be unique per entire O365
35 | /// connector card.
36 | /// Define if this input is a required field.
37 | /// Default value is false.
38 | /// Input title that will be shown as the
39 | /// placeholder
40 | /// Default value for this input field
41 | /// Include time input field. Default value
42 | /// is false (date only).
43 | public O365ConnectorCardDateInput(string type = default(string), string id = default(string), bool? isRequired = default(bool?), string title = default(string), string value = default(string), bool? includeTime = default(bool?))
44 | : base(type, id, isRequired, title, value)
45 | {
46 | IncludeTime = includeTime;
47 | CustomInit();
48 | }
49 |
50 | ///
51 | /// An initialization method that performs custom operations like setting defaults
52 | ///
53 | partial void CustomInit();
54 |
55 | ///
56 | /// Gets or sets include time input field. Default value is false
57 | /// (date only).
58 | ///
59 | [JsonProperty(PropertyName = "includeTime")]
60 | public bool? IncludeTime { get; set; }
61 |
62 | }
63 | }
64 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/FileDownloadInfo.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// File download info attachment.
18 | ///
19 | public partial class FileDownloadInfo
20 | {
21 | ///
22 | /// Initializes a new instance of the FileDownloadInfo class.
23 | ///
24 | public FileDownloadInfo()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the FileDownloadInfo class.
31 | ///
32 | /// File download url.
33 | /// Unique Id for the file.
34 | /// Type of file.
35 | /// ETag for the file.
36 | public FileDownloadInfo(string downloadUrl = default(string), string uniqueId = default(string), string fileType = default(string), object etag = default(object))
37 | {
38 | DownloadUrl = downloadUrl;
39 | UniqueId = uniqueId;
40 | FileType = fileType;
41 | Etag = etag;
42 | CustomInit();
43 | }
44 |
45 | ///
46 | /// An initialization method that performs custom operations like setting defaults
47 | ///
48 | partial void CustomInit();
49 |
50 | ///
51 | /// Gets or sets file download url.
52 | ///
53 | [JsonProperty(PropertyName = "downloadUrl")]
54 | public string DownloadUrl { get; set; }
55 |
56 | ///
57 | /// Gets or sets unique Id for the file.
58 | ///
59 | [JsonProperty(PropertyName = "uniqueId")]
60 | public string UniqueId { get; set; }
61 |
62 | ///
63 | /// Gets or sets type of file.
64 | ///
65 | [JsonProperty(PropertyName = "fileType")]
66 | public string FileType { get; set; }
67 |
68 | ///
69 | /// Gets or sets eTag for the file.
70 | ///
71 | [JsonProperty(PropertyName = "etag")]
72 | public object Etag { get; set; }
73 |
74 | }
75 | }
76 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/MessageActionsPayloadMention.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// Represents the entity that was mentioned in the message.
18 | ///
19 | public partial class MessageActionsPayloadMention
20 | {
21 | ///
22 | /// Initializes a new instance of the MessageActionsPayloadMention
23 | /// class.
24 | ///
25 | public MessageActionsPayloadMention()
26 | {
27 | CustomInit();
28 | }
29 |
30 | ///
31 | /// Initializes a new instance of the MessageActionsPayloadMention
32 | /// class.
33 | ///
34 | /// The id of the mentioned entity.
35 | /// The plaintext display name of the
36 | /// mentioned entity.
37 | /// Provides more details on the mentioned
38 | /// entity.
39 | public MessageActionsPayloadMention(int? id = default(int?), string mentionText = default(string), MessageActionsPayloadFrom mentioned = default(MessageActionsPayloadFrom))
40 | {
41 | Id = id;
42 | MentionText = mentionText;
43 | Mentioned = mentioned;
44 | CustomInit();
45 | }
46 |
47 | ///
48 | /// An initialization method that performs custom operations like setting defaults
49 | ///
50 | partial void CustomInit();
51 |
52 | ///
53 | /// Gets or sets the id of the mentioned entity.
54 | ///
55 | [JsonProperty(PropertyName = "id")]
56 | public int? Id { get; set; }
57 |
58 | ///
59 | /// Gets or sets the plaintext display name of the mentioned entity.
60 | ///
61 | [JsonProperty(PropertyName = "mentionText")]
62 | public string MentionText { get; set; }
63 |
64 | ///
65 | /// Gets or sets provides more details on the mentioned entity.
66 | ///
67 | [JsonProperty(PropertyName = "mentioned")]
68 | public MessageActionsPayloadFrom Mentioned { get; set; }
69 |
70 | }
71 | }
72 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Connector.Teams/ITeamsConnectorClient.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Connector.Teams
12 | {
13 | using Microsoft.Rest;
14 | using Microsoft.Bot.Schema.Teams;
15 | using Newtonsoft.Json;
16 |
17 | ///
18 | /// The Bot Connector REST API extension for Microsoft Teams allows your
19 | /// bot to perform extended operations on to Microsoft Teams channel
20 | /// configured in the
21 | /// [Bot Framework Developer Portal](https://dev.botframework.com). The
22 | /// Connector service uses industry-standard REST and JSON over HTTPS.
23 | ///
24 | /// Client libraries for this REST API are available. See below for a list.
25 | ///
26 | ///
27 | ///
28 | /// Authentication for both the Bot Connector and Bot State REST APIs is
29 | /// accomplished with JWT Bearer tokens, and is
30 | /// described in detail in the [Connector
31 | /// Authentication](https://docs.botframework.com/en-us/restapi/authentication)
32 | /// document.
33 | ///
34 | /// # Client Libraries for the Bot Connector REST API
35 | ///
36 | /// * [Bot Builder for
37 | /// C#](https://docs.botframework.com/en-us/csharp/builder/sdkreference/)
38 | /// * [Bot Builder for
39 | /// Node.js](https://docs.botframework.com/en-us/node/builder/overview/)
40 | ///
41 | /// © 2016 Microsoft
42 | ///
43 | public partial interface ITeamsConnectorClient : System.IDisposable
44 | {
45 | ///
46 | /// The base URI of the service.
47 | ///
48 | System.Uri BaseUri { get; set; }
49 |
50 | ///
51 | /// Gets or sets json serialization settings.
52 | ///
53 | JsonSerializerSettings SerializationSettings { get; }
54 |
55 | ///
56 | /// Gets or sets json deserialization settings.
57 | ///
58 | JsonSerializerSettings DeserializationSettings { get; }
59 |
60 | ///
61 | /// Subscription credentials which uniquely identify client
62 | /// subscription.
63 | ///
64 | ServiceClientCredentials Credentials { get; }
65 |
66 |
67 | ///
68 | /// Gets the ITeamsOperations.
69 | ///
70 | ITeamsOperations Teams { get; }
71 |
72 | }
73 | }
74 |
--------------------------------------------------------------------------------
/CSharp/Samples/Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension/Engine/TeamsInvokeActivityHandler.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Licensed under the MIT License.
3 | //
4 |
5 | namespace Microsoft.Bot.Builder.Teams.WikipediaMessagingExtension.Engine
6 | {
7 | using System;
8 | using System.Threading.Tasks;
9 | using Microsoft.Bot.Builder.Abstractions.Teams;
10 | using Microsoft.Bot.Schema.Teams;
11 |
12 | ///
13 | /// Handles Teams invoke activity.
14 | ///
15 | ///
16 | public class TeamsInvokeActivityHandler : TeamsInvokeActivityHandlerBase
17 | {
18 | ///
19 | /// The search handler
20 | ///
21 | private readonly ISearchHandler searchHandler;
22 |
23 | ///
24 | /// Initializes a new instance of the class.
25 | ///
26 | /// The search handler.
27 | public TeamsInvokeActivityHandler(ISearchHandler searchHandler)
28 | {
29 | this.searchHandler = searchHandler;
30 | }
31 |
32 | ///
33 | /// Handles the messaging extension action asynchronously.
34 | ///
35 | /// The turn context
36 | /// The invoke query object
37 | ///
38 | /// Task tracking operation.
39 | ///
40 | public async Task HandleMessagingExtensionQueryAsync(TurnContext turnContext, MessagingExtensionQuery query)
41 | {
42 | try
43 | {
44 | return new InvokeResponse
45 | {
46 | Body = new MessagingExtensionResponse
47 | {
48 | ComposeExtension = await this.searchHandler.GetSearchResultAsync(query).ConfigureAwait(false),
49 | },
50 | Status = 200,
51 | };
52 | }
53 | catch (Exception ex)
54 | {
55 | return new InvokeResponse
56 | {
57 | Body = new MessagingExtensionResponse
58 | {
59 | ComposeExtension = new MessagingExtensionResult
60 | {
61 | Text = "Failed to search " + ex.Message,
62 | Type = "message",
63 | },
64 | },
65 | Status = 200,
66 | };
67 | }
68 | }
69 | }
70 | }
71 |
--------------------------------------------------------------------------------
/CSharp/Microsoft.Bot.Schema.Teams/Generated/MessageActionsPayloadUser.cs:
--------------------------------------------------------------------------------
1 | //
2 | // Copyright (c) Microsoft Corporation. All rights reserved.
3 | // Licensed under the MIT License. See License.txt in the project root for
4 | // license information.
5 | //
6 | // Code generated by Microsoft (R) AutoRest Code Generator.
7 | // Changes may cause incorrect behavior and will be lost if the code is
8 | // regenerated.
9 | //
10 |
11 | namespace Microsoft.Bot.Schema.Teams
12 | {
13 | using Newtonsoft.Json;
14 | using System.Linq;
15 |
16 | ///
17 | /// Represents a user entity.
18 | ///
19 | public partial class MessageActionsPayloadUser
20 | {
21 | ///
22 | /// Initializes a new instance of the MessageActionsPayloadUser class.
23 | ///
24 | public MessageActionsPayloadUser()
25 | {
26 | CustomInit();
27 | }
28 |
29 | ///
30 | /// Initializes a new instance of the MessageActionsPayloadUser class.
31 | ///
32 | /// The identity type of the user.
33 | /// Possible values include: 'aadUser', 'onPremiseAadUser',
34 | /// 'anonymousGuest', 'federatedUser'
35 | /// The id of the user.
36 | /// The plaintext display name of the
37 | /// user.
38 | public MessageActionsPayloadUser(string userIdentityType = default(string), string id = default(string), string displayName = default(string))
39 | {
40 | UserIdentityType = userIdentityType;
41 | Id = id;
42 | DisplayName = displayName;
43 | CustomInit();
44 | }
45 |
46 | ///
47 | /// An initialization method that performs custom operations like setting defaults
48 | ///
49 | partial void CustomInit();
50 |
51 | ///
52 | /// Gets or sets the identity type of the user. Possible values
53 | /// include: 'aadUser', 'onPremiseAadUser', 'anonymousGuest',
54 | /// 'federatedUser'
55 | ///
56 | [JsonProperty(PropertyName = "userIdentityType")]
57 | public string UserIdentityType { get; set; }
58 |
59 | ///
60 | /// Gets or sets the id of the user.
61 | ///
62 | [JsonProperty(PropertyName = "id")]
63 | public string Id { get; set; }
64 |
65 | ///
66 | /// Gets or sets the plaintext display name of the user.
67 | ///
68 | [JsonProperty(PropertyName = "displayName")]
69 | public string DisplayName { get; set; }
70 |
71 | }
72 | }
73 |
--------------------------------------------------------------------------------