Exemplo n.º 1
0
        T ReadValueInternal <T>(Identifier identifier, Func <Method, string, string, string, string, HttpStatusCode[], T> action)
        {
            string resource = identifier.Timestamp.HasValue
        ? ResourceBuilder.BuildCellOrRowQuery(identifier.ToQuery())
        : ResourceBuilder.BuildSingleValueAccess(identifier, true);

            return(action(Method.GET, resource, Options.ContentType, null, null, new[] { HttpStatusCode.OK, HttpStatusCode.NotFound }));
        }
Exemplo n.º 2
0
        /// <summary>
        ///   Reads the value with the matching identifier.
        /// </summary>
        /// <param name="identifier">The identifier.</param>
        public virtual string ReadValue(Identifier identifier)
        {
            string resource = identifier.Timestamp.HasValue
        ? ResourceBuilder.BuildCellOrRowQuery(identifier.ToQuery())
        : ResourceBuilder.BuildSingleValueAccess(identifier, true);

            IRestResponse response = SendRequest(Method.GET, resource, Options.ContentType);

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

            return(response.StatusCode == HttpStatusCode.OK
        ? Converter.ConvertCells(response.Content, identifier.Table).Select(cell => cell.Value).FirstOrDefault()
        : null);
        }