@octokit/plugin-rest-endpoint-methods
TypeScript icon, indicating that this package has built-in type declarations

11.0.1 • Public • Published

plugin-rest-endpoint-methods.js

Octokit plugin adding one method for all of api.github.com REST API endpoints

@latest Build Status

Usage

Browsers

Load @octokit/plugin-rest-endpoint-methods and @octokit/core (or core-compatible module) directly from esm.sh

<script type="module">
  import { Octokit } from "https://esm.sh/@octokit/core";
  import { restEndpointMethods } from "https://esm.sh/@octokit/plugin-rest-endpoint-methods";
</script>
Node

Install with npm install @octokit/core @octokit/plugin-rest-endpoint-methods. Optionally replace @octokit/core with a compatible module

import { Octokit } from "@octokit/core";
import { restEndpointMethods } from "@octokit/plugin-rest-endpoint-methods";
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. All endpoint methods are documented in the docs/ folder, e.g. docs/users/getAuthenticated.md

TypeScript

Parameter and response types for all endpoint methods exported as { RestEndpointMethodTypes }.

Example

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, which is a direct transpilation from GitHub's official OpenAPI specification.

Contributing

See CONTRIBUTING.md

License

MIT

Readme

Keywords

Package Sidebar

Install

npm i @octokit/plugin-rest-endpoint-methods

Weekly Downloads

5,232,353

Version

11.0.1

License

MIT

Unpacked Size

1.25 MB

Total Files

18

Last publish

Collaborators

  • kfcampbell
  • nickfloyd
  • gr2m
  • octokitbot