{"id":27999022,"url":"https://github.com/dnsimple/dnsimple-node","last_synced_at":"2025-05-08T22:55:48.681Z","repository":{"id":10794474,"uuid":"66772752","full_name":"dnsimple/dnsimple-node","owner":"dnsimple","description":"The DNSimple API client for Node.js.","archived":false,"fork":false,"pushed_at":"2025-05-08T09:15:38.000Z","size":997,"stargazers_count":47,"open_issues_count":1,"forks_count":18,"subscribers_count":11,"default_branch":"main","last_synced_at":"2025-05-08T22:55:40.329Z","etag":null,"topics":["api","api-client","dnsimple","dnsimple-api","dnsimple-policy-eng","dnsimple-policy-group-apiclient","dnsimple-policy-triage-application","node","nodejs"],"latest_commit_sha":null,"homepage":"https://developer.dnsimple.com/","language":"TypeScript","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":".github/CODEOWNERS","security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2016-08-28T14:31:51.000Z","updated_at":"2025-05-08T06:10:43.000Z","dependencies_parsed_at":"2024-04-04T13:34:23.264Z","dependency_job_id":"2ebb1130-ea09-4966-807f-c2ff1bd09f1e","html_url":"https://github.com/dnsimple/dnsimple-node","commit_stats":{"total_commits":359,"total_committers":27,"mean_commits":"13.296296296296296","dds":0.6183844011142061,"last_synced_commit":"78de3fd5de68393671f935afcd58ef4a2e2c452f"},"previous_names":[],"tags_count":36,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnsimple%2Fdnsimple-node","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnsimple%2Fdnsimple-node/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnsimple%2Fdnsimple-node/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/dnsimple%2Fdnsimple-node/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/dnsimple","download_url":"https://codeload.github.com/dnsimple/dnsimple-node/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":253160801,"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","node","nodejs"],"created_at":"2025-05-08T22:55:47.830Z","updated_at":"2025-05-08T22:55:48.662Z","avatar_url":"https://github.com/dnsimple.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# DNSimple Node.js Client\n\nA Node.js client for the [DNSimple API v2](https://developer.dnsimple.com/v2/) with TypeScript definitions.\n\n[![Build Status](https://travis-ci.com/dnsimple/dnsimple-node.svg?branch=main)](https://travis-ci.com/dnsimple/dnsimple-node)\n[![js-semistandard-style](https://img.shields.io/badge/code%20style-semistandard-brightgreen.svg?style=flat-square)](https://github.com/standard/semistandard)\n[![npm version](https://badge.fury.io/js/dnsimple.svg)](https://badge.fury.io/js/dnsimple)\n[![npm downloads](https://img.shields.io/npm/dm/dnsimple.svg)](https://www.npmjs.com/package/dnsimple)\n\n## Requirements\n\nThe [dnsimple-node](https://npmjs.org/package/dnsimple-node) package requires Node.js 18 or higher.\n\nYou must also have an activated DNSimple account to access the DNSimple API.\n\n## Installation\n\nYou can install this package directly from the GitHub repo with `npm install dnsimple/dnsimple-node`.\n\nAlternatively, install the latest stable version from NPM with `npm install dnsimple`.\n\n## Usage\n\nThis library is a Node.js client you can use to interact with the [DNSimple API v2](https://developer.dnsimple.com/v2/). TypeScript definitions are provided for all API method parameters and responses.\n\nNote that in all examples below, the `accessToken` must be an OAuth token as described in the [DNSimple API Access Token documentation](https://support.dnsimple.com/articles/api-access-token/).\n\nAll client methods that call out to the DNSimple API are async and will return a Promise. The examples below demonstrate basic usage.\n\n```js\nconst { DNSimple } = require(\"dnsimple\");\n// Or use this if you're using TypeScript:\n// import { DNSimple } from \"dnsimple\";\n\nconst client = new DNSimple({\n  accessToken: process.env.TOKEN,\n});\n\n// Fetch your details\nconst response = await client.identity.whoami();\n// All responses have a `data` property if there's response data.\nconst accountId = response.data.account.id;\n\n// List your domains\nconst { data: domains1 } = await client.domains.listDomains(accountId);\nconst { data: domains3 } = await client.domains.listDomains(accountId, { page: 3 });\n\n// Create a domain\nconst { data: createdDomain } = await client.domains.createDomain(accountId, { name: \"example.com\" });\n\n// Get a domain\nconst { data: domain } = await client.domains.getDomain(accountId, \"example.com\");\n```\n\nTo be run like this:\n\n```shell\nTOKEN=[TOKEN VALUE GOES HERE] node test.js\n```\n\nTake a look at [https://github.com/dnsimple/hello-domains-node](https://github.com/dnsimple/hello-domains-node) for an example app that authorizes via OAuth and displays your domain list.\n\n## Pagination\n\nThere are helper submethods available on API methods that are paginated to assist with fetching items across all pages.\n\nFor an API that returns a `paginate` property, you can use either the `iterateAll` or `collectAll` submethods:\n\n- **iterateAll**: return an asynchronous iterator of items that are returned from the API. When the last item on a page is iterated, the next page will be fetched. This continues until there are no more pages.\n\n- **collectAll**: fetch all pages and collect all the items in order into an array.\n\nExamples:\n\n```typescript\n// iterateAll\nfor await (const certificate of client.certificates.listCertificates.iterateAll(1010, \"bingo.pizza\")) {\n  console.log(certificate);\n}\n// collectAll\nconst certificates: Array\u003cCertificate\u003e = await client.certificates.listCertificates.collectAll(1010, \"bingo.pizza\");\nconsole.log(certificates.length);\n```\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 `baseUrl` property when you construct the client:\n\n```javascript\nconst { DNSimple } = require(\"dnsimple\");\nconst client = new DNSimple({\n  baseUrl: \"https://api.sandbox.dnsimple.com\",\n  accessToken: process.env.TOKEN,\n});\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 customize the `User-Agent` header for the calls made to the DNSimple API:\n\n```javascript\nconst { DNSimple } = require(\"dnsimple\");\nconst client = new DNSimple({\n  userAgent: \"my-app\",\n  accessToken: process.env.TOKEN,\n});\n```\n\nThe value you provide will be appended to the default `User-Agent` the client uses. For example, if you use `my-app`, the final header value will be `dnsimple-node/x.x.x my-app` (note that it will vary depending on the client version).\n\n## License\n\nCopyright © 2016\u0026ndash;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-node","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fdnsimple%2Fdnsimple-node","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fdnsimple%2Fdnsimple-node/lists"}