Exemplo n.º 1
0
        internal override void Parse(XElement element)
        {
            Id = element.ElementAsLong("id");

            var user = element.Element("actors")?.Element("user");

            if (user != null)
            {
                User = new Actor();
                User.Parse(user);
            }

            New             = element.ElementAsBool("new");
            CreatedDateTime = element.ElementAsDateTime("created_at");

            var body = element.Element("body");

            Text              = body?.ElementAsString("text");
            HtmlBody          = body?.ElementAsString("html");
            Url               = element.ElementAsString("url");
            ResourceType      = element.ElementAsString("resource_type");
            GroupResourceType = element.ElementAsString("group_resource_type");

            var groupResource = element.Element("group_resource");

            var readStatus = groupResource.Element("read_status");

            if (readStatus != null)
            {
                ReadStatus = new ReadStatus();
                ReadStatus.Parse(readStatus);
            }

            var friend = groupResource.Element("friend");

            if (friend != null)
            {
                Friend = new FriendGroupResource();
                Friend.Parse(friend);
            }

            var authorFollowing = groupResource.Element("author_following");

            if (authorFollowing != null)
            {
                AuthorFollowing = new AuthorFollowingGroupResource();
                AuthorFollowing.Parse(authorFollowing);
            }

            var recommendation = groupResource.Element("recommendation");

            if (recommendation != null)
            {
                Recommendation = new RecommendationGroupResource();
                Recommendation.Parse(recommendation);
            }
        }
Exemplo n.º 2
0
        internal override void Parse(XElement element)
        {
            UpdateType = element.AttributeAsString("type");
            Id         = element.ElementAsInt("id");
            ActionText = element.ElementAsString("action_text");
            Link       = element.ElementAsString("link");
            ImageUrl   = element.ElementAsString("image_url");
            UpdatedAt  = element.ElementAsDateTime("updated_at");
            Body       = element.ElementAsString("body");

            var user = element.Element("actor");

            if (user != null)
            {
                User = new Actor();
                User.Parse(user);
            }

            var action = element.Element("action");

            if (action != null)
            {
                Action = new Action();
                Action.Parse(action);
            }

            var @object = element.Element("object");

            var status = @object?.Element("read_status");

            if (status != null)
            {
                ReadStatus = new ReadStatus();
                ReadStatus.Parse(status);
            }

            var book = @object?.Element("book");

            if (book != null)
            {
                Book = new BookSummary();
                Book.Parse(book);
            }
        }