Last active
December 17, 2015 19:58
-
-
Save bhameyie/5663784 to your computer and use it in GitHub Desktop.
using RestSharp and imdbapi.com to get movie data
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class Finder | |
{ | |
RestClient client = new RestClient("http://www.imdbapi.com/"); | |
public delegate void FindingMovie(string content); | |
public event FindingMovie OnMovieFound; | |
public void FindMovie(string title) | |
{ | |
var request = new RestRequest(string.Format("?i=&t={0}&plot=full", title),Method.GET); | |
request.RequestFormat = DataFormat.Json; | |
client.ExecuteAsync<Movie>(request, Callback()); | |
} | |
private Action<RestResponse<Movie>> Callback() | |
{ | |
return (e) => OnMovieFound(e.Content); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment