diff --git a/huntflow_api_client/entities/applicants.py b/huntflow_api_client/entities/applicants.py index bc1a1ac..c05e218 100644 --- a/huntflow_api_client/entities/applicants.py +++ b/huntflow_api_client/entities/applicants.py @@ -110,7 +110,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_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 7007d32..02bc7da 100644 --- a/huntflow_api_client/models/common.py +++ b/huntflow_api_client/models/common.py @@ -7,6 +7,7 @@ from huntflow_api_client.models.consts import ( CalendarEventReminderMethod, + CalendarEventStatus, EmailContactType, EventReminderMultiplier, MemberType, @@ -234,7 +235,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: str = Field(..., description="Attendee email") @@ -242,6 +243,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..67416be 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, ) @@ -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..5522bb2 100644 --- a/huntflow_api_client/models/response/applicant_logs.py +++ b/huntflow_api_client/models/response/applicant_logs.py @@ -5,7 +5,7 @@ from huntflow_api_client.models.common import ( ApplicantOffer, - CalendarEventAttendee, + CalendarEventAttendeeResponse, File, PaginatedResponse, VacancyQuotaItem, @@ -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 15e2278..3f27e5c 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -1,7 +1,7 @@ [project] name = "huntflow-api-client" -version = "2.13.0" +version = "2.13.1" description = "Huntflow API Client for Python" authors = [ {name = "Developers huntflow", email = "developer@huntflow.ru"}, diff --git a/tests/test_entities/test_applicants.py b/tests/test_entities/test_applicants.py index 2498c76..1c46992 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 @@ -201,7 +202,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", @@ -332,6 +333,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)