예제 #1
0
 /// <summary>
 /// Makes a GET 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 DoHttpGetRequest(string url, IGetOptions options)
 {
     if (String.IsNullOrWhiteSpace(url))
     {
         throw new ArgumentNullException("url");
     }
     if (options == null)
     {
         throw new ArgumentNullException("options");
     }
     return(DoHttpGetRequest(url, options.GetQueryString()));
 }
예제 #2
0
 /// <summary>
 /// Makes a GET request to the Facebook API. If the <code>AccessToken</code> property has
 /// been specified, the access token will be appended to the query string.
 /// </summary>
 /// <param name="url">The URL to call.</param>
 /// <param name="options">The options of the request.</param>
 /// <returns>Returns an instance of <code>SocialHttpResponse</code> wrapping the response from the Facebook Graph API.</returns>
 public SocialHttpResponse DoAuthenticatedGetRequest(string url, IGetOptions options) {
     return DoAuthenticatedGetRequest(url, options == null ? null : options.GetQueryString());
 }
예제 #3
0
 /// <summary>
 /// Makes a signed request to the Twitter 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>
 public virtual HttpWebResponse DoHttpRequest(string method, string url, IGetOptions options) {
     SocialQueryString queryString = options == null ? null : options.GetQueryString();
     return DoHttpRequest(method, url, queryString);
 }
예제 #4
0
 /// <summary>
 /// Makes a signed GET request to the specified <code>url</code>.
 /// </summary>
 /// <param name="url">The URL to call.</param>
 /// <param name="options">The options for the call to the API.</param>
 public virtual SocialHttpResponse DoHttpGetRequest(string url, IGetOptions options) {
     NameValueCollection nvc = (options == null ? null : options.GetQueryString().NameValueCollection);
     return SocialHttpResponse.GetFromWebResponse(DoHttpRequest("GET", url, nvc, null));
 }
 /// <summary>
 /// Makes an authenticated GET request to the specified URL. If an access token has been
 /// specified for this client, that access token will be added to the query string.
 /// Similar if a client ID has been specified instead of an access token, that client ID
 /// will be added to the query string. However some endpoint methods may require an access
 /// token, and a client ID will therefore not be sufficient for such methods.
 /// </summary>
 /// <param name="url">The URL to call.</param>
 /// <param name="query">The query string for the call.</param>
 public SocialHttpResponse DoAuthenticatedGetRequest(string url, IGetOptions query) {
     return DoAuthenticatedGetRequest(url, query == null ? null : query.GetQueryString());
 }
예제 #6
0
        /// <summary>
        /// Makes a signed request to the Twitter 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>
        public virtual HttpWebResponse DoHttpRequest(string method, string url, IGetOptions options)
        {
            SocialQueryString queryString = options == null ? null : options.GetQueryString();

            return(DoHttpRequest(method, url, queryString));
        }
예제 #7
0
        /// <summary>
        /// Makes an authenticated GET request to the specified URL. The access token is
        /// automatically appended to the query string.
        /// </summary>
        /// <param name="url">The URL to call.</param>
        /// <param name="options">The options for the call to the API.</param>
        public SocialHttpResponse DoAuthenticatedGetRequest(string url, IGetOptions options) {

            // Generate a NameValueCollection for the query string
            NameValueCollection query = options.GetQueryString().NameValueCollection;

            // Append the access token or server if specified
            if (!String.IsNullOrWhiteSpace(AccessToken)) {
                // TODO: Specify access token in HTTP header instead
                query.Set("access_token", AccessToken);
            } else if (!String.IsNullOrWhiteSpace(ServerKey)) {
                query.Set("key", ServerKey);
            }

            // Make a call to the API
            return SocialHttpResponse.GetFromWebResponse(SocialUtils.DoHttpGetRequest(url, query));

        }
 /// <summary>
 /// Makes an authenticated GET request to the specified URL. If an access token has been
 /// specified for this client, that access token will be added to the query string.
 /// Similar if a client ID has been specified instead of an access token, that client ID
 /// will be added to the query string. However some endpoint methods may require an access
 /// token, and a client ID will therefore not be sufficient for such methods.
 /// </summary>
 /// <param name="url">The URL to call.</param>
 /// <param name="query">The query string for the call.</param>
 public SocialHttpResponse DoAuthenticatedGetRequest(string url, IGetOptions query)
 {
     return(DoAuthenticatedGetRequest(url, query == null ? null : query.GetQueryString()));
 }
예제 #9
0
        /// <summary>
        /// Makes a signed GET request to the specified <code>url</code>.
        /// </summary>
        /// <param name="url">The URL to call.</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 DoHttpGetRequest(string url, IGetOptions options)
        {
            NameValueCollection nvc = (options == null ? null : options.GetQueryString().NameValueCollection);

            return(DoHttpRequest("GET", url, nvc, null));
        }