Socket
Socket
Sign inDemoInstall

@octokit/plugin-rest-endpoint-methods

Package Overview
Dependencies
10
Maintainers
4
Versions
193
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @octokit/plugin-rest-endpoint-methods

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


Version published
Weekly downloads
6.9M
increased by1.53%
Maintainers
4
Created
Weekly downloads
 

Package description

What is @octokit/plugin-rest-endpoint-methods?

The @octokit/plugin-rest-endpoint-methods package is a plugin for Octokit, a GitHub SDK, that provides methods for calling GitHub's REST API endpoints. It simplifies the process of making REST API calls to GitHub by providing pre-defined methods for many of the API endpoints, allowing developers to interact with GitHub data and perform actions like repository management, issue tracking, and more without having to manually construct HTTP requests.

What are @octokit/plugin-rest-endpoint-methods's main functionalities?

Repository Management

This feature allows users to create a new repository on GitHub. The provided code sample demonstrates how to create a new repository for the authenticated user.

{"octokit.rest.repos.createForAuthenticatedUser({ name: 'my-new-repo' })"}

Issues Management

This feature enables users to create new issues in a repository. The code sample shows how to create an issue in the 'hello-world' repository owned by 'octocat' with a title and body.

{"octokit.rest.issues.create({ owner: 'octocat', repo: 'hello-world', title: 'New issue', body: 'Hello, world!' })"}

Pull Requests

This feature allows users to create pull requests in a repository. The code sample illustrates creating a pull request in the 'hello-world' repository, specifying the title, feature branch, and base branch.

{"octokit.rest.pulls.create({ owner: 'octocat', repo: 'hello-world', title: 'Amazing new feature', head: 'feature-branch-name', base: 'main' })"}

Other packages similar to @octokit/plugin-rest-endpoint-methods

Readme

Source

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

[!IMPORTANT] As we use conditional exports, you will need to adapt your tsconfig.json by setting "moduleResolution": "node16", "module": "node16".

See the TypeScript docs on package.json "exports".
See this helpful guide on transitioning to ESM from @sindresorhus

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

Keywords

FAQs

Last updated on 16 Apr 2024

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc