internal HyvesResponse(Stream responseStream, HyvesMethod method) { this.method = method; paginateInformation = null; StreamReader streamReader = new StreamReader(responseStream); this.rawResponse = streamReader.ReadToEnd(); try { JsonReader jsonReader = new JsonReader(new StringReader(this.rawResponse)); object result = jsonReader.ReadValue(); Hashtable jsonObject = result as Hashtable; if (jsonObject != null) { object errorCode = jsonObject["error_code"]; if (errorCode != null) { this.status = (HyvesResponseStatus)(int)errorCode; message = (string)jsonObject["error_message"]; } Hashtable info = jsonObject["info"] as Hashtable; if (info != null) { this.timestampDifference = (int)info["timestamp_difference"]; this.runningMilliseconds = (int)info["running_milliseconds"]; this.paginateInformation = new HyvesPaginateInformation(info); } } if (this.status == HyvesResponseStatus.Succeeded) { this.result = result; } } catch { this.status = HyvesResponseStatus.UnknownError; } }
internal HyvesResponse(HttpStatusCode errorStatusCode, HyvesMethod method) { status = (HyvesResponseStatus)((uint)HyvesResponseStatus.HttpError | (uint)errorStatusCode); this.method = method; }