@quranjs/api 2.1.0 → 3.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.d.ts CHANGED
@@ -1,256 +1,7 @@
1
- /**
2
- * Maps chapter number to verse count
3
- */
4
- declare const versesMapping: {
5
- readonly 1: 7;
6
- readonly 2: 286;
7
- readonly 3: 200;
8
- readonly 4: 176;
9
- readonly 5: 120;
10
- readonly 6: 165;
11
- readonly 7: 206;
12
- readonly 8: 75;
13
- readonly 9: 129;
14
- readonly 10: 109;
15
- readonly 11: 123;
16
- readonly 12: 111;
17
- readonly 13: 43;
18
- readonly 14: 52;
19
- readonly 15: 99;
20
- readonly 16: 128;
21
- readonly 17: 111;
22
- readonly 18: 110;
23
- readonly 19: 98;
24
- readonly 20: 135;
25
- readonly 21: 112;
26
- readonly 22: 78;
27
- readonly 23: 118;
28
- readonly 24: 64;
29
- readonly 25: 77;
30
- readonly 26: 227;
31
- readonly 27: 93;
32
- readonly 28: 88;
33
- readonly 29: 69;
34
- readonly 30: 60;
35
- readonly 31: 34;
36
- readonly 32: 30;
37
- readonly 33: 73;
38
- readonly 34: 54;
39
- readonly 35: 45;
40
- readonly 36: 83;
41
- readonly 37: 182;
42
- readonly 38: 88;
43
- readonly 39: 75;
44
- readonly 40: 85;
45
- readonly 41: 54;
46
- readonly 42: 53;
47
- readonly 43: 89;
48
- readonly 44: 59;
49
- readonly 45: 37;
50
- readonly 46: 35;
51
- readonly 47: 38;
52
- readonly 48: 29;
53
- readonly 49: 18;
54
- readonly 50: 45;
55
- readonly 51: 60;
56
- readonly 52: 49;
57
- readonly 53: 62;
58
- readonly 54: 55;
59
- readonly 55: 78;
60
- readonly 56: 96;
61
- readonly 57: 29;
62
- readonly 58: 22;
63
- readonly 59: 24;
64
- readonly 60: 13;
65
- readonly 61: 14;
66
- readonly 62: 11;
67
- readonly 63: 11;
68
- readonly 64: 18;
69
- readonly 65: 12;
70
- readonly 66: 12;
71
- readonly 67: 30;
72
- readonly 68: 52;
73
- readonly 69: 52;
74
- readonly 70: 44;
75
- readonly 71: 28;
76
- readonly 72: 28;
77
- readonly 73: 20;
78
- readonly 74: 56;
79
- readonly 75: 40;
80
- readonly 76: 31;
81
- readonly 77: 50;
82
- readonly 78: 40;
83
- readonly 79: 46;
84
- readonly 80: 42;
85
- readonly 81: 29;
86
- readonly 82: 19;
87
- readonly 83: 36;
88
- readonly 84: 25;
89
- readonly 85: 22;
90
- readonly 86: 17;
91
- readonly 87: 19;
92
- readonly 88: 26;
93
- readonly 89: 30;
94
- readonly 90: 20;
95
- readonly 91: 15;
96
- readonly 92: 21;
97
- readonly 93: 11;
98
- readonly 94: 8;
99
- readonly 95: 8;
100
- readonly 96: 19;
101
- readonly 97: 5;
102
- readonly 98: 8;
103
- readonly 99: 8;
104
- readonly 100: 11;
105
- readonly 101: 11;
106
- readonly 102: 8;
107
- readonly 103: 3;
108
- readonly 104: 9;
109
- readonly 105: 5;
110
- readonly 106: 4;
111
- readonly 107: 7;
112
- readonly 108: 3;
113
- readonly 109: 6;
114
- readonly 110: 3;
115
- readonly 111: 5;
116
- readonly 112: 4;
117
- readonly 113: 5;
118
- readonly 114: 6;
119
- };
120
-
121
- type _NumbersFrom0ToN<Nr extends number> = Nr extends Nr ? number extends Nr ? number : Nr extends 0 ? never : _NumbersFrom0ToNRec<Nr, [], 0> : never;
122
- type _NumbersFrom0ToNRec<Nr extends number, Counter extends unknown[], Accumulator extends number> = Counter["length"] extends Nr ? Accumulator : _NumbersFrom0ToNRec<Nr, [
123
- unknown,
124
- ...Counter
125
- ], Accumulator | Counter["length"]>;
126
- type NumberRange<Start extends number, End extends number> = Exclude<_NumbersFrom0ToN<End>, _NumbersFrom0ToN<Start>>;
127
- type NumberUnionToString<TType> = TType extends number ? `${TType}` : TType;
128
- /**
129
- * Builds a tuple with a length equal to the provided number literal.
130
- * Used for type-level arithmetic.
131
- */
132
- type BuildTuple<TLength extends number, TAccumulator extends unknown[] = []> = TAccumulator["length"] extends TLength ? TAccumulator : BuildTuple<TLength, [...TAccumulator, unknown]>;
133
- /**
134
- * Increments a numeric literal type by 1.
135
- */
136
- type Increment<TNumber extends number> = [
137
- ...BuildTuple<TNumber>,
138
- unknown
139
- ]["length"];
140
-
141
- /**
142
- * A `VerseKey` is a string literal in the form `${chapter}:${verse}` where:
143
- * - `chapter` is a valid chapter id from `versesMapping`
144
- * - `verse` is within the range 1..(verseCount for that chapter)
145
- */
146
- type VerseKey = {
147
- [TChapter in keyof typeof versesMapping]: `${TChapter}:${NumberRange<1, Increment<(typeof versesMapping)[TChapter]>>}`;
148
- }[keyof typeof versesMapping];
149
-
150
- type ChapterId = keyof typeof versesMapping | NumberUnionToString<keyof typeof versesMapping>;
151
-
152
- type _HizbNumber = NumberRange<1, 61>;
153
- type HizbNumber = _HizbNumber | NumberUnionToString<_HizbNumber>;
154
-
155
- type _JuzNumber = NumberRange<1, 31>;
156
- type JuzNumber = _JuzNumber | NumberUnionToString<_JuzNumber>;
157
-
158
- type _PageNumber = NumberRange<1, 605>;
159
- type PageNumber = _PageNumber | NumberUnionToString<_PageNumber>;
160
-
161
- type _RubNumber = NumberRange<1, 241>;
162
- type RubNumber = _RubNumber | NumberUnionToString<_RubNumber>;
163
-
164
- declare enum SearchNavigationType {
165
- SURAH = "surah",
166
- JUZ = "juz",
167
- HIZB = "hizb",
168
- AYAH = "ayah",
169
- RUB_EL_HIZB = "rub_el_hizb",
170
- SEARCH_PAGE = "search_page",
171
- PAGE = "page",
172
- RANGE = "range",
173
- QURAN_RANGE = "quran_range"
174
- }
175
- interface SearchResult {
176
- resultType: SearchNavigationType;
177
- key: number | string;
178
- name: string;
179
- arabic?: string;
180
- isArabic?: boolean;
181
- isTransliteration?: boolean;
182
- }
183
-
184
- interface SearchResponse {
185
- pagination: {
186
- currentPage: number;
187
- nextPage: number | null;
188
- perPage: number;
189
- totalPages: number;
190
- totalRecords: number;
191
- };
192
- result?: {
193
- navigation: SearchResult[];
194
- verses: SearchResult[];
195
- };
196
- }
197
-
198
- /**
199
- * Segment structure is [wordFrom, wordTo, timeFrom, timeTo] time is in ms
200
- */
201
- type Segment = [number, number, number, number];
202
-
203
- interface ChapterRecitation {
204
- id: number;
205
- chapterId: number;
206
- fileSize: number;
207
- format: string;
208
- audioUrl: string;
209
- }
210
- interface VerseRecitation {
211
- verseKey: VerseKey;
212
- url: string;
213
- id?: number;
214
- chapterId?: number;
215
- segments?: Segment[];
216
- format?: string;
217
- }
218
-
219
- interface AudioResponse {
220
- url?: string;
221
- duration?: number;
222
- format?: string;
223
- verseKey: string;
224
- segments?: Segment[];
225
- }
226
-
227
- interface TranslatedName {
228
- name: string;
229
- languageName: string;
230
- }
231
-
232
- interface Chapter {
233
- id: number;
234
- versesCount: number;
235
- bismillahPre: boolean;
236
- revelationOrder: number;
237
- revelationPlace: string;
238
- pages: Array<number>;
239
- nameComplex: string;
240
- nameSimple: string;
241
- transliteratedName: string;
242
- nameArabic: string;
243
- translatedName: TranslatedName;
244
- }
245
-
246
- interface ChapterInfo {
247
- id: number;
248
- chapterId: number;
249
- text: string;
250
- shortText: string;
251
- source: string;
252
- languageName?: string;
253
- }
1
+ import { Q as QuranClientConfig } from './index-BZgqOfA4.js';
2
+ export { A as ApiParams, f as ApiService, B as BaseApiParams, c as BinaryString, k as CachedToken, C as CustomFetcher, H as HTTPMethod, L as Language, O as OperationRequest, P as PaginationParams, j as PublicClientConfig, e as QuranFetchClient, a as QuranFont, R as RuntimeMode, S as SearchMode, d as SearchParams, i as ServerClientConfig, g as ServiceEnvironmentConfig, l as TokenResponse, h as TokenStorage, T as TranslationField, U as UserSession, V as VerseField, b as VerseRecitationField, W as WordField } from './index-BZgqOfA4.js';
3
+ import { T as TranslatedName, Q as QuranChapters, a as QuranVerses, b as QuranJuzs, c as QuranAudio, d as QuranResources, e as QuranSearch, C as ChapterId, J as JuzNumber, R as RubNumber, H as HizbNumber, P as PageNumber, V as VerseKey } from './verses-DnPcyHIi.js';
4
+ export { A as AudioResponse, h as Chapter, i as ChapterInfo, y as ChapterInfoResource, f as ChapterRecitation, B as ChapterReciterResource, o as CharType, p as Juz, L as LanguageResource, N as NormalizedVerseRecitation, q as Pagination, s as RecitationInfoResource, r as RecitationResource, x as RecitationStylesResource, D as SearchNavigationType, S as SearchResponse, E as SearchResult, j as Segment, k as Tafsir, w as TafsirInfoResource, v as TafsirResource, l as Translation, u as TranslationInfoResource, t as TranslationResource, m as Transliteration, n as Verse, z as VerseMediaResource, g as VerseRecitation, W as Word } from './verses-DnPcyHIi.js';
254
5
 
255
6
  interface Footnote {
256
7
  id: number | string;
@@ -281,14 +32,6 @@ interface Reciter {
281
32
  };
282
33
  }
283
34
 
284
- interface Tafsir {
285
- id?: number;
286
- resourceId?: number;
287
- text?: string;
288
- resourceName?: string;
289
- languageName?: string;
290
- }
291
-
292
35
  interface TafsirInfo {
293
36
  id?: number;
294
37
  name?: string;
@@ -298,657 +41,11 @@ interface TafsirInfo {
298
41
  translatedName: TranslatedName;
299
42
  }
300
43
 
301
- interface Translation {
302
- id?: number;
303
- text: string;
304
- resourceId: number;
305
- resourceName?: string;
306
- verseId?: number;
307
- languageId?: number;
308
- languageName?: string;
309
- verseKey?: VerseKey;
310
- chapterId?: number;
311
- verseNumber?: number;
312
- juzNumber?: number;
313
- hizbNumber?: number;
314
- rubNumber?: number;
315
- pageNumber?: number;
316
- }
317
-
318
- interface Transliteration {
319
- languageName?: string;
320
- text?: string;
321
- }
322
-
323
- declare enum CharType {
324
- Word = "word",
325
- End = "end",
326
- Pause = "pause",
327
- Sajdah = "sajdah",
328
- RubElHizb = "rub-el-hizb"
329
- }
330
- interface Word {
331
- id?: number;
332
- position: number;
333
- audioUrl: string;
334
- charTypeName: CharType;
335
- codeV1?: string;
336
- codeV2?: string;
337
- pageNumber?: number;
338
- lineNumber?: number;
339
- text?: string;
340
- textUthmani?: string;
341
- textIndopak?: string;
342
- textImlaei?: string;
343
- translation: Translation;
344
- transliteration: Transliteration;
345
- location?: string;
346
- verseKey?: VerseKey;
347
- }
348
-
349
- interface Verse {
350
- id: number;
351
- verseNumber: number;
352
- verseKey: VerseKey;
353
- chapterId?: number | string;
354
- pageNumber: number;
355
- juzNumber: number;
356
- hizbNumber: number;
357
- rubElHizbNumber: number;
358
- words?: Word[];
359
- textUthmani?: string;
360
- textUthmaniSimple?: string;
361
- textUthmaniTajweed?: string;
362
- textImlaei?: string;
363
- textImlaeiSimple?: string;
364
- textIndopak?: string;
365
- textIndopakNastaleeq?: string;
366
- sajdahNumber: null;
367
- imageUrl?: string;
368
- imageWidth?: number;
369
- v1Page?: number;
370
- v2Page?: number;
371
- codeV1?: string;
372
- codeV2?: string;
373
- translations?: Translation[];
374
- tafsirs?: Tafsir[];
375
- audio?: AudioResponse;
376
- }
377
-
378
- interface Juz {
379
- id: number;
380
- juzNumber: number;
381
- verseMapping: Record<number, string>;
382
- firstVerseId: number;
383
- lastVerseId: number;
384
- versesCount: number;
385
- }
386
-
387
- interface Pagination {
388
- perPage: number;
389
- currentPage: number;
390
- nextPage: number;
391
- totalPages: number;
392
- totalRecords: number;
393
- }
394
-
395
- interface RecitationResource {
396
- id?: number;
397
- reciterName?: string;
398
- style?: string;
399
- translatedName?: TranslatedName;
400
- }
401
- interface RecitationInfoResource {
402
- id?: number;
403
- info?: string;
404
- }
405
- interface TranslationResource {
406
- id?: number;
407
- name?: string;
408
- authorName?: string;
409
- slug?: string;
410
- languageName?: string;
411
- translatedName?: TranslatedName;
412
- }
413
- interface TranslationInfoResource {
414
- id?: number;
415
- info?: string;
416
- }
417
- interface TafsirResource {
418
- id?: number;
419
- name?: string;
420
- authorName?: string;
421
- slug?: string;
422
- languageName?: string;
423
- translatedName?: TranslatedName;
424
- }
425
- interface TafsirInfoResource {
426
- id?: number;
427
- info?: string;
428
- }
429
- interface RecitationStylesResource {
430
- mujawwad: string;
431
- murattal: string;
432
- muallim: string;
433
- }
434
- interface LanguageResource {
435
- id?: number;
436
- name?: string;
437
- nativeName?: string;
438
- isoCode?: string;
439
- direction?: string;
440
- translatedNames?: TranslatedName[];
441
- }
442
- interface ChapterInfoResource {
443
- id?: number;
444
- name?: string;
445
- authorName?: string;
446
- slug?: string;
447
- languageName?: string;
448
- translatedName?: TranslatedName;
449
- }
450
- interface VerseMediaResource {
451
- id?: number;
452
- name?: string;
453
- authorName?: string;
454
- languageName?: string;
455
- }
456
- interface ChapterReciterResource {
457
- id: number;
458
- name: string;
459
- arabicName?: string;
460
- relativePath?: string;
461
- format?: string;
462
- filesSize?: number;
463
- }
464
-
465
- type ApiParams = Record<string, string | number | boolean | unknown[] | undefined | Record<string, boolean>>;
466
- /**
467
- * Base parameters that are common across most API endpoints
468
- */
469
- interface BaseApiParams extends ApiParams {
470
- /** Language for the response */
471
- language?: Language;
472
- }
473
- /**
474
- * Pagination parameters
475
- */
476
- interface PaginationParams extends ApiParams {
477
- /** Page number for pagination */
478
- page?: number;
479
- /** Number of items per page */
480
- perPage?: number;
481
- }
482
- type BinaryString = "0" | "1";
483
- declare enum SearchMode {
484
- Advanced = "advanced",
485
- Quick = "quick"
486
- }
487
- /**
488
- * Search parameters
489
- */
490
- interface SearchParams extends BaseApiParams {
491
- /** Search mode */
492
- mode: SearchMode;
493
- /** Search query */
494
- query: string;
495
- /** Filter translations */
496
- filterTranslations?: string | string[];
497
- /** For advanced search, limit to exact matches */
498
- exactMatchesOnly?: BinaryString;
499
- /** Include text in the response */
500
- getText?: BinaryString;
501
- /** Include highlighted text */
502
- highlight?: BinaryString;
503
- /** Quick search navigational results count */
504
- navigationalResultsNumber?: number;
505
- /** Quick search verse results count */
506
- versesResultsNumber?: number;
507
- /** Comma-separated list of indexes */
508
- indexes?: string | string[];
509
- /** Page number for pagination */
510
- page?: number;
511
- /** Number of results to return */
512
- size?: number;
513
- /** Translation IDs to use for language detection */
514
- translationIds?: string | number | Array<string | number>;
515
- /** Quran fields to include in verse filters */
516
- fields?: Partial<Record<VerseField, boolean>>;
517
- /** Translation fields to include in verse filters */
518
- translationFields?: Partial<Record<TranslationField, boolean>>;
519
- /** Word fields to include in verse filters */
520
- wordFields?: Partial<Record<WordField, boolean>>;
521
- /** Include word data in verse filters */
522
- words?: boolean;
523
- }
524
-
525
- /**
526
- * Custom fetcher function type that matches the native fetch API
527
- */
528
- type CustomFetcher = typeof fetch;
529
- interface QuranClientConfig {
530
- /** Client ID for authentication */
531
- clientId: string;
532
- /** Client secret for authentication */
533
- clientSecret: string;
534
- /** Base URL for content APIs */
535
- contentBaseUrl?: string;
536
- /** Base URL for authentication */
537
- authBaseUrl?: string;
538
- /** Custom fetch implementation */
539
- fetch?: CustomFetcher;
540
- /** Default parameters for all API calls */
541
- defaults?: Partial<BaseApiParams>;
542
- }
543
- interface CachedToken {
544
- value: string;
545
- expiresAt: number;
546
- }
547
- interface TokenResponse {
548
- access_token: string;
549
- expires_in: number;
550
- }
551
-
552
- declare enum Language {
553
- ARABIC = "ar",
554
- ENGLISH = "en",
555
- URDU = "ur",
556
- BENGALI = "bn",
557
- TURKISH = "tr",
558
- SPANISH = "es",
559
- GERMAN = "de",
560
- BOSNIAN = "bs",
561
- RUSSIAN = "ru",
562
- ALBANIAN_AL = "al",
563
- FRENCH = "fr",
564
- DUTCH = "nl",
565
- TAMIL = "ta",
566
- TAJIK = "tg",
567
- INDONESIAN = "id",
568
- UZBEK = "uz",
569
- VIETNAMESE = "vi",
570
- CHINESE = "zh",
571
- ITALIAN = "it",
572
- JAPANESE = "ja",
573
- MALAYALAM = "ml",
574
- AMHARIC = "am",
575
- KAZAKH = "kk",
576
- PORTUGUESE = "pt",
577
- TAGALOG = "tl",
578
- THAI = "th",
579
- KOREAN = "ko",
580
- HINDI = "hi",
581
- KURDISH = "ku",
582
- HAUSA = "ha",
583
- AZERI = "az",
584
- SWAHILI = "sw",
585
- PERSIAN = "fa",
586
- SERBIAN = "sr",
587
- MARANAO = "mrn",
588
- AMAZIGH = "zgh",
589
- ASSAMESE = "as",
590
- BULGARIAN = "bg",
591
- CHECHEN = "ce",
592
- CZECH = "cs",
593
- DIVEHI = "dv",
594
- FINNISH = "fi",
595
- GUJAARATI = "gu",
596
- HEBREW = "he",
597
- GEORGIAN = "ka",
598
- CENTRAL_KHMER = "km",
599
- GANDA = "lg",
600
- MARATHI = "mr",
601
- YORUBA = "yo",
602
- MALAY = "ms",
603
- NEPALI = "ne",
604
- SWEDISH = "sv",
605
- TELUGU = "te",
606
- TATAR = "tt",
607
- UYGHUR = "ug",
608
- UKRAINIAN = "uk",
609
- NORWEGIAN = "no",
610
- OROMO = "om",
611
- POLISH = "pl",
612
- PASHTO = "ps",
613
- ROMANIAN = "ro",
614
- SINDHI = "sd",
615
- NORTHERN_SAMI = "se",
616
- SINHALA = "si",
617
- SOMALI = "so",
618
- ALBANIAN_SQ = "sq"
619
- }
620
- declare enum QuranFont {
621
- MadaniV1 = "code_v1",
622
- MadaniV2 = "code_v2",
623
- Uthmani = "text_uthmani"
624
- }
625
- type VerseField = "chapterId" | "textUthmani" | "textUthmaniSimple" | "textImlaei" | "textImlaeiSimple" | "textIndopak" | "textIndopakNastaleeq" | "textUthmaniTajweed" | "imageUrl" | "imageWidth" | "codeV1" | "codeV2" | "v1Page" | "v2Page";
626
- type WordField = "v1Page" | "v2Page" | "textUthmani" | "textImlaei" | "textIndopak" | "verseKey" | "location" | "codeV1" | "codeV2";
627
- type TranslationField = "resourceName" | "verseId" | "languageId" | "languageName" | "verseKey" | "chapterId" | "verseNumber" | "juzNumber" | "hizbNumber" | "rubNumber" | "pageNumber";
628
- type VerseRecitationField = "id" | "chapterId" | "segments" | "format";
629
-
630
- type Config = Required<Pick<QuranClientConfig, "contentBaseUrl" | "authBaseUrl">> & Omit<QuranClientConfig, "contentBaseUrl" | "authBaseUrl">;
631
- /**
632
- * Handles HTTP requests with authentication for the Quran API
633
- */
634
- declare class QuranFetcher {
635
- private config;
636
- private cachedToken;
637
- constructor(config: Config);
638
- /**
639
- * Update the configuration
640
- */
641
- updateConfig(config: Config): void;
642
- getFetch(): CustomFetcher;
643
- private doFetch;
644
- /**
645
- * Get access token for API authentication
646
- */
647
- private getAccessToken;
648
- /**
649
- * Clear cached token (useful for testing or forcing re-authentication)
650
- */
651
- clearCachedToken(): void;
652
- /**
653
- * Make URL with base URL and query parameters
654
- */
655
- private makeUrl;
656
- /**
657
- * Make authenticated HTTP request
658
- */
659
- fetch<T extends object>(url: string, params?: ApiParams): Promise<T>;
660
- }
661
-
662
- type GetChapterRecitationOptions = BaseApiParams;
663
- type GetVerseRecitationOptions = BaseApiParams & {
664
- fields?: Partial<Record<VerseRecitationField, boolean>>;
665
- };
666
- /**
667
- * Audio API methods
668
- */
669
- declare class QuranAudio {
670
- private fetcher;
671
- constructor(fetcher: QuranFetcher);
672
- /**
673
- * Get all chapter recitations for specific reciter
674
- * @param {string} reciterId
675
- * @param {GetChapterRecitationOptions} options
676
- * @example
677
- * client.audio.findAllChapterRecitations('2')
678
- */
679
- findAllChapterRecitations(reciterId: string, options?: GetChapterRecitationOptions): Promise<ChapterRecitation[]>;
680
- /**
681
- * Get a specific chapter recitation by reciter and chapter
682
- * @param {string} reciterId
683
- * @param {ChapterId} chapterId
684
- * @param {GetChapterRecitationOptions} options
685
- * @example
686
- * client.audio.findChapterRecitationById('2', '1')
687
- */
688
- findChapterRecitationById(reciterId: string, chapterId: ChapterId, options?: GetChapterRecitationOptions): Promise<ChapterRecitation>;
689
- /**
690
- * Get verse recitations by chapter
691
- * @param {ChapterId} chapterId
692
- * @param {string} recitationId
693
- * @param {GetVerseRecitationOptions} options
694
- * @example
695
- * client.audio.findVerseRecitationsByChapter('1', '2')
696
- */
697
- findVerseRecitationsByChapter(chapterId: ChapterId, recitationId: string, options?: GetVerseRecitationOptions): Promise<{
698
- audioFiles: VerseRecitation[];
699
- pagination: Pagination;
700
- }>;
701
- /**
702
- * Get verse recitations by verse key
703
- * @param {VerseKey} key
704
- * @param {string} recitationId
705
- * @param {GetVerseRecitationOptions} options
706
- * @example
707
- * client.audio.findVerseRecitationsByKey('1:1', '2')
708
- */
709
- findVerseRecitationsByKey(key: VerseKey, recitationId: string, options?: GetVerseRecitationOptions): Promise<{
710
- audioFiles: VerseRecitation[];
711
- pagination: Pagination;
712
- }>;
713
- }
714
-
715
- type GetChapterOptions = BaseApiParams;
716
- /**
717
- * Chapters API methods
718
- */
719
- declare class QuranChapters {
720
- private fetcher;
721
- constructor(fetcher: QuranFetcher);
722
- /**
723
- * Get all chapters.
724
- * @description https://api-docs.quran.com/docs/quran.com_versioned/4.0.0/list-chapters
725
- * @param {GetChapterOptions} options
726
- * @example
727
- * client.chapters.findAll()
728
- */
729
- findAll(options?: GetChapterOptions): Promise<Chapter[]>;
730
- /**
731
- * Get chapter by id.
732
- * @description https://api-docs.quran.com/docs/quran.com_versioned/4.0.0/get-chapter
733
- * @param {ChapterId} id chapter id, minimum 1, maximum 114
734
- * @param {GetChapterOptions} options
735
- * @example
736
- * client.chapters.findById('1')
737
- * client.chapters.findById('114')
738
- */
739
- findById(id: ChapterId, options?: GetChapterOptions): Promise<Chapter>;
740
- /**
741
- * Get chapter info by id.
742
- * @description https://api-docs.quran.com/docs/quran.com_versioned/4.0.0/get-chapter-info
743
- * @param {ChapterId} id chapter id, minimum 1, maximum 114
744
- * @param {GetChapterOptions} options
745
- * @example
746
- * client.chapters.findInfoById('1')
747
- * client.chapters.findInfoById('114')
748
- */
749
- findInfoById(id: ChapterId, options?: GetChapterOptions): Promise<ChapterInfo>;
750
- }
751
-
752
- /**
753
- * Juzs API methods
754
- */
755
- declare class QuranJuzs {
756
- private fetcher;
757
- constructor(fetcher: QuranFetcher);
758
- /**
759
- * Get All Juzs
760
- * @description https://api-docs.quran.com/docs/quran.com_versioned/4.0.0/juzs
761
- * @example
762
- * client.juzs.findAll()
763
- */
764
- findAll(): Promise<Juz[]>;
765
- }
766
-
767
- type GetResourceOptions = BaseApiParams;
768
- /**
769
- * Resources API methods
770
- */
771
- declare class QuranResources {
772
- private fetcher;
773
- constructor(fetcher: QuranFetcher);
774
- /**
775
- * Get all recitations.
776
- * @param {GetResourceOptions} options
777
- * @example
778
- * client.resources.findAllRecitations()
779
- */
780
- findAllRecitations(options?: GetResourceOptions): Promise<RecitationResource[]>;
781
- /**
782
- * Get all translations.
783
- * @param {GetResourceOptions} options
784
- * @example
785
- * client.resources.findAllTranslations()
786
- */
787
- findAllTranslations(options?: GetResourceOptions): Promise<TranslationResource[]>;
788
- /**
789
- * Get all tafsirs.
790
- * @param {GetResourceOptions} options
791
- * @example
792
- * client.resources.findAllTafsirs()
793
- */
794
- findAllTafsirs(options?: GetResourceOptions): Promise<TafsirResource[]>;
795
- /**
796
- * Get all languages.
797
- * @param {GetResourceOptions} options
798
- * @example
799
- * client.resources.findAllLanguages()
800
- */
801
- findAllLanguages(options?: GetResourceOptions): Promise<LanguageResource[]>;
802
- /**
803
- * Get recitation info by id.
804
- * @param {string} id recitation id
805
- * @param {GetResourceOptions} options
806
- * @example
807
- * client.resources.findRecitationInfo('1')
808
- */
809
- findRecitationInfo(id: string, options?: GetResourceOptions): Promise<RecitationInfoResource>;
810
- /**
811
- * Get translation info by id.
812
- * @param {string} id translation id
813
- * @param {GetResourceOptions} options
814
- * @example
815
- * client.resources.findTranslationInfo('131')
816
- */
817
- findTranslationInfo(id: string, options?: GetResourceOptions): Promise<TranslationInfoResource>;
818
- /**
819
- * Get tafsir info by id.
820
- * @param {string} id tafsir id
821
- * @param {GetResourceOptions} options
822
- * @example
823
- * client.resources.findTafsirInfo('171')
824
- */
825
- findTafsirInfo(id: string, options?: GetResourceOptions): Promise<TafsirInfoResource>;
826
- /**
827
- * Get all chapter infos.
828
- * @param {GetResourceOptions} options
829
- * @example
830
- * client.resources.findAllChapterInfos()
831
- */
832
- findAllChapterInfos(options?: GetResourceOptions): Promise<ChapterInfoResource[]>;
833
- /**
834
- * Get all chapter reciters.
835
- * @param {GetResourceOptions} options
836
- * @example
837
- * client.resources.findAllChapterReciters()
838
- */
839
- findAllChapterReciters(options?: GetResourceOptions): Promise<ChapterReciterResource[]>;
840
- /**
841
- * Get all recitation styles.
842
- * @param {GetResourceOptions} options
843
- * @example
844
- * client.resources.findAllRecitationStyles()
845
- */
846
- findAllRecitationStyles(options?: GetResourceOptions): Promise<RecitationStylesResource>;
847
- /**
848
- * Get verse media.
849
- * @param {GetResourceOptions} options
850
- * @example
851
- * client.resources.findVerseMedia()
852
- */
853
- findVerseMedia(options?: GetResourceOptions): Promise<VerseMediaResource>;
854
- }
855
-
856
- type SearchOptions = Omit<SearchParams, "query">;
857
- /**
858
- * Search API methods
859
- */
860
- declare class QuranSearch {
861
- private fetcher;
862
- constructor(fetcher: QuranFetcher);
863
- /**
864
- * Search
865
- * @description /v1/search
866
- * @param {string} query search query
867
- * @param {SearchOptions} options
868
- * @example
869
- * client.search.search('نور', { mode: SearchMode.Quick })
870
- * client.search.search('نور', { mode: SearchMode.Advanced, exactMatchesOnly: '1' })
871
- * client.search.search('نور', { mode: SearchMode.Quick, size: 10 })
872
- * client.search.search('نور', { mode: SearchMode.Quick, page: 2 })
873
- */
874
- search(query: string, options: SearchOptions): Promise<SearchResponse>;
875
- }
876
-
877
- type GetVerseOptions = BaseApiParams & PaginationParams & {
878
- reciter?: string | number;
879
- words?: boolean;
880
- translations?: string[] | number[];
881
- tafsirs?: string[] | number[];
882
- wordFields?: Partial<Record<WordField, boolean>>;
883
- translationFields?: Partial<Record<TranslationField, boolean>>;
884
- fields?: Partial<Record<VerseField, boolean>>;
885
- };
886
- /**
887
- * Verses API methods
888
- */
889
- declare class QuranVerses {
890
- private fetcher;
891
- constructor(fetcher: QuranFetcher);
892
- /**
893
- * Get a specific verse by its key.
894
- * @param {VerseKey} key verse key in format "chapter:verse" (e.g., "1:1")
895
- * @param {GetVerseOptions} options
896
- * @example
897
- * client.verses.findByKey('1:1')
898
- * client.verses.findByKey('2:255')
899
- */
900
- findByKey(key: VerseKey, options?: GetVerseOptions): Promise<Verse>;
901
- /**
902
- * Get verses by chapter.
903
- * @param {ChapterId} id chapter id, minimum 1, maximum 114
904
- * @param {GetVerseOptions} options
905
- * @example
906
- * client.verses.findByChapter('1')
907
- */
908
- findByChapter(id: ChapterId, options?: GetVerseOptions): Promise<Verse[]>;
909
- /**
910
- * Get verses by page number.
911
- * @param {PageNumber} page page number
912
- * @param {GetVerseOptions} options
913
- * @example
914
- * client.verses.findByPage('1')
915
- */
916
- findByPage(page: PageNumber, options?: GetVerseOptions): Promise<Verse[]>;
917
- /**
918
- * Get verses by juz number.
919
- * @param {JuzNumber} juz juz number
920
- * @param {GetVerseOptions} options
921
- * @example
922
- * client.verses.findByJuz('1')
923
- */
924
- findByJuz(juz: JuzNumber, options?: GetVerseOptions): Promise<Verse[]>;
925
- /**
926
- * Get verses by hizb number.
927
- * @param {HizbNumber} hizb hizb number
928
- * @param {GetVerseOptions} options
929
- * @example
930
- * client.verses.findByHizb('1')
931
- */
932
- findByHizb(hizb: HizbNumber, options?: GetVerseOptions): Promise<Verse[]>;
933
- /**
934
- * Get verses by rub number.
935
- * @param {RubNumber} rub rub number
936
- * @param {GetVerseOptions} options
937
- * @example
938
- * client.verses.findByRub('1')
939
- */
940
- findByRub(rub: RubNumber, options?: GetVerseOptions): Promise<Verse[]>;
941
- /**
942
- * Get a random verse.
943
- * @param {GetVerseOptions} options
944
- * @example
945
- * client.verses.findRandom()
946
- */
947
- findRandom(options?: GetVerseOptions): Promise<Verse>;
948
- }
949
-
950
44
  /**
951
- * Main Quran API client
45
+ * Legacy universal Quran API client.
46
+ *
47
+ * Prefer `createPublicClient` from `@quranjs/api/public` or
48
+ * `createServerClient` from `@quranjs/api/server` for new applications.
952
49
  */
953
50
  declare class QuranClient {
954
51
  private config;
@@ -960,17 +57,8 @@ declare class QuranClient {
960
57
  readonly resources: QuranResources;
961
58
  readonly search: QuranSearch;
962
59
  constructor(config: QuranClientConfig);
963
- /**
964
- * Get the current configuration
965
- */
966
60
  getConfig(): QuranClientConfig;
967
- /**
968
- * Update the configuration
969
- */
970
61
  updateConfig(newConfig: Partial<QuranClientConfig>): void;
971
- /**
972
- * Clear cached authentication token
973
- */
974
62
  clearCachedToken(): void;
975
63
  }
976
64
 
@@ -1046,4 +134,4 @@ declare const isValidQuranPage: (page: string | number) => page is PageNumber;
1046
134
  */
1047
135
  declare const isValidVerseKey: (key: string) => key is VerseKey;
1048
136
 
1049
- export { type ApiParams, type AudioResponse, type BaseApiParams, type BinaryString, type CachedToken, type Chapter, type ChapterId, type ChapterInfo, type ChapterInfoResource, type ChapterRecitation, type ChapterReciterResource, CharType, type CustomFetcher, type Footnote, type HizbNumber, type Juz, type JuzNumber, Language, type LanguageResource, type PageNumber, type Pagination, type PaginationParams, QuranClient, type QuranClientConfig, QuranFont, type RecitationInfoResource, type RecitationResource, type RecitationStylesResource, type Reciter, type RubNumber, SearchMode, SearchNavigationType, type SearchParams, type SearchResponse, type SearchResult, type Segment, type Tafsir, type TafsirInfo, type TafsirInfoResource, type TafsirResource, type TokenResponse, type TranslatedName, type Translation, type TranslationField, type TranslationInfoResource, type TranslationResource, type Transliteration, type Verse, type VerseField, type VerseKey, type VerseMediaResource, type VerseRecitation, type VerseRecitationField, type Word, type WordField, isValidChapterId, isValidHizb, isValidJuz, isValidQuranPage, isValidRub, isValidVerseKey };
137
+ export { ChapterId, type Footnote, HizbNumber, JuzNumber, PageNumber, QuranClient, QuranClientConfig, type Reciter, RubNumber, type TafsirInfo, TranslatedName, VerseKey, isValidChapterId, isValidHizb, isValidJuz, isValidQuranPage, isValidRub, isValidVerseKey };