Skip to content

Commit cdaa167

Browse files
committed
DEV-22328: client to hfapi2
1 parent 48cc600 commit cdaa167

22 files changed

Lines changed: 141 additions & 24 deletions

huntflow_api_client/entities/__init__.py

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@
2525
from huntflow_api_client.entities.survey_type_a import SurveyTypeA
2626
from huntflow_api_client.entities.survey_type_q import SurveyTypeQ
2727
from huntflow_api_client.entities.tags import AccountTag, ApplicantTag
28+
from huntflow_api_client.entities.token import Token
2829
from huntflow_api_client.entities.user_settings import UserSettings
2930
from huntflow_api_client.entities.users import User
3031
from huntflow_api_client.entities.users_management import UsersManagement
@@ -61,6 +62,7 @@
6162
"Resume",
6263
"SurveyTypeA",
6364
"SurveyTypeQ",
65+
"Token",
6466
"User",
6567
"UsersManagement",
6668
"UserSettings",

huntflow_api_client/entities/applicant_on_vacancy.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,6 @@ async def move_applicant_to_child_vacancy(
7777
response = await self._api.request(
7878
"PUT",
7979
f"/accounts/{account_id}/applicants/vacancy/{vacancy_id}/split",
80-
json=data.jsonable_dict(exclude_none=True),
80+
json=data.jsonable_dict(exclude_unset=True),
8181
)
8282
return ApplicantVacancySplitResponse.model_validate(response.json())

huntflow_api_client/entities/applicants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
GetEntityMixin,
77
ListEntityMixin,
88
)
9-
from huntflow_api_client.models.consts import AgreementState, ApplicantSearchField
9+
from huntflow_api_client.models.consts import AgreementStateRequest, ApplicantSearchField
1010
from huntflow_api_client.models.request.applicants import (
1111
ApplicantCreateRequest,
1212
ApplicantUpdateRequest,
@@ -29,7 +29,7 @@ async def list(
2929
page: Optional[int] = 1,
3030
status: Optional[int] = None,
3131
vacancy_id: Optional[int] = None,
32-
agreement_state: Optional[AgreementState] = None,
32+
agreement_state: Optional[AgreementStateRequest] = None,
3333
) -> ApplicantListResponse:
3434
"""
3535
API method reference https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/applicants

huntflow_api_client/entities/dictionaries.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ async def create(
4343
:return: An object that contains the task ID of the delayed background update task
4444
"""
4545
path = f"/accounts/{account_id}/dictionaries"
46-
response = await self._api.request("POST", path, json=data.jsonable_dict(exclude_none=True))
46+
response = await self._api.request(
47+
"POST",
48+
path,
49+
json=data.jsonable_dict(exclude_unset=True),
50+
)
4751
return DictionaryTaskResponse.model_validate(response.json())
4852

4953
async def get(self, account_id: int, dict_code: str) -> DictionaryResponse:
@@ -75,5 +79,5 @@ async def update(
7579
:return: An object that contains the task ID of the delayed background update task
7680
"""
7781
path = f"/accounts/{account_id}/dictionaries/{dict_code}"
78-
response = await self._api.request("PUT", path, json=data.jsonable_dict(exclude_none=True))
82+
response = await self._api.request("PUT", path, json=data.jsonable_dict(exclude_unset=True))
7983
return DictionaryTaskResponse.model_validate(response.json())

huntflow_api_client/entities/multi_vacancies.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ async def create(
2626
response = await self._api.request(
2727
"POST",
2828
f"/accounts/{account_id}/multi-vacancies",
29-
json=data.jsonable_dict(exclude_none=True),
29+
json=data.jsonable_dict(exclude_unset=True),
3030
)
3131
return MultiVacancyResponse.model_validate(response.json())
3232

@@ -52,6 +52,6 @@ async def update(
5252
response = await self._api.request(
5353
method,
5454
f"/accounts/{account_id}/multi-vacancies/{vacancy_id}",
55-
json=data.jsonable_dict(exclude_none=True),
55+
json=data.jsonable_dict(exclude_unset=True),
5656
)
5757
return MultiVacancyResponse.model_validate(response.json())

huntflow_api_client/entities/production_calendars.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ async def get_non_working_days_in_period(
5555
calendar_id: int,
5656
deadline: datetime.date,
5757
start: Optional[datetime.date] = None,
58-
verbose: Optional[bool] = True,
58+
verbose: Optional[bool] = False,
5959
) -> NonWorkingDaysResponse:
6060
"""
6161
API method reference

huntflow_api_client/entities/resume.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -83,7 +83,7 @@ async def update(
8383
response = await self._api.request(
8484
"PUT",
8585
f"/accounts/{account_id}/applicants/{applicant_id}/externals/{external_id}",
86-
json=data.jsonable_dict(exclude_none=True),
86+
json=data.jsonable_dict(),
8787
)
8888
return ApplicantResumeResponse.model_validate(response.json())
8989

huntflow_api_client/entities/tags.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ async def create(
4343
response = await self._api.request(
4444
"POST",
4545
f"/accounts/{account_id}/tags",
46-
json=account_tag.jsonable_dict(exclude_none=True),
46+
json=account_tag.jsonable_dict(),
4747
)
4848
return AccountTagResponse.model_validate(response.json())
4949

@@ -65,7 +65,7 @@ async def update(
6565
response = await self._api.request(
6666
"PUT",
6767
f"/accounts/{account_id}/tags/{account_tag_id}",
68-
json=data.jsonable_dict(exclude_none=True),
68+
json=data.jsonable_dict(),
6969
)
7070
return AccountTagResponse.model_validate(response.json())
7171

@@ -112,7 +112,7 @@ async def update(
112112
response = await self._api.request(
113113
"POST",
114114
f"/accounts/{account_id}/applicants/{applicant_id}/tags",
115-
json=data.jsonable_dict(exclude_none=True),
115+
json=data.jsonable_dict(),
116116
)
117117
return ApplicantTagsListResponse.model_validate(response.json())
118118

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
from huntflow_api_client.entities.base import BaseEntity, UpdateEntityMixin
2+
from huntflow_api_client.models.request.token import RefreshTokenRequest
3+
from huntflow_api_client.models.response.token import RefreshTokenResponse
4+
5+
6+
class Token(BaseEntity, UpdateEntityMixin):
7+
8+
async def update(self, data: RefreshTokenRequest) -> RefreshTokenResponse:
9+
"""
10+
API method reference
11+
https://api.huntflow.ru/latest/docs#post-/token/refresh
12+
13+
:param data: token request data
14+
:return: refreshed token data
15+
"""
16+
response = await self._api.request(
17+
"POST",
18+
"/token/refresh",
19+
json=data.jsonable_dict(),
20+
)
21+
return RefreshTokenResponse.model_validate(response.json())

huntflow_api_client/entities/vacancies.py

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -96,7 +96,7 @@ async def create(self, account_id: int, data: VacancyCreateRequest) -> VacancyCr
9696
response = await self._api.request(
9797
"POST",
9898
f"/accounts/{account_id}/vacancies",
99-
json=data.jsonable_dict(exclude_none=True),
99+
json=data.jsonable_dict(exclude_unset=True),
100100
)
101101
return VacancyCreateResponse.model_validate(response.json())
102102

@@ -118,7 +118,7 @@ async def update(
118118
response = await self._api.request(
119119
"PUT",
120120
f"/accounts/{account_id}/vacancies/{vacancy_id}",
121-
json=data.jsonable_dict(exclude_none=True),
121+
json=data.jsonable_dict(exclude_unset=True),
122122
)
123123
return VacancyResponse.model_validate(response.json())
124124

@@ -150,7 +150,7 @@ async def patch(
150150
response = await self._api.request(
151151
"PATCH",
152152
f"/accounts/{account_id}/vacancies/{vacancy_id}",
153-
json=data.jsonable_dict(exclude_none=True),
153+
json=data.jsonable_dict(exclude_unset=True),
154154
)
155155
return VacancyResponse.model_validate(response.json())
156156

@@ -174,7 +174,7 @@ async def assign_coworker(
174174
response = await self._api.request(
175175
"PUT",
176176
f"/accounts/{account_id}/vacancies/{vacancy_id}/members/{account_member_id}",
177-
json=data.jsonable_dict(exclude_none=True),
177+
json=data.jsonable_dict(),
178178
)
179179
return StatusResponse.model_validate(response.json())
180180

@@ -304,7 +304,7 @@ async def close(self, account_id: int, vacancy_id: int, data: VacancyCloseReques
304304
await self._api.request(
305305
"POST",
306306
f"/accounts/{account_id}/vacancies/{vacancy_id}/state/close",
307-
json=data.jsonable_dict(exclude_none=True),
307+
json=data.jsonable_dict(),
308308
)
309309

310310
async def hold(self, account_id: int, vacancy_id: int, data: VacancyHoldRequest) -> None:
@@ -319,7 +319,7 @@ async def hold(self, account_id: int, vacancy_id: int, data: VacancyHoldRequest)
319319
await self._api.request(
320320
"POST",
321321
f"/accounts/{account_id}/vacancies/{vacancy_id}/state/hold",
322-
json=data.jsonable_dict(exclude_none=True),
322+
json=data.jsonable_dict(),
323323
)
324324

325325
async def resume(self, account_id: int, vacancy_id: int) -> None:

0 commit comments

Comments
 (0)