using Newtonsoft.Json; using System.Collections.Generic; namespace MatrixDotNetLib { public class MatrixEventContent { public string Body { get; set; } public string Creator { get; set; } public string DisplayName { get; set; } [JsonProperty("event_id")] public string EventId { get; set; } /// /// Gets or sets the event content info property - check FileInfo.MimeType for file type /// [JsonProperty("info")] public MatrixImageInfo FileInfo { get; set; } [JsonProperty("currently_active")] public bool IsActive { get; set; } [JsonProperty("join_rule")] public string JoinRule { get; set; } [JsonProperty("last_active_ago")] public int LastActive { get; set; } public string Membership { get; set; } public string Name { get; set; } public string Presence { get; set; } [JsonProperty("room_version")] public string RoomVersion { get; set; } public List Users { get; set; } } } //// simplest implementation //// might not work for UWP //// sauce: https://stackoverflow.com/questions/5527316/how-to-set-the-content-of-an-httpwebrequest-in-c //HttpContent requestContent = new StringContent(requestJson, Encoding.UTF8, "application/json"); //HttpClient client = new HttpClient(); //client.BaseAddress = new Uri(loginUrl); //client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("application/json")); //HttpResponseMessage responseMessage = client.PostAsync(loginUrl, requestContent).Result; //string responseString = responseMessage.Content.ReadAsStringAsync().Result; //if(responseString.Contains("errcode")) //{ // // deserialize into error object // MatrixError error = JsonConvert.DeserializeObject(responseString); // // convert error object to a string // string errMsg = error.ErrorCode + ": " + error.ErrorMessage; // // throw exception (can be caught and handled gracefully) // throw new Exception(errMsg); //} //else //{ // MatrixLoginResponse response = JsonConvert.DeserializeObject(responseString); // return response; //}