1 | # rest.js
|
2 |
|
3 | > GitHub REST API client for JavaScript
|
4 |
|
5 | [![@latest](https://img.shields.io/npm/v/@octokit/rest.svg)](https://www.npmjs.com/package/@octokit/rest)
|
6 | [![Build Status](https://github.com/octokit/rest.js/workflows/Test/badge.svg)](https://github.com/octokit/rest.js/actions?query=workflow%3ATest+branch%3Amain)
|
7 |
|
8 | ## Usage
|
9 |
|
10 | <table>
|
11 | <tbody valign=top align=left>
|
12 | <tr><th>
|
13 | Browsers
|
14 | </th><td width=100%>
|
15 | Load <code>@octokit/rest</code> directly from <a href="https://esm.sh">esm.sh</a>
|
16 |
|
17 | ```html
|
18 | <script type="module">
|
19 | import { Octokit } from "https://esm.sh/@octokit/rest";
|
20 | </script>
|
21 | ```
|
22 |
|
23 | </td></tr>
|
24 | <tr><th>
|
25 | Node
|
26 | </th><td>
|
27 |
|
28 | Install with <code>npm install @octokit/rest</code>
|
29 |
|
30 | ```js
|
31 | const { Octokit } = require("@octokit/rest");
|
32 | // or: import { Octokit } from "@octokit/rest";
|
33 | ```
|
34 |
|
35 | </td></tr>
|
36 | </tbody>
|
37 | </table>
|
38 |
|
39 | ```js
|
40 | const octokit = new Octokit();
|
41 |
|
42 | // Compare: https://docs.github.com/en/rest/reference/repos/#list-organization-repositories
|
43 | octokit.rest.repos
|
44 | .listForOrg({
|
45 | org: "octokit",
|
46 | type: "public",
|
47 | })
|
48 | .then(({ data }) => {
|
49 | // handle data
|
50 | });
|
51 | ```
|
52 |
|
53 | See https://octokit.github.io/rest.js for full documentation.
|
54 |
|
55 | ## Contributing
|
56 |
|
57 | We would love you to contribute to `@octokit/rest`, pull requests are very welcome! Please see [CONTRIBUTING.md](CONTRIBUTING.md) for more information.
|
58 |
|
59 | ## Credits
|
60 |
|
61 | `@octokit/rest` was originally created as [`node-github`](https://www.npmjs.com/package/github) in 2012 by Mike de Boer from Cloud9 IDE, Inc. [The original commit](https://github.blog/2020-04-09-from-48k-lines-of-code-to-10-the-story-of-githubs-javascript-sdk/) is from 2010 which predates the npm registry.
|
62 |
|
63 | It was adopted and renamed by GitHub in 2017. Learn more about its origin on GitHub's blog: [From 48k lines of code to 10—the story of GitHub’s JavaScript SDK](https://github.blog/2020-04-09-from-48k-lines-of-code-to-10-the-story-of-githubs-javascript-sdk/)
|
64 |
|
65 | ## LICENSE
|
66 |
|
67 | [MIT](LICENSE)
|