Example #1
0
        IRestResponse GetValidatedResponse(IRestResponse response, HttpStatusCode[] validStatuses)
        {
            if (response.ResponseStatus == ResponseStatus.Error && response.ErrorException != null)
            {
                throw response.ErrorException;
            }

            if (validStatuses == null)
            {
                ErrorProvider.ThrowIfStatusMismatch(response, HttpStatusCode.OK);
            }
            else
            {
                ErrorProvider.ThrowIfStatusMismatch(response, validStatuses);
            }

            return(response);
        }
Example #2
0
        /// <summary>
        ///   Writes the value to HBase using the identifier.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        /// <param name="value">The value.</param>
        public virtual void WriteValue(Identifier identifier, string value)
        {
            string        contentType = Options.ContentType;
            string        resource    = ResourceBuilder.BuildSingleValueAccess(identifier);
            string        content     = Converter.ConvertCell(new Cell(identifier, value));
            IRestResponse response    = SendRequest(Method.POST, resource, contentType, contentType, content);

            ErrorProvider.ThrowIfStatusMismatch(response, HttpStatusCode.OK);
        }