Skip to content

ahwm/OpenSRS.NET

Repository files navigation

OpenSRS.NET

build

Fully operational API client for OpenSRS

Leading libraries lack a lot of functionality. Some of the base implementation inspired by/borrowed from OpenSrs.

Full domains API documentation here: http://domains.opensrs.guide/docs

Usage

The usage differs slightly between .NET Framework and .NET 8.

.NET Framework

Usage for .NET Framework and .NET versions < 8

var client = new OpenSRSClient("apiKey", "username", test: true);
var resp = await client.RegisterAsync(new RegisterRequest { Domain = domain });
var resp = await client.LookupAsync(new LookupRequest(domain));

.NET 8

Microsoft added support for using the HttpClient through dependency injection and this library takes advantage of that.

// Program.cs

services.AddOpenSRS(_settings.Key, _settings.Username, _settings.IsTest);
// controller
public class DomainController(OpenSRSClient openSrs) : Controller
{
    public async Task<IActionResult> RegisterDomain(string domain)
    {
        var resp = await openSrs.RegisterAsync(new RegisterRequest { Domain = domain });
    }

    public async Task<IActionResult> Lookup(string domain)
    {
        var resp = await openSrs.LookupAsync(new LookupRequest(domain));
    }
}

About

Fully operational API client for OpenSRS

Resources

License

Code of conduct

Stars

Watchers

Forks

Releases

No releases published

Sponsor this project

 

Packages

 
 
 

Languages