Exemplo n.º 1
0
        private RestRequest PrepareSubmit(LinksAndCommentsSubmitInput linksAndCommentsSubmitInput, string gRecaptchaResponse = "")
        {
            RestRequest restRequest = PrepareRequest("api/submit", Method.POST);

            restRequest.AddObject(linksAndCommentsSubmitInput);
            restRequest.AddParameter("g-recaptcha-response", gRecaptchaResponse);

            return(restRequest);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Submit this link post to Reddit asynchronously.
 /// </summary>
 /// <param name="linksAndCommentsSubmitInput">A valid LinksAndCommentsSubmitInput instance</param>
 /// <param name="gRecapthaResponse"></param>
 public async Task <LinkPost> SubmitAsync(LinksAndCommentsSubmitInput linksAndCommentsSubmitInput, string gRecapthaResponse = "")
 {
     return(new LinkPost(Dispatch, Validate(await Dispatch.LinksAndComments.SubmitAsync(linksAndCommentsSubmitInput, gRecapthaResponse)).JSON.Data, this));
 }
Exemplo n.º 3
0
 /// <summary>
 /// Submit this link post to Reddit.
 /// </summary>
 /// <param name="linksAndCommentsSubmitInput">A valid LinksAndCommentsSubmitInput instance</param>
 /// <param name="gRecapthaResponse"></param>
 /// <returns>A copy of this instance populated with the ID and Fullname returned by the API.</returns>
 public LinkPost Submit(LinksAndCommentsSubmitInput linksAndCommentsSubmitInput, string gRecapthaResponse = "")
 {
     return(new LinkPost(Dispatch, Validate(Dispatch.LinksAndComments.Submit(linksAndCommentsSubmitInput, gRecapthaResponse)).JSON.Data, this));
 }
Exemplo n.º 4
0
 /// <summary>
 /// Submit a link to a subreddit asynchronously.
 /// Submit will create a link or self-post in the subreddit sr with the title title.
 /// If kind is "link", then url is expected to be a valid URL to link to.
 /// Otherwise, text, if present, will be the body of the self-post unless richtext_json is present, in which case it will be converted into the body of the self-post.
 /// An error is thrown if both text and richtext_json are present.
 /// If a link with the same URL has already been submitted to the specified subreddit an error will be returned unless resubmit is true.
 /// extension is used for determining which view-type (e.g.json, compact etc.) to use for the redirect that is generated if the resubmit error occurs.
 /// </summary>
 /// <param name="linksAndCommentsSubmitInput">A valid LinksAndCommentsSubmitInput instance</param>
 /// <param name="gRecaptchaResponse"></param>
 /// <returns>An object containing the id, name, and URL of the newly created post.</returns>
 public async Task <PostResultShortContainer> SubmitAsync(LinksAndCommentsSubmitInput linksAndCommentsSubmitInput, string gRecaptchaResponse = "")
 {
     return(JsonConvert.DeserializeObject <PostResultShortContainer>(await ExecuteRequestAsync(PrepareSubmit(linksAndCommentsSubmitInput, gRecaptchaResponse))));
 }