-
Notifications
You must be signed in to change notification settings - Fork 209
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[C#] feat: add file and o365 card handlers (#785)
## Linked issues closes: #606 ## Details Add handlers for: - `fileConsent/invoke` - `actionableMessage/executeAction` #### Change details Added 3 methods to `Application`: - `OnFileConsentAccept` - `OnFileConsentDecline` - `OnO365ConnectorCardAction` Added unit tests ## Attestation Checklist - [X] My code follows the style guidelines of this project - I have checked for/fixed spelling, linting, and other errors - I have commented my code for clarity - I have made corresponding changes to the documentation (we use [TypeDoc](https://typedoc.org/) to document our code) - My changes generate no new warnings - I have added tests that validates my changes, and provides sufficient test coverage. I have tested with: - Local testing - E2E testing in Teams - New and existing unit tests pass locally with my changes ### Additional information > Feel free to add other relevant information below
- Loading branch information
Showing
4 changed files
with
305 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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 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
18 changes: 18 additions & 0 deletions
18
dotnet/packages/Microsoft.TeamsAI/Microsoft.TeamsAI/Application/FileConsentCardHandler.cs
This file contains 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,18 @@ | ||
using Microsoft.Bot.Builder; | ||
using Microsoft.Bot.Schema.Teams; | ||
using Microsoft.TeamsAI.State; | ||
|
||
namespace Microsoft.TeamsAI.Application | ||
{ | ||
/// <summary> | ||
/// Function for handling file consent card activities. | ||
/// </summary> | ||
/// <typeparam name="TState">Type of the turn state. This allows for strongly typed access to the turn state.</typeparam> | ||
/// <param name="turnContext">A strongly-typed context object for this turn.</param> | ||
/// <param name="turnState">The turn state object that stores arbitrary data for this turn.</param> | ||
/// <param name="fileConsentCardResponse">The response representing the value of the invoke activity sent when the user acts on a file consent card.</param> | ||
/// <param name="cancellationToken">A cancellation token that can be used by other objects | ||
/// or threads to receive notice of cancellation.</param> | ||
/// <returns>A task that represents the work queued to execute.</returns> | ||
public delegate Task FileConsentHandler<TState>(ITurnContext turnContext, TState turnState, FileConsentCardResponse fileConsentCardResponse, CancellationToken cancellationToken) where TState : ITurnState<StateBase, StateBase, TempState>; | ||
} |
18 changes: 18 additions & 0 deletions
18
...ackages/Microsoft.TeamsAI/Microsoft.TeamsAI/Application/O365ConnectorCardActionHandler.cs
This file contains 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,18 @@ | ||
using Microsoft.Bot.Builder; | ||
using Microsoft.Bot.Schema.Teams; | ||
using Microsoft.TeamsAI.State; | ||
|
||
namespace Microsoft.TeamsAI.Application | ||
{ | ||
/// <summary> | ||
/// Function for handling O365 Connector Card Action activities. | ||
/// </summary> | ||
/// <typeparam name="TState">Type of the turn state. This allows for strongly typed access to the turn state.</typeparam> | ||
/// <param name="turnContext">A strongly-typed context object for this turn.</param> | ||
/// <param name="turnState">The turn state object that stores arbitrary data for this turn.</param> | ||
/// <param name="query">The O365 connector card HttpPOST invoke query.</param> | ||
/// <param name="cancellationToken">A cancellation token that can be used by other objects | ||
/// or threads to receive notice of cancellation.</param> | ||
/// <returns>A task that represents the work queued to execute.</returns> | ||
public delegate Task O365ConnectorCardActionHandler<TState>(ITurnContext turnContext, TState turnState, O365ConnectorCardActionQuery query, CancellationToken cancellationToken) where TState : ITurnState<StateBase, StateBase, TempState>; | ||
} |