Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion huntflow_api_client/entities/applicant_on_vacancy.py
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,6 @@ async def move_applicant_to_child_vacancy(
response = await self._api.request(
"PUT",
f"/accounts/{account_id}/applicants/vacancy/{vacancy_id}/split",
json=data.jsonable_dict(exclude_none=True),
json=data.jsonable_dict(exclude_unset=True),
)
return ApplicantVacancySplitResponse.model_validate(response.json())
4 changes: 2 additions & 2 deletions huntflow_api_client/entities/applicants.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
GetEntityMixin,
ListEntityMixin,
)
from huntflow_api_client.models.consts import AgreementState, ApplicantSearchField
from huntflow_api_client.models.consts import AgreementStateRequest, ApplicantSearchField
from huntflow_api_client.models.request.applicants import (
ApplicantCreateRequest,
ApplicantUpdateRequest,
Expand All @@ -29,7 +29,7 @@ async def list(
page: Optional[int] = 1,
status: Optional[int] = None,
vacancy_id: Optional[int] = None,
agreement_state: Optional[AgreementState] = None,
agreement_state: Optional[AgreementStateRequest] = None,
) -> ApplicantListResponse:
"""
API method reference https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/applicants
Expand Down
8 changes: 6 additions & 2 deletions huntflow_api_client/entities/dictionaries.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,11 @@ async def create(
:return: An object that contains the task ID of the delayed background update task
"""
path = f"/accounts/{account_id}/dictionaries"
response = await self._api.request("POST", path, json=data.jsonable_dict(exclude_none=True))
response = await self._api.request(
"POST",
path,
json=data.jsonable_dict(exclude_unset=True),
)
return DictionaryTaskResponse.model_validate(response.json())

async def get(self, account_id: int, dict_code: str) -> DictionaryResponse:
Expand Down Expand Up @@ -75,5 +79,5 @@ async def update(
:return: An object that contains the task ID of the delayed background update task
"""
path = f"/accounts/{account_id}/dictionaries/{dict_code}"
response = await self._api.request("PUT", path, json=data.jsonable_dict(exclude_none=True))
response = await self._api.request("PUT", path, json=data.jsonable_dict(exclude_unset=True))
return DictionaryTaskResponse.model_validate(response.json())
4 changes: 2 additions & 2 deletions huntflow_api_client/entities/multi_vacancies.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ async def create(
response = await self._api.request(
"POST",
f"/accounts/{account_id}/multi-vacancies",
json=data.jsonable_dict(exclude_none=True),
json=data.jsonable_dict(exclude_unset=True),
)
return MultiVacancyResponse.model_validate(response.json())

Expand All @@ -52,6 +52,6 @@ async def update(
response = await self._api.request(
method,
f"/accounts/{account_id}/multi-vacancies/{vacancy_id}",
json=data.jsonable_dict(exclude_none=True),
json=data.jsonable_dict(exclude_unset=True),
)
return MultiVacancyResponse.model_validate(response.json())
2 changes: 1 addition & 1 deletion huntflow_api_client/entities/production_calendars.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ async def get_non_working_days_in_period(
calendar_id: int,
deadline: datetime.date,
start: Optional[datetime.date] = None,
verbose: Optional[bool] = True,
verbose: Optional[bool] = False,
) -> NonWorkingDaysResponse:
"""
API method reference
Expand Down
2 changes: 1 addition & 1 deletion huntflow_api_client/entities/resume.py
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ async def update(
response = await self._api.request(
"PUT",
f"/accounts/{account_id}/applicants/{applicant_id}/externals/{external_id}",
json=data.jsonable_dict(exclude_none=True),
json=data.jsonable_dict(),
)
return ApplicantResumeResponse.model_validate(response.json())

Expand Down
6 changes: 3 additions & 3 deletions huntflow_api_client/entities/tags.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ async def create(
response = await self._api.request(
"POST",
f"/accounts/{account_id}/tags",
json=account_tag.jsonable_dict(exclude_none=True),
json=account_tag.jsonable_dict(),
)
return AccountTagResponse.model_validate(response.json())

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

Expand Down Expand Up @@ -112,7 +112,7 @@ async def update(
response = await self._api.request(
"POST",
f"/accounts/{account_id}/applicants/{applicant_id}/tags",
json=data.jsonable_dict(exclude_none=True),
json=data.jsonable_dict(),
)
return ApplicantTagsListResponse.model_validate(response.json())

Expand Down
12 changes: 6 additions & 6 deletions huntflow_api_client/entities/vacancies.py
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ async def create(self, account_id: int, data: VacancyCreateRequest) -> VacancyCr
response = await self._api.request(
"POST",
f"/accounts/{account_id}/vacancies",
json=data.jsonable_dict(exclude_none=True),
json=data.jsonable_dict(exclude_unset=True),
)
return VacancyCreateResponse.model_validate(response.json())

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

Expand Down Expand Up @@ -150,7 +150,7 @@ async def patch(
response = await self._api.request(
"PATCH",
f"/accounts/{account_id}/vacancies/{vacancy_id}",
json=data.jsonable_dict(exclude_none=True),
json=data.jsonable_dict(exclude_unset=True),
)
return VacancyResponse.model_validate(response.json())

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

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

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

async def resume(self, account_id: int, vacancy_id: int) -> None:
Expand Down
2 changes: 1 addition & 1 deletion huntflow_api_client/entities/vacancy_requests.py
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,6 @@ async def create(
response = await self._api.request(
"POST",
path,
json=request_data.jsonable_dict(exclude_none=True),
json=request_data.jsonable_dict(exclude_unset=True),
)
return VacancyRequestResponse.model_validate(response.json())
2 changes: 1 addition & 1 deletion huntflow_api_client/entities/webhooks.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ async def create(self, account_id: int, data: WebhookRequest) -> WebhookResponse
:return: Information about the webhook
"""
path = f"/accounts/{account_id}/hooks"
response = await self._api.request("POST", path, json=data.jsonable_dict(exclude_none=True))
response = await self._api.request("POST", path, json=data.jsonable_dict())
return WebhookResponse.model_validate(response.json())

async def delete(self, account_id: int, webhook_id: int) -> None:
Expand Down
1 change: 1 addition & 0 deletions huntflow_api_client/models/common.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,6 +170,7 @@ class EmailRecipient(BaseModel):
name: Optional[str] = Field(
None,
description="Name of email recipient",
alias="displayName",
)
email: str = Field(..., description="Email address")

Expand Down
8 changes: 7 additions & 1 deletion huntflow_api_client/models/consts.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
from enum import Enum

from huntflow_api_client.utils import extend_enum


class WebhookEvent(str, Enum):
APPLICANT = "APPLICANT"
Expand Down Expand Up @@ -69,11 +71,15 @@ class FieldType(str, Enum):
html = "html"


class AgreementState(str, Enum):
class AgreementStateRequest(str, Enum):
not_sent = "not_sent"
sent = "sent"
accepted = "accepted"
declined = "declined"


@extend_enum(AgreementStateRequest)
class AgreementStateResponse(str, Enum):
send_error = "send_error"


Expand Down
24 changes: 17 additions & 7 deletions huntflow_api_client/models/response/applicant_logs.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
from huntflow_api_client.models.common import (
ApplicantOffer,
CalendarEventAttendeeResponse,
EmailRecipient,
File,
PaginatedResponse,
VacancyQuotaItem,
Expand All @@ -15,11 +16,11 @@
CalendarEventReminderMethod,
CalendarEventStatus,
CalendarEventType,
EmailContactType,
SurveyType,
Transparency,
)
from huntflow_api_client.models.response.applicant_offers import ApplicantVacancyOffer
from huntflow_api_client.models.response.survey import SurveyTypeARespondent


class BaseSurveySchemaType(BaseModel):
Expand All @@ -35,6 +36,10 @@ class SurveySchemaTypeQLogResponse(BaseSurveySchemaType):
title: Optional[str] = Field(..., description="Survey title")


class SurveySchemaTypeALogResponse(BaseSurveySchemaType):
pass


class ApplicantLogSurveyQuestionary(BaseModel):
id: int = Field(..., description="Survey questionary ID")
survey: SurveySchemaTypeQLogResponse = Field(..., description="Survey schema")
Expand All @@ -48,13 +53,14 @@ class ApplicantLogSurveyQuestionary(BaseModel):
)


class EmailRecipient(BaseModel):
type: Optional[EmailContactType] = Field(None, description="Type of the email contact")
name: Optional[str] = Field(
None,
description="Name of email recipient",
class ApplicantLogSurveyAnswerTypeA(BaseModel):
id: int = Field(..., description="Survey questionary ID")
created: datetime = Field(
...,
description="Date and time of creating an survey questionary of type A",
)
email: str = Field(..., description="Email address")
respondent: SurveyTypeARespondent = Field(..., description="Who created the survey answer")
survey: SurveySchemaTypeALogResponse = Field(..., description="Survey schema")


class ApplicantLogAccountInfo(BaseModel):
Expand Down Expand Up @@ -172,6 +178,10 @@ class ApplicantLogItem(BaseModel):
None,
description="Survey questionary",
)
survey_answer_of_type_a: Optional[ApplicantLogSurveyAnswerTypeA] = Field(
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

почему нет в доке у нас этого поля?
https://api.huntflow.ru/v2/docs#get-/accounts/-account_id-/applicants/-applicant_id-/logs

Image

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Image

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

в ответе от ручки, которую ты оставила в коммменте

None,
description="Survey answer of type A object",
)


class ApplicantLogResponse(PaginatedResponse):
Expand Down
2 changes: 1 addition & 1 deletion huntflow_api_client/models/response/applicants.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
from pydantic import BaseModel, ConfigDict, Field, PositiveInt

from huntflow_api_client.models.common import Applicant, PaginatedResponse
from huntflow_api_client.models.consts import AgreementState as AgreementStateEnum
from huntflow_api_client.models.consts import AgreementStateResponse as AgreementStateEnum


class ApplicantTag(BaseModel):
Expand Down
16 changes: 16 additions & 0 deletions huntflow_api_client/utils.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
from enum import Enum
from typing import Any, Callable, Dict, Type, TypeVar

T = TypeVar("T", bound=Enum)


def extend_enum(inherited_enum: Type[T]) -> Callable:
def wrapper(added_enum: Type[T]) -> Enum:
joined: Dict[str, Any] = {}
for item in inherited_enum:
joined[item.name] = item.value
for item in added_enum:
joined[item.name] = item.value
return Enum(added_enum.__name__, joined)

return wrapper
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@

[project]
name = "huntflow-api-client"
version = "2.13.2"
version = "2.13.3"
description = "Huntflow API Client for Python"
authors = [
{name = "Developers huntflow", email = "developer@huntflow.ru"},
Expand Down
2 changes: 1 addition & 1 deletion tests/test_entities/test_production_calendar.py
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,7 @@ async def test_get_non_working_days_in_period(
) -> None:
httpx_mock.add_response(
url=f"{VERSIONED_BASE_URL}/production_calendars/{CALENDAR_ID}/days/"
f"{DEADLINE_DATE.strftime('%Y-%m-%d')}?verbose=true",
f"{DEADLINE_DATE.strftime('%Y-%m-%d')}?verbose=false",
json=NON_WORKING_DAYS_GET_RESPONSE,
)
api_client = HuntflowAPI(BASE_URL, token_proxy=token_proxy)
Expand Down
Loading