From f0542b1a6a361480542b0173b134b3bc709cc8cb Mon Sep 17 00:00:00 2001 From: Asim Aslam Date: Tue, 14 Sep 2021 18:45:22 +0100 Subject: [PATCH] Quran API (#205) * Add basic version of a Quran API * remove examples json swp * fix search translation * add examples json --- quran/.gitignore | 2 + quran/Dockerfile | 3 + quran/Makefile | 28 + quran/README.md | 6 + quran/domain/domain.go | 206 +++++ quran/examples.json | 142 +++ quran/generate.go | 3 + quran/handler/quran.go | 197 ++++ quran/main.go | 25 + quran/micro.mu | 1 + quran/proto/quran.pb.go | 1577 +++++++++++++++++++++++++++++++++ quran/proto/quran.pb.micro.go | 144 +++ quran/proto/quran.proto | 191 ++++ quran/publicapi.json | 5 + 14 files changed, 2530 insertions(+) create mode 100644 quran/.gitignore create mode 100644 quran/Dockerfile create mode 100644 quran/Makefile create mode 100644 quran/README.md create mode 100644 quran/domain/domain.go create mode 100644 quran/examples.json create mode 100644 quran/generate.go create mode 100644 quran/handler/quran.go create mode 100644 quran/main.go create mode 100644 quran/micro.mu create mode 100644 quran/proto/quran.pb.go create mode 100644 quran/proto/quran.pb.micro.go create mode 100644 quran/proto/quran.proto create mode 100644 quran/publicapi.json diff --git a/quran/.gitignore b/quran/.gitignore new file mode 100644 index 0000000..fe1cea0 --- /dev/null +++ b/quran/.gitignore @@ -0,0 +1,2 @@ + +quran diff --git a/quran/Dockerfile b/quran/Dockerfile new file mode 100644 index 0000000..6b9bbb9 --- /dev/null +++ b/quran/Dockerfile @@ -0,0 +1,3 @@ +FROM alpine +ADD quran /quran +ENTRYPOINT [ "/quran" ] diff --git a/quran/Makefile b/quran/Makefile new file mode 100644 index 0000000..768031b --- /dev/null +++ b/quran/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/quran.proto + +.PHONY: proto +proto: + protoc --proto_path=. --micro_out=. --go_out=:. proto/quran.proto + +.PHONY: build +build: + go build -o quran *.go + +.PHONY: test +test: + go test -v ./... -cover + +.PHONY: docker +docker: + docker build . -t quran:latest diff --git a/quran/README.md b/quran/README.md new file mode 100644 index 0000000..2d64cfe --- /dev/null +++ b/quran/README.md @@ -0,0 +1,6 @@ +The Holy Quran + +# Quran Service + +The Holy Quran powered by [Quran.com](https://quran.api-docs.io) + diff --git a/quran/domain/domain.go b/quran/domain/domain.go new file mode 100644 index 0000000..dfc7286 --- /dev/null +++ b/quran/domain/domain.go @@ -0,0 +1,206 @@ +package domain + +import ( + "strings" + + pb "github.com/micro/services/quran/proto" +) + +var ( + // the default tafsir author + tafsir = map[int32]string{ + 169: "Tafsir Ibn Kathir", + } +) + +type Chapter struct { + Id int32 `json:"id"` + RevelationPlace string `json:"revelation_place"` + RevelationOrder int32 `json:"revelation_order"` + BismillahPrefix bool `json:"bismillah_pre"` + NameSimple string `json:"name_simple"` + NameComplex string `json:"name_complex"` + NameArabic string `json:"name_arabic"` + VersesCount int32 `json:"verses_count"` + Pages []int32 `json:"pages"` + TranslatedName *TranslatedName `json:"translated_name"` +} + +type TranslatedName struct { + LanguageName string `json:"language_name"` + Name string `json:"name"` +} + +type TranslationText struct { + Id int32 `json:"id"` + ResourceId int32 `json:"resource_id"` + Text string `json:"text"` + ResourceName string `json:"resource_name"` +} + +type Translation struct { + Text string `json:"text"` + LanguageName string `json:"language_name"` +} + +type Transliteration struct { + Text string `json:"text"` + LanguageName string `json:"language_name"` +} + +type Tafsir struct { + Id int32 `json:"id"` + ResourceId int32 `json:"resource_id"` + Text string `json:"text"` +} + +type ChapterInfo struct { + Id int32 `json:"id"` + ChapterId int32 `json:"chapter_id"` + LanguageName string `json:"language_name"` + ShortText string `json:"short_text"` + Source string `json:"source"` + Text string `json:"text"` +} + +type Pagination struct { + PerPage int32 `json:"per_page"` + CurrentPage int32 `json:"current_page"` + NextPage int32 `json:"next_page"` + TotalPages int32 `json:"total_pages"` + TotalRecords int32 `json:"total_records"` +} + +type Verse struct { + Id int32 `json:"id"` + VerseNumber int32 `json:"verse_number"` + VerseKey string `json:"verse_key"` + JuzNumber int32 `json:"juz_number"` + HizbNumber int32 `json:"hizb_number"` + RubNumber int32 `json:"rub_number"` + PageNumber int32 `json:"page_number"` + Translations []*TranslationText `json:"translations"` + Tafsirs []*Tafsir `json:"tafsirs"` + Words []*Word `json:"words"` + TextImlaei string `json:"text_imlaei"` +} + +type Word struct { + Id int32 `json:"id"` + Position int32 `json:"position"` + AudioUrl string `json:"audio_url"` + CharTypeName string `json:"char_type_name"` + CodeV1 string `json:"code_v1"` + PageNumber int32 `json:"page_number"` + LineNumber int32 `json:"line_number"` + Text string `json:"text_imlaei"` + Code string `json:"code_v2"` + Translation *Translation `json:"translation"` + Transliteration *Translation `json:"transliteration"` +} + +type Result struct { + VerseId int32 `json:"verse_id"` + VerseKey string `json:"verse_key"` + Text string `json:"text"` + Translations []*SearchTranslation `json:"translations"` +} + +type SearchResults struct { + Query string `json:"query"` + TotalResults int32 `json:"total_results"` + CurrentPage int32 `json:"current_page"` + TotalPages int32 `json:"total_pages"` + Results []*Result `json:"results"` +} + +type SearchTranslation struct { + ResourceId int32 `json:"resource_id"` + Text string `json:"text"` + Name string `json:"name"` +} + +type VersesByChapter struct { + Pagination *Pagination `json:"pagination"` + Verses []*Verse `json:"verses"` +} + +func VerseToProto(verse *Verse) *pb.Verse { + var transliteration []string + var translation []string + var words []*pb.Word + + for _, word := range verse.Words { + words = append(words, &pb.Word{ + Id: word.Id, + Position: word.Position, + CharType: word.CharTypeName, + Page: word.PageNumber, + Line: word.LineNumber, + Text: word.Text, + Code: word.Code, + Translation: word.Translation.Text, + Transliteration: word.Transliteration.Text, + }) + + // skip the end + if word.CharTypeName == "end" { + continue + } + + translation = append(translation, word.Translation.Text) + transliteration = append(transliteration, word.Transliteration.Text) + } + + var translations []*pb.Translation + + for _, tr := range verse.Translations { + translations = append(translations, &pb.Translation{ + Id: tr.Id, + Source: tr.ResourceName, + Text: tr.Text, + }) + } + + var interpretations []*pb.Interpretation + + for _, tf := range verse.Tafsirs { + interpretations = append(interpretations, &pb.Interpretation{ + Id: tf.Id, + Source: tafsir[tf.ResourceId], + Text: tf.Text, + }) + } + + return &pb.Verse{ + Id: verse.Id, + Key: verse.VerseKey, + Number: verse.VerseNumber, + Page: verse.PageNumber, + Text: verse.TextImlaei, + TranslatedText: strings.Join(translation, " "), + Transliteration: strings.Join(transliteration, " "), + Words: words, + Translations: translations, + Interpretations: interpretations, + } +} + +func ResultToProto(r *Result) *pb.Result { + var translations []*pb.Translation + + for _, tr := range r.Translations { + translations = append(translations, &pb.Translation{ + Id: tr.ResourceId, + Source: tr.Name, + Text: tr.Text, + }) + } + + return &pb.Result{ + VerseKey: r.VerseKey, + VerseId: r.VerseId, + Text: r.Text, + Translations: translations, + } +} diff --git a/quran/examples.json b/quran/examples.json new file mode 100644 index 0000000..1f12db6 --- /dev/null +++ b/quran/examples.json @@ -0,0 +1,142 @@ +{ + "chapters": [{ + "title": "List Chapters", + "run_check": false, + "request": { + "language": "en" + }, + "response": { + "chapters": [{ + "id": 1, + "verses": 7, + "name": "Al-Fatihah", + "arabic_name": "الفاتحة", + "complex_name": "Al-Fātiĥah", + "translated_name": "The Opener", + "prefix_bismillah": false, + "revelation_place": "makkah", + "revelation_order": 5, + "pages": [ + 1, + 1 + ] + }, + { + "id": 2, + "verses": 286, + "name": "Al-Baqarah", + "arabic_name": "البقرة", + "complex_name": "Al-Baqarah", + "translated_name": "The Cow", + "prefix_bismillah": true, + "revelation_place": "madinah", + "revelation_order": 87, + "pages": [ + 2, + 49 + ] + }, + { + "id": 3, + "verses": 200, + "name": "Ali 'Imran", + "arabic_name": "آل عمران", + "complex_name": "Āli `Imrān", + "translated_name": "Family of Imran", + "prefix_bismillah": true, + "revelation_place": "madinah", + "revelation_order": 89, + "pages": [ + 50, + 76 + ] + }] + } + }], + "summary": [{ + "title": "Get chapter summary", + "run_check": false, + "request": { + "chapter": 1 + }, + "response": { + "chapter": 1, + "summary": "This Surah is named Al-Fatihah because of its subject matter. Fatihah is that which opens a subject or a book or any other thing. In other words, Al-Fatihah is a sort of preface.", + "source": "Sayyid Abul Ala Maududi - Tafhim al-Qur'an - The Meaning of the Quran", + "text": "\u003ch2\u003eName\u003c/h2\u003e\u003cp\u003eThis Surah is named Al-Fatihah because of its subject matter. Fatihah is that which opens a subject or a book or any other thing. In other words, Al-Fatihah is a sort of preface.\u003c/p\u003e\u003ch2\u003ePeriod of Revelation\u003c/h2\u003e\u003cp\u003eSurah Al-Fatihah is one of the very earliest Revelations to the Holy Prophet. As a matter of fact, we learn from authentic traditions that it was the first complete Surah that was revealed to Muhammad (Allah's peace be upon him). Before this, only a few miscellaneous verses were revealed which form parts of Alaq, Muzzammil, Muddaththir, etc.\u003c/p\u003e\u003ch2\u003eTheme\u003c/h2\u003e\u003cp\u003eThis Surah is in fact a prayer that Allah has taught to all those who want to make a study of His book. It has been placed at the very beginning of the Quran to teach this lesson to the reader: if you sincerely want to benefit from the Quran, you should offer this prayer to the Lord of the Universe.\u003c/p\u003e\u003cp\u003eThis preface is meant to create a strong desire in the heart of the reader to seek guidance from the Lord of the Universe Who alone can grant it. Thus Al-Fatihah indirectly teaches that the best thing for a man is to pray for guidance to the straight path, to study the Quran with the mental attitude of a seeker searching for the truth, and to recognize the fact that the Lord of the Universe is the source of all knowledge. He should, therefore, begin the study of the Quran with a prayer to Him for guidance.\u003c/p\u003e\u003cp\u003eFrom this theme, it becomes clear that the real relation between Al-Fatihah and the Quran is not that of an introduction to a book but that of a prayer and its answer. Al-Fatihah is the prayer from the servant and the Quran is the answer from the Master to the servant's prayer. The servant prays to Allah to show him guidance and the Master places the whole of the Quran before him in answer to his prayer, as if to say, \"This is the Guidance you begged from Me.\"\u003c/p\u003e" + } + }], + "verses": [{ + "title": "Get verses of a chapter", + "run_check": false, + "request": { + "chapter": 1 + }, + "response": { + "chapter": 1, + "page": 1, + "total_pages": 1, + "verses": [{ + "id": 1, + "number": 1, + "key": "1:1", + "page": 1, + "text": "بِسْمِ اللَّهِ الرَّحْمَٰنِ الرَّحِيمِ", + "transliteration": "bis'mi l-lahi l-raḥmāni l-raḥīmi", + "translated_text": "In (the) name (of) Allah the Most Gracious the Most Merciful", + "translations": [], + "interpretations": [], + "words": [] + }, + { + "id": 2, + "number": 2, + "key": "1:2", + "page": 1, + "text": "الْحَمْدُ لِلَّهِ رَبِّ الْعَالَمِينَ", + "transliteration": "al-ḥamdu lillahi rabbi l-ʿālamīna", + "translated_text": "All praises and thanks (be) to Allah the Lord of the universe", + "translations": [], + "interpretations": [], + "words": [] + }, + { + "id": 3, + "number": 3, + "key": "1:3", + "page": 1, + "text": "الرَّحْمَٰنِ الرَّحِيمِ", + "transliteration": "al-raḥmāni l-raḥīmi", + "translated_text": "The Most Gracious the Most Merciful", + "translations": [], + "interpretations": [], + "words": [] + }] + } + }], + "search": [{ + "title": "Search the Quran", + "run_check": false, + "request": { + "query": "messenger" + }, + "response": { + "query": "messenger", + "total_results": 5756, + "page": 1, + "total_pages": 288, + "results": [{ + "verse_id": 4211, + "verse_key": "40:78", + "text": "وَلَقَدْ أَرْسَلْنَا رُسُلًا مِّن قَبْلِكَ مِنْهُم مَّن قَصَصْنَا عَلَيْكَ وَمِنْهُم مَّن لَّمْ نَقْصُصْ عَلَيْكَ ۗ وَمَا كَانَ لِرَسُولٍ أَن يَأْتِىَ بِـَٔايَةٍ إِلَّا بِإِذْنِ ٱللَّهِ ۚ فَإِذَا جَآءَ أَمْرُ ٱللَّهِ قُضِىَ بِٱلْحَقِّ وَخَسِرَ هُنَالِكَ ٱلْمُبْطِلُونَ", + "translations": [ + { + "id": 171, + "source": "Abridged Explanation of the Quran", + "text": "O \u003cem\u003eMessenger\u003c/em\u003e! I have sent many \u003cem\u003emessengers\u003c/em\u003e before you to their people, but they rejected them and caused them harm. The \u003cem\u003emessengers\u003c/em\u003e were patient upon the rejection and harm they faced. From among these \u003cem\u003emessengers\u003c/em\u003e are those whom I have related their stories to you, and those whose stories I have not related. It is not correct for a \u003cem\u003emessenger\u003c/em\u003e to bring a sign to his people from his Lord, except if He (may He be glorified) wishes for him to bring it. So, for the disbelievers to demand signs is wrong. When the decree of Allah for victory or judgement in favour of the \u003cem\u003emessengers\u003c/em\u003e against their nations happens, the judgement will be made fairly. The disbelievers will then be destroyed and the \u003cem\u003emessengers\u003c/em\u003e will be saved. At that point when the judgement is made between the servants, the people of falsehood will lose out by having put themselves in a position of doom by committing disbelief." + } + ] + }] + } + }] +} diff --git a/quran/generate.go b/quran/generate.go new file mode 100644 index 0000000..7d9db91 --- /dev/null +++ b/quran/generate.go @@ -0,0 +1,3 @@ +package main + +//go:generate make proto diff --git a/quran/handler/quran.go b/quran/handler/quran.go new file mode 100644 index 0000000..a5e039c --- /dev/null +++ b/quran/handler/quran.go @@ -0,0 +1,197 @@ +package handler + +import ( + "context" + "fmt" + "net/url" + + "github.com/micro/micro/v3/service/errors" + "github.com/micro/micro/v3/service/logger" + "github.com/micro/services/pkg/api" + "github.com/micro/services/quran/domain" + pb "github.com/micro/services/quran/proto" +) + +const ( + // the default api url + apiUrl = "https://api.quran.com/api/v4/" + // TODO: allow multiple translations + // the default translation id + translationId = "131,20" + // TODO: allow multiple interpretations + // the default tafsir id + tafsirId = "169" + // TODO: make configurable + arabicText = "text_imlaei" +) + +type Quran struct{} + +// Chapters returns a list of the chapters of the Quran +func (q *Quran) Chapters(ctx context.Context, req *pb.ChaptersRequest, rsp *pb.ChaptersResponse) error { + lang := "en" + if len(req.Language) > 0 { + lang = req.Language + } + + var resp map[string][]*domain.Chapter + if err := api.Get(apiUrl+"chapters?language="+lang, &resp); err != nil { + logger.Errorf("Failed to retrieve chapters: %v", err) + return errors.InternalServerError("quran.chapters", "Failed to retrieve chapters") + } + + for _, c := range resp["chapters"] { + rsp.Chapters = append(rsp.Chapters, &pb.Chapter{ + Id: c.Id, + RevelationPlace: c.RevelationPlace, + RevelationOrder: c.RevelationOrder, + PrefixBismillah: c.BismillahPrefix, + Name: c.NameSimple, + ComplexName: c.NameComplex, + ArabicName: c.NameArabic, + TranslatedName: c.TranslatedName.Name, + Verses: c.VersesCount, + Pages: c.Pages, + }) + } + + return nil +} + +// Retrieve the summary for a given chapter +func (q *Quran) Summary(ctx context.Context, req *pb.SummaryRequest, rsp *pb.SummaryResponse) error { + lang := "en" + if len(req.Language) > 0 { + lang = req.Language + } + if req.Chapter <= 0 { + return errors.BadRequest("quran.chapter-summary", "require chapter id") + } + + var resp map[string]*domain.ChapterInfo + uri := fmt.Sprintf(apiUrl+"chapters/%d/info?language=%s", req.Chapter, lang) + + if err := api.Get(uri, &resp); err != nil { + logger.Errorf("Failed to retrieve chapter info: %v", err) + return errors.InternalServerError("quran.chapter-summary", "Failed to retrieve chapter summary") + } + + info := resp["chapter_info"] + rsp.Chapter = info.ChapterId + rsp.Summary = info.ShortText + rsp.Source = info.Source + rsp.Text = info.Text + + return nil +} + +// Return the verses by chapter +func (q *Quran) Verses(ctx context.Context, req *pb.VersesRequest, rsp *pb.VersesResponse) error { + lang := "en" + if len(req.Language) > 0 { + lang = req.Language + } + + if req.Chapter <= 0 { + return errors.BadRequest("quran.verses", "require chapter id") + } + + // TODO: enable configuring translations + // comma separated list of resource ids + // https://quran.api-docs.io/v4/resources/translations + translations := translationId + // TODO: enable configuring tafirs + // https://api.quran.com/api/v4/resources/tafsirs + tafsirs := tafsirId + + uri := fmt.Sprintf(apiUrl+"verses/by_chapter/%d?language=%s", req.Chapter, lang) + + // additional fields we require + // arabic text in imlaei script + uri += "&fields=" + arabicText + + uri += "&words=true" + uri += "&word_fields=code_v2,text_imlaei" + + if len(translations) > 0 && req.Translate { + uri += "&translations=" + translations + uri += "&translation_fields=resource_name" + } + + if len(tafsirs) > 0 && req.Interpret { + uri += "&tafsirs=" + tafsirs + } + + if req.Page > 0 { + uri += fmt.Sprintf("&page=%d", req.Page) + } + + if req.Limit > 0 { + uri += fmt.Sprintf("&per_page=%d", req.Limit) + } + + var resp *domain.VersesByChapter + + if err := api.Get(uri, &resp); err != nil { + logger.Errorf("Failed to retrieve verses: %v", err) + return errors.InternalServerError("quran.verses", "Failed to retrieve verses") + } + + rsp.Chapter = req.Chapter + rsp.Page = resp.Pagination.CurrentPage + rsp.TotalPages = resp.Pagination.TotalPages + + for _, verse := range resp.Verses { + v := domain.VerseToProto(verse) + // strip words if not asked for + if req.Words != true { + v.Words = nil + } + rsp.Verses = append(rsp.Verses, v) + } + + return nil +} + +// Return the search results for a given query +func (q *Quran) Search(ctx context.Context, req *pb.SearchRequest, rsp *pb.SearchResponse) error { + if len(req.Query) == 0 { + return errors.BadRequest("quran.search", "missing search query") + } + + lang := "en" + if len(req.Language) > 0 { + lang = req.Language + } + + if req.Limit <= 0 { + req.Limit = 20 + } + + qq := url.Values{} + qq.Set("q", req.Query) + qq.Set("size", fmt.Sprintf("%d", req.Limit)) + qq.Set("page", fmt.Sprintf("%d", req.Page)) + qq.Set("language", lang) + + uri := fmt.Sprintf(apiUrl+"search?%s", qq.Encode()) + + var resp map[string]*domain.SearchResults + + if err := api.Get(uri, &resp); err != nil { + logger.Errorf("Failed to retrieve search results: %v", err) + return errors.InternalServerError("quran.search", "Failed to retrieve search results") + } + + rsp.Query = req.Query + rsp.Page = resp["search"].CurrentPage + rsp.TotalPages = resp["search"].TotalPages + rsp.TotalResults = resp["search"].TotalResults + + for _, result := range resp["search"].Results { + r := domain.ResultToProto(result) + rsp.Results = append(rsp.Results, r) + } + + return nil +} diff --git a/quran/main.go b/quran/main.go new file mode 100644 index 0000000..75ed29e --- /dev/null +++ b/quran/main.go @@ -0,0 +1,25 @@ +package main + +import ( + "github.com/micro/services/quran/handler" + pb "github.com/micro/services/quran/proto" + + "github.com/micro/micro/v3/service" + "github.com/micro/micro/v3/service/logger" +) + +func main() { + // Create service + srv := service.New( + service.Name("quran"), + service.Version("latest"), + ) + + // Register handler + pb.RegisterQuranHandler(srv.Server(), new(handler.Quran)) + + // Run service + if err := srv.Run(); err != nil { + logger.Fatal(err) + } +} diff --git a/quran/micro.mu b/quran/micro.mu new file mode 100644 index 0000000..d744de8 --- /dev/null +++ b/quran/micro.mu @@ -0,0 +1 @@ +service quran diff --git a/quran/proto/quran.pb.go b/quran/proto/quran.pb.go new file mode 100644 index 0000000..a61d692 --- /dev/null +++ b/quran/proto/quran.pb.go @@ -0,0 +1,1577 @@ +// Code generated by protoc-gen-go. DO NOT EDIT. +// versions: +// protoc-gen-go v1.26.0 +// protoc v3.15.6 +// source: proto/quran.proto + +package quran + +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 Chapter struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The id of the chapter as a number e.g 1 + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // The number of verses in the chapter + Verses int32 `protobuf:"varint,2,opt,name=verses,proto3" json:"verses,omitempty"` + // The simple name of the chapter + Name string `protobuf:"bytes,3,opt,name=name,proto3" json:"name,omitempty"` + // The arabic name of the chapter + ArabicName string `protobuf:"bytes,4,opt,name=arabic_name,json=arabicName,proto3" json:"arabic_name,omitempty"` + // The complex name of the chapter + ComplexName string `protobuf:"bytes,5,opt,name=complex_name,json=complexName,proto3" json:"complex_name,omitempty"` + // The translated name + TranslatedName string `protobuf:"bytes,6,opt,name=translated_name,json=translatedName,proto3" json:"translated_name,omitempty"` + // Should the chapter start with bismillah + PrefixBismillah bool `protobuf:"varint,7,opt,name=prefix_bismillah,json=prefixBismillah,proto3" json:"prefix_bismillah,omitempty"` + // The place of revelation + RevelationPlace string `protobuf:"bytes,8,opt,name=revelation_place,json=revelationPlace,proto3" json:"revelation_place,omitempty"` + // The order in which it was revealed + RevelationOrder int32 `protobuf:"varint,9,opt,name=revelation_order,json=revelationOrder,proto3" json:"revelation_order,omitempty"` + // The pages from and to e.g 1, 1 + Pages []int32 `protobuf:"varint,10,rep,packed,name=pages,proto3" json:"pages,omitempty"` +} + +func (x *Chapter) Reset() { + *x = Chapter{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[0] + 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_quran_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 Chapter.ProtoReflect.Descriptor instead. +func (*Chapter) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{0} +} + +func (x *Chapter) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Chapter) GetVerses() int32 { + if x != nil { + return x.Verses + } + return 0 +} + +func (x *Chapter) GetName() string { + if x != nil { + return x.Name + } + return "" +} + +func (x *Chapter) GetArabicName() string { + if x != nil { + return x.ArabicName + } + return "" +} + +func (x *Chapter) GetComplexName() string { + if x != nil { + return x.ComplexName + } + return "" +} + +func (x *Chapter) GetTranslatedName() string { + if x != nil { + return x.TranslatedName + } + return "" +} + +func (x *Chapter) GetPrefixBismillah() bool { + if x != nil { + return x.PrefixBismillah + } + return false +} + +func (x *Chapter) GetRevelationPlace() string { + if x != nil { + return x.RevelationPlace + } + return "" +} + +func (x *Chapter) GetRevelationOrder() int32 { + if x != nil { + return x.RevelationOrder + } + return 0 +} + +func (x *Chapter) GetPages() []int32 { + if x != nil { + return x.Pages + } + return nil +} + +type Verse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The unique id of the verse in the whole book + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // The verse number in this chapter + Number int32 `protobuf:"varint,2,opt,name=number,proto3" json:"number,omitempty"` + // The key of this verse (chapter:verse) e.g 1:1 + Key string `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"` + // The page of the Quran this verse is on + Page int32 `protobuf:"varint,4,opt,name=page,proto3" json:"page,omitempty"` + // The arabic text for this verse + Text string `protobuf:"bytes,5,opt,name=text,proto3" json:"text,omitempty"` + // The phonetic transliteration from arabic + Transliteration string `protobuf:"bytes,6,opt,name=transliteration,proto3" json:"transliteration,omitempty"` + // The basic translation of the verse + TranslatedText string `protobuf:"bytes,7,opt,name=translated_text,json=translatedText,proto3" json:"translated_text,omitempty"` + // The alternative translations for the verse + Translations []*Translation `protobuf:"bytes,8,rep,name=translations,proto3" json:"translations,omitempty"` + // The interpretations of the verse + Interpretations []*Interpretation `protobuf:"bytes,9,rep,name=interpretations,proto3" json:"interpretations,omitempty"` + // The individual words within the verse (Ayah) + Words []*Word `protobuf:"bytes,10,rep,name=words,proto3" json:"words,omitempty"` +} + +func (x *Verse) Reset() { + *x = Verse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[1] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Verse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Verse) ProtoMessage() {} + +func (x *Verse) ProtoReflect() protoreflect.Message { + mi := &file_proto_quran_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 Verse.ProtoReflect.Descriptor instead. +func (*Verse) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{1} +} + +func (x *Verse) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Verse) GetNumber() int32 { + if x != nil { + return x.Number + } + return 0 +} + +func (x *Verse) GetKey() string { + if x != nil { + return x.Key + } + return "" +} + +func (x *Verse) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *Verse) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +func (x *Verse) GetTransliteration() string { + if x != nil { + return x.Transliteration + } + return "" +} + +func (x *Verse) GetTranslatedText() string { + if x != nil { + return x.TranslatedText + } + return "" +} + +func (x *Verse) GetTranslations() []*Translation { + if x != nil { + return x.Translations + } + return nil +} + +func (x *Verse) GetInterpretations() []*Interpretation { + if x != nil { + return x.Interpretations + } + return nil +} + +func (x *Verse) GetWords() []*Word { + if x != nil { + return x.Words + } + return nil +} + +type Interpretation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The unique id of the interpretation + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // The source of the interpretation + Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` + // The translated text + Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` +} + +func (x *Interpretation) Reset() { + *x = Interpretation{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[2] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Interpretation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Interpretation) ProtoMessage() {} + +func (x *Interpretation) ProtoReflect() protoreflect.Message { + mi := &file_proto_quran_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 Interpretation.ProtoReflect.Descriptor instead. +func (*Interpretation) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{2} +} + +func (x *Interpretation) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Interpretation) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *Interpretation) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +type Translation struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The unique id of the translation + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // The source of the translation + Source string `protobuf:"bytes,2,opt,name=source,proto3" json:"source,omitempty"` + // The translated text + Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` +} + +func (x *Translation) Reset() { + *x = Translation{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[3] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Translation) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Translation) ProtoMessage() {} + +func (x *Translation) ProtoReflect() protoreflect.Message { + mi := &file_proto_quran_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 Translation.ProtoReflect.Descriptor instead. +func (*Translation) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{3} +} + +func (x *Translation) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Translation) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *Translation) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +type Word struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The id of the word within the verse + Id int32 `protobuf:"varint,1,opt,name=id,proto3" json:"id,omitempty"` + // The position of the word + Position int32 `protobuf:"varint,2,opt,name=position,proto3" json:"position,omitempty"` + // The character type e.g word, end + CharType string `protobuf:"bytes,3,opt,name=char_type,json=charType,proto3" json:"char_type,omitempty"` + // The page number + Page int32 `protobuf:"varint,4,opt,name=page,proto3" json:"page,omitempty"` + // The line number + Line int32 `protobuf:"varint,5,opt,name=line,proto3" json:"line,omitempty"` + // The arabic text for this word + Text string `protobuf:"bytes,6,opt,name=text,proto3" json:"text,omitempty"` + // The QCF v2 font code + Code string `protobuf:"bytes,7,opt,name=code,proto3" json:"code,omitempty"` + // The translated text + Translation string `protobuf:"bytes,8,opt,name=translation,proto3" json:"translation,omitempty"` + // The transliteration text + Transliteration string `protobuf:"bytes,9,opt,name=transliteration,proto3" json:"transliteration,omitempty"` +} + +func (x *Word) Reset() { + *x = Word{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[4] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Word) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Word) ProtoMessage() {} + +func (x *Word) ProtoReflect() protoreflect.Message { + mi := &file_proto_quran_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 Word.ProtoReflect.Descriptor instead. +func (*Word) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{4} +} + +func (x *Word) GetId() int32 { + if x != nil { + return x.Id + } + return 0 +} + +func (x *Word) GetPosition() int32 { + if x != nil { + return x.Position + } + return 0 +} + +func (x *Word) GetCharType() string { + if x != nil { + return x.CharType + } + return "" +} + +func (x *Word) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *Word) GetLine() int32 { + if x != nil { + return x.Line + } + return 0 +} + +func (x *Word) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +func (x *Word) GetCode() string { + if x != nil { + return x.Code + } + return "" +} + +func (x *Word) GetTranslation() string { + if x != nil { + return x.Translation + } + return "" +} + +func (x *Word) GetTransliteration() string { + if x != nil { + return x.Transliteration + } + return "" +} + +type Result struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The unique verse id across the Quran + VerseId int32 `protobuf:"varint,1,opt,name=verse_id,json=verseId,proto3" json:"verse_id,omitempty"` + // The verse key e.g 1:1 + VerseKey string `protobuf:"bytes,2,opt,name=verse_key,json=verseKey,proto3" json:"verse_key,omitempty"` + // The associated arabic text + Text string `protobuf:"bytes,3,opt,name=text,proto3" json:"text,omitempty"` + // The related translations to the text + Translations []*Translation `protobuf:"bytes,4,rep,name=translations,proto3" json:"translations,omitempty"` +} + +func (x *Result) Reset() { + *x = Result{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[5] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *Result) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*Result) ProtoMessage() {} + +func (x *Result) ProtoReflect() protoreflect.Message { + mi := &file_proto_quran_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 Result.ProtoReflect.Descriptor instead. +func (*Result) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{5} +} + +func (x *Result) GetVerseId() int32 { + if x != nil { + return x.VerseId + } + return 0 +} + +func (x *Result) GetVerseKey() string { + if x != nil { + return x.VerseKey + } + return "" +} + +func (x *Result) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +func (x *Result) GetTranslations() []*Translation { + if x != nil { + return x.Translations + } + return nil +} + +// List the Chapters (surahs) of the Quran +type ChaptersRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // Specify the language e.g en + Language string `protobuf:"bytes,1,opt,name=language,proto3" json:"language,omitempty"` +} + +func (x *ChaptersRequest) Reset() { + *x = ChaptersRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[6] + 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_quran_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 ChaptersRequest.ProtoReflect.Descriptor instead. +func (*ChaptersRequest) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{6} +} + +func (x *ChaptersRequest) GetLanguage() string { + if x != nil { + return x.Language + } + return "" +} + +type ChaptersResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + Chapters []*Chapter `protobuf:"bytes,1,rep,name=chapters,proto3" json:"chapters,omitempty"` +} + +func (x *ChaptersResponse) Reset() { + *x = ChaptersResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[7] + 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_quran_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 ChaptersResponse.ProtoReflect.Descriptor instead. +func (*ChaptersResponse) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{7} +} + +func (x *ChaptersResponse) GetChapters() []*Chapter { + if x != nil { + return x.Chapters + } + return nil +} + +// Get a summary for a given chapter (surah) +type SummaryRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The chapter id e.g 1 + Chapter int32 `protobuf:"varint,1,opt,name=chapter,proto3" json:"chapter,omitempty"` + // Specify the language e.g en + Language string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"` +} + +func (x *SummaryRequest) Reset() { + *x = SummaryRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[8] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SummaryRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SummaryRequest) ProtoMessage() {} + +func (x *SummaryRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_quran_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 SummaryRequest.ProtoReflect.Descriptor instead. +func (*SummaryRequest) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{8} +} + +func (x *SummaryRequest) GetChapter() int32 { + if x != nil { + return x.Chapter + } + return 0 +} + +func (x *SummaryRequest) GetLanguage() string { + if x != nil { + return x.Language + } + return "" +} + +type SummaryResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The chapter id + Chapter int32 `protobuf:"varint,1,opt,name=chapter,proto3" json:"chapter,omitempty"` + // The short summary for the chapter + Summary string `protobuf:"bytes,2,opt,name=summary,proto3" json:"summary,omitempty"` + // The source of the summary + Source string `protobuf:"bytes,3,opt,name=source,proto3" json:"source,omitempty"` + // The full description for the chapter + Text string `protobuf:"bytes,4,opt,name=text,proto3" json:"text,omitempty"` +} + +func (x *SummaryResponse) Reset() { + *x = SummaryResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[9] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SummaryResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SummaryResponse) ProtoMessage() {} + +func (x *SummaryResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_quran_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 SummaryResponse.ProtoReflect.Descriptor instead. +func (*SummaryResponse) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{9} +} + +func (x *SummaryResponse) GetChapter() int32 { + if x != nil { + return x.Chapter + } + return 0 +} + +func (x *SummaryResponse) GetSummary() string { + if x != nil { + return x.Summary + } + return "" +} + +func (x *SummaryResponse) GetSource() string { + if x != nil { + return x.Source + } + return "" +} + +func (x *SummaryResponse) GetText() string { + if x != nil { + return x.Text + } + return "" +} + +// Lookup the verses (ayahs) for a chapter +type VersesRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The chapter id to retrieve + Chapter int32 `protobuf:"varint,1,opt,name=chapter,proto3" json:"chapter,omitempty"` + // The language of translation + Language string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"` + // Return the individual words with the verses + Words bool `protobuf:"varint,3,opt,name=words,proto3" json:"words,omitempty"` + // Return the interpretation (tafsir) + Interpret bool `protobuf:"varint,4,opt,name=interpret,proto3" json:"interpret,omitempty"` + // Return alternate translations + Translate bool `protobuf:"varint,5,opt,name=translate,proto3" json:"translate,omitempty"` + // The page number to request + Page int32 `protobuf:"varint,6,opt,name=page,proto3" json:"page,omitempty"` + // The verses per page + Limit int32 `protobuf:"varint,7,opt,name=limit,proto3" json:"limit,omitempty"` +} + +func (x *VersesRequest) Reset() { + *x = VersesRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[10] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VersesRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VersesRequest) ProtoMessage() {} + +func (x *VersesRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_quran_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 VersesRequest.ProtoReflect.Descriptor instead. +func (*VersesRequest) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{10} +} + +func (x *VersesRequest) GetChapter() int32 { + if x != nil { + return x.Chapter + } + return 0 +} + +func (x *VersesRequest) GetLanguage() string { + if x != nil { + return x.Language + } + return "" +} + +func (x *VersesRequest) GetWords() bool { + if x != nil { + return x.Words + } + return false +} + +func (x *VersesRequest) GetInterpret() bool { + if x != nil { + return x.Interpret + } + return false +} + +func (x *VersesRequest) GetTranslate() bool { + if x != nil { + return x.Translate + } + return false +} + +func (x *VersesRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *VersesRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +type VersesResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The chapter requested + Chapter int32 `protobuf:"varint,1,opt,name=chapter,proto3" json:"chapter,omitempty"` + // The page requested + Page int32 `protobuf:"varint,2,opt,name=page,proto3" json:"page,omitempty"` + // The total pages + TotalPages int32 `protobuf:"varint,3,opt,name=total_pages,json=totalPages,proto3" json:"total_pages,omitempty"` + // The verses on the page + Verses []*Verse `protobuf:"bytes,4,rep,name=verses,proto3" json:"verses,omitempty"` +} + +func (x *VersesResponse) Reset() { + *x = VersesResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[11] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *VersesResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*VersesResponse) ProtoMessage() {} + +func (x *VersesResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_quran_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 VersesResponse.ProtoReflect.Descriptor instead. +func (*VersesResponse) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{11} +} + +func (x *VersesResponse) GetChapter() int32 { + if x != nil { + return x.Chapter + } + return 0 +} + +func (x *VersesResponse) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *VersesResponse) GetTotalPages() int32 { + if x != nil { + return x.TotalPages + } + return 0 +} + +func (x *VersesResponse) GetVerses() []*Verse { + if x != nil { + return x.Verses + } + return nil +} + +// Search the Quran for any form of query or questions +type SearchRequest struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The query to ask + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + // The language for translation + Language string `protobuf:"bytes,2,opt,name=language,proto3" json:"language,omitempty"` + // The number of results to return + Limit int32 `protobuf:"varint,3,opt,name=limit,proto3" json:"limit,omitempty"` + // The pagination number + Page int32 `protobuf:"varint,4,opt,name=page,proto3" json:"page,omitempty"` +} + +func (x *SearchRequest) Reset() { + *x = SearchRequest{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[12] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchRequest) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchRequest) ProtoMessage() {} + +func (x *SearchRequest) ProtoReflect() protoreflect.Message { + mi := &file_proto_quran_proto_msgTypes[12] + 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 SearchRequest.ProtoReflect.Descriptor instead. +func (*SearchRequest) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{12} +} + +func (x *SearchRequest) GetQuery() string { + if x != nil { + return x.Query + } + return "" +} + +func (x *SearchRequest) GetLanguage() string { + if x != nil { + return x.Language + } + return "" +} + +func (x *SearchRequest) GetLimit() int32 { + if x != nil { + return x.Limit + } + return 0 +} + +func (x *SearchRequest) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +type SearchResponse struct { + state protoimpl.MessageState + sizeCache protoimpl.SizeCache + unknownFields protoimpl.UnknownFields + + // The question asked + Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"` + // The total results returned + TotalResults int32 `protobuf:"varint,2,opt,name=total_results,json=totalResults,proto3" json:"total_results,omitempty"` + // The current page + Page int32 `protobuf:"varint,3,opt,name=page,proto3" json:"page,omitempty"` + // The total pages + TotalPages int32 `protobuf:"varint,4,opt,name=total_pages,json=totalPages,proto3" json:"total_pages,omitempty"` + // The results for the query + Results []*Result `protobuf:"bytes,5,rep,name=results,proto3" json:"results,omitempty"` +} + +func (x *SearchResponse) Reset() { + *x = SearchResponse{} + if protoimpl.UnsafeEnabled { + mi := &file_proto_quran_proto_msgTypes[13] + ms := protoimpl.X.MessageStateOf(protoimpl.Pointer(x)) + ms.StoreMessageInfo(mi) + } +} + +func (x *SearchResponse) String() string { + return protoimpl.X.MessageStringOf(x) +} + +func (*SearchResponse) ProtoMessage() {} + +func (x *SearchResponse) ProtoReflect() protoreflect.Message { + mi := &file_proto_quran_proto_msgTypes[13] + 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 SearchResponse.ProtoReflect.Descriptor instead. +func (*SearchResponse) Descriptor() ([]byte, []int) { + return file_proto_quran_proto_rawDescGZIP(), []int{13} +} + +func (x *SearchResponse) GetQuery() string { + if x != nil { + return x.Query + } + return "" +} + +func (x *SearchResponse) GetTotalResults() int32 { + if x != nil { + return x.TotalResults + } + return 0 +} + +func (x *SearchResponse) GetPage() int32 { + if x != nil { + return x.Page + } + return 0 +} + +func (x *SearchResponse) GetTotalPages() int32 { + if x != nil { + return x.TotalPages + } + return 0 +} + +func (x *SearchResponse) GetResults() []*Result { + if x != nil { + return x.Results + } + return nil +} + +var File_proto_quran_proto protoreflect.FileDescriptor + +var file_proto_quran_proto_rawDesc = []byte{ + 0x0a, 0x11, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x2f, 0x71, 0x75, 0x72, 0x61, 0x6e, 0x2e, 0x70, 0x72, + 0x6f, 0x74, 0x6f, 0x12, 0x05, 0x71, 0x75, 0x72, 0x61, 0x6e, 0x22, 0xc9, 0x02, 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, 0x16, 0x0a, 0x06, 0x76, 0x65, 0x72, 0x73, 0x65, 0x73, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x06, 0x76, 0x65, 0x72, 0x73, 0x65, 0x73, 0x12, 0x12, + 0x0a, 0x04, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x03, 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, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0a, 0x61, 0x72, 0x61, 0x62, 0x69, 0x63, 0x4e, + 0x61, 0x6d, 0x65, 0x12, 0x21, 0x0a, 0x0c, 0x63, 0x6f, 0x6d, 0x70, 0x6c, 0x65, 0x78, 0x5f, 0x6e, + 0x61, 0x6d, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0b, 0x63, 0x6f, 0x6d, 0x70, 0x6c, + 0x65, 0x78, 0x4e, 0x61, 0x6d, 0x65, 0x12, 0x27, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, + 0x61, 0x74, 0x65, 0x64, 0x5f, 0x6e, 0x61, 0x6d, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x4e, 0x61, 0x6d, 0x65, 0x12, + 0x29, 0x0a, 0x10, 0x70, 0x72, 0x65, 0x66, 0x69, 0x78, 0x5f, 0x62, 0x69, 0x73, 0x6d, 0x69, 0x6c, + 0x6c, 0x61, 0x68, 0x18, 0x07, 0x20, 0x01, 0x28, 0x08, 0x52, 0x0f, 0x70, 0x72, 0x65, 0x66, 0x69, + 0x78, 0x42, 0x69, 0x73, 0x6d, 0x69, 0x6c, 0x6c, 0x61, 0x68, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, + 0x76, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x5f, 0x70, 0x6c, 0x61, 0x63, 0x65, 0x18, 0x08, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x72, 0x65, 0x76, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, + 0x50, 0x6c, 0x61, 0x63, 0x65, 0x12, 0x29, 0x0a, 0x10, 0x72, 0x65, 0x76, 0x65, 0x6c, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x5f, 0x6f, 0x72, 0x64, 0x65, 0x72, 0x18, 0x09, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x0f, 0x72, 0x65, 0x76, 0x65, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x4f, 0x72, 0x64, 0x65, 0x72, + 0x12, 0x14, 0x0a, 0x05, 0x70, 0x61, 0x67, 0x65, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x05, 0x52, + 0x05, 0x70, 0x61, 0x67, 0x65, 0x73, 0x22, 0xd8, 0x02, 0x0a, 0x05, 0x56, 0x65, 0x72, 0x73, 0x65, + 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, + 0x12, 0x16, 0x0a, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x06, 0x6e, 0x75, 0x6d, 0x62, 0x65, 0x72, 0x12, 0x10, 0x0a, 0x03, 0x6b, 0x65, 0x79, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x03, 0x6b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, + 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x12, + 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x05, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, + 0x78, 0x74, 0x12, 0x28, 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x69, 0x74, 0x65, 0x72, + 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x06, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, + 0x6e, 0x73, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x27, 0x0a, 0x0f, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x65, 0x64, 0x5f, 0x74, 0x65, 0x78, 0x74, 0x18, + 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0e, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x65, + 0x64, 0x54, 0x65, 0x78, 0x74, 0x12, 0x36, 0x0a, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, + 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, 0x08, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x71, 0x75, + 0x72, 0x61, 0x6e, 0x2e, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, + 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x3f, 0x0a, + 0x0f, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, + 0x18, 0x09, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x15, 0x2e, 0x71, 0x75, 0x72, 0x61, 0x6e, 0x2e, 0x49, + 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0f, 0x69, + 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x12, 0x21, + 0x0a, 0x05, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x18, 0x0a, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0b, 0x2e, + 0x71, 0x75, 0x72, 0x61, 0x6e, 0x2e, 0x57, 0x6f, 0x72, 0x64, 0x52, 0x05, 0x77, 0x6f, 0x72, 0x64, + 0x73, 0x22, 0x4c, 0x0a, 0x0e, 0x49, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x61, 0x74, + 0x69, 0x6f, 0x6e, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, + 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, + 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, + 0x49, 0x0a, 0x0b, 0x54, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x0e, + 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x02, 0x69, 0x64, 0x12, 0x16, + 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, + 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x03, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x22, 0xeb, 0x01, 0x0a, 0x04, 0x57, + 0x6f, 0x72, 0x64, 0x12, 0x0e, 0x0a, 0x02, 0x69, 0x64, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, + 0x02, 0x69, 0x64, 0x12, 0x1a, 0x0a, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x18, + 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x08, 0x70, 0x6f, 0x73, 0x69, 0x74, 0x69, 0x6f, 0x6e, 0x12, + 0x1b, 0x0a, 0x09, 0x63, 0x68, 0x61, 0x72, 0x5f, 0x74, 0x79, 0x70, 0x65, 0x18, 0x03, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x08, 0x63, 0x68, 0x61, 0x72, 0x54, 0x79, 0x70, 0x65, 0x12, 0x12, 0x0a, 0x04, + 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, + 0x12, 0x12, 0x0a, 0x04, 0x6c, 0x69, 0x6e, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, + 0x6c, 0x69, 0x6e, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x06, 0x20, 0x01, + 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, 0x12, 0x0a, 0x04, 0x63, 0x6f, 0x64, 0x65, + 0x18, 0x07, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x63, 0x6f, 0x64, 0x65, 0x12, 0x20, 0x0a, 0x0b, + 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x18, 0x08, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x0b, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x12, 0x28, + 0x0a, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x69, 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, + 0x6e, 0x18, 0x09, 0x20, 0x01, 0x28, 0x09, 0x52, 0x0f, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x69, + 0x74, 0x65, 0x72, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x22, 0x8c, 0x01, 0x0a, 0x06, 0x52, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x12, 0x19, 0x0a, 0x08, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x69, 0x64, 0x18, + 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x76, 0x65, 0x72, 0x73, 0x65, 0x49, 0x64, 0x12, 0x1b, + 0x0a, 0x09, 0x76, 0x65, 0x72, 0x73, 0x65, 0x5f, 0x6b, 0x65, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, + 0x09, 0x52, 0x08, 0x76, 0x65, 0x72, 0x73, 0x65, 0x4b, 0x65, 0x79, 0x12, 0x12, 0x0a, 0x04, 0x74, + 0x65, 0x78, 0x74, 0x18, 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, 0x74, 0x12, + 0x36, 0x0a, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x18, + 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x12, 0x2e, 0x71, 0x75, 0x72, 0x61, 0x6e, 0x2e, 0x54, 0x72, + 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x52, 0x0c, 0x74, 0x72, 0x61, 0x6e, 0x73, + 0x6c, 0x61, 0x74, 0x69, 0x6f, 0x6e, 0x73, 0x22, 0x2d, 0x0a, 0x0f, 0x43, 0x68, 0x61, 0x70, 0x74, + 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, + 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, + 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x22, 0x3e, 0x0a, 0x10, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, + 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x2a, 0x0a, 0x08, 0x63, 0x68, + 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x18, 0x01, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0e, 0x2e, 0x71, + 0x75, 0x72, 0x61, 0x6e, 0x2e, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x52, 0x08, 0x63, 0x68, + 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x22, 0x46, 0x0a, 0x0e, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, + 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x70, + 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x68, 0x61, 0x70, 0x74, + 0x65, 0x72, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x18, 0x02, + 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x22, 0x71, + 0x0a, 0x0f, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, + 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, + 0x28, 0x05, 0x52, 0x07, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x12, 0x18, 0x0a, 0x07, 0x73, + 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x07, 0x73, 0x75, + 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x16, 0x0a, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x18, + 0x03, 0x20, 0x01, 0x28, 0x09, 0x52, 0x06, 0x73, 0x6f, 0x75, 0x72, 0x63, 0x65, 0x12, 0x12, 0x0a, + 0x04, 0x74, 0x65, 0x78, 0x74, 0x18, 0x04, 0x20, 0x01, 0x28, 0x09, 0x52, 0x04, 0x74, 0x65, 0x78, + 0x74, 0x22, 0xc1, 0x01, 0x0a, 0x0d, 0x56, 0x65, 0x72, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, + 0x65, 0x73, 0x74, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x18, 0x01, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x12, 0x1a, 0x0a, + 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, + 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, 0x12, 0x14, 0x0a, 0x05, 0x77, 0x6f, 0x72, + 0x64, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x08, 0x52, 0x05, 0x77, 0x6f, 0x72, 0x64, 0x73, 0x12, + 0x1c, 0x0a, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x18, 0x04, 0x20, 0x01, + 0x28, 0x08, 0x52, 0x09, 0x69, 0x6e, 0x74, 0x65, 0x72, 0x70, 0x72, 0x65, 0x74, 0x12, 0x1c, 0x0a, + 0x09, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x65, 0x18, 0x05, 0x20, 0x01, 0x28, 0x08, + 0x52, 0x09, 0x74, 0x72, 0x61, 0x6e, 0x73, 0x6c, 0x61, 0x74, 0x65, 0x12, 0x12, 0x0a, 0x04, 0x70, + 0x61, 0x67, 0x65, 0x18, 0x06, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, + 0x14, 0x0a, 0x05, 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x18, 0x07, 0x20, 0x01, 0x28, 0x05, 0x52, 0x05, + 0x6c, 0x69, 0x6d, 0x69, 0x74, 0x22, 0x85, 0x01, 0x0a, 0x0e, 0x56, 0x65, 0x72, 0x73, 0x65, 0x73, + 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x18, 0x0a, 0x07, 0x63, 0x68, 0x61, 0x70, + 0x74, 0x65, 0x72, 0x18, 0x01, 0x20, 0x01, 0x28, 0x05, 0x52, 0x07, 0x63, 0x68, 0x61, 0x70, 0x74, + 0x65, 0x72, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, + 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x0a, 0x0b, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, + 0x70, 0x61, 0x67, 0x65, 0x73, 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, + 0x61, 0x6c, 0x50, 0x61, 0x67, 0x65, 0x73, 0x12, 0x24, 0x0a, 0x06, 0x76, 0x65, 0x72, 0x73, 0x65, + 0x73, 0x18, 0x04, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0c, 0x2e, 0x71, 0x75, 0x72, 0x61, 0x6e, 0x2e, + 0x56, 0x65, 0x72, 0x73, 0x65, 0x52, 0x06, 0x76, 0x65, 0x72, 0x73, 0x65, 0x73, 0x22, 0x6b, 0x0a, + 0x0d, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x12, 0x14, + 0x0a, 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, + 0x75, 0x65, 0x72, 0x79, 0x12, 0x1a, 0x0a, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 0x61, 0x67, 0x65, + 0x18, 0x02, 0x20, 0x01, 0x28, 0x09, 0x52, 0x08, 0x6c, 0x61, 0x6e, 0x67, 0x75, 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, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, 0x18, 0x04, + 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x22, 0xa9, 0x01, 0x0a, 0x0e, 0x53, + 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x12, 0x14, 0x0a, + 0x05, 0x71, 0x75, 0x65, 0x72, 0x79, 0x18, 0x01, 0x20, 0x01, 0x28, 0x09, 0x52, 0x05, 0x71, 0x75, + 0x65, 0x72, 0x79, 0x12, 0x23, 0x0a, 0x0d, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x72, 0x65, 0x73, + 0x75, 0x6c, 0x74, 0x73, 0x18, 0x02, 0x20, 0x01, 0x28, 0x05, 0x52, 0x0c, 0x74, 0x6f, 0x74, 0x61, + 0x6c, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x12, 0x12, 0x0a, 0x04, 0x70, 0x61, 0x67, 0x65, + 0x18, 0x03, 0x20, 0x01, 0x28, 0x05, 0x52, 0x04, 0x70, 0x61, 0x67, 0x65, 0x12, 0x1f, 0x0a, 0x0b, + 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x5f, 0x70, 0x61, 0x67, 0x65, 0x73, 0x18, 0x04, 0x20, 0x01, 0x28, + 0x05, 0x52, 0x0a, 0x74, 0x6f, 0x74, 0x61, 0x6c, 0x50, 0x61, 0x67, 0x65, 0x73, 0x12, 0x27, 0x0a, + 0x07, 0x72, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x18, 0x05, 0x20, 0x03, 0x28, 0x0b, 0x32, 0x0d, + 0x2e, 0x71, 0x75, 0x72, 0x61, 0x6e, 0x2e, 0x52, 0x65, 0x73, 0x75, 0x6c, 0x74, 0x52, 0x07, 0x72, + 0x65, 0x73, 0x75, 0x6c, 0x74, 0x73, 0x32, 0xf4, 0x01, 0x0a, 0x05, 0x51, 0x75, 0x72, 0x61, 0x6e, + 0x12, 0x3d, 0x0a, 0x08, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x12, 0x16, 0x2e, 0x71, + 0x75, 0x72, 0x61, 0x6e, 0x2e, 0x43, 0x68, 0x61, 0x70, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x17, 0x2e, 0x71, 0x75, 0x72, 0x61, 0x6e, 0x2e, 0x43, 0x68, 0x61, + 0x70, 0x74, 0x65, 0x72, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, + 0x3a, 0x0a, 0x07, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x12, 0x15, 0x2e, 0x71, 0x75, 0x72, + 0x61, 0x6e, 0x2e, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, 0x79, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, + 0x74, 0x1a, 0x16, 0x2e, 0x71, 0x75, 0x72, 0x61, 0x6e, 0x2e, 0x53, 0x75, 0x6d, 0x6d, 0x61, 0x72, + 0x79, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x06, 0x56, + 0x65, 0x72, 0x73, 0x65, 0x73, 0x12, 0x14, 0x2e, 0x71, 0x75, 0x72, 0x61, 0x6e, 0x2e, 0x56, 0x65, + 0x72, 0x73, 0x65, 0x73, 0x52, 0x65, 0x71, 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x71, 0x75, + 0x72, 0x61, 0x6e, 0x2e, 0x56, 0x65, 0x72, 0x73, 0x65, 0x73, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, + 0x73, 0x65, 0x22, 0x00, 0x12, 0x37, 0x0a, 0x06, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x12, 0x14, + 0x2e, 0x71, 0x75, 0x72, 0x61, 0x6e, 0x2e, 0x53, 0x65, 0x61, 0x72, 0x63, 0x68, 0x52, 0x65, 0x71, + 0x75, 0x65, 0x73, 0x74, 0x1a, 0x15, 0x2e, 0x71, 0x75, 0x72, 0x61, 0x6e, 0x2e, 0x53, 0x65, 0x61, + 0x72, 0x63, 0x68, 0x52, 0x65, 0x73, 0x70, 0x6f, 0x6e, 0x73, 0x65, 0x22, 0x00, 0x42, 0x0f, 0x5a, + 0x0d, 0x2e, 0x2f, 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x3b, 0x71, 0x75, 0x72, 0x61, 0x6e, 0x62, 0x06, + 0x70, 0x72, 0x6f, 0x74, 0x6f, 0x33, +} + +var ( + file_proto_quran_proto_rawDescOnce sync.Once + file_proto_quran_proto_rawDescData = file_proto_quran_proto_rawDesc +) + +func file_proto_quran_proto_rawDescGZIP() []byte { + file_proto_quran_proto_rawDescOnce.Do(func() { + file_proto_quran_proto_rawDescData = protoimpl.X.CompressGZIP(file_proto_quran_proto_rawDescData) + }) + return file_proto_quran_proto_rawDescData +} + +var file_proto_quran_proto_msgTypes = make([]protoimpl.MessageInfo, 14) +var file_proto_quran_proto_goTypes = []interface{}{ + (*Chapter)(nil), // 0: quran.Chapter + (*Verse)(nil), // 1: quran.Verse + (*Interpretation)(nil), // 2: quran.Interpretation + (*Translation)(nil), // 3: quran.Translation + (*Word)(nil), // 4: quran.Word + (*Result)(nil), // 5: quran.Result + (*ChaptersRequest)(nil), // 6: quran.ChaptersRequest + (*ChaptersResponse)(nil), // 7: quran.ChaptersResponse + (*SummaryRequest)(nil), // 8: quran.SummaryRequest + (*SummaryResponse)(nil), // 9: quran.SummaryResponse + (*VersesRequest)(nil), // 10: quran.VersesRequest + (*VersesResponse)(nil), // 11: quran.VersesResponse + (*SearchRequest)(nil), // 12: quran.SearchRequest + (*SearchResponse)(nil), // 13: quran.SearchResponse +} +var file_proto_quran_proto_depIdxs = []int32{ + 3, // 0: quran.Verse.translations:type_name -> quran.Translation + 2, // 1: quran.Verse.interpretations:type_name -> quran.Interpretation + 4, // 2: quran.Verse.words:type_name -> quran.Word + 3, // 3: quran.Result.translations:type_name -> quran.Translation + 0, // 4: quran.ChaptersResponse.chapters:type_name -> quran.Chapter + 1, // 5: quran.VersesResponse.verses:type_name -> quran.Verse + 5, // 6: quran.SearchResponse.results:type_name -> quran.Result + 6, // 7: quran.Quran.Chapters:input_type -> quran.ChaptersRequest + 8, // 8: quran.Quran.Summary:input_type -> quran.SummaryRequest + 10, // 9: quran.Quran.Verses:input_type -> quran.VersesRequest + 12, // 10: quran.Quran.Search:input_type -> quran.SearchRequest + 7, // 11: quran.Quran.Chapters:output_type -> quran.ChaptersResponse + 9, // 12: quran.Quran.Summary:output_type -> quran.SummaryResponse + 11, // 13: quran.Quran.Verses:output_type -> quran.VersesResponse + 13, // 14: quran.Quran.Search:output_type -> quran.SearchResponse + 11, // [11:15] is the sub-list for method output_type + 7, // [7:11] is the sub-list for method input_type + 7, // [7:7] is the sub-list for extension type_name + 7, // [7:7] is the sub-list for extension extendee + 0, // [0:7] is the sub-list for field type_name +} + +func init() { file_proto_quran_proto_init() } +func file_proto_quran_proto_init() { + if File_proto_quran_proto != nil { + return + } + if !protoimpl.UnsafeEnabled { + file_proto_quran_proto_msgTypes[0].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_quran_proto_msgTypes[1].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Verse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_quran_proto_msgTypes[2].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Interpretation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_quran_proto_msgTypes[3].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Translation); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_quran_proto_msgTypes[4].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Word); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_quran_proto_msgTypes[5].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*Result); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_quran_proto_msgTypes[6].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_quran_proto_msgTypes[7].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_quran_proto_msgTypes[8].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SummaryRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_quran_proto_msgTypes[9].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SummaryResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_quran_proto_msgTypes[10].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VersesRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_quran_proto_msgTypes[11].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*VersesResponse); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_quran_proto_msgTypes[12].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchRequest); i { + case 0: + return &v.state + case 1: + return &v.sizeCache + case 2: + return &v.unknownFields + default: + return nil + } + } + file_proto_quran_proto_msgTypes[13].Exporter = func(v interface{}, i int) interface{} { + switch v := v.(*SearchResponse); 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_quran_proto_rawDesc, + NumEnums: 0, + NumMessages: 14, + NumExtensions: 0, + NumServices: 1, + }, + GoTypes: file_proto_quran_proto_goTypes, + DependencyIndexes: file_proto_quran_proto_depIdxs, + MessageInfos: file_proto_quran_proto_msgTypes, + }.Build() + File_proto_quran_proto = out.File + file_proto_quran_proto_rawDesc = nil + file_proto_quran_proto_goTypes = nil + file_proto_quran_proto_depIdxs = nil +} diff --git a/quran/proto/quran.pb.micro.go b/quran/proto/quran.pb.micro.go new file mode 100644 index 0000000..4116a36 --- /dev/null +++ b/quran/proto/quran.pb.micro.go @@ -0,0 +1,144 @@ +// Code generated by protoc-gen-micro. DO NOT EDIT. +// source: proto/quran.proto + +package quran + +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 Quran service + +func NewQuranEndpoints() []*api.Endpoint { + return []*api.Endpoint{} +} + +// Client API for Quran service + +type QuranService interface { + Chapters(ctx context.Context, in *ChaptersRequest, opts ...client.CallOption) (*ChaptersResponse, error) + Summary(ctx context.Context, in *SummaryRequest, opts ...client.CallOption) (*SummaryResponse, error) + Verses(ctx context.Context, in *VersesRequest, opts ...client.CallOption) (*VersesResponse, error) + Search(ctx context.Context, in *SearchRequest, opts ...client.CallOption) (*SearchResponse, error) +} + +type quranService struct { + c client.Client + name string +} + +func NewQuranService(name string, c client.Client) QuranService { + return &quranService{ + c: c, + name: name, + } +} + +func (c *quranService) Chapters(ctx context.Context, in *ChaptersRequest, opts ...client.CallOption) (*ChaptersResponse, error) { + req := c.c.NewRequest(c.name, "Quran.Chapters", in) + out := new(ChaptersResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *quranService) Summary(ctx context.Context, in *SummaryRequest, opts ...client.CallOption) (*SummaryResponse, error) { + req := c.c.NewRequest(c.name, "Quran.Summary", in) + out := new(SummaryResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *quranService) Verses(ctx context.Context, in *VersesRequest, opts ...client.CallOption) (*VersesResponse, error) { + req := c.c.NewRequest(c.name, "Quran.Verses", in) + out := new(VersesResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *quranService) Search(ctx context.Context, in *SearchRequest, opts ...client.CallOption) (*SearchResponse, error) { + req := c.c.NewRequest(c.name, "Quran.Search", in) + out := new(SearchResponse) + err := c.c.Call(ctx, req, out, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +// Server API for Quran service + +type QuranHandler interface { + Chapters(context.Context, *ChaptersRequest, *ChaptersResponse) error + Summary(context.Context, *SummaryRequest, *SummaryResponse) error + Verses(context.Context, *VersesRequest, *VersesResponse) error + Search(context.Context, *SearchRequest, *SearchResponse) error +} + +func RegisterQuranHandler(s server.Server, hdlr QuranHandler, opts ...server.HandlerOption) error { + type quran interface { + Chapters(ctx context.Context, in *ChaptersRequest, out *ChaptersResponse) error + Summary(ctx context.Context, in *SummaryRequest, out *SummaryResponse) error + Verses(ctx context.Context, in *VersesRequest, out *VersesResponse) error + Search(ctx context.Context, in *SearchRequest, out *SearchResponse) error + } + type Quran struct { + quran + } + h := &quranHandler{hdlr} + return s.Handle(s.NewHandler(&Quran{h}, opts...)) +} + +type quranHandler struct { + QuranHandler +} + +func (h *quranHandler) Chapters(ctx context.Context, in *ChaptersRequest, out *ChaptersResponse) error { + return h.QuranHandler.Chapters(ctx, in, out) +} + +func (h *quranHandler) Summary(ctx context.Context, in *SummaryRequest, out *SummaryResponse) error { + return h.QuranHandler.Summary(ctx, in, out) +} + +func (h *quranHandler) Verses(ctx context.Context, in *VersesRequest, out *VersesResponse) error { + return h.QuranHandler.Verses(ctx, in, out) +} + +func (h *quranHandler) Search(ctx context.Context, in *SearchRequest, out *SearchResponse) error { + return h.QuranHandler.Search(ctx, in, out) +} diff --git a/quran/proto/quran.proto b/quran/proto/quran.proto new file mode 100644 index 0000000..8bc7ab9 --- /dev/null +++ b/quran/proto/quran.proto @@ -0,0 +1,191 @@ +syntax = "proto3"; + +package quran; + +option go_package = "./proto;quran"; + +service Quran { + rpc Chapters(ChaptersRequest) returns (ChaptersResponse) {} + rpc Summary(SummaryRequest) returns (SummaryResponse) {} + rpc Verses(VersesRequest) returns (VersesResponse) {} + rpc Search(SearchRequest) returns (SearchResponse) {} +} + +message Chapter { + // The id of the chapter as a number e.g 1 + int32 id = 1; + // The number of verses in the chapter + int32 verses = 2; + // The simple name of the chapter + string name = 3; + // The arabic name of the chapter + string arabic_name = 4; + // The complex name of the chapter + string complex_name = 5; + // The translated name + string translated_name = 6; + // Should the chapter start with bismillah + bool prefix_bismillah = 7; + // The place of revelation + string revelation_place = 8; + // The order in which it was revealed + int32 revelation_order = 9; + // The pages from and to e.g 1, 1 + repeated int32 pages = 10; +} + +message Verse { + // The unique id of the verse in the whole book + int32 id = 1; + // The verse number in this chapter + int32 number = 2; + // The key of this verse (chapter:verse) e.g 1:1 + string key = 3; + // The page of the Quran this verse is on + int32 page = 4; + // The arabic text for this verse + string text = 5; + // The phonetic transliteration from arabic + string transliteration = 6; + // The basic translation of the verse + string translated_text = 7; + // The alternative translations for the verse + repeated Translation translations = 8; + // The interpretations of the verse + repeated Interpretation interpretations = 9; + // The individual words within the verse (Ayah) + repeated Word words = 10; +} + +message Interpretation { + // The unique id of the interpretation + int32 id = 1; + // The source of the interpretation + string source = 2; + // The translated text + string text = 3; +} + +message Translation { + // The unique id of the translation + int32 id = 1; + // The source of the translation + string source = 2; + // The translated text + string text = 3; +} + +message Word { + // The id of the word within the verse + int32 id = 1; + // The position of the word + int32 position = 2; + // The character type e.g word, end + string char_type = 3; + // The page number + int32 page = 4; + // The line number + int32 line = 5; + // The arabic text for this word + string text = 6; + // The QCF v2 font code + string code = 7; + // The translated text + string translation = 8; + // The transliteration text + string transliteration = 9; +} + +message Result { + // The unique verse id across the Quran + int32 verse_id = 1; + // The verse key e.g 1:1 + string verse_key = 2; + // The associated arabic text + string text = 3; + // The related translations to the text + repeated Translation translations = 4; +} + +// List the Chapters (surahs) of the Quran +message ChaptersRequest { + // Specify the language e.g en + string language = 1; +} + +message ChaptersResponse { + repeated Chapter chapters = 1; +} + +// Get a summary for a given chapter (surah) +message SummaryRequest { + // The chapter id e.g 1 + int32 chapter = 1; + // Specify the language e.g en + string language = 2; +} + +message SummaryResponse { + // The chapter id + int32 chapter = 1; + // The short summary for the chapter + string summary = 2; + // The source of the summary + string source = 3; + // The full description for the chapter + string text = 4; +} + +// Lookup the verses (ayahs) for a chapter +message VersesRequest { + // The chapter id to retrieve + int32 chapter = 1; + // The language of translation + string language = 2; + // Return the individual words with the verses + bool words = 3; + // Return the interpretation (tafsir) + bool interpret = 4; + // Return alternate translations + bool translate = 5; + // The page number to request + int32 page = 6; + // The verses per page + int32 limit = 7; +} + +message VersesResponse { + // The chapter requested + int32 chapter = 1; + // The page requested + int32 page = 2; + // The total pages + int32 total_pages = 3; + // The verses on the page + repeated Verse verses = 4; +} + +// Search the Quran for any form of query or questions +message SearchRequest { + // The query to ask + string query = 1; + // The language for translation + string language = 2; + // The number of results to return + int32 limit = 3; + // The pagination number + int32 page = 4; +} + +message SearchResponse { + // The question asked + string query = 1; + // The total results returned + int32 total_results = 2; + // The current page + int32 page = 3; + // The total pages + int32 total_pages = 4; + // The results for the query + repeated Result results = 5; +} diff --git a/quran/publicapi.json b/quran/publicapi.json new file mode 100644 index 0000000..f8a2ca9 --- /dev/null +++ b/quran/publicapi.json @@ -0,0 +1,5 @@ +{ + "name": "quran", + "icon": "📖", + "category": "religion" +}