SetUriTransformer() public method

public SetUriTransformer ( IRestUriTransformer uriTransformer ) : void
uriTransformer IRestUriTransformer
return void
Exemplo n.º 1
0
        public static void Run()
        {
            AmazonUriSigner signer = new AmazonUriSigner(Services.AmazonAccessKey, Services.AmazonSecretKey);

            var templatedUriRequestBuilder = new TemplatedUriRequestBuilder(new RequestFactory());
            templatedUriRequestBuilder.Uri = Services.AmazonUri;
            templatedUriRequestBuilder.SetUriTransformer(signer);

            dynamic amazon = new RestClient(
                templatedUriRequestBuilder,
                new ResponseProcessor(new StandardResultBuilder(RestService.Xml)));

            dynamic searchOptions = new JsonObject();
            searchOptions.SearchIndex = "Books";
            searchOptions.Keywords = "Dynamic Programming";

            dynamic search = amazon.ItemSearch(searchOptions);
            dynamic bookList = search.Result;

            foreach (dynamic book in bookList.SelectAll("Item")) {
                Console.WriteLine(book.ASIN + " : " + book.ItemAttributes.Title);
            }
        }