Skip to content

Conversation

@jablan
Copy link
Collaborator

@jablan jablan commented Dec 16, 2025

phrase/phrase-js#19

Parses pagination and link headers from API response and exposes them as convenience functions.

In order to keep the backwards compatibility, we can't alter high level API functions, but only raw ones instead.

@jablan jablan marked this pull request as ready for review December 16, 2025 10:23
@jablan jablan requested a review from Copilot December 16, 2025 10:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adds pagination metadata parsing from API response headers, exposing pagination information through the raw API methods while maintaining backward compatibility with high-level API functions.

Key changes:

  • Extended ApiResponse interface and JSONApiResponse class to include pagination properties (isPaginated, hasNextPage, nextPage, nextPageUrl, totalCount, totalPages)
  • Implemented header parsing logic in the constructor to extract pagination data from Link and Pagination headers
  • Added comprehensive test coverage for the new pagination functionality

Reviewed changes

Copilot reviewed 2 out of 2 changed files in this pull request and generated 2 comments.

File Description
openapi-generator/templates/typescript-fetch/runtime.mustache Adds pagination properties to ApiResponse interface and implements parsing logic in JSONApiResponse constructor
clients/typescript/tests/BasicApiTest.ts Updates mock fetch helper to support headers and adds new test suite for localesListRaw with pagination assertions

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@jablan jablan requested a review from Varpuspaavi December 16, 2025 10:35
@jablan jablan merged commit 92ad9fc into main Dec 16, 2025
11 checks passed
@jablan jablan deleted the scd-665-ts-parse-pagination branch December 16, 2025 13:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants