Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
31 additions
and
6 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,28 @@ | ||
from mp_api.core.client import BaseRester | ||
from mp_api.routes.synthesis.models import SynthesisRecipe | ||
from mp_api.routes.synthesis.models import SynthesisSearchResultModel | ||
from typing import List | ||
|
||
|
||
class SynthesisRester(BaseRester): | ||
|
||
suffix = "synthesis" | ||
document_model = SynthesisRecipe | ||
document_model = SynthesisSearchResultModel # 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 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,8 +1,13 @@ | ||
from typing import List | ||
from mp_api.routes.synthesis.models import SynthesisRecipe | ||
from typing import List, Optional | ||
from mp_api.routes.synthesis.models import SynthesisSearchResultModel | ||
|
||
|
||
class SynthesisRester: | ||
|
||
def query_text(self, keywords: List[str]) -> SynthesisRecipe: | ||
... | ||
def get_document_by_id( | ||
self, | ||
document_id: str, | ||
fields: Optional[List[str]] = None, | ||
monty_decode: bool = True, | ||
version: Optional[str] = None, | ||
) -> SynthesisSearchResultModel: ... |