internal ServerResponse(ServerResponseDTO serverResponseDTO) { if (serverResponseDTO == null) { throw new ArgumentNullException(nameof(serverResponseDTO)); } OK = serverResponseDTO.OK; Error = ServerResponseError.FromString(serverResponseDTO.Error, serverResponseDTO.Reason); Reason = serverResponseDTO.Reason; }
/// <summary> /// Initializes new instance of <see cref="SaveDocResponse"/> class. /// </summary> /// <param name="docResponseDTO">DTO with vaues for initialization.</param> /// <exception cref="ArgumentNullException">Required parameter is null or empty.</exception> public SaveDocResponse(CouchDBDatabase.SaveDocResponseDTO docResponseDTO) { if (docResponseDTO == null) { throw new ArgumentNullException(nameof(docResponseDTO)); } Id = docResponseDTO.Id; Revision = docResponseDTO.Rev; Error = ServerResponseError.FromString(docResponseDTO.Error, docResponseDTO.Reason); }
/// <summary> /// Create <see cref="DocListResponseRow{String}"/> by <see cref="JObject"/>. /// </summary> /// <param name="json"></param> /// <returns></returns> ///// <exception cref="NoException"></exception> internal static DocListResponseRow <string> FromJsonToString(JObject json) { var id = SerializationHelper.GetStringOrDefault(json, "id"); var key = SerializationHelper.GetStringOrDefault(json, "key"); var value = SerializationHelper.GetObjectOrDefault(json, "value"); var doc = SerializationHelper.GetObjectOrDefault(json, "doc")?.ToString(); var error = SerializationHelper.GetStringOrDefault(json, "error"); return(new DocListResponseRow <string>(id, key, DocListResponseRowValue.FromJson(value), doc, ServerResponseError.FromString(error))); }