Amend examples (#211)

This commit is contained in:
Janos Dobronszki
2021-09-21 16:36:39 +01:00
committed by GitHub
parent 80a253ada5
commit ba6220fd01
61 changed files with 920 additions and 918 deletions

View File

@@ -24,7 +24,6 @@ import * as sentiment from "./sentiment";
import * as sms from "./sms";
import * as stock from "./stock";
import * as stream from "./stream";
import * as sunnah from "./sunnah";
import * as thumbnail from "./thumbnail";
import * as time from "./time";
import * as twitter from "./twitter";
@@ -60,7 +59,6 @@ export class Client {
this.smsService = new sms.SmsService(token);
this.stockService = new stock.StockService(token);
this.streamService = new stream.StreamService(token);
this.sunnahService = new sunnah.SunnahService(token);
this.thumbnailService = new thumbnail.ThumbnailService(token);
this.timeService = new time.TimeService(token);
this.twitterService = new twitter.TwitterService(token);
@@ -95,7 +93,6 @@ export class Client {
smsService: sms.SmsService;
stockService: stock.StockService;
streamService: stream.StreamService;
sunnahService: sunnah.SunnahService;
thumbnailService: thumbnail.ThumbnailService;
timeService: time.TimeService;
twitterService: twitter.TwitterService;

View File

@@ -36,7 +36,6 @@
"./sms": "./dist/sms/index.js",
"./stock": "./dist/stock/index.js",
"./stream": "./dist/stream/index.js",
"./sunnah": "./dist/sunnah/index.js",
"./test": "./dist/test/index.js",
"./thumbnail": "./dist/thumbnail/index.js",
"./time": "./dist/time/index.js",
@@ -59,5 +58,5 @@
},
"type": "module",
"types": "dist/index.d.ts",
"version": "1.0.520"
"version": "1.0.521"
}

View File

@@ -149,7 +149,7 @@ export interface Verse {
// The unique id of the verse in the whole book
id?: number;
// The interpretations of the verse
interpretations?: Translation[];
interpretations?: Interpretation[];
// The key of this verse (chapter:verse) e.g 1:1
key?: string;
// The verse number in this chapter
@@ -161,7 +161,7 @@ export interface Verse {
// The basic translation of the verse
translatedText?: string;
// The alternative translations for the verse
translations?: Translation[];
translations?: Interpretation[];
// The phonetic transliteration from arabic
transliteration?: string;
// The individual words within the verse (Ayah)

View File

@@ -1,183 +0,0 @@
import * as m3o from "@m3o/m3o-node";
export class SunnahService {
private client: m3o.Client;
constructor(token: string) {
this.client = new m3o.Client({ token: token });
}
// Get a list of books from within a collection. A book can contain many chapters
// each with its own hadiths.
books(request: BooksRequest): Promise<BooksResponse> {
return this.client.call(
"sunnah",
"Books",
request
) as Promise<BooksResponse>;
}
// Get all the chapters of a given book within a collection.
chapters(request: ChaptersRequest): Promise<ChaptersResponse> {
return this.client.call(
"sunnah",
"Chapters",
request
) as Promise<ChaptersResponse>;
}
// Get a list of available collections. A collection is
// a compilation of hadiths collected and written by an author.
collections(request: CollectionsRequest): Promise<CollectionsResponse> {
return this.client.call(
"sunnah",
"Collections",
request
) as Promise<CollectionsResponse>;
}
// Hadiths returns a list of hadiths and their corresponding text for a
// given book within a collection.
hadiths(request: HadithsRequest): Promise<HadithsResponse> {
return this.client.call(
"sunnah",
"Hadiths",
request
) as Promise<HadithsResponse>;
}
}
export interface Book {
// arabic name of the book
arabicName?: string;
// number of hadiths in the book
hadiths?: number;
// number of the book e.g 1
id?: number;
// name of the book
name?: string;
}
export interface BooksRequest {
// Name of the collection
collection?: string;
// Limit the number of books returned
limit?: number;
// The page in the pagination
page?: number;
}
export interface BooksResponse {
// A list of books
books?: Book[];
// Name of the collection
collection?: string;
// The limit specified
limit?: number;
// The page requested
page?: number;
// The total overall books
total?: number;
}
export interface Chapter {
// arabic title
arabicTitle?: string;
// the book number
book?: number;
// the chapter id e.g 1
id?: number;
// the chapter key e.g 1.00
key?: string;
// title of the chapter
title?: string;
}
export interface ChaptersRequest {
// number of the book
book?: number;
// name of the collection
collection?: string;
// Limit the number of chapters returned
limit?: number;
// The page in the pagination
page?: number;
}
export interface ChaptersResponse {
// number of the book
book?: number;
// The chapters of the book
chapters?: Chapter[];
// name of the collection
collection?: string;
// Limit the number of chapters returned
limit?: number;
// The page in the pagination
page?: number;
// Total chapters in the book
total?: number;
}
export interface Collection {
// Arabic title if available
arabicTitle?: string;
// Total hadiths in the collection
hadiths?: number;
// Name of the collection e.g bukhari
name?: string;
// An introduction explaining the collection
summary?: string;
// Title of the collection e.g Sahih al-Bukhari
title?: string;
}
export interface CollectionsRequest {
// Number of collections to limit to
limit?: number;
// The page in the pagination
page?: number;
}
export interface CollectionsResponse {
collections?: Collection[];
}
export interface Hadith {
// the arabic chapter title
arabicChapterTitle?: string;
// the arabic text
arabicText?: string;
// the chapter id
chapter?: number;
// the chapter key
chapterKey?: string;
// the chapter title
chapterTitle?: string;
// hadith id
id?: number;
// hadith text
text?: string;
}
export interface HadithsRequest {
// number of the book
book?: number;
// name of the collection
collection?: string;
// Limit the number of hadiths
limit?: number;
// The page in the pagination
page?: number;
}
export interface HadithsResponse {
// number of the book
book?: number;
// name of the collection
collection?: string;
// The hadiths of the book
hadiths?: Hadith[];
// Limit the number of hadiths returned
limit?: number;
// The page in the pagination
page?: number;
// Total hadiths in the book
total?: number;
}