Gandi 0.0.0-alpha3
See the version list below for details.
dotnet add package Gandi --version 0.0.0-alpha3
NuGet\Install-Package Gandi -Version 0.0.0-alpha3
<PackageReference Include="Gandi" Version="0.0.0-alpha3" />
paket add Gandi --version 0.0.0-alpha3
#r "nuget: Gandi, 0.0.0-alpha3"
// Install Gandi as a Cake Addin #addin nuget:?package=Gandi&version=0.0.0-alpha3&prerelease // Install Gandi as a Cake Tool #tool nuget:?package=Gandi&version=0.0.0-alpha3&prerelease
Gandi
.NET REST client for the Gandi v5 API
This library allows you to create, read, update, and delete LiveDNS DNS records in your Gandi domains.
It's similar to G6.GandiLiveDns, but it's compatible with both Personal Access Token and API Key authentication, public types have interfaces so you can mock and actually test your dependent code, and it's compatible with a wider variety of runtimes.
Prerequisites
- .NET runtime compatible with .NET Standard 2.0
- .NET 5 or later
- .NET Core 2 or later
- .NET Framework 4.6.2 or later
- Gandi domain name
- ✅ Domain must be using LiveDNS, the default for new domains (
ns-*-*.gandi.net
) - ❌ Classic DNS (
*.dns.gandi.net
) is incompatible; you will need to migrate to LiveDNS - ❌ External nameservers (with glue records) are incompatible; you will need to update the record on the external nameserver instead of on Gandi's nameservers
- ✅ Domain must be using LiveDNS, the default for new domains (
Installation
This library is available in the Gandi
package on NuGet Gallery.
dotnet add package Gandi
Configuration
- Construct a new instance of
GandiClient
.using Gandi; using var gandi = new GandiClient();
- Get a Gandi authentication token, and pass it to the
AuthToken
property ofGandiClient
. This token can be either an API Key or Personal Access Token.- If you already have a Gandi API Key, you can use it to authenticate this client to your Gandi account.
- If your Gandi account doesn't already have an API Key, it's too late, you can't make one anymore.
- If you don't remember your API Key, you can regenerate it using Account › Authentication options › Developer access › API key.
- Pass the API Key to the
AuthToken
property of yourGandiClient
instance.
gandi.AuthToken = "<your API key>";
- You can always create a Personal Access Token.
- Go to either User Settings or Organizations › ⚙ Manage.
- Click Create a token.
- If prompted, choose the organization which owns the domain whose DNS records you want to manage, then click Next.
- Choose a name and expiration period for the token.
- Choose whether the token will be allowed to access all domains in the organization, or just a subset of them.
- Allow permission to "Manage domain name technical configurations."
- Click Create.
- Copy the token text. Keep it somewhere safe, because Gandi won't show it to you again.
- Set a calendar reminder to notify you before this token expires. There is no way for Gandi to notify you or for clients to refresh or renew tokens, so you will have to repeat all of these steps when your token eventually expires.
- Click Done.
- Pass the Personal Access Token to the
AuthToken
property of yourGandiClient
instance.
gandi.AuthToken = "<your personal access token>";
- If you already have a Gandi API Key, you can use it to authenticate this client to your Gandi account.
Advanced configuration
- You can access the
HttpClient
instance used byGandiClient
if you want to configure timeouts, extra request headers, or add requests or response filters. - If you want to provide your own
HttpClient
, you can pass it to theGandiClient(HttpClient?)
constructor. Make sure theHttpClient
'sHttpMessageHandler
inherits fromIUnfuckedHttpHandler
(one easy way to do this is forHttpClient
to be anUnfuckedHttpClient
) so that authentication client request filters work.
Usage
LiveDNS
Find DNS records
Return a list of all DNS records in the domain, optionally filtered by name or type (A, CNAME, etc).
var liveDns = gandi.LiveDns("mydomain.com");
IEnumerable<DnsRecord> allRecords = await liveDns.List();
IEnumerable<DnsRecord> cnames = await liveDns.List(RecordType.CNAME);
Get a DNS record
Return one DNS record in the domain with the given name and type, or null
if it was not found.
DnsRecord? wwwRecord = await liveDns.Get(RecordType.A, "www");
Create or update a DNS record
Set a DNS record's value, automatically creating it if it didn't already exist, or modifying it if it already existed (upserting).
await liveDns.Set(new DnsRecord(RecordType.A, "www", TimeToLive.FromHours(1), "1.2.3.4"));
Delete a record
Remove a record with the given name and optionally the given type. If the type is not specified, records of all types with the given name are deleted. This method returns successfully even if the record did not exist, because either way it doesn't exist after the method completes, so it's in the desired state.
await liveDns.Delete(RecordTytpe.CNAME, "www");
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 was computed. net5.0-windows was computed. net6.0 is compatible. 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 was computed. 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 was computed. 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. |
.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 was computed. |
.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
- Unfucked.HTTP (>= 0.0.0-beta5)
-
net6.0
- Unfucked.HTTP (>= 0.0.0-beta5)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Version | Downloads | Last updated |
---|---|---|
0.0.0-alpha5 | 19 | 3/11/2025 |
0.0.0-alpha4 | 66 | 3/9/2025 |
0.0.0-alpha3 | 39 | 3/8/2025 |
0.0.0-alpha2 | 161 | 3/6/2025 |
0.0.0-alpha1 | 162 | 3/6/2025 |
0.0.0-alpha0 | 280 | 3/5/2025 |