using Bit.Core.Models.Teams; namespace Bit.Core.Services; /// /// Service that provides functionality relating to the Microsoft Teams integration including OAuth, /// team discovery and sending a message to a channel in Teams. /// public interface ITeamsService { /// /// Generate the Microsoft Teams OAuth 2.0 authorization URL used to begin the sign-in flow. /// /// The absolute redirect URI that Microsoft will call after user authorization. /// Must match the URI registered with the app configuration. /// A state token used to correlate the request and callback and prevent CSRF attacks. /// The full authorization URL to which the user should be redirected to begin the sign-in process. string GetRedirectUrl(string callbackUrl, string state); /// /// Exchange the OAuth code for a Microsoft Graph API access token. /// /// The code returned from Microsoft via the OAuth callback Url. /// The same redirect URI that was passed to the authorization request. /// A valid Microsoft Graph access token if the exchange succeeds; otherwise, an empty string. Task ObtainTokenViaOAuth(string code, string redirectUrl); /// /// Get the Teams to which the authenticated user belongs via Microsoft Graph API. /// /// A valid Microsoft Graph access token for the user (obtained via OAuth). /// A read-only list of objects representing the user’s joined teams. /// Returns an empty list if the request fails or if the token is invalid. Task> GetJoinedTeamsAsync(string accessToken); /// /// Send a message to a specific channel in Teams. /// /// This is used primarily by the to send events to the /// Teams channel. /// The service URI associated with the Microsoft Bot Framework connector for the target /// team. Obtained via the bot framework callback. /// The conversation or channel ID where the message should be delivered. Obtained via /// the bot framework callback. /// The message text to post to the channel. /// A task that completes when the message has been sent. Errors during message delivery are surfaced /// as exceptions from the underlying connector client. Task SendMessageToChannelAsync(Uri serviceUri, string channelId, string message); }