-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRequests.fs
More file actions
32 lines (29 loc) · 1.59 KB
/
Requests.fs
File metadata and controls
32 lines (29 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
namespace WunderlistBackup
module Requests =
open FSharp.Data
open WunderlistBackup.Http
let asyncRequest credentials (method : HttpMethod) (segment : Segment) query =
Http.AsyncRequestString
(
url = credentials.endpoint.WithSegment segment.String,
query = query,
headers = [ "X-Client-ID", credentials.clientId.value
"X-Access-Token", credentials.token.value ],
httpMethod = method.String
)
//open Newtonsoft.Json.Linq
//let asyncRequest _ _ (segment : Segment) query =
// async {
// return
// match (segment, query) with
// | (Folders, _) -> System.IO.File.ReadAllText "FoldersJsonSample.json"
// | (Lists, _) -> System.IO.File.ReadAllText "ListsJsonSample.json"
// //| (Tasks, [ ("list_id", id) ]) -> (JArray.Parse(System.IO.File.ReadAllText "TasksJsonSample.json") |>
// // Seq.filter (fun jt -> jt.["list_id"].ToString() = id) |>
// // Seq.toArray |>
// // JArray).ToString()
// | (Tasks, _) -> System.IO.File.ReadAllText "TasksJsonSample.json"
// | (Subtasks, _) -> System.IO.File.ReadAllText "SubtasksJsonSample.json"
// | (Notes, _) -> System.IO.File.ReadAllText "NotesJsonSample.json"
// | (Files, _) -> System.IO.File.ReadAllText "FilesJsonSample.json"
// }