OsuSharp 6.2.0
See the version list below for details.
dotnet add package OsuSharp --version 6.2.0
NuGet\Install-Package OsuSharp -Version 6.2.0
<PackageReference Include="OsuSharp" Version="6.2.0" />
<PackageVersion Include="OsuSharp" Version="6.2.0" />
<PackageReference Include="OsuSharp" />
paket add OsuSharp --version 6.2.0
#r "nuget: OsuSharp, 6.2.0"
#:package OsuSharp@6.2.0
#addin nuget:?package=OsuSharp&version=6.2.0
#tool nuget:?package=OsuSharp&version=6.2.0
OsuSharp
OsuSharp is a wrapper written in C# for the osu! API.
- Compatible with .NET 5
Installation
You can install the stable version of the wrapper with NuGet (only supports API v1 for packages prior to 6.0.0):
PM> Install-Package OsuSharp
You can also try Nightly Builds for the API v2. You need to add the following URL as a new NuGet Source:
https://nuget.emzi0767.com/api/v3/index.json
Then, you can just pull the nightly packages. You may need to enable preview builds to find them.
Finally, you can just compile from source:
git clone https://github.com/Kiritsu/OsuSharp.git
Basic Usage
You can use the following example to get started with the library:
Program.cs
public static class Program
{
public static void Main(string[] args)
{
CreateHostBuilder(args).Build().Run();
}
public static IHostBuilder CreateHostBuilder(string[] args)
{
return Host.CreateDefaultBuilder(args)
.ConfigureOsuSharp((ctx, options) => options.Configuration = new OsuClientConfiguration
{
ClientId = 123,
ClientSecret = "my-super-secret"
})
.ConfigureServices((ctx, services) => services.AddSingleton<IOsuService, OsuService>());
}
}
IOsuService.cs
internal interface IOsuService
{
IAsyncEnumerable<IBeatmapset> GetLastRankedBeatmapsetsAsync(int count);
Task<string> GetUserAvatarUrlAsync(string username);
}
OsuService.cs
public class OsuService : IOsuService
{
private readonly IOsuClient _client;
public OsuService(IOsuClient client)
{
_client = client;
}
public async IAsyncEnumerable<IBeatmapset> GetLastRankedBeatmapsetsAsync(int count)
{
var builder = new BeatmapsetsLookupBuilder()
.WithGameMode(GameMode.Osu)
.WithConvertedBeatmaps()
.WithCategory(BeatmapsetCategory.Ranked);
await foreach (var beatmap in _client.EnumerateBeatmapsetsAsync(builder, BeatmapSorting.Ranked_Desc))
{
yield return beatmap;
count--;
if (count == 0)
{
break;
}
}
}
public async Task<string> GetUserAvatarUrlAsync(string username)
{
var user = await _client.GetUserAsync(username);
return user.AvatarUrl.ToString();
}
}
Contributing
If you want to contribute, feel free to use Issues or Pull Requests!
Todo:
Beatmapset Discussions
- /beatmapsets/discussions/posts (Get Beatmapset Discussion Posts)
- /beatmapsets/discussions/votes (Get Beatmapset Discussion Votes)
- /beatmapsets/discussions/ (Get Beatmapset Discussions)
Changelog
- /changelog/{stream}/{build} (Get Changelog Build)
- /changelog (Get Changelog Listing)
- /changelog/{changelog} (Lookup Changelog Build)
Chat
- /chat/new (Create New PM)
Comments
- /comments (Get Comments)
- /comments/{comment} (Get a Comment)
Forum
- /forums/topics/{topic}/reply (Reply Topic)
- /forums/topics (Create Topic)
- /forums/topics/{topic} (Get Topic and Posts)
- /forums/topics/{topic} (Edit Topic)
- /forums/posts/{topic} (Edit Post)
Home
- /search (Search | Users AND/OR Wiki pages)
Multiplayer
- /rooms/{room}/playlist/{playlist}/scores (Get Scores)
News
- /news (Get News Listing)
- /news/{news} (Get News Post)
Ranking
- /rankings/{mode}/{type} (Get Ranking)
- /spotlights (Get Spotlights)
Wiki
- /wiki/{locale}/{path}
Undocumented
- /beatmapsets/events
- /matches
- /matches/{match}
- /rooms/{mode?}
- /rooms/{room}/leaderboard
- /rooms/{room}
- /beatmapsets/lookup (doesn't seem to work?)
- /friends
Done already
Users
- /me/{mode} (Get Own Data)
- /users/{user}/kudosu (Get User Kudosu)
- /users/{user}/scores/{types} (Get User Scores)
- /users/{user}/beatmapsets/{type} (Get User Beatmaps)
- /users/{user}/recent_activity (Get User Recent Activity)
- /users/{user}/{mode?} (Get User)
Beatmaps
- /beatmaps/{beatmap} (Get Beatmap)
- /beatmaps/{beatmap}/scores/users/{user} (Get a User Beatmap score)
- /beatmaps/{beatmap}/scores/users/{user}/all (Get all User Beatmap score)
- /beatmaps/{beatmap}/scores (Get Beatmap scores)
- /beatmaps/lookup (Lookup Beatmap)
Beatmapsets
- /beatmapsets/{beatmapset} (Get Beatmapset)
- /beatmapsets/search/{filters?} (Search beatmapsets)
Scores
- /scores/{mode}/{score} (Get Score)
- /scores/{mode}/{score}/download (Get Replay ; Needs Authorization Code Grant)
OAuth Tokens
- /oauth/tokens/current (Revoke current token)
Misc
- /seasonal-backgrounds (Get Current Seasonal Backgrounds ; No Auth)
Contact
You can join my personal Discord server: https://discord.gg/UugbeH8
Thanks
Thanks to the following contributors:
- Naamloos
- Kamdzy
- Bond-009
- jacksonrakena
- Piotrekol
- Quahu
- Kieran
- Francesco149 for Oppai.
Thanks to JetBrains for giving an open source license for their products!
<a href="https://www.jetbrains.com/?from=jensyl"><img src="imgs/jetbrains.svg" alt="JetBrains IDEs" width="150px"></img></a>
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. 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. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- Microsoft.Extensions.Hosting.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Logging.Abstractions (>= 5.0.0)
- Microsoft.Extensions.Options (>= 5.0.0)
- OsuSharp.Domain (>= 6.2.0)
- OsuSharp.JsonModels (>= 6.2.0)
NuGet packages (2)
Showing the top 2 NuGet packages that depend on OsuSharp:
Package | Downloads |
---|---|
OsuSharp.Analyzer
Analyzers for the unofficial wrapper of the osu! API (V1) written in C# and compatible with .NET Standard 2.0 |
|
OsuSharp.Oppai
Oppai API for the unofficial wrapper of the osu! API (V1) written in C# and compatible with .NET Standard 2.0. This can be used if you don't use the OsuSharp wrapper (but has the dependency for Mode enum bitflags) |
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last Updated | |
---|---|---|---|
6.4.1 | 3,878 | 12/30/2023 | |
6.4.0 | 474 | 11/21/2023 | |
6.3.2 | 456 | 10/21/2023 | |
6.3.1 | 963 | 9/10/2023 | |
6.3.0 | 613 | 9/10/2023 | |
6.2.4 | 1,053 | 9/28/2022 | |
6.2.3 | 996 | 9/23/2022 | |
6.2.2 | 946 | 6/23/2022 | |
6.2.1 | 1,004 | 6/17/2022 | |
6.2.0 | 1,096 | 4/4/2022 | |
6.1.0 | 1,031 | 3/13/2022 | |
6.0.0 | 985 | 3/7/2022 | |
5.6.1 | 4,091 | 11/28/2021 | |
5.6.0 | 1,821 | 7/31/2021 | |
5.5.0 | 1,550 | 7/1/2021 | |
5.4.4 | 2,240 | 6/3/2020 | |
5.4.3 | 1,796 | 6/2/2020 | |
5.4.2 | 1,726 | 3/23/2020 | |
5.4.1 | 1,742 | 3/23/2020 | |
5.4.0 | 1,767 | 1/31/2020 | |
5.3.2 | 1,785 | 1/19/2020 | |
5.3.1 | 1,812 | 12/21/2019 | |
5.3.0 | 1,828 | 11/19/2019 | |
5.2.0 | 1,464 | 11/17/2019 | |
5.1.0 | 1,782 | 11/17/2019 | |
5.0.2 | 1,516 | 11/14/2019 | |
5.0.1 | 1,483 | 11/13/2019 | |
5.0.0 | 1,116 | 11/13/2019 | |
3.2.8 | 1,994 | 1/18/2019 | |
3.2.7 | 1,979 | 11/30/2018 | |
3.2.6 | 1,846 | 11/30/2018 | |
3.2.5 | 1,546 | 11/30/2018 | |
3.2.3 | 1,557 | 11/30/2018 | |
3.2.2 | 1,534 | 11/30/2018 | |
3.2.1 | 1,492 | 11/30/2018 | |
3.2.0 | 1,982 | 11/6/2018 | |
3.1.3 | 1,639 | 10/1/2018 | |
3.0.2 | 1,589 | 10/1/2018 | |
3.0.0 | 1,572 | 9/24/2018 | |
2.0.1 | 2,125 | 6/22/2018 | |
2.0.0 | 1,969 | 6/21/2018 | |
1.7.0 | 1,977 | 6/20/2018 | |
1.6.1 | 1,981 | 6/20/2018 | |
1.6.0 | 2,191 | 3/31/2018 | |
1.5.2 | 2,090 | 3/9/2018 | |
1.5.1 | 2,036 | 3/8/2018 | |
1.5.0 | 2,167 | 2/23/2018 | |
1.4.5 | 2,050 | 2/16/2018 | |
1.4.3 | 2,076 | 1/16/2018 | |
1.4.1 | 2,420 | 12/19/2017 | |
1.4.0 | 2,252 | 12/12/2017 | |
1.3.0 | 2,254 | 10/21/2017 | |
1.2.4 | 2,430 | 8/8/2017 | |
1.2.3 | 2,361 | 8/7/2017 | |
1.2.2 | 2,387 | 8/6/2017 | |
1.2.1 | 2,398 | 8/6/2017 | |
1.2.0 | 2,332 | 8/6/2017 | |
1.1.1 | 2,336 | 7/28/2017 | |
1.1.0 | 2,307 | 7/28/2017 | |
1.0.5 | 2,283 | 7/28/2017 | |
1.0.4 | 2,304 | 7/28/2017 | |
1.0.3 | 2,404 | 7/27/2017 | |
1.0.2 | 2,607 | 6/27/2017 | |
1.0.1 | 2,010 | 6/27/2017 | |
1.0.0 | 2,245 | 6/27/2017 |