Skip to content
This repository has been archived by the owner on May 9, 2024. It is now read-only.

Commit

Permalink
search people
Browse files Browse the repository at this point in the history
  • Loading branch information
Julien Rossow-Greenberg committed Feb 23, 2024
1 parent e9f106d commit 0f8c132
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 1 deletion.
14 changes: 13 additions & 1 deletion pytdx/tdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -537,7 +537,7 @@ def search_kb_articles(
return [KnowledgeArticle(**item) for item in response]

#
# PERSON
# People
#

def get_person(
Expand All @@ -551,3 +551,15 @@ def get_person(

response = self.__request("GET", url=url)
return Person(**response)

def search_people(self, search_payload: dict) -> List[Person]:
"""
Search People
{
"UserName": "[email protected]",
}
"""
url = f"{self.people_url}/search"

response = self.__request("POST", url=url, data=search_payload)
return [Person(**item) for item in response]
9 changes: 9 additions & 0 deletions tests/test_tdx.py
Original file line number Diff line number Diff line change
Expand Up @@ -117,6 +117,15 @@ def test_get_person(tdx_client):
assert isinstance(result, Person)


def test_search_people(tdx_client):
result = tdx_client.search_people(
search_payload={
"UserName": "[email protected]",
}
)
assert result[0].UID == "eb449a7d-df73-ee11-826a-0050f2f4736d"


### Admin tests

"""
Expand Down

0 comments on commit 0f8c132

Please sign in to comment.