Example #1
0
        static async Task MainAsync(string[] args)
        {
            var authManager = new AuthManager(new WebManager());
            Console.WriteLine("If you have an auth token, enter it below. Else leave blank: ");
            var authToken = Console.ReadLine();
            if (string.IsNullOrEmpty(authToken))
            {
                authToken = await MakeNewUser(authManager);
            }
            if (string.IsNullOrEmpty(authToken))
            {
                Console.WriteLine("Error getting auth token!");
            }

            _webManager = new WebManager(authToken);
            await GetComputers();
            //await GetNames();
            //await GetUserInfo();
            //await MakePost();
            //await GetMessages();
            //await MakeComment();
            Console.ReadKey();
        }
Example #2
0
 public static async Task<string> MakeNewUser(AuthManager authManager)
 {
     Console.WriteLine("Enter your phone number: ");
     var number = Console.ReadLine();
     var codeResult = await authManager.RequestCodeAsync(number);
     Console.WriteLine("Enter the code you recieved: ");
     var code = Console.ReadLine();
     var authResult = await authManager.RegisterAsync(number, code);
     Console.WriteLine(authResult.Data.Token);
     return authResult.Data.Token;
 }