Skip to content

Instantly share code, notes, and snippets.

@follesoe
Created March 20, 2013 09:39
Show Gist options
  • Save follesoe/5203471 to your computer and use it in GitHub Desktop.
Save follesoe/5203471 to your computer and use it in GitHub Desktop.
Consuming RegObs OData Feed from F#
#r "FSharp.Data.TypeProviders"
#r "System.Data.Services.Client"
open System
open Microsoft.FSharp.Linq
open Microsoft.FSharp.Data.TypeProviders
type RegObs = ODataService<"http://api.nve.no/hydrology/regobs/v0.8.7/Odata.svc">
let data = RegObs.GetDataContext()
let ava = query {
for a in data.AvalancheObs do
where (a.Comment.Length > 0)
sortByDescending a.DtAvalancheTime
take 10
select a
}
ava |> Seq.iter(fun a -> printfn "(%A): %s" a.DtAvalancheTime a.Comment)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment