From 6e40bfe06a02c171c86eb7ca0a3db0e330dcddb5 Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Tue, 21 Sep 2021 15:19:22 +0100 Subject: [PATCH] add sunnah api (#210) --- pkg/api/api.go | 21 +- sunnah/.gitignore | 2 + sunnah/Dockerfile | 3 + sunnah/Makefile | 28 + sunnah/README.md | 10 + sunnah/domain/domain.go | 80 ++ sunnah/examples.json | 99 +++ sunnah/generate.go | 3 + sunnah/handler/sunnah.go | 231 ++++++ sunnah/main.go | 34 + sunnah/micro.mu | 1 + sunnah/proto/sunnah.pb.go | 1304 +++++++++++++++++++++++++++++++ sunnah/proto/sunnah.pb.micro.go | 144 ++++ sunnah/proto/sunnah.proto | 158 ++++ sunnah/publicapi.json | 5 + 15 files changed, 2122 insertions(+), 1 deletion(-) create mode 100644 sunnah/.gitignore create mode 100644 sunnah/Dockerfile create mode 100644 sunnah/Makefile create mode 100644 sunnah/README.md create mode 100644 sunnah/domain/domain.go create mode 100644 sunnah/examples.json create mode 100644 sunnah/generate.go create mode 100644 sunnah/handler/sunnah.go create mode 100644 sunnah/main.go create mode 100644 sunnah/micro.mu create mode 100644 sunnah/proto/sunnah.pb.go create mode 100644 sunnah/proto/sunnah.pb.micro.go create mode 100644 sunnah/proto/sunnah.proto create mode 100644 sunnah/publicapi.json diff --git a/pkg/api/api.go b/pkg/api/api.go index d79c7c0..74b29b0 100644 --- a/pkg/api/api.go +++ b/pkg/api/api.go @@ -8,8 +8,27 @@ import ( "net/http" ) +var ( + keys = map[string]string{} +) + +// Set a key within the header +func SetKey(k, v string) { + keys[k] = v +} + +// Get a url and unmarshal a json body into the given value func Get(url string, rsp interface{}) error { - resp, err := http.Get(url) + req, err := http.NewRequest("GET", url, nil) + if err != nil { + return err + } + + for k, v := range keys { + req.Header.Set(k, v) + } + + resp, err := http.DefaultClient.Do(req) if err != nil { return err } diff --git a/sunnah/.gitignore b/sunnah/.gitignore new file mode 100644 index 0000000..8cd205d --- /dev/null +++ b/sunnah/.gitignore @@ -0,0 +1,2 @@ + +sunnah diff --git a/sunnah/Dockerfile b/sunnah/Dockerfile new file mode 100644 index 0000000..ae59689 --- /dev/null +++ b/sunnah/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine +ADD sunnah /sunnah +ENTRYPOINT [ "/sunnah" ] diff --git a/sunnah/Makefile b/sunnah/Makefile new file mode 100644 index 0000000..9c8afc7 --- /dev/null +++ b/sunnah/Makefile @@ -0,0 +1,28 @@ + +GOPATH:=$(shell go env GOPATH) +.PHONY: init +init: + go get -u github.com/golang/protobuf/proto + go get -u github.com/golang/protobuf/protoc-gen-go + go get github.com/micro/micro/v3/cmd/protoc-gen-micro + go get github.com/micro/micro/v3/cmd/protoc-gen-openapi + +.PHONY: api +api: + protoc --openapi_out=. --proto_path=. proto/sunnah.proto + +.PHONY: proto +proto: + protoc --proto_path=. --micro_out=. --go_out=:. proto/sunnah.proto + +.PHONY: build +build: + go build -o sunnah *.go + +.PHONY: test +test: + go test -v ./... -cover + +.PHONY: docker +docker: + docker build . -t sunnah:latest diff --git a/sunnah/README.md b/sunnah/README.md new file mode 100644 index 0000000..fc0bfbb --- /dev/null +++ b/sunnah/README.md @@ -0,0 +1,10 @@ +Traditions and practices of the Islamic prophet, Muhammad (pbuh) + +# Sunnah Service + +Sunnah are the traditions and practices of the Islamic prophet, Muhammad, that constitute a model for Muslims to follow. +According to classical Islamic theories, the sunnah are documented by hadith (the verbally transmitted record of the teachings, +deeds and sayings, silent permissions or disapprovals of Muhammad), and along with the Quran (the book of Islam), are the divine +revelation (Wahy) delivered through Muhammad that make up the primary sources of Islamic law and belief/theology. + +Powered by [Sunnah.com](https://sunnah.com). diff --git a/sunnah/domain/domain.go b/sunnah/domain/domain.go new file mode 100644 index 0000000..5b2ab4a --- /dev/null +++ b/sunnah/domain/domain.go @@ -0,0 +1,80 @@ +package domain + +type BookRequest struct { + Data []*Book `json:"data"` + Total int32 `json:"total"` + Limit int32 `json:"limit"` +} + +type BookText struct { + Lang string `json:"lang"` + Name string `json:"name"` +} + +type Book struct { + BookNumber string `json:"bookNumber"` + Book []*BookText `json:"book"` + HadithStartNumber int32 `json:"hadithStartNumber"` + HadithEndNumber int32 `json:"hadithEndNumber"` + NumberOfHadith int32 `json:"numberOfHadith"` +} + +type ChaptersRequest struct { + Data []*Chapter `json:"data"` + Total int32 `json:"total"` + Limit int32 `json:"limit"` +} + +type ChapterText struct { + Lang string `json:"lang"` + ChapterNumber string `json:"chapterNumber"` + ChapterTitle string `json:"chapterTitle"` +} + +type Chapter struct { + BookNumber string `json:"bookNumber"` + ChapterId string `json:"chapterId"` + Chapter []*ChapterText `json:"chapter"` +} + +type CollectionRequest struct { + Data []*Collection `json:"data"` + Total int32 `json:"total"` + Limit int32 `json:"limit"` +} + +type CollectionText struct { + Lang string `json:"lang"` + Title string `json:"title"` + ShortIntro string `json:"shortIntro"` +} + +type Collection struct { + Name string `json:"name"` + HasBooks bool `json:"hasBooks"` + HasChapters bool `json:"hasChapters"` + TotalHadith int32 `json:"totalHadith"` + TotalAvailableHadith int32 `json:"totalAvailableHadith"` + Collection []*CollectionText `json:"collection"` +} + +type HadithsRequest struct { + Data []*Hadith `json:"data"` + Total int32 `json:"total"` + Limit int32 `json:"limit"` +} + +type HadithText struct { + Lang string `json:"lang"` + ChapterNumber string `json:"chapterNumber"` + ChapterTitle string `json:"chapterTitle"` + Body string `json:"body"` +} + +type Hadith struct { + Collection string `json:"collection"` + BookNumber string `json:"bookNumber"` + ChapterId string `json:"chapterId"` + HadithNumber string `json:"hadithNumber"` + Hadith []*HadithText `json:"hadith"` +} diff --git a/sunnah/examples.json b/sunnah/examples.json new file mode 100644 index 0000000..c75af2e --- /dev/null +++ b/sunnah/examples.json @@ -0,0 +1,99 @@ +{ + "collections": [{ + "title": "List available collections", + "run_check": false, + "request": {}, + "response": { + "collections": [{ + "name": "bukhari", + "title": "Sahih al-Bukhari", + "arabic_title": "صحيح البخاري", + "summary": "Sahih al-Bukhari is a collection of hadith compiled by Imam Muhammad al-Bukhari (d. 256 AH/870 AD) (rahimahullah).\r\n\r\nHis collection is recognized by the overwhelming majority of the Muslim world to be the most authentic collection of reports of the \u003ci\u003eSunnah\u003c/i\u003e of the Prophet Muhammad (ﷺ). It contains over 7500 hadith (with repetitions) in 97 books.\r\n\r\nThe translation provided here is by Dr. M. Muhsin Khan.", + "hadiths": 7291 + }] + } + }], + "books": [{ + "title": "Get the books within a collection", + "run_check": false, + "request": { + "collection": "bukhari" + }, + "response": { + "collection": "bukhari", + "total": 97, + "page": 1, + "limit": 50, + "books": [ + { + "id": 1, + "name": "Revelation", + "arabic_name": "كتاب بدء الوحى ", + "hadiths": 7 + }, + { + "id": 2, + "name": "Belief", + "arabic_name": "كتاب الإيمان ", + "hadiths": 51 + }, + { + "id": 3, + "name": "Knowledge", + "arabic_name": "كتاب العلم ", + "hadiths": 76 + } + ] + } + ], + "chapters": [{ + "title": "List the chapters in a book", + "run_check": false, + "request": { + "collection": "bukhari", + "book": 1 + }, + "response": { + "collection": "bukhari", + "book": 1, + "page": 1, + "limit": 50, + "total": 6, + "chapters": [ + { + "id": 1, + "key": "1.00", + "book": 1, + "title": "How the Divine Revelation started being revealed to Allah's Messenger", + "arabic_title": "باب كَيْفَ كَانَ بَدْءُ الْوَحْىِ إِلَى رَسُولِ اللَّهِ صلى الله عليه وسلم" + } + ] + } + }], + "hadiths": [{ + "title": "List the hadiths in a book", + "run_check": false, + "request": { + "collection": "bukhari", + "book": 1 + }, + "response": { + "collection": "bukhari", + "book": 1, + "page": 1, + "limit": 50, + "total": 7, + "hadiths": [ + { + "id": 1, + "chapter": 1, + "chapter_key": "1.00", + "chapter_title": "How the Divine Revelation started being revealed to Allah's Messenger", + "arabic_chapter_title": "باب كَيْفَ كَانَ بَدْءُ الْوَحْىِ إِلَى رَسُولِ اللَّهِ صلى الله عليه وسلم", + "text": "\u003cp\u003eNarrated 'Umar bin Al-Khattab:\n\u003c/p\u003e\n\u003cp\u003e\n I heard Allah's Messenger (ﷺ) saying, \"The reward of deeds depends upon the \n intentions and every person will get the reward according to what he \n has intended. So whoever emigrated for worldly benefits or for a woman\n to marry, his emigration was for what he emigrated for.\"\n\u003c/p\u003e", + "arabic_text": "\u003cp\u003e[prematn]حَدَّثَنَا[narrator id=\"4698\" tooltip=\"عبد الله بن الزبير بن عيسى بن عبيد الله بن أسامة بن عبد الله بن حميد بن زهير بن الحارث بن أسد بن عبد العزى\"] الْحُمَيْدِيُّ عَبْدُ اللَّهِ بْنُ الزُّبَيْرِ [/narrator]، قَالَ : حَدَّثَنَا[narrator id=\"3443\" tooltip=\"سفيان بن عيينة بن ميمون\"] سُفْيَانُ [/narrator]، قَالَ : حَدَّثَنَا[narrator id=\"8272\" tooltip=\"يحيى بن سعيد بن قيس بن عمرو بن سهل بن ثعلبة بن الحارث بن زيد بن ثعلبة بن غنم بن مالك بن النجار\"] يَحْيَى بْنُ سَعِيدٍ الْأَنْصَارِيُّ [/narrator]، قَالَ : أَخْبَرَنِي[narrator id=\"6796\" tooltip=\"محمد بن إبراهيم بن الحارث بن خالد بن صخر بن عامر بن كعب بن سعد بن تيم بن مرة\"] مُحَمَّدُ بْنُ إِبْرَاهِيمَ التَّيْمِيُّ [/narrator]، أَنَّهُ سَمِعَ[narrator id=\"5719\" tooltip=\"علقمة بن وقاص بن محصن بن كلدة بن عبد ياليل\"] عَلْقَمَةَ بْنَ وَقَّاصٍ اللَّيْثِيَّ [/narrator]، يَقُولُ : سَمِعْتُ[narrator id=\"5913\" tooltip=\"عمر بن الخطاب بن نفيل بن عبد العزى بن رياح بن عبد الله بن قرط بن رزاح بن عدي بن كعب\"] عُمَرَ بْنَ الْخَطَّابِ [/narrator] رَضِيَ اللَّهُ عَنْهُ عَلَى الْمِنْبَرِ، قَالَ : سَمِعْتُ رَسُولَ اللَّهِ صَلَّى اللَّهُ عَلَيْهِ وَسَلَّمَ، يَقُولُ : \"[/prematn]\n[matn]إِنَّمَا الْأَعْمَالُ بِالنِّيَّاتِ، وَإِنَّمَا لِكُلِّ امْرِئٍ مَا نَوَى، فَمَنْ كَانَتْ هِجْرَتُهُ إِلَى دُنْيَا يُصِيبُهَا أَوْ إِلَى امْرَأَةٍ يَنْكِحُهَا، فَهِجْرَتُهُ إِلَى مَا هَاجَرَ إِلَيْهِ \"[/matn]\u003c/p\u003e" + } + ] + } + }] +} diff --git a/sunnah/generate.go b/sunnah/generate.go new file mode 100644 index 0000000..7d9db91 --- /dev/null +++ b/sunnah/generate.go @@ -0,0 +1,3 @@ +package main + +//go:generate make proto diff --git a/sunnah/handler/sunnah.go b/sunnah/handler/sunnah.go new file mode 100644 index 0000000..81b09d9 --- /dev/null +++ b/sunnah/handler/sunnah.go @@ -0,0 +1,231 @@ +package handler + +import ( + "context" + "fmt" + "strconv" + "strings" + + "github.com/micro/micro/v3/service/errors" + "github.com/micro/micro/v3/service/logger" + "github.com/micro/services/pkg/api" + "github.com/micro/services/sunnah/domain" + pb "github.com/micro/services/sunnah/proto" +) + +var ( + apiUrl = "https://api.sunnah.com/v1/" +) + +type Sunnah struct { + apiKey string +} + +func New(key string) *Sunnah { + api.SetKey("X-API-Key", key) + + return &Sunnah{ + apiKey: key, + } +} + +func (s *Sunnah) Collections(ctx context.Context, req *pb.CollectionsRequest, rsp *pb.CollectionsResponse) error { + var resp *domain.CollectionRequest + + if req.Limit <= 0 { + req.Limit = 50 + } + + if req.Page <= 0 { + req.Page = 1 + } + + uri := fmt.Sprintf("%scollections?limit=%d&page=%d", apiUrl, req.Limit, req.Page) + + if err := api.Get(uri, &resp); err != nil { + logger.Errorf("Failed to retrieve collections: %v", err) + return errors.InternalServerError("sunnah.collections", "Failed to retrieve collections") + } + + for _, c := range resp.Data { + var arabicTitle string + if len(c.Collection) > 1 && c.Collection[1].Lang == "ar" { + arabicTitle = c.Collection[1].Title + } + + rsp.Collections = append(rsp.Collections, &pb.Collection{ + Name: c.Name, + Title: c.Collection[0].Title, + ArabicTitle: arabicTitle, + Hadiths: c.TotalHadith, + Summary: c.Collection[0].ShortIntro, + }) + } + + return nil +} + +func (s *Sunnah) Books(ctx context.Context, req *pb.BooksRequest, rsp *pb.BooksResponse) error { + var resp *domain.BookRequest + + if len(req.Collection) == 0 { + return errors.BadRequest("sunnah.books", "missing collection name") + } + + if req.Limit <= 0 { + req.Limit = 50 + } + + if req.Page <= 0 { + req.Page = 1 + } + + uri := fmt.Sprintf("%scollections/%s/books?limit=%d&page=%d", apiUrl, req.Collection, req.Limit, req.Page) + + if err := api.Get(uri, &resp); err != nil { + logger.Errorf("Failed to retrieve books: %v", err) + return errors.InternalServerError("sunnah.books", "Failed to retrieve books") + } + + rsp.Collection = req.Collection + rsp.Total = resp.Total + rsp.Limit = req.Limit + rsp.Page = req.Page + + for _, b := range resp.Data { + if len(b.Book) == 0 { + continue + } + + var arabicName string + if len(b.Book) > 1 && b.Book[1].Lang == "ar" { + arabicName = b.Book[1].Name + } + bkId, _ := strconv.Atoi(b.BookNumber) + rsp.Books = append(rsp.Books, &pb.Book{ + Id: int32(bkId), + Name: b.Book[0].Name, + ArabicName: arabicName, + Hadiths: b.NumberOfHadith, + }) + } + + return nil +} + +func (s *Sunnah) Chapters(ctx context.Context, req *pb.ChaptersRequest, rsp *pb.ChaptersResponse) error { + var resp *domain.ChaptersRequest + + if len(req.Collection) == 0 { + return errors.BadRequest("sunnah.chapters", "missing collection name") + } + + if req.Book == 0 { + req.Book = 1 + } + + if req.Limit <= 0 { + req.Limit = 50 + } + + if req.Page <= 0 { + req.Page = 1 + } + + uri := fmt.Sprintf("%scollections/%s/books/%d/chapters?limit=%d&page=%d", apiUrl, req.Collection, req.Book, req.Limit, req.Page) + + if err := api.Get(uri, &resp); err != nil { + logger.Errorf("Failed to retrieve chapters: %v", err) + return errors.InternalServerError("sunnah.chapters", "Failed to retrieve chapters") + } + + rsp.Collection = req.Collection + rsp.Book = req.Book + rsp.Total = resp.Total + rsp.Limit = req.Limit + rsp.Page = req.Page + + for _, c := range resp.Data { + if len(c.Chapter) == 0 { + continue + } + + var arabicTitle string + if len(c.Chapter) > 1 && c.Chapter[1].Lang == "ar" { + arabicTitle = c.Chapter[1].ChapterTitle + } + bkId, _ := strconv.Atoi(c.BookNumber) + chNumber, _ := strconv.Atoi(strings.Split(c.ChapterId, ".")[0]) + rsp.Chapters = append(rsp.Chapters, &pb.Chapter{ + Id: int32(chNumber), + Key: c.ChapterId, + Book: int32(bkId), + Title: c.Chapter[0].ChapterTitle, + ArabicTitle: arabicTitle, + }) + } + + return nil +} + +func (s *Sunnah) Hadiths(ctx context.Context, req *pb.HadithsRequest, rsp *pb.HadithsResponse) error { + var resp *domain.HadithsRequest + + if len(req.Collection) == 0 { + return errors.BadRequest("sunnah.hadiths", "missing collection name") + } + + if req.Book == 0 { + req.Book = 1 + } + + if req.Limit <= 0 { + req.Limit = 50 + } + + if req.Page <= 0 { + req.Page = 1 + } + + uri := fmt.Sprintf("%scollections/%s/books/%d/hadiths?limit=%d&page=%d", apiUrl, req.Collection, req.Book, req.Limit, req.Page) + + if err := api.Get(uri, &resp); err != nil { + logger.Errorf("Failed to retrieve hadiths: %v", err) + return errors.InternalServerError("sunnah.hadiths", "Failed to retrieve hadiths") + } + + rsp.Collection = req.Collection + rsp.Book = req.Book + rsp.Total = resp.Total + rsp.Limit = req.Limit + rsp.Page = req.Page + + for _, h := range resp.Data { + if len(h.Hadith) == 0 { + continue + } + + var arabicTitle string + var arabicText string + + if len(h.Hadith) > 1 && h.Hadith[1].Lang == "ar" { + arabicTitle = h.Hadith[1].ChapterTitle + arabicText = h.Hadith[1].Body + } + + chNumber, _ := strconv.Atoi(strings.Split(h.ChapterId, ".")[0]) + hId, _ := strconv.Atoi(h.HadithNumber) + + rsp.Hadiths = append(rsp.Hadiths, &pb.Hadith{ + Id: int32(hId), + Chapter: int32(chNumber), + ChapterKey: h.ChapterId, + ChapterTitle: h.Hadith[0].ChapterTitle, + Text: h.Hadith[0].Body, + ArabicText: arabicText, + ArabicChapterTitle: arabicTitle, + }) + } + + return nil +} diff --git a/sunnah/main.go b/sunnah/main.go new file mode 100644 index 0000000..c98700f --- /dev/null +++ b/sunnah/main.go @@ -0,0 +1,34 @@ +package main + +import ( + "github.com/micro/micro/v3/service" + "github.com/micro/micro/v3/service/config" + "github.com/micro/micro/v3/service/logger" + "github.com/micro/services/sunnah/handler" + pb "github.com/micro/services/sunnah/proto" +) + +func main() { + // Create service + srv := service.New( + service.Name("sunnah"), + service.Version("latest"), + ) + + v, err := config.Get("sunnah.api_key") + if err != nil { + logger.Fatalf("sunnha.api_key config not found: %v", err) + } + key := v.String("") + if len(key) == 0 { + logger.Fatal("sunnah.api_key config not found") + } + + // Register handler + pb.RegisterSunnahHandler(srv.Server(), handler.New(key)) + + // Run service + if err := srv.Run(); err != nil { + logger.Fatal(err) + } +} diff --git a/sunnah/micro.mu b/sunnah/micro.mu new file mode 100644 index 0000000..ea21372 --- /dev/null +++ b/sunnah/micro.mu @@ -0,0 +1 @@ +service sunnah diff --git a/sunnah/proto/sunnah.pb.go b/sunnah/proto/sunnah.pb.go new file mode 100644 index 0000000..4222e37 --- /dev/null +++ b/sunnah/proto/sunnah.pb.go @@ -0,0 +1,1304 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.15.6 +// source: proto/sunnah.proto + +package sunnah + +import ( + protoreflect "google.golang.org/protobuf/reflect/protoreflect" + protoimpl "google.golang.org/protobuf/runtime/protoimpl" + reflect "reflect" + sync "sync" +) + +const ( + // Verify that this generated code is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(20 - protoimpl.MinVersion) + // Verify that runtime/protoimpl is sufficiently up-to-date. + _ = protoimpl.EnforceVersion(protoimpl.MaxVersion - 20) +) + +type Collection struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name of the collection e.g bukhari + Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"` + // Title of the collection e.g Sahih al-Bukhari + Title string `protobuf:"bytes,2,opt,name=title,proto3" json:"title,omitempty"` + // Arabic title if available + ArabicTitle string `protobuf:"bytes,3,opt,name=arabic_title,json=arabicTitle,proto3" json:"arabic_title,omitempty"` + // An introduction explaining the collection + Summary string `protobuf:"bytes,4,opt,name=summary,proto3" json:"summary,omitempty"` + // Total hadiths in the collection + Hadiths int32 `protobuf:"varint,5,opt,name=hadiths,proto3" json:"hadiths,omitempty"` +} + +func (x *Collection) Reset() { + *x = Collection{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_sunnah_proto_msgTypes[0] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Collection) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Collection) ProtoMessage() {} + +func (x *Collection) ProtoReflect() protoreflect.Message { + mi := &file_proto_sunnah_proto_msgTypes[0] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Collection.ProtoReflect.Descriptor instead. +func (*Collection) Descriptor() ([]byte, []int) { + return file_proto_sunnah_proto_rawDescGZIP(), []int{0} +} + +func (x *Collection) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Collection) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Collection) GetArabicTitle() string { + if x != nil { + return x.ArabicTitle + } + return "" +} + +func (x *Collection) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + +func (x *Collection) GetHadiths() int32 { + if x != nil { + return x.Hadiths + } + return 0 +} + +type Book struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // number of the book e.g 1 + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // name of the book + Name string `protobuf:"bytes,2,opt,name=name,proto3" json:"name,omitempty"` + // arabic name of the book + ArabicName string `protobuf:"bytes,3,opt,name=arabic_name,json=arabicName,proto3" json:"arabic_name,omitempty"` + // number of hadiths in the book + Hadiths int32 `protobuf:"varint,4,opt,name=hadiths,proto3" json:"hadiths,omitempty"` +} + +func (x *Book) Reset() { + *x = Book{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_sunnah_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Book) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Book) ProtoMessage() {} + +func (x *Book) ProtoReflect() protoreflect.Message { + mi := &file_proto_sunnah_proto_msgTypes[1] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Book.ProtoReflect.Descriptor instead. +func (*Book) Descriptor() ([]byte, []int) { + return file_proto_sunnah_proto_rawDescGZIP(), []int{1} +} + +func (x *Book) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Book) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Book) GetArabicName() string { + if x != nil { + return x.ArabicName + } + return "" +} + +func (x *Book) GetHadiths() int32 { + if x != nil { + return x.Hadiths + } + return 0 +} + +type Chapter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // the chapter id e.g 1 + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // the chapter key e.g 1.00 + Key string `protobuf:"bytes,2,opt,name=key,proto3" json:"key,omitempty"` + // the book number + Book int32 `protobuf:"varint,3,opt,name=book,proto3" json:"book,omitempty"` + // title of the chapter + Title string `protobuf:"bytes,4,opt,name=title,proto3" json:"title,omitempty"` + // arabic title + ArabicTitle string `protobuf:"bytes,5,opt,name=arabic_title,json=arabicTitle,proto3" json:"arabic_title,omitempty"` +} + +func (x *Chapter) Reset() { + *x = Chapter{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_sunnah_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Chapter) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Chapter) ProtoMessage() {} + +func (x *Chapter) ProtoReflect() protoreflect.Message { + mi := &file_proto_sunnah_proto_msgTypes[2] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Chapter.ProtoReflect.Descriptor instead. +func (*Chapter) Descriptor() ([]byte, []int) { + return file_proto_sunnah_proto_rawDescGZIP(), []int{2} +} + +func (x *Chapter) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Chapter) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Chapter) GetBook() int32 { + if x != nil { + return x.Book + } + return 0 +} + +func (x *Chapter) GetTitle() string { + if x != nil { + return x.Title + } + return "" +} + +func (x *Chapter) GetArabicTitle() string { + if x != nil { + return x.ArabicTitle + } + return "" +} + +type Hadith struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // hadith id + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // the chapter id + Chapter int32 `protobuf:"varint,2,opt,name=chapter,proto3" json:"chapter,omitempty"` + // the chapter key + ChapterKey string `protobuf:"bytes,3,opt,name=chapter_key,json=chapterKey,proto3" json:"chapter_key,omitempty"` + // the chapter title + ChapterTitle string `protobuf:"bytes,4,opt,name=chapter_title,json=chapterTitle,proto3" json:"chapter_title,omitempty"` + // the arabic chapter title + ArabicChapterTitle string `protobuf:"bytes,5,opt,name=arabic_chapter_title,json=arabicChapterTitle,proto3" json:"arabic_chapter_title,omitempty"` + // hadith text + Text string `protobuf:"bytes,6,opt,name=text,proto3" json:"text,omitempty"` + // the arabic text + ArabicText string `protobuf:"bytes,7,opt,name=arabic_text,json=arabicText,proto3" json:"arabic_text,omitempty"` +} + +func (x *Hadith) Reset() { + *x = Hadith{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_sunnah_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Hadith) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Hadith) ProtoMessage() {} + +func (x *Hadith) ProtoReflect() protoreflect.Message { + mi := &file_proto_sunnah_proto_msgTypes[3] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use Hadith.ProtoReflect.Descriptor instead. +func (*Hadith) Descriptor() ([]byte, []int) { + return file_proto_sunnah_proto_rawDescGZIP(), []int{3} +} + +func (x *Hadith) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Hadith) GetChapter() int32 { + if x != nil { + return x.Chapter + } + return 0 +} + +func (x *Hadith) GetChapterKey() string { + if x != nil { + return x.ChapterKey + } + return "" +} + +func (x *Hadith) GetChapterTitle() string { + if x != nil { + return x.ChapterTitle + } + return "" +} + +func (x *Hadith) GetArabicChapterTitle() string { + if x != nil { + return x.ArabicChapterTitle + } + return "" +} + +func (x *Hadith) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +func (x *Hadith) GetArabicText() string { + if x != nil { + return x.ArabicText + } + return "" +} + +// Get a list of available collections. A collection is +// a compilation of hadiths collected and written by an author. +type CollectionsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The page in the pagination + Page int32 `protobuf:"varint,1,opt,name=page,proto3" json:"page,omitempty"` + // Number of collections to limit to + Limit int32 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"` +} + +func (x *CollectionsRequest) Reset() { + *x = CollectionsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_sunnah_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CollectionsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionsRequest) ProtoMessage() {} + +func (x *CollectionsRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_sunnah_proto_msgTypes[4] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionsRequest.ProtoReflect.Descriptor instead. +func (*CollectionsRequest) Descriptor() ([]byte, []int) { + return file_proto_sunnah_proto_rawDescGZIP(), []int{4} +} + +func (x *CollectionsRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *CollectionsRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +type CollectionsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Collections []*Collection `protobuf:"bytes,1,rep,name=collections,proto3" json:"collections,omitempty"` +} + +func (x *CollectionsResponse) Reset() { + *x = CollectionsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_sunnah_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *CollectionsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*CollectionsResponse) ProtoMessage() {} + +func (x *CollectionsResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_sunnah_proto_msgTypes[5] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use CollectionsResponse.ProtoReflect.Descriptor instead. +func (*CollectionsResponse) Descriptor() ([]byte, []int) { + return file_proto_sunnah_proto_rawDescGZIP(), []int{5} +} + +func (x *CollectionsResponse) GetCollections() []*Collection { + if x != nil { + return x.Collections + } + return nil +} + +// Get a list of books from within a collection. A book can contain many chapters +// each with its own hadiths. +type BooksRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name of the collection + Collection string `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty"` + // The page in the pagination + Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"` + // Limit the number of books returned + Limit int32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` +} + +func (x *BooksRequest) Reset() { + *x = BooksRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_sunnah_proto_msgTypes[6] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BooksRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BooksRequest) ProtoMessage() {} + +func (x *BooksRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_sunnah_proto_msgTypes[6] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BooksRequest.ProtoReflect.Descriptor instead. +func (*BooksRequest) Descriptor() ([]byte, []int) { + return file_proto_sunnah_proto_rawDescGZIP(), []int{6} +} + +func (x *BooksRequest) GetCollection() string { + if x != nil { + return x.Collection + } + return "" +} + +func (x *BooksRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *BooksRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +type BooksResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Name of the collection + Collection string `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty"` + // The total overall books + Total int32 `protobuf:"varint,2,opt,name=total,proto3" json:"total,omitempty"` + // The page requested + Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` + // The limit specified + Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` + // A list of books + Books []*Book `protobuf:"bytes,5,rep,name=books,proto3" json:"books,omitempty"` +} + +func (x *BooksResponse) Reset() { + *x = BooksResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_sunnah_proto_msgTypes[7] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *BooksResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*BooksResponse) ProtoMessage() {} + +func (x *BooksResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_sunnah_proto_msgTypes[7] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use BooksResponse.ProtoReflect.Descriptor instead. +func (*BooksResponse) Descriptor() ([]byte, []int) { + return file_proto_sunnah_proto_rawDescGZIP(), []int{7} +} + +func (x *BooksResponse) GetCollection() string { + if x != nil { + return x.Collection + } + return "" +} + +func (x *BooksResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *BooksResponse) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *BooksResponse) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *BooksResponse) GetBooks() []*Book { + if x != nil { + return x.Books + } + return nil +} + +// Get all the chapters of a given book within a collection. +type ChaptersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // name of the collection + Collection string `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty"` + // number of the book + Book int32 `protobuf:"varint,2,opt,name=book,proto3" json:"book,omitempty"` + // The page in the pagination + Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` + // Limit the number of chapters returned + Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` +} + +func (x *ChaptersRequest) Reset() { + *x = ChaptersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_sunnah_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChaptersRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChaptersRequest) ProtoMessage() {} + +func (x *ChaptersRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_sunnah_proto_msgTypes[8] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChaptersRequest.ProtoReflect.Descriptor instead. +func (*ChaptersRequest) Descriptor() ([]byte, []int) { + return file_proto_sunnah_proto_rawDescGZIP(), []int{8} +} + +func (x *ChaptersRequest) GetCollection() string { + if x != nil { + return x.Collection + } + return "" +} + +func (x *ChaptersRequest) GetBook() int32 { + if x != nil { + return x.Book + } + return 0 +} + +func (x *ChaptersRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *ChaptersRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +type ChaptersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // name of the collection + Collection string `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty"` + // number of the book + Book int32 `protobuf:"varint,2,opt,name=book,proto3" json:"book,omitempty"` + // The page in the pagination + Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` + // Limit the number of chapters returned + Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` + // Total chapters in the book + Total int32 `protobuf:"varint,5,opt,name=total,proto3" json:"total,omitempty"` + // The chapters of the book + Chapters []*Chapter `protobuf:"bytes,6,rep,name=chapters,proto3" json:"chapters,omitempty"` +} + +func (x *ChaptersResponse) Reset() { + *x = ChaptersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_sunnah_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *ChaptersResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*ChaptersResponse) ProtoMessage() {} + +func (x *ChaptersResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_sunnah_proto_msgTypes[9] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use ChaptersResponse.ProtoReflect.Descriptor instead. +func (*ChaptersResponse) Descriptor() ([]byte, []int) { + return file_proto_sunnah_proto_rawDescGZIP(), []int{9} +} + +func (x *ChaptersResponse) GetCollection() string { + if x != nil { + return x.Collection + } + return "" +} + +func (x *ChaptersResponse) GetBook() int32 { + if x != nil { + return x.Book + } + return 0 +} + +func (x *ChaptersResponse) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *ChaptersResponse) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *ChaptersResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *ChaptersResponse) GetChapters() []*Chapter { + if x != nil { + return x.Chapters + } + return nil +} + +// Hadiths returns a list of hadiths and their corresponding text for a +// given book within a collection. +type HadithsRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // name of the collection + Collection string `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty"` + // number of the book + Book int32 `protobuf:"varint,2,opt,name=book,proto3" json:"book,omitempty"` + // The page in the pagination + Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` + // Limit the number of hadiths + Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` +} + +func (x *HadithsRequest) Reset() { + *x = HadithsRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_sunnah_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HadithsRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HadithsRequest) ProtoMessage() {} + +func (x *HadithsRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_sunnah_proto_msgTypes[10] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HadithsRequest.ProtoReflect.Descriptor instead. +func (*HadithsRequest) Descriptor() ([]byte, []int) { + return file_proto_sunnah_proto_rawDescGZIP(), []int{10} +} + +func (x *HadithsRequest) GetCollection() string { + if x != nil { + return x.Collection + } + return "" +} + +func (x *HadithsRequest) GetBook() int32 { + if x != nil { + return x.Book + } + return 0 +} + +func (x *HadithsRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *HadithsRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +type HadithsResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // name of the collection + Collection string `protobuf:"bytes,1,opt,name=collection,proto3" json:"collection,omitempty"` + // number of the book + Book int32 `protobuf:"varint,2,opt,name=book,proto3" json:"book,omitempty"` + // The page in the pagination + Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` + // Limit the number of hadiths returned + Limit int32 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"` + // Total hadiths in the book + Total int32 `protobuf:"varint,5,opt,name=total,proto3" json:"total,omitempty"` + // The hadiths of the book + Hadiths []*Hadith `protobuf:"bytes,7,rep,name=hadiths,proto3" json:"hadiths,omitempty"` +} + +func (x *HadithsResponse) Reset() { + *x = HadithsResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_sunnah_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *HadithsResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*HadithsResponse) ProtoMessage() {} + +func (x *HadithsResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_sunnah_proto_msgTypes[11] + if protoimpl.UnsafeEnabled && x != nil { + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + if ms.LoadMessageInfo() == nil { + ms.StoreMessageInfo(mi) + } + return ms + } + return mi.MessageOf(x) +} + +// Deprecated: Use HadithsResponse.ProtoReflect.Descriptor instead. +func (*HadithsResponse) Descriptor() ([]byte, []int) { + return file_proto_sunnah_proto_rawDescGZIP(), []int{11} +} + +func (x *HadithsResponse) GetCollection() string { + if x != nil { + return x.Collection + } + return "" +} + +func (x *HadithsResponse) GetBook() int32 { + if x != nil { + return x.Book + } + return 0 +} + +func (x *HadithsResponse) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *HadithsResponse) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *HadithsResponse) GetTotal() int32 { + if x != nil { + return x.Total + } + return 0 +} + +func (x *HadithsResponse) GetHadiths() []*Hadith { + if x != nil { + return x.Hadiths + } + return nil +} + +var File_proto_sunnah_proto protoreflect.FileDescriptor + +var file_proto_sunnah_proto_rawDesc = []byte{ + 0x0a, 0x12, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x73, 0x75, 0x6e, 0x6e, 0x61, 0x68, 0x2e, 0x70, + 0x72, 0x6f, 0x74, 0x6f, 0x12, 0x06, 0x73, 0x75, 0x6e, 0x6e, 0x61, 0x68, 0x22, 0x8d, 0x01, 0x0a, + 0x0a, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, + 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x72, 0x61, 0x62, 0x69, 0x63, 0x5f, + 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x61, 0x72, 0x61, + 0x62, 0x69, 0x63, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x73, 0x75, 0x6d, 0x6d, + 0x61, 0x72, 0x79, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, 0x6d, 0x6d, 0x61, + 0x72, 0x79, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x61, 0x64, 0x69, 0x74, 0x68, 0x73, 0x18, 0x05, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x07, 0x68, 0x61, 0x64, 0x69, 0x74, 0x68, 0x73, 0x22, 0x65, 0x0a, 0x04, + 0x42, 0x6f, 0x6f, 0x6b, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x02, 0x69, 0x64, 0x12, 0x12, 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x02, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x61, 0x72, 0x61, 0x62, + 0x69, 0x63, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, + 0x72, 0x61, 0x62, 0x69, 0x63, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x68, 0x61, 0x64, + 0x69, 0x74, 0x68, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x68, 0x61, 0x64, 0x69, + 0x74, 0x68, 0x73, 0x22, 0x78, 0x0a, 0x07, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x10, + 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, + 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, + 0x62, 0x6f, 0x6f, 0x6b, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x04, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x05, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x61, 0x72, + 0x61, 0x62, 0x69, 0x63, 0x5f, 0x74, 0x69, 0x74, 0x6c, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0b, 0x61, 0x72, 0x61, 0x62, 0x69, 0x63, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x22, 0xdf, 0x01, + 0x0a, 0x06, 0x48, 0x61, 0x64, 0x69, 0x74, 0x68, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x70, + 0x74, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x68, 0x61, 0x70, 0x74, + 0x65, 0x72, 0x12, 0x1f, 0x0a, 0x0b, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x5f, 0x6b, 0x65, + 0x79, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, + 0x4b, 0x65, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x5f, 0x74, + 0x69, 0x74, 0x6c, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0c, 0x63, 0x68, 0x61, 0x70, + 0x74, 0x65, 0x72, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x30, 0x0a, 0x14, 0x61, 0x72, 0x61, 0x62, + 0x69, 0x63, 0x5f, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x5f, 0x74, 0x69, 0x74, 0x6c, 0x65, + 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x12, 0x61, 0x72, 0x61, 0x62, 0x69, 0x63, 0x43, 0x68, + 0x61, 0x70, 0x74, 0x65, 0x72, 0x54, 0x69, 0x74, 0x6c, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, + 0x78, 0x74, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x1f, + 0x0a, 0x0b, 0x61, 0x72, 0x61, 0x62, 0x69, 0x63, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x18, 0x07, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x72, 0x61, 0x62, 0x69, 0x63, 0x54, 0x65, 0x78, 0x74, 0x22, + 0x3e, 0x0a, 0x12, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, + 0x69, 0x74, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, + 0x4b, 0x0a, 0x13, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, + 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x34, 0x0a, 0x0b, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x73, 0x75, + 0x6e, 0x6e, 0x61, 0x68, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x0b, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x58, 0x0a, 0x0c, + 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, + 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, + 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, + 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x93, 0x01, 0x0a, 0x0d, 0x42, 0x6f, 0x6f, 0x6b, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, + 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, + 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x12, + 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, + 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x22, 0x0a, 0x05, 0x62, 0x6f, 0x6f, 0x6b, + 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x73, 0x75, 0x6e, 0x6e, 0x61, 0x68, + 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x52, 0x05, 0x62, 0x6f, 0x6f, 0x6b, 0x73, 0x22, 0x6f, 0x0a, 0x0f, + 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, + 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x62, + 0x6f, 0x6f, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0xb3, 0x01, + 0x0a, 0x10, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, + 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, + 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, + 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x2b, 0x0a, 0x08, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, + 0x72, 0x73, 0x18, 0x06, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0f, 0x2e, 0x73, 0x75, 0x6e, 0x6e, 0x61, + 0x68, 0x2e, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x08, 0x63, 0x68, 0x61, 0x70, 0x74, + 0x65, 0x72, 0x73, 0x22, 0x6e, 0x0a, 0x0e, 0x48, 0x61, 0x64, 0x69, 0x74, 0x68, 0x73, 0x52, 0x65, + 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x05, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, + 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x6c, 0x69, + 0x6d, 0x69, 0x74, 0x22, 0xaf, 0x01, 0x0a, 0x0f, 0x48, 0x61, 0x64, 0x69, 0x74, 0x68, 0x73, 0x52, + 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x1e, 0x0a, 0x0a, 0x63, 0x6f, 0x6c, 0x6c, 0x65, + 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x63, 0x6f, 0x6c, + 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x12, 0x0a, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x62, 0x6f, 0x6f, 0x6b, 0x12, 0x12, 0x0a, 0x04, 0x70, + 0x61, 0x67, 0x65, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x12, 0x14, 0x0a, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x18, 0x05, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x12, 0x28, 0x0a, 0x07, 0x68, + 0x61, 0x64, 0x69, 0x74, 0x68, 0x73, 0x18, 0x07, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x73, + 0x75, 0x6e, 0x6e, 0x61, 0x68, 0x2e, 0x48, 0x61, 0x64, 0x69, 0x74, 0x68, 0x52, 0x07, 0x68, 0x61, + 0x64, 0x69, 0x74, 0x68, 0x73, 0x32, 0x89, 0x02, 0x0a, 0x06, 0x53, 0x75, 0x6e, 0x6e, 0x61, 0x68, + 0x12, 0x48, 0x0a, 0x0b, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, + 0x1a, 0x2e, 0x73, 0x75, 0x6e, 0x6e, 0x61, 0x68, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, + 0x69, 0x6f, 0x6e, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x1b, 0x2e, 0x73, 0x75, + 0x6e, 0x6e, 0x61, 0x68, 0x2e, 0x43, 0x6f, 0x6c, 0x6c, 0x65, 0x63, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x36, 0x0a, 0x05, 0x42, 0x6f, + 0x6f, 0x6b, 0x73, 0x12, 0x14, 0x2e, 0x73, 0x75, 0x6e, 0x6e, 0x61, 0x68, 0x2e, 0x42, 0x6f, 0x6f, + 0x6b, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x73, 0x75, 0x6e, 0x6e, + 0x61, 0x68, 0x2e, 0x42, 0x6f, 0x6f, 0x6b, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, + 0x22, 0x00, 0x12, 0x3f, 0x0a, 0x08, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x12, 0x17, + 0x2e, 0x73, 0x75, 0x6e, 0x6e, 0x61, 0x68, 0x2e, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, + 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x18, 0x2e, 0x73, 0x75, 0x6e, 0x6e, 0x61, 0x68, + 0x2e, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x22, 0x00, 0x12, 0x3c, 0x0a, 0x07, 0x48, 0x61, 0x64, 0x69, 0x74, 0x68, 0x73, 0x12, 0x16, + 0x2e, 0x73, 0x75, 0x6e, 0x6e, 0x61, 0x68, 0x2e, 0x48, 0x61, 0x64, 0x69, 0x74, 0x68, 0x73, 0x52, + 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x73, 0x75, 0x6e, 0x6e, 0x61, 0x68, 0x2e, + 0x48, 0x61, 0x64, 0x69, 0x74, 0x68, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, + 0x00, 0x42, 0x10, 0x5a, 0x0e, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x73, 0x75, 0x6e, + 0x6e, 0x61, 0x68, 0x62, 0x06, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_sunnah_proto_rawDescOnce sync.Once + file_proto_sunnah_proto_rawDescData = file_proto_sunnah_proto_rawDesc +) + +func file_proto_sunnah_proto_rawDescGZIP() []byte { + file_proto_sunnah_proto_rawDescOnce.Do(func() { + file_proto_sunnah_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_sunnah_proto_rawDescData) + }) + return file_proto_sunnah_proto_rawDescData +} + +var file_proto_sunnah_proto_msgTypes = make([]protoimpl.MessageInfo, 12) +var file_proto_sunnah_proto_goTypes = []interface{}{ + (*Collection)(nil), // 0: sunnah.Collection + (*Book)(nil), // 1: sunnah.Book + (*Chapter)(nil), // 2: sunnah.Chapter + (*Hadith)(nil), // 3: sunnah.Hadith + (*CollectionsRequest)(nil), // 4: sunnah.CollectionsRequest + (*CollectionsResponse)(nil), // 5: sunnah.CollectionsResponse + (*BooksRequest)(nil), // 6: sunnah.BooksRequest + (*BooksResponse)(nil), // 7: sunnah.BooksResponse + (*ChaptersRequest)(nil), // 8: sunnah.ChaptersRequest + (*ChaptersResponse)(nil), // 9: sunnah.ChaptersResponse + (*HadithsRequest)(nil), // 10: sunnah.HadithsRequest + (*HadithsResponse)(nil), // 11: sunnah.HadithsResponse +} +var file_proto_sunnah_proto_depIdxs = []int32{ + 0, // 0: sunnah.CollectionsResponse.collections:type_name -> sunnah.Collection + 1, // 1: sunnah.BooksResponse.books:type_name -> sunnah.Book + 2, // 2: sunnah.ChaptersResponse.chapters:type_name -> sunnah.Chapter + 3, // 3: sunnah.HadithsResponse.hadiths:type_name -> sunnah.Hadith + 4, // 4: sunnah.Sunnah.Collections:input_type -> sunnah.CollectionsRequest + 6, // 5: sunnah.Sunnah.Books:input_type -> sunnah.BooksRequest + 8, // 6: sunnah.Sunnah.Chapters:input_type -> sunnah.ChaptersRequest + 10, // 7: sunnah.Sunnah.Hadiths:input_type -> sunnah.HadithsRequest + 5, // 8: sunnah.Sunnah.Collections:output_type -> sunnah.CollectionsResponse + 7, // 9: sunnah.Sunnah.Books:output_type -> sunnah.BooksResponse + 9, // 10: sunnah.Sunnah.Chapters:output_type -> sunnah.ChaptersResponse + 11, // 11: sunnah.Sunnah.Hadiths:output_type -> sunnah.HadithsResponse + 8, // [8:12] is the sub-list for method output_type + 4, // [4:8] is the sub-list for method input_type + 4, // [4:4] is the sub-list for extension type_name + 4, // [4:4] is the sub-list for extension extendee + 0, // [0:4] is the sub-list for field type_name +} + +func init() { file_proto_sunnah_proto_init() } +func file_proto_sunnah_proto_init() { + if File_proto_sunnah_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_sunnah_proto_msgTypes[0].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Collection); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_sunnah_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Book); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_sunnah_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Chapter); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_sunnah_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Hadith); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_sunnah_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CollectionsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_sunnah_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*CollectionsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_sunnah_proto_msgTypes[6].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BooksRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_sunnah_proto_msgTypes[7].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*BooksResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_sunnah_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChaptersRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_sunnah_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*ChaptersResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_sunnah_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HadithsRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_sunnah_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*HadithsResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + } + type x struct{} + out := protoimpl.TypeBuilder{ + File: protoimpl.DescBuilder{ + GoPackagePath: reflect.TypeOf(x{}).PkgPath(), + RawDescriptor: file_proto_sunnah_proto_rawDesc, + NumEnums: 0, + NumMessages: 12, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_sunnah_proto_goTypes, + DependencyIndexes: file_proto_sunnah_proto_depIdxs, + MessageInfos: file_proto_sunnah_proto_msgTypes, + }.Build() + File_proto_sunnah_proto = out.File + file_proto_sunnah_proto_rawDesc = nil + file_proto_sunnah_proto_goTypes = nil + file_proto_sunnah_proto_depIdxs = nil +} diff --git a/sunnah/proto/sunnah.pb.micro.go b/sunnah/proto/sunnah.pb.micro.go new file mode 100644 index 0000000..7f284fe --- /dev/null +++ b/sunnah/proto/sunnah.pb.micro.go @@ -0,0 +1,144 @@ +// Code generated by protoc-gen-micro. DO NOT EDIT. +// source: proto/sunnah.proto + +package sunnah + +import ( + fmt "fmt" + proto "github.com/golang/protobuf/proto" + math "math" +) + +import ( + context "context" + api "github.com/micro/micro/v3/service/api" + client "github.com/micro/micro/v3/service/client" + server "github.com/micro/micro/v3/service/server" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +// A compilation error at this line likely means your copy of the +// proto package needs to be updated. +const _ = proto.ProtoPackageIsVersion3 // please upgrade the proto package + +// Reference imports to suppress errors if they are not otherwise used. +var _ api.Endpoint +var _ context.Context +var _ client.Option +var _ server.Option + +// Api Endpoints for Sunnah service + +func NewSunnahEndpoints() []*api.Endpoint { + return []*api.Endpoint{} +} + +// Client API for Sunnah service + +type SunnahService interface { + Collections(ctx context.Context, in *CollectionsRequest, opts ...client.CallOption) (*CollectionsResponse, error) + Books(ctx context.Context, in *BooksRequest, opts ...client.CallOption) (*BooksResponse, error) + Chapters(ctx context.Context, in *ChaptersRequest, opts ...client.CallOption) (*ChaptersResponse, error) + Hadiths(ctx context.Context, in *HadithsRequest, opts ...client.CallOption) (*HadithsResponse, error) +} + +type sunnahService struct { + c client.Client + name string +} + +func NewSunnahService(name string, c client.Client) SunnahService { + return &sunnahService{ + c: c, + name: name, + } +} + +func (c *sunnahService) Collections(ctx context.Context, in *CollectionsRequest, opts ...client.CallOption) (*CollectionsResponse, error) { + req := c.c.NewRequest(c.name, "Sunnah.Collections", in) + out := new(CollectionsResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sunnahService) Books(ctx context.Context, in *BooksRequest, opts ...client.CallOption) (*BooksResponse, error) { + req := c.c.NewRequest(c.name, "Sunnah.Books", in) + out := new(BooksResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sunnahService) Chapters(ctx context.Context, in *ChaptersRequest, opts ...client.CallOption) (*ChaptersResponse, error) { + req := c.c.NewRequest(c.name, "Sunnah.Chapters", in) + out := new(ChaptersResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *sunnahService) Hadiths(ctx context.Context, in *HadithsRequest, opts ...client.CallOption) (*HadithsResponse, error) { + req := c.c.NewRequest(c.name, "Sunnah.Hadiths", in) + out := new(HadithsResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Sunnah service + +type SunnahHandler interface { + Collections(context.Context, *CollectionsRequest, *CollectionsResponse) error + Books(context.Context, *BooksRequest, *BooksResponse) error + Chapters(context.Context, *ChaptersRequest, *ChaptersResponse) error + Hadiths(context.Context, *HadithsRequest, *HadithsResponse) error +} + +func RegisterSunnahHandler(s server.Server, hdlr SunnahHandler, opts ...server.HandlerOption) error { + type sunnah interface { + Collections(ctx context.Context, in *CollectionsRequest, out *CollectionsResponse) error + Books(ctx context.Context, in *BooksRequest, out *BooksResponse) error + Chapters(ctx context.Context, in *ChaptersRequest, out *ChaptersResponse) error + Hadiths(ctx context.Context, in *HadithsRequest, out *HadithsResponse) error + } + type Sunnah struct { + sunnah + } + h := &sunnahHandler{hdlr} + return s.Handle(s.NewHandler(&Sunnah{h}, opts...)) +} + +type sunnahHandler struct { + SunnahHandler +} + +func (h *sunnahHandler) Collections(ctx context.Context, in *CollectionsRequest, out *CollectionsResponse) error { + return h.SunnahHandler.Collections(ctx, in, out) +} + +func (h *sunnahHandler) Books(ctx context.Context, in *BooksRequest, out *BooksResponse) error { + return h.SunnahHandler.Books(ctx, in, out) +} + +func (h *sunnahHandler) Chapters(ctx context.Context, in *ChaptersRequest, out *ChaptersResponse) error { + return h.SunnahHandler.Chapters(ctx, in, out) +} + +func (h *sunnahHandler) Hadiths(ctx context.Context, in *HadithsRequest, out *HadithsResponse) error { + return h.SunnahHandler.Hadiths(ctx, in, out) +} diff --git a/sunnah/proto/sunnah.proto b/sunnah/proto/sunnah.proto new file mode 100644 index 0000000..8f9ae5f --- /dev/null +++ b/sunnah/proto/sunnah.proto @@ -0,0 +1,158 @@ +syntax = "proto3"; + +package sunnah; + +option go_package = "./proto;sunnah"; + +service Sunnah { + rpc Collections(CollectionsRequest) returns (CollectionsResponse) {} + rpc Books(BooksRequest) returns (BooksResponse) {} + rpc Chapters(ChaptersRequest) returns (ChaptersResponse) {} + rpc Hadiths(HadithsRequest) returns (HadithsResponse) {} +} + +message Collection { + // Name of the collection e.g bukhari + string name = 1; + // Title of the collection e.g Sahih al-Bukhari + string title = 2; + // Arabic title if available + string arabic_title = 3; + // An introduction explaining the collection + string summary = 4; + // Total hadiths in the collection + int32 hadiths = 5; +} + +message Book { + // number of the book e.g 1 + int32 id = 1; + // name of the book + string name = 2; + // arabic name of the book + string arabic_name = 3; + // number of hadiths in the book + int32 hadiths = 4; +} + +message Chapter { + // the chapter id e.g 1 + int32 id = 1; + // the chapter key e.g 1.00 + string key = 2; + // the book number + int32 book = 3; + // title of the chapter + string title = 4; + // arabic title + string arabic_title = 5; +} + +message Hadith { + // hadith id + int32 id = 1; + // the chapter id + int32 chapter = 2; + // the chapter key + string chapter_key = 3; + // the chapter title + string chapter_title = 4; + // the arabic chapter title + string arabic_chapter_title = 5; + // hadith text + string text = 6; + // the arabic text + string arabic_text = 7; +} + +// Get a list of available collections. A collection is +// a compilation of hadiths collected and written by an author. +message CollectionsRequest { + // The page in the pagination + int32 page = 1; + // Number of collections to limit to + int32 limit = 2; +} + +message CollectionsResponse { + repeated Collection collections = 1; +} + +// Get a list of books from within a collection. A book can contain many chapters +// each with its own hadiths. +message BooksRequest { + // Name of the collection + string collection = 1; + // The page in the pagination + int32 page = 2; + // Limit the number of books returned + int32 limit = 3; +} + +message BooksResponse { + // Name of the collection + string collection = 1; + // The total overall books + int32 total = 2; + // The page requested + int32 page = 3; + // The limit specified + int32 limit = 4; + // A list of books + repeated Book books = 5; +} + +// Get all the chapters of a given book within a collection. +message ChaptersRequest { + // name of the collection + string collection = 1; + // number of the book + int32 book = 2; + // The page in the pagination + int32 page = 3; + // Limit the number of chapters returned + int32 limit = 4; +} + +message ChaptersResponse { + // name of the collection + string collection = 1; + // number of the book + int32 book = 2; + // The page in the pagination + int32 page = 3; + // Limit the number of chapters returned + int32 limit = 4; + // Total chapters in the book + int32 total = 5; + // The chapters of the book + repeated Chapter chapters = 6; +} + +// Hadiths returns a list of hadiths and their corresponding text for a +// given book within a collection. +message HadithsRequest { + // name of the collection + string collection = 1; + // number of the book + int32 book = 2; + // The page in the pagination + int32 page = 3; + // Limit the number of hadiths + int32 limit = 4; +} + +message HadithsResponse { + // name of the collection + string collection = 1; + // number of the book + int32 book = 2; + // The page in the pagination + int32 page = 3; + // Limit the number of hadiths returned + int32 limit = 4; + // Total hadiths in the book + int32 total = 5; + // The hadiths of the book + repeated Hadith hadiths = 7; +} diff --git a/sunnah/publicapi.json b/sunnah/publicapi.json new file mode 100644 index 0000000..ea2425c --- /dev/null +++ b/sunnah/publicapi.json @@ -0,0 +1,5 @@ +{ + "name": "sunnah", + "icon": "📖", + "category": "religion" +}