-
Notifications
You must be signed in to change notification settings - Fork 240
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Update pagination query to conform to API spec
While looking for API shape mismatches for #389, I stumbled upon a major issue with our pagination parameters across the entire package. This fixes that discrepency, but is done via a pretty intrusive breaking change by removing the embedded `APIListObject` from all `List*Options` types, replacing them with three distinct fields: `Limit`, `Offset`, and `Total`. For the traditional API pagination, there is a `total` URL query parameter that tells the API to include the total count of records in the response. For the query parameter it's a bool flag, with a value of `true` telling the API to include the count. When the response comes back from the API, there is a `total` field in the JSON that is the total count of items in the collection. This value is only set if that `total` query parameter is set to `true` because it's an expensive operation that PagerDuty recommends you don't enable. The problem is we tried to reuse the `APIListObject` struct type for both the pagination URL query parameters, and the pagination fields in the JSON response body. The issue with doing that is for requests the `Total` field needs to be a bool, but within the `APIListObject` it's a `uint` because it was really only designed to be used for response body parsing. So since we're intending to remove the embedded struct types in v2 (#318), it feels like the best course of action here is to move forward with that plan for these paginated query parameter struct types so that we can conform to the PagerDuty API spec. Related to #318 Related to #389
- Loading branch information
Showing
34 changed files
with
494 additions
and
120 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Oops, something went wrong.