jdalrymple / gitbeaker

🦊🧪 A comprehensive and typed Gitlab SDK for Node.js, Browsers, Deno and CLI
Other
1.5k stars 283 forks source link

Pagination not working in `Repositories.allRepositoryTrees` #3602

Closed ryan-williams closed 2 weeks ago

ryan-williams commented 2 weeks ago

Description

Steps to reproduce

Here's a repro in GitHub Actions:

Simple attempt to use keyset pagination in Repositories.allRepositoryTrees isn't working:

import { Gitlab } from "@gitbeaker/rest"
const gl = new Gitlab({ token: "" })
const page = await gl.Repositories.allRepositoryTrees(
    "hudcostreets/ctbk.dev",
    {
        pagination: "keyset",
        perPage: 5,
    }
)
console.log(`${page.length} items:`)
console.log(page)

Returns 22 items (despite perPage: 5), and no pagination info.

"keyset" is the only pagination method supported in Repositories.allRepositoryTrees, so I'm unable to page through results at all.

Expected behaviour

Return 5 items, and some sort of cursor or callback to fetch more

Actual behaviour

Returns array of 22 items, no pagination info.

Checklist

ryan-williams commented 2 weeks ago

I realized the various GitBeaker all* APIs are automatically fetching all "pages" of results from GitLab.

I was confused by a corner-case related to fetching top-level groups: #3603.