Skip to content

Latest commit

Β 

History

History
74 lines (61 loc) Β· 3.15 KB

File metadata and controls

74 lines (61 loc) Β· 3.15 KB

EnkaSharp

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)

EnkaSharp

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 main branch. This contains the latest stable release and is the exact source running in production.
  • Dev β€” This is the development branch. 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 the development branch, 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 the development branch, afterward the bugfix branch should be deleted.