Title: Support pagination by thomasjm · Pull Request #503 · haskell-github/github · GitHub
Open Graph Title: Support pagination by thomasjm · Pull Request #503 · haskell-github/github
X Title: Support pagination by thomasjm · Pull Request #503 · haskell-github/github
Description: This PR is an attempt to support GitHub's pagination API. At present, this package allows you to construct a request with FetchCount, which has constructors FetchAtLeast Word and FetchAll. Both of these cause the library to repeatedly call the GitHub endpoint as many times as necessary to collect the desired number of items. This obscures the actual pagination API from the user. What if I want to fetch a specific page? And what if I want to access the Link header information returned by the GitHub API, to determine the total number of pages, next/last page links, etc.? This PR adds a new constructor to FetchCount called FetchPage PageParams. PageParams allows you to specify the page and/or perPage as integers, and you will get exactly the items you're asking for. This PR also exposes a function parsePageLinks, which you can use to extract the page links from an HTTP response. You can use it like this: mgr <- newManager tlsManagerSettings ret <- executeRequestWithMgrAndRes mgr auth $ issuesForRepoR owner repo mempty (GitHub.FetchPage (GitHub.PageParams (Just 2) (Just 1))) case ret of Left e -> expectationFailure . show $ e Right res -> do let issues = responseBody res let pageLinks = GitHub.parsePageLinks res putStrLn ("pageLinks: " ++ show pageLinks) I'd like to expose this in a nicer way at the higher levels of the API, like the github function. Maybe by providing a githubPaged version that returns the response value and also a PageLinks object. But this is serviceable enough for now. More API design suggestions are welcome!
Open Graph Description: This PR is an attempt to support GitHub's pagination API. At present, this package allows you to construct a request with FetchCount, which has constructors FetchAtLeast Word and FetchAll. Both...
X Description: This PR is an attempt to support GitHub's pagination API. At present, this package allows you to construct a request with FetchCount, which has constructors FetchAtLeast Word and FetchAll. ...
Opengraph URL: https://github.com/haskell-github/github/pull/503
X: @github
Domain: patch-diff.githubusercontent.com
| route-pattern | /:user_id/:repository/pull/:id/checks(.:format) |
| route-controller | pull_requests |
| route-action | checks |
| fetch-nonce | v2:da1d8a22-38d7-724b-ebe9-d61d535c4809 |
| current-catalog-service-hash | 87dc3bc62d9b466312751bfd5f889726f4f1337bdff4e8be7da7c93d6c00a25a |
| request-id | 9E48:10BDCB:40AE86C:59481EB:6977EC56 |
| html-safe-nonce | 29b99229e43ba95625be5f1470f6b990f800beb2adc03979404274f51969b18e |
| visitor-payload | eyJyZWZlcnJlciI6IiIsInJlcXVlc3RfaWQiOiI5RTQ4OjEwQkRDQjo0MEFFODZDOjU5NDgxRUI6Njk3N0VDNTYiLCJ2aXNpdG9yX2lkIjoiNDQ2OTE2Mzg0NDA4MTAxOTk5MCIsInJlZ2lvbl9lZGdlIjoiaWFkIiwicmVnaW9uX3JlbmRlciI6ImlhZCJ9 |
| visitor-hmac | 091bf97e45591123b35e876062880231db409ca5a5bfc6db771c5be1d1f9b54b |
| hovercard-subject-tag | pull_request:1746798242 |
| github-keyboard-shortcuts | repository,pull-request-list,pull-request-conversation,pull-request-files-changed,checks,copilot |
| google-site-verification | Apib7-x98H0j5cPqHWwSMm6dNU4GmODRoqxLiDzdx9I |
| octolytics-url | https://collector.github.com/github/collect |
| analytics-location | / |
| fb:app_id | 1401488693436528 |
| apple-itunes-app | app-id=1477376905, app-argument=https://github.com/haskell-github/github/pull/503/checks |
| twitter:image | https://avatars.githubusercontent.com/u/1634990?s=400&v=4 |
| twitter:card | summary_large_image |
| og:image | https://avatars.githubusercontent.com/u/1634990?s=400&v=4 |
| og:image:alt | This PR is an attempt to support GitHub's pagination API. At present, this package allows you to construct a request with FetchCount, which has constructors FetchAtLeast Word and FetchAll. Both... |
| og:site_name | GitHub |
| og:type | object |
| hostname | github.com |
| expected-hostname | github.com |
| None | 7eaaff248df7c1f4041c54b7590a56b5684599fefe7ab3647a01863fcc3f017a |
| turbo-cache-control | no-preview |
| go-import | github.com/haskell-github/github git https://github.com/haskell-github/github.git |
| octolytics-dimension-user_id | 101745265 |
| octolytics-dimension-user_login | haskell-github |
| octolytics-dimension-repository_id | 2677437 |
| octolytics-dimension-repository_nwo | haskell-github/github |
| octolytics-dimension-repository_public | true |
| octolytics-dimension-repository_is_fork | false |
| octolytics-dimension-repository_network_root_id | 2677437 |
| octolytics-dimension-repository_network_root_nwo | haskell-github/github |
| turbo-body-classes | logged-out env-production page-responsive full-width full-width-p-0 |
| disable-turbo | false |
| browser-stats-url | https://api.github.com/_private/browser/stats |
| browser-errors-url | https://api.github.com/_private/browser/errors |
| release | 25fe115ee1f8e1f2769ecde97c7c00c068519c2a |
| ui-target | canary-2 |
| theme-color | #1e2327 |
| color-scheme | light dark |
Links:
Viewport: width=device-width