Skip to content

Commit 58fd19f

Browse files
committed
feat: fix jsdoc stuff and rename some types
1 parent 32d0a60 commit 58fd19f

File tree

4 files changed

+60
-60
lines changed

4 files changed

+60
-60
lines changed

src/sdk/v4/audio.ts

Lines changed: 22 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -15,33 +15,33 @@ import { decamelize } from 'humps';
1515
import Utils from '../utils';
1616
import { fetcher } from './_fetcher';
1717

18-
type GetChapterRecitationsOptions = Partial<{
18+
type GetChapterRecitationOptions = Partial<{
1919
language: Language;
2020
}>;
2121

22-
const defaultChapterRecitationsOptions: GetChapterRecitationsOptions = {
22+
const defaultChapterRecitationsOptions: GetChapterRecitationOptions = {
2323
language: Language.ARABIC,
2424
};
2525

2626
const getChapterRecitationsOptions = (
27-
options: GetChapterRecitationsOptions = {}
27+
options: GetChapterRecitationOptions = {}
2828
) => {
2929
const final: any = { ...defaultChapterRecitationsOptions, ...options };
3030

3131
return final;
3232
};
3333

34-
type GetVerseRecitationsOptions = Partial<{
34+
type GetVerseRecitationOptions = Partial<{
3535
language: Language;
3636
fields: Partial<Record<VerseRecitationField, boolean>>;
3737
}>;
3838

39-
const defaultVerseRecitationsOptions: GetVerseRecitationsOptions = {
39+
const defaultVerseRecitationsOptions: GetVerseRecitationOptions = {
4040
language: Language.ARABIC,
4141
};
4242

4343
const getVerseRecitationsOptions = (
44-
options: GetVerseRecitationsOptions = {}
44+
options: GetVerseRecitationOptions = {}
4545
) => {
4646
const initial = { ...defaultVerseRecitationsOptions, ...options };
4747
const final: any = { language: initial.language };
@@ -61,13 +61,13 @@ const getVerseRecitationsOptions = (
6161
* Get all chapter recitations for specific reciter
6262
* @description https://quran.api-docs.io/v4/audio-recitations/list-of-all-surah-audio-files-for-specific-reciter
6363
* @param {string} reciterId
64-
* @param {GetChapterRecitationsOptions} options
64+
* @param {GetChapterRecitationOptions} options
6565
* @example
6666
* quran.v4.audio.findAllChapterRecitations('2')
6767
*/
6868
const findAllChapterRecitations = async (
6969
reciterId: string,
70-
options?: GetChapterRecitationsOptions
70+
options?: GetChapterRecitationOptions
7171
) => {
7272
const params = getChapterRecitationsOptions(options);
7373
const { audioFiles } = await fetcher<{ audioFiles: ChapterRecitation[] }>(
@@ -82,14 +82,14 @@ const findAllChapterRecitations = async (
8282
* @description https://quran.api-docs.io/v4/audio-recitations/get-single-surah-audio-for-specific-reciter
8383
* @param {ChapterId} chapterId
8484
* @param {string} reciterId
85-
* @param {GetChapterRecitationsOptions} options
85+
* @param {GetChapterRecitationOptions} options
8686
* @example
8787
* quran.v4.audio.findChapterRecitationById('1', '2') // first chapter recitation for reciter 2
8888
*/
8989
const findChapterRecitationById = async (
9090
chapterId: ChapterId,
9191
reciterId: string,
92-
options?: GetChapterRecitationsOptions
92+
options?: GetChapterRecitationOptions
9393
) => {
9494
if (!Utils.isValidChapterId(chapterId)) throw new Error('Invalid chapter id');
9595

@@ -107,14 +107,14 @@ const findChapterRecitationById = async (
107107
* @description https://quran.api-docs.io/v4/audio-recitations/get-ayah-recitations-for-specific-surah
108108
* @param {ChapterId} chapterId
109109
* @param {string} recitationId
110-
* @param {GetVerseRecitationsOptions} options
110+
* @param {GetVerseRecitationOptions} options
111111
* @example
112112
* quran.v4.audio.findVerseRecitationsByChapter('1', '2')
113113
*/
114114
const findVerseRecitationsByChapter = async (
115115
chapterId: ChapterId,
116116
recitationId: string,
117-
options?: GetVerseRecitationsOptions
117+
options?: GetVerseRecitationOptions
118118
) => {
119119
if (!Utils.isValidChapterId(chapterId)) throw new Error('Invalid chapter id');
120120

@@ -139,7 +139,7 @@ const findVerseRecitationsByChapter = async (
139139
const findVerseRecitationsByJuz = async (
140140
juz: JuzNumber,
141141
recitationId: string,
142-
options?: GetVerseRecitationsOptions
142+
options?: GetVerseRecitationOptions
143143
) => {
144144
if (!Utils.isValidJuz(juz)) throw new Error('Invalid juz');
145145

@@ -157,14 +157,14 @@ const findVerseRecitationsByJuz = async (
157157
* @description https://quran.api-docs.io/v4/audio-recitations/get-ayah-recitations-for-specific-madani-mushaf-page
158158
* @param {PageNumber} page
159159
* @param {string} recitationId
160-
* @param {GetVerseRecitationsOptions} options
160+
* @param {GetVerseRecitationOptions} options
161161
* @example
162162
* quran.v4.audio.findVerseRecitationsByPage('1', '2')
163163
*/
164164
const findVerseRecitationsByPage = async (
165165
page: PageNumber,
166166
recitationId: string,
167-
options?: GetVerseRecitationsOptions
167+
options?: GetVerseRecitationOptions
168168
) => {
169169
if (!Utils.isValidQuranPage(page)) throw new Error('Invalid page');
170170

@@ -182,14 +182,14 @@ const findVerseRecitationsByPage = async (
182182
* @description https://quran.api-docs.io/v4/audio-recitations/get-ayah-recitations-for-specific-rub
183183
* @param {RubNumber} rub
184184
* @param {string} recitationId
185-
* @param {GetVerseRecitationsOptions} options
185+
* @param {GetVerseRecitationOptions} options
186186
* @example
187187
* quran.v4.audio.findVerseRecitationsByRub('1', '2')
188188
*/
189189
const findVerseRecitationsByRub = async (
190190
rub: RubNumber,
191191
recitationId: string,
192-
options?: GetVerseRecitationsOptions
192+
options?: GetVerseRecitationOptions
193193
) => {
194194
if (!Utils.isValidRub(rub)) throw new Error('Invalid rub');
195195

@@ -207,14 +207,14 @@ const findVerseRecitationsByRub = async (
207207
* @description https://quran.api-docs.io/v4/audio-recitations/get-ayah-recitations-for-specific-hizb
208208
* @param {HizbNumber} hizb
209209
* @param {string} recitationId
210-
* @param {GetVerseRecitationsOptions} options
210+
* @param {GetVerseRecitationOptions} options
211211
* @example
212212
* quran.v4.audio.findVerseRecitationsByHizb('1', '2')
213213
*/
214214
const findVerseRecitationsByHizb = async (
215215
hizb: HizbNumber,
216216
recitationId: string,
217-
options?: GetVerseRecitationsOptions
217+
options?: GetVerseRecitationOptions
218218
) => {
219219
if (!Utils.isValidHizb(hizb)) throw new Error('Invalid hizb');
220220

@@ -228,18 +228,18 @@ const findVerseRecitationsByHizb = async (
228228
};
229229

230230
/**
231-
* Get all verse audio files for a specific reciter and a specific hizb
231+
* Get all verse audio files for a specific reciter and a specific verse
232232
* @description https://quran.api-docs.io/v4/audio-recitations/get-ayah-recitations-for-specific-ayah
233233
* @param {VerseKey} key
234234
* @param {string} recitationId
235-
* @param {GetVerseRecitationsOptions} options
235+
* @param {GetVerseRecitationOptions} options
236236
* @example
237237
* quran.v4.audio.findVerseRecitationsByKey('1:1', '2')
238238
*/
239239
const findVerseRecitationsByKey = async (
240240
key: VerseKey,
241241
recitationId: string,
242-
options?: GetVerseRecitationsOptions
242+
options?: GetVerseRecitationOptions
243243
) => {
244244
if (!Utils.isValidVerseKey(key)) throw new Error('Invalid verse key');
245245

src/sdk/v4/chapters.ts

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -2,27 +2,27 @@ import { Chapter, ChapterId, ChapterInfo, Language } from '../../types';
22
import { fetcher } from './_fetcher';
33
import Utils from '../utils';
44

5-
type Options = Partial<{
5+
type GetChapterOptions = Partial<{
66
language: Language;
77
}>;
88

9-
const defaultOptions: Options = {
9+
const defaultOptions: GetChapterOptions = {
1010
language: Language.ARABIC,
1111
};
1212

13-
const getChapterOptions = (options: Options = {}) => {
13+
const getChapterOptions = (options: GetChapterOptions = {}) => {
1414
const final: any = { ...defaultOptions, ...options };
1515
return final;
1616
};
1717

1818
/**
1919
* Get all chapters.
2020
* @description https://quran.api-docs.io/v4/chapters/list-chapters
21-
* @param {Options} options
21+
* @param {GetChapterOptions} options
2222
* @example
2323
* quran.v4.chapters.findAll()
2424
*/
25-
const findAll = async (options?: Options) => {
25+
const findAll = async (options?: GetChapterOptions) => {
2626
const params = getChapterOptions(options);
2727
const { chapters } = await fetcher<{ chapters: Chapter[] }>(
2828
'/chapters',
@@ -36,12 +36,12 @@ const findAll = async (options?: Options) => {
3636
* Get chapter by id.
3737
* @description https://quran.api-docs.io/v4/chapters/get-chapter
3838
* @param {ChapterId} id chapter id, minimum 1, maximum 114
39-
* @param {Options} options
39+
* @param {GetChapterOptions} options
4040
* @example
4141
* quran.v4.chapters.findById('1')
4242
* quran.v4.chapters.findById('114')
4343
*/
44-
const findById = async (id: ChapterId, options?: Options) => {
44+
const findById = async (id: ChapterId, options?: GetChapterOptions) => {
4545
if (!Utils.isValidChapterId(id)) throw new Error('Invalid chapter id');
4646

4747
const params = getChapterOptions(options);
@@ -57,12 +57,12 @@ const findById = async (id: ChapterId, options?: Options) => {
5757
* Get chapter info by id.
5858
* @description https://quran.api-docs.io/v4/chapters/chapter_info
5959
* @param {ChapterId} id chapter id, minimum 1, maximum 114
60-
* @param {Options} options
60+
* @param {GetChapterOptions} options
6161
* @example
6262
* quran.v4.chapters.findInfoById('1')
6363
* quran.v4.chapters.findInfoById('114')
6464
*/
65-
const findInfoById = async (id: ChapterId, options?: Options) => {
65+
const findInfoById = async (id: ChapterId, options?: GetChapterOptions) => {
6666
if (!Utils.isValidChapterId(id)) throw new Error('Invalid chapter id');
6767

6868
const params = getChapterOptions(options);

src/sdk/v4/resources.ts

Lines changed: 23 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,27 @@ import {
1414
} from '../../types';
1515
import { fetcher } from './_fetcher';
1616

17-
type GetResourcesOptions = Partial<{
17+
type GetResourceOptions = Partial<{
1818
language: Language;
1919
}>;
2020

21-
const defaultOptions: GetResourcesOptions = {
21+
const defaultOptions: GetResourceOptions = {
2222
language: Language.ARABIC,
2323
};
2424

25-
const getResourcesOptions = (options: GetResourcesOptions = {}) => {
25+
const getResourcesOptions = (options: GetResourceOptions = {}) => {
2626
const final: any = { ...defaultOptions, ...options };
2727
return final;
2828
};
2929

3030
/**
3131
* Get all recitations.
3232
* @description https://quran.api-docs.io/v4/resources/recitations
33-
* @param {GetResourcesOptions} options
33+
* @param {GetResourceOptions} options
3434
* @example
3535
* quran.v4.resources.findAllRecitations()
3636
*/
37-
const findAllRecitations = async (options?: GetResourcesOptions) => {
37+
const findAllRecitations = async (options?: GetResourceOptions) => {
3838
const params = getResourcesOptions(options);
3939
const { recitations } = await fetcher<{
4040
recitations: RecitationResource[];
@@ -48,11 +48,11 @@ const findAllRecitations = async (options?: GetResourcesOptions) => {
4848
* Get all recitation info.
4949
* @description https://quran.api-docs.io/v4/resources/recitation-info
5050
* @param {string} id recitation id
51-
* @param {GetResourcesOptions} options
51+
* @param {GetResourceOptions} options
5252
* @example
5353
* quran.v4.resources.findRecitationInfo('1')
5454
*/
55-
// const findRecitationInfo = async (id: string, options?: GetResourcesOptions) => {
55+
// const findRecitationInfo = async (id: string, options?: GetResourceOptions) => {
5656
// const params = getResourcesOptions(options);
5757
// const { info } = await fetcher<{
5858
// info: RecitationInfoResource;
@@ -64,11 +64,11 @@ const findAllRecitations = async (options?: GetResourcesOptions) => {
6464
/**
6565
* Get all translations.
6666
* @description https://quran.api-docs.io/v4/resources/translations
67-
* @param {GetResourcesOptions} options
67+
* @param {GetResourceOptions} options
6868
* @example
6969
* quran.v4.resources.findAllTranslations()
7070
*/
71-
const findAllTranslations = async (options?: GetResourcesOptions) => {
71+
const findAllTranslations = async (options?: GetResourceOptions) => {
7272
const params = getResourcesOptions(options);
7373
const { translations } = await fetcher<{
7474
translations: TranslationResource[];
@@ -82,11 +82,11 @@ const findAllTranslations = async (options?: GetResourcesOptions) => {
8282
* Get translation info.
8383
* @description https://quran.api-docs.io/v4/resources/translation-info
8484
* @param {string} id translation id
85-
* @param {GetResourcesOptions} options
85+
* @param {GetResourceOptions} options
8686
* @example
8787
* quran.v4.resources.findTranslationInfo('169')
8888
*/
89-
// const findTranslationInfo = async (id: string, options?: GetResourcesOptions) => {
89+
// const findTranslationInfo = async (id: string, options?: GetResourceOptions) => {
9090
// const params = getResourcesOptions(options);
9191
// const { info } = await fetcher<{
9292
// info: TranslationInfoResource;
@@ -98,11 +98,11 @@ const findAllTranslations = async (options?: GetResourcesOptions) => {
9898
/**
9999
* Get all tafsirs.
100100
* @description https://quran.api-docs.io/v4/resources/tafsirs
101-
* @param {GetResourcesOptions} options
101+
* @param {GetResourceOptions} options
102102
* @example
103103
* quran.v4.resources.findAllTafsirs()
104104
*/
105-
const findAllTafsirs = async (options?: GetResourcesOptions) => {
105+
const findAllTafsirs = async (options?: GetResourceOptions) => {
106106
const params = getResourcesOptions(options);
107107
const { tafsirs } = await fetcher<{
108108
tafsirs: TafsirResource[];
@@ -116,11 +116,11 @@ const findAllTafsirs = async (options?: GetResourcesOptions) => {
116116
* Get tafsir info.
117117
* @description https://quran.api-docs.io/v4/resources/tafsirs-info
118118
* @param {string} id tafsir id
119-
* @param {GetResourcesOptions} options
119+
* @param {GetResourceOptions} options
120120
* @example
121121
* quran.v4.resources.findTranslationInfo('1')
122122
*/
123-
// const findTafsirInfo = async (id: string, options?: GetResourcesOptions) => {
123+
// const findTafsirInfo = async (id: string, options?: GetResourceOptions) => {
124124
// const params = getResourcesOptions(options);
125125
// const { info } = await fetcher<{
126126
// info: TafsirInfoResource;
@@ -146,11 +146,11 @@ const findAllRecitationStyles = async () => {
146146
/**
147147
* Get all languages.
148148
* @description https://quran.api-docs.io/v4/resources/languages
149-
* @param {GetResourcesOptions} options
149+
* @param {GetResourceOptions} options
150150
* @example
151151
* quran.v4.resources.findAllLanguages()
152152
*/
153-
const findAllLanguages = async (options?: GetResourcesOptions) => {
153+
const findAllLanguages = async (options?: GetResourceOptions) => {
154154
const params = getResourcesOptions(options);
155155
const { languages } = await fetcher<{
156156
languages: LanguageResource[];
@@ -162,11 +162,11 @@ const findAllLanguages = async (options?: GetResourcesOptions) => {
162162
/**
163163
* Get all chapter infos.
164164
* @description https://quran.api-docs.io/v4/resources/chapter-info
165-
* @param {GetResourcesOptions} options
165+
* @param {GetResourceOptions} options
166166
* @example
167167
* quran.v4.resources.findAllChapterInfos()
168168
*/
169-
const findAllChapterInfos = async (options?: GetResourcesOptions) => {
169+
const findAllChapterInfos = async (options?: GetResourceOptions) => {
170170
const params = getResourcesOptions(options);
171171
const { chapterInfos } = await fetcher<{
172172
chapterInfos: ChapterInfoResource[];
@@ -178,11 +178,11 @@ const findAllChapterInfos = async (options?: GetResourcesOptions) => {
178178
/**
179179
* Get verse media.
180180
* @description https://quran.api-docs.io/v4/resources/verse_media
181-
* @param {GetResourcesOptions} options
181+
* @param {GetResourceOptions} options
182182
* @example
183183
* quran.v4.resources.findVerseMedia()
184184
*/
185-
const findVerseMedia = async (options?: GetResourcesOptions) => {
185+
const findVerseMedia = async (options?: GetResourceOptions) => {
186186
const params = getResourcesOptions(options);
187187
const { verseMedia } = await fetcher<{
188188
verseMedia: VerseMediaResource;
@@ -194,11 +194,11 @@ const findVerseMedia = async (options?: GetResourcesOptions) => {
194194
/**
195195
* Get all chapter reciters.
196196
* @description https://quran.api-docs.io/v4/resources/list-of-chapter-reciters
197-
* @param {GetResourcesOptions} options
197+
* @param {GetResourceOptions} options
198198
* @example
199199
* quran.v4.resources.findAllChapterReciters()
200200
*/
201-
const findAllChapterReciters = async (options?: GetResourcesOptions) => {
201+
const findAllChapterReciters = async (options?: GetResourceOptions) => {
202202
const params = getResourcesOptions(options);
203203
const { reciters } = await fetcher<{
204204
reciters: ChapterReciterResource[];

0 commit comments

Comments
 (0)