Exemplo n.º 1
0
        async Task <KeyValueResponse <TContent> > GetAsync <TContent>(string key, KeyValueOptions options = null)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            string uri = Uri.EscapeUriString(String.Format("v1/kv/{0}", key));

            AppendQueryParameters(ref uri, options);

            HttpResponseMessage response = await _client.GetAsync(uri);

            TContent content = await ReadContentAsync <TContent>(response);

            var reply = new KeyValueResponse <TContent>(response, content);

            return(reply);
        }
Exemplo n.º 2
0
        public async Task <KeyValueResponse <dynamic> > GetDynamicAsync(string key, dynamic options = null)
        {
            if (key == null)
            {
                throw new ArgumentNullException("key");
            }

            string uri = Uri.EscapeUriString(String.Format("v1/kv/{0}", key));

            JObject jo = JObject.FromObject(options);
            JObjectQueryProvider queryProvider = new JObjectQueryProvider(jo);

            AppendQueryParameters(ref uri, queryProvider);

            HttpResponseMessage response = await _client.GetAsync(uri);

            dynamic content = await ReadContentAsync <dynamic>(response);

            var reply = new KeyValueResponse <dynamic>(response, content);

            return(reply);
        }