import { normalizePaginatedListResponse } from "https://deno.land/x/windmill@v1.422.0/node_modules/@octokit/plugin-paginate-rest/dist-src/normalize-paginated-list-response.js";
Some “list” response that can be paginated have a different response structure
They have a total_count
key in the response (search also has incomplete_results
,
/installation/repositories also has repository_selection
), as well as a key with
the list of the items which name varies from endpoint to endpoint.
Octokit normalizes these responses so that paginated results are always returned following the same structure. One challenge is that if the list response has only one page, no Link header is provided, so this header alone is not sufficient to check wether a response is paginated or not.
We check if a "total_count" key is present in the response data, but also make sure that a "url" property is not, as the "Get the combined status for a specific ref" endpoint would otherwise match: https://developer.github.com/v3/repos/statuses/#get-the-combined-status-for-a-specific-ref