Skip to content

Commit a72e831

Browse files
authored
Merge branch 'v2' into INT-950
2 parents bd8d98d + 1f12816 commit a72e831

20 files changed

+359
-10
lines changed

.github/workflows/autorelease.yml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,9 @@ jobs:
1818
python-version: 3.8
1919
- name: Set up PDM
2020
uses: pdm-project/setup-pdm@v3
21+
with:
22+
python-version: 3.8
23+
version: 2.20.1
2124

2225
- name: Install dependencies
2326
run: pdm install -dG release

.github/workflows/publish.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ jobs:
1313
- uses: actions/checkout@v3
1414
- name: Set up PDM
1515
uses: pdm-project/setup-pdm@v3
16+
with:
17+
version: 2.20.1
1618

1719
- name: Publish package distributions to PyPI
1820
run: pdm publish

.github/workflows/python-linters.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ jobs:
1818
uses: pdm-project/setup-pdm@v3
1919
with:
2020
python-version: ${{ matrix.python-version }}
21+
version: 2.20.1
2122

2223
- name: Install dependencies
2324
run: |

.github/workflows/python-tests.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ jobs:
1919
uses: pdm-project/setup-pdm@v3
2020
with:
2121
python-version: ${{ matrix.python-version }}
22+
version: 2.20.1
2223

2324
- name: Install dependencies
2425
run: |

huntflow_api_client/entities/__init__.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@
2121
from huntflow_api_client.entities.regions import Region
2222
from huntflow_api_client.entities.rejection_reason import RejectionReason
2323
from huntflow_api_client.entities.resume import Resume
24+
from huntflow_api_client.entities.survey_type_a import SurveyTypeA
2425
from huntflow_api_client.entities.survey_type_q import SurveyTypeQ
2526
from huntflow_api_client.entities.tags import AccountTag, ApplicantTag
2627
from huntflow_api_client.entities.user_settings import UserSettings
@@ -56,11 +57,12 @@
5657
"Region",
5758
"RejectionReason",
5859
"Resume",
60+
"SurveyTypeA",
61+
"SurveyTypeQ",
5962
"User",
6063
"UsersManagement",
6164
"UserSettings",
6265
"Vacancy",
6366
"VacancyRequest",
6467
"Webhook",
65-
"SurveyTypeQ",
6668
)

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())
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
from huntflow_api_client.entities.base import BaseEntity, GetEntityMixin, ListEntityMixin
2+
from huntflow_api_client.models.response.survey import (
3+
SurveyAnswerTypeAResponse,
4+
SurveySchemasTypeAListResponse,
5+
SurveySchemaTypeAResponse,
6+
)
7+
8+
9+
class SurveyTypeA(BaseEntity, GetEntityMixin, ListEntityMixin):
10+
async def list(
11+
self,
12+
account_id: int,
13+
active: bool = True,
14+
) -> SurveySchemasTypeAListResponse:
15+
"""
16+
API method reference
17+
https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/surveys/type_a
18+
19+
:param account_id: Organization ID
20+
:param active: Shows only active schemas
21+
:return: List of all applicant feedback forms in organization.
22+
"""
23+
params = {"active": active}
24+
response = await self._api.request(
25+
"GET",
26+
f"/accounts/{account_id}/surveys/type_a",
27+
params=params,
28+
)
29+
return SurveySchemasTypeAListResponse.model_validate(response.json())
30+
31+
async def get(self, account_id: int, survey_id: int) -> SurveySchemaTypeAResponse:
32+
"""
33+
API method reference
34+
https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/surveys/type_a/-survey_id-
35+
36+
:param account_id: Organization ID
37+
:param survey_id: Survey ID
38+
:return: An applicant feedback forms in organization.
39+
"""
40+
response = await self._api.request(
41+
"GET",
42+
f"/accounts/{account_id}/surveys/type_a/{survey_id}",
43+
)
44+
return SurveySchemaTypeAResponse.model_validate(response.json())
45+
46+
async def get_applicant_answer(
47+
self,
48+
account_id: int,
49+
survey_id: int,
50+
answer_id: int,
51+
) -> SurveyAnswerTypeAResponse:
52+
"""
53+
API method reference
54+
https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/surveys/type_a/-survey_id-/answers/-answer_id-
55+
56+
:param account_id: Organization ID
57+
:param survey_id: Survey ID
58+
:param answer_id: Answer ID
59+
:return: Returns answer of applicant feedback form.
60+
"""
61+
response = await self._api.request(
62+
"GET",
63+
f"/accounts/{account_id}/surveys/type_a/{survey_id}/answers/{answer_id}",
64+
)
65+
return SurveyAnswerTypeAResponse.model_validate(response.json())

huntflow_api_client/entities/users_management.py

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
1-
from typing import Any, Dict, Optional
1+
from typing import Any, Dict, List, Optional
22

33
from huntflow_api_client.entities.base import BaseEntity
4+
from huntflow_api_client.models.consts import MemberType
45
from huntflow_api_client.models.request.users_management import ForeignUserRequest
56
from huntflow_api_client.models.response.users_management import (
67
CreatedUserControlTaskResponse,
@@ -15,6 +16,7 @@ class UsersManagement(BaseEntity):
1516
async def get_users_with_foreign(
1617
self,
1718
account_id: int,
19+
member_types: Optional[List[MemberType]] = None,
1820
count: Optional[int] = 30,
1921
page: Optional[int] = 1,
2022
) -> ForeignUsersListResponse:
@@ -23,6 +25,7 @@ async def get_users_with_foreign(
2325
https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/users/foreign
2426
2527
:param account_id: Organization ID
28+
:param member_types: Array of member types
2629
:param count: Number of items per page
2730
:param page: Page number
2831
@@ -32,6 +35,8 @@ async def get_users_with_foreign(
3235
All identifiers in response are foreign.
3336
"""
3437
params: Dict[str, Any] = {"count": count, "page": page}
38+
if member_types:
39+
params["member_types"] = [member_type.value for member_type in member_types]
3540
response = await self._api.request(
3641
"GET",
3742
f"/accounts/{account_id}/users/foreign",

huntflow_api_client/entities/webhooks.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,35 @@
1+
from typing import Any, Dict, Optional
2+
13
from huntflow_api_client.entities.base import (
24
BaseEntity,
35
CreateEntityMixin,
46
DeleteEntityMixin,
57
ListEntityMixin,
68
)
9+
from huntflow_api_client.models.consts import WebhookType
710
from huntflow_api_client.models.request.webhooks import WebhookRequest
811
from huntflow_api_client.models.response.webhooks import WebhookResponse, WebhooksListResponse
912

1013

1114
class Webhook(BaseEntity, ListEntityMixin, CreateEntityMixin, DeleteEntityMixin):
12-
async def list(self, account_id: int) -> WebhooksListResponse:
15+
async def list(
16+
self,
17+
account_id: int,
18+
webhook_type: Optional[WebhookType] = None,
19+
) -> WebhooksListResponse:
1320
"""
1421
API method reference https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/hooks
1522
1623
:param account_id: Organization ID
24+
:param webhook_type: Webhook type. If no value provided, webhooks of all types will be
25+
returned.
1726
:return: List of webhooks
1827
"""
1928
path = f"/accounts/{account_id}/hooks"
20-
response = await self._api.request("GET", path)
29+
params: Dict[str, Any] = {}
30+
if webhook_type:
31+
params["webhook_type"] = webhook_type.value
32+
response = await self._api.request("GET", path, params=params)
2133
return WebhooksListResponse.model_validate(response.json())
2234

2335
async def create(self, account_id: int, data: WebhookRequest) -> WebhookResponse:

huntflow_api_client/models/consts.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,13 @@ class WebhookEvent(str, Enum):
77
RESPONSE = "RESPONSE"
88
OFFER = "OFFER"
99
VACANCY_REQUEST = "VACANCY-REQUEST"
10+
RECRUITMENT_EVALUATION = "RECRUITMENT-EVALUATION"
11+
SURVEY_QUESTIONARY = "SURVEY-QUESTIONARY"
12+
13+
14+
class WebhookType(str, Enum):
15+
USER = "USER"
16+
APPLICATION = "APPLICATION"
1017

1118

1219
class MemberType(str, Enum):
@@ -154,6 +161,7 @@ class ActionLogType(str, Enum):
154161
VACANCY_EXTERNAL = "VACANCY_EXTERNAL"
155162
ACCOUNT_MEMBER = "ACCOUNT_MEMBER"
156163
DOWNLOAD_APPLICANTS = "DOWNLOAD_APPLICANTS"
164+
PASSWORD_CHANGE = "PASSWORD_CHANGE"
157165

158166

159167
class SurveyType(str, Enum):
@@ -172,7 +180,6 @@ class UserControlTaskStatus(str, Enum):
172180
SUCCESS = "SUCCESS"
173181
FAILED = "FAILED"
174182

175-
176183
class RecommendationProcessingStatus(str, Enum):
177184
ALL = "ALL"
178185
PROCESSED = "PROCESSED"
@@ -183,3 +190,8 @@ class RecommendationStatus(str, Enum):
183190
TAKEN = "TAKEN"
184191
TAKEN_OTHER = "TAKEN_OTHER"
185192
DECLINED = "DECLINED"
193+
194+
195+
class InterviewType(str, Enum):
196+
USER = "user"
197+
INTERVIEW = "interview"

0 commit comments

Comments
 (0)