github.com/nektos/act@v0.2.63-0.20240520024548-8acde99bfa9c/pkg/runner/testdata/actions/node16/node_modules/@octokit/plugin-rest-endpoint-methods/README.md (about) 1 # plugin-rest-endpoint-methods.js 2 3 > Octokit plugin adding one method for all of api.github.com REST API endpoints 4 5 [](https://www.npmjs.com/package/@octokit/plugin-rest-endpoint-methods) 6 [](https://github.com/octokit/plugin-rest-endpoint-methods.js/actions?workflow=Test) 7 8 ## Usage 9 10 <table> 11 <tbody valign=top align=left> 12 <tr><th> 13 Browsers 14 </th><td width=100%> 15 16 Load `@octokit/plugin-rest-endpoint-methods` and [`@octokit/core`](https://github.com/octokit/core.js) (or core-compatible module) directly from [cdn.skypack.dev](https://cdn.skypack.dev) 17 18 ```html 19 <script type="module"> 20 import { Octokit } from "https://cdn.skypack.dev/@octokit/core"; 21 import { restEndpointMethods } from "https://cdn.skypack.dev/@octokit/plugin-rest-endpoint-methods"; 22 </script> 23 ``` 24 25 </td></tr> 26 <tr><th> 27 Node 28 </th><td> 29 30 Install with `npm install @octokit/core @octokit/plugin-rest-endpoint-methods`. Optionally replace `@octokit/core` with a compatible module 31 32 ```js 33 const { Octokit } = require("@octokit/core"); 34 const { 35 restEndpointMethods, 36 } = require("@octokit/plugin-rest-endpoint-methods"); 37 ``` 38 39 </td></tr> 40 </tbody> 41 </table> 42 43 ```js 44 const MyOctokit = Octokit.plugin(restEndpointMethods); 45 const octokit = new MyOctokit({ auth: "secret123" }); 46 47 // https://developer.github.com/v3/users/#get-the-authenticated-user 48 octokit.rest.users.getAuthenticated(); 49 ``` 50 51 There is one method for each REST API endpoint documented at [https://developer.github.com/v3](https://developer.github.com/v3). All endpoint methods are documented in the [docs/](docs/) folder, e.g. [docs/users/getAuthenticated.md](docs/users/getAuthenticated.md) 52 53 ## TypeScript 54 55 Parameter and response types for all endpoint methods exported as `{ RestEndpointMethodTypes }`. 56 57 Example 58 59 ```ts 60 import { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods"; 61 62 type UpdateLabelParameters = RestEndpointMethodTypes["issues"]["updateLabel"]["parameters"]; 63 type UpdateLabelResponse = RestEndpointMethodTypes["issues"]["updateLabel"]["response"]; 64 ``` 65 66 In order to get types beyond parameters and responses, check out [`@octokit/openapi-types`](https://github.com/octokit/openapi-types.ts/#readme), which is a direct transpliation from GitHub's official OpenAPI specification. 67 68 ## Contributing 69 70 See [CONTRIBUTING.md](CONTRIBUTING.md) 71 72 ## License 73 74 [MIT](LICENSE)