Created
June 19, 2014 14:53
-
-
Save thinktainer/945af6eeba2db398f286 to your computer and use it in GitHub Desktop.
f# second session
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
open ApiaryProvider | |
let mdb = new ApiaryProvider<"themoviedb">("http://api.themoviedb.org") | |
mdb.AddQueryParam("api_key", ApiKey) | |
let query = "query", "craig" | |
let res = mdb.Search.Person(query=[query]) | |
let totalPages = res.TotalPages | |
let pages = | |
seq { 1 .. totalPages } | |
|> Seq.map (fun x -> mdb.Search.AsyncPerson(query=[query; "page", x.ToString()])) | |
|> Async.Parallel | |
|> Async.RunSynchronously | |
let results = pages |> Array.collect(fun rs -> rs.Results) | |
let pop = results |> Seq.sortBy (fun x -> x.JsonValue) | |
let fi = res.Results |> Seq.filter(fun p -> p.Name.Contains("Daniel")) | |
let h = results |> Seq.head | |
printfn "%A" h.JsonValue | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment