Exemple #1
0
        static void Main(string[] args)
        {
            try
            {
                if (string.IsNullOrWhiteSpace(CanopyAuthentication.ClientId) ||
                    string.IsNullOrWhiteSpace(CanopyAuthentication.ClientSecret))
                {
                    Console.WriteLine("Please set up ClientID and ClientSecret in CanopyAuthentication.");
                }

                if (!CanopyAuthentication.Instance.LoadAuthenticatedUser())
                {
                    Console.Write("Username: "******"Company: ");
                    var company = Console.ReadLine();
                    Console.Write("Password: "******"Requesting cars...");
                    var authenticatedUser = CanopyAuthentication.Instance.GetAuthenticatedUser().Result;
                    var configClient      = new ConfigClient(CanopyAuthentication.CanopyApiBaseUrl);
                    var result            = configClient.GetConfigsAsyncAsync(authenticatedUser.TenantId, "car", null, null).Result;
                    foreach (var item in result.QueryResults.Documents)
                    {
                        Console.WriteLine(item.Name);
                    }

                    System.Threading.Thread.Sleep(TimeSpan.FromMinutes(5));
                }
            }
            catch (Exception t)
            {
                Console.WriteLine();
                Console.WriteLine(t);
            }
        }