TwitterSharp 0.1.0-alpha
This is a prerelease version of TwitterSharp.
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package TwitterSharp --version 0.1.0-alpha
NuGet\Install-Package TwitterSharp -Version 0.1.0-alpha
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="TwitterSharp" Version="0.1.0-alpha" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add TwitterSharp --version 0.1.0-alpha
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: TwitterSharp, 0.1.0-alpha"
#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 TwitterSharp as a Cake Addin #addin nuget:?package=TwitterSharp&version=0.1.0-alpha&prerelease // Install TwitterSharp as a Cake Tool #tool nuget:?package=TwitterSharp&version=0.1.0-alpha&prerelease
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Examples
To begin with, please go to the Twitter Developer Portal and create a new application
Get a tweet from its ID
var client = new TwitterSharp.Client.TwitterClient(bearerToken);
var answer = await client.GetTweetsByIdsAsync("1389189291582967809");
Console.WriteLine(answer[0].Text); // たのしみ!!\uD83D\uDC93 https://t.co/DgBYVYr9lN
Get an user from its username
var client = new TwitterSharp.Client.TwitterClient(bearerToken);
var answer = await client.GetUsersAsync("theindra5");
Console.WriteLine(answer[0].Id); // 1022468464513089536
Get latest tweets from an user id
var client = new TwitterSharp.Client.TwitterClient(bearerToken);
// You can get the id using GetUsersAsync
var answer = await client.GetTweetsFromUserIdAsync("1109748792721432577");
for (int i = 0; i < answer.Length; i++)
{
Console.WriteLine($"Tweet n°{i}:\n{answer[i].Text}\n\n");
}
Follow users and get all new tweets
var client = new TwitterSharp.Client.TwitterClient(bearerToken);
// Subscribe to 5 Twitter accounts
var request = new TwitterSharp.Request.StreamRequest(
Expression.Author("moricalliope") // using TwitterSharp.Rule;
.Or(
Expression.Author("takanashikiara"),
Expression.Author("ninomaeinanis"),
Expression.Author("gawrgura"),
Expression.Author("watsonameliaEN")
)
);
await client.AddTweetStreamAsync(request); // Add them to the stream
// We display all the subscriptions we have
var subs = await client.GetInfoTweetStreamAsync();
Console.WriteLine("Subscriptions: " + string.Join("\n", subs.Select(x => x.Value.ToString())));
// NextTweetStreamAsync will continue to run in background
Task.Run(async () =>
{
// Take in parameter a callback called for each new tweet
// Since we want to get the basic info of the tweet author, we add an empty array of UserOption
await client.NextTweetStreamAsync((tweet) =>
{
Console.WriteLine($"From {tweet.Author.Name}: {tweet.Text}");
}, Array.Empty<UserOption>());
});
Product | Versions 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.
-
net5.0
- No dependencies.
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
2.4.0 | 9,561 | 12/9/2022 |
2.3.0 | 1,886 | 9/15/2022 |
2.2.0 | 2,950 | 7/15/2022 |
2.1.0 | 2,326 | 3/22/2022 |
2.0.0 | 675 | 3/15/2022 |
1.5.0 | 765 | 2/15/2022 |
1.4.0 | 516 | 2/6/2022 |
1.3.0 | 456 | 2/4/2022 |
1.2.0 | 388 | 1/13/2022 |
1.1.1 | 461 | 1/10/2022 |
1.1.0 | 297 | 1/5/2022 |
1.0.1 | 862 | 6/13/2021 |
1.0.0 | 445 | 6/11/2021 |
0.2.0-alpha | 253 | 5/8/2021 |
0.1.0-alpha | 264 | 5/7/2021 |
0.0.0-alpha | 248 | 5/5/2021 |