Parse Before/After Links into Response#2154
Merged
gmlewis merged 2 commits intogoogle:masterfrom Nov 15, 2021
dghubble:parse-before-after
Merged
Parse Before/After Links into Response#2154gmlewis merged 2 commits intogoogle:masterfrom dghubble:parse-before-after
gmlewis merged 2 commits intogoogle:masterfrom
dghubble:parse-before-after
Conversation
* Some Github APIs use `before`/`after` for pagination, rather than `page` or `cursor` pagination. Parse these response values * For example, the Organizations GetAuditLog (Enterprise Cloud) https://docs.github.com/en/rest/reference/orgs#get-the-audit-log-for-an-organization With this change, pagination can be performed ```go for pageCount < PageMax { entries, resp, err := client.Organizations.GetAuditLog(ctx, "org", auditParams) if err != nil { return err } pageCount++ if resp.After == "" { break } auditParams.After = resp.After } ```
Codecov Report
@@ Coverage Diff @@
## master #2154 +/- ##
==========================================
+ Coverage 97.78% 97.79% +0.01%
==========================================
Files 112 112
Lines 9976 10036 +60
==========================================
+ Hits 9755 9815 +60
Misses 154 154
Partials 67 67
Continue to review full report at Codecov.
|
Contributor
Author
|
Maybe another reviewer has time / interest? |
Collaborator
|
Perhaps @Parker77 has time? |
Co-authored-by: Parker77 <20973702+Parker77@users.noreply.github.com>
Collaborator
|
Thank you, @Parker77 ! |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
before/afterfor pagination, rather thanpageorcursorpagination. Parse these response values into the githubResponseWith this change, pagination can be performed
Rel: #1848