示例#1
0
        public SuggestEmailResponse QueryEmail(string email)
        {
            var request = new RestRequest(EMAIL_RESOURCE, Method.POST);
            var query   = new SuggestQuery(email);

            return(Execute <SuggestEmailResponse>(request, query));
        }
示例#2
0
        private T Execute <T>(RestRequest request, SuggestQuery query) where T : new()
        {
            request.AddHeader("Authorization", "Token " + this._token);
            request.AddHeader("Content-Type", _contentType.Name);
            request.AddHeader("Accept", _contentType.Name);
            request.RequestFormat             = _contentType.Format;
            request.XmlSerializer.ContentType = _contentType.Name;
            request.AddBody(query);
            var response = _client.Execute <T>(request);

            if (response.ErrorException != null)
            {
                throw response.ErrorException;
            }
            return(response.Data);
        }