A .NET client library for the Athonet API, providing access to HSS and MOGW endpoints.
Install via NuGet Package Manager:
dotnet add package Athonet.ApiOr via Package Manager Console:
Install-Package Athonet.Api- HSS (Home Subscriber Server) API support
- MOGW (Mobile Gateway) API support
- Certificate-based authentication
- Configurable SSL certificate validation
- Request/response logging support
- Built on Refit for type-safe HTTP operations
using Athonet.Api;
using System.Security.Cryptography.X509Certificates;
// Configure the client
var options = new AthonetClientOptions
{
Username = "your-username",
Password = "your-password",
Certificate = new X509Certificate2("path/to/certificate.pfx", "password"),
Hostname = "your-athonet-host.com",
Port = 446, // Default port
IgnoreSslCertificateErrors = false,
StoreLastRequestAndResponse = true // Enable for debugging
};
// Create the client
using var client = new AthonetClient(options);
// Access HSS API
var hssData = await client.Hss.GetSubscribersAsync();
// Access MOGW API
var events = await client.Mogw.GetEventsAsync(
new MogwEventQuery { OrderBy = "id", Limit = 10 },
cancellationToken);| Property | Type | Required | Default | Description |
|---|---|---|---|---|
Username |
string |
Yes | - | API username |
Password |
string |
Yes | - | API password |
Certificate |
X509Certificate2 |
Yes | - | Client certificate for authentication |
Hostname |
string |
Yes | - | Athonet server hostname |
Port |
int |
No | 446 |
API port |
IgnoreSslCertificateErrors |
bool |
No | false |
Bypass SSL certificate validation |
StoreLastRequestAndResponse |
bool |
No | false |
Store last HTTP request/response for debugging |
UserAgent |
string |
No | "Athonet.Api-nuget-package" |
Custom User-Agent header |
When StoreLastRequestAndResponse is enabled, you can access the raw HTTP data:
var options = new AthonetClientOptions
{
// ... other settings
StoreLastRequestAndResponse = true
};
using var client = new AthonetClient(options);
await client.Hss.SomeMethodAsync();
// Access raw HTTP data
var lastRequest = client.LastHttpRequest;
var lastResponse = client.LastHttpResponse;using Athonet.Api.Exceptions;
try
{
await client.Hss.GetSubscribersAsync();
}
catch (AthonetApiException ex)
{
Console.WriteLine($"HTTP Status: {ex.HttpStatusCode}");
Console.WriteLine($"Response: {ex.ResponseBody}");
}- .NET 10 or later
- Valid Athonet API credentials
- X.509 client certificate
See the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
For issues and questions, please use the GitHub Issues page.