Skip to content

Commit

Permalink
Synthesis client update
Browse files Browse the repository at this point in the history
  • Loading branch information
munrojm committed May 11, 2021
1 parent 5351f80 commit f010860
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 3 deletions.
23 changes: 22 additions & 1 deletion src/mp_api/routes/synthesis/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,4 +5,25 @@
class SynthesisRester(BaseRester):

suffix = "synthesis"
document_model = SynthesisDoc
document_model = SynthesisDoc # type: ignore

def search_synthesis_text(self, keywords: list[str]):
"""
Search synthesis recipe text.
Arguments:
keywords (List[str]): List of search keywords
Returns:
synthesis_docs ([SynthesisDoc]): List of synthesis documents
"""

keyword_string = ",".join(keywords)

synthesis_docs = self._query_resource(
criteria={"keywords": keyword_string},
suburl="text_search",
use_document_model=True,
)

return synthesis_docs
10 changes: 8 additions & 2 deletions src/mp_api/routes/synthesis/client.pyi
Original file line number Diff line number Diff line change
@@ -1,8 +1,14 @@
from typing import List
from typing import List, Optional
from mp_api.routes.synthesis.models import SynthesisDoc


class SynthesisRester:

def query_text(self, keywords: List[str]) -> SynthesisDoc:
def get_document_by_id(
self,
document_id: str,
fields: Optional[List[str]] = None,
monty_decode: bool = True,
version: Optional[str] = None,
) -> SynthesisDoc:
...

0 comments on commit f010860

Please sign in to comment.