islamic-content-sdk 1.0.2 → 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 +347 -39
  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
 
@@ -41,116 +41,424 @@ import { IslamicContentSdk } from "islamic-content-sdk";
41
41
  const sdk = new IslamicContentSdk();
42
42
  ```
43
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
+
44
50
  ### Quran Source (QuranEnc API)
45
51
 
52
+ **API Documentation Link:** [QuranEnc API](https://quranenc.com/en/home/api/)
53
+
46
54
  ```typescript
47
- // 1. Get available translations
55
+ // 1. Get available translations list on the platform
48
56
  const translations = await sdk.quranenc.translationList({
49
- language: "es",
50
- localization: "ar",
57
+ language: "es", // Optional: Filter list by language code
58
+ localization: "ar" // Optional: Localize names in the response
51
59
  });
52
60
 
53
61
  // 2. Translate an entire sura (Al-Fatiha in Spanish)
54
62
  const sura = await sdk.quranenc.translationSura("spanish_montada_eu", 1);
55
63
 
56
- // 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
57
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
+ });
58
83
  ```
59
84
 
85
+ ---
86
+
60
87
  ### Hadith Source (HadeethEnc API)
61
88
 
89
+ **API Documentation Link:** [HadeethEnc API](https://documenter.getpostman.com/view/5211979/TVev3j7q#intro)
90
+
62
91
  ```typescript
63
92
  // 1. Get available languages in the encyclopedia
64
93
  const languages = await sdk.hadeethenc.languages();
65
94
 
66
- // 2. Get main categories of Hadith in English
67
- 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");
68
100
 
69
- // 3. Get details of a specific Hadith by ID
70
- const hadith = await sdk.hadeethenc.hadithDetails({ id: 2962, language: "ar" });
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
+ });
108
+
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
+ });
71
114
  ```
72
115
 
116
+ ---
117
+
73
118
  ### IslamHouse Source (IslamHouse v3 API)
74
119
 
120
+ **API Documentation Link:** [IslamHouse API Docs](https://documenter.getpostman.com/view/7929737/TzkyMfPc)
121
+
75
122
  ```typescript
76
- // 1. Core material categories (videos, books, etc.)
77
- const content = await sdk.islamhouse.categoriesAndTypes.allTypes("ar", "ar");
123
+ // ==========================================
124
+ // 1. Categories & Types (categoriesAndTypes)
125
+ // ==========================================
126
+
127
+ // Core material types (videos, books, fatwas, etc.)
128
+ const types = await sdk.islamhouse.categoriesAndTypes.allTypes("ar", "ar"); // siteLang, contentLang
78
129
 
79
- // 2. Complete categories tree for materials
130
+ // Get all categories in the database
131
+ const allCategories = await sdk.islamhouse.categoriesAndTypes.allCategories("ar");
132
+
133
+ // Complete category hierarchy tree
80
134
  const tree = await sdk.islamhouse.categoriesAndTypes.categoriesTree("ar");
81
135
 
82
- // 3. List of sources and authors
83
- 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
84
163
 
85
- // 4. View all categories
86
- 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
87
166
 
88
- // 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
89
225
  const terms = await sdk.islamhouse.languages.terms("ar");
90
226
 
91
- // 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
92
253
  const recitation = await sdk.islamhouse.quran.recitationDetails(228065, "ar");
93
254
  ```
94
255
 
256
+ ---
257
+
95
258
  ### Risalat Al-Haramain Source (Risalat Al-Haramain API)
96
259
 
260
+ **API Documentation Link:** [Risalat Al-Haramain API](https://risala.prh.gov.sa/en/Api/content)
261
+
97
262
  ```typescript
98
- // 1. Get available languages
99
- const risalaLangs = await sdk.risalatAlHaramain.lookups.languages();
263
+ // ==========================================
264
+ // 1. Platform Contents (contents)
265
+ // ==========================================
100
266
 
101
- // 2. Get full content of the platform in a specific language
267
+ // Get full content of the platform in a specific language
102
268
  const fullContents = await sdk.risalatAlHaramain.contents.getFullContents({
103
- 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
104
300
  });
105
301
 
106
- // 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
107
310
  const quranContent = await sdk.risalatAlHaramain.islamicContent.quran({
311
+ language: "en",
108
312
  lang: "ar",
313
+ isFeatured: 1
109
314
  });
110
315
 
111
- // 4. Text search in content
112
- 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");
113
332
  ```
114
333
 
334
+ ---
335
+
115
336
  ### Bayan Al Islam Source (Bayan Al Islam API)
116
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
+
117
340
  ```typescript
118
341
  // 1. Get list of available languages
119
- const bayanLangs = await sdk.bayanAlIslam.languagesList();
342
+ const bayanLangs = await sdk.bayanAlIslam.languagesList("ar");
120
343
 
121
- // 2. Get content list for Muslims
344
+ // 2. Get content list tailored for Muslims
122
345
  const muslimList = await sdk.bayanAlIslam.muslimList("en");
123
346
 
124
- // 3. Get content list for non-Muslims
347
+ // 3. Get content list tailored for Non-Muslims
125
348
  const nonMuslimList = await sdk.bayanAlIslam.nonMuslimList("en");
126
349
 
127
350
  // 4. Get details of a specific content item by ID
128
- const contentDetails = await sdk.bayanAlIslam.singleContent(22184);
351
+ const contentDetails = await sdk.bayanAlIslam.singleContent(22184, "en");
129
352
 
130
- // 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)
131
361
  const recent = await sdk.bayanAlIslam.recentContents({
132
362
  lang: "ar",
133
363
  init: true,
364
+ ids: [22184], // Optional: content IDs list
365
+ language: "en" // Optional
134
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
135
382
  ```
136
383
 
384
+ ---
385
+
137
386
  ### Al Montaka Source (Al Montaka API)
138
387
 
139
- ```typescript
140
- // 1. Get available languages
141
- const languages = await sdk.alMontaka.lookups.languages();
388
+ **API Documentation Link:** [Al Montaka API](https://documenter.getpostman.com/view/5211979/2s8YzMZ6Fu)
142
389
 
143
- // 2. Get target age groups
144
- const ageGroups = await sdk.alMontaka.lookups.ageGroups();
390
+ ```typescript
391
+ // ==========================================
392
+ // 1. Content and Comments (contents)
393
+ // ==========================================
145
394
 
146
- // 3. Get comments for a specific content ID
395
+ // Get all comments for a specific content ID
147
396
  const comments = await sdk.alMontaka.contents.comments(1);
148
397
 
149
- // 4. Add a new comment to a specific content
398
+ // Add a new comment to a specific content item
150
399
  const newComment = await sdk.alMontaka.contents.addComment(1, "Test comment");
151
400
 
152
- // 5. Get filtered content by category IDs
401
+ // Get filtered content by category IDs
153
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();
154
462
  ```
155
463
 
156
464
  ---
@@ -162,4 +470,4 @@ You can support the projects and efforts of The Association for Multi-lingual Is
162
470
  - [Support Projects (Wakfy)](https://islamiccontent.org/Wakfy)
163
471
  - [Bank Accounts](https://islamiccontent.org/Accounts)
164
472
  - [Association Store](https://store.islamiccontent.sa/)
165
- - [Annual Operational Support (الدعم التشغيلي السنوي للجمعية)](https://store.islamiccontent.sa/%D8%A7%D9%84%D9%85%D8%B5%D8%B1%D9%88%D9%81%D8%A7%D8%AA-%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)
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.2",
3
+ "version": "1.0.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "module": "dist/index.mjs",