Holidays
Usage
List company holidays:
import asyncio
import factorialhr
async def main():
auth = factorialhr.AccessTokenAuth("your_access_token")
async with factorialhr.ApiClient(auth=auth) as api:
holidays = factorialhr.CompanyHolidaysEndpoint(api)
response = await holidays.all()
for h in response.data():
print(h.name, h.date, h.half_day)
asyncio.run(main())
- class factorialhr.CompanyHoliday(*, id: int, location_ids: Sequence[int] | None = None, team_ids: Sequence[int] | None = None, employee_ids: Sequence[int] | None = None, summary: str | None = None, description: str | None = None, date: date, half_day: HalfDay | None = None)[source]
Model for holidays_company_holiday.
- date: date
Company holiday date
- description: str | None
Company holiday description
- employee_ids: Sequence[int] | None
Related employee ids
- half_day: HalfDay | None
If the company holiday is half-day and which part of the day
- id: int
Company holiday id
- location_ids: Sequence[int] | None
Related location ids
- summary: str | None
Company holiday summary
- team_ids: Sequence[int] | None
Related team ids
- class factorialhr.CompanyHolidaysEndpoint(api: ApiClient)[source]
Endpoint for holidays/company_holidays operations.
- async all(**kwargs) ListApiResponse[CompanyHoliday][source]
Get all company holidays records.
Official documentation: holidays/company_holidays
- 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[CompanyHoliday][source]
Get company holidays with pagination metadata.
Official documentation: holidays/company_holidays
- 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(holiday_id: int | str, **kwargs) CompanyHoliday[source]
Get a specific company holiday by ID.
Official documentation: holidays/company_holidays
- Parameters:
holiday_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: