Beispiel #1
0
        private static async Task Main()
        {
            Console.WriteLine("C# Client");

            var apiKey  = Environment.GetEnvironmentVariable("API_KEY");
            var project = Environment.GetEnvironmentVariable("PROJECT");

            using var handler = new HttpClientHandler
                  {
                      ServerCertificateCustomValidationCallback = (message, cert, chain, errors) => true
                  };
            var serviceCollection = new ServiceCollection();

            ConfigureServices(serviceCollection);
            var serviceProvider = serviceCollection.BuildServiceProvider();

            var logger = serviceProvider.GetService <ILoggerFactory>().CreateLogger <Program>();

            using var httpClient = new HttpClient(handler);
            var builder = new Client.Builder();
            var client  =
                builder
                .SetAppId("playground")
                .SetHttpClient(httpClient)
                .SetApiKey(apiKey)
                .SetProject(project)
                .SetLogger(logger)
                .SetLogLevel(LogLevel.Debug)
                .Build();

            var asset = await GetAssetsExample(client, "23-TE-96116-04").ConfigureAwait(false);

            Console.WriteLine($"{asset}");
            //var data = await QueryTimeseriesDataExample(client);
        }