DigitalOcean.Net
1.0.1
dotnet add package DigitalOcean.Net --version 1.0.1
NuGet\Install-Package DigitalOcean.Net -Version 1.0.1
<PackageReference Include="DigitalOcean.Net" Version="1.0.1" />
<PackageVersion Include="DigitalOcean.Net" Version="1.0.1" />
<PackageReference Include="DigitalOcean.Net" />
paket add DigitalOcean.Net --version 1.0.1
#r "nuget: DigitalOcean.Net, 1.0.1"
#:package DigitalOcean.Net@1.0.1
#addin nuget:?package=DigitalOcean.Net&version=1.0.1
#tool nuget:?package=DigitalOcean.Net&version=1.0.1
DigitalOcean.Net
A comprehensive .NET client library for the DigitalOcean API, covering all 40+ resource categories including Droplets, Kubernetes, App Platform, Databases, and more.
Features
- ✅ Full API Coverage — All 40+ DigitalOcean resource categories (Droplets, Apps, Databases, Kubernetes, VPCs, etc.)
- ✅ Multi-targeting — Supports
netstandard2.0,netstandard2.1,net8.0,net9.0,net10.0 - ✅ Strongly-typed — Auto-generated from the official OpenAPI specification
- ✅ Dependency Injection — First-class support for
Microsoft.Extensions.DependencyInjection - ✅ CancellationToken — Full async/await with cancellation support
- ✅ SourceLink — Debug into library source code
- ✅ doctl Integration — Read token directly from
doctlCLI config
Installation
dotnet add package DigitalOcean.Net
Quick Start
Direct Usage
using DigitalOcean.Net;
// Create client with your API token
var client = DigitalOceanClientFactory.Create("dop_v1_your_token_here");
// Or read token from doctl CLI config (~/.config/doctl/config.yaml)
var client = DigitalOceanClientFactory.CreateFromAppData();
// List all Droplets
var dropletsResponse = await client.V2.Droplets.GetAsync();
foreach (var droplet in dropletsResponse?.Droplets ?? [])
{
Console.WriteLine($"{droplet.Name} - {droplet.Status}");
}
// Get account info
var account = await client.V2.Account.GetAsync();
Console.WriteLine($"Email: {account?.Account?.Email}");
// List Apps (App Platform)
var apps = await client.V2.Apps.GetAsync();
// List Kubernetes clusters
var k8s = await client.V2.Kubernetes.Clusters.GetAsync();
// List databases
var dbs = await client.V2.Databases.GetAsync();
With Dependency Injection
using DigitalOcean.Net.Extensions;
// In Program.cs or Startup.cs
builder.Services.AddDigitalOceanClient(options =>
{
options.Token = builder.Configuration["DigitalOcean:Token"]!;
});
// In your service class
public class MyService(DigitalOceanApiClient client)
{
public async Task ListDroplets()
{
var response = await client.V2.Droplets.GetAsync();
// ...
}
}
Advanced Configuration
// Custom options
var client = DigitalOceanClientFactory.Create(new DigitalOceanClientOptions
{
Token = "dop_v1_your_token_here",
BaseUrl = "https://api.digitalocean.com",
Timeout = TimeSpan.FromSeconds(60),
UserAgent = "MyApp/1.0"
});
// Use your own HttpClient (for proxies, custom handlers, etc.)
var httpClient = new HttpClient(new MyCustomHandler());
var client = DigitalOceanClientFactory.Create("dop_v1_token", httpClient);
API Coverage
| Category | Description | Namespace |
|---|---|---|
| Account | Account info | client.V2.Account |
| Actions | Action history | client.V2.Actions |
| Apps | App Platform | client.V2.Apps |
| Billing | Billing & invoices | client.V2.Customers |
| CDN | Content delivery | client.V2.Cdn |
| Certificates | SSL certificates | client.V2.Certificates |
| Databases | Managed databases | client.V2.Databases |
| Domains | DNS management | client.V2.Domains |
| Droplets | Virtual machines | client.V2.Droplets |
| Firewalls | Cloud firewalls | client.V2.Firewalls |
| Functions | Serverless functions | client.V2.Functions |
| Images | OS images | client.V2.Images |
| Kubernetes | K8s clusters | client.V2.Kubernetes |
| Load Balancers | Load balancers | client.V2.LoadBalancers |
| Monitoring | Alerts & metrics | client.V2.Monitoring |
| Projects | Project management | client.V2.Projects |
| Regions | Available regions | client.V2.Regions |
| Registry | Container registry | client.V2.Registry |
| Reserved IPs | Static IPs | client.V2.ReservedIps |
| Sizes | Droplet sizes | client.V2.Sizes |
| Snapshots | Volume snapshots | client.V2.Snapshots |
| Spaces | Object storage | client.V2.Spaces |
| SSH Keys | SSH key management | client.V2.Account |
| Tags | Resource tagging | client.V2.Tags |
| Uptime | Uptime checks | client.V2.Uptime |
| Volumes | Block storage | client.V2.Volumes |
| VPCs | Virtual networks | client.V2.Vpcs |
Authentication
DigitalOcean uses OAuth Bearer tokens. Generate a token from the DigitalOcean Control Panel.
Token prefixes:
dop_v1_— Personal access tokendoo_v1_— OAuth application tokendor_v1_— Refresh token
Technical Architecture
Code Generation
The client code in this library is auto-generated by Microsoft Kiota from the DigitalOcean official OpenAPI specification. This means:
- Completeness: API coverage is perfectly aligned with the official spec — no missing endpoints
- Accuracy: Request/response models strictly match API definitions, ensuring type safety
- Maintainability: When DigitalOcean updates their API, simply regenerate to sync
Dependencies Explained
This library depends on the following packages, all necessary for full functionality:
Kiota Runtime (API Client Core)
These are the runtime libraries required by Microsoft Kiota-generated client code. Kiota is Microsoft's official OpenAPI client generator with a modular design where each serialization format is an independent package:
| Package | Purpose | Repository |
|---|---|---|
| Microsoft.Kiota.Abstractions | Kiota core abstraction layer, defines request/response pipeline | microsoft/kiota-abstractions-dotnet |
| Microsoft.Kiota.Http.HttpClientLibrary | HTTP transport implementation based on HttpClient |
microsoft/kiota-http-dotnet |
| Microsoft.Kiota.Serialization.Json | JSON serialization/deserialization (primary API data format) | microsoft/kiota-serialization-json-dotnet |
| Microsoft.Kiota.Serialization.Text | Plain text serialization (some APIs return text responses) | microsoft/kiota-serialization-text-dotnet |
| Microsoft.Kiota.Serialization.Form | Form data serialization (some APIs accept form submissions) | microsoft/kiota-serialization-form-dotnet |
| Microsoft.Kiota.Serialization.Multipart | Multipart data serialization (file uploads, etc.) | microsoft/kiota-serialization-multipart-dotnet |
Dependency Injection Support
| Package | Purpose | Repository |
|---|---|---|
| Microsoft.Extensions.DependencyInjection.Abstractions | DI container abstraction, provides IServiceCollection extensions |
dotnet/runtime |
| Microsoft.Extensions.Http | IHttpClientFactory support, manages HttpClient lifecycle |
dotnet/runtime |
| Microsoft.Extensions.Options | Options pattern, supports IOptions<T> configuration binding |
dotnet/runtime |
Tool Support
| Package | Purpose | Repository |
|---|---|---|
| YamlDotNet | YAML parsing, for reading tokens from doctl CLI configuration file |
aaubry/YamlDotNet |
Multi-Target Framework Compatibility (Conditional Dependencies)
The following packages are only included for older target frameworks to supplement missing APIs:
| Package | Condition | Purpose | Repository |
|---|---|---|---|
| System.Text.Json | netstandard2.0, netstandard2.1 |
High-performance JSON serialization (built-in for .NET 8+) | dotnet/runtime |
| Microsoft.Bcl.AsyncInterfaces | netstandard2.0 only |
Async interfaces like IAsyncEnumerable<T> (built-in for .NET Standard 2.1+) |
dotnet/runtime |
Requirements
- .NET Standard 2.0+ / .NET 8.0+ / .NET 9.0+ / .NET 10.0+
- A DigitalOcean account and API token
Contributing
Contributions are welcome! Please open an issue or submit a pull request.
Acknowledgements
This project was built with the assistance of GitHub Copilot CLI + Claude Opus 4.6.
License
This project is licensed under the MIT License. See the LICENSE file for details.
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 was computed. net5.0-windows was computed. net6.0 was computed. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 is compatible. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 is compatible. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 was computed. netcoreapp2.1 was computed. netcoreapp2.2 was computed. netcoreapp3.0 was computed. netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 is compatible. netstandard2.1 is compatible. |
| .NET Framework | net461 was computed. net462 was computed. net463 was computed. net47 was computed. net471 was computed. net472 was computed. net48 was computed. net481 was computed. |
| MonoAndroid | monoandroid was computed. |
| MonoMac | monomac was computed. |
| MonoTouch | monotouch was computed. |
| Tizen | tizen40 was computed. tizen60 was computed. |
| Xamarin.iOS | xamarinios was computed. |
| Xamarin.Mac | xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos was computed. |
-
.NETStandard 2.0
- Microsoft.Bcl.AsyncInterfaces (>= 8.0.0)
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Kiota.Abstractions (>= 1.22.1)
- Microsoft.Kiota.Http.HttpClientLibrary (>= 1.22.1)
- Microsoft.Kiota.Serialization.Form (>= 1.22.1)
- Microsoft.Kiota.Serialization.Json (>= 1.22.1)
- Microsoft.Kiota.Serialization.Multipart (>= 1.22.1)
- Microsoft.Kiota.Serialization.Text (>= 1.22.1)
- System.Text.Json (>= 8.0.6)
- YamlDotNet (>= 16.3.0)
-
.NETStandard 2.1
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Kiota.Abstractions (>= 1.22.1)
- Microsoft.Kiota.Http.HttpClientLibrary (>= 1.22.1)
- Microsoft.Kiota.Serialization.Form (>= 1.22.1)
- Microsoft.Kiota.Serialization.Json (>= 1.22.1)
- Microsoft.Kiota.Serialization.Multipart (>= 1.22.1)
- Microsoft.Kiota.Serialization.Text (>= 1.22.1)
- System.Text.Json (>= 8.0.6)
- YamlDotNet (>= 16.3.0)
-
net10.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Kiota.Abstractions (>= 1.22.1)
- Microsoft.Kiota.Http.HttpClientLibrary (>= 1.22.1)
- Microsoft.Kiota.Serialization.Form (>= 1.22.1)
- Microsoft.Kiota.Serialization.Json (>= 1.22.1)
- Microsoft.Kiota.Serialization.Multipart (>= 1.22.1)
- Microsoft.Kiota.Serialization.Text (>= 1.22.1)
- YamlDotNet (>= 16.3.0)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Kiota.Abstractions (>= 1.22.1)
- Microsoft.Kiota.Http.HttpClientLibrary (>= 1.22.1)
- Microsoft.Kiota.Serialization.Form (>= 1.22.1)
- Microsoft.Kiota.Serialization.Json (>= 1.22.1)
- Microsoft.Kiota.Serialization.Multipart (>= 1.22.1)
- Microsoft.Kiota.Serialization.Text (>= 1.22.1)
- YamlDotNet (>= 16.3.0)
-
net9.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.2)
- Microsoft.Extensions.Http (>= 8.0.1)
- Microsoft.Extensions.Options (>= 8.0.2)
- Microsoft.Kiota.Abstractions (>= 1.22.1)
- Microsoft.Kiota.Http.HttpClientLibrary (>= 1.22.1)
- Microsoft.Kiota.Serialization.Form (>= 1.22.1)
- Microsoft.Kiota.Serialization.Json (>= 1.22.1)
- Microsoft.Kiota.Serialization.Multipart (>= 1.22.1)
- Microsoft.Kiota.Serialization.Text (>= 1.22.1)
- YamlDotNet (>= 16.3.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.