microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
core/src/Microsoft.Teams.Apps/AppBuilder.cs
36lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | namespace Microsoft.Teams.Apps; |
| 5 | |
| 6 | /// <summary> |
| 7 | /// Provides a static entry point for creating an <see cref="AppBuilder"/>. |
| 8 | /// </summary> |
| 9 | public static class App |
| 10 | { |
| 11 | /// <summary> |
| 12 | /// Creates a new <see cref="AppBuilder"/> instance for configuring a Teams bot application. |
| 13 | /// </summary> |
| 14 | /// <returns>A new <see cref="AppBuilder"/>.</returns> |
| 15 | public static AppBuilder Builder() => new(); |
| 16 | } |
| 17 | |
| 18 | /// <summary> |
| 19 | /// Fluent builder for configuring a Teams bot application. |
| 20 | /// Wraps <see cref="TeamsBotApplicationOptions"/> for backward compatibility with the old <c>App.Builder()</c> pattern. |
| 21 | /// </summary> |
| 22 | public class AppBuilder |
| 23 | { |
| 24 | internal TeamsBotApplicationOptions Options { get; } = new(); |
| 25 | |
| 26 | /// <summary> |
| 27 | /// Registers an OAuth connection for the bot application. |
| 28 | /// </summary> |
| 29 | /// <param name="connectionName">The OAuth connection name configured on the bot.</param> |
| 30 | /// <returns>This builder instance for chaining.</returns> |
| 31 | public AppBuilder AddOAuth(string connectionName) |
| 32 | { |
| 33 | Options.AddOAuthFlow(connectionName); |
| 34 | return this; |
| 35 | } |
| 36 | } |
| 37 | |