Gandi 0.0.0-alpha2

This is a prerelease version of Gandi.
dotnet add package Gandi --version 0.0.0-alpha2                
NuGet\Install-Package Gandi -Version 0.0.0-alpha2                
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Gandi" Version="0.0.0-alpha2" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Gandi --version 0.0.0-alpha2                
#r "nuget: Gandi, 0.0.0-alpha2"                
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Gandi as a Cake Addin
#addin nuget:?package=Gandi&version=0.0.0-alpha2&prerelease

// Install Gandi as a Cake Tool
#tool nuget:?package=Gandi&version=0.0.0-alpha2&prerelease                

Gandi

.NET REST client for the Gandi v5 API

This library allows you to create, read, update, and delete LiveDNS 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.

  1. Prerequisites
  2. Installation
  3. Configuration
  4. Usage

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

Installation

This library is available in the Gandi package on NuGet Gallery.

dotnet add package Gandi

Configuration

  1. Construct a new instance of GandiClient.
    using Gandi;
    
    using var gandi = new GandiClient();
    
  2. Get a Gandi authentication token to pass to this client.
    • 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 ApiKey property of your GandiClient instance.
      gandi.ApiKey = apiKey;
      
    • If you don't already have an API key, you can create a Personal Access Token.
      1. Go to either User Settings or Organizations › ⚙ Manage.
      2. Click Create a token.
      3. If prompted, choose the organization which owns the domain whose DNS records you want to manage, then click Next.
      4. Choose a name and expiration period for the token.
      5. Choose whether the token will be allowed to access all domains in the organization, or just a subset of them.
      6. Allow permission to "Manage domain name technical configurations."
      7. Click Create.
      8. Copy the token text. Keep it somewhere safe, because Gandi won't show it to you again.
      9. 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.
      10. Click Done.
Advanced configuration
  • You can access the HttpClient and HttpMessageHandler instances used by GandiClient if you want to configure timeouts, extra request headers, or add requests or response filters.
  • If you want to provide your own HttpClient and HttpMessageHandler instances, you can subclass GandiClient and call its protected constructor GandiClient(UnfuckedHttpHandler, UnfuckedHttpClient), which take wrappers around HttpMessageHandler and HttpClient to provide filtering, serialization, and builders.

Usage

LiveDNS

Find DNS records in domain

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, all record 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 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. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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-alpha2 0 3/6/2025
0.0.0-alpha1 0 3/6/2025
0.0.0-alpha0 22 3/5/2025