EnkaSharp
May 12, 2025 ยท View on GitHub
About
A wrapper over enka.network API , supporting Dependency Injection and MemoryCache.
๐ License
This project is open source project , licensed under MIT license. Please abide by license terms. You must provide MIT license in copied/derived in parts that contain / derive from this code.
๐ฆ Semantic Versioning (SemVer)
This project follows Semantic Versioning (SemVer), which uses a version format of MAJOR.MINOR.PATCH.
- Patch โ Increases when bug fixes, new features, new methods or small improvements are made that do not affect compatibility.
- Minor โ Increases when new features or functionality are added in a backward-compatible manner.
- Major โ Increases when there are incompatible changes that break backward compatibility.
See more : Microsoft Versioning Docs
๐ฅ Installation (Nuget)
Game support
| Game | Status |
|---|---|
| Genshin Impact | โ Ready |
| Honkai: Star Rail | โ Not Implemented |
| Zenless Zone Zero | โ Not Implemented |
Creating Client
var memoryCache = new MemoryCache(new MemoryCacheOptions());
IEnkaClient client = EnkaProviderFactory.Create(new EnkaClientConfig { UserAgent = "Carried-Api-Test"} , memoryCache);
// we have to call InitializeAsync() to populate assets before we can use EnkaClient
await client.InitializeAsync();
For Asp.Net and other Dependency Injection Scenarios:
builder.Services.AddMemoryCache();
builder.Services.AddEnkaClient(new EnkaClientConfig { UserAgent = "Carried-Api-Test"});
For ASP.NET best bet would be to create BackgroundService to initialize our assets:
builder.Services.AddHostedService<StartupService>();
public class StartupService : BackgroundService
{
private readonly IEnkaClient _client;
public StartupService(IEnkaClient client)
{
_client = client;
}
protected override async Task ExecuteAsync(CancellationToken stoppingToken)
{
await _client.InitializeAsync();
}
}
Using Client
// provide uid - your hoyoverse uid
EnkaGenshinData genshinData = await _enkaClient.Genshin.GetGenshinDataAsync(uid);
// access properties freely
๐ท๏ธ Branches
- Main โ This is the
mainbranch. This contains the latest stable release and is the exact source running in production. - Dev โ This is the
developmentbranch. This contains the latest staging release that is marked for deployment and is the exact source running on staging. - Feature โ This is a
feature/*branch. This contains a new feature that will be added. Any feature should have its own branch. Once completed the branch should be merged into thedevelopmentbranch, afterward the feature branch should be deleted. - Bugfix โ This is a
bugfix/*branch. This contains a bugfix that will be added. Any bugfix should have its own branch. Once completed the branch should be merged into thedevelopmentbranch, afterward the bugfix branch should be deleted.