Today,
Joe Mayo released the latest version of LINQ to Twitter. LINQ to Twitter is an open source third-party LINQ Provider (Twitter Library) for the Twitter micro-blogging service. It uses standard LINQ syntax for queries and includes method calls for changes via the Twitter API.
In addition to fixing bugs, the highlighted features of this release include support for DM Events, Extended Tweets and .NET Core.
Here’s a demo of using extended mode tweets in a Search query:
- static async Task DoSearchAsync(TwitterContext twitterCtx)
- {
- string searchTerm = "\"LINQ to Twitter\" OR Linq2Twitter OR LinqToTwitter OR JoeMayo";
-
- Search searchResponse =
- await
- (from search in twitterCtx.Search
- where search.Type == SearchType.Search &&
- search.Query == searchTerm &&
- search.IncludeEntities == true &&
- search.TweetMode == TweetMode.Extended
- select search)
- .SingleOrDefaultAsync();
-
- if (searchResponse?.Statuses != null)
- searchResponse.Statuses.ForEach(tweet =>
- Console.WriteLine(
- "\n User: {0} ({1})\n Tweet: {2}",
- tweet.User.ScreenNameResponse,
- tweet.User.UserIDResponse,
- tweet.Text ?? tweet.FullText));
- else
- Console.WriteLine("No entries found.");
- }