Skip to content

Commit

Permalink
Merge pull request #84 from GW2Treasures/feature/page-size
Browse files Browse the repository at this point in the history
Allow specifying `page_size` without `page` for paginated endpoints
  • Loading branch information
darthmaim authored Nov 1, 2024
2 parents 0147397 + 83dfeed commit 143c8dc
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
5 changes: 5 additions & 0 deletions .changeset/chilly-snakes-behave.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@gw2api/types": patch
---

Allow specifying `page_size` without `page` for paginated endpoints
2 changes: 1 addition & 1 deletion packages/types/endpoints.ts
Original file line number Diff line number Diff line change
Expand Up @@ -339,7 +339,7 @@ type WithParameters<Url extends string, Parameters extends string | undefined =
Parameters extends undefined ? Url : `${Url}?${Parameters}`;

// helper for paginated endpoints
type PaginationParameters = `page=${number}` | CombineParameters<`page=${number}`, `page_size=${number}`>;
type PaginationParameters = `page=${number}` | `page_size=${number}` | CombineParameters<`page=${number}`, `page_size=${number}`>;
type PaginatedEndpointUrl<Endpoint extends KnownEndpoint> = Endpoint | WithParameters<Endpoint, PaginationParameters>

// helper types for bulk requests
Expand Down

0 comments on commit 143c8dc

Please sign in to comment.