{"name":"ghutils","version":"5.0.16","author":{"url":"http://r.va.gg/","name":"Rod","email":"rod@vagg.org"},"license":"MIT","_id":"ghutils@5.0.16","maintainers":[{"name":"rvagg","email":"r@va.gg"}],"homepage":"https://github.com/rvagg/ghutils#readme","bugs":{"url":"https://github.com/rvagg/ghutils/issues"},"dist":{"shasum":"2dd5ff0630e53c3c36e27ff89466aaee68284576","tarball":"http://registry-npm.ywwl.com/ghutils/download/ghutils-5.0.16.tgz","fileCount":10,"integrity":"sha512-qr22trH4o10CZfXSixSXevtrFZIrQvG1buhEV5G9tja9dJg9o32A2ANOnB00Wltlvi/DmNv+ax0OfFG7hHfC+w==","signatures":[{"sig":"MEUCIQDINSSErI9tLI+efvzYxPSFKxM7TEFdJr6uJk9LdP9QQAIgSkO3xP3zqyVfVtUv1ZTJIRVZV9bcjvl7to22dgU3orU=","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"},{"sig":"MEMCHyHIrB5fHsGYrzdZRkuurL2IHmUDXaq1qYCotkyBUx0CIB45wIJldGYNc2o56sV9oNVUDErzl2vGhwSVE4ctiRoS","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"attestations":{"url":"https://registry.npmjs.org/-/npm/v1/attestations/ghutils@5.0.16","provenance":{"predicateType":"https://slsa.dev/provenance/v1"}},"unpackedSize":30492,"size":9203,"noattachment":false,"key":"/ghutils/-/ghutils-5.0.16.tgz"},"main":"ghutils.js","type":"module","engines":{"node":">=20"},"exports":{".":"./ghutils.js","./test-util":"./test-util.js"},"gitHead":"67eb82afa391f5c0ac5af10b20d604b7c138ed10","release":{"plugins":[["@semantic-release/commit-analyzer",{"preset":"conventionalcommits","releaseRules":[{"release":"major","breaking":true},{"revert":true,"release":"patch"},{"type":"feat","release":"minor"},{"type":"fix","release":"patch"},{"type":"chore","release":"patch"},{"type":"docs","release":"patch"},{"type":"test","release":"patch"},{"scope":"no-release","release":false}]}],["@semantic-release/release-notes-generator",{"preset":"conventionalcommits","presetConfig":{"types":[{"type":"feat","section":"Features"},{"type":"fix","section":"Bug Fixes"},{"type":"perf","section":"Performance Improvements"},{"type":"revert","section":"Reverts"},{"type":"refactor","section":"Code Refactoring"},{"type":"test","section":"Tests"},{"type":"build","section":"Trivial Changes"},{"type":"ci","section":"Trivial Changes"},{"type":"chore","section":"Trivial Changes"},{"type":"docs","section":"Trivial Changes"},{"type":"style","section":"Trivial Changes"}]}}],"@semantic-release/changelog","@semantic-release/npm","@semantic-release/github","@semantic-release/git"],"branches":["master"]},"scripts":{"lint":"standard","test":"npm run lint && npm run test:unit","build":"true","test:unit":"node --test test.js"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"32191cea-c8e6-4245-ad04-f9ee2f72fd3c"}},"repository":{"url":"git+https://github.com/rvagg/ghutils.git","type":"git"},"_npmVersion":"11.21.1","description":"A collection of utility functions for dealing with the GitHub API","directories":{},"_nodeVersion":"24.21.0","_hasShrinkwrap":false,"devDependencies":{"standard":"^17.1.2","semantic-release":"^25.0.2","@semantic-release/git":"^11.0.0","@semantic-release/npm":"^13.1.3","@semantic-release/github":"^12.0.2","@semantic-release/changelog":"^7.0.0","@semantic-release/commit-analyzer":"^13.0.1","@semantic-release/release-notes-generator":"^14.1.0","conventional-changelog-conventionalcommits":"^9.3.1"},"_npmOperationalInternal":{"tmp":"tmp/ghutils_5.0.16_1793106863632_0.6148898291079419","host":"s3://npm-registry-packages-npm-production"},"readme":"# ghutils\n\n**A collection of utility functions for dealing with the GitHub API**\n\n[![NPM](https://nodei.co/npm/ghutils.svg?style=flat&data=n,v&color=blue)](https://nodei.co/npm/ghutils/)\n\nUsed by:\n\n* [ghissues](https://github.com/rvagg/ghissues) - a Node.js library to interact with the GitHub Issues API\n* [ghpulls](https://github.com/rvagg/ghpulls) - a Node.js library to interact with the GitHub Pull Request API\n* [ghrepos](https://github.com/rvagg/ghrepos) - a Node.js library to interact with the GitHub Repos API\n* [ghusers](https://github.com/rvagg/ghusers) - a Node.js library to interact with the GitHub Users API\n* [ghteams](https://github.com/rvagg/ghteams) - a Node.js library to interact with the GitHub Teams API\n* [ghreleases](https://github.com/ralphtheninja/ghreleases) - a Node.js library to interact with the GitHub Releases API\n\n## Requirements\n\n- Node.js >= 20\n\n## Example\n\n```js\nimport { ghget, lister } from 'ghutils'\n\nconst auth = { token: 'your-github-token' }\n\n// Make a single GET request\nconst { data } = await ghget(auth, 'https://api.github.com/user')\nconsole.log(data)\n\n// List all items from a paginated endpoint\nconst issues = await lister(auth, 'https://api.github.com/repos/owner/repo/issues')\nconsole.log(issues)\n```\n\n## API\n\nAll methods return Promises and use native `fetch` internally.\n\n### apiRoot\n\nThe API root URL: `'https://api.github.com'`\n\n### makeOptions(auth, options)\n\nHelper to build request options with proper headers. Accepts a GitHub auth object from [ghauth](https://github.com/rvagg/ghauth) (containing a `token` property) and optional additional options.\n\n### ghget(auth, url, options)\n\nMake a GitHub API compatible GET request to the given URL. Returns `{ data, res }` where `data` is the parsed JSON response and `res` is the fetch Response object.\n\n```js\nconst { data, res } = await ghget(auth, 'https://api.github.com/user')\n```\n\n### ghpost(auth, url, data, options)\n\nMake a GitHub API compatible POST request with JSON body.\n\n```js\nconst { data } = await ghpost(auth, 'https://api.github.com/repos/owner/repo/issues', {\n  title: 'New issue',\n  body: 'Issue description'\n})\n```\n\n### ghpatch(auth, url, data, options)\n\nMake a GitHub API compatible PATCH request with JSON body.\n\n```js\nconst { data } = await ghpatch(auth, 'https://api.github.com/repos/owner/repo/issues/1', {\n  state: 'closed'\n})\n```\n\n### ghdelete(auth, url, options)\n\nMake a GitHub API compatible DELETE request.\n\n```js\nawait ghdelete(auth, 'https://api.github.com/repos/owner/repo/issues/1/labels/bug')\n```\n\n### lister(auth, urlbase, options)\n\nGiven a paginated URL resource, recursively fetch all available pages of data and return an array containing the complete list.\n\nOptions:\n- `afterDate` - A `Date` object; only return items with `created_at` after this date\n- Any other options are passed as query parameters (e.g., `state`, `per_page`)\n\n```js\n// Get all open issues\nconst issues = await lister(auth, 'https://api.github.com/repos/owner/repo/issues', {\n  state: 'open',\n  per_page: 100\n})\n\n// Get issues created after a specific date\nconst recentIssues = await lister(auth, 'https://api.github.com/repos/owner/repo/issues', {\n  afterDate: new Date('2024-01-01')\n})\n```\n\n## Authentication\n\nAll methods accept an `auth` object with a `token` property. Use [ghauth](https://github.com/rvagg/ghauth) to create and manage persistent GitHub authentication tokens for command-line apps:\n\n```js\nimport ghauth from 'ghauth'\n\nconst auth = await ghauth({\n  configName: 'my-app',\n  clientId: 'your-github-oauth-app-client-id',\n  scopes: ['repo']\n})\n// auth = { token: 'ghp_xxxxxxxxxxxx', user: 'username' }\n```\n\nOr provide the token directly:\n\n```js\nconst auth = { token: 'ghp_xxxxxxxxxxxx' }\n```\n\nFor backwards compatibility with older versions, an object with both `user` and `token` properties is also accepted (the `user` property is ignored).\n\n## License & Copyright\n\n**ghutils** is Copyright (c) 2015-2025 Rod Vagg [@rvagg](https://twitter.com/rvagg) and licensed under the MIT licence. All rights not explicitly granted in the MIT license are reserved. See the included LICENSE.md file for more details.\n","publish_time":1793106863716,"_cnpm_publish_time":1793106863716,"dist-tags":{"latest":"5.0.17"}}