Timeoff
Usage
List leave allowances, leaves, and policies:
import asyncio
import factorialhr
async def main():
auth = factorialhr.AccessTokenAuth("your_access_token")
async with factorialhr.ApiClient(auth=auth) as api:
allowances = factorialhr.AllowancesEndpoint(api)
response = await allowances.get(params={"page": 1})
for a in response.data():
print(a.employee_id, a.allowance_type, a.balance)
leaves = factorialhr.LeavesEndpoint(api)
for leave in (await leaves.all()).data():
print(leave.employee_id, leave.starts_on, leave.ends_on)
policies = factorialhr.PoliciesEndpoint(api)
for p in (await policies.all()).data():
print(p.name)
asyncio.run(main())
- class factorialhr.Allowance(*, id: int, accrued_denominator_in_cents: int | None = None, accrued_factor_in_cents: int | None = None, accrued_units_availability: AccruedUnitsAvailability | None = None, allowance_type: AllowanceType, available_days: AvailableDays, carry_over_days: int | None = None, carry_over_units_in_cents: int | None = None, count_holiday_as_workable: bool, cycle_length: int | None = None, cycle_start: str | None = None, days_type: DaysType | None = None, employee_carry_over_starting_year: int | None = None, expire_in_months: int | None = None, frequency: Frequency | None = None, holiday_allowance_in_cents: int | None = None, leave_type_ids: Sequence[int], maximum_amount_in_cents: int | None = None, name: str, negative_counter_type: NegativeCounterType | None = None, position: int | None = None, proration_type: ProationType, pto_proratio_enabled: bool | None = None, range_type: RangeType | None = None, rounding: Rounding, send_notification: bool | None = None, source_units: SourceUnits | None = None, tenure_period_transition: TenurePeriodTransition | None = None, tenure_periods: Sequence[Mapping[str, Any]], tenure_periods_enabled: bool | None = None, timeoff_cycle: str, timeoff_policy_id: int, unlimited_accrued_hours: bool | None = None, unlimited_carry_over: bool | None = None, unlimited_carry_over_expiration: bool | None = None, unlimited_holidays: bool | None = None)[source]
Model for timeoff_allowance.
- accrued_denominator_in_cents: int | None
Only for Allowances based on worked time. It represents how many units you need to work to be granted allowance units
- accrued_factor_in_cents: int | None
Only for Allowances based on worked time. It represents how many units you are given per unit of time worked
- accrued_units_availability: AccruedUnitsAvailability | None
When can the accrued units be spent
- allowance_type: AllowanceType
Sets the allowance units. Can be “days” or “hours”
- available_days: AvailableDays
Indicates how the allowance units are accrued. For example all_days means all allowance days are given on the first day of the cycle
- carry_over_days: int | None
How many units can carry over between cycles
- carry_over_units_in_cents: int | None
How many units can carry over between cycles multiplied by 100
- count_holiday_as_workable: bool
This setting flags if units taken during a bank holiday should be deducted or not from allowance
- cycle_length: int | None
How many months does each allowance cycle last
- cycle_start: str | None
When does the cycle start
- days_type: DaysType | None
Indicates if the allowance is based on working on calendar days
- employee_carry_over_starting_year: int | None
When does the carryover start
- expire_in_months: int | None
When does the carryover expire in months
- frequency: Frequency | None
Defines duration of the allowance cycles. Can be “yearly”, “monthly_flexible” or “lifetime”
- holiday_allowance_in_cents: int | None
Base amount of holiday allowance units multiplied by 100
- id: int
Unique identifier of the allowance
- leave_type_ids: Sequence[int]
An array of leave type ids associated with that allowance
- maximum_amount_in_cents: int | None
Maximum the allowance can reach on accrued
- name: str
Allowance name set by the user
- negative_counter_type: NegativeCounterType | None
Whether the allowance allows to request more days than available
- proration_type: ProationType
Whether the allowance has proration enabled or not
- range_type: RangeType | None
Configures how leaves duration is handled
- rounding: Rounding
How the accrued units of the allowance are rounded. It depends if the allowance is set in hours or days
- source_units: SourceUnits | None
This field configures the type of allowance (fixed balance, based on worked time)
- tenure_period_transition: TenurePeriodTransition | None
In case the allowance has tenure periods, when is this tenure applied
- class factorialhr.AllowanceIncidence(*, id: int, employee_id: int, description: str | None = None, days_in_cents: int, timeoff_allowance_id: int, effective_on: date, target_balance: str | None = None, created_at: datetime, updated_at: datetime)[source]
Model for timeoff_allowance_incidence.
- class factorialhr.AllowanceIncidencesEndpoint(api: ApiClient)[source]
Endpoint for timeoff/allowance_incidences operations.
- async all(**kwargs) ListApiResponse[AllowanceIncidence][source]
Get all allowance incidences records.
Official documentation: timeoff/allowance_incidences
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing the list of records.
- Return type:
- async create(data: Mapping[str, Any], **kwargs) AllowanceIncidence[source]
Create a new allowance incidence.
Official documentation: timeoff/allowance_incidences
- Parameters:
data (Mapping[str, Any]) – Payload for the new record (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The created record.
- Return type:
- async delete(incidence_id: int | str, **kwargs) AllowanceIncidence[source]
Delete an allowance incidence.
Official documentation: timeoff/allowance_incidences
- Parameters:
incidence_id (int | str) – The unique identifier of the record to delete.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The deleted record.
- Return type:
- async get(**kwargs) MetaApiResponse[AllowanceIncidence][source]
Get allowance incidences with pagination metadata.
Official documentation: timeoff/allowance_incidences
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing records and pagination metadata.
- Return type:
- async get_by_id(incidence_id: int | str, **kwargs) AllowanceIncidence[source]
Get a specific allowance incidence by ID.
Official documentation: timeoff/allowance_incidences
- Parameters:
incidence_id (int | str) – The unique identifier.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The record.
- Return type:
- async update(incidence_id: int | str, data: Mapping[str, Any], **kwargs) AllowanceIncidence[source]
Update an allowance incidence.
Official documentation: timeoff/allowance_incidences
- Parameters:
incidence_id (int | str) – The unique identifier of the record to update.
data (Mapping[str, Any]) – Payload with fields to update (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The updated record.
- Return type:
- class factorialhr.AllowancesEndpoint(api: ApiClient)[source]
Endpoint for timeoff/allowances operations.
- async all(**kwargs) ListApiResponse[Allowance][source]
Get all allowances records.
Official documentation: timeoff/allowances
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing the list of records.
- Return type:
- async create(data: Mapping[str, Any], **kwargs) Allowance[source]
Create a new allowance.
Official documentation: timeoff/allowances
- Parameters:
data (Mapping[str, Any]) – Payload for the new record (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The created record.
- Return type:
- async delete(allowance_id: int | str, **kwargs) Allowance[source]
Delete an allowance.
Official documentation: timeoff/allowances
- Parameters:
allowance_id (int | str) – The unique identifier of the record to delete.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The deleted record.
- Return type:
- async delete_with_alt_allowance(data: Mapping[str, Any], **kwargs) Allowance[source]
Delete an allowance and migrate existing incidences to alternative allowance.
Official documentation: timeoff/allowances
- Parameters:
data (Mapping[str, Any]) – Payload for the new record (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Result.
- Return type:
- async get(**kwargs) MetaApiResponse[Allowance][source]
Get allowances with pagination metadata.
Official documentation: timeoff/allowances
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing records and pagination metadata.
- Return type:
- async get_by_id(allowance_id: int | str, **kwargs) Allowance[source]
Get a specific allowance by ID.
Official documentation: timeoff/allowances
- Parameters:
allowance_id (int | str) – The unique identifier.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The record.
- Return type:
- async update(allowance_id: int | str, data: Mapping[str, Any], **kwargs) Allowance[source]
Update an allowance.
Official documentation: timeoff/allowances
- Parameters:
allowance_id (int | str) – The unique identifier of the record to update.
data (Mapping[str, Any]) – Payload with fields to update (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The updated record.
- Return type:
- class factorialhr.AllowanceStatsEndpoint(api: ApiClient)[source]
Endpoint for timeoff/allowance_stats operations.
- async all(**kwargs) ListApiResponse[AllowanceStatsNew][source]
Get all allowance stats records.
Official documentation: timeoff/allowance_stats
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing the list of records.
- Return type:
- async get(**kwargs) MetaApiResponse[AllowanceStatsNew][source]
Get allowance stats with pagination metadata.
Official documentation: timeoff/allowance_stats
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing records and pagination metadata.
- Return type:
- async get_by_id(stat_id: int | str, **kwargs) AllowanceStatsNew[source]
Get a specific allowance stat by ID.
Official documentation: timeoff/allowance_stats
- Parameters:
stat_id (int | str) – The unique identifier.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The record.
- Return type:
- class factorialhr.AllowanceStatsNew(*, id: str, allowance_id: int, employee_id: int, year: int, cycles: str, carry_overs: Sequence[Any], accumulated_carry_over: Mapping[str, Any], available_days: Mapping[str, Any], total_accrued_units: Mapping[str, Any], incidences: Mapping[str, Any], max_balance_cap: Mapping[str, Any] | None = None, policy_allowance: Mapping[str, Any], prorated_allowance_days: Mapping[str, Any], total_in_decimal: Mapping[str, Any] | None = None, used_carry_over: Mapping[str, Any], used_days: Mapping[str, Any], used_units_until_reference_date: Mapping[str, Any], outstanding_units: Mapping[str, Any])[source]
Model for timeoff_allowance_stats_new.
- class factorialhr.BlockedPeriod(*, id: int, company_id: int, name: str, leave_type_ids: Sequence[int], time_periods: Sequence[Mapping[str, Any]], strategy: str, members: Sequence[int], location_ids: Sequence[int] | None = None, team_ids: Sequence[int] | None = None, legal_entity_ids: Sequence[int] | None = None)[source]
Model for timeoff_blocked_periods_policy.
- class factorialhr.BlockedPeriodsEndpoint(api: ApiClient)[source]
Endpoint for timeoff/blocked_periods operations.
- async all(**kwargs) ListApiResponse[BlockedPeriod][source]
Get all blocked periods records.
Official documentation: timeoff/blocked_periods
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing the list of records.
- Return type:
- async create(data: Mapping[str, Any], **kwargs) BlockedPeriod[source]
Create a new blocked period.
Official documentation: timeoff/blocked_periods
- Parameters:
data (Mapping[str, Any]) – Payload for the new record (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The created record.
- Return type:
- async delete(period_id: int | str, **kwargs) BlockedPeriod[source]
Delete a blocked period.
Official documentation: timeoff/blocked_periods
- Parameters:
period_id (int | str) – The unique identifier of the record to delete.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The deleted record.
- Return type:
- async get(**kwargs) MetaApiResponse[BlockedPeriod][source]
Get blocked periods with pagination metadata.
Official documentation: timeoff/blocked_periods
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing records and pagination metadata.
- Return type:
- async get_by_id(period_id: int | str, **kwargs) BlockedPeriod[source]
Get a specific blocked period by ID.
Official documentation: timeoff/blocked_periods
- Parameters:
period_id (int | str) – The unique identifier.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The record.
- Return type:
- async update(period_id: int | str, data: Mapping[str, Any], **kwargs) BlockedPeriod[source]
Update a blocked period.
Official documentation: timeoff/blocked_periods
- Parameters:
period_id (int | str) – The unique identifier of the record to update.
data (Mapping[str, Any]) – Payload with fields to update (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The updated record.
- Return type:
- class factorialhr.Leave(*, id: int, company_id: int, employee_id: int, start_on: date, finish_on: date | None = None, half_day: HalfDay | None = None, description: str | None = None, reason: str | None = None, leave_type_id: int | None = None, leave_type_name: str | None = None, approved: bool | None = None, employee_full_name: str | None = None, start_time: str | None = None, hours_amount_in_cents: int | None = None, duration_attributes: Mapping[str, Any] | None = None, deleted_at: datetime | None = None, updated_at: datetime, created_at: datetime | None = None, days_taken: int | None = None)[source]
Model for timeoff_leave.
- days_taken: int | None
Number of days taken for paid leave
- half_day: HalfDay | None
Indicates if the leave is taken as a half-day
- class factorialhr.LeavesEndpoint(api: ApiClient)[source]
Endpoint for timeoff/leaves operations.
- async all(**kwargs) ListApiResponse[Leave][source]
Get all leaves records.
Official documentation: timeoff/leaves
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing the list of records.
- Return type:
- async approve(data: Mapping[str, Any], **kwargs) Leave[source]
Approve a leave.
Official documentation: timeoff/leaves
- Parameters:
data (Mapping[str, Any]) – Payload for the new record (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Result.
- Return type:
- async approve_all(data: Mapping[str, Any], **kwargs) Leave[source]
Approve all steps of a leave.
Official documentation: timeoff/leaves
- Parameters:
data (Mapping[str, Any]) – Payload for the new record (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Result.
- Return type:
- async create(data: Mapping[str, Any], **kwargs) Leave[source]
Create a new leave.
Official documentation: timeoff/leaves
- Parameters:
data (Mapping[str, Any]) – Payload for the new record (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The created record.
- Return type:
- async delete(leave_id: int | str, **kwargs) Leave[source]
Delete a leave.
Official documentation: timeoff/leaves
- Parameters:
leave_id (int | str) – The unique identifier of the record to delete.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The deleted record.
- Return type:
- async get(**kwargs) MetaApiResponse[Leave][source]
Get leaves with pagination metadata.
Official documentation: timeoff/leaves
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing records and pagination metadata.
- Return type:
- async get_by_id(leave_id: int | str, **kwargs) Leave[source]
Get a specific leave by ID.
Official documentation: timeoff/leaves
- Parameters:
leave_id (int | str) – The unique identifier.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The record.
- Return type:
- async reject(data: Mapping[str, Any], **kwargs) Leave[source]
Reject a leave.
Official documentation: timeoff/leaves
- Parameters:
data (Mapping[str, Any]) – Payload for the new record (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Result.
- Return type:
- async update(leave_id: int | str, data: Mapping[str, Any], **kwargs) Leave[source]
Update a leave.
Official documentation: timeoff/leaves
- Parameters:
leave_id (int | str) – The unique identifier of the record to update.
data (Mapping[str, Any]) – Payload with fields to update (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The updated record.
- Return type:
- class factorialhr.LeaveType(*, id: int, name: str, translated_name: str | None = None, identifier: str, color: str, active: bool | None = None, editable: bool | None = None, approval_required: bool | None = None, accrues: bool | None = None, attachment: bool, allow_endless: bool | None = None, restricted: bool | None = None, visibility: bool, workable: bool, payable: bool | None = None, company_id: int, is_attachment_mandatory: bool | None = None, allowance_ids: Sequence[int], half_days_units_enabled: bool | None = None, max_days_in_cents: int | None = None, min_days_in_cents: int | None = None, description: str | None = None, details_required: bool)[source]
Model for timeoff_leave_type.
- class factorialhr.LeaveTypesEndpoint(api: ApiClient)[source]
Endpoint for timeoff/leave_types operations.
- async all(**kwargs) ListApiResponse[LeaveType][source]
Get all leave types records.
Official documentation: timeoff/leave_types
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing the list of records.
- Return type:
- async create(data: Mapping[str, Any], **kwargs) LeaveType[source]
Create a new leave type.
Official documentation: timeoff/leave_types
- Parameters:
data (Mapping[str, Any]) – Payload for the new record (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The created record.
- Return type:
- async get(**kwargs) MetaApiResponse[LeaveType][source]
Get leave types with pagination metadata.
Official documentation: timeoff/leave_types
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing records and pagination metadata.
- Return type:
- async get_by_id(leave_type_id: int | str, **kwargs) LeaveType[source]
Get a specific leave type by ID.
Official documentation: timeoff/leave_types
- Parameters:
leave_type_id (int | str) – The unique identifier.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The record.
- Return type:
- async update(leave_type_id: int | str, data: Mapping[str, Any], **kwargs) LeaveType[source]
Update a leave type.
Official documentation: timeoff/leave_types
- Parameters:
leave_type_id (int | str) – The unique identifier of the record to update.
data (Mapping[str, Any]) – Payload with fields to update (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The updated record.
- Return type:
- class factorialhr.PoliciesEndpoint(api: ApiClient)[source]
Endpoint for timeoff/policies operations.
- async all(**kwargs) ListApiResponse[Policy][source]
Get all policies records.
Official documentation: timeoff/policies
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing the list of records.
- Return type:
- async create(data: Mapping[str, Any], **kwargs) Policy[source]
Create a new policy.
Official documentation: timeoff/policies
- Parameters:
data (Mapping[str, Any]) – Payload for the new record (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The created record.
- Return type:
- async delete(policy_id: int | str, **kwargs) Policy[source]
Delete a policy.
Official documentation: timeoff/policies
- Parameters:
policy_id (int | str) – The unique identifier of the record to delete.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The deleted record.
- Return type:
- async get(**kwargs) MetaApiResponse[Policy][source]
Get policies with pagination metadata.
Official documentation: timeoff/policies
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing records and pagination metadata.
- Return type:
- async get_by_id(policy_id: int | str, **kwargs) Policy[source]
Get a specific policy by ID.
Official documentation: timeoff/policies
- Parameters:
policy_id (int | str) – The unique identifier.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The record.
- Return type:
- async update(policy_id: int | str, data: Mapping[str, Any], **kwargs) Policy[source]
Update a policy.
Official documentation: timeoff/policies
- Parameters:
policy_id (int | str) – The unique identifier of the record to update.
data (Mapping[str, Any]) – Payload with fields to update (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The updated record.
- Return type:
- class factorialhr.Policy(*, id: int, name: str, main: bool | None = None, company_id: int, description: str | None = None)[source]
Model for timeoff_policy.
- class factorialhr.PolicyAssignment(*, id: int | None = None, timeoff_policy_id: int, employee_id: int, effective_at: date)[source]
Model for timeoff_policy_assignment.
- class factorialhr.PolicyAssignmentsEndpoint(api: ApiClient)[source]
Endpoint for timeoff/policy_assignments operations.
- async all(**kwargs) ListApiResponse[PolicyAssignment][source]
Get all policy assignments records.
Official documentation: timeoff/policy_assignments
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing the list of records.
- Return type:
- async create(data: Mapping[str, Any], **kwargs) PolicyAssignment[source]
Create a new policy assignment.
Official documentation: timeoff/policy_assignments
- Parameters:
data (Mapping[str, Any]) – Payload for the new record (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The created record.
- Return type:
- async delete(assignment_id: int | str, **kwargs) PolicyAssignment[source]
Delete a policy assignment.
Official documentation: timeoff/policy_assignments
- Parameters:
assignment_id (int | str) – The unique identifier of the record to delete.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The deleted record.
- Return type:
- async get(**kwargs) MetaApiResponse[PolicyAssignment][source]
Get policy assignments with pagination metadata.
Official documentation: timeoff/policy_assignments
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing records and pagination metadata.
- Return type:
- async get_by_id(assignment_id: int | str, **kwargs) PolicyAssignment[source]
Get a specific policy assignment by ID.
Official documentation: timeoff/policy_assignments
- Parameters:
assignment_id (int | str) – The unique identifier.
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The record.
- Return type:
- async update(assignment_id: int | str, data: Mapping[str, Any], **kwargs) PolicyAssignment[source]
Update a policy assignment.
Official documentation: timeoff/policy_assignments
- Parameters:
assignment_id (int | str) – The unique identifier of the record to update.
data (Mapping[str, Any]) – Payload with fields to update (key-value mapping).
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.
- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
The updated record.
- Return type:
- class factorialhr.PolicyTimeline(*, employee_id: int, start_limit_date: date, end_limit_date: date, items: Sequence[Any], id: int)[source]
Model for timeoff_policy_timeline.
- class factorialhr.PolicyTimelinesEndpoint(api: ApiClient)[source]
Endpoint for timeoff/policy_timelines operations.
- async all(**kwargs) ListApiResponse[PolicyTimeline][source]
Get all policy timelines records.
Official documentation: timeoff/policy_timelines
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing the list of records.
- Return type:
- async get(**kwargs) MetaApiResponse[PolicyTimeline][source]
Get policy timelines with pagination metadata.
Official documentation: timeoff/policy_timelines
- Parameters:
kwargs (optional) – Optional keyword arguments (e.g.
paramsfor query string) forwarded to the HTTP request.- Raises:
httpx.HTTPStatusError – When the API returns an error status code.
- Returns:
Response containing records and pagination metadata.
- Return type: