Skip to content
← Public packages

@kody/github

Call GitHub REST, GraphQL, and pull requests with a GitHub OAuth App or a personal access token.

src/paginate.ts

16 lines · 546 B · TypeScript
import type { GitHubPaginateOptions } from "./types"
export { paginate } from "./core"
import { paginate } from "./core"

/**
 * Follow GitHub REST Link pagination for array endpoints.
 *
 * @returns Combined `items` from up to `maxPages` pages.
 * @example
 * import githubPaginate from 'kody:@kody/github/paginate'
 * const result = await githubPaginate({ path: '/user/repos', maxPages: 2 })
 * // => { items: [...], pages: 2 }
 */
export default async function githubPaginate(params: GitHubPaginateOptions) {
  return await paginate(params)
}