@octokit/rest
's direct dependencies. Data on all dependencies, including transitive ones, is available via CSV download.Name | Version | Size | License | Type | Vulnerabilities |
---|---|---|---|---|---|
@octokit/core | 5.2.0 | 44.31 kB | MIT | prod peer | |
@octokit/plugin-paginate-rest | 8.0.0 | 18.79 kB | MIT | prod | |
@octokit/plugin-request-log | 4.0.1 | 10.71 kB | MIT | prod | |
@octokit/plugin-rest-endpoint-methods | 9.0.0 | 158.34 kB | MIT | prod |
The @octokit/rest
package is a GitHub REST API client for Node.js. This JavaScript client facilitates direct interaction with the GitHub REST API, enabling developers to perform operations like list organization repositories, user authentication, CRUD operations on issues, pull requests, and other GitHub entities, among others, directly from their JavaScript code.
To use @octokit/rest
, start by installing the package with your Node package manager of choice: npm install @octokit/rest
. After installation, you can import the Octokit
class from the package. Instantiating this class gives you an object with methods that allow you to perform various GitHub REST API operations. Below is a quick example:
const { Octokit } = require("@octokit/rest");
const octokit = new Octokit();
octokit.rest.repos.listForOrg({
org: "octokit",
type: "public",
})
.then(({ data }) => {
// handle data
});
In this example, we are establishing a connection to GitHub's API using Octokit
and then listing all the public repositories for the organization "octokit". The then
function is used to handle the response.
If you are working in a browser environment, you can also use the ES6 module syntax via a module CDN like esm.sh:
<script type="module">
import { Octokit } from "https://esm.sh/@octokit/rest";
// use Octokit as above
</script>
The full documentation for @octokit/rest
, containing detailed usage instructions and API method descriptions, is available online at Octokit's own documentation page. Here you'll find all the information you need to make full use of this powerful GitHub REST API client in your JavaScript projects.