{"id":13941648,"url":"https://github.com/jonschlinkert/gists","last_synced_at":"2025-07-24T11:35:42.079Z","repository":{"id":36255669,"uuid":"40560083","full_name":"jonschlinkert/gists","owner":"jonschlinkert","description":"Methods for working with the GitHub Gist API. Node.js/JavaScript","archived":false,"fork":false,"pushed_at":"2019-12-04T05:09:02.000Z","size":35,"stargazers_count":100,"open_issues_count":8,"forks_count":14,"subscribers_count":5,"default_branch":"master","last_synced_at":"2025-03-11T12:01:45.987Z","etag":null,"topics":["api","axios","get","gist","gists","github","javascript","jonschlinkert","nodejs","request","requests"],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","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/jonschlinkert.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2015-08-11T19:07:44.000Z","updated_at":"2024-10-30T16:13:16.000Z","dependencies_parsed_at":"2022-08-24T17:00:22.730Z","dependency_job_id":null,"html_url":"https://github.com/jonschlinkert/gists","commit_stats":null,"previous_names":[],"tags_count":5,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fgists","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fgists/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fgists/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/jonschlinkert%2Fgists/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/jonschlinkert","download_url":"https://codeload.github.com/jonschlinkert/gists/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":244047646,"owners_count":20389206,"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","axios","get","gist","gists","github","javascript","jonschlinkert","nodejs","request","requests"],"created_at":"2024-08-08T02:01:23.738Z","updated_at":"2025-03-17T14:15:22.382Z","avatar_url":"https://github.com/jonschlinkert.png","language":"JavaScript","readme":"# gists [![NPM version](https://img.shields.io/npm/v/gists.svg?style=flat)](https://www.npmjs.com/package/gists) [![NPM monthly downloads](https://img.shields.io/npm/dm/gists.svg?style=flat)](https://npmjs.org/package/gists) [![NPM total downloads](https://img.shields.io/npm/dt/gists.svg?style=flat)](https://npmjs.org/package/gists) \n\n\u003e Methods for working with the GitHub Gist API. Node.js/JavaScript\n\nPlease consider following this project's author, [Jon Schlinkert](https://github.com/jonschlinkert), and consider starring the project to show your :heart: and support.\n\n## Install\n\nInstall with [npm](https://www.npmjs.com/):\n\n```sh\n$ npm install --save gists\n```\n\n**Full support for:**\n\n* [Gist API](https://developer.github.com/v3/gists/)\n* [Gist Comments API](https://developer.github.com/v3/gists/comments/)\n\n_(If you find something missing or encounter a bug, please [create an issue](https://github.com/jonschlinkert/gists/issues/new). Thanks!)_\n\n## Heads up!\n\n**Breaking changes in v2.0!!!**\n\nPlease read the [CHANGELOG](CHANGELOG.md) for more details.\n\n## Usage\n\nAdd `gists` to your node.js/JavaScript project with the following code:\n\n```js\nconst Gists = require('gists');\nconst gists = new Gists({\n  username: 'your_username', \n  password: 'your_password'\n});\n\n// EXAMPLE: Download the Markdown Cheatsheet gist.\ngists.get('5854601')\n  .then(res =\u003e console.log(res))\n  .catch(console.error)\n```\n\n## API\n\nSee the [GitHub Gist API documentation](https://developer.github.com/v3/gists/) for additional details and input options for each method.\n\n### [Gists](index.js#L24)\n\nThe main export is the `Gists` class. Start by creating an instance of `Gists`.\n\n**Params**\n\n* `options` **{Object}**\n\n**Example**\n\n```js\n// see github-base for all available options and other ways to authenticate\nconst Gists = require('gists');\nconst gists = new Gists({ username: 'your_username', password: '*******' });\n\n// all methods, when invoked, return a promise with this sigature\ngists.get(...args)\n  .then(res =\u003e console.log(res.body))\n  .catch(console.error);\n```\n\n### [.create](index.js#L38)\n\nCreate a new gist ([docs](https://developer.github.com/v3/gists/#create-a-gist)).\n\n**Params**\n\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// POST /gists\ngists.create(options);\n```\n\n### [.get](index.js#L55)\n\nGet a gist ([docs](https://developer.github.com/v3/gists/#get-a-single-gist)).\n\n**Params**\n\n* `gist_id` **{String}**: (required) The id of the gist to get.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// GET /gists/:gist_id\ngists.get(gist_id[, options]);\n```\n\n### [.list](index.js#L72)\n\nList all gists for the given `username` ([docs](https://developer.github.com/v3/gists/#list-a-users-gists)).\n\n**Params**\n\n* `username` **{String}**\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// GET /users/:username/gists\ngists.list(username[, options]);\n```\n\n### [.all](index.js#L89)\n\nList the authenticated user's gists, or if called anonymously get all public gists. ([docs](https://developer.github.com/v3/gists/#list-a-users-gists)).\n\n**Params**\n\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// GET /gists/\ngists.all(options);\n```\n\n### [.public](index.js#L106)\n\nList all public gists sorted by most recently updated to least recently updated ([docs](https://developer.github.com/v3/gists/#list-all-public-gists)).\n\n**Params**\n\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// GET /gists/public\ngists.public(options);\n```\n\n### [.starred](index.js#L122)\n\nList the authenticated user's starred gists ([docs](https://developer.github.com/v3/gists/#list-starred-gists)).\n\n**Params**\n\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// GET /gists/starred\ngists.starred(options);\n```\n\n### [.revision](index.js#L140)\n\nGet a specific revision of a gist ([docs](https://developer.github.com/v3/gists/#get-a-specific-revision-of-a-gist)).\n\n**Params**\n\n* `gist_id` **{String}**: (required) The id of the gist to get.\n* `sha` **{String}**: (required) The `sha` of the gist revision to get.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// GET /gists/:gist_id/:sha\ngists.revision(gist_id, sha[, options]);\n```\n\n### [.commits](index.js#L157)\n\nList commits for a gist ([docs](https://developer.github.com/v3/gists/#list-gist-commits)).\n\n**Params**\n\n* `gist_id` **{String}**: (required) The id of the gist to get commits for.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// GET /gists/:gist_id/commits\ngists.commit(gist_id[, options]);\n```\n\n### [.forks](index.js#L174)\n\nList all forks for a gist ([docs](https://developer.github.com/v3/gists/#list-gist-forks)).\n\n**Params**\n\n* `gist_id` **{String}**: (required) The id of the gist to list forks for.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// GET /gists/:gist_id/forks\ngists.forks(gist_id[, options]);\n```\n\n### [.fork](index.js#L191)\n\nFork a gist ([docs](https://developer.github.com/v3/gists/#fork-a-gist)).\n\n**Params**\n\n* `gist_id` **{String}**: The id of the gist to fork.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// POST /gists/:gist_id/forks\ngists.fork(gist_id[, options]);\n```\n\n### [.edit](index.js#L208)\n\nEdit a gist ([docs](https://developer.github.com/v3/gists/#edit-a-gist)).\n\n**Params**\n\n* `gist_id` **{String}**: (required) The id of the gist to edit.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// PATCH /gists/:gist_id\ngists.edit(gist_id[, options]);\n```\n\n### [.delete](index.js#L225)\n\nDelete a gist ([docs](https://developer.github.com/v3/gists/#delete-a-gist)).\n\n**Params**\n\n* `gist_id` **{String}**: (required) The id of the gist to delete.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// DELETE /gists/:gist_id\ngists.delete(gist_id[, options]);\n```\n\n### [.star](index.js#L242)\n\nStar a gist ([docs](https://developer.github.com/v3/gists/#star-a-gist)).\n\n**Params**\n\n* `gist_id` **{String}**: (required) The id of the gist to star.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// PUT /gists/:gist_id/star\ngists.star(gist_id[, options]);\n```\n\n### [.unstar](index.js#L259)\n\nUnstar a gist ([docs](https://developer.github.com/v3/gists/#unstar-a-gist)).\n\n**Params**\n\n* `gist_id` **{String}**: (required) The id of the gist to unstar.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// DELETE /gists/:gist_id/star\ngists.unstar(gist_id[, options]);\n```\n\n### [.isStarred](index.js#L277)\n\nCheck if a gist is starred ([docs](https://developer.github.com/v3/gists/#check-if-a-gist-is-starred)).\n\n**Params**\n\n* `gist_id` **{String}**: (required) The id of the gist to check.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n* `returns` **{Boolean}**: Returns `true` if a gist is starred.\n\n**Example**\n\n```js\n// GET /gists/:gist_id/star\ngists.isStarred(gist_id[, options])\n```\n\n### [.comment](index.js#L301)\n\nCreate a comment on a gist ([docs](https://developer.github.com/v3/gists/comments/#create-a-comment)).\n\n**Params**\n\n* `gist_id` **{String}**: (required)\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// POST /gists/:gist_id/comments\ngists.comment(gist_id, { body: 'Just commenting for the sake of commenting' });\n```\n\n### [.getComment](index.js#L319)\n\nGet a single comment from a gist ([docs](https://developer.github.com/v3/gists/comments/#get-a-single-comment)).\n\n**Params**\n\n* `gist_id` **{String}**: (required)\n* `comment_id` **{String}**: (required) The id of the comment to get.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// GET /gists/:gist_id/comments/:comment_id\ngists.getComment(gist_id, comment_id, options);\n```\n\n### [.listComments](index.js#L336)\n\nList comments on a gist ([docs](https://developer.github.com/v3/gists/comments/#list-comments-on-a-gist)).\n\n**Params**\n\n* `gist_id` **{String}**: (required)\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// GET /gists/:gist_id/comments\ngists.listComments(options);\n```\n\n### [.edit](index.js#L354)\n\nEdit a comment ([docs](https://developer.github.com/v3/gists/comments/#edit-a-comment)).\n\n**Params**\n\n* `gist_id` **{String}**: (required)\n* `comment_id` **{String}**: (required) The id of the comment to edit.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// PATCH /gists/:gist_id/comments/:gist_id\ngists.editComment(gist_id, comment_id[, options]);\n```\n\n### [.delete](index.js#L372)\n\nDelete a comment ([docs](https://developer.github.com/v3/gists/comments/#delete-a-comment)).\n\n**Params**\n\n* `gist_id` **{String}**: (required)\n* `comment_id` **{String}**: (required) The id of the comment to edit.\n* `options` **{Object}**: Options to pass to [github-base](https://github.com/jonschlinkert/github-base).\n\n**Example**\n\n```js\n// DELETE /gists/:gist_id/comments/:comment_id\ngists.deleteComment(gist_id, comment_id[, options]);\n```\n\n## Release history\n\n### v2.0\n\n* Decrecated `.download` in favor of `.get`. Start using `.get` now, as `.download` will be removed in the next major release.\n* Decrecated `.del` in favor of `.delete`. Start using `.delete` now, as `.del` will be removed in the next major release.\n* Upgraded [github-base](https://github.com/jonschlinkert/github-base), which is now an ES6 class.\n\n## About\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eContributing\u003c/strong\u003e\u003c/summary\u003e\n\nPull requests and stars are always welcome. For bugs and feature requests, [please create an issue](../../issues/new).\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eRunning Tests\u003c/strong\u003e\u003c/summary\u003e\n\nRunning and reviewing unit tests is a great way to get familiarized with a library and its API. You can install dependencies and run tests with the following command:\n\n```sh\n$ npm install \u0026\u0026 npm test\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\n\u003csummary\u003e\u003cstrong\u003eBuilding docs\u003c/strong\u003e\u003c/summary\u003e\n\n_(This project's readme.md is generated by [verb](https://github.com/verbose/verb-generate-readme), please don't edit the readme directly. Any changes to the readme must be made in the [.verb.md](.verb.md) readme template.)_\n\nTo generate the readme, run the following command:\n\n```sh\n$ npm install -g verbose/verb#dev verb-generate-readme \u0026\u0026 verb\n```\n\n\u003c/details\u003e\n\n### Related projects\n\nYou might also be interested in these projects:\n\n* [github-base](https://www.npmjs.com/package/github-base): Low-level methods for working with the GitHub API in node.js/JavaScript. | [homepage](https://github.com/jonschlinkert/github-base \"Low-level methods for working with the GitHub API in node.js/JavaScript.\")\n* [github-contributors](https://www.npmjs.com/package/github-contributors): Generate a markdown or JSON list of contributors for a project using the GitHub API. | [homepage](https://github.com/jonschlinkert/github-contributors \"Generate a markdown or JSON list of contributors for a project using the GitHub API.\")\n\n### Contributors\n\n| **Commits** | **Contributor** | \n| --- | --- |\n| 15 | [jonschlinkert](https://github.com/jonschlinkert) |\n| 6 | [tennisonchan](https://github.com/tennisonchan) |\n| 4 | [doowb](https://github.com/doowb) |\n| 1 | [sheeit](https://github.com/sheeit) |\n\n### Author\n\n**Jon Schlinkert**\n\n* [GitHub Profile](https://github.com/jonschlinkert)\n* [Twitter Profile](https://twitter.com/jonschlinkert)\n* [LinkedIn Profile](https://linkedin.com/in/jonschlinkert)\n\n### License\n\nCopyright © 2018, [Jon Schlinkert](https://github.com/jonschlinkert).\nReleased under the [MIT License](LICENSE).\n\n***\n\n_This file was generated by [verb-generate-readme](https://github.com/verbose/verb-generate-readme), v0.6.0, on August 19, 2018._","funding_links":[],"categories":["JavaScript"],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fgists","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fjonschlinkert%2Fgists","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fjonschlinkert%2Fgists/lists"}