Lessons learned from buying, connecting, and operating domains
Free Trial
Features

Go API client 0.6x series, DNSControl, Terraform, and more

Simone Carletti's profile picture Simone Carletti

The Go API client is one of the most adopted DNSimple API clients, either directly or indirectly through one of the numerous integrations that uses our domain and zone API, such as Terraform or Kubernetes external-dns.

Over the last few weeks, we've been busy integrating a lot of feedback from customers and various project communities. I'm happy to announce that the 0.60 series is out – with a number of improvements.

We also worked with several integration maintainers to ensure the projects are up to date:

If you're using one of those integrations, makes sure to download the updates to take advantage of the new changes.

Here's a short description of the most important updates:

Go contexts

All the client methods are now context-aware.

tc := dnsimple.StaticTokenHTTPClient(context.Background(), "your-token")
client := dnsimple.NewClient(tc)

ctx := ...
whoamiResponse, err := client.Identity.Whoami(ctx)

If your applicaton is not context aware, you just need to pass the background context.

tc := dnsimple.StaticTokenHTTPClient(context.Background(), "your-token")
client := dnsimple.NewClient(tc)

whoamiResponse, err := client.Identity.Whoami(context.Background())

Exported response types

Response-types are now exported. This simplifies the integration, in particular testing, as you can now reference (and instantiate) a dnsimple response struct in your tests.

Optional values

We fixed multiple issues related to Golang zero-values that caused bugs when updating a zone record without specifying a name, or when specifying listing options.

As a result, you'll need to use pointers in certain scenarios, such as the ListOptions.

str := "com"
client.Domains.ListDomains(context.Background(), accountID, &dnsimple.DomainListOptions{NameLike: &str)

The client offers convenient helpers to continue using literals without explicitly creating a variable container:

client.Domains.ListDomains(context.Background(), accountID, &dnsimple.DomainListOptions{NameLike: dnsimple.String("com"))

More

If you want to learn more about the changes, take a look at the CHANGELOG for the complete list.

Our API is a powerful collection of endpoints. For a quick introduction, take a look at What you can do with the DNSimple API.

Don't hesitate to let us know if you have any feedback or if you find any issues.

Share on Twitter and Facebook

Simone Carletti's profile picture

Simone Carletti

Italian software developer, a PADI scuba instructor and a former professional sommelier. I make awesome code and troll Anthony for fun and profit.