public static FunkUserInfo FromJSON(String iJSON) { FunkUserInfo pFIoInfo = new FunkUserInfo(); using (JsonReader pJRrReader = new JsonTextReader(new StringReader(iJSON))) { pJRrReader.DateParseHandling = DateParseHandling.None; JObject pJOtJSON = JObject.Load(pJRrReader); pFIoInfo.cStrAuthenticated = pJOtJSON["Authenticated"].Value <String>(); pFIoInfo.cStrEmail = pJOtJSON["Email"].Value <String>(); pFIoInfo.cStrNameIdentifier = pJOtJSON["NameIdentifier"] != null ? pJOtJSON["NameIdentifier"].Value <String>() : String.Empty; pFIoInfo.cBlnRegistered = pJOtJSON["Registered"].Value <Boolean>(); pFIoInfo.cBlnActivated = pJOtJSON["Activated"] != null ? pJOtJSON["Activated"].Value <Boolean>() : false; pFIoInfo.cBlnLocked = pJOtJSON["Locked"] != null ? pJOtJSON["Locked"].Value <Boolean>() : false; } return(pFIoInfo); }
public static async Task <FunkManagementGetUserInfoResponse> GetUserInfoAsync(this FunkClient iFunkClient) { HttpResponseMessage pHRMResponse = await iFunkClient.AuthenticatedRequestAsync("GET", iFunkClient.GetFunctionURI("UserInfo")); if (pHRMResponse.IsSuccessStatusCode) { String pStrResponse = await pHRMResponse.Content.ReadAsStringAsync(); FunkUserInfo pFIOResponse = FunkUserInfo.FromJSON(pStrResponse); return(new FunkManagementGetUserInfoResponse(true, pFIOResponse)); } else { return(new FunkManagementGetUserInfoResponse(false, null)); } }