Skip to content

Commit 2fb376a

Browse files
committed
Documentation.
1 parent f0e363e commit 2fb376a

31 files changed

+1378
-43
lines changed

RedditSharp/AuthProvider.cs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,13 @@ public string GetOAuthToken(string username, string password)
168168
}
169169
throw new AuthenticationException("Could not log in.");
170170
}
171-
171+
172+
/// <summary>
173+
/// revokes an oauth token
174+
/// </summary>
175+
/// <param name="token">The oauth token..</param>
176+
/// <param name="isRefresh">Set to true for refresh token.</param>
177+
/// <returns>The access token</returns>
172178
public void RevokeToken(string token, bool isRefresh)
173179
{
174180
string tokenType = isRefresh ? "refresh_token" : "access_token";

RedditSharp/BotWebAgent.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,19 @@ public class BotWebAgent : WebAgent
1414
private string Username;
1515
private string Password;
1616

17+
/// <summary>
18+
/// DateTime the token expires.
19+
/// </summary>
1720
public DateTime TokenValidTo { get; set; }
1821

22+
/// <summary>
23+
/// A web agent using reddit's OAuth interface.
24+
/// </summary>
25+
/// <param name="username">The username.</param>
26+
/// <param name="password">The user's password.</param>
27+
/// <param name="clientId">Granted by reddit as part of app.</param>
28+
/// <param name="clientSecret">Granted by reddit as part of app.</param>
29+
/// <param name="redirectUri">Selected as part of app. Reddit will send users back here.</param>
1930
public BotWebAgent(string username, string password, string clientID, string clientSecret, string redirectURI)
2031
{
2132
Username = username;
@@ -27,6 +38,7 @@ public BotWebAgent(string username, string password, string clientID, string cli
2738
GetNewToken();
2839
}
2940

41+
/// <inheritdoc/>
3042
public override HttpWebRequest CreateRequest(string url, string method)
3143
{
3244
//add 5 minutes for clock skew to ensure requests succeed
@@ -37,6 +49,7 @@ public override HttpWebRequest CreateRequest(string url, string method)
3749
return base.CreateRequest(url, method);
3850
}
3951

52+
/// <inheritdoc/>
4053
protected override HttpWebRequest CreateRequest(Uri uri, string method)
4154
{
4255
//add 5 minutes for clock skew to ensure requests succeed

RedditSharp/Catchpha/Captcha.cs

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,14 @@ public struct Captcha
66
{
77
private const string UrlFormat = "http://www.reddit.com/captcha/{0}";
88

9+
/// <summary>
10+
/// Captcha Id.
11+
/// </summary>
912
public readonly string Id;
13+
14+
/// <summary>
15+
/// Captcha url.
16+
/// </summary>
1017
public readonly Uri Url;
1118

1219
internal Captcha(string id)

RedditSharp/Catchpha/CaptchaResponse.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,14 @@
22
{
33
public class CaptchaResponse
44
{
5+
/// <summary>
6+
/// Captcha answer.
7+
/// </summary>
58
public readonly string Answer;
69

10+
/// <summary>
11+
/// Set to true to cancel.
12+
/// </summary>
713
public bool Cancel { get { return string.IsNullOrEmpty(Answer); } }
814

915
public CaptchaResponse(string answer = null)

RedditSharp/Data/LinkData.cs

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,15 @@
22
{
33
internal class LinkData : SubmitData
44
{
5+
/// <summary>
6+
/// Used for redirects.
7+
/// </summary>
58
[RedditAPIName("extension")]
69
internal string Extension { get; set; }
710

11+
/// <summary>
12+
/// Url of the link.
13+
/// </summary>
814
[RedditAPIName("url")]
915
internal string URL { get; set; }
1016

RedditSharp/Data/SubmitData.cs

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,52 @@ namespace RedditSharp
22
{
33
internal abstract class SubmitData
44
{
5+
/// <summary>
6+
/// Should be set to "json"
7+
/// </summary>
58
[RedditAPIName("api_type")]
69
internal string APIType { get; set; }
710

11+
/// <summary>
12+
/// One of "link", "self" or "image"
13+
/// </summary>
814
[RedditAPIName("kind")]
915
internal string Kind { get; set; }
1016

17+
/// <summary>
18+
/// Name of the subreddit to which you are submitting.
19+
/// </summary>
1120
[RedditAPIName("sr")]
1221
internal string Subreddit { get; set; }
1322

23+
/// <summary>
24+
/// Logged in users modhash.
25+
/// </summary>
1426
[RedditAPIName("uh")]
1527
internal string UserHash { get; set; }
1628

29+
/// <summary>
30+
/// Title of the submission. Maximum 300 characters.
31+
/// </summary>
1732
[RedditAPIName("title")]
1833
internal string Title { get; set; }
1934

35+
/// <summary>
36+
/// Captcha ident.
37+
/// </summary>
2038
[RedditAPIName("iden")]
2139
internal string Iden { get; set; }
2240

41+
/// <summary>
42+
/// Captcha.
43+
/// </summary>
2344
[RedditAPIName("captcha")]
2445
internal string Captcha { get; set; }
2546

47+
/// <summary>
48+
/// If a link with the same URL has already been submitted to the specified
49+
/// subreddit an error will be returned unless resubmit is true.
50+
/// </summary>
2651
[RedditAPIName("resubmit")]
2752
internal bool Resubmit { get; set; }
2853

RedditSharp/Data/TextData.cs

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
{
33
internal class TextData : SubmitData
44
{
5+
/// <summary>
6+
/// Markdown text of the self post.
7+
/// </summary>
58
[RedditAPIName("text")]
69
internal string Text { get; set; }
710

RedditSharp/Domain.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,15 @@ public class Domain
1717
[JsonIgnore]
1818
private IWebAgent WebAgent { get; set; }
1919

20+
/// <summary>
21+
/// Domain name
22+
/// </summary>
2023
[JsonIgnore]
2124
public string Name { get; set; }
2225

26+
/// <summary>
27+
/// Get a <see cref="Listing{T}"/> of posts made for this domain.
28+
/// </summary>
2329
public Listing<Post> Posts
2430
{
2531
get
@@ -28,6 +34,9 @@ public Listing<Post> Posts
2834
}
2935
}
3036

37+
/// <summary>
38+
/// Get a <see cref="Listing{T}"/> of posts made for this domain that are in the new queue.
39+
/// </summary>
3140
public Listing<Post> New
3241
{
3342
get
@@ -36,6 +45,9 @@ public Listing<Post> New
3645
}
3746
}
3847

48+
/// <summary>
49+
/// Get a <see cref="Listing{T}"/> of posts made for this domain that are in the hot queue.
50+
/// </summary>
3951
public Listing<Post> Hot
4052
{
4153
get
@@ -51,6 +63,7 @@ protected internal Domain(Reddit reddit, Uri domain, IWebAgent webAgent)
5163
Name = domain.Host;
5264
}
5365

66+
/// <inheritdoc/>
5467
public override string ToString()
5568
{
5669
return "/domain/" + Name;

RedditSharp/Flairs/FlairTemplate.cs

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,18 +10,33 @@ public enum FlairPosition
1010
}
1111
public class UserFlairTemplate // TODO: Consider using this class to set templates as well
1212
{
13+
/// <summary>
14+
/// Flair text.
15+
/// </summary>
1316
[JsonProperty("flair_text")]
1417
public string Text { get; set; }
1518

19+
/// <summary>
20+
/// Flair clss class.
21+
/// </summary>
1622
[JsonProperty("flair_css_class")]
1723
public string CssClass { get; set; }
1824

25+
/// <summary>
26+
/// Flair template id.
27+
/// </summary>
1928
[JsonProperty("flair_template_id")]
2029
public string TemplateId { get; set; }
2130

31+
/// <summary>
32+
/// Set to true if this is user editable.
33+
/// </summary>
2234
[JsonProperty("flair_text_editable")]
2335
public bool IsEditable { get; set; }
2436

37+
/// <summary>
38+
/// Position of the flair left or right.
39+
/// </summary>
2540
[JsonProperty("flair_position")]
2641
[JsonConverter(typeof(StringEnumConverter))]
2742
public FlairPosition FlairPosition { get; set; }

RedditSharp/Moderator Actions/ModeratorPermission.cs

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,37 @@ namespace RedditSharp
88
[Flags]
99
public enum ModeratorPermission
1010
{
11+
/// <summary>
12+
/// No permissions.
13+
/// </summary>
1114
None = 0x00,
15+
/// <summary>
16+
/// access permissions.
17+
/// </summary>
1218
Access = 0x01,
19+
/// <summary>
20+
/// Subreddit config.
21+
/// </summary>
1322
Config = 0x02,
23+
/// <summary>
24+
/// Flair management.
25+
/// </summary>
1426
Flair = 0x04,
27+
/// <summary>
28+
/// Modmail.
29+
/// </summary>
1530
Mail = 0x08,
31+
/// <summary>
32+
/// Moderate posts.
33+
/// </summary>
1634
Posts = 0x10,
35+
/// <summary>
36+
/// Edit / view protected wiki paes.
37+
/// </summary>
1738
Wiki = 0x20,
39+
/// <summary>
40+
/// All permissions.
41+
/// </summary>
1842
All = Access | Config | Flair | Mail | Posts | Wiki
1943
}
2044

0 commit comments

Comments
 (0)