public Subreddit(JObject jobj, RequestService reqServ) : base(jobj, reqServ) { var data = (JObject)jobj["data"]; this.DisplayName = data["display_name"].Value<string>(); this.Title = data["title"].Value<string>(); this.Created = Helpers.FromUnixTime(data["created_utc"].Value<long>()); this.Over18 = data["over18"].Value<string>() == "true" ? true : false; this.Subscribers = data["subscribers"].Value<int>(); this.Description = data["public_description"].Value<string>(); this.Url = data["url"].Value<string>(); this.Posts = new Listing<Post>(this.Url, _reqServ); }
public Comment(JObject jobj, RequestService reqServ) : base(jobj, reqServ) { var data = (JObject)jobj["data"]; this.Author = data["author"].Value<string>(); this.Body = data["body"].Value<string>(); this.BodyHtml = data["body"].Value<string>(); this.LinkId = data["link_id"].Value<string>(); this.Ups = data["ups"].Value<int>(); this.Downs = data["downs"].Value<int>(); this.Created = Helpers.FromUnixTime(data["created_utc"].Value<long>()); string likeValue = data["likes"].Value<string>(); if (likeValue == "true") { this.Likes = true; } else if (likeValue == "false") { this.Likes = false; } else { this.Likes = null; } JObject replyObj = data["replies"] as JObject; if (replyObj != null) { this.Replies = new Listing<Comment>(GetRepliesResource(), replyObj, _reqServ, true); } else { this.Replies = new Listing<Comment>("", _reqServ); } this.Replies.SetLinkId(this.LinkId); }
public Post(JObject jobj, RequestService reqServ) : base(jobj, reqServ) { var data = (JObject)jobj["data"]; this.Author = data["author"].Value<string>(); this.Domain = data["domain"].Value<string>(); this.IsSelf = data["is_self"].Value<bool>(); this.CommentCount = data["num_comments"].Value<int>(); this.Over18 = data["over_18"].Value<bool>(); this.PermaLink = data["permalink"].Value<string>(); this.IsHidden = data["hidden"].Value<bool>(); this.SelfText = data["selftext"].Value<string>(); this.Subreddit = data["subreddit"].Value<string>(); this.ThumbnailUrl = data["thumbnail"].Value<string>(); this.Title = data["title"].Value<string>(); this.Url = data["url"].Value<string>(); this.Ups = data["ups"].Value<int>(); this.Downs = data["downs"].Value<int>(); this.Created = Helpers.FromUnixTime(data["created_utc"].Value<long>()); string likeValue = data["likes"].Value<string>(); if (likeValue == "true") { this.Likes = true; } else if (likeValue == "false") { this.Likes = false; } else { this.Likes = null; } this.Comments = new Listing<Comment>("comments/" + this.Id, _reqServ); }
public RedditApi() { _reqServ = new RequestService(); }
public Thing(string resource, RequestService reqServ) { _reqServ = reqServ; this.Resource = resource; }
public Thing(JObject jobj, RequestService reqServ) { _reqServ = reqServ; LoadThingData(jobj); }