namespace Bit.Core.Services;
/// Defines operations for interacting with Slack, including OAuth authentication, channel discovery,
/// and sending messages.
public interface ISlackService
{
/// Note: This API is not currently used (yet) by any server code. It is here to provide functionality if
/// the UI needs to be able to look up channels for a user.
/// Retrieves the ID of a Slack channel by name.
/// See conversations.list API.
/// A valid Slack OAuth access token.
/// The name of the channel to look up.
/// The channel ID if found; otherwise, an empty string.
Task GetChannelIdAsync(string token, string channelName);
/// Note: This API is not currently used (yet) by any server code. It is here to provide functionality if
/// the UI needs to be able to look up channels for a user.
/// Retrieves the IDs of multiple Slack channels by name.
/// See conversations.list API.
/// A valid Slack OAuth access token.
/// A list of channel names to look up.
/// A list of matching channel IDs. Channels that cannot be found are omitted.
Task> GetChannelIdsAsync(string token, List channelNames);
/// Note: This API is not currently used (yet) by any server code. It is here to provide functionality if
/// the UI needs to be able to look up a user by their email address.
/// Retrieves the DM channel ID for a Slack user by email.
/// See users.lookupByEmail API and
/// conversations.open API.
/// A valid Slack OAuth access token.
/// The email address of the user to open a DM with.
/// The DM channel ID if successful; otherwise, an empty string.
Task GetDmChannelByEmailAsync(string token, string email);
/// Builds the Slack OAuth 2.0 authorization URL for the app.
/// See Slack OAuth v2 documentation.
/// The absolute redirect URI that Slack 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);
/// Exchanges a Slack OAuth code for an access token.
/// See oauth.v2.access API.
/// The authorization code returned by Slack via the callback URL after user authorization.
/// The redirect URI that was used in the authorization request.
/// A valid Slack access token if successful; otherwise, an empty string.
Task ObtainTokenViaOAuth(string code, string redirectUrl);
/// Sends a message to a Slack channel by ID.
/// See chat.postMessage API.
/// This is used primarily by the to send events to the
/// Slack channel.
/// A valid Slack OAuth access token.
/// The message text to send.
/// The channel ID to send the message to.
/// A task that completes when the message has been sent.
Task SendSlackMessageByChannelIdAsync(string token, string message, string channelId);
}