public void PerformAction(string userId, Activity reply, string message) { if (RequiresAuthenticatedUser && !UsersRegistry.IsUserRegistered(userId)) { throw new UserNotAuthenticatedException(); } PerformActionInternal(userId, reply, message); }
protected override void PerformActionInternal(string userId, Activity reply, string message) { var oAuthClient = SplitwiseClientBuilder.BuildOAuthClient(); (string requestToken, string requestTokenSecret) = oAuthClient.GetRequestToken(); UsersRegistry.SaveRequestToken(userId, requestToken, requestTokenSecret); string authorizationUrl = oAuthClient.GetAuthorizationUrl(requestToken); var singinCard = CreateSinginCard(authorizationUrl); reply.Attachments.Add(singinCard.ToAttachment()); }
public SplitwiseBot( ILoggerFactory loggerFactory, UsersRegistry usersRegistry, BotActionsRegistry botActionsRegistry) { if (loggerFactory == null) { throw new System.ArgumentNullException(nameof(loggerFactory)); } _usersRegistry = usersRegistry; _botActionsRegistry = botActionsRegistry; _logger = loggerFactory.CreateLogger <SplitwiseBot>(); _logger.LogTrace("Turn start."); }
public ShowHelpAction(UsersRegistry usersRegistry, SplitwiseClientBuilder splitwiseClientBuilder) : base(usersRegistry, splitwiseClientBuilder) { }
public GetMembersListAction(UsersRegistry usersRegistry, SplitwiseClientBuilder splitwiseClientBuilder, IConfiguration configuration) : base(usersRegistry, splitwiseClientBuilder) { _configuration = configuration; }
public AuthenticateAction(UsersRegistry usersRegistry, SplitwiseClientBuilder splitwiseClientBuilder) : base(usersRegistry, splitwiseClientBuilder) { }
protected SplitwiseClient.SplitwiseClient CreateSplitwiseClient(string userId) { (string accessToken, string accessTokenSecret) = UsersRegistry.GetAccessTokenWithSecret(userId); return(SplitwiseClientBuilder.Build(accessToken, accessTokenSecret)); }
protected BotAction(UsersRegistry usersRegistry, SplitwiseClientBuilder splitwiseClientBuilder) { UsersRegistry = usersRegistry; SplitwiseClientBuilder = splitwiseClientBuilder; }
public OAuthController(SplitwiseClientBuilder splitwiseClientBuilder, UsersRegistry usersRegistry) { _splitwiseClientBuilder = splitwiseClientBuilder; _usersRegistry = usersRegistry; }