コード例 #1
0
 /// <summary>
 /// Makes a GET request to the specified <paramref name="url"/>.
 /// </summary>
 /// <param name="url">The URL of the request.</param>
 /// <param name="options">The options for the call to the specified <paramref name="url"/>.</param>
 /// <returns>An instance of <see cref="IHttpResponse"/> representing the response.</returns>
 public virtual IHttpResponse Get(string url, IHttpGetOptions options)
 {
     if (string.IsNullOrWhiteSpace(url))
     {
         throw new ArgumentNullException(nameof(url));
     }
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     return(DoHttpRequest(HttpMethod.Get, url, options.GetQueryString()));
 }
コード例 #2
0
 /// <summary>
 /// Makes a POST request to the specified <paramref name="url"/>.
 /// </summary>
 /// <param name="url">The URL of the request.</param>
 /// <param name="options">The options for the call to the specified <paramref name="url"/>.</param>
 /// <returns>An instance of <see cref="SocialHttpResponse"/> representing the response.</returns>
 public static SocialHttpResponse DoHttpPostRequest(string url, IHttpGetOptions options)
 {
     if (String.IsNullOrWhiteSpace(url))
     {
         throw new ArgumentNullException(nameof(url));
     }
     if (options == null)
     {
         throw new ArgumentNullException(nameof(options));
     }
     return(DoHttpRequest(SocialHttpMethod.Post, url, options.GetQueryString(), null));
 }
コード例 #3
0
 /// <summary>
 /// Makes a DELETE request to the specified <paramref name="url"/>.
 /// </summary>
 /// <param name="url">The URL of the request.</param>
 /// <param name="options">The options for the call to the specified <paramref name="url"/>.</param>
 /// <returns>An instance of <see cref="SocialHttpResponse"/> representing the response.</returns>
 public static SocialHttpResponse DoHttpDeleteRequest(string url, IHttpGetOptions options)
 {
     if (String.IsNullOrWhiteSpace(url))
     {
         throw new ArgumentNullException("url");
     }
     if (options == null)
     {
         throw new ArgumentNullException("options");
     }
     return(DoHttpRequest(SocialHttpMethod.Delete, url, options.GetQueryString()));
 }
コード例 #4
0
 /// <summary>
 /// Makes a POST request to the specified <code>url</code>.
 /// </summary>
 /// <param name="url">The URL of the request.</param>
 /// <param name="options">The options for the call to the specified <code>url</code>.</param>
 /// <returns>Returns an instance of <see cref="SocialHttpResponse"/> representing the response.</returns>
 public virtual SocialHttpResponse DoHttpPostRequest(string url, IHttpGetOptions options) {
     if (String.IsNullOrWhiteSpace(url)) throw new ArgumentNullException("url");
     if (options == null) throw new ArgumentNullException("options");
     return DoHttpRequest(SocialHttpMethod.Post, url, options.GetQueryString(), null);
 }
コード例 #5
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="options">The options for the call to the API.</param>
 /// <returns>Returns an instance of <see cref="SocialHttpResponse"/> representing the raw response.</returns>
 public virtual SocialHttpResponse DoHttpRequest(SocialHttpMethod method, string url, IHttpGetOptions options) {
     IHttpQueryString queryString = options == null ? null : options.GetQueryString();
     return DoHttpRequest(method, url, queryString);
 }
コード例 #6
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="options">The options for the call to the API.</param>
            /// <returns>An instance of <see cref="SocialHttpResponse"/> representing the raw response.</returns>
            public static SocialHttpResponse DoHttpRequest(SocialHttpMethod method, string url, IHttpGetOptions options)
            {
                IHttpQueryString queryString = options?.GetQueryString();

                return(DoHttpRequest(method, url, queryString));
            }