{"id":13832226,"url":"https://github.com/dnsimple/dnsimple-go","last_synced_at":"2025-05-08T22:55:51.644Z","repository":{"id":24532662,"uuid":"27939005","full_name":"dnsimple/dnsimple-go","owner":"dnsimple","description":"The DNSimple API client for Go.","archived":false,"fork":false,"pushed_at":"2025-05-08T09:20:55.000Z","size":956,"stargazers_count":76,"open_issues_count":1,"forks_count":24,"subscribers_count":14,"default_branch":"main","last_synced_at":"2025-05-08T22:55:44.376Z","etag":null,"topics":["api","api-client","dnsimple","dnsimple-api","dnsimple-policy-eng","dnsimple-policy-group-apiclient","dnsimple-policy-triage-application","go"],"latest_commit_sha":null,"homepage":"https://developer.dnsimple.com/","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/dnsimple.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.txt","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2014-12-12T21:32:30.000Z","updated_at":"2025-05-08T09:20:57.000Z","dependencies_parsed_at":"2023-07-13T08:52:32.275Z","dependency_job_id":"42a93a6a-aaaa-4720-9912-66481907175a","html_url":"https://github.com/dnsimple/dnsimple-go","commit_stats":null,"previous_names":["aetrion/dnsimple-go","weppos/dnsimple-go","weppos/go-dnsimple"],"tags_count":39,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnsimple%2Fdnsimple-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnsimple%2Fdnsimple-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnsimple%2Fdnsimple-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnsimple%2Fdnsimple-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnsimple","download_url":"https://codeload.github.com/dnsimple/dnsimple-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160798,"owners_count":21863627,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["api","api-client","dnsimple","dnsimple-api","dnsimple-policy-eng","dnsimple-policy-group-apiclient","dnsimple-policy-triage-application","go"],"created_at":"2024-08-04T10:01:56.201Z","updated_at":"2025-05-08T22:55:51.627Z","avatar_url":"https://github.com/dnsimple.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# DNSimple Go Client\n\nA Go client for the [DNSimple API v2](https://developer.dnsimple.com/v2/).\n\n[![Build Status](https://github.com/dnsimple/dnsimple-go/actions/workflows/ci.yml/badge.svg)](https://github.com/dnsimple/dnsimple-go/actions/workflows/ci.yml)\n[![GoDoc](https://godoc.org/github.com/dnsimple/dnsimple-go/dnsimple?status.svg)](https://godoc.org/github.com/dnsimple/dnsimple-go/dnsimple)\n\n## Installation\n\n```shell\ngo get github.com/dnsimple/dnsimple-go/v4/dnsimple\n```\n\n## Usage\n\nThis library is a Go client you can use to interact with the [DNSimple API v2](https://developer.dnsimple.com/v2/). Here are some examples.\n\n```go\npackage main\n\nimport (\n    \"context\"\n    \"fmt\"\n    \"os\"\n    \"strconv\"\n\n    \"github.com/dnsimple/dnsimple-go/v4/dnsimple\"\n)\n\nfunc main() {\n    tc := dnsimple.StaticTokenHTTPClient(context.Background(), \"your-token\")\n\n    // new client\n    client := dnsimple.NewClient(tc)\n\n    // get the current authenticated account (if you don't know who you are)\n    whoamiResponse, err := client.Identity.Whoami(context.Background())\n    if err != nil {\n        fmt.Printf(\"Whoami() returned error: %v\\n\", err)\n        os.Exit(1)\n    }\n\n    fmt.Println(whoamiResponse.Data.Account)\n    fmt.Println(whoamiResponse.Data.User)\n\n    // either assign the account ID or fetch it from the response\n    // if you are authenticated with an account token\n    accountID := strconv.FormatInt(whoamiResponse.Data.Account.ID, 10)\n\n    // get the list of domains\n    domainsResponse, err := client.Domains.ListDomains(context.Background(), accountID, nil)\n    if err != nil {\n        fmt.Printf(\"Domains.ListDomains() returned error: %v\\n\", err)\n        os.Exit(1)\n    }\n\n    // iterate over all the domains in the\n    // paginated response.\n    for _, domain := range domainsResponse.Data {\n        fmt.Println(domain)\n    }\n\n    // List methods support a variety of options to paginate, sort and filter records.\n    // Here's a few example:\n\n    // get the list of domains filtered by name and sorted by expiration\n    client.Domains.ListDomains(context.Background(), accountID, \u0026dnsimple.DomainListOptions{NameLike: dnsimple.String(\"com\"), ListOptions: {Sort: dnsimple.String(\"expiration:DESC\")}})\n}\n```\n\nFor more complete documentation, see [godoc](https://godoc.org/github.com/dnsimple/dnsimple-go/dnsimple).\n\n## Authentication\n\nWhen creating a new client you are required to provide an `http.Client` to use for authenticating the requests.\nSupported authentication mechanisms are OAuth and HTTP Digest. We provide convenient helpers to generate a preconfigured HTTP client.\n\n### Authenticating with OAuth\n\n```go\ntc := dnsimple.StaticTokenHTTPClient(context.Background(), \"your-token\")\n\n// new client\nclient := dnsimple.NewClient(tc)\n```\n\n### Authenticating with HTTP Basic Auth\n\n```go\nhc := dnsimple.BasicAuthHTTPClient(context.Background(), \"your-user\", \"your-password\")\nclient := dnsimple.NewClient(hc)\n```\n\nFor requests made to authorize OAuth access, and to exchange the short lived authorization token for the OAuth token, use an HTTP client with a timeout:\n\n```go\nclient := dnsimple.NewClient(\u0026http.Client{Timeout: time.Second * 10})\n```\n\nFor any other custom need you can define your own `http.RoundTripper` implementation and\npass a client that authenticated with the custom round tripper.\n\n## Sandbox Environment\n\nWe highly recommend testing against our [sandbox environment](https://developer.dnsimple.com/sandbox/) before using our production environment. This will allow you to avoid real purchases, live charges on your credit card, and reduce the chance of your running up against rate limits.\n\nThe client supports both the production and sandbox environment. To switch to sandbox pass the sandbox API host using the `base_url` option when you construct the client:\n\n```go\nclient := dnsimple.NewClient(tc)\nclient.BaseURL = \"https://api.sandbox.dnsimple.com\"\n```\n\nYou will need to ensure that you are using an access token created in the sandbox environment. Production tokens will *not* work in the sandbox environment.\n\n## Setting a custom `User-Agent` header\n\nYou can customize the `User-Agent` header for the calls made to the DNSimple API:\n\n```go\nclient := dnsimple.NewClient(tc)\nclient.SetUserAgent(\"my-app/1.0\")\n```\n\nThe value you provide will be prepended to the default `User-Agent` the client uses. For example, if you use `my-app/1.0`, the final header value will be `my-app/1.0 dnsimple-go/0.14.0` (note that it will vary depending on the client version).\n\nWe recommend to customize the user agent. If you are building a library or integration on top of the official client, customizing the client will help us to understand what is this client used for, and allow to contribute back or get in touch.\n\n## Contributing\n\nFor instructions about contributing and testing, visit the [CONTRIBUTING](CONTRIBUTING.md) file.\n\n## License\n\nCopyright (c) 2014-2024 DNSimple Corporation. This is Free Software distributed under the MIT license.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnsimple%2Fdnsimple-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnsimple%2Fdnsimple-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnsimple%2Fdnsimple-go/lists"}