fsprojects / FSharp.Data

F# Data: Library for Data Access
https://fsprojects.github.io/FSharp.Data
Other
815 stars 287 forks source link

OAuth support #453

Open ovatsus opened 10 years ago

ovatsus commented 10 years ago

See if we can somehow combine https://github.com/endeavour/PerfectShuffle.OAuth with https://github.com/fsharp/FSharp.Data/pull/451

/cc @veikkoeeva

ovatsus commented 10 years ago

The twitter provider from F# Data Toolbox also has an OAuth implementation. Would be nice to extract and make reusable https://github.com/fsprojects/FSharp.Data.Toolbox/blob/master/src/FSharp.Data.Toolbox.Twitter/Twitter.fs

dsyme commented 8 years ago

Just to mention that I was using the GitHub API today, unauthenticated, and quickly hit the rate limitations of that API. It would have been great if I could have very seamlessly switched to OAuth or Basic authentication - including for both design-time and compile-time web requests

dsyme commented 8 years ago

Sample code that I wanted to convert to OAuth - just JSON + URLs


#I "script-packages/packages/FSharp.Data/lib/net40"
#r "script-packages/packages/FSharp.Data/lib/net40/FSharp.Data.dll"

open System
open System.IO
open FSharp.Data

[<Literal>]
let repo = "https://github.com/Microsoft/visualfsharp"
[<Literal>]
let repoApi = "https://api.github.com/repos/Microsoft/visualfsharp"
type Commits = JsonProvider< const (repoApi + "/commits")>

type Pulls = JsonProvider< const (repoApi + "/pulls")>

type Comments = JsonProvider< "https://api.github.com/repos/Microsoft/visualfsharp/issues/848/comments">

let commits = Commits.GetSamples()
let pulls = Pulls.GetSamples()

let buildSpecs = 
    [ for pr in pulls do
         if pr.Title.Contains("[CompilerPerf]") then
             yield (pr.Head.Repo.CloneUrl, pr.Head.Sha, repoHeadSha, pr.Head.Ref, pr.Number) 
      yield ("https://github.com/forki/visualfsharp.git", "d0ab5fec77482e1280578f47e3257cf660d7f1b2", repoHeadSha, "foreach_optimization", 1303);
      yield (repo, repoHeadSha, repoHeadSha, "master", 0);
    ]
kontomondo commented 8 years ago

@ovatsus @dsyme Does FSharp.Data not support basic authentiation in the form of //<user>:<password>@<host>:<port>/<url-path> (As per RFC1738)? If that's the case I could add it.

carlpaten commented 6 years ago

This would still be nice :0