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" />
paket add OsuSharp --version 6.2.0
#r "nuget: OsuSharp, 6.2.0"
// Install OsuSharp as a Cake Addin #addin nuget:?package=OsuSharp&version=6.2.0 // Install OsuSharp as a Cake Tool #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. |
-
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 | 2,666 | 12/30/2023 | |
6.4.0 | 454 | 11/21/2023 | |
6.3.2 | 426 | 10/21/2023 | |
6.3.1 | 928 | 9/10/2023 | |
6.3.0 | 581 | 9/10/2023 | |
6.2.4 | 998 | 9/28/2022 | |
6.2.3 | 938 | 9/23/2022 | |
6.2.2 | 881 | 6/23/2022 | |
6.2.1 | 940 | 6/17/2022 | |
6.2.0 | 1,027 | 4/4/2022 | |
6.1.0 | 962 | 3/13/2022 | |
6.0.0 | 916 | 3/7/2022 | |
5.6.1 | 3,966 | 11/28/2021 | |
5.6.0 | 1,750 | 7/31/2021 | |
5.5.0 | 1,474 | 7/1/2021 | |
5.4.4 | 2,141 | 6/3/2020 | |
5.4.3 | 1,701 | 6/2/2020 | |
5.4.2 | 1,635 | 3/23/2020 | |
5.4.1 | 1,648 | 3/23/2020 | |
5.4.0 | 1,676 | 1/31/2020 | |
5.3.2 | 1,693 | 1/19/2020 | |
5.3.1 | 1,720 | 12/21/2019 | |
5.3.0 | 1,737 | 11/19/2019 | |
5.2.0 | 1,374 | 11/17/2019 | |
5.1.0 | 1,689 | 11/17/2019 | |
5.0.2 | 1,425 | 11/14/2019 | |
5.0.1 | 1,393 | 11/13/2019 | |
5.0.0 | 1,024 | 11/13/2019 | |
3.2.8 | 1,815 | 1/18/2019 | |
3.2.7 | 1,802 | 11/30/2018 | |
3.2.6 | 1,666 | 11/30/2018 | |
3.2.5 | 1,368 | 11/30/2018 | |
3.2.3 | 1,375 | 11/30/2018 | |
3.2.2 | 1,343 | 11/30/2018 | |
3.2.1 | 1,312 | 11/30/2018 | |
3.2.0 | 1,795 | 11/6/2018 | |
3.1.3 | 1,442 | 10/1/2018 | |
3.0.2 | 1,396 | 10/1/2018 | |
3.0.0 | 1,377 | 9/24/2018 | |
2.0.1 | 1,753 | 6/22/2018 | |
2.0.0 | 1,597 | 6/21/2018 | |
1.7.0 | 1,604 | 6/20/2018 | |
1.6.1 | 1,608 | 6/20/2018 | |
1.6.0 | 1,805 | 3/31/2018 | |
1.5.2 | 1,703 | 3/9/2018 | |
1.5.1 | 1,653 | 3/8/2018 | |
1.5.0 | 1,776 | 2/23/2018 | |
1.4.5 | 1,666 | 2/16/2018 | |
1.4.3 | 1,684 | 1/16/2018 | |
1.4.1 | 1,928 | 12/19/2017 | |
1.4.0 | 1,860 | 12/12/2017 | |
1.3.0 | 1,861 | 10/21/2017 | |
1.2.4 | 2,035 | 8/8/2017 | |
1.2.3 | 1,962 | 8/7/2017 | |
1.2.2 | 1,990 | 8/6/2017 | |
1.2.1 | 2,006 | 8/6/2017 | |
1.2.0 | 1,935 | 8/6/2017 | |
1.1.1 | 1,939 | 7/28/2017 | |
1.1.0 | 1,913 | 7/28/2017 | |
1.0.5 | 1,891 | 7/28/2017 | |
1.0.4 | 1,909 | 7/28/2017 | |
1.0.3 | 2,009 | 7/27/2017 | |
1.0.2 | 2,105 | 6/27/2017 | |
1.0.1 | 1,724 | 6/27/2017 | |
1.0.0 | 1,853 | 6/27/2017 |