/// <summary> /// Makes a POST 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> public SocialHttpResponse DoAuthenticatedPostRequest(string url, IPostOptions options) { if (options == null) { throw new ArgumentNullException("options"); } return(DoAuthenticatedPostRequest(url, options.GetQueryString(), options.GetPostData(), options.IsMultipart)); }
/// <summary> /// Makes a signed POST 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 DoHttpPostRequest(string url, IPostOptions options) { SocialQueryString query = (options == null ? null : options.GetQueryString()); SocialPostData postData = (options == null ? null : options.GetPostData()); NameValueCollection nvcQuery = (query == null ? null : query.NameValueCollection); NameValueCollection nvcPostData = (postData == null ? null : postData.ToNameValueCollection()); // TODO: Converting the POST data to a NameValueCollection will not support multipart data return(DoHttpRequest("POST", url, nvcQuery, nvcPostData)); }
/// <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, IPostOptions options) { if (String.IsNullOrWhiteSpace(url)) { throw new ArgumentNullException("url"); } if (options == null) { throw new ArgumentNullException("options"); } return(DoHttpPostRequest(url, options.GetQueryString(), options.GetPostData(), options.IsMultipart)); }
public async Task <List <Post> > GetByOptionsAsync(IPostOptions options) { string query = @"SELECT * FROM dbo.Posts WHERE (datepublished >= @StartDate OR @StartDate IS NULL) AND (posttypeurl = @Category OR @Category = 'all') AND (YEAR(datepublished) = @Year OR @Year IS NULL) AND (MONTH(datepublished) = @Month OR @Month IS NULL) AND (DAY(datepublished) = @Day OR @Day IS NULL) AND (lower(shortnames) LIKE '%' + @Author + '%' OR @Author = 'all') AND ispublic = 1 ORDER BY datepublished DESC;"; return((await QueryAsync <Post, PostType, Authors, Post>( query, (post, postType, authors) => { post.PostType = postType; post.Authors = authors; return post; }, parameters: new { options.StartDate, options.Category, options.Year, options.Month, options.Day, options.Author, }, splitOn: "PostTypeID,AuthorIDs")).ToList()); }
/// <summary> /// Makes a POST 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 DoAuthenticatedPostRequest(string url, IPostOptions options) { if (options == null) throw new ArgumentNullException("options"); return DoAuthenticatedPostRequest(url, options.GetQueryString(), options.GetPostData(), options.IsMultipart); }
/// <summary> /// Makes a signed POST 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 DoHttpPostRequest(string url, IPostOptions options) { SocialQueryString query = (options == null ? null : options.GetQueryString()); SocialPostData postData = (options == null ? null : options.GetPostData()); NameValueCollection nvcQuery = (query == null ? null : query.NameValueCollection); NameValueCollection nvcPostData = (postData == null ? null : postData.ToNameValueCollection()); // TODO: Converting the POST data to a NameValueCollection will not support multipart data return SocialHttpResponse.GetFromWebResponse(DoHttpRequest("POST", url, nvcQuery, nvcPostData)); }