Skip to content

octokit/plugin-paginate-graphql.js

 
 

Repository files navigation

plugin-paginate-graphql.js

Octokit plugin to paginate GraphQL Query responses

@latest Build Status Greenkeeper

Usage

Browsers

Load @octokit/plugin-paginate-graphql and @octokit/core (or core-compatible module) directly from cdn.pika.dev

<script type="module">
  import { Octokit } from "https://cdn.pika.dev/@octokit/core";
  import { paginateGraphql } from "https://cdn.pika.dev/@octokit/plugin-paginate-graphql";
</script>
Node

Install with npm install @octokit/core @octokit/plugin-paginate-graphql. Optionally replace @octokit/core with a core-compatible module

const { Octokit } = require("@octokit/core");
const { paginateGraphql } = require("@octokit/plugin-paginate-graphql");
const MyOctokit = Octokit.plugin(paginateGraphql);
const octokit = new MyOctokit({ auth: "secret123" });

const query = `query repositoryIssues($owner:String!,$repo:String!,$since:DateTime!) {
  repository(owner:$owner,name:$repo) {
    issues(first:100, filterBy:{since:$since}) {
      nodes {
        number
        title
      }
    }
  }
}`;
const {
  repository: {
    issues: { nodes: issues }
  }
} = await octokit.paginate(query, {
  owner: "octocat",
  repo: "hello-world",
  since: "2019-10-01T00:00:00.000Z"
});

Contributing

See CONTRIBUTING.md

License

MIT

About

Octokit plugin to paginate GraphQL Query responses

Topics

Resources

License

Code of conduct

Contributing

Stars

Watchers

Forks

Packages

No packages published

Contributors 14