Skip to content

Commit 54a90ad

Browse files
authored
Merge pull request #96 from huntflow/INT-650_get_interview_types_endpoint
[INT-650] - Add get_interview_types() to the OrganizationSettings entity.
2 parents 419c165 + 34c79af commit 54a90ad

5 files changed

Lines changed: 67 additions & 1 deletion

File tree

huntflow_api_client/entities/organization_settings.py

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from huntflow_api_client.entities.base import BaseEntity
2+
from huntflow_api_client.models.response.interview_types import InterviewTypesListResponse
23
from huntflow_api_client.models.response.organization_settings import (
34
BaseSurveySchemaTypeWithSchemas,
45
CloseReasonsListResponse,
@@ -53,3 +54,15 @@ async def get_applicant_survey_form(
5354
f"/accounts/{account_id}/surveys/type_a/{survey_id}",
5455
)
5556
return BaseSurveySchemaTypeWithSchemas.model_validate(response.json())
57+
58+
async def get_interview_types(self, account_id: int) -> InterviewTypesListResponse:
59+
"""
60+
API method reference
61+
https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/interview_types
62+
63+
:param account_id: Organization ID
64+
65+
:return: List of interview types
66+
"""
67+
response = await self._api.request("GET", f"/accounts/{account_id}/interview_types")
68+
return InterviewTypesListResponse.model_validate(response.json())

huntflow_api_client/models/consts.py

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -171,3 +171,8 @@ class UserControlTaskStatus(str, Enum):
171171
PENDING = "PENDING"
172172
SUCCESS = "SUCCESS"
173173
FAILED = "FAILED"
174+
175+
176+
class InterviewType(str, Enum):
177+
USER = "user"
178+
INTERVIEW = "interview"
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from typing import List
2+
3+
from pydantic import BaseModel, Field
4+
5+
from huntflow_api_client.models.consts import InterviewType as InterviewTypeEnum
6+
7+
8+
class InterviewType(BaseModel):
9+
id: int = Field(..., description="Interview type ID", examples=[20])
10+
name: str = Field(..., description="Interview type name", examples=["Phone interview"])
11+
account: int = Field(..., description="Organization ID", examples=[42])
12+
order: int = Field(..., description="Order number")
13+
type: InterviewTypeEnum = Field(
14+
...,
15+
description="Type of the interview",
16+
examples=[InterviewTypeEnum.USER],
17+
)
18+
19+
20+
class InterviewTypesListResponse(BaseModel):
21+
items: List[InterviewType]

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11

22
[project]
33
name = "huntflow-api-client"
4-
version = "2.2.0"
4+
version = "2.3.0"
55
description = "Huntflow API Client for Python"
66
authors = [
77
{name = "Developers huntflow", email = "developer@huntflow.ru"},

tests/test_entities/test_organization_settings.py

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
from huntflow_api_client import HuntflowAPI
66
from huntflow_api_client.entities.organization_settings import OrganizationSettings
7+
from huntflow_api_client.models.response.interview_types import InterviewTypesListResponse
78
from huntflow_api_client.models.response.organization_settings import (
89
BaseSurveySchemaTypeWithSchemas,
910
CloseReasonsListResponse,
@@ -27,6 +28,17 @@
2728
"schema": {},
2829
"ui_schema": {},
2930
}
31+
INTERVIEW_TYPES_RESPONSE: Dict[str, Any] = {
32+
"items": [
33+
{
34+
"id": 20,
35+
"name": "Phone interview",
36+
"account": 42,
37+
"order": 0,
38+
"type": "user",
39+
},
40+
],
41+
}
3042

3143

3244
async def test_get_hold_reasons(
@@ -72,3 +84,18 @@ async def test_get_applicant_survey_form(
7284

7385
response = await settings.get_applicant_survey_form(ACCOUNT_ID, SURVEY_ID)
7486
assert response == BaseSurveySchemaTypeWithSchemas(**SURVEY_FORM_RESPONSE)
87+
88+
89+
async def test_get_interview_types(
90+
httpx_mock: HTTPXMock,
91+
token_proxy: HuntflowTokenProxy,
92+
) -> None:
93+
httpx_mock.add_response(
94+
url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/interview_types",
95+
json=INTERVIEW_TYPES_RESPONSE,
96+
)
97+
api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy)
98+
settings = OrganizationSettings(api_client)
99+
100+
response = await settings.get_interview_types(ACCOUNT_ID)
101+
assert response == InterviewTypesListResponse(**INTERVIEW_TYPES_RESPONSE)

0 commit comments

Comments
 (0)