Display timeline

Sep 9, 2014 at 3:34 PM
Edited Sep 9, 2014 at 3:51 PM
Not sure if I'm missing the point of the API and this library but I a m looking to use it to display my Tweets on my ASP.NET MVC homepage. I have all the library code working find and returning the array of tweets but I am a little unsure of how to actually render them to the screen.

Could someone point me in the right direction ?

Was string to write my own template but seems like reinventing the wheel:
@for (int i = 0; i < Model.Length; i++)
            {
                <div class="row">
                    <div class="col-xs-3 pull-right"><a href="#">@Model[i].CreatedAt.ToString("MMM yy")</a></div>
                    <div class="col-xs-9">
                        <img src="@Model[i].Creator.ProfileImageUrl" /><span>@Model[i].Creator.Name</span><span>@Model[i].Creator.ScreenName</span>
                    </div>
                </div>
            }
Coordinator
Sep 9, 2014 at 7:16 PM
Well, why would you say that it is reinventing the wheel? Your code looks perfectly fine to me.

The point of this API is to allow you to access the Twitter REST Api in few lines of code that you will be sure will work in various scenarios.
Twitter REST API is not small and there are various little tricks to know in order to consume it. Tweetinvi give you this feature without you worrying about the implementation of such a feature.

Linvi
Marked as answer by linvi on 9/11/2014 at 5:05 AM
Sep 9, 2014 at 8:59 PM
Edited Sep 9, 2014 at 8:59 PM
Thanks Linvi,

I thought I had missed something and perhaps the HTML of the tweets were returned from the API. Thanks for the reply....have pasted more of my code in case it helps anyone else...
@model Tweetinvi.Core.Interfaces.ITweet[]
@for (int i = 0; i < Model.Length; i++)
            {
                <div class="row twitter-row">
                    <div class="header">
                        <a class="twitter-date" href="#">@Model[i].CreatedAt.ToString("MMM yy")</a>
                        <div class="twitter-author">
                            <a href="#">
                                <img class="twitter-user-image" src="@Model[i].Creator.ProfileImageUrl" />
                                <span class="twitter-Name">@Model[i].Creator.Name</span>
                                <span class="twitter-screenName">@(string.Format("@{0}", Model[i].Creator.ScreenName))</span>
                            </a>
                        </div>
                    </div>
                    <div class="twitter-entry">
                        @{
                string displayText = Model[i].Text;

                if (Model[i].Urls.Count != 0)
                {
                    foreach (var url in Model[i].Urls)
                    {
                        displayText = displayText.Replace(url.URL, string.Format("<a href='{0}' class='twitter-link'>{0}</a>", url.URL));
                    }
                }
                        }
                        @Html.Raw(displayText)
                </div>
            </div>
            }