private static async Task CheckAuthenticationToken()
        {
            // Load a user from JSON
            var userJson = File.ReadAllText("myRtmUser.json");
            var user     = Rtm.GetUserFactory().LoadFromJson(userJson);

            var tokenVerifier = Rtm.GetAuthFactory().CreateTokenVerifier();

            try
            {
                if (await tokenVerifier.VerifyAsync(user.Token).ConfigureAwait(false))
                {
                    Console.WriteLine("Token is still valid.");
                }
                else
                {
                    // Token is expired or otherwise invalid.  you'll need to create a new authorization URL
                    // and instruct the user to reauthorize your app.
                    Console.WriteLine("Token is expired or invalid.");
                }
            }
            catch (RtmException ex)
            {
                // Some other API error was returned.
                Console.WriteLine($"RTM Error Code: {ex.ErrorCode}");
                Console.WriteLine($"RTM Error Message: {ex.Message}");
            }
        }
        private static ITaskRepository GetTaskRepository()
        {
            // Load a user from JSON
            var userJson = File.ReadAllText("myRtmUser.json");
            var user = Rtm.GetUserFactory().LoadFromJson(userJson);

            return Rtm.GetTaskRepository(user.Token);
        }
        private static ILocationRepository InitLocationRepository()
        {
            // Load a user from JSON
            var userJson = File.ReadAllText("myRtmUser.json");
            var user     = Rtm.GetUserFactory().LoadFromJson(userJson);

            return(Rtm.GetLocationRepository(user.Token));
        }
Exemple #4
0
        public void GetUserFactory_CreatesUserFactory()
        {
            var actual = Rtm.GetUserFactory();

            Assert.IsInstanceOf <UserFactory>(actual);
        }