diff --git a/huntflow_api_client/entities/applicants.py b/huntflow_api_client/entities/applicants.py index 02f1c23..8c0d106 100644 --- a/huntflow_api_client/entities/applicants.py +++ b/huntflow_api_client/entities/applicants.py @@ -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, @@ -27,7 +27,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 diff --git a/huntflow_api_client/models/consts.py b/huntflow_api_client/models/consts.py index 37bbb36..c89d9ed 100644 --- a/huntflow_api_client/models/consts.py +++ b/huntflow_api_client/models/consts.py @@ -1,5 +1,7 @@ from enum import Enum +from huntflow_api_client.models.utils import extend_enum + class WebhookEvent(str, Enum): APPLICANT = "APPLICANT" @@ -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" diff --git a/huntflow_api_client/models/response/applicants.py b/huntflow_api_client/models/response/applicants.py index e4eacc0..a69c7ef 100644 --- a/huntflow_api_client/models/response/applicants.py +++ b/huntflow_api_client/models/response/applicants.py @@ -4,7 +4,7 @@ from pydantic import BaseModel, ConfigDict, EmailStr, 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): diff --git a/huntflow_api_client/models/utils.py b/huntflow_api_client/models/utils.py new file mode 100644 index 0000000..150e397 --- /dev/null +++ b/huntflow_api_client/models/utils.py @@ -0,0 +1,14 @@ +from enum import Enum +from typing import Callable, Type + + +def extend_enum(inherited_enum: Type[Enum]) -> Callable: + def wrapper(added_enum: Type[Enum]) -> Enum: + joined = {} + 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