Permalink
Cannot retrieve contributors at this time
76 lines (53 sloc)
2.44 KB
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
codeql-action/node_modules/@octokit/plugin-rest-endpoint-methods/README.md
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# plugin-rest-endpoint-methods.js | |
> Octokit plugin adding one method for all of api.github.com REST API endpoints | |
[](https://www.npmjs.com/package/@octokit/plugin-rest-endpoint-methods) | |
[](https://github.com/octokit/plugin-rest-endpoint-methods.js/actions?workflow=Test) | |
## Usage | |
<table> | |
<tbody valign=top align=left> | |
<tr><th> | |
Browsers | |
</th><td width=100%> | |
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) | |
```html | |
<script type="module"> | |
import { Octokit } from "https://cdn.skypack.dev/@octokit/core"; | |
import { restEndpointMethods } from "https://cdn.skypack.dev/@octokit/plugin-rest-endpoint-methods"; | |
</script> | |
``` | |
</td></tr> | |
<tr><th> | |
Node | |
</th><td> | |
Install with `npm install @octokit/core @octokit/plugin-rest-endpoint-methods`. Optionally replace `@octokit/core` with a compatible module | |
```js | |
const { Octokit } = require("@octokit/core"); | |
const { | |
restEndpointMethods, | |
} = require("@octokit/plugin-rest-endpoint-methods"); | |
``` | |
</td></tr> | |
</tbody> | |
</table> | |
```js | |
const MyOctokit = Octokit.plugin(restEndpointMethods); | |
const octokit = new MyOctokit({ auth: "secret123" }); | |
// https://developer.github.com/v3/users/#get-the-authenticated-user | |
octokit.rest.users.getAuthenticated(); | |
``` | |
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) | |
## TypeScript | |
Parameter and response types for all endpoint methods exported as `{ RestEndpointMethodTypes }`. | |
Example | |
```ts | |
import { RestEndpointMethodTypes } from "@octokit/plugin-rest-endpoint-methods"; | |
type UpdateLabelParameters = | |
RestEndpointMethodTypes["issues"]["updateLabel"]["parameters"]; | |
type UpdateLabelResponse = | |
RestEndpointMethodTypes["issues"]["updateLabel"]["response"]; | |
``` | |
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 transpilation from GitHub's official OpenAPI specification. | |
## Contributing | |
See [CONTRIBUTING.md](CONTRIBUTING.md) | |
## License | |
[MIT](LICENSE) |