Skip to content

Commit 713f709

Browse files
authored
Merge pull request #92 from huntflow/INT-561_create_ApplicantResponse_entity
[INT-561] - Create ApplicantResponse entity.
2 parents 40841e8 + 9d46499 commit 713f709

6 files changed

Lines changed: 315 additions & 572 deletions

File tree

huntflow_api_client/entities/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@
66
from huntflow_api_client.entities.applicant_offers import ApplicantOffer
77
from huntflow_api_client.entities.applicant_on_vacancy import ApplicantOnVacancy
88
from huntflow_api_client.entities.applicant_on_vacancy_status import ApplicantOnVacancyStatus
9+
from huntflow_api_client.entities.applicant_reponse import ApplicantResponse
910
from huntflow_api_client.entities.applicants import Applicant
1011
from huntflow_api_client.entities.coworkers import Coworker
1112
from huntflow_api_client.entities.delayed_tasks import DelayedTask
@@ -41,6 +42,7 @@
4142
"ApplicantOffer",
4243
"ApplicantOnVacancy",
4344
"ApplicantOnVacancyStatus",
45+
"ApplicantResponse",
4446
"ApplicantTag",
4547
"ApplicantsQuestionary",
4648
"Coworker",
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from typing import Any, Dict, Optional
2+
3+
from huntflow_api_client.entities.base import BaseEntity, ListEntityMixin
4+
from huntflow_api_client.models.response.applicant_response import ApplicantResponsesListResponse
5+
6+
7+
class ApplicantResponse(BaseEntity, ListEntityMixin):
8+
async def list(
9+
self,
10+
account_id: int,
11+
applicant_id: int,
12+
count: int = 30,
13+
next_page_cursor: Optional[str] = None,
14+
) -> ApplicantResponsesListResponse:
15+
"""
16+
API method reference:
17+
https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/applicants/-applicant_id-/responses
18+
19+
:param account_id: Organization ID
20+
:param applicant_id: Applicant ID
21+
:param count: Number of items per page
22+
:param next_page_cursor: Next page cursor
23+
24+
:return: List of applicant's responses from job sites
25+
"""
26+
path = f"/accounts/{account_id}/applicants/{applicant_id}/responses"
27+
params: Dict[str, Any] = {"count": count}
28+
if next_page_cursor:
29+
params["next_page_cursor"] = next_page_cursor
30+
response = await self._api.request("GET", path, params=params)
31+
return ApplicantResponsesListResponse.model_validate(response.json())
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
from datetime import datetime
2+
from typing import List, Optional
3+
4+
from pydantic import BaseModel, Field
5+
6+
7+
class ApplicantResponseVacancy(BaseModel):
8+
id: int = Field(..., description="Vacancy ID")
9+
position: str = Field(..., description="The name of the vacancy (occupation)")
10+
11+
12+
class ApplicantResponseVacancyExternal(BaseModel):
13+
id: int = Field(..., description="Publication ID")
14+
foreign: str = Field(..., description="Foreign publication ID (from job site)")
15+
16+
17+
class ApplicantResponse(BaseModel):
18+
id: int = Field(..., description="Response ID")
19+
foreign: str = Field(..., description="Foreign response ID (from job site)")
20+
created: datetime
21+
applicant_external: int = Field(..., description="Resume ID")
22+
vacancy: ApplicantResponseVacancy = Field(..., description="Vacancy")
23+
vacancy_external: ApplicantResponseVacancyExternal = Field(
24+
...,
25+
description="Publication of a vacancy for which an applicant responded",
26+
)
27+
28+
29+
class ApplicantResponsesListResponse(BaseModel):
30+
items: List[ApplicantResponse] = Field(..., description="List of applicant's responses")
31+
next_page_cursor: Optional[str] = Field(None, description="Next page cursor")

0 commit comments

Comments
 (0)