microsoft/teams.net
Publicmirrored fromhttps://github.com/microsoft/teams.netAvailable
core/src/Microsoft.Teams.Core/Schema/AgenticIdentity.cs
43lines · modecode
| 1 | // Copyright (c) Microsoft Corporation. |
| 2 | // Licensed under the MIT License. |
| 3 | |
| 4 | namespace Microsoft.Teams.Core.Schema; |
| 5 | |
| 6 | /// <summary> |
| 7 | /// Represents an agentic identity for user-delegated token acquisition. |
| 8 | /// </summary> |
| 9 | public sealed class AgenticIdentity |
| 10 | { |
| 11 | /// <summary> |
| 12 | /// Agentic application ID. |
| 13 | /// </summary> |
| 14 | public string? AgenticAppId { get; set; } |
| 15 | /// <summary> |
| 16 | /// Agentic user ID. |
| 17 | /// </summary> |
| 18 | public string? AgenticUserId { get; set; } |
| 19 | |
| 20 | /// <summary> |
| 21 | /// Agentic application blueprint ID. |
| 22 | /// </summary> |
| 23 | public string? AgenticAppBlueprintId { get; set; } |
| 24 | |
| 25 | /// <summary> |
| 26 | /// Creates an <see cref="AgenticIdentity"/> from a <see cref="ChannelAccount"/>'s typed agentic fields. |
| 27 | /// Returns null if the account is null or has no agentic fields set. |
| 28 | /// </summary> |
| 29 | public static AgenticIdentity? FromAccount(ChannelAccount? account) |
| 30 | { |
| 31 | if (account is null || (account.AgenticAppId is null && account.AgenticUserId is null && account.AgenticAppBlueprintId is null)) |
| 32 | { |
| 33 | return null; |
| 34 | } |
| 35 | |
| 36 | return new AgenticIdentity |
| 37 | { |
| 38 | AgenticAppId = account.AgenticAppId, |
| 39 | AgenticUserId = account.AgenticUserId, |
| 40 | AgenticAppBlueprintId = account.AgenticAppBlueprintId |
| 41 | }; |
| 42 | } |
| 43 | } |
| 44 | |