コード例 #1
0
ファイル: Subreddits.cs プロジェクト: weirdyang/Reddit.NET
        private RestRequest PrepareSiteAdmin(SubredditsSiteAdminInput subredditsSiteAdminInput, string gRecaptchaResponse = null, string headerTitle = null)
        {
            RestRequest restRequest = PrepareRequest("api/site_admin", Method.POST);

            restRequest.AddObject(subredditsSiteAdminInput);
            AddParamIfNotNull("g-recaptcha-response", gRecaptchaResponse, ref restRequest);
            AddParamIfNotNull("header-title", headerTitle, ref restRequest);

            return(restRequest);
        }
コード例 #2
0
ファイル: Subreddits.cs プロジェクト: weirdyang/Reddit.NET
 /// <summary>
 /// Create or configure a subreddit asynchronously.  Null values are ignored.
 /// If sr is specified, the request will attempt to modify the specified subreddit. If not, a subreddit with name name will be created.
 /// This endpoint expects all values to be supplied on every request. If modifying a subset of options, it may be useful to get the current settings from /about/edit.json first.
 /// For backwards compatibility, description is the sidebar text and public_description is the publicly visible subreddit description.
 /// Most of the parameters for this endpoint are identical to options visible in the user interface and their meanings are best explained there.
 /// See also: /about/edit.json.
 /// </summary>
 /// <param name="subredditsSiteAdminInput">A valid SubredditsSiteAdminInput instance</param>
 /// <param name="gRecaptchaResponse"></param>
 /// <param name="headerTitle">a string no longer than 500 characters</param>
 /// <returns>An object indicating any errors.</returns>
 public async Task <GenericContainer> SiteAdminAsync(SubredditsSiteAdminInput subredditsSiteAdminInput, string gRecaptchaResponse = null, string headerTitle = null)
 {
     return(JsonConvert.DeserializeObject <GenericContainer>(await ExecuteRequestAsync(PrepareSiteAdmin(subredditsSiteAdminInput, gRecaptchaResponse, headerTitle))));
 }