public static void Run() { var templatedUriRequestBuilder = new TemplatedUriRequestBuilder(new RequestFactory()); templatedUriRequestBuilder.Uri = Services.FlickrUri; dynamic flickr = new RestClient(templatedUriRequestBuilder, new ResponseProcessor(new StandardResultBuilder(RestService.Json))); flickr.apiKey = Services.FlickrApiKey; Console.WriteLine("Searching photos tagged with 'seattle'..."); dynamic photosOptions = new JsonObject(); photosOptions.tags = "seattle"; photosOptions.per_page = 4; dynamic search = flickr.Photos.Search(photosOptions); WritePhotos(search.Result); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Searching interesting photos..."); dynamic interestingnessOptions = new JsonObject(); interestingnessOptions.per_page = 4; dynamic listing = flickr.Interestingness.GetList(interestingnessOptions); WritePhotos(listing.Result); }
public static void Run() { //TODO: Fix this up with a request wrapper dynamic googleSearch = new RestClient(null, Services.GoogleSearchUri, RestService.Json); Console.WriteLine("Searching Google for 'seattle'..."); dynamic searchOptions = new JsonObject(); searchOptions.q = "seattle"; dynamic search = googleSearch.invokeAsync(searchOptions); search.Callback((RestCallback)delegate() { dynamic results = search.Result.responseData.results; foreach (dynamic item in results) { Console.WriteLine(item.titleNoFormatting); Console.WriteLine(item.url); Console.WriteLine(); } }); while (search.IsCompleted == false) { Console.WriteLine("."); Thread.Sleep(100); } }
public static void Run() { var templatedUriRequestBuilder = new TemplatedUriRequestBuilder(new RequestFactory()); templatedUriRequestBuilder.Uri = Services.BingSearchUri; dynamic bingSearch = new RestClient(templatedUriRequestBuilder, new ResponseProcessor(new StandardResultBuilder(RestService.Json))); bingSearch.appID = Services.BingApiKey; Console.WriteLine("Searching Bing for 'seattle'..."); dynamic searchOptions = new JsonObject(); searchOptions.Query = "seattle"; searchOptions.Sources = new string[] { "Web", "Image" }; searchOptions.Web = new JsonObject("Count", 4); searchOptions.Image = new JsonObject("Count", 2); dynamic search = bingSearch.invoke(searchOptions); dynamic searchResponse = search.Result.SearchResponse; foreach (dynamic item in searchResponse.Web.Results) { Console.WriteLine(item.Title); Console.WriteLine(item.DisplayUrl); Console.WriteLine(); } foreach (dynamic item in searchResponse.Image.Results) { Console.WriteLine(item.Title); Console.WriteLine(item.MediaUrl); Console.WriteLine(); } }
public static void Run() { dynamic bingSearch = new RestClient(Services.BingSearchUri, RestService.Json); bingSearch.appID = Services.BingApiKey; Console.WriteLine("Searching Bing for 'seattle'..."); dynamic searchOptions = new JsonObject(); searchOptions.Query = "seattle"; searchOptions.Sources = new string[] { "Web", "Image" }; searchOptions.Web = new JsonObject("Count", 4); searchOptions.Image = new JsonObject("Count", 2); dynamic search = bingSearch.invoke(searchOptions); dynamic searchResponse = search.Result.SearchResponse; foreach (dynamic item in searchResponse.Web.Results) { Console.WriteLine(item.Title); Console.WriteLine(item.DisplayUrl); Console.WriteLine(); } foreach (dynamic item in searchResponse.Image.Results) { Console.WriteLine(item.Title); Console.WriteLine(item.MediaUrl); Console.WriteLine(); } }
public static void Run() { var templatedUriRequestBuilder = new TemplatedUriRequestBuilder(new RequestFactory()); templatedUriRequestBuilder.Uri = Services.GoogleSearchUri; dynamic googleSearch = new RestClient(templatedUriRequestBuilder, new ResponseProcessor(new StandardResultBuilder(RestService.Json))); Console.WriteLine("Searching Google for 'seattle'..."); dynamic searchOptions = new JsonObject(); searchOptions.q = "seattle"; dynamic search = googleSearch.invokeAsync(searchOptions); search.Callback((RestCallback)delegate() { dynamic results = search.Result.responseData.results; foreach (dynamic item in results) { Console.WriteLine(item.titleNoFormatting); Console.WriteLine(item.url); Console.WriteLine(); } }); while (search.IsCompleted == false) { Console.WriteLine("."); Thread.Sleep(100); } }
public static void Run() { dynamic amazon = new RestClient(AppSettings.Default.AmazonUri, RestClientMode.Xml); amazon.subscriptionID = AppSettings.Default.AmazonSubscriptionID; dynamic searchOptions = new JsonObject(); searchOptions.SearchIndex = "Books"; searchOptions.Keywords = "Dynamic Programming"; dynamic bookList = amazon.ItemSearch(searchOptions); foreach (dynamic book in bookList.SelectAll("Item")) { Console.WriteLine(book.ASIN + " : " + book.ItemAttributes.Title); } }
public static void Run() { AmazonUriSigner signer = new AmazonUriSigner(Services.AmazonAccessKey, Services.AmazonSecretKey); dynamic amazon = new RestClient(Services.AmazonUri, RestService.Xml). WithUriTransformer(signer); 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); } }
public override bool TryGetMember(GetMemberBinder binder, out object result) { object value = _requestBuilder.ParametersStore.GetParameter(binder.Name); if (value != null) { result = value; return true; } string operationGroup = binder.Name; if (_operationGroup != null) { operationGroup = _operationGroup + "." + operationGroup; } var operationGroupClient = new RestClient(this, operationGroup); result = operationGroupClient; return true; }
public static void Run() { dynamic liveSearch = new RestClient(AppSettings.Default.LiveSearchUri, RestClientMode.Json); liveSearch.appID = AppSettings.Default.LiveSearchApiKey; Console.WriteLine("Searching Live for 'seattle'..."); dynamic searchOptions = new JsonObject(); searchOptions.Query = "seattle"; dynamic response = liveSearch(searchOptions); dynamic results = response.SearchResponse.Web.Results; foreach (dynamic item in results) { Console.WriteLine(item.Title); Console.WriteLine(item.DisplayUrl); Console.WriteLine(); } }
public static void Run() { List<string> PostOps = new List<string>() { "checkin_test", }; dynamic untappd = new RestClient(Services.UntappdUri, RestService.Json, PostOps); untappd.apiKey = Services.UntappdApiKey; untappd = untappd.WithBasicAuth(Services.UntappdCheckinAs, MD5(Services.UntappdCheckinAsPassword)); Console.WriteLine("Checking in"); dynamic checkinOptions = new JsonObject(); checkinOptions.gmt_offset = -8; checkinOptions.bid = 1; dynamic checkin = untappd.checkin_test(checkinOptions); Console.WriteLine(string.Format("That was checkin ID #{0}",checkin.Result.checkin_details.checkin_id)); }
public static void Run() { dynamic flickr = new RestClient(AppSettings.Default.FlickrUri, RestClientMode.Json); flickr.apiKey = AppSettings.Default.FlickrApiKey; Console.WriteLine("Searching photos tagged with 'seattle'..."); dynamic photosOptions = new JsonObject(); photosOptions.tags = "seattle"; photosOptions.per_page = 4; dynamic searchResponse = flickr.Photos.Search(photosOptions); WritePhotos(searchResponse); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Searching interesting photos..."); dynamic interestingList = flickr.Interestingness.GetList(); WritePhotos(interestingList); }
public override bool TryGetMember(GetMemberBinder binder, out object result) { if (_parameters == null) { _parameters = new Dictionary<string, object>(); } object value; if (_parameters.TryGetValue(binder.Name, out value)) { result = value; return true; } string operationGroup = binder.Name; if (_operationGroup != null) { operationGroup = _operationGroup + "." + operationGroup; } RestClient operationGroupClient = new RestClient(_uriFormat, _service, operationGroup, _parameters); result = operationGroupClient; return true; }
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); } }
private RestClient(RestClient restClient, string operationGroup) : this(restClient._requestBuilder, restClient._responseProcessor) { _operationGroup = operationGroup; }
protected override object GetMember(GetMemberAction action) { if (_parameters == null) { _parameters = new Dictionary<string, object>(); } object value; if (_parameters.TryGetValue(action.Name, out value)) { return value; } string operationGroup = action.Name; if (_operationGroup != null) { operationGroup = _operationGroup + "." + operationGroup; } RestClient operationGroupClient = new RestClient(_uriFormat, _mode, operationGroup, _parameters); return operationGroupClient; }
public static void Run() { dynamic flickr = new RestClient(Services.FlickrUri, RestService.Json); flickr.apiKey = Services.FlickrApiKey; Console.WriteLine("Searching photos tagged with 'seattle'..."); dynamic photosOptions = new JsonObject(); photosOptions.tags = "seattle"; photosOptions.per_page = 4; dynamic search = flickr.Photos.Search(photosOptions); WritePhotos(search.Result); Console.WriteLine(); Console.WriteLine(); Console.WriteLine("Searching interesting photos..."); dynamic interestingnessOptions = new JsonObject(); interestingnessOptions.per_page = 4; dynamic listing = flickr.Interestingness.GetList(interestingnessOptions); WritePhotos(listing.Result); }