islamic-content-sdk 1.0.1 → 1.0.3

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.
Files changed (2) hide show
  1. package/README.md +357 -47
  2. package/package.json +1 -1
package/README.md CHANGED
@@ -2,7 +2,7 @@
2
2
 
3
3
  [![npm version](https://img.shields.io/npm/v/islamic-content-sdk.svg)](https://www.npmjs.com/package/islamic-content-sdk)
4
4
  [![npm downloads](https://img.shields.io/npm/dm/islamic-content-sdk.svg)](https://www.npmjs.com/package/islamic-content-sdk)
5
- [![bundle size](https://img.shields.io/bundlephobia/minzip/islamic-content-sdk)](https://bundlephobia.com/package/islamic-content-sdk)
5
+ [![bundle size](https://badgen.net/bundlephobia/minzip/islamic-content-sdk)](https://bundlephobia.com/package/islamic-content-sdk)
6
6
 
7
7
  An integrated and easy-to-use software library for developers to fetch authentic Islamic content (The Holy Qur'an and Hadith) in multiple languages directly from official sources.
8
8
 
@@ -13,12 +13,13 @@ This project is developed for [The Association for Multi-lingual Islamic Content
13
13
  ## Services Overview
14
14
 
15
15
  This SDK aggregates content from multiple major multi-lingual Islamic platforms:
16
- * **QuranEnc (`quranenc`)**: Quran Translations, suras, verses, and audios.
17
- * **HadeethEnc (`hadeethenc`)**: Hadith collections, category trees, and grades.
18
- * **IslamHouse (`islamhouse`)**: Multi-lingual books, articles, audios, fatwas, and author details.
19
- * **Risalat Al-Haramain (`risalatAlHaramain`)**: Platform content, Fatwas, Quran recitations, and Hadiths.
20
- * **Bayan Al Islam (`bayanAlIslam`)**: Educational booklets and resources tailored for Muslims and Non-Muslims.
21
- * **Al Montaka (`alMontaka`)**: Structured lookups, categories, content filters, and community comments.
16
+
17
+ - **QuranEnc (`quranenc`)**: Quran Translations, suras, verses, and audios.
18
+ - **HadeethEnc (`hadeethenc`)**: Hadith collections, category trees, and grades.
19
+ - **IslamHouse (`islamhouse`)**: Multi-lingual books, articles, audios, fatwas, and author details.
20
+ - **Risalat Al-Haramain (`risalatAlHaramain`)**: Platform content, Fatwas, Quran recitations, and Hadiths.
21
+ - **Bayan Al Islam (`bayanAlIslam`)**: Educational booklets and resources tailored for Muslims and Non-Muslims.
22
+ - **Al Montaka (`alMontaka`)**: Structured lookups, categories, content filters, and community comments.
22
23
 
23
24
  ---
24
25
 
@@ -40,116 +41,424 @@ import { IslamicContentSdk } from "islamic-content-sdk";
40
41
  const sdk = new IslamicContentSdk();
41
42
  ```
42
43
 
44
+ ---
45
+
46
+ ## Detailed Service Methods Reference
47
+
48
+ Below is a complete guide on how to interact with every single method and option available in the SDK.
49
+
43
50
  ### Quran Source (QuranEnc API)
44
51
 
52
+ **API Documentation Link:** [QuranEnc API](https://quranenc.com/en/home/api/)
53
+
45
54
  ```typescript
46
- // 1. Get available translations
55
+ // 1. Get available translations list on the platform
47
56
  const translations = await sdk.quranenc.translationList({
48
- language: "es",
49
- localization: "ar",
57
+ language: "es", // Optional: Filter list by language code
58
+ localization: "ar" // Optional: Localize names in the response
50
59
  });
51
60
 
52
61
  // 2. Translate an entire sura (Al-Fatiha in Spanish)
53
62
  const sura = await sdk.quranenc.translationSura("spanish_montada_eu", 1);
54
63
 
55
- // 3. Get the audio MP3 file details for a specific verse
64
+ // 3. Translate a specific verse (Ayah 1 of Sura 1)
65
+ const aya = await sdk.quranenc.translationAya("spanish_montada_eu", 1, 1);
66
+
67
+ // 4. Get the audio MP3 file details for a specific verse
56
68
  const audio = await sdk.quranenc.ayaAudio("chinese_suliman", 1, 1);
69
+ // Returns: { status: 200, file_url: "...", content_type: "audio/mpeg" }
70
+
71
+ // 5. Submit translation feedback/note (POST request)
72
+ const noteResponse = await sdk.quranenc.addNote({
73
+ sura: 1,
74
+ aya: 1,
75
+ name: "QA Tester",
76
+ email: "qa@example.com",
77
+ note: "Test note from SDK automated test suite",
78
+ translation_key: "spanish_montada_eu",
79
+ source: "sdk_test",
80
+ version: "1.0.0",
81
+ suggested_translation: "Suggested text" // Optional
82
+ });
57
83
  ```
58
84
 
85
+ ---
86
+
59
87
  ### Hadith Source (HadeethEnc API)
60
88
 
89
+ **API Documentation Link:** [HadeethEnc API](https://documenter.getpostman.com/view/5211979/TVev3j7q#intro)
90
+
61
91
  ```typescript
62
92
  // 1. Get available languages in the encyclopedia
63
93
  const languages = await sdk.hadeethenc.languages();
64
94
 
65
- // 2. Get main categories of Hadith in English
66
- const categories = await sdk.hadeethenc.rootCategories("en");
95
+ // 2. Get all categories of Hadith translated in a specific language
96
+ const categories = await sdk.hadeethenc.categories("en");
97
+
98
+ // 3. Get main (root) categories of Hadith in English
99
+ const rootCategories = await sdk.hadeethenc.rootCategories("en");
100
+
101
+ // 4. List Hadiths under a category with pagination
102
+ const hadiths = await sdk.hadeethenc.hadithsList({
103
+ language: "en",
104
+ categoryId: 1, // Optional: Category ID
105
+ page: 1, // Optional: Page number
106
+ perPage: 20 // Optional: Number of items per page
107
+ });
67
108
 
68
- // 3. Get details of a specific Hadith by ID
69
- const hadith = await sdk.hadeethenc.hadithDetails({ id: 2962, language: "ar" });
109
+ // 5. Get full explanation, translations, and grade of a specific Hadith by ID
110
+ const hadith = await sdk.hadeethenc.hadithDetails({
111
+ id: 2962,
112
+ language: "ar"
113
+ });
70
114
  ```
71
115
 
116
+ ---
117
+
72
118
  ### IslamHouse Source (IslamHouse v3 API)
73
119
 
120
+ **API Documentation Link:** [IslamHouse API Docs](https://documenter.getpostman.com/view/7929737/TzkyMfPc)
121
+
74
122
  ```typescript
75
- // 1. Core material categories (videos, books, etc.)
76
- const content = await sdk.islamhouse.categoriesAndTypes.allTypes("ar", "ar");
123
+ // ==========================================
124
+ // 1. Categories & Types (categoriesAndTypes)
125
+ // ==========================================
77
126
 
78
- // 2. Complete categories tree for materials
127
+ // Core material types (videos, books, fatwas, etc.)
128
+ const types = await sdk.islamhouse.categoriesAndTypes.allTypes("ar", "ar"); // siteLang, contentLang
129
+
130
+ // Get all categories in the database
131
+ const allCategories = await sdk.islamhouse.categoriesAndTypes.allCategories("ar");
132
+
133
+ // Complete category hierarchy tree
79
134
  const tree = await sdk.islamhouse.categoriesAndTypes.categoriesTree("ar");
80
135
 
81
- // 3. List of sources and authors
82
- const authors = await sdk.islamhouse.authors.list({ page: 1, perPage: 10 });
136
+ // Subcategories of a category with content lang localization
137
+ const childCats = await sdk.islamhouse.categoriesAndTypes.childCategories(1, "ar", "ar"); // categoryId, siteLang, contentLang
138
+
139
+ // Basic details of a category by ID
140
+ const singleCategory = await sdk.islamhouse.categoriesAndTypes.singleCategoryBasic(1, "ar");
141
+
142
+ // Subcategories with nested children
143
+ const subCategories = await sdk.islamhouse.categoriesAndTypes.subCategories(1, "ar");
144
+
145
+ // Available material types under a specific category ID
146
+ const categoryTypes = await sdk.islamhouse.categoriesAndTypes.categoryTypes(1, "ar", "ar");
147
+
148
+ // Available languages for materials within a category ID
149
+ const categoryLangs = await sdk.islamhouse.categoriesAndTypes.categoryLanguages(1, "ar", "ar"); // id, slang, language
150
+
151
+ // ==========================================
152
+ // 2. Items Listings (items)
153
+ // ==========================================
154
+
155
+ // List materials by type (e.g. "books", "videos", "audios") and language
156
+ const items = await sdk.islamhouse.items.listItems("books", "ar", "ar", 1, 25); // type, siteLang, slang, page, limit
157
+
158
+ // List materials published by a specific author ID
159
+ const authorItems = await sdk.islamhouse.items.authorItems(1, "ar", "ar", "ar", 1, 20); // authorId, slang, siteLang, contentLang, page, limit
160
+
161
+ // List materials categorized under a category ID
162
+ const catItems = await sdk.islamhouse.items.categoryItems(1, "ar", "ar", "ar", 1, 20); // categoryId, slang, siteLang, contentLang, page, limit
83
163
 
84
- // 4. View all categories
85
- const categories = await sdk.islamhouse.categoriesAndTypes.allCategories("ar");
164
+ // List latest items by period (e.g., "week", "month")
165
+ const latestItems = await sdk.islamhouse.items.latestItems("week", "ar", "ar", "ar", 1, 25); // period, slang, siteLang, contentLang, page, limit
86
166
 
87
- // 5. User interface localization terms for different languages
167
+ // Highlighted featured items on the homepage
168
+ const highlights = await sdk.islamhouse.items.highlightedItems("ar", "ar"); // siteLang, contentLang
169
+
170
+ // Get the total count of items available for a specific type
171
+ const itemsCount = await sdk.islamhouse.items.itemsCount("books", "ar", "ar"); // type, siteLang, contentLang
172
+
173
+ // ==========================================
174
+ // 3. Single Item Details (item)
175
+ // ==========================================
176
+
177
+ // Details, metadata, and description of a single item
178
+ const itemDetails = await sdk.islamhouse.item.details(228065, "ar");
179
+
180
+ // List downloadable media/PDF attachments for an item
181
+ const attachments = await sdk.islamhouse.item.attachments(228065);
182
+
183
+ // Category tree path leading to this item
184
+ const itemTree = await sdk.islamhouse.item.tree(228065, "ar");
185
+
186
+ // Translation card details of the item
187
+ const itemCardTrans = await sdk.islamhouse.item.cardTranslations(228065, "ar");
188
+
189
+ // Other translation languages available for this item
190
+ const translations = await sdk.islamhouse.item.translations(228065, "ar");
191
+
192
+ // ==========================================
193
+ // 4. Authors and Publishers (authors)
194
+ // ==========================================
195
+
196
+ // List authors/sources with filter and sort parameters
197
+ const authors = await sdk.islamhouse.authors.list({
198
+ kind: "author", // Optional: "showall" | "author" | "source"
199
+ locale: "ar", // Optional: "showall" | language code
200
+ sort: "countdesc", // Optional
201
+ page: 1, // Optional
202
+ perPage: 10 // Optional
203
+ });
204
+
205
+ // Specific author details by ID
206
+ const authorDetails = await sdk.islamhouse.authors.details(1, "ar");
207
+
208
+ // Translation card details of an author
209
+ const authorCard = await sdk.islamhouse.authors.cardTranslations(1, "ar");
210
+
211
+ // Material types available for an author
212
+ const authorTypes = await sdk.islamhouse.authors.availableTypes(1, "ar", "ar");
213
+
214
+ // Languages available for an author
215
+ const authorLangs = await sdk.islamhouse.authors.availableLocales(1, "ar", "ar");
216
+
217
+ // ==========================================
218
+ // 5. Languages & Terms (languages)
219
+ // ==========================================
220
+
221
+ // Details of all supported languages on the platform
222
+ const langKeys = await sdk.islamhouse.languages.keys();
223
+
224
+ // Interface translation terms for localization
88
225
  const terms = await sdk.islamhouse.languages.terms("ar");
89
226
 
90
- // 6. Details of a specific Quran recitation by ID
227
+ // Available languages relative to another
228
+ const availLangs = await sdk.islamhouse.languages.availableLanguages("ar", "ar");
229
+
230
+ // ==========================================
231
+ // 6. Holy Quran Recitations (quran)
232
+ // ==========================================
233
+
234
+ // Quran recitation categories (reciters, sections)
235
+ const quranCategories = await sdk.islamhouse.quran.categories("ar");
236
+
237
+ // Basic details of a Quran category
238
+ const quranCategory = await sdk.islamhouse.quran.singleCategory(1, "ar");
239
+
240
+ // Details about a specific reciter
241
+ const reciterDetails = await sdk.islamhouse.quran.authorDetails(1, "ar");
242
+
243
+ // Recitations list of a specific reciter
244
+ const recitations = await sdk.islamhouse.quran.authorRecitations(1, "ar");
245
+
246
+ // Detailed info of a specific Quran Surah
247
+ const suraDetails = await sdk.islamhouse.quran.suraDetails(1, "ar");
248
+
249
+ // Audio recordings of a specific Surah by various reciters
250
+ const suraRecitations = await sdk.islamhouse.quran.suraRecitations(1, "ar");
251
+
252
+ // Details of a specific Quran recitation by ID
91
253
  const recitation = await sdk.islamhouse.quran.recitationDetails(228065, "ar");
92
254
  ```
93
255
 
256
+ ---
257
+
94
258
  ### Risalat Al-Haramain Source (Risalat Al-Haramain API)
95
259
 
260
+ **API Documentation Link:** [Risalat Al-Haramain API](https://risala.prh.gov.sa/en/Api/content)
261
+
96
262
  ```typescript
97
- // 1. Get available languages
98
- const risalaLangs = await sdk.risalatAlHaramain.lookups.languages();
263
+ // ==========================================
264
+ // 1. Platform Contents (contents)
265
+ // ==========================================
99
266
 
100
- // 2. Get full content of the platform in a specific language
267
+ // Get full content of the platform in a specific language
101
268
  const fullContents = await sdk.risalatAlHaramain.contents.getFullContents({
102
- lang: "en",
269
+ language: "en", // Optional: URL language path (default: "en")
270
+ lang: "en" // Optional: Query parameter language (default: "en")
271
+ });
272
+
273
+ // Retrieve contents with optional parameters
274
+ const contents = await sdk.risalatAlHaramain.contents.getContents({
275
+ language: "en",
276
+ lang: "en"
277
+ });
278
+
279
+ // Get detailed content of a single item
280
+ const singleContent = await sdk.risalatAlHaramain.contents.singleContent(1, "en");
281
+
282
+ // Quick search items by name
283
+ const nameSearchResult = await sdk.risalatAlHaramain.contents.nameSearch("حصن", "ar");
284
+
285
+ // Check available translation languages for an item
286
+ const risalaAvailLangs = await sdk.risalatAlHaramain.contents.availableLanguages(1, "ar");
287
+
288
+ // Get translation of a content item into a target language
289
+ const contentTranslation = await sdk.risalatAlHaramain.contents.contentTranslation(1, "en", "ar"); // id, targetLanguage, language
290
+
291
+ // ==========================================
292
+ // 2. Islamic Content Modules (islamicContent)
293
+ // ==========================================
294
+
295
+ // Get Fatwas
296
+ const fatwas = await sdk.risalatAlHaramain.islamicContent.fatwas({
297
+ language: "en", // Optional
298
+ lang: "ar", // Optional
299
+ isFeatured: 1 // Optional: 0 or 1
103
300
  });
104
301
 
105
- // 3. Get featured Holy Quran content
302
+ // Get featured Hadiths
303
+ const hadeeths = await sdk.risalatAlHaramain.islamicContent.hadeeths({
304
+ language: "en",
305
+ lang: "ar",
306
+ isFeatured: 1
307
+ });
308
+
309
+ // Get featured Quran recitations
106
310
  const quranContent = await sdk.risalatAlHaramain.islamicContent.quran({
311
+ language: "en",
107
312
  lang: "ar",
313
+ isFeatured: 1
108
314
  });
109
315
 
110
- // 4. Text search in content
111
- const searchResult = await sdk.risalatAlHaramain.search.contents("حصن");
316
+ // ==========================================
317
+ // 3. Platform Search (search)
318
+ // ==========================================
319
+
320
+ // Keyword text search across platform content
321
+ const searchResult = await sdk.risalatAlHaramain.search.contents("حصن", "en");
322
+
323
+ // ==========================================
324
+ // 4. Lookups & Meta (lookups)
325
+ // ==========================================
326
+
327
+ // Get available languages
328
+ const risalaLangs = await sdk.risalatAlHaramain.lookups.languages("en");
329
+
330
+ // Get available content types
331
+ const contentTypes = await sdk.risalatAlHaramain.lookups.contentTypes("en");
112
332
  ```
113
333
 
334
+ ---
335
+
114
336
  ### Bayan Al Islam Source (Bayan Al Islam API)
115
337
 
338
+ **Postman Resources:** [Collection](https://byenah.com/download-request?name=Bayan%20Al%20Islam.postman_collection.json) | [Environment](https://byenah.com/download-request?name=Bayan%20al%20islam%20env.postman_environment.json)
339
+
116
340
  ```typescript
117
341
  // 1. Get list of available languages
118
- const bayanLangs = await sdk.bayanAlIslam.languagesList();
342
+ const bayanLangs = await sdk.bayanAlIslam.languagesList("ar");
119
343
 
120
- // 2. Get content list for Muslims
344
+ // 2. Get content list tailored for Muslims
121
345
  const muslimList = await sdk.bayanAlIslam.muslimList("en");
122
346
 
123
- // 3. Get content list for non-Muslims
347
+ // 3. Get content list tailored for Non-Muslims
124
348
  const nonMuslimList = await sdk.bayanAlIslam.nonMuslimList("en");
125
349
 
126
350
  // 4. Get details of a specific content item by ID
127
- const contentDetails = await sdk.bayanAlIslam.singleContent(22184);
351
+ const contentDetails = await sdk.bayanAlIslam.singleContent(22184, "en");
128
352
 
129
- // 5. Get recent additions
353
+ // 5. Get languages list paginated and filtered by name
354
+ const paginatedLangs = await sdk.bayanAlIslam.paginatedLanguages({
355
+ name: "English", // Optional
356
+ page: 1, // Optional
357
+ language: "en" // Optional
358
+ });
359
+
360
+ // 6. Get recent contents (Muslim/Non-Muslim updates)
130
361
  const recent = await sdk.bayanAlIslam.recentContents({
131
362
  lang: "ar",
132
363
  init: true,
364
+ ids: [22184], // Optional: content IDs list
365
+ language: "en" // Optional
133
366
  });
367
+
368
+ // 7. Get website lookup variables
369
+ const lookups = await sdk.bayanAlIslam.lookups("en");
370
+
371
+ // 8. Search materials by title/name
372
+ const searchResult = await sdk.bayanAlIslam.nameSearch("حصن", "ar");
373
+
374
+ // 9. Check available translation languages for a content ID
375
+ const availLangs = await sdk.bayanAlIslam.availableLanguages(22184, "ar");
376
+
377
+ // 10. Get specific translation of a content item
378
+ const translation = await sdk.bayanAlIslam.contentTranslation(22184, "en", "ar"); // id, targetLanguage, language
379
+
380
+ // 11. Get translations for media or PDF attachments of a content item
381
+ const attachmentsTrans = await sdk.bayanAlIslam.attachmentsTranslation(22184, "en", "ar"); // id, targetLanguage, language
134
382
  ```
135
383
 
384
+ ---
385
+
136
386
  ### Al Montaka Source (Al Montaka API)
137
387
 
138
- ```typescript
139
- // 1. Get available languages
140
- const languages = await sdk.alMontaka.lookups.languages();
388
+ **API Documentation Link:** [Al Montaka API](https://documenter.getpostman.com/view/5211979/2s8YzMZ6Fu)
141
389
 
142
- // 2. Get target age groups
143
- const ageGroups = await sdk.alMontaka.lookups.ageGroups();
390
+ ```typescript
391
+ // ==========================================
392
+ // 1. Content and Comments (contents)
393
+ // ==========================================
144
394
 
145
- // 3. Get comments for a specific content ID
395
+ // Get all comments for a specific content ID
146
396
  const comments = await sdk.alMontaka.contents.comments(1);
147
397
 
148
- // 4. Add a new comment to a specific content
398
+ // Add a new comment to a specific content item
149
399
  const newComment = await sdk.alMontaka.contents.addComment(1, "Test comment");
150
400
 
151
- // 5. Get filtered content by category IDs
401
+ // Get filtered content by category IDs
152
402
  const filteredContent = await sdk.alMontaka.contents.content([1, 2]);
403
+
404
+ // ==========================================
405
+ // 2. Site Lookups and Filters (lookups)
406
+ // ==========================================
407
+
408
+ // Get target age groups
409
+ const ageGroups = await sdk.alMontaka.lookups.ageGroups();
410
+
411
+ // Get categories matching language and name filter
412
+ const categories = await sdk.alMontaka.lookups.categories({
413
+ languageId: 1,
414
+ nameCont: "General"
415
+ });
416
+
417
+ // Get publishing entities matching language and name filter
418
+ const entities = await sdk.alMontaka.lookups.entities({
419
+ languageId: 1,
420
+ nameCont: "Dar"
421
+ });
422
+
423
+ // Get expertise/scientific levels matching filter
424
+ const expertLevels = await sdk.alMontaka.lookups.expertLevels({
425
+ languageId: 1,
426
+ nameCont: "Level"
427
+ });
428
+
429
+ // Get ideologies matching filter
430
+ const ideologies = await sdk.alMontaka.lookups.ideologies({
431
+ languageId: 1,
432
+ nameCont: "Sunnah",
433
+ parentId: 0
434
+ });
435
+
436
+ // Get available languages
437
+ const languages = await sdk.alMontaka.lookups.languages();
438
+
439
+ // Get/search scholars, narrators, or personalities
440
+ const persons = await sdk.alMontaka.lookups.persons({
441
+ nameCont: "Muhammad", // Optional
442
+ page: 1 // Optional
443
+ });
444
+
445
+ // Get website sections matching filter
446
+ const sections = await sdk.alMontaka.lookups.sections({
447
+ languageId: 1,
448
+ nameCont: "Section"
449
+ });
450
+
451
+ // Get tags matching filter
452
+ const tags = await sdk.alMontaka.lookups.tags({
453
+ languageId: 1,
454
+ nameCont: "Tag"
455
+ });
456
+
457
+ // Get targeted groups of audience
458
+ const targetedGroups = await sdk.alMontaka.lookups.targetedGroups();
459
+
460
+ // Get integrated YouTube channels list
461
+ const youtubeChannels = await sdk.alMontaka.lookups.youtubeChannels();
153
462
  ```
154
463
 
155
464
  ---
@@ -157,7 +466,8 @@ const filteredContent = await sdk.alMontaka.contents.content([1, 2]);
157
466
  ## Donation & Support
158
467
 
159
468
  You can support the projects and efforts of The Association for Multi-lingual Islamic Content through the following official channels:
160
- * [Support Projects (Wakfy)](https://islamiccontent.org/Wakfy)
161
- * [Bank Accounts](https://islamiccontent.org/Accounts)
162
- * [Association Store](https://store.islamiccontent.sa/)
163
469
 
470
+ - [Support Projects (Wakfy)](https://islamiccontent.org/Wakfy)
471
+ - [Bank Accounts](https://islamiccontent.org/Accounts)
472
+ - [Association Store](https://store.islamiccontent.sa/)
473
+ - [Annual Operational Support (الدعم التشغيلي السنوي للجمعية)](https://store.islamiccontent.sa/%D8%A7%D9%84%D9%85%D8%B5%D8%B1%D9%8وفات-%D8%A7%D9%84%D8%AA%D8%B4%D8%BA%D9%8A%D9%84%D9%8A%D8%A9-%D8%A7%D9%84%D8%B3%D9%86%D9%88%D9%8A%D8%A9-%D9%84%D9%84%D8%AC%D9%85%D8%B9%D9%8A-%D8%A9/p1950956689)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "islamic-content-sdk",
3
- "version": "1.0.1",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",