feat(rpc): add msearch type handler

Signed-off-by: Kevin Morris <kevr@0cost.org>
This commit is contained in:
Kevin Morris 2021-10-30 22:56:18 -07:00
parent 9fef8b0611
commit 05e6cfca62
No known key found for this signature in database
GPG key ID: F7E46DED420788F3
2 changed files with 32 additions and 15 deletions

View file

@ -101,12 +101,6 @@ class RPC:
if self.type not in RPC.EXPOSED_TYPES:
raise RPCError("Incorrect request type specified.")
try:
getattr(self, f"_handle_{self.type.replace('-', '_')}_type")
except AttributeError:
raise RPCError(
f"Request type '{self.type}' is not yet implemented.")
def _enforce_args(self, args: List[str]):
if not args:
raise RPCError("No request type/data specified.")
@ -211,6 +205,9 @@ class RPC:
results = search.results().limit(max_results)
return [self._get_json_data(pkg) for pkg in results]
def _handle_msearch_type(self, args: List[str] = [], **kwargs):
return self._handle_search_type(by="m", args=args)
def _handle_suggest_type(self, args: List[str] = [], **kwargs):
if not args:
return []