From 482f1c06d2114529901c72a8ec8cb3772d979b9c Mon Sep 17 00:00:00 2001 From: Aleksandr Kroshko Date: Thu, 26 Mar 2026 15:00:10 +0300 Subject: [PATCH 1/3] update applicant and get logs fix --- huntflow_api_client/entities/applicants.py | 2 +- huntflow_api_client/models/common.py | 11 +++++++++-- huntflow_api_client/models/request/applicant_logs.py | 4 ++-- huntflow_api_client/models/request/applicants.py | 6 +++--- huntflow_api_client/models/response/applicant_logs.py | 6 +++--- pyproject.toml | 2 +- 6 files changed, 19 insertions(+), 12 deletions(-) diff --git a/huntflow_api_client/entities/applicants.py b/huntflow_api_client/entities/applicants.py index 02f1c23..e219f8d 100644 --- a/huntflow_api_client/entities/applicants.py +++ b/huntflow_api_client/entities/applicants.py @@ -108,7 +108,7 @@ async def patch( response = await self._api.request( "PATCH", f"/accounts/{account_id}/applicants/{applicant_id}", - json=data.jsonable_dict(exclude_none=True), + json=data.jsonable_dict(exclude_none=True, exclude_unset=True), ) return ApplicantItem.model_validate(response.json()) diff --git a/huntflow_api_client/models/common.py b/huntflow_api_client/models/common.py index 8d458f1..7fa3893 100644 --- a/huntflow_api_client/models/common.py +++ b/huntflow_api_client/models/common.py @@ -10,7 +10,7 @@ EmailContactType, EventReminderMultiplier, MemberType, - VacancyState, + VacancyState, CalendarEventStatus, ) _FieldSet: typing_extensions.TypeAlias = "Set[int] | Set[str] | Dict[int, Any] | Dict[str, Any]" @@ -234,7 +234,7 @@ class CalendarEventReminder(BaseModel): method: CalendarEventReminderMethod = Field(..., description="Reminder method") -class CalendarEventAttendee(BaseModel): +class CalendarEventAttendeeRequest(BaseModel): member: Optional[PositiveInt] = Field(None, description="Coworker ID") name: Optional[str] = Field(None, description="Attendee name", alias="displayName") email: EmailStr = Field(..., description="Attendee email") @@ -242,6 +242,13 @@ class CalendarEventAttendee(BaseModel): model_config = ConfigDict(populate_by_name=True) +class CalendarEventAttendeeResponse(CalendarEventAttendeeRequest): + status: Optional[CalendarEventStatus] = Field( + None, + alias="responseStatus", + ) + + class SurveyQuestionaryRespondent(BaseModel): applicant_id: int = Field(..., description="Applicant ID") diff --git a/huntflow_api_client/models/request/applicant_logs.py b/huntflow_api_client/models/request/applicant_logs.py index 8b1a6f8..d6178d9 100644 --- a/huntflow_api_client/models/request/applicant_logs.py +++ b/huntflow_api_client/models/request/applicant_logs.py @@ -8,7 +8,7 @@ ApplicantLogIm, ApplicantLogSms, ApplicantOffer, - CalendarEventAttendee, + CalendarEventAttendeeRequest, CalendarEventReminder, JsonRequestModel, ) @@ -25,7 +25,7 @@ class ApplicantLogCalendarEvent(BaseModel): event_type: CalendarEventType = Field(..., description="Calendar event type") description: Optional[str] = Field(None, description="Event description (comment)") calendar: PositiveInt = Field(..., description="Calendar ID") - attendees: List[CalendarEventAttendee] = Field( + attendees: List[CalendarEventAttendeeRequest] = Field( ..., description="Event attendees (participants)", ) diff --git a/huntflow_api_client/models/request/applicants.py b/huntflow_api_client/models/request/applicants.py index 16286ab..5e542c3 100644 --- a/huntflow_api_client/models/request/applicants.py +++ b/huntflow_api_client/models/request/applicants.py @@ -5,7 +5,7 @@ from huntflow_api_client.models.common import ( Applicant, - CalendarEventAttendee, + CalendarEventAttendeeRequest, CalendarEventReminder, JsonRequestModel, ) @@ -48,7 +48,7 @@ class ApplicantCreateRequest(Applicant, JsonRequestModel): class ApplicantUpdateRequest(Applicant, JsonRequestModel): birthday: Optional[date] = Field(None, description="Date of birth") social: Optional[List[ApplicantSocial]] = Field( - None, + [], max_length=1, description="List of applicant's social accounts", ) @@ -67,7 +67,7 @@ class ApplicantEvent(BaseModel): event_type: CalendarEventType = Field(..., description="Calendar event type") description: Optional[str] = Field(None, description="Event description (comment)") calendar: PositiveInt = Field(..., description="Calendar ID") - attendees: List[CalendarEventAttendee] = Field( + attendees: List[CalendarEventAttendeeRequest] = Field( ..., description="Event attendees (participants)", ) diff --git a/huntflow_api_client/models/response/applicant_logs.py b/huntflow_api_client/models/response/applicant_logs.py index 074af87..a003fa9 100644 --- a/huntflow_api_client/models/response/applicant_logs.py +++ b/huntflow_api_client/models/response/applicant_logs.py @@ -5,10 +5,10 @@ from huntflow_api_client.models.common import ( ApplicantOffer, - CalendarEventAttendee, + CalendarEventAttendeeRequest, File, PaginatedResponse, - VacancyQuotaItem, + VacancyQuotaItem, CalendarEventAttendeeResponse, ) from huntflow_api_client.models.consts import ( ApplicantLogType, @@ -111,7 +111,7 @@ class ApplicantLogCalendarEvent(BaseModel): ) foreign: Optional[str] = Field(None, description="Foreign ID of event") location: Optional[str] = Field(None, description="Event location") - attendees: List[CalendarEventAttendee] = Field( + attendees: List[CalendarEventAttendeeResponse] = Field( [], description="Event attendees (participants)", ) diff --git a/pyproject.toml b/pyproject.toml index cdb2753..74dd71e 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "huntflow-api-client" -version = "0.1.4" +version = "0.1.5" description = "Huntflow API Client for Python" authors = [ {name = "Developers huntflow", email = "developer@huntflow.ru"}, From 4136a8d28c58e4cfe84882d17f2eb959bffd49ed Mon Sep 17 00:00:00 2001 From: Aleksandr Kroshko Date: Thu, 26 Mar 2026 15:10:33 +0300 Subject: [PATCH 2/3] codestyle --- huntflow_api_client/models/common.py | 3 ++- huntflow_api_client/models/response/applicant_logs.py | 4 ++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/huntflow_api_client/models/common.py b/huntflow_api_client/models/common.py index 7fa3893..7fcd108 100644 --- a/huntflow_api_client/models/common.py +++ b/huntflow_api_client/models/common.py @@ -7,10 +7,11 @@ from huntflow_api_client.models.consts import ( CalendarEventReminderMethod, + CalendarEventStatus, EmailContactType, EventReminderMultiplier, MemberType, - VacancyState, CalendarEventStatus, + VacancyState, ) _FieldSet: typing_extensions.TypeAlias = "Set[int] | Set[str] | Dict[int, Any] | Dict[str, Any]" diff --git a/huntflow_api_client/models/response/applicant_logs.py b/huntflow_api_client/models/response/applicant_logs.py index a003fa9..5522bb2 100644 --- a/huntflow_api_client/models/response/applicant_logs.py +++ b/huntflow_api_client/models/response/applicant_logs.py @@ -5,10 +5,10 @@ from huntflow_api_client.models.common import ( ApplicantOffer, - CalendarEventAttendeeRequest, + CalendarEventAttendeeResponse, File, PaginatedResponse, - VacancyQuotaItem, CalendarEventAttendeeResponse, + VacancyQuotaItem, ) from huntflow_api_client.models.consts import ( ApplicantLogType, From c80047e0aa0a8f9fd6b2f479bbbcbf38c9f8a24b Mon Sep 17 00:00:00 2001 From: Aleksandr Kroshko Date: Thu, 26 Mar 2026 17:53:14 +0300 Subject: [PATCH 3/3] test fixed --- huntflow_api_client/entities/applicants.py | 2 +- huntflow_api_client/models/request/applicants.py | 2 +- tests/test_entities/test_applicants.py | 4 +++- 3 files changed, 5 insertions(+), 3 deletions(-) diff --git a/huntflow_api_client/entities/applicants.py b/huntflow_api_client/entities/applicants.py index e219f8d..dcbab02 100644 --- a/huntflow_api_client/entities/applicants.py +++ b/huntflow_api_client/entities/applicants.py @@ -108,7 +108,7 @@ async def patch( response = await self._api.request( "PATCH", f"/accounts/{account_id}/applicants/{applicant_id}", - json=data.jsonable_dict(exclude_none=True, exclude_unset=True), + json=data.jsonable_dict(exclude_unset=True), ) return ApplicantItem.model_validate(response.json()) diff --git a/huntflow_api_client/models/request/applicants.py b/huntflow_api_client/models/request/applicants.py index 5e542c3..67416be 100644 --- a/huntflow_api_client/models/request/applicants.py +++ b/huntflow_api_client/models/request/applicants.py @@ -48,7 +48,7 @@ class ApplicantCreateRequest(Applicant, JsonRequestModel): class ApplicantUpdateRequest(Applicant, JsonRequestModel): birthday: Optional[date] = Field(None, description="Date of birth") social: Optional[List[ApplicantSocial]] = Field( - [], + None, max_length=1, description="List of applicant's social accounts", ) diff --git a/tests/test_entities/test_applicants.py b/tests/test_entities/test_applicants.py index 1e46cb7..87d06ed 100644 --- a/tests/test_entities/test_applicants.py +++ b/tests/test_entities/test_applicants.py @@ -1,3 +1,4 @@ +import json from typing import Any, Dict from pytest_httpx import HTTPXMock @@ -199,7 +200,7 @@ }, ], } -APPLICANT_PATCH_REQUEST: Dict[str, Any] = {"first_name": "Newname"} +APPLICANT_PATCH_REQUEST: Dict[str, Any] = {"first_name": "Newname", "social": []} APPLICANT_PATCH_RESPONSE: Dict[str, Any] = { "first_name": "Newname", "last_name": "Doe", @@ -324,6 +325,7 @@ async def test_patch_applicant( ) -> None: httpx_mock.add_response( url=f"{VERSIONED_BASE_URL}/accounts/{ACCOUNT_ID}/applicants/{APPLICANT_ID}", + match_content=json.dumps(APPLICANT_PATCH_REQUEST).encode(), json=APPLICANT_PATCH_RESPONSE, ) api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy)