Skip to content

Conversation

@basit3407
Copy link
Contributor

Description

This PR adds support for the new GET /api/v4/verses/by_range endpoint to the JS SDK, allowing consumers to fetch verses within a specific range of verse keys (e.g., '1:1' to '1:7').

It also ensures the Tafsir type definition is up-to-date with the latest quran.com-api changes, including new fields for tafsir grouping and localization.

Changes

  • SDK: Added findByRange(from: VerseKey, to: VerseKey, options?: GetVerseOptions) method to QuranVerses class.
  • Types: Updated Tafsir interface to include:
    • slug
    • languageId
    • groupVerseKeyFrom
    • groupVerseKeyTo
    • groupTafsirId
    • startVerseId
    • endVerseId
  • Tests: Added unit tests for findByRange covering valid requests and edge cases (invalid keys).
  • Mocks: Added MSW handler for /api/v4/verses/by_range to support local testing.

Verification

  • Ran unit tests via pnpm test and validated all tests pass, including the new findByRange test cases. for the new /api/v4/verses/by_range endpoint to the JS SDK.

This commit adds support for the new `/api/v4/verses/by_range` endpoint to the JS SDK.
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.

1 participant