Ejemplo n.º 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));
        }
Ejemplo n.º 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);
        }