LinqToTwitter.AspNet 6.14.0

There is a newer version of this package available.
See the version list below for details.
dotnet add package LinqToTwitter.AspNet --version 6.14.0                
NuGet\Install-Package LinqToTwitter.AspNet -Version 6.14.0                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="LinqToTwitter.AspNet" Version="6.14.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add LinqToTwitter.AspNet --version 6.14.0                
#r "nuget: LinqToTwitter.AspNet, 6.14.0"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install LinqToTwitter.AspNet as a Cake Addin
#addin nuget:?package=LinqToTwitter.AspNet&version=6.14.0

// Install LinqToTwitter.AspNet as a Cake Tool
#tool nuget:?package=LinqToTwitter.AspNet&version=6.14.0                

LINQ to Twitter

LINQ to Twitter is an open source 3rd 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.

Standard Labs v2

Example

The following query returns search results where people are tweeting about LINQ to Twitter:

var twitterCtx = new TwitterContext(...);

var searchResponse =
    await
    (from search in twitterCtx.Search
     where search.Type == SearchType.Search &&
           search.Query == "\"LINQ to Twitter\""
     select search)
    .SingleOrDefaultAsync();

if (searchResponse != null && searchResponse.Statuses != null)
    searchResponse.Statuses.ForEach(tweet =>
        Console.WriteLine(
            "User: {0}, Tweet: {1}", 
            tweet.User.ScreenNameResponse,
            tweet.Text));

From a coding experience perspective, the TwitterContext type is analogous to the Entity Framework DBContext. You use the TwitterContext instance, twitterCtx, to access IQueryable<T> tweet categories. In the example above, the Search will give you the ability to search Twitter for tweets meeting some criteria.

Note: The ellipses in the TwitterContext parameters indicates that you need to provide an authorizer with credentials, which is required. You can visit Securing Your Applications for documentation on authorizers and visit the Download page for working examples.

Each query category has a Type property for the type of tweets you want to get back. For example, Status tweets can be made for Home, Mentions, or User timelines. Each query category also has an XxxType enum to help you figure out what is available. The example above uses SearchType.Search to perform searches. Another example would be Status queries which might have StatusType.Home as its Type. In the case of Search queries, Search is the only option, but the Type idiom is consistent accross all query categories.

Just like other LINQ providers, you get an IQueryable<T> back from the query. You can see how to materialize the query by invoking the SingleOrDefaultAsync operator. For Search results, you receive one Search entity that contains information about the Search query and the Search entity contains a Statuses property that is a collection of Status entities. On other queries, you would materialize the query with ToListAsync for multiple results. Just like other LINQ providers, LINQ to Twitter does deferred execution, so operators such as ToListAsync and SingleOrDefaultAsync or statements such as for and foreach loops will cause the query to execute and make the actual call to Twitter.

The latest version of LINQ to Twitter supports async. You can see this where the code above await's the query, using the SingleOrDefaultAsync operator. Commands are async also. e.g. await TweetAsync("Hello from LINQ to Twitter").

For more details on how LINQ to Twitter works, you can visit Making API Calls for API specific examples. The downloadable source code also contains copious examples in the projects. Just look in the Samples folder.

NuGet

In addition to being able to download from this site, you can also automatically install LINQ to Twitter into your Visual Studio projects via NuGet;

Available Feature Set

See LINQ to Twitter v6 APIs.

For more info:

  • follow @JoeMayo for releases and related blog posts.
  • follow @Linq2Twitr for more detailed project information.
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories (1)

Showing the top 1 popular GitHub repositories that depend on LinqToTwitter.AspNet:

Repository Stars
JoeMayo/LinqToTwitter
LINQ Provider for the Twitter API (C# Twitter Library)
Version Downloads Last updated
6.15.0 6,239 6/29/2022
6.14.0 14,076 2/7/2022
6.12.0 658 2/1/2022
6.11.0 680 1/24/2022
6.7.1 608 6/24/2021
6.7.0 341 6/24/2021
6.0.1 746 11/11/2020
6.0.0 674 11/11/2020

Note: In previous versions of LINQ to Twitter, this was included in the `linqtotwitter` package. In version 6, ASP.NET Core 5 support is a separate package with a dependency on `linqtotwitter` v6.0+.

- Implemented space buyers and space tweets queries.
- Implemented Liking Users query.
- Implemented Me endpoint, which gets info for the authenticated user.
- Switched license to MIT.