visuddhinanda 2 anni fa
parent
commit
b040d68945

+ 13 - 2
rpc/protocols/tulip.proto

@@ -7,6 +7,7 @@ package mint.tulip.v1;
 message SearchRequest {
   repeated string keywords = 1;
   repeated int32 books = 2;
+  string match_mode = 3;
 
   message Page {
     int32 index = 1;
@@ -29,6 +30,14 @@ message SearchResponse {
   int32 total = 99;
 }
 
+message BookListResponse {
+  message Item {
+    int32 book = 1;
+    int32 count = 2;
+  }
+  repeated Item items = 1;
+}
+
 message UpdateRequest {
   int32 book = 1;
   int32 paragraph = 2;
@@ -63,12 +72,14 @@ message UploadDictionaryResponse{
 service Search {
   rpc Pali(SearchRequest) returns (SearchResponse) {}
 
-  rpc Update(UpdateRequest) returns (UpdateResponse) {}
+  rpc BookList(SearchRequest) returns (BookListResponse) {}
 
-  rpc UploadDictionary(UploadDictionaryRequest) returns (UploadDictionaryResponse) {}
+  rpc Update(UpdateRequest) returns (UpdateResponse) {}
 
   rpc UpdateIndex(UpdateIndexRequest) returns (UpdateIndexResponse) {}
 
+  rpc UploadDictionary(UploadDictionaryRequest) returns (UploadDictionaryResponse) {}
+
 }
 
 // ----------------------------------------------------------------------------

BIN
rpc/tulip/tulip/GPBMetadata/Tulip.php


+ 58 - 0
rpc/tulip/tulip/Mint/Tulip/V1/BookListResponse.php

@@ -0,0 +1,58 @@
+<?php
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: tulip.proto
+
+namespace Mint\Tulip\V1;
+
+use Google\Protobuf\Internal\GPBType;
+use Google\Protobuf\Internal\RepeatedField;
+use Google\Protobuf\Internal\GPBUtil;
+
+/**
+ * Generated from protobuf message <code>mint.tulip.v1.BookListResponse</code>
+ */
+class BookListResponse extends \Google\Protobuf\Internal\Message
+{
+    /**
+     * Generated from protobuf field <code>repeated .mint.tulip.v1.BookListResponse.Item items = 1;</code>
+     */
+    private $items;
+
+    /**
+     * Constructor.
+     *
+     * @param array $data {
+     *     Optional. Data for populating the Message object.
+     *
+     *     @type array<\Mint\Tulip\V1\BookListResponse\Item>|\Google\Protobuf\Internal\RepeatedField $items
+     * }
+     */
+    public function __construct($data = NULL) {
+        \GPBMetadata\Tulip::initOnce();
+        parent::__construct($data);
+    }
+
+    /**
+     * Generated from protobuf field <code>repeated .mint.tulip.v1.BookListResponse.Item items = 1;</code>
+     * @return \Google\Protobuf\Internal\RepeatedField
+     */
+    public function getItems()
+    {
+        return $this->items;
+    }
+
+    /**
+     * Generated from protobuf field <code>repeated .mint.tulip.v1.BookListResponse.Item items = 1;</code>
+     * @param array<\Mint\Tulip\V1\BookListResponse\Item>|\Google\Protobuf\Internal\RepeatedField $var
+     * @return $this
+     */
+    public function setItems($var)
+    {
+        $arr = GPBUtil::checkRepeatedField($var, \Google\Protobuf\Internal\GPBType::MESSAGE, \Mint\Tulip\V1\BookListResponse\Item::class);
+        $this->items = $arr;
+
+        return $this;
+    }
+
+}
+

+ 88 - 0
rpc/tulip/tulip/Mint/Tulip/V1/BookListResponse/Item.php

@@ -0,0 +1,88 @@
+<?php
+# Generated by the protocol buffer compiler.  DO NOT EDIT!
+# source: tulip.proto
+
+namespace Mint\Tulip\V1\BookListResponse;
+
+use Google\Protobuf\Internal\GPBType;
+use Google\Protobuf\Internal\RepeatedField;
+use Google\Protobuf\Internal\GPBUtil;
+
+/**
+ * Generated from protobuf message <code>mint.tulip.v1.BookListResponse.Item</code>
+ */
+class Item extends \Google\Protobuf\Internal\Message
+{
+    /**
+     * Generated from protobuf field <code>int32 book = 1;</code>
+     */
+    protected $book = 0;
+    /**
+     * Generated from protobuf field <code>int32 count = 2;</code>
+     */
+    protected $count = 0;
+
+    /**
+     * Constructor.
+     *
+     * @param array $data {
+     *     Optional. Data for populating the Message object.
+     *
+     *     @type int $book
+     *     @type int $count
+     * }
+     */
+    public function __construct($data = NULL) {
+        \GPBMetadata\Tulip::initOnce();
+        parent::__construct($data);
+    }
+
+    /**
+     * Generated from protobuf field <code>int32 book = 1;</code>
+     * @return int
+     */
+    public function getBook()
+    {
+        return $this->book;
+    }
+
+    /**
+     * Generated from protobuf field <code>int32 book = 1;</code>
+     * @param int $var
+     * @return $this
+     */
+    public function setBook($var)
+    {
+        GPBUtil::checkInt32($var);
+        $this->book = $var;
+
+        return $this;
+    }
+
+    /**
+     * Generated from protobuf field <code>int32 count = 2;</code>
+     * @return int
+     */
+    public function getCount()
+    {
+        return $this->count;
+    }
+
+    /**
+     * Generated from protobuf field <code>int32 count = 2;</code>
+     * @param int $var
+     * @return $this
+     */
+    public function setCount($var)
+    {
+        GPBUtil::checkInt32($var);
+        $this->count = $var;
+
+        return $this;
+    }
+
+}
+
+// Adding a class alias for backwards compatibility with the previous class name.
+class_alias(Item::class, \Mint\Tulip\V1\BookListResponse_Item::class);
+

+ 22 - 8
rpc/tulip/tulip/Mint/Tulip/V1/SearchClient.php

@@ -31,30 +31,30 @@ class SearchClient extends \Grpc\BaseStub {
     }
 
     /**
-     * @param \Mint\Tulip\V1\UpdateRequest $argument input argument
+     * @param \Mint\Tulip\V1\SearchRequest $argument input argument
      * @param array $metadata metadata
      * @param array $options call options
      * @return \Grpc\UnaryCall
      */
-    public function Update(\Mint\Tulip\V1\UpdateRequest $argument,
+    public function BookList(\Mint\Tulip\V1\SearchRequest $argument,
       $metadata = [], $options = []) {
-        return $this->_simpleRequest('/mint.tulip.v1.Search/Update',
+        return $this->_simpleRequest('/mint.tulip.v1.Search/BookList',
         $argument,
-        ['\Mint\Tulip\V1\UpdateResponse', 'decode'],
+        ['\Mint\Tulip\V1\BookListResponse', 'decode'],
         $metadata, $options);
     }
 
     /**
-     * @param \Mint\Tulip\V1\UploadDictionaryRequest $argument input argument
+     * @param \Mint\Tulip\V1\UpdateRequest $argument input argument
      * @param array $metadata metadata
      * @param array $options call options
      * @return \Grpc\UnaryCall
      */
-    public function UploadDictionary(\Mint\Tulip\V1\UploadDictionaryRequest $argument,
+    public function Update(\Mint\Tulip\V1\UpdateRequest $argument,
       $metadata = [], $options = []) {
-        return $this->_simpleRequest('/mint.tulip.v1.Search/UploadDictionary',
+        return $this->_simpleRequest('/mint.tulip.v1.Search/Update',
         $argument,
-        ['\Mint\Tulip\V1\UploadDictionaryResponse', 'decode'],
+        ['\Mint\Tulip\V1\UpdateResponse', 'decode'],
         $metadata, $options);
     }
 
@@ -72,4 +72,18 @@ class SearchClient extends \Grpc\BaseStub {
         $metadata, $options);
     }
 
+    /**
+     * @param \Mint\Tulip\V1\UploadDictionaryRequest $argument input argument
+     * @param array $metadata metadata
+     * @param array $options call options
+     * @return \Grpc\UnaryCall
+     */
+    public function UploadDictionary(\Mint\Tulip\V1\UploadDictionaryRequest $argument,
+      $metadata = [], $options = []) {
+        return $this->_simpleRequest('/mint.tulip.v1.Search/UploadDictionary',
+        $argument,
+        ['\Mint\Tulip\V1\UploadDictionaryResponse', 'decode'],
+        $metadata, $options);
+    }
+
 }

+ 27 - 0
rpc/tulip/tulip/Mint/Tulip/V1/SearchRequest.php

@@ -23,6 +23,10 @@ class SearchRequest extends \Google\Protobuf\Internal\Message
      * Generated from protobuf field <code>repeated int32 books = 2;</code>
      */
     private $books;
+    /**
+     * Generated from protobuf field <code>string match_mode = 3;</code>
+     */
+    protected $match_mode = '';
     /**
      * Generated from protobuf field <code>optional .mint.tulip.v1.SearchRequest.Page page = 99;</code>
      */
@@ -36,6 +40,7 @@ class SearchRequest extends \Google\Protobuf\Internal\Message
      *
      *     @type array<string>|\Google\Protobuf\Internal\RepeatedField $keywords
      *     @type array<int>|\Google\Protobuf\Internal\RepeatedField $books
+     *     @type string $match_mode
      *     @type \Mint\Tulip\V1\SearchRequest\Page $page
      * }
      */
@@ -88,6 +93,28 @@ class SearchRequest extends \Google\Protobuf\Internal\Message
         return $this;
     }
 
+    /**
+     * Generated from protobuf field <code>string match_mode = 3;</code>
+     * @return string
+     */
+    public function getMatchMode()
+    {
+        return $this->match_mode;
+    }
+
+    /**
+     * Generated from protobuf field <code>string match_mode = 3;</code>
+     * @param string $var
+     * @return $this
+     */
+    public function setMatchMode($var)
+    {
+        GPBUtil::checkString($var, True);
+        $this->match_mode = $var;
+
+        return $this;
+    }
+
     /**
      * Generated from protobuf field <code>optional .mint.tulip.v1.SearchRequest.Page page = 99;</code>
      * @return \Mint\Tulip\V1\SearchRequest\Page|null

+ 36 - 16
rpc/tulip/tulip/Mint/Tulip/V1/SearchStub.php

@@ -22,29 +22,29 @@ class SearchStub {
     }
 
     /**
-     * @param \Mint\Tulip\V1\UpdateRequest $request client request
+     * @param \Mint\Tulip\V1\SearchRequest $request client request
      * @param \Grpc\ServerContext $context server request context
-     * @return \Mint\Tulip\V1\UpdateResponse for response data, null if if error occured
+     * @return \Mint\Tulip\V1\BookListResponse for response data, null if if error occured
      *     initial metadata (if any) and status (if not ok) should be set to $context
      */
-    public function Update(
-        \Mint\Tulip\V1\UpdateRequest $request,
+    public function BookList(
+        \Mint\Tulip\V1\SearchRequest $request,
         \Grpc\ServerContext $context
-    ): ?\Mint\Tulip\V1\UpdateResponse {
+    ): ?\Mint\Tulip\V1\BookListResponse {
         $context->setStatus(\Grpc\Status::unimplemented());
         return null;
     }
 
     /**
-     * @param \Mint\Tulip\V1\UploadDictionaryRequest $request client request
+     * @param \Mint\Tulip\V1\UpdateRequest $request client request
      * @param \Grpc\ServerContext $context server request context
-     * @return \Mint\Tulip\V1\UploadDictionaryResponse for response data, null if if error occured
+     * @return \Mint\Tulip\V1\UpdateResponse for response data, null if if error occured
      *     initial metadata (if any) and status (if not ok) should be set to $context
      */
-    public function UploadDictionary(
-        \Mint\Tulip\V1\UploadDictionaryRequest $request,
+    public function Update(
+        \Mint\Tulip\V1\UpdateRequest $request,
         \Grpc\ServerContext $context
-    ): ?\Mint\Tulip\V1\UploadDictionaryResponse {
+    ): ?\Mint\Tulip\V1\UpdateResponse {
         $context->setStatus(\Grpc\Status::unimplemented());
         return null;
     }
@@ -63,6 +63,20 @@ class SearchStub {
         return null;
     }
 
+    /**
+     * @param \Mint\Tulip\V1\UploadDictionaryRequest $request client request
+     * @param \Grpc\ServerContext $context server request context
+     * @return \Mint\Tulip\V1\UploadDictionaryResponse for response data, null if if error occured
+     *     initial metadata (if any) and status (if not ok) should be set to $context
+     */
+    public function UploadDictionary(
+        \Mint\Tulip\V1\UploadDictionaryRequest $request,
+        \Grpc\ServerContext $context
+    ): ?\Mint\Tulip\V1\UploadDictionaryResponse {
+        $context->setStatus(\Grpc\Status::unimplemented());
+        return null;
+    }
+
     /**
      * Get the method descriptors of the service for server registration
      *
@@ -77,16 +91,16 @@ class SearchStub {
                 '\Mint\Tulip\V1\SearchRequest',
                 \Grpc\MethodDescriptor::UNARY_CALL
             ),
-            '/mint.tulip.v1.Search/Update' => new \Grpc\MethodDescriptor(
+            '/mint.tulip.v1.Search/BookList' => new \Grpc\MethodDescriptor(
                 $this,
-                'Update',
-                '\Mint\Tulip\V1\UpdateRequest',
+                'BookList',
+                '\Mint\Tulip\V1\SearchRequest',
                 \Grpc\MethodDescriptor::UNARY_CALL
             ),
-            '/mint.tulip.v1.Search/UploadDictionary' => new \Grpc\MethodDescriptor(
+            '/mint.tulip.v1.Search/Update' => new \Grpc\MethodDescriptor(
                 $this,
-                'UploadDictionary',
-                '\Mint\Tulip\V1\UploadDictionaryRequest',
+                'Update',
+                '\Mint\Tulip\V1\UpdateRequest',
                 \Grpc\MethodDescriptor::UNARY_CALL
             ),
             '/mint.tulip.v1.Search/UpdateIndex' => new \Grpc\MethodDescriptor(
@@ -95,6 +109,12 @@ class SearchStub {
                 '\Mint\Tulip\V1\UpdateIndexRequest',
                 \Grpc\MethodDescriptor::UNARY_CALL
             ),
+            '/mint.tulip.v1.Search/UploadDictionary' => new \Grpc\MethodDescriptor(
+                $this,
+                'UploadDictionary',
+                '\Mint\Tulip\V1\UploadDictionaryRequest',
+                \Grpc\MethodDescriptor::UNARY_CALL
+            ),
         ];
     }