Skip to content

Commit 4d7c970

Browse files
author
koval
committed
Fix AgreementState enum.
1 parent 2682919 commit 4d7c970

4 files changed

Lines changed: 24 additions & 4 deletions

File tree

huntflow_api_client/entities/applicants.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
GetEntityMixin,
77
ListEntityMixin,
88
)
9-
from huntflow_api_client.models.consts import AgreementState, ApplicantSearchField
9+
from huntflow_api_client.models.consts import AgreementStateRequest, ApplicantSearchField
1010
from huntflow_api_client.models.request.applicants import (
1111
ApplicantCreateRequest,
1212
ApplicantUpdateRequest,
@@ -27,7 +27,7 @@ async def list(
2727
page: Optional[int] = 1,
2828
status: Optional[int] = None,
2929
vacancy_id: Optional[int] = None,
30-
agreement_state: Optional[AgreementState] = None,
30+
agreement_state: Optional[AgreementStateRequest] = None,
3131
) -> ApplicantListResponse:
3232
"""
3333
API method reference https://api.huntflow.ai/v2/docs#get-/accounts/-account_id-/applicants

huntflow_api_client/models/consts.py

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
from enum import Enum
22

3+
from huntflow_api_client.models.utils import extend_enum
4+
35

46
class WebhookEvent(str, Enum):
57
APPLICANT = "APPLICANT"
@@ -69,11 +71,15 @@ class FieldType(str, Enum):
6971
html = "html"
7072

7173

72-
class AgreementState(str, Enum):
74+
class AgreementStateRequest(str, Enum):
7375
not_sent = "not_sent"
7476
sent = "sent"
7577
accepted = "accepted"
7678
declined = "declined"
79+
80+
81+
@extend_enum(AgreementStateRequest)
82+
class AgreementStateResponse(str, Enum):
7783
send_error = "send_error"
7884

7985

huntflow_api_client/models/response/applicants.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
from pydantic import BaseModel, ConfigDict, EmailStr, Field, PositiveInt
55

66
from huntflow_api_client.models.common import Applicant, PaginatedResponse
7-
from huntflow_api_client.models.consts import AgreementState as AgreementStateEnum
7+
from huntflow_api_client.models.consts import AgreementStateResponse as AgreementStateEnum
88

99

1010
class ApplicantTag(BaseModel):
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
from enum import Enum
2+
from typing import Callable, Type
3+
4+
5+
def extend_enum(inherited_enum: Type[Enum]) -> Callable:
6+
def wrapper(added_enum: Type[Enum]) -> Enum:
7+
joined = {}
8+
for item in inherited_enum:
9+
joined[item.name] = item.value
10+
for item in added_enum:
11+
joined[item.name] = item.value
12+
return Enum(added_enum.__name__, joined)
13+
14+
return wrapper

0 commit comments

Comments
 (0)