-
-
Save taion809/099f3c67ba5c2e70197d134fe0976520 to your computer and use it in GitHub Desktop.
F# json.net deserialize
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
namespace PoeIngester | |
open HttpFs.Client | |
open System.Net.Http | |
open Hopac | |
open Newtonsoft.Json | |
module Bookmark = | |
type responseBody = { | |
[<JsonProperty(PropertyName="next_change_id")>] | |
NextChangeId: string; | |
} | |
let apiUrl = "https://poe.ninja/api/Data/GetStats" | |
let fetch (client: HttpClient) = job { | |
let request = Request.createWithClient client Get (System.Uri(apiUrl)) | |
use! response = getResponse request | |
let! body = Response.readBodyAsString response | |
let rb = JsonConvert.DeserializeObject<responseBody>(body) | |
return rb.NextChangeId | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment