Skip to content
Open
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
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 @@ -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
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.models.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
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, 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):
Expand Down
14 changes: 14 additions & 0 deletions huntflow_api_client/models/utils.py
Original file line number Diff line number Diff line change
@@ -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