Skip to content

Instantly share code, notes, and snippets.

@thinktainer
Created June 19, 2014 14:53
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save thinktainer/945af6eeba2db398f286 to your computer and use it in GitHub Desktop.
Save thinktainer/945af6eeba2db398f286 to your computer and use it in GitHub Desktop.
f# second session
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