/// <summary>
 /// Initializes a new request with default options.
 /// </summary>
 public SocialHttpRequest()
 {
     Method   = SocialHttpMethod.Get;
     Encoding = Encoding.UTF8;
     Timeout  = TimeSpan.FromSeconds(100);
     PostData = new SocialHttpPostData();
 }
Esempio n. 2
0
        /// <summary>
        /// Makes a HTTP request to the underlying API based on the specified parameters.
        /// </summary>
        /// <param name="method">The HTTP method of the request.</param>
        /// <param name="url">The base URL of the request (no query string).</param>
        /// <param name="queryString">The query string.</param>
        /// <param name="postData">The POST data.</param>
        /// <returns>Returns an instance of <see cref="SocialHttpResponse"/> representing the raw response.</returns>
        public virtual SocialHttpResponse DoHttpRequest(SocialHttpMethod method, string url, IHttpQueryString queryString, IHttpPostData postData) {

            // Some input validation
            if (String.IsNullOrWhiteSpace(url)) throw new ArgumentNullException("url");
            if (queryString == null) queryString = new SocialHttpQueryString();
            if (postData == null) postData = new SocialHttpPostData();

            // Initialize the request
            SocialHttpRequest request = new SocialHttpRequest {
                Method = method,
                Url = url,
                QueryString = queryString,
                PostData = postData
            };

            PrepareHttpRequest(request);

            // Make the call to the URL
            return request.GetResponse();

        }
 /// <summary>
 /// Initializes a new request with default options.
 /// </summary>
 public SocialHttpRequest() {
     Method = SocialHttpMethod.Get;
     Encoding = Encoding.UTF8;
     Timeout = TimeSpan.FromSeconds(100);
     PostData = new SocialHttpPostData();
 }