Exemple #1
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddControllers().AddNewtonsoftJson(x => x.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore);

            services.AddSwaggerGen(c =>
            {
                c.SwaggerDoc("v1", new OpenApiInfo {
                    Title = "WebApp", Version = "v1"
                });
            });

            services.AddHttpClient();

            services.AddMindSphereSdkService(options =>
            {
                options.Credentials = AppCredentials.FromJsonFile(@"..\..\mdspcreds.json");
            });
        }
        static async Task Main(string[] args)
        {
            AppCredentials appCredentials = AppCredentials.FromJsonFile(@"..\..\..\..\..\mdspcreds.json");
            HttpClient     httpClient     = new HttpClient();

            AssetManagementClient assetClient = new AssetManagementClient(appCredentials, httpClient);


            ListAssetsRequest request = new ListAssetsRequest()
            {
                Size = 200
            };
            List <Asset> test = (await assetClient.ListAssetsAsync(request)).ToList();

            foreach (var item in test)
            {
                Console.WriteLine(item.AssetId);
            }

            Console.ReadKey();
        }