mirror of
https://github.com/kevin-DL/services.git
synced 2026-01-18 13:45:09 +00:00
Commit from GitHub Actions (Publish APIs & Clients)
This commit is contained in:
@@ -27,6 +27,7 @@ import (
|
|||||||
"github.com/micro/services/clients/go/sms"
|
"github.com/micro/services/clients/go/sms"
|
||||||
"github.com/micro/services/clients/go/stock"
|
"github.com/micro/services/clients/go/stock"
|
||||||
"github.com/micro/services/clients/go/stream"
|
"github.com/micro/services/clients/go/stream"
|
||||||
|
"github.com/micro/services/clients/go/sunnah"
|
||||||
"github.com/micro/services/clients/go/thumbnail"
|
"github.com/micro/services/clients/go/thumbnail"
|
||||||
"github.com/micro/services/clients/go/time"
|
"github.com/micro/services/clients/go/time"
|
||||||
"github.com/micro/services/clients/go/twitter"
|
"github.com/micro/services/clients/go/twitter"
|
||||||
@@ -65,6 +66,7 @@ func NewClient(token string) *Client {
|
|||||||
SmsService: sms.NewSmsService(token),
|
SmsService: sms.NewSmsService(token),
|
||||||
StockService: stock.NewStockService(token),
|
StockService: stock.NewStockService(token),
|
||||||
StreamService: stream.NewStreamService(token),
|
StreamService: stream.NewStreamService(token),
|
||||||
|
SunnahService: sunnah.NewSunnahService(token),
|
||||||
ThumbnailService: thumbnail.NewThumbnailService(token),
|
ThumbnailService: thumbnail.NewThumbnailService(token),
|
||||||
TimeService: time.NewTimeService(token),
|
TimeService: time.NewTimeService(token),
|
||||||
TwitterService: twitter.NewTwitterService(token),
|
TwitterService: twitter.NewTwitterService(token),
|
||||||
@@ -103,6 +105,7 @@ type Client struct {
|
|||||||
SmsService *sms.SmsService
|
SmsService *sms.SmsService
|
||||||
StockService *stock.StockService
|
StockService *stock.StockService
|
||||||
StreamService *stream.StreamService
|
StreamService *stream.StreamService
|
||||||
|
SunnahService *sunnah.SunnahService
|
||||||
ThumbnailService *thumbnail.ThumbnailService
|
ThumbnailService *thumbnail.ThumbnailService
|
||||||
TimeService *time.TimeService
|
TimeService *time.TimeService
|
||||||
TwitterService *twitter.TwitterService
|
TwitterService *twitter.TwitterService
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ type Result struct {
|
|||||||
// The associated arabic text
|
// The associated arabic text
|
||||||
Text string `json:"text"`
|
Text string `json:"text"`
|
||||||
// The related translations to the text
|
// The related translations to the text
|
||||||
Translations []Interpretation `json:"translations"`
|
Translations []Translation `json:"translations"`
|
||||||
// The unique verse id across the Quran
|
// The unique verse id across the Quran
|
||||||
VerseId int32 `json:"verseId"`
|
VerseId int32 `json:"verseId"`
|
||||||
// The verse key e.g 1:1
|
// The verse key e.g 1:1
|
||||||
@@ -149,7 +149,7 @@ type Verse struct {
|
|||||||
// The unique id of the verse in the whole book
|
// The unique id of the verse in the whole book
|
||||||
Id int32 `json:"id"`
|
Id int32 `json:"id"`
|
||||||
// The interpretations of the verse
|
// The interpretations of the verse
|
||||||
Interpretations []Interpretation `json:"interpretations"`
|
Interpretations []Translation `json:"interpretations"`
|
||||||
// The key of this verse (chapter:verse) e.g 1:1
|
// The key of this verse (chapter:verse) e.g 1:1
|
||||||
Key string `json:"key"`
|
Key string `json:"key"`
|
||||||
// The verse number in this chapter
|
// The verse number in this chapter
|
||||||
@@ -161,7 +161,7 @@ type Verse struct {
|
|||||||
// The basic translation of the verse
|
// The basic translation of the verse
|
||||||
TranslatedText string `json:"translatedText"`
|
TranslatedText string `json:"translatedText"`
|
||||||
// The alternative translations for the verse
|
// The alternative translations for the verse
|
||||||
Translations []Interpretation `json:"translations"`
|
Translations []Translation `json:"translations"`
|
||||||
// The phonetic transliteration from arabic
|
// The phonetic transliteration from arabic
|
||||||
Transliteration string `json:"transliteration"`
|
Transliteration string `json:"transliteration"`
|
||||||
// The individual words within the verse (Ayah)
|
// The individual words within the verse (Ayah)
|
||||||
|
|||||||
183
clients/go/sunnah/sunnah.go
Executable file
183
clients/go/sunnah/sunnah.go
Executable file
@@ -0,0 +1,183 @@
|
|||||||
|
package sunnah
|
||||||
|
|
||||||
|
import (
|
||||||
|
"github.com/m3o/m3o-go/client"
|
||||||
|
)
|
||||||
|
|
||||||
|
func NewSunnahService(token string) *SunnahService {
|
||||||
|
return &SunnahService{
|
||||||
|
client: client.NewClient(&client.Options{
|
||||||
|
Token: token,
|
||||||
|
}),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
type SunnahService struct {
|
||||||
|
client *client.Client
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get a list of books from within a collection. A book can contain many chapters
|
||||||
|
// each with its own hadiths.
|
||||||
|
func (t *SunnahService) Books(request *BooksRequest) (*BooksResponse, error) {
|
||||||
|
rsp := &BooksResponse{}
|
||||||
|
return rsp, t.client.Call("sunnah", "Books", request, rsp)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get all the chapters of a given book within a collection.
|
||||||
|
func (t *SunnahService) Chapters(request *ChaptersRequest) (*ChaptersResponse, error) {
|
||||||
|
rsp := &ChaptersResponse{}
|
||||||
|
return rsp, t.client.Call("sunnah", "Chapters", request, rsp)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Get a list of available collections. A collection is
|
||||||
|
// a compilation of hadiths collected and written by an author.
|
||||||
|
func (t *SunnahService) Collections(request *CollectionsRequest) (*CollectionsResponse, error) {
|
||||||
|
rsp := &CollectionsResponse{}
|
||||||
|
return rsp, t.client.Call("sunnah", "Collections", request, rsp)
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hadiths returns a list of hadiths and their corresponding text for a
|
||||||
|
// given book within a collection.
|
||||||
|
func (t *SunnahService) Hadiths(request *HadithsRequest) (*HadithsResponse, error) {
|
||||||
|
rsp := &HadithsResponse{}
|
||||||
|
return rsp, t.client.Call("sunnah", "Hadiths", request, rsp)
|
||||||
|
}
|
||||||
|
|
||||||
|
type Book struct {
|
||||||
|
// arabic name of the book
|
||||||
|
ArabicName string `json:"arabicName"`
|
||||||
|
// number of hadiths in the book
|
||||||
|
Hadiths int32 `json:"hadiths"`
|
||||||
|
// number of the book e.g 1
|
||||||
|
Id int32 `json:"id"`
|
||||||
|
// name of the book
|
||||||
|
Name string `json:"name"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BooksRequest struct {
|
||||||
|
// Name of the collection
|
||||||
|
Collection string `json:"collection"`
|
||||||
|
// Limit the number of books returned
|
||||||
|
Limit int32 `json:"limit"`
|
||||||
|
// The page in the pagination
|
||||||
|
Page int32 `json:"page"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type BooksResponse struct {
|
||||||
|
// A list of books
|
||||||
|
Books []Book `json:"books"`
|
||||||
|
// Name of the collection
|
||||||
|
Collection string `json:"collection"`
|
||||||
|
// The limit specified
|
||||||
|
Limit int32 `json:"limit"`
|
||||||
|
// The page requested
|
||||||
|
Page int32 `json:"page"`
|
||||||
|
// The total overall books
|
||||||
|
Total int32 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Chapter struct {
|
||||||
|
// arabic title
|
||||||
|
ArabicTitle string `json:"arabicTitle"`
|
||||||
|
// the book number
|
||||||
|
Book int32 `json:"book"`
|
||||||
|
// the chapter id e.g 1
|
||||||
|
Id int32 `json:"id"`
|
||||||
|
// the chapter key e.g 1.00
|
||||||
|
Key string `json:"key"`
|
||||||
|
// title of the chapter
|
||||||
|
Title string `json:"title"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ChaptersRequest struct {
|
||||||
|
// number of the book
|
||||||
|
Book int32 `json:"book"`
|
||||||
|
// name of the collection
|
||||||
|
Collection string `json:"collection"`
|
||||||
|
// Limit the number of chapters returned
|
||||||
|
Limit int32 `json:"limit"`
|
||||||
|
// The page in the pagination
|
||||||
|
Page int32 `json:"page"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type ChaptersResponse struct {
|
||||||
|
// number of the book
|
||||||
|
Book int32 `json:"book"`
|
||||||
|
// The chapters of the book
|
||||||
|
Chapters []Chapter `json:"chapters"`
|
||||||
|
// name of the collection
|
||||||
|
Collection string `json:"collection"`
|
||||||
|
// Limit the number of chapters returned
|
||||||
|
Limit int32 `json:"limit"`
|
||||||
|
// The page in the pagination
|
||||||
|
Page int32 `json:"page"`
|
||||||
|
// Total chapters in the book
|
||||||
|
Total int32 `json:"total"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Collection struct {
|
||||||
|
// Arabic title if available
|
||||||
|
ArabicTitle string `json:"arabicTitle"`
|
||||||
|
// Total hadiths in the collection
|
||||||
|
Hadiths int32 `json:"hadiths"`
|
||||||
|
// Name of the collection e.g bukhari
|
||||||
|
Name string `json:"name"`
|
||||||
|
// An introduction explaining the collection
|
||||||
|
Summary string `json:"summary"`
|
||||||
|
// Title of the collection e.g Sahih al-Bukhari
|
||||||
|
Title string `json:"title"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CollectionsRequest struct {
|
||||||
|
// Number of collections to limit to
|
||||||
|
Limit int32 `json:"limit"`
|
||||||
|
// The page in the pagination
|
||||||
|
Page int32 `json:"page"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type CollectionsResponse struct {
|
||||||
|
Collections []Collection `json:"collections"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type Hadith struct {
|
||||||
|
// the arabic chapter title
|
||||||
|
ArabicChapterTitle string `json:"arabicChapterTitle"`
|
||||||
|
// the arabic text
|
||||||
|
ArabicText string `json:"arabicText"`
|
||||||
|
// the chapter id
|
||||||
|
Chapter int32 `json:"chapter"`
|
||||||
|
// the chapter key
|
||||||
|
ChapterKey string `json:"chapterKey"`
|
||||||
|
// the chapter title
|
||||||
|
ChapterTitle string `json:"chapterTitle"`
|
||||||
|
// hadith id
|
||||||
|
Id int32 `json:"id"`
|
||||||
|
// hadith text
|
||||||
|
Text string `json:"text"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type HadithsRequest struct {
|
||||||
|
// number of the book
|
||||||
|
Book int32 `json:"book"`
|
||||||
|
// name of the collection
|
||||||
|
Collection string `json:"collection"`
|
||||||
|
// Limit the number of hadiths
|
||||||
|
Limit int32 `json:"limit"`
|
||||||
|
// The page in the pagination
|
||||||
|
Page int32 `json:"page"`
|
||||||
|
}
|
||||||
|
|
||||||
|
type HadithsResponse struct {
|
||||||
|
// number of the book
|
||||||
|
Book int32 `json:"book"`
|
||||||
|
// name of the collection
|
||||||
|
Collection string `json:"collection"`
|
||||||
|
// The hadiths of the book
|
||||||
|
Hadiths []Hadith `json:"hadiths"`
|
||||||
|
// Limit the number of hadiths returned
|
||||||
|
Limit int32 `json:"limit"`
|
||||||
|
// The page in the pagination
|
||||||
|
Page int32 `json:"page"`
|
||||||
|
// Total hadiths in the book
|
||||||
|
Total int32 `json:"total"`
|
||||||
|
}
|
||||||
@@ -24,6 +24,7 @@ import * as sentiment from "./sentiment";
|
|||||||
import * as sms from "./sms";
|
import * as sms from "./sms";
|
||||||
import * as stock from "./stock";
|
import * as stock from "./stock";
|
||||||
import * as stream from "./stream";
|
import * as stream from "./stream";
|
||||||
|
import * as sunnah from "./sunnah";
|
||||||
import * as thumbnail from "./thumbnail";
|
import * as thumbnail from "./thumbnail";
|
||||||
import * as time from "./time";
|
import * as time from "./time";
|
||||||
import * as twitter from "./twitter";
|
import * as twitter from "./twitter";
|
||||||
@@ -59,6 +60,7 @@ export class Client {
|
|||||||
this.smsService = new sms.SmsService(token);
|
this.smsService = new sms.SmsService(token);
|
||||||
this.stockService = new stock.StockService(token);
|
this.stockService = new stock.StockService(token);
|
||||||
this.streamService = new stream.StreamService(token);
|
this.streamService = new stream.StreamService(token);
|
||||||
|
this.sunnahService = new sunnah.SunnahService(token);
|
||||||
this.thumbnailService = new thumbnail.ThumbnailService(token);
|
this.thumbnailService = new thumbnail.ThumbnailService(token);
|
||||||
this.timeService = new time.TimeService(token);
|
this.timeService = new time.TimeService(token);
|
||||||
this.twitterService = new twitter.TwitterService(token);
|
this.twitterService = new twitter.TwitterService(token);
|
||||||
@@ -93,6 +95,7 @@ export class Client {
|
|||||||
smsService: sms.SmsService;
|
smsService: sms.SmsService;
|
||||||
stockService: stock.StockService;
|
stockService: stock.StockService;
|
||||||
streamService: stream.StreamService;
|
streamService: stream.StreamService;
|
||||||
|
sunnahService: sunnah.SunnahService;
|
||||||
thumbnailService: thumbnail.ThumbnailService;
|
thumbnailService: thumbnail.ThumbnailService;
|
||||||
timeService: time.TimeService;
|
timeService: time.TimeService;
|
||||||
twitterService: twitter.TwitterService;
|
twitterService: twitter.TwitterService;
|
||||||
|
|||||||
@@ -36,6 +36,7 @@
|
|||||||
"./sms": "./dist/sms/index.js",
|
"./sms": "./dist/sms/index.js",
|
||||||
"./stock": "./dist/stock/index.js",
|
"./stock": "./dist/stock/index.js",
|
||||||
"./stream": "./dist/stream/index.js",
|
"./stream": "./dist/stream/index.js",
|
||||||
|
"./sunnah": "./dist/sunnah/index.js",
|
||||||
"./test": "./dist/test/index.js",
|
"./test": "./dist/test/index.js",
|
||||||
"./thumbnail": "./dist/thumbnail/index.js",
|
"./thumbnail": "./dist/thumbnail/index.js",
|
||||||
"./time": "./dist/time/index.js",
|
"./time": "./dist/time/index.js",
|
||||||
|
|||||||
@@ -87,7 +87,7 @@ export interface Result {
|
|||||||
// The associated arabic text
|
// The associated arabic text
|
||||||
text?: string;
|
text?: string;
|
||||||
// The related translations to the text
|
// The related translations to the text
|
||||||
translations?: Interpretation[];
|
translations?: Translation[];
|
||||||
// The unique verse id across the Quran
|
// The unique verse id across the Quran
|
||||||
verseId?: number;
|
verseId?: number;
|
||||||
// The verse key e.g 1:1
|
// The verse key e.g 1:1
|
||||||
@@ -149,7 +149,7 @@ export interface Verse {
|
|||||||
// The unique id of the verse in the whole book
|
// The unique id of the verse in the whole book
|
||||||
id?: number;
|
id?: number;
|
||||||
// The interpretations of the verse
|
// The interpretations of the verse
|
||||||
interpretations?: Interpretation[];
|
interpretations?: Translation[];
|
||||||
// The key of this verse (chapter:verse) e.g 1:1
|
// The key of this verse (chapter:verse) e.g 1:1
|
||||||
key?: string;
|
key?: string;
|
||||||
// The verse number in this chapter
|
// The verse number in this chapter
|
||||||
@@ -161,7 +161,7 @@ export interface Verse {
|
|||||||
// The basic translation of the verse
|
// The basic translation of the verse
|
||||||
translatedText?: string;
|
translatedText?: string;
|
||||||
// The alternative translations for the verse
|
// The alternative translations for the verse
|
||||||
translations?: Interpretation[];
|
translations?: Translation[];
|
||||||
// The phonetic transliteration from arabic
|
// The phonetic transliteration from arabic
|
||||||
transliteration?: string;
|
transliteration?: string;
|
||||||
// The individual words within the verse (Ayah)
|
// The individual words within the verse (Ayah)
|
||||||
|
|||||||
183
clients/ts/sunnah/index.ts
Executable file
183
clients/ts/sunnah/index.ts
Executable file
@@ -0,0 +1,183 @@
|
|||||||
|
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;
|
||||||
|
}
|
||||||
@@ -11,9 +11,9 @@ func PublishAmessage() {
|
|||||||
streamService := stream.NewStreamService(os.Getenv("MICRO_API_TOKEN"))
|
streamService := stream.NewStreamService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
rsp, err := streamService.Publish(&stream.PublishRequest{
|
rsp, err := streamService.Publish(&stream.PublishRequest{
|
||||||
Message: map[string]interface{}{
|
Message: map[string]interface{}{
|
||||||
|
"user": "john",
|
||||||
"id": "1",
|
"id": "1",
|
||||||
"type": "signup",
|
"type": "signup",
|
||||||
"user": "john",
|
|
||||||
},
|
},
|
||||||
Topic: "events",
|
Topic: "events",
|
||||||
})
|
})
|
||||||
|
|||||||
6
examples/sunnah/books/curl/getTheBooksWithinACollection.sh
Executable file
6
examples/sunnah/books/curl/getTheBooksWithinACollection.sh
Executable file
@@ -0,0 +1,6 @@
|
|||||||
|
curl "https://api.m3o.com/v1/sunnah/Books" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||||
|
-d '{
|
||||||
|
"collection": "bukhari"
|
||||||
|
}'
|
||||||
17
examples/sunnah/books/go/getTheBooksWithinACollection.go
Executable file
17
examples/sunnah/books/go/getTheBooksWithinACollection.go
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
package example
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/micro/services/clients/go/sunnah"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get a list of books from within a collection. A book can contain many chapters
|
||||||
|
// each with its own hadiths.
|
||||||
|
func GetTheBooksWithinAcollection() {
|
||||||
|
sunnahService := sunnah.NewSunnahService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
|
rsp, err := sunnahService.Books(&sunnah.BooksRequest{
|
||||||
|
Collection: "bukhari",
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
13
examples/sunnah/books/node/getTheBooksWithinACollection.js
Executable file
13
examples/sunnah/books/node/getTheBooksWithinACollection.js
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
import * as sunnah from "m3o/sunnah";
|
||||||
|
|
||||||
|
// Get a list of books from within a collection. A book can contain many chapters
|
||||||
|
// each with its own hadiths.
|
||||||
|
async function GetTheBooksWithinAcollection() {
|
||||||
|
let sunnahService = new sunnah.SunnahService(process.env.MICRO_API_TOKEN);
|
||||||
|
let rsp = await sunnahService.books({
|
||||||
|
collection: "bukhari",
|
||||||
|
});
|
||||||
|
console.log(rsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
await GetTheBooksWithinAcollection();
|
||||||
7
examples/sunnah/chapters/curl/listTheChaptersInABook.sh
Executable file
7
examples/sunnah/chapters/curl/listTheChaptersInABook.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
curl "https://api.m3o.com/v1/sunnah/Chapters" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||||
|
-d '{
|
||||||
|
"book": 1,
|
||||||
|
"collection": "bukhari"
|
||||||
|
}'
|
||||||
17
examples/sunnah/chapters/go/listTheChaptersInABook.go
Executable file
17
examples/sunnah/chapters/go/listTheChaptersInABook.go
Executable file
@@ -0,0 +1,17 @@
|
|||||||
|
package example
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/micro/services/clients/go/sunnah"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get all the chapters of a given book within a collection.
|
||||||
|
func ListTheChaptersInAbook() {
|
||||||
|
sunnahService := sunnah.NewSunnahService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
|
rsp, err := sunnahService.Chapters(&sunnah.ChaptersRequest{
|
||||||
|
Book: 1,
|
||||||
|
Collection: "bukhari",
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
13
examples/sunnah/chapters/node/listTheChaptersInABook.js
Executable file
13
examples/sunnah/chapters/node/listTheChaptersInABook.js
Executable file
@@ -0,0 +1,13 @@
|
|||||||
|
import * as sunnah from "m3o/sunnah";
|
||||||
|
|
||||||
|
// Get all the chapters of a given book within a collection.
|
||||||
|
async function ListTheChaptersInAbook() {
|
||||||
|
let sunnahService = new sunnah.SunnahService(process.env.MICRO_API_TOKEN);
|
||||||
|
let rsp = await sunnahService.chapters({
|
||||||
|
book: 1,
|
||||||
|
collection: "bukhari",
|
||||||
|
});
|
||||||
|
console.log(rsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
await ListTheChaptersInAbook();
|
||||||
4
examples/sunnah/collections/curl/listAvailableCollections.sh
Executable file
4
examples/sunnah/collections/curl/listAvailableCollections.sh
Executable file
@@ -0,0 +1,4 @@
|
|||||||
|
curl "https://api.m3o.com/v1/sunnah/Collections" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||||
|
-d '{}'
|
||||||
15
examples/sunnah/collections/go/listAvailableCollections.go
Executable file
15
examples/sunnah/collections/go/listAvailableCollections.go
Executable file
@@ -0,0 +1,15 @@
|
|||||||
|
package example
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/micro/services/clients/go/sunnah"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Get a list of available collections. A collection is
|
||||||
|
// a compilation of hadiths collected and written by an author.
|
||||||
|
func ListAvailableCollections() {
|
||||||
|
sunnahService := sunnah.NewSunnahService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
|
rsp, err := sunnahService.Collections(&sunnah.CollectionsRequest{})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
11
examples/sunnah/collections/node/listAvailableCollections.js
Executable file
11
examples/sunnah/collections/node/listAvailableCollections.js
Executable file
@@ -0,0 +1,11 @@
|
|||||||
|
import * as sunnah from "m3o/sunnah";
|
||||||
|
|
||||||
|
// Get a list of available collections. A collection is
|
||||||
|
// a compilation of hadiths collected and written by an author.
|
||||||
|
async function ListAvailableCollections() {
|
||||||
|
let sunnahService = new sunnah.SunnahService(process.env.MICRO_API_TOKEN);
|
||||||
|
let rsp = await sunnahService.collections({});
|
||||||
|
console.log(rsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
await ListAvailableCollections();
|
||||||
7
examples/sunnah/hadiths/curl/listTheHadithsInABook.sh
Executable file
7
examples/sunnah/hadiths/curl/listTheHadithsInABook.sh
Executable file
@@ -0,0 +1,7 @@
|
|||||||
|
curl "https://api.m3o.com/v1/sunnah/Hadiths" \
|
||||||
|
-H "Content-Type: application/json" \
|
||||||
|
-H "Authorization: Bearer $MICRO_API_TOKEN" \
|
||||||
|
-d '{
|
||||||
|
"book": 1,
|
||||||
|
"collection": "bukhari"
|
||||||
|
}'
|
||||||
18
examples/sunnah/hadiths/go/listTheHadithsInABook.go
Executable file
18
examples/sunnah/hadiths/go/listTheHadithsInABook.go
Executable file
@@ -0,0 +1,18 @@
|
|||||||
|
package example
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
"github.com/micro/services/clients/go/sunnah"
|
||||||
|
"os"
|
||||||
|
)
|
||||||
|
|
||||||
|
// Hadiths returns a list of hadiths and their corresponding text for a
|
||||||
|
// given book within a collection.
|
||||||
|
func ListTheHadithsInAbook() {
|
||||||
|
sunnahService := sunnah.NewSunnahService(os.Getenv("MICRO_API_TOKEN"))
|
||||||
|
rsp, err := sunnahService.Hadiths(&sunnah.HadithsRequest{
|
||||||
|
Book: 1,
|
||||||
|
Collection: "bukhari",
|
||||||
|
})
|
||||||
|
fmt.Println(rsp, err)
|
||||||
|
}
|
||||||
14
examples/sunnah/hadiths/node/listTheHadithsInABook.js
Executable file
14
examples/sunnah/hadiths/node/listTheHadithsInABook.js
Executable file
@@ -0,0 +1,14 @@
|
|||||||
|
import * as sunnah from "m3o/sunnah";
|
||||||
|
|
||||||
|
// Hadiths returns a list of hadiths and their corresponding text for a
|
||||||
|
// given book within a collection.
|
||||||
|
async function ListTheHadithsInAbook() {
|
||||||
|
let sunnahService = new sunnah.SunnahService(process.env.MICRO_API_TOKEN);
|
||||||
|
let rsp = await sunnahService.hadiths({
|
||||||
|
book: 1,
|
||||||
|
collection: "bukhari",
|
||||||
|
});
|
||||||
|
console.log(rsp);
|
||||||
|
}
|
||||||
|
|
||||||
|
await ListTheHadithsInAbook();
|
||||||
Reference in New Issue
Block a user