Ejemplo n.º 1
0
        public void ExposeToApi()
        {
            new ActuatorSettingsHttpApiDispatcher(Settings, HttpApiController).ExposeToApi();

            HttpApiController.HandlePost($"actuator/{Id.Value}/status")
            .Using(c =>
            {
                JsonObject requestData;
                if (!JsonObject.TryParse(c.Request.Body, out requestData))
                {
                    c.Response.StatusCode = HttpStatusCode.BadRequest;
                    return;
                }

                var apiContext = new ApiRequestContext(requestData, new JsonObject());
                HandleApiPost(apiContext);

                c.Response.Body = new JsonBody(apiContext.Response);
            });

            HttpApiController.HandleGet($"actuator/{Id.Value}/status")
            .Using(c =>
            {
                c.Response.Body = new JsonBody(ExportStatusToJsonObject());
            });
        }
Ejemplo n.º 2
0
        static void Main(string[] args)
        {
            HttpApiController.InitializeClient();
            Console.ForegroundColor = ConsoleColor.Green;

            //Console.WriteLine("Welcome to the Weather App!");
            //Console.WriteLine("For a list of commands type /help");

            Console.WriteLine($"Welcome tp the GITHUB WebHTTPClient!");
            Console.ForegroundColor = ConsoleColor.Yellow;
            GitHubProcessor GHProcessor = new GitHubProcessor();

            GHProcessor.EndPoint = "https://api.github.com/user";
            Console.WriteLine("YOUR RESPONSE IS:");
            Task t = new Task(async() => await GHProcessor.PatchAsync());

            t.Start();
            Console.ReadLine();


            //while (true)
            //{
            //    cmd.ValidateInput(Console.ReadLine());
            //}
        }