@quranjs/api 2.2.0 → 3.1.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/README.md +30 -10
- package/dist/index-BZgqOfA4.d.mts +228 -0
- package/dist/index-BZgqOfA4.d.ts +228 -0
- package/dist/index.d.mts +9 -937
- package/dist/index.d.ts +9 -937
- package/dist/index.min.js +2 -2
- package/dist/index.min.js.map +1 -1
- package/dist/index.min.mjs +2 -2
- package/dist/index.min.mjs.map +1 -1
- package/dist/public.d.mts +212 -0
- package/dist/public.d.ts +212 -0
- package/dist/public.min.js +3 -0
- package/dist/public.min.js.map +1 -0
- package/dist/public.min.mjs +3 -0
- package/dist/public.min.mjs.map +1 -0
- package/dist/runtime-utils-CxjOQDsB.d.mts +3 -0
- package/dist/runtime-utils-CxjOQDsB.d.ts +3 -0
- package/dist/server.d.mts +337 -0
- package/dist/server.d.ts +337 -0
- package/dist/server.min.js +3 -0
- package/dist/server.min.js.map +1 -0
- package/dist/server.min.mjs +3 -0
- package/dist/server.min.mjs.map +1 -0
- package/dist/verses-DnPcyHIi.d.ts +739 -0
- package/dist/verses-qzAdux2V.d.mts +739 -0
- package/package.json +25 -3
|
@@ -0,0 +1,739 @@
|
|
|
1
|
+
import { e as QuranFetchClient, B as BaseApiParams, b as VerseRecitationField, d as SearchParams, P as PaginationParams, W as WordField, T as TranslationField, V as VerseField } from './index-BZgqOfA4.mjs';
|
|
2
|
+
|
|
3
|
+
/**
|
|
4
|
+
* Maps chapter number to verse count
|
|
5
|
+
*/
|
|
6
|
+
declare const versesMapping: {
|
|
7
|
+
readonly 1: 7;
|
|
8
|
+
readonly 2: 286;
|
|
9
|
+
readonly 3: 200;
|
|
10
|
+
readonly 4: 176;
|
|
11
|
+
readonly 5: 120;
|
|
12
|
+
readonly 6: 165;
|
|
13
|
+
readonly 7: 206;
|
|
14
|
+
readonly 8: 75;
|
|
15
|
+
readonly 9: 129;
|
|
16
|
+
readonly 10: 109;
|
|
17
|
+
readonly 11: 123;
|
|
18
|
+
readonly 12: 111;
|
|
19
|
+
readonly 13: 43;
|
|
20
|
+
readonly 14: 52;
|
|
21
|
+
readonly 15: 99;
|
|
22
|
+
readonly 16: 128;
|
|
23
|
+
readonly 17: 111;
|
|
24
|
+
readonly 18: 110;
|
|
25
|
+
readonly 19: 98;
|
|
26
|
+
readonly 20: 135;
|
|
27
|
+
readonly 21: 112;
|
|
28
|
+
readonly 22: 78;
|
|
29
|
+
readonly 23: 118;
|
|
30
|
+
readonly 24: 64;
|
|
31
|
+
readonly 25: 77;
|
|
32
|
+
readonly 26: 227;
|
|
33
|
+
readonly 27: 93;
|
|
34
|
+
readonly 28: 88;
|
|
35
|
+
readonly 29: 69;
|
|
36
|
+
readonly 30: 60;
|
|
37
|
+
readonly 31: 34;
|
|
38
|
+
readonly 32: 30;
|
|
39
|
+
readonly 33: 73;
|
|
40
|
+
readonly 34: 54;
|
|
41
|
+
readonly 35: 45;
|
|
42
|
+
readonly 36: 83;
|
|
43
|
+
readonly 37: 182;
|
|
44
|
+
readonly 38: 88;
|
|
45
|
+
readonly 39: 75;
|
|
46
|
+
readonly 40: 85;
|
|
47
|
+
readonly 41: 54;
|
|
48
|
+
readonly 42: 53;
|
|
49
|
+
readonly 43: 89;
|
|
50
|
+
readonly 44: 59;
|
|
51
|
+
readonly 45: 37;
|
|
52
|
+
readonly 46: 35;
|
|
53
|
+
readonly 47: 38;
|
|
54
|
+
readonly 48: 29;
|
|
55
|
+
readonly 49: 18;
|
|
56
|
+
readonly 50: 45;
|
|
57
|
+
readonly 51: 60;
|
|
58
|
+
readonly 52: 49;
|
|
59
|
+
readonly 53: 62;
|
|
60
|
+
readonly 54: 55;
|
|
61
|
+
readonly 55: 78;
|
|
62
|
+
readonly 56: 96;
|
|
63
|
+
readonly 57: 29;
|
|
64
|
+
readonly 58: 22;
|
|
65
|
+
readonly 59: 24;
|
|
66
|
+
readonly 60: 13;
|
|
67
|
+
readonly 61: 14;
|
|
68
|
+
readonly 62: 11;
|
|
69
|
+
readonly 63: 11;
|
|
70
|
+
readonly 64: 18;
|
|
71
|
+
readonly 65: 12;
|
|
72
|
+
readonly 66: 12;
|
|
73
|
+
readonly 67: 30;
|
|
74
|
+
readonly 68: 52;
|
|
75
|
+
readonly 69: 52;
|
|
76
|
+
readonly 70: 44;
|
|
77
|
+
readonly 71: 28;
|
|
78
|
+
readonly 72: 28;
|
|
79
|
+
readonly 73: 20;
|
|
80
|
+
readonly 74: 56;
|
|
81
|
+
readonly 75: 40;
|
|
82
|
+
readonly 76: 31;
|
|
83
|
+
readonly 77: 50;
|
|
84
|
+
readonly 78: 40;
|
|
85
|
+
readonly 79: 46;
|
|
86
|
+
readonly 80: 42;
|
|
87
|
+
readonly 81: 29;
|
|
88
|
+
readonly 82: 19;
|
|
89
|
+
readonly 83: 36;
|
|
90
|
+
readonly 84: 25;
|
|
91
|
+
readonly 85: 22;
|
|
92
|
+
readonly 86: 17;
|
|
93
|
+
readonly 87: 19;
|
|
94
|
+
readonly 88: 26;
|
|
95
|
+
readonly 89: 30;
|
|
96
|
+
readonly 90: 20;
|
|
97
|
+
readonly 91: 15;
|
|
98
|
+
readonly 92: 21;
|
|
99
|
+
readonly 93: 11;
|
|
100
|
+
readonly 94: 8;
|
|
101
|
+
readonly 95: 8;
|
|
102
|
+
readonly 96: 19;
|
|
103
|
+
readonly 97: 5;
|
|
104
|
+
readonly 98: 8;
|
|
105
|
+
readonly 99: 8;
|
|
106
|
+
readonly 100: 11;
|
|
107
|
+
readonly 101: 11;
|
|
108
|
+
readonly 102: 8;
|
|
109
|
+
readonly 103: 3;
|
|
110
|
+
readonly 104: 9;
|
|
111
|
+
readonly 105: 5;
|
|
112
|
+
readonly 106: 4;
|
|
113
|
+
readonly 107: 7;
|
|
114
|
+
readonly 108: 3;
|
|
115
|
+
readonly 109: 6;
|
|
116
|
+
readonly 110: 3;
|
|
117
|
+
readonly 111: 5;
|
|
118
|
+
readonly 112: 4;
|
|
119
|
+
readonly 113: 5;
|
|
120
|
+
readonly 114: 6;
|
|
121
|
+
};
|
|
122
|
+
|
|
123
|
+
type _NumbersFrom0ToN<Nr extends number> = Nr extends Nr ? number extends Nr ? number : Nr extends 0 ? never : _NumbersFrom0ToNRec<Nr, [], 0> : never;
|
|
124
|
+
type _NumbersFrom0ToNRec<Nr extends number, Counter extends unknown[], Accumulator extends number> = Counter["length"] extends Nr ? Accumulator : _NumbersFrom0ToNRec<Nr, [
|
|
125
|
+
unknown,
|
|
126
|
+
...Counter
|
|
127
|
+
], Accumulator | Counter["length"]>;
|
|
128
|
+
type NumberRange<Start extends number, End extends number> = Exclude<_NumbersFrom0ToN<End>, _NumbersFrom0ToN<Start>>;
|
|
129
|
+
type NumberUnionToString<TType> = TType extends number ? `${TType}` : TType;
|
|
130
|
+
/**
|
|
131
|
+
* Builds a tuple with a length equal to the provided number literal.
|
|
132
|
+
* Used for type-level arithmetic.
|
|
133
|
+
*/
|
|
134
|
+
type BuildTuple<TLength extends number, TAccumulator extends unknown[] = []> = TAccumulator["length"] extends TLength ? TAccumulator : BuildTuple<TLength, [...TAccumulator, unknown]>;
|
|
135
|
+
/**
|
|
136
|
+
* Increments a numeric literal type by 1.
|
|
137
|
+
*/
|
|
138
|
+
type Increment<TNumber extends number> = [
|
|
139
|
+
...BuildTuple<TNumber>,
|
|
140
|
+
unknown
|
|
141
|
+
]["length"];
|
|
142
|
+
|
|
143
|
+
/**
|
|
144
|
+
* A `VerseKey` is a string literal in the form `${chapter}:${verse}` where:
|
|
145
|
+
* - `chapter` is a valid chapter id from `versesMapping`
|
|
146
|
+
* - `verse` is within the range 1..(verseCount for that chapter)
|
|
147
|
+
*/
|
|
148
|
+
type VerseKey = {
|
|
149
|
+
[TChapter in keyof typeof versesMapping]: `${TChapter}:${NumberRange<1, Increment<(typeof versesMapping)[TChapter]>>}`;
|
|
150
|
+
}[keyof typeof versesMapping];
|
|
151
|
+
|
|
152
|
+
type ChapterId = keyof typeof versesMapping | NumberUnionToString<keyof typeof versesMapping>;
|
|
153
|
+
|
|
154
|
+
type _HizbNumber = NumberRange<1, 61>;
|
|
155
|
+
type HizbNumber = _HizbNumber | NumberUnionToString<_HizbNumber>;
|
|
156
|
+
|
|
157
|
+
type _JuzNumber = NumberRange<1, 31>;
|
|
158
|
+
type JuzNumber = _JuzNumber | NumberUnionToString<_JuzNumber>;
|
|
159
|
+
|
|
160
|
+
type _PageNumber = NumberRange<1, 605>;
|
|
161
|
+
type PageNumber = _PageNumber | NumberUnionToString<_PageNumber>;
|
|
162
|
+
|
|
163
|
+
type _RubNumber = NumberRange<1, 241>;
|
|
164
|
+
type RubNumber = _RubNumber | NumberUnionToString<_RubNumber>;
|
|
165
|
+
|
|
166
|
+
declare enum SearchNavigationType {
|
|
167
|
+
SURAH = "surah",
|
|
168
|
+
JUZ = "juz",
|
|
169
|
+
HIZB = "hizb",
|
|
170
|
+
AYAH = "ayah",
|
|
171
|
+
RUB_EL_HIZB = "rub_el_hizb",
|
|
172
|
+
SEARCH_PAGE = "search_page",
|
|
173
|
+
PAGE = "page",
|
|
174
|
+
RANGE = "range",
|
|
175
|
+
QURAN_RANGE = "quran_range"
|
|
176
|
+
}
|
|
177
|
+
interface SearchResult {
|
|
178
|
+
resultType: SearchNavigationType;
|
|
179
|
+
key: number | string;
|
|
180
|
+
name: string;
|
|
181
|
+
arabic?: string;
|
|
182
|
+
isArabic?: boolean;
|
|
183
|
+
isTransliteration?: boolean;
|
|
184
|
+
}
|
|
185
|
+
|
|
186
|
+
interface SearchResponse {
|
|
187
|
+
pagination: {
|
|
188
|
+
currentPage: number;
|
|
189
|
+
nextPage: number | null;
|
|
190
|
+
perPage: number;
|
|
191
|
+
totalPages: number;
|
|
192
|
+
totalRecords: number;
|
|
193
|
+
};
|
|
194
|
+
result?: {
|
|
195
|
+
navigation: SearchResult[];
|
|
196
|
+
verses: SearchResult[];
|
|
197
|
+
};
|
|
198
|
+
}
|
|
199
|
+
|
|
200
|
+
/**
|
|
201
|
+
* Segment structure is [wordFrom, wordTo, timeFrom, timeTo] time is in ms
|
|
202
|
+
*/
|
|
203
|
+
type Segment = [number, number, number, number];
|
|
204
|
+
|
|
205
|
+
interface ChapterRecitation {
|
|
206
|
+
id: number;
|
|
207
|
+
chapterId: number;
|
|
208
|
+
fileSize: number;
|
|
209
|
+
format: string;
|
|
210
|
+
audioUrl: string;
|
|
211
|
+
}
|
|
212
|
+
interface VerseRecitation {
|
|
213
|
+
verseKey: VerseKey;
|
|
214
|
+
/** Relative URL path (e.g., "AbdulBaset/Murattal/mp3/002255.mp3") */
|
|
215
|
+
url: string;
|
|
216
|
+
/** Absolute URL when returned by SDK helpers (e.g., "https://verses.quran.com/AbdulBaset/Murattal/mp3/002255.mp3") */
|
|
217
|
+
audioUrl?: string;
|
|
218
|
+
id?: number;
|
|
219
|
+
chapterId?: number;
|
|
220
|
+
segments?: Segment[];
|
|
221
|
+
format?: string;
|
|
222
|
+
}
|
|
223
|
+
type NormalizedVerseRecitation = VerseRecitation & {
|
|
224
|
+
audioUrl: string;
|
|
225
|
+
};
|
|
226
|
+
|
|
227
|
+
interface AudioResponse {
|
|
228
|
+
url?: string;
|
|
229
|
+
duration?: number;
|
|
230
|
+
format?: string;
|
|
231
|
+
verseKey: string;
|
|
232
|
+
segments?: Segment[];
|
|
233
|
+
}
|
|
234
|
+
|
|
235
|
+
interface TranslatedName {
|
|
236
|
+
name: string;
|
|
237
|
+
languageName: string;
|
|
238
|
+
}
|
|
239
|
+
|
|
240
|
+
interface Chapter {
|
|
241
|
+
id: number;
|
|
242
|
+
versesCount: number;
|
|
243
|
+
bismillahPre: boolean;
|
|
244
|
+
revelationOrder: number;
|
|
245
|
+
revelationPlace: string;
|
|
246
|
+
pages: Array<number>;
|
|
247
|
+
nameComplex: string;
|
|
248
|
+
nameSimple: string;
|
|
249
|
+
transliteratedName: string;
|
|
250
|
+
nameArabic: string;
|
|
251
|
+
translatedName: TranslatedName;
|
|
252
|
+
}
|
|
253
|
+
|
|
254
|
+
interface ChapterInfo {
|
|
255
|
+
id: number;
|
|
256
|
+
chapterId: number;
|
|
257
|
+
text: string;
|
|
258
|
+
shortText: string;
|
|
259
|
+
source: string;
|
|
260
|
+
languageName?: string;
|
|
261
|
+
}
|
|
262
|
+
|
|
263
|
+
interface Tafsir {
|
|
264
|
+
id?: number;
|
|
265
|
+
resourceId?: number;
|
|
266
|
+
text?: string;
|
|
267
|
+
resourceName?: string;
|
|
268
|
+
languageName?: string;
|
|
269
|
+
slug?: string;
|
|
270
|
+
languageId?: number;
|
|
271
|
+
groupVerseKeyFrom?: string;
|
|
272
|
+
groupVerseKeyTo?: string;
|
|
273
|
+
groupTafsirId?: number;
|
|
274
|
+
startVerseId?: number;
|
|
275
|
+
endVerseId?: number;
|
|
276
|
+
}
|
|
277
|
+
|
|
278
|
+
interface Translation {
|
|
279
|
+
id?: number;
|
|
280
|
+
text: string;
|
|
281
|
+
resourceId: number;
|
|
282
|
+
resourceName?: string;
|
|
283
|
+
verseId?: number;
|
|
284
|
+
languageId?: number;
|
|
285
|
+
languageName?: string;
|
|
286
|
+
verseKey?: VerseKey;
|
|
287
|
+
chapterId?: number;
|
|
288
|
+
verseNumber?: number;
|
|
289
|
+
juzNumber?: number;
|
|
290
|
+
hizbNumber?: number;
|
|
291
|
+
rubNumber?: number;
|
|
292
|
+
pageNumber?: number;
|
|
293
|
+
}
|
|
294
|
+
|
|
295
|
+
interface Transliteration {
|
|
296
|
+
languageName?: string;
|
|
297
|
+
text?: string;
|
|
298
|
+
}
|
|
299
|
+
|
|
300
|
+
declare enum CharType {
|
|
301
|
+
Word = "word",
|
|
302
|
+
End = "end",
|
|
303
|
+
Pause = "pause",
|
|
304
|
+
Sajdah = "sajdah",
|
|
305
|
+
RubElHizb = "rub-el-hizb"
|
|
306
|
+
}
|
|
307
|
+
interface Word {
|
|
308
|
+
id?: number;
|
|
309
|
+
position: number;
|
|
310
|
+
audioUrl: string;
|
|
311
|
+
charTypeName: CharType;
|
|
312
|
+
codeV1?: string;
|
|
313
|
+
codeV2?: string;
|
|
314
|
+
pageNumber?: number;
|
|
315
|
+
lineNumber?: number;
|
|
316
|
+
text?: string;
|
|
317
|
+
textUthmani?: string;
|
|
318
|
+
textIndopak?: string;
|
|
319
|
+
textImlaei?: string;
|
|
320
|
+
translation: Translation;
|
|
321
|
+
transliteration: Transliteration;
|
|
322
|
+
location?: string;
|
|
323
|
+
verseKey?: VerseKey;
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
interface Verse {
|
|
327
|
+
id: number;
|
|
328
|
+
verseNumber: number;
|
|
329
|
+
verseKey: VerseKey;
|
|
330
|
+
chapterId?: number | string;
|
|
331
|
+
pageNumber: number;
|
|
332
|
+
juzNumber: number;
|
|
333
|
+
hizbNumber: number;
|
|
334
|
+
rubElHizbNumber: number;
|
|
335
|
+
words?: Word[];
|
|
336
|
+
textUthmani?: string;
|
|
337
|
+
textUthmaniSimple?: string;
|
|
338
|
+
textUthmaniTajweed?: string;
|
|
339
|
+
textImlaei?: string;
|
|
340
|
+
textImlaeiSimple?: string;
|
|
341
|
+
textIndopak?: string;
|
|
342
|
+
textIndopakNastaleeq?: string;
|
|
343
|
+
sajdahNumber: null;
|
|
344
|
+
imageUrl?: string;
|
|
345
|
+
imageWidth?: number;
|
|
346
|
+
v1Page?: number;
|
|
347
|
+
v2Page?: number;
|
|
348
|
+
codeV1?: string;
|
|
349
|
+
codeV2?: string;
|
|
350
|
+
translations?: Translation[];
|
|
351
|
+
tafsirs?: Tafsir[];
|
|
352
|
+
audio?: AudioResponse;
|
|
353
|
+
}
|
|
354
|
+
|
|
355
|
+
interface Juz {
|
|
356
|
+
id: number;
|
|
357
|
+
juzNumber: number;
|
|
358
|
+
verseMapping: Record<number, string>;
|
|
359
|
+
firstVerseId: number;
|
|
360
|
+
lastVerseId: number;
|
|
361
|
+
versesCount: number;
|
|
362
|
+
}
|
|
363
|
+
|
|
364
|
+
interface Pagination {
|
|
365
|
+
perPage: number;
|
|
366
|
+
currentPage: number;
|
|
367
|
+
nextPage: number;
|
|
368
|
+
totalPages: number;
|
|
369
|
+
totalRecords: number;
|
|
370
|
+
}
|
|
371
|
+
|
|
372
|
+
interface RecitationResource {
|
|
373
|
+
id?: number;
|
|
374
|
+
reciterName?: string;
|
|
375
|
+
style?: string;
|
|
376
|
+
translatedName?: TranslatedName;
|
|
377
|
+
}
|
|
378
|
+
interface RecitationInfoResource {
|
|
379
|
+
id?: number;
|
|
380
|
+
info?: string;
|
|
381
|
+
}
|
|
382
|
+
interface TranslationResource {
|
|
383
|
+
id?: number;
|
|
384
|
+
name?: string;
|
|
385
|
+
authorName?: string;
|
|
386
|
+
slug?: string;
|
|
387
|
+
languageName?: string;
|
|
388
|
+
translatedName?: TranslatedName;
|
|
389
|
+
}
|
|
390
|
+
interface TranslationInfoResource {
|
|
391
|
+
id?: number;
|
|
392
|
+
info?: string;
|
|
393
|
+
}
|
|
394
|
+
interface TafsirResource {
|
|
395
|
+
id?: number;
|
|
396
|
+
name?: string;
|
|
397
|
+
authorName?: string;
|
|
398
|
+
slug?: string;
|
|
399
|
+
languageName?: string;
|
|
400
|
+
translatedName?: TranslatedName;
|
|
401
|
+
}
|
|
402
|
+
interface TafsirInfoResource {
|
|
403
|
+
id?: number;
|
|
404
|
+
info?: string;
|
|
405
|
+
}
|
|
406
|
+
interface RecitationStylesResource {
|
|
407
|
+
mujawwad: string;
|
|
408
|
+
murattal: string;
|
|
409
|
+
muallim: string;
|
|
410
|
+
}
|
|
411
|
+
interface LanguageResource {
|
|
412
|
+
id?: number;
|
|
413
|
+
name?: string;
|
|
414
|
+
nativeName?: string;
|
|
415
|
+
isoCode?: string;
|
|
416
|
+
direction?: string;
|
|
417
|
+
translatedNames?: TranslatedName[];
|
|
418
|
+
}
|
|
419
|
+
interface ChapterInfoResource {
|
|
420
|
+
id?: number;
|
|
421
|
+
name?: string;
|
|
422
|
+
authorName?: string;
|
|
423
|
+
slug?: string;
|
|
424
|
+
languageName?: string;
|
|
425
|
+
translatedName?: TranslatedName;
|
|
426
|
+
}
|
|
427
|
+
interface VerseMediaResource {
|
|
428
|
+
id?: number;
|
|
429
|
+
name?: string;
|
|
430
|
+
authorName?: string;
|
|
431
|
+
languageName?: string;
|
|
432
|
+
}
|
|
433
|
+
interface ChapterReciterResource {
|
|
434
|
+
id: number;
|
|
435
|
+
name: string;
|
|
436
|
+
arabicName?: string;
|
|
437
|
+
relativePath?: string;
|
|
438
|
+
format?: string;
|
|
439
|
+
filesSize?: number;
|
|
440
|
+
}
|
|
441
|
+
|
|
442
|
+
type GetChapterRecitationOptions = BaseApiParams;
|
|
443
|
+
type GetVerseRecitationOptions = BaseApiParams & {
|
|
444
|
+
fields?: Partial<Record<VerseRecitationField, boolean>>;
|
|
445
|
+
};
|
|
446
|
+
/**
|
|
447
|
+
* Audio API methods
|
|
448
|
+
*/
|
|
449
|
+
declare class QuranAudio {
|
|
450
|
+
private fetcher;
|
|
451
|
+
constructor(fetcher: QuranFetchClient);
|
|
452
|
+
/**
|
|
453
|
+
* Get all chapter recitations for specific reciter
|
|
454
|
+
* @param {string} reciterId
|
|
455
|
+
* @param {GetChapterRecitationOptions} options
|
|
456
|
+
* @example
|
|
457
|
+
* client.audio.findAllChapterRecitations('2')
|
|
458
|
+
*/
|
|
459
|
+
findAllChapterRecitations(reciterId: string, options?: GetChapterRecitationOptions): Promise<ChapterRecitation[]>;
|
|
460
|
+
/**
|
|
461
|
+
* Get a specific chapter recitation by reciter and chapter
|
|
462
|
+
* @param {string} reciterId
|
|
463
|
+
* @param {ChapterId} chapterId
|
|
464
|
+
* @param {GetChapterRecitationOptions} options
|
|
465
|
+
* @example
|
|
466
|
+
* client.audio.findChapterRecitationById('2', '1')
|
|
467
|
+
*/
|
|
468
|
+
findChapterRecitationById(reciterId: string, chapterId: ChapterId, options?: GetChapterRecitationOptions): Promise<ChapterRecitation>;
|
|
469
|
+
/**
|
|
470
|
+
* Get verse recitations by chapter
|
|
471
|
+
* @param {ChapterId} chapterId
|
|
472
|
+
* @param {string} recitationId
|
|
473
|
+
* @param {GetVerseRecitationOptions} options
|
|
474
|
+
* @example
|
|
475
|
+
* client.audio.findVerseRecitationsByChapter('1', '2')
|
|
476
|
+
*/
|
|
477
|
+
findVerseRecitationsByChapter(chapterId: ChapterId, recitationId: string, options?: GetVerseRecitationOptions): Promise<{
|
|
478
|
+
audioFiles: NormalizedVerseRecitation[];
|
|
479
|
+
pagination: Pagination;
|
|
480
|
+
}>;
|
|
481
|
+
/**
|
|
482
|
+
* Get verse recitations by verse key
|
|
483
|
+
* @param {VerseKey} key
|
|
484
|
+
* @param {string} recitationId
|
|
485
|
+
* @param {GetVerseRecitationOptions} options
|
|
486
|
+
* @example
|
|
487
|
+
* client.audio.findVerseRecitationsByKey('1:1', '2')
|
|
488
|
+
*/
|
|
489
|
+
findVerseRecitationsByKey(key: VerseKey, recitationId: string, options?: GetVerseRecitationOptions): Promise<{
|
|
490
|
+
audioFiles: NormalizedVerseRecitation[];
|
|
491
|
+
pagination: Pagination;
|
|
492
|
+
}>;
|
|
493
|
+
}
|
|
494
|
+
|
|
495
|
+
type GetChapterOptions = BaseApiParams;
|
|
496
|
+
/**
|
|
497
|
+
* Chapters API methods
|
|
498
|
+
*/
|
|
499
|
+
declare class QuranChapters {
|
|
500
|
+
private fetcher;
|
|
501
|
+
constructor(fetcher: QuranFetchClient);
|
|
502
|
+
/**
|
|
503
|
+
* Get all chapters.
|
|
504
|
+
* @description https://api-docs.quran.com/docs/quran.com_versioned/4.0.0/list-chapters
|
|
505
|
+
* @param {GetChapterOptions} options
|
|
506
|
+
* @example
|
|
507
|
+
* client.chapters.findAll()
|
|
508
|
+
*/
|
|
509
|
+
findAll(options?: GetChapterOptions): Promise<Chapter[]>;
|
|
510
|
+
/**
|
|
511
|
+
* Get chapter by id.
|
|
512
|
+
* @description https://api-docs.quran.com/docs/quran.com_versioned/4.0.0/get-chapter
|
|
513
|
+
* @param {ChapterId} id chapter id, minimum 1, maximum 114
|
|
514
|
+
* @param {GetChapterOptions} options
|
|
515
|
+
* @example
|
|
516
|
+
* client.chapters.findById('1')
|
|
517
|
+
* client.chapters.findById('114')
|
|
518
|
+
*/
|
|
519
|
+
findById(id: ChapterId, options?: GetChapterOptions): Promise<Chapter>;
|
|
520
|
+
/**
|
|
521
|
+
* Get chapter info by id.
|
|
522
|
+
* @description https://api-docs.quran.com/docs/quran.com_versioned/4.0.0/get-chapter-info
|
|
523
|
+
* @param {ChapterId} id chapter id, minimum 1, maximum 114
|
|
524
|
+
* @param {GetChapterOptions} options
|
|
525
|
+
* @example
|
|
526
|
+
* client.chapters.findInfoById('1')
|
|
527
|
+
* client.chapters.findInfoById('114')
|
|
528
|
+
*/
|
|
529
|
+
findInfoById(id: ChapterId, options?: GetChapterOptions): Promise<ChapterInfo>;
|
|
530
|
+
}
|
|
531
|
+
|
|
532
|
+
/**
|
|
533
|
+
* Juzs API methods
|
|
534
|
+
*/
|
|
535
|
+
declare class QuranJuzs {
|
|
536
|
+
private fetcher;
|
|
537
|
+
constructor(fetcher: QuranFetchClient);
|
|
538
|
+
/**
|
|
539
|
+
* Get All Juzs
|
|
540
|
+
* @description https://api-docs.quran.com/docs/quran.com_versioned/4.0.0/juzs
|
|
541
|
+
* @example
|
|
542
|
+
* client.juzs.findAll()
|
|
543
|
+
*/
|
|
544
|
+
findAll(): Promise<Juz[]>;
|
|
545
|
+
}
|
|
546
|
+
|
|
547
|
+
type GetResourceOptions = BaseApiParams;
|
|
548
|
+
/**
|
|
549
|
+
* Resources API methods
|
|
550
|
+
*/
|
|
551
|
+
declare class QuranResources {
|
|
552
|
+
private fetcher;
|
|
553
|
+
constructor(fetcher: QuranFetchClient);
|
|
554
|
+
/**
|
|
555
|
+
* Get all recitations.
|
|
556
|
+
* @param {GetResourceOptions} options
|
|
557
|
+
* @example
|
|
558
|
+
* client.resources.findAllRecitations()
|
|
559
|
+
*/
|
|
560
|
+
findAllRecitations(options?: GetResourceOptions): Promise<RecitationResource[]>;
|
|
561
|
+
/**
|
|
562
|
+
* Get all translations.
|
|
563
|
+
* @param {GetResourceOptions} options
|
|
564
|
+
* @example
|
|
565
|
+
* client.resources.findAllTranslations()
|
|
566
|
+
*/
|
|
567
|
+
findAllTranslations(options?: GetResourceOptions): Promise<TranslationResource[]>;
|
|
568
|
+
/**
|
|
569
|
+
* Get all tafsirs.
|
|
570
|
+
* @param {GetResourceOptions} options
|
|
571
|
+
* @example
|
|
572
|
+
* client.resources.findAllTafsirs()
|
|
573
|
+
*/
|
|
574
|
+
findAllTafsirs(options?: GetResourceOptions): Promise<TafsirResource[]>;
|
|
575
|
+
/**
|
|
576
|
+
* Get all languages.
|
|
577
|
+
* @param {GetResourceOptions} options
|
|
578
|
+
* @example
|
|
579
|
+
* client.resources.findAllLanguages()
|
|
580
|
+
*/
|
|
581
|
+
findAllLanguages(options?: GetResourceOptions): Promise<LanguageResource[]>;
|
|
582
|
+
/**
|
|
583
|
+
* Get recitation info by id.
|
|
584
|
+
* @param {string} id recitation id
|
|
585
|
+
* @param {GetResourceOptions} options
|
|
586
|
+
* @example
|
|
587
|
+
* client.resources.findRecitationInfo('1')
|
|
588
|
+
*/
|
|
589
|
+
findRecitationInfo(id: string, options?: GetResourceOptions): Promise<RecitationInfoResource>;
|
|
590
|
+
/**
|
|
591
|
+
* Get translation info by id.
|
|
592
|
+
* @param {string} id translation id
|
|
593
|
+
* @param {GetResourceOptions} options
|
|
594
|
+
* @example
|
|
595
|
+
* client.resources.findTranslationInfo('131')
|
|
596
|
+
*/
|
|
597
|
+
findTranslationInfo(id: string, options?: GetResourceOptions): Promise<TranslationInfoResource>;
|
|
598
|
+
/**
|
|
599
|
+
* Get tafsir info by id.
|
|
600
|
+
* @param {string} id tafsir id
|
|
601
|
+
* @param {GetResourceOptions} options
|
|
602
|
+
* @example
|
|
603
|
+
* client.resources.findTafsirInfo('171')
|
|
604
|
+
*/
|
|
605
|
+
findTafsirInfo(id: string, options?: GetResourceOptions): Promise<TafsirInfoResource>;
|
|
606
|
+
/**
|
|
607
|
+
* Get all chapter infos.
|
|
608
|
+
* @param {GetResourceOptions} options
|
|
609
|
+
* @example
|
|
610
|
+
* client.resources.findAllChapterInfos()
|
|
611
|
+
*/
|
|
612
|
+
findAllChapterInfos(options?: GetResourceOptions): Promise<ChapterInfoResource[]>;
|
|
613
|
+
/**
|
|
614
|
+
* Get all chapter reciters.
|
|
615
|
+
* @param {GetResourceOptions} options
|
|
616
|
+
* @example
|
|
617
|
+
* client.resources.findAllChapterReciters()
|
|
618
|
+
*/
|
|
619
|
+
findAllChapterReciters(options?: GetResourceOptions): Promise<ChapterReciterResource[]>;
|
|
620
|
+
/**
|
|
621
|
+
* Get all recitation styles.
|
|
622
|
+
* @param {GetResourceOptions} options
|
|
623
|
+
* @example
|
|
624
|
+
* client.resources.findAllRecitationStyles()
|
|
625
|
+
*/
|
|
626
|
+
findAllRecitationStyles(options?: GetResourceOptions): Promise<RecitationStylesResource>;
|
|
627
|
+
/**
|
|
628
|
+
* Get verse media.
|
|
629
|
+
* @param {GetResourceOptions} options
|
|
630
|
+
* @example
|
|
631
|
+
* client.resources.findVerseMedia()
|
|
632
|
+
*/
|
|
633
|
+
findVerseMedia(options?: GetResourceOptions): Promise<VerseMediaResource>;
|
|
634
|
+
}
|
|
635
|
+
|
|
636
|
+
type SearchOptions = Omit<SearchParams, "query">;
|
|
637
|
+
/**
|
|
638
|
+
* Search API methods
|
|
639
|
+
*/
|
|
640
|
+
declare class QuranSearch {
|
|
641
|
+
private fetcher;
|
|
642
|
+
constructor(fetcher: QuranFetchClient);
|
|
643
|
+
/**
|
|
644
|
+
* Search
|
|
645
|
+
* @description /v1/search
|
|
646
|
+
* @param {string} query search query
|
|
647
|
+
* @param {SearchOptions} options
|
|
648
|
+
* @example
|
|
649
|
+
* client.search.search('نور', { mode: SearchMode.Quick })
|
|
650
|
+
* client.search.search('نور', { mode: SearchMode.Advanced, exactMatchesOnly: '1' })
|
|
651
|
+
* client.search.search('نور', { mode: SearchMode.Quick, size: 10 })
|
|
652
|
+
* client.search.search('نور', { mode: SearchMode.Quick, page: 2 })
|
|
653
|
+
*/
|
|
654
|
+
search(query: string, options: SearchOptions): Promise<SearchResponse>;
|
|
655
|
+
}
|
|
656
|
+
|
|
657
|
+
type GetVerseOptions = BaseApiParams & PaginationParams & {
|
|
658
|
+
reciter?: string | number;
|
|
659
|
+
words?: boolean;
|
|
660
|
+
translations?: string[] | number[];
|
|
661
|
+
tafsirs?: string[] | number[];
|
|
662
|
+
wordFields?: Partial<Record<WordField, boolean>>;
|
|
663
|
+
translationFields?: Partial<Record<TranslationField, boolean>>;
|
|
664
|
+
fields?: Partial<Record<VerseField, boolean>>;
|
|
665
|
+
};
|
|
666
|
+
/**
|
|
667
|
+
* Verses API methods
|
|
668
|
+
*/
|
|
669
|
+
declare class QuranVerses {
|
|
670
|
+
private fetcher;
|
|
671
|
+
constructor(fetcher: QuranFetchClient);
|
|
672
|
+
/**
|
|
673
|
+
* Get a specific verse by its key.
|
|
674
|
+
* @param {VerseKey} key verse key in format "chapter:verse" (e.g., "1:1")
|
|
675
|
+
* @param {GetVerseOptions} options
|
|
676
|
+
* @example
|
|
677
|
+
* client.verses.findByKey('1:1')
|
|
678
|
+
* client.verses.findByKey('2:255')
|
|
679
|
+
*/
|
|
680
|
+
findByKey(key: VerseKey, options?: GetVerseOptions): Promise<Verse>;
|
|
681
|
+
/**
|
|
682
|
+
* Get verses by range.
|
|
683
|
+
* @param {VerseKey} from start verse key (e.g., "1:1")
|
|
684
|
+
* @param {VerseKey} to end verse key (e.g., "1:7")
|
|
685
|
+
* @param {GetVerseOptions} options
|
|
686
|
+
* @example
|
|
687
|
+
* client.verses.findByRange('1:1', '1:7')
|
|
688
|
+
*/
|
|
689
|
+
findByRange(from: VerseKey, to: VerseKey, options?: GetVerseOptions): Promise<Verse[]>;
|
|
690
|
+
/**
|
|
691
|
+
* Get verses by chapter.
|
|
692
|
+
* @param {ChapterId} id chapter id, minimum 1, maximum 114
|
|
693
|
+
* @param {GetVerseOptions} options
|
|
694
|
+
* @example
|
|
695
|
+
* client.verses.findByChapter('1')
|
|
696
|
+
*/
|
|
697
|
+
findByChapter(id: ChapterId, options?: GetVerseOptions): Promise<Verse[]>;
|
|
698
|
+
/**
|
|
699
|
+
* Get verses by page number.
|
|
700
|
+
* @param {PageNumber} page page number
|
|
701
|
+
* @param {GetVerseOptions} options
|
|
702
|
+
* @example
|
|
703
|
+
* client.verses.findByPage('1')
|
|
704
|
+
*/
|
|
705
|
+
findByPage(page: PageNumber, options?: GetVerseOptions): Promise<Verse[]>;
|
|
706
|
+
/**
|
|
707
|
+
* Get verses by juz number.
|
|
708
|
+
* @param {JuzNumber} juz juz number
|
|
709
|
+
* @param {GetVerseOptions} options
|
|
710
|
+
* @example
|
|
711
|
+
* client.verses.findByJuz('1')
|
|
712
|
+
*/
|
|
713
|
+
findByJuz(juz: JuzNumber, options?: GetVerseOptions): Promise<Verse[]>;
|
|
714
|
+
/**
|
|
715
|
+
* Get verses by hizb number.
|
|
716
|
+
* @param {HizbNumber} hizb hizb number
|
|
717
|
+
* @param {GetVerseOptions} options
|
|
718
|
+
* @example
|
|
719
|
+
* client.verses.findByHizb('1')
|
|
720
|
+
*/
|
|
721
|
+
findByHizb(hizb: HizbNumber, options?: GetVerseOptions): Promise<Verse[]>;
|
|
722
|
+
/**
|
|
723
|
+
* Get verses by rub number.
|
|
724
|
+
* @param {RubNumber} rub rub number
|
|
725
|
+
* @param {GetVerseOptions} options
|
|
726
|
+
* @example
|
|
727
|
+
* client.verses.findByRub('1')
|
|
728
|
+
*/
|
|
729
|
+
findByRub(rub: RubNumber, options?: GetVerseOptions): Promise<Verse[]>;
|
|
730
|
+
/**
|
|
731
|
+
* Get a random verse.
|
|
732
|
+
* @param {GetVerseOptions} options
|
|
733
|
+
* @example
|
|
734
|
+
* client.verses.findRandom()
|
|
735
|
+
*/
|
|
736
|
+
findRandom(options?: GetVerseOptions): Promise<Verse>;
|
|
737
|
+
}
|
|
738
|
+
|
|
739
|
+
export { type AudioResponse as A, type ChapterReciterResource as B, type ChapterId as C, SearchNavigationType as D, type SearchResult as E, type HizbNumber as H, type JuzNumber as J, type LanguageResource as L, type NormalizedVerseRecitation as N, type PageNumber as P, QuranChapters as Q, type RubNumber as R, type SearchResponse as S, type TranslatedName as T, type VerseKey as V, type Word as W, QuranVerses as a, QuranJuzs as b, QuranAudio as c, QuranResources as d, QuranSearch as e, type ChapterRecitation as f, type VerseRecitation as g, type Chapter as h, type ChapterInfo as i, type Segment as j, type Tafsir as k, type Translation as l, type Transliteration as m, type Verse as n, CharType as o, type Juz as p, type Pagination as q, type RecitationResource as r, type RecitationInfoResource as s, type TranslationResource as t, type TranslationInfoResource as u, type TafsirResource as v, type TafsirInfoResource as w, type RecitationStylesResource as x, type ChapterInfoResource as y, type VerseMediaResource as z };
|