Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@octokit/core

Package Overview
Dependencies
Maintainers
4
Versions
75
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/core

Extendable client for GitHub's REST & GraphQL APIs

  • 5.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
9.2M
decreased by-4.11%
Maintainers
4
Weekly downloads
 
Created

What is @octokit/core?

The @octokit/core package is a core library for GitHub's REST API v3. It provides a simplified interface to interact with GitHub's API, allowing developers to authenticate, send requests, and process responses. This package is part of the Octokit SDK, which is a collection of libraries for working with the GitHub API.

What are @octokit/core's main functionalities?

Authentication

Authenticate with the GitHub API using a personal access token. This is essential for performing actions that require GitHub permissions.

{
  const { Octokit } = require('@octokit/core');
  const octokit = new Octokit({ auth: `personal_access_token` });
}

Send Requests

Send requests to the GitHub API. This example fetches a user's profile information using their username.

{
  const { Octokit } = require('@octokit/core');
  const octokit = new Octokit();
  async function fetchUser() {
    const response = await octokit.request('GET /users/{username}', {
      username: 'octocat'
    });
    console.log(response.data);
  }
  fetchUser();
}

Custom Requests

Create custom requests to perform specific actions, such as creating an issue in a repository. This demonstrates how to use the package to interact with various parts of the GitHub API.

{
  const { Octokit } = require('@octokit/core');
  const octokit = new Octokit();
  async function createIssue(owner, repo, title, body) {
    const response = await octokit.request('POST /repos/{owner}/{repo}/issues', {
      owner,
      repo,
      title,
      body
    });
    console.log(response.data);
  }
  createIssue('octocat', 'Hello-World', 'New issue title', 'Issue body content');
}

Other packages similar to @octokit/core

Keywords

FAQs

Package last updated on 23 Sep 2023

Did you know?

Socket

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
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc