ApiResponses.ts 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. import AudioData from './AudioData';
  2. import AvailableLanguage from './AvailableLanguage';
  3. import AvailableTranslation from './AvailableTranslation';
  4. import AvailableWordByWordTranslation from './AvailableWordByWordTranslation';
  5. import Chapter from './Chapter';
  6. import ChapterInfo from './ChapterInfo';
  7. import Footnote from './Footnote';
  8. import LookupRange from './LookupRange';
  9. import LookupRecord from './LookupRecord';
  10. import MetaData from './MetaData';
  11. import Reciter from './Reciter';
  12. import SearchService from './Search/SearchService';
  13. import { SearchNavigationResult } from './SearchNavigationResult';
  14. import TafsirInfo from './TafsirInfo';
  15. import Verse from './Verse';
  16. export interface BaseResponse {
  17. status?: number;
  18. error?: string;
  19. }
  20. interface Pagination {
  21. perPage: number;
  22. currentPage: number;
  23. nextPage: number | null;
  24. totalRecords: number;
  25. totalPages: number;
  26. }
  27. // The response from the verses endpoint that returns a list of verses
  28. export interface VersesResponse extends BaseResponse {
  29. pagination: Pagination;
  30. verses: Verse[];
  31. metaData?: MetaData;
  32. pagesLookup?: PagesLookUpResponse;
  33. }
  34. // The response from the chapters endpoint that returns a list of the chapters
  35. export interface ChaptersResponse extends BaseResponse {
  36. chapters: Chapter[];
  37. }
  38. export interface VerseResponse extends BaseResponse {
  39. verse: Verse;
  40. }
  41. // The response from the chapter endpoint that returns information on a chapter
  42. export interface ChapterResponse extends BaseResponse {
  43. chapter: Chapter;
  44. }
  45. export interface TranslationsResponse extends BaseResponse {
  46. translations?: AvailableTranslation[];
  47. }
  48. export interface WordByWordTranslationsResponse extends BaseResponse {
  49. wordByWordTranslations?: AvailableWordByWordTranslation[];
  50. }
  51. export interface LanguagesResponse extends BaseResponse {
  52. languages?: AvailableLanguage[];
  53. }
  54. export interface RecitersResponse extends BaseResponse {
  55. reciters?: Reciter[];
  56. }
  57. export interface ReciterResponse extends BaseResponse {
  58. reciter?: Reciter;
  59. }
  60. export interface AudioDataResponse extends BaseResponse {
  61. audioFiles: AudioData[];
  62. }
  63. export interface AudioTimestampsResponse extends BaseResponse {
  64. result: {
  65. timestampFrom: number;
  66. timestampTo: number;
  67. };
  68. }
  69. export interface SearchResponse extends BaseResponse {
  70. service?: SearchService;
  71. pagination: Pagination;
  72. result?: {
  73. navigation: SearchNavigationResult[];
  74. verses: Verse[];
  75. };
  76. }
  77. export interface AdvancedCopyRawResultResponse extends BaseResponse {
  78. result?: string;
  79. }
  80. export interface TafsirsResponse extends BaseResponse {
  81. tafsirs?: TafsirInfo[];
  82. }
  83. export interface ChapterInfoResponse extends BaseResponse {
  84. chapterInfo?: ChapterInfo;
  85. }
  86. export interface FootnoteResponse extends BaseResponse {
  87. footNote?: Footnote;
  88. }
  89. export interface PagesLookUpResponse extends BaseResponse {
  90. lookupRange: LookupRange;
  91. pages?: Record<string, LookupRecord>;
  92. totalPage?: number;
  93. }
  94. export interface TafsirContentResponse extends BaseResponse {
  95. tafsir: {
  96. verses: Record<string, Verse>;
  97. resourceId: number;
  98. resourceName: string;
  99. languageId: number;
  100. translatedName: {
  101. name: string;
  102. languageName: string;
  103. };
  104. text: string;
  105. slug?: string;
  106. };
  107. }