Skip to content

Commit ef98b7b

Browse files
committed
Merge branch 'v2' into DEV-22316
# Conflicts: # pyproject.toml
2 parents c80047e + 3da0ff7 commit ef98b7b

38 files changed

Lines changed: 953 additions & 259 deletions

.github/workflows/autorelease.yml

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,16 +8,23 @@ jobs:
88
autorelease:
99
if: github.event.pull_request.merged == true
1010

11-
runs-on: ubuntu-20.04
11+
runs-on: ubuntu-latest
12+
strategy:
13+
matrix:
14+
python-version: [ '3.8.16' ]
15+
1216
steps:
1317
- uses: actions/checkout@v3
1418

1519
- name: Set up python
1620
uses: actions/setup-python@v4
1721
with:
18-
python-version: 3.8
22+
python-version: ${{ matrix.python-version }}
1923
- name: Set up PDM
2024
uses: pdm-project/setup-pdm@v3
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
version: 2.20.1
2128

2229
- name: Install dependencies
2330
run: pdm install -dG release

.github/workflows/publish.yml

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,27 @@ on:
66

77
jobs:
88
build-and-publish:
9-
runs-on: ubuntu-20.04
9+
runs-on: ubuntu-latest
10+
strategy:
11+
matrix:
12+
python-version: [ '3.8.16' ]
13+
1014
permissions:
1115
id-token: write
16+
1217
steps:
1318
- uses: actions/checkout@v3
19+
20+
- name: Set up python
21+
uses: actions/setup-python@v4
22+
with:
23+
python-version: ${{ matrix.python-version }}
24+
1425
- name: Set up PDM
1526
uses: pdm-project/setup-pdm@v3
27+
with:
28+
python-version: ${{ matrix.python-version }}
29+
version: 2.20.1
1630

1731
- name: Publish package distributions to PyPI
1832
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: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,11 @@
1818
from huntflow_api_client.entities.organization_settings import OrganizationSettings
1919
from huntflow_api_client.entities.production_calendars import ProductionCalendar
2020
from huntflow_api_client.entities.questionary import ApplicantsQuestionary
21+
from huntflow_api_client.entities.recommendation import Recommendation
2122
from huntflow_api_client.entities.regions import Region
2223
from huntflow_api_client.entities.rejection_reason import RejectionReason
2324
from huntflow_api_client.entities.resume import Resume
25+
from huntflow_api_client.entities.survey_type_a import SurveyTypeA
2426
from huntflow_api_client.entities.survey_type_q import SurveyTypeQ
2527
from huntflow_api_client.entities.tags import AccountTag, ApplicantTag
2628
from huntflow_api_client.entities.user_settings import UserSettings
@@ -53,14 +55,16 @@
5355
"MultiVacancy",
5456
"OrganizationSettings",
5557
"ProductionCalendar",
58+
"Recommendation",
5659
"Region",
5760
"RejectionReason",
5861
"Resume",
62+
"SurveyTypeA",
63+
"SurveyTypeQ",
5964
"User",
6065
"UsersManagement",
6166
"UserSettings",
6267
"Vacancy",
6368
"VacancyRequest",
6469
"Webhook",
65-
"SurveyTypeQ",
6670
)

huntflow_api_client/entities/applicants.py

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,12 @@
1212
ApplicantUpdateRequest,
1313
)
1414
from huntflow_api_client.models.response.applicants import (
15+
ApplicantCreateAgreementLinkResponse,
1516
ApplicantCreateResponse,
1617
ApplicantItem,
1718
ApplicantListResponse,
1819
ApplicantSearchByCursorResponse,
20+
ApplicantSendAgreementResponse,
1921
)
2022

2123

@@ -186,3 +188,41 @@ async def search_by_cursor(
186188

187189
response = await self._api.request("GET", path, params=params)
188190
return ApplicantSearchByCursorResponse.model_validate(response.json())
191+
192+
async def create_agreement_link(
193+
self,
194+
account_id: int,
195+
applicant_id: int,
196+
) -> ApplicantCreateAgreementLinkResponse:
197+
"""
198+
API method reference:
199+
https://api.huntflow.ai/v2/docs#post-/accounts/-account_id-/applicants/-applicant_id-/agreement_link
200+
201+
:param account_id: Organization ID
202+
:param applicant_id: Applicant ID
203+
:return: Link to interact with agreement
204+
"""
205+
response = await self._api.request(
206+
"POST",
207+
f"/accounts/{account_id}/applicants/{applicant_id}/agreement_link",
208+
)
209+
return ApplicantCreateAgreementLinkResponse.model_validate(response.json())
210+
211+
async def send_agreement_via_email(
212+
self,
213+
account_id: int,
214+
applicant_id: int,
215+
) -> ApplicantSendAgreementResponse:
216+
"""
217+
API method reference:
218+
https://api.huntflow.ai/v2/docs#post-/accounts/-account_id-/applicants/-applicant_id-/agreement_email
219+
220+
:param account_id: Organization ID
221+
:param applicant_id: Applicant ID
222+
:return: Job_id and recipient email of agreement
223+
"""
224+
response = await self._api.request(
225+
"POST",
226+
f"/accounts/{account_id}/applicants/{applicant_id}/agreement_email",
227+
)
228+
return ApplicantSendAgreementResponse.model_validate(response.json())

huntflow_api_client/entities/file.py

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from typing import BinaryIO, Optional, Union
1+
from typing import BinaryIO, Dict, Optional, Tuple, Union
22

33
from huntflow_api_client.entities.base import BaseEntity
44
from huntflow_api_client.models.request.file import UploadFileHeaders
@@ -12,6 +12,7 @@ async def upload(
1212
headers: UploadFileHeaders,
1313
file: Union[bytes, BinaryIO],
1414
preset: Optional[str] = None,
15+
filename: Optional[str] = None,
1516
) -> UploadResponse:
1617
"""
1718
API method reference https://api.huntflow.ai/v2/docs#post-/accounts/-account_id-/upload
@@ -20,16 +21,24 @@ async def upload(
2021
:param file: File
2122
:param preset: Preset
2223
:param headers: Headers
24+
:param filename: Filename
2325
:return: Additional data
2426
"""
2527

2628
data = {}
2729
if preset:
2830
data["preset"] = preset
31+
32+
files: Dict[str, Union[Union[bytes, BinaryIO], Tuple[str, Union[bytes, BinaryIO]]]] = {}
33+
if filename:
34+
files["file"] = (filename, file)
35+
else:
36+
files["file"] = file
37+
2938
response = await self._api.request(
3039
"POST",
3140
f"/accounts/{account_id}/upload",
32-
files={"file": file},
41+
files=files,
3342
data=data,
3443
headers=headers.jsonable_dict(exclude_none=True, by_alias=True),
3544
)

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: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
from typing import Dict, Optional, Union
2+
3+
from huntflow_api_client.entities.base import BaseEntity, ListEntityMixin
4+
from huntflow_api_client.models.consts import RecommendationProcessingStatus
5+
from huntflow_api_client.models.response.recommendation import RecommendationListResponse
6+
7+
8+
class Recommendation(BaseEntity, ListEntityMixin):
9+
async def list(
10+
self,
11+
account_id: int,
12+
vacancy_id: int,
13+
count: int = 30,
14+
processing_status: RecommendationProcessingStatus = RecommendationProcessingStatus.ALL,
15+
next_page_cursor: Optional[str] = None,
16+
) -> RecommendationListResponse:
17+
"""
18+
API method reference
19+
https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/recommendations/-vacancy_id-
20+
21+
:param account_id: Organization ID
22+
:param vacancy_id: Vacancy ID
23+
:param count: Number of items per page
24+
:param next_page_cursor: Next page cursor
25+
:param processing_status: Get all recommendations or processed/unprocessed only
26+
:return: A list of applicants recommended for a vacancy
27+
"""
28+
params: Dict[str, Union[str, int]]
29+
if next_page_cursor is not None:
30+
params = {"next_page_cursor": next_page_cursor}
31+
else:
32+
params = {"count": count}
33+
params["processing_status"] = processing_status.value
34+
35+
response = await self._api.request(
36+
"GET",
37+
f"/accounts/{account_id}/recommendations/{vacancy_id}",
38+
params=params,
39+
)
40+
return RecommendationListResponse.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())

0 commit comments

Comments
 (0)