{"id":13581678,"url":"https://github.com/amalucelli/nextdns-go","last_synced_at":"2025-09-26T09:30:25.486Z","repository":{"id":38048174,"uuid":"504408661","full_name":"amalucelli/nextdns-go","owner":"amalucelli","description":"Go client library to access the NextDNS API","archived":false,"fork":false,"pushed_at":"2023-05-06T00:37:48.000Z","size":78,"stargazers_count":14,"open_issues_count":1,"forks_count":6,"subscribers_count":3,"default_branch":"main","last_synced_at":"2024-11-05T21:44:58.243Z","etag":null,"topics":["go","golang","golang-client","nextdns"],"latest_commit_sha":null,"homepage":"","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/amalucelli.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE.md","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}},"created_at":"2022-06-17T05:45:06.000Z","updated_at":"2024-02-11T23:37:21.000Z","dependencies_parsed_at":"2024-06-21T16:42:46.105Z","dependency_job_id":"43b9b44e-464d-4a27-88e6-ad0a36abb41b","html_url":"https://github.com/amalucelli/nextdns-go","commit_stats":null,"previous_names":[],"tags_count":6,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalucelli%2Fnextdns-go","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalucelli%2Fnextdns-go/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalucelli%2Fnextdns-go/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/amalucelli%2Fnextdns-go/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/amalucelli","download_url":"https://codeload.github.com/amalucelli/nextdns-go/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":234300387,"owners_count":18810607,"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":["go","golang","golang-client","nextdns"],"created_at":"2024-08-01T15:02:10.270Z","updated_at":"2025-09-26T09:30:25.175Z","avatar_url":"https://github.com/amalucelli.png","language":"Go","funding_links":[],"categories":["Go"],"sub_categories":[],"readme":"# nextdns-go\n\nGo client library for [NextDNS](https://nextdns.io/) API.\n\n## Install\n\n```bash\ngo get github.com/amalucelli/nextdns-go/nextdns\n```\n\n## Requirements\n\nAn API Key is required to interact with the NextDNS API.\nYou can find your API Key in the [NextDNS account](https://my.nextdns.io/account) page.\n\n## API\n\nThe [official API documentation](https://nextdns.github.io/api/) was the base document for this package.\n\nAPIs supported by this package:\n\n- [x] Profile (`/profiles` and `/profiles/:profile`)\n- [ ] Analytics (`/profiles/:profile/analytics`)\n- [ ] Logs (`/profiles/:profile/logs`)\n\n## Usage\n\nHere is an example usage of the NextAPI Go client for the `/profiles` endpoint:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/amalucelli/nextdns-go/nextdns\"\n)\n\nfunc main() {\n\t// get the api key from the environment\n\tkey := os.Getenv(\"NEXTDNS_API_KEY\")\n\n\t// client client with a custom API key\n\tctx := context.Background()\n\tclient, _ := nextdns.New(\n\t\tnextdns.WithAPIKey(key),\n\t)\n\n\t// set a few settings like the name and some other attributes\n\tcreate := \u0026nextdns.CreateProfileRequest{\n\t\tName: \"nextdns-go\",\n\t\tDenylist: []*nextdns.Denylist{\n\t\t\t{\n\t\t\t\tID:     \"google.com\",\n\t\t\t\tActive: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tID:     \"bing.com\",\n\t\t\t\tActive: true,\n\t\t\t},\n\t\t},\n\t\tAllowlist: []*nextdns.Allowlist{\n\t\t\t{\n\t\t\t\tID:     \"duckduckgo.com\",\n\t\t\t\tActive: true,\n\t\t\t},\n\t\t\t{\n\t\t\t\tID:     \"search.brave.com\",\n\t\t\t\tActive: false,\n\t\t\t},\n\t\t},\n\t\tParentalControl: \u0026nextdns.ParentalControl{\n\t\t\tCategories: []*nextdns.ParentalControlCategories{\n\t\t\t\t{\n\t\t\t\t\tID:     \"gambling\",\n\t\t\t\t\tActive: true,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t\tSecurity: \u0026nextdns.Security{\n\t\t\tAiThreatDetection: true,\n\t\t},\n\t\tSettings: \u0026nextdns.Settings{\n\t\t\tLogs: \u0026nextdns.SettingsLogs{\n\t\t\t\tEnabled: true,\n\t\t\t},\n\t\t\tWeb3: true,\n\t\t},\n\t}\n\n\t// create a new profile\n\tid, _ := client.Profiles.Create(ctx, create)\n\n\t// set a few settings like the name and some other attributes\n\tupdate := \u0026nextdns.UpdateProfileRequest{\n\t\tProfileID: id,\n\t\tProfile: \u0026nextdns.Profile{\n\t\t\tName: \"nextdns-go-updated\",\n\t\t\tSettings: \u0026nextdns.Settings{\n\t\t\t\tLogs: \u0026nextdns.SettingsLogs{\n\t\t\t\t\tEnabled: false,\n\t\t\t\t},\n\t\t\t},\n\t\t},\n\t}\n\n\t// update the profile\n\t_ = client.Profiles.Update(ctx, update)\n\n\t// get the profile details to check the settings\n\tprofile, _ := client.Profiles.Get(ctx, \u0026nextdns.GetProfileRequest{\n\t\tProfileID: id,\n\t})\n\tfmt.Printf(\"%q profile name: %s\\n\", id, profile.Name)\n\tfmt.Printf(\"%q logs status: %t\\n\", id, profile.Settings.Logs.Enabled)\n\n\t// list all the profiles\n\tprofiles, _ := client.Profiles.List(ctx, \u0026nextdns.ListProfileRequest{})\n\tfmt.Printf(\"Found %d profiles\\n\", len(profiles))\n\tfor _, p := range profiles {\n\t\tfmt.Printf(\"ID: %q\\n\", p.ID)\n\t\tfmt.Printf(\"Name: %q\\n\", p.Name)\n\t}\n\n\t// delete the profile\n\t_ = client.Profiles.Delete(ctx, \u0026nextdns.DeleteProfileRequest{\n\t\tProfileID: id,\n\t})\n}\n```\n\nIt's also possible to update directly the API child endpoints, like the `/profiles/:profile/denylist` endpoint:\n\n```go\npackage main\n\nimport (\n\t\"context\"\n\t\"fmt\"\n\t\"os\"\n\n\t\"github.com/amalucelli/nextdns-go/nextdns\"\n)\n\nfunc main() {\n\t// get the api key from the environment\n\tkey := os.Getenv(\"NEXTDNS_API_KEY\")\n\n\t// client client with a custom API key\n\tctx := context.Background()\n\tclient, _ := nextdns.New(\n\t\tnextdns.WithAPIKey(key),\n\t)\n\n\t// set the profile id\n\tid := \"abc123\"\n\n\t// set the request to update the denylist\n\trequest := \u0026nextdns.UpdateDenylistRequest{\n\t\tProfileID: id,\n\t\tID:      \"google.com\",\n\t\tDenylist: \u0026nextdns.Denylist{\n\t\t\tActive: true,\n\t\t},\n\t}\n\n\t// update the denylist\n\t_ = client.Denylist.Update(ctx, request)\n\n\t// list all the denylist entries\n\tlist, _ := client.Denylist.Get(ctx, \u0026nextdns.GetDenylistRequest{ProfileID: id})\n\tfor _, p := range list {\n\t\tfmt.Printf(\"ID: %q\\n\", p.ID)\n\t\tfmt.Printf(\"Status: %t\\n\", p.Active)\n\t}\n}\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famalucelli%2Fnextdns-go","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Famalucelli%2Fnextdns-go","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Famalucelli%2Fnextdns-go/lists"}