// using (var client = new HttpClient())
// {
// using (var response = client.PostAsync(uri, new StringContent(JsonConvert.SerializeObject(content), Encoding.UTF8, "application/json")))
// {
// response.Result.EnsureSuccessStatusCode();
// }
// }
open System.Net.Http
open System.Text
open Newtonsoft.Json
module communication =
let post(message:string) = async {
let uri = "https://h...content-available-to-author-only...k.com/"
use client = new HttpClient()
use response = client.PostAsync(uri, new StringContent(JsonConvert.SerializeObject(message), Encoding.UTF8, "application/json"))
//do! response |> Async.RunSynchronously |>
}
Ly8JCQl1c2luZyAodmFyIGNsaWVudCA9IG5ldyBIdHRwQ2xpZW50KCkpCi8vCQkJewovLwkJCQl1c2luZyAodmFyIHJlc3BvbnNlID0gY2xpZW50LlBvc3RBc3luYyh1cmksIG5ldyBTdHJpbmdDb250ZW50KEpzb25Db252ZXJ0LlNlcmlhbGl6ZU9iamVjdChjb250ZW50KSwgRW5jb2RpbmcuVVRGOCwgImFwcGxpY2F0aW9uL2pzb24iKSkpCi8vCQkJCXsKLy8JCQkJCXJlc3BvbnNlLlJlc3VsdC5FbnN1cmVTdWNjZXNzU3RhdHVzQ29kZSgpOwovLwkJCQl9Ci8vCQkJfQpvcGVuIFN5c3RlbS5OZXQuSHR0cApvcGVuIFN5c3RlbS5UZXh0Cm9wZW4gTmV3dG9uc29mdC5Kc29uCgoKbW9kdWxlIGNvbW11bmljYXRpb24gPQogICAgbGV0IHBvc3QobWVzc2FnZTpzdHJpbmcpID0gYXN5bmMgewogICAgICAgIGxldCB1cmkgPSAiaHR0cHM6Ly9oLi4uY29udGVudC1hdmFpbGFibGUtdG8tYXV0aG9yLW9ubHkuLi5rLmNvbS8iCiAgICAgICAgdXNlIGNsaWVudCA9IG5ldyBIdHRwQ2xpZW50KCkKICAgICAgICB1c2UgcmVzcG9uc2UgPSBjbGllbnQuUG9zdEFzeW5jKHVyaSwgbmV3IFN0cmluZ0NvbnRlbnQoSnNvbkNvbnZlcnQuU2VyaWFsaXplT2JqZWN0KG1lc3NhZ2UpLCBFbmNvZGluZy5VVEY4LCAiYXBwbGljYXRpb24vanNvbiIpKQogICAgICAgIC8vZG8hIHJlc3BvbnNlIHw+IEFzeW5jLlJ1blN5bmNocm9ub3VzbHkgfD4gCiAgICB9