Beispiel #1
0
        internal static MessageListing FromJson(JToken token)
        {
            var list = new MessageListing();

            list.ModHash = token["data"]["modhash"].ToString();
            list.Before  = token["data"]["before"].ToString();
            list.After   = token["data"]["after"].ToString();

            foreach (var child in token["data"]["children"].Children().Select(post => post["data"]))
            {
                list.Add(Message.FromJson(child));
            }

            return(list);
        }
Beispiel #2
0
        public static MessageListing Sent(Session session)
        {
            var request = new Request
            {
                Method = "GET",
                Cookie = session.Cookie,
                Url    = "http://www.reddit.com/message/sent/.json"
            };

            var json = string.Empty;

            if (request.Execute(out json) != System.Net.HttpStatusCode.OK)
            {
                throw new RedditException(json);
            }

            var o = JObject.Parse(json);

            return(MessageListing.FromJson(o));
        }