C# SDK (.NET)
The official Zyphr SDK for .NET, built with HttpClient targeting .NET 8.0.
Installation
NuGet
dotnet add package ZyphrDev.SDK
Package Manager
Install-Package ZyphrDev.SDK
Quick Start
using ZyphrDev.SDK.Api;
using ZyphrDev.SDK.Client;
using ZyphrDev.SDK.Model;
var config = new Configuration
{
ApiKey = new Dictionary<string, string>
{
{ "X-API-Key", "zy_live_xxx" }
}
};
var emails = new EmailsApi(config);
var result = await emails.SendEmailAsync(new SendEmailRequest(
to: "user@example.com",
subject: "Welcome!",
html: "<h1>Hello!</h1>"
));
Console.WriteLine($"Email sent: {result.Id}");
Configuration
var config = new Configuration
{
BasePath = "https://api.zyphr.dev/v1",
ApiKey = new Dictionary<string, string>
{
{ "X-API-Key", "zy_live_xxx" }
}
};
Send Push Notification
var push = new PushApi(config);
await push.SendPushAsync(new SendPushRequest(
userId: "user_123",
title: "New Message",
body: "You have a new message"
));
Send SMS
var sms = new SmsApi(config);
var result = await sms.SendSmsAsync(new SendSmsRequest(
to: "+14155551234",
body: "Your verification code is 123456"
));
Error Handling
try
{
await emails.SendEmailAsync(request);
}
catch (ApiException ex)
{
Console.WriteLine($"API Error ({ex.ErrorCode}): {ex.Message}");
Console.WriteLine($"Response: {ex.ErrorContent}");
}
Requirements
- .NET 8.0+
- C# 12+