-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcommon.py
More file actions
279 lines (228 loc) · 9.64 KB
/
common.py
File metadata and controls
279 lines (228 loc) · 9.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
import json
from datetime import date, datetime
from typing import Any, Dict, List, Optional, Set, Union
import typing_extensions
from pydantic import AnyHttpUrl, BaseModel, ConfigDict, EmailStr, Field, PositiveInt
from huntflow_api_client.models.consts import (
CalendarEventReminderMethod,
CalendarEventStatus,
EmailContactType,
EventReminderMultiplier,
MemberType,
VacancyState,
)
_FieldSet: typing_extensions.TypeAlias = "Set[int] | Set[str] | Dict[int, Any] | Dict[str, Any]"
class JsonRequestModel(BaseModel):
def jsonable_dict(
self,
*,
include: Optional[_FieldSet] = None,
exclude: Optional[_FieldSet] = None,
by_alias: bool = False,
exclude_unset: bool = False,
exclude_defaults: bool = False,
exclude_none: bool = False,
round_trip: bool = False,
warnings: bool = True,
) -> Dict[str, Any]:
return json.loads(
self.model_dump_json(
include=include,
exclude=exclude,
by_alias=by_alias,
exclude_unset=exclude_unset,
exclude_defaults=exclude_defaults,
exclude_none=exclude_none,
round_trip=round_trip,
warnings=warnings,
),
)
class PaginatedResponse(BaseModel):
page: PositiveInt = Field(..., description="Page number")
count: int = Field(..., description="Number of items per page")
total_pages: int = Field(..., description="Total number of pages")
class Vacancy(BaseModel):
account_division: Optional[PositiveInt] = Field(
None,
description="Division ID",
)
account_region: Optional[PositiveInt] = Field(
None,
description="Account region",
)
position: str = Field(
...,
description="The name of the vacancy (occupation)",
)
company: Optional[str] = Field(
None,
description="Department (ignored if the DEPARTMENTS are enabled)",
)
money: Optional[str] = Field(None, description="Salary")
priority: Optional[int] = Field(
None,
description="The priority of a vacancy (0 for usual or 1 for high)",
ge=0,
le=1,
)
hidden: bool = Field(False, description="Is the vacancy hidden from the colleagues?")
state: VacancyState = Field(VacancyState.OPEN, description="The state of a vacancy")
class FillQuota(BaseModel):
deadline: Optional[date] = Field(None, description="Date when the quota should be filled")
applicants_to_hire: Optional[int] = Field(
None,
description="Number of applicants should be hired on the fill quota",
ge=1,
le=999,
)
vacancy_request: Optional[PositiveInt] = Field(
None,
description="Vacancy request ID",
)
class EditedFillQuota(FillQuota):
id: Optional[PositiveInt] = Field(None, description="Fill quota ID")
class File(BaseModel):
id: PositiveInt = Field(..., description="File ID")
url: AnyHttpUrl = Field(..., description="File URL")
content_type: str = Field(..., description="MIME type of file")
name: str = Field(..., description="File name")
class Applicant(BaseModel):
first_name: Optional[str] = Field(None, description="First name")
last_name: Optional[str] = Field(None, description="Last name")
middle_name: Optional[str] = Field(None, description="Middle name")
money: Optional[str] = Field(None, description="Salary expectation")
phone: Optional[str] = Field(None, description="Phone number")
email: Union[EmailStr, str, None] = Field(
None,
description="Email address",
)
skype: Optional[str] = Field(None, description="Skype login")
position: Optional[str] = Field(
None,
description="Applicant’s occupation",
)
company: Optional[str] = Field(
None,
description="Applicant’s place of work",
)
photo: Optional[int] = Field(None, description="Applicant’s photo ID")
class StatusResponse(BaseModel):
status: bool = Field(True)
class VacancyQuotaBase(BaseModel):
id: PositiveInt = Field(..., description="Fill quota ID")
vacancy_frame: PositiveInt = Field(..., description="Vacancy frame ID")
vacancy_request: Optional[PositiveInt] = Field(None, description="Vacancy request ID")
created: datetime = Field(..., description="Date and time of creating a vacancy quota")
changed: Optional[datetime] = Field(
None,
description="Date and time of updating a vacancy quota",
)
applicants_to_hire: PositiveInt = Field(
...,
description="Number of applicants should be hired on the quota",
)
already_hired: int = Field(..., description="Number of applicants already hired on the quota")
deadline: Optional[date] = Field(None, description="Date when the quota should be filled")
closed: Optional[datetime] = Field(None, description="Date and time when the quota was closed")
work_days_in_work: Optional[int] = Field(
None,
description="How many working days the vacancy is in work",
)
work_days_after_deadline: Optional[int] = Field(
None,
description="How many working days the vacancy is in work after deadline",
)
class AccountInfo(BaseModel):
id: PositiveInt = Field(..., description="ID of the user who opened the quota")
name: str = Field(..., description="Name of the user who opened the quota")
email: Optional[EmailStr] = Field(None, description="Email of the user who opened the quota")
class VacancyQuotaItem(VacancyQuotaBase):
account_info: AccountInfo
class EmailRecipient(BaseModel):
type: Optional[EmailContactType] = Field(None, description="Type of the email contact")
name: Optional[str] = Field(
None,
description="Name of email recipient",
)
email: str = Field(..., description="Email address")
class EmailFollowup(BaseModel):
id: PositiveInt = Field(..., description="Followup ID")
account_member_template: int = Field(..., description="Email template ID")
html: str = Field(..., description="Email content (HTML)")
days: int = Field(
...,
ge=1,
description="The number of days after which to send a followup if there is no response",
)
class ApplicantLogEmail(BaseModel):
account_email: PositiveInt = Field(
...,
description="Email account ID",
)
files: Optional[List[PositiveInt]] = Field(
None,
description="List of uploaded files ID",
)
followups: Optional[List[EmailFollowup]] = Field(
None,
description="List of email templates",
)
html: str = Field(..., description="Email content (HTML)")
email: EmailStr = Field(..., description="Recipient email address")
subject: str = Field(..., description="Email subject")
send_at: Optional[datetime] = Field(
None,
description="Date and time to send email. If not supplied, email will be sent immediately",
)
timezone: Optional[str] = Field(None, description="Time zone")
to: Optional[List[EmailRecipient]] = Field(
None,
description="List of additional recipients (cc/bcc)",
)
reply: Optional[PositiveInt] = Field(None, description="Reply email ID")
class ApplicantLogIm(BaseModel):
account_im: PositiveInt = Field(..., description="Account IM ID")
receiver: str = Field(..., description="Username or phone of recipient")
body: str = Field(..., description="Message text")
class ApplicantLogSms(BaseModel):
phone: str = Field(..., description="Phone number of recipient")
body: str = Field(..., description="Message text")
class ApplicantOffer(BaseModel):
account_applicant_offer: PositiveInt = Field(..., description="Organization offer ID")
values: dict = Field(..., description="Organization offer schema")
class CalendarEventReminder(BaseModel):
multiplier: EventReminderMultiplier = Field(..., description="Reminder period")
value: int = Field(..., ge=0, lt=40320, description="Reminder value")
method: CalendarEventReminderMethod = Field(..., description="Reminder method")
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")
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")
class SurveyQuestionaryRespondentWithName(SurveyQuestionaryRespondent):
name: str = Field(..., description="Applicant name")
class ForeignUser(BaseModel):
id: str = Field(..., description="Foreign User ID")
name: str = Field(..., description="User name")
email: EmailStr = Field(..., description="Email")
type: MemberType = Field(..., description="User type (role)")
head_id: Optional[str] = Field(None, description="Foreign user ID of head")
division_ids: Optional[List[str]] = Field(
None,
description="Foreign IDs of available divisions, case insensitive. "
"If field is not provided, contains null or empty list, "
"it means access to all divisions",
)
permissions: Optional[List[str]] = Field(
None,
description="User permissions. If field is not provided, "
"contains null or empty list, it means no restrictions",
)
meta: Optional[Dict] = Field(None, description="Additional meta information")