コード例 #1
0
        public void PerformAction(string userId, Activity reply, string message)
        {
            if (RequiresAuthenticatedUser && !UsersRegistry.IsUserRegistered(userId))
            {
                throw new UserNotAuthenticatedException();
            }

            PerformActionInternal(userId, reply, message);
        }
コード例 #2
0
        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());
        }
コード例 #3
0
        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.");
        }
コード例 #4
0
 public ShowHelpAction(UsersRegistry usersRegistry, SplitwiseClientBuilder splitwiseClientBuilder)
     : base(usersRegistry, splitwiseClientBuilder)
 {
 }
コード例 #5
0
 public GetMembersListAction(UsersRegistry usersRegistry, SplitwiseClientBuilder splitwiseClientBuilder,
                             IConfiguration configuration)
     : base(usersRegistry, splitwiseClientBuilder)
 {
     _configuration = configuration;
 }
コード例 #6
0
 public AuthenticateAction(UsersRegistry usersRegistry, SplitwiseClientBuilder splitwiseClientBuilder)
     : base(usersRegistry, splitwiseClientBuilder)
 {
 }
コード例 #7
0
 protected SplitwiseClient.SplitwiseClient CreateSplitwiseClient(string userId)
 {
     (string accessToken, string accessTokenSecret) = UsersRegistry.GetAccessTokenWithSecret(userId);
     return(SplitwiseClientBuilder.Build(accessToken, accessTokenSecret));
 }
コード例 #8
0
 protected BotAction(UsersRegistry usersRegistry, SplitwiseClientBuilder splitwiseClientBuilder)
 {
     UsersRegistry          = usersRegistry;
     SplitwiseClientBuilder = splitwiseClientBuilder;
 }
コード例 #9
0
 public OAuthController(SplitwiseClientBuilder splitwiseClientBuilder, UsersRegistry usersRegistry)
 {
     _splitwiseClientBuilder = splitwiseClientBuilder;
     _usersRegistry          = usersRegistry;
 }