Exemple #1
0
        public async Task Execute()
        {
            while (true)
            {
                //Get the html code from the google home page
                await httpClient.Get("http://www.google.com");

                //Asynchronously, get the json from jsonplaceholder and serialize it.
                httpClient.Get <List <Todo> >("https://jsonplaceholder.typicode.com/todos/", options =>
                {
                    options.RequestMediaType = new JsonHttpMediaType();
                    options.AddHeader("Authorization", "Bearer <token>");
                    options.QueryStrings.Add("name", "John Doe");
                }).Subscribe();

                tmdbConsumer.ListMovies().Subscribe();

                httpClient.Post <Identifiable>(@"https://jsonplaceholder.typicode.com/posts", new Post()
                {
                    Title  = "Foo",
                    Body   = "Bar",
                    UserId = 3
                }).Subscribe();

                await httpClient.Post(@"https://postman-echo.com/post");
            }
        }
Exemple #2
0
        public async Task Execute()
        {
            await httpClient.Get("http://google.com");

            await tmdbConsumer.ListMovies();

            await jsonPlaceHolderConsumer.GetTodos();

            await jsonPlaceHolderConsumer.SendPost(new Post()
            {
                Title  = "Foo",
                Body   = "Bar",
                UserId = 3
            });
        }