📅 You're Invited: Meet the Socket team at RSAC (April 28 – May 1).RSVP
Socket
Sign inDemoInstall
Socket

@octokit/plugin-paginate-graphql

Package Overview
Dependencies
Maintainers
4
Versions
18
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@octokit/plugin-paginate-graphql

Octokit plugin to paginate GraphQL API endpoint responses

5.2.4
latest
Source
npm
Version published
Maintainers
4
Created

What is @octokit/plugin-paginate-graphql?

@octokit/plugin-paginate-graphql is a plugin for the Octokit library that simplifies the process of paginating through GitHub's GraphQL API responses. It allows developers to easily handle large sets of data that are returned in multiple pages by automatically fetching all pages of results.

What are @octokit/plugin-paginate-graphql's main functionalities?

Automatic Pagination

This feature allows you to automatically paginate through all pages of a GraphQL query. The code sample demonstrates how to fetch all issues from a GitHub repository using the paginateGraphql method.

const { Octokit } = require('@octokit/core');
const { paginateGraphql } = require('@octokit/plugin-paginate-graphql');

const MyOctokit = Octokit.plugin(paginateGraphql);
const octokit = new MyOctokit({ auth: 'your-token' });

async function fetchAllIssues() {
  const query = `
    query($cursor: String) {
      repository(owner: "owner", name: "repo") {
        issues(first: 100, after: $cursor) {
          nodes {
            title
            number
          }
          pageInfo {
            endCursor
            hasNextPage
          }
        }
      }
    }
  `;

  const issues = await octokit.paginateGraphql(query);
  console.log(issues);
}

fetchAllIssues();

Other packages similar to @octokit/plugin-paginate-graphql

Keywords

github

FAQs

Package last updated on 11 Oct 2024

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