Work Schedule

Usage

Fetch work schedule configuration:

import asyncio
import factorialhr

async def main():
    auth = factorialhr.AccessTokenAuth("your_access_token")
    async with factorialhr.ApiClient(auth=auth) as api:
        schedule = factorialhr.ScheduleEndpoint(api)
        one = await schedule.get_by_id(123)
        print(one.name)
        day_config = factorialhr.DayConfigurationEndpoint(api)
        config = await day_config.get_by_id(456)
        print(config.schedule_id)

asyncio.run(main())
class factorialhr.DayConfigurationEndpoint(api: ApiClient)[source]

Endpoint for work_schedule/day_configurations operations.

async all(**kwargs) ListApiResponse[WorkScheduleDayConfiguration][source]

Get all day configuration records.

Official documentation: work_schedule/day_configurations

Parameters:

kwargs (optional) – Optional keyword arguments (e.g. params for 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:

ListApiResponse[WorkScheduleDayConfiguration]

async bulk_cud(data: Mapping[str, Any], **kwargs) WorkScheduleDayConfiguration[source]

Bulk create/update/delete day configurations.

Official documentation: work_schedule/day_configurations

Parameters:
  • data (Mapping[str, Any]) – Payload for the new record (key-value mapping).

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

Result.

Return type:

WorkScheduleDayConfiguration

async get(**kwargs) MetaApiResponse[WorkScheduleDayConfiguration][source]

Get day configurations with pagination metadata.

Official documentation: work_schedule/day_configurations

Parameters:

kwargs (optional) – Optional keyword arguments (e.g. params for 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:

MetaApiResponse[WorkScheduleDayConfiguration]

async get_by_id(day_config_id: int | str, **kwargs) WorkScheduleDayConfiguration[source]

Get a specific day configuration by ID.

Official documentation: work_schedule/day_configurations

Parameters:
  • day_config_id (int | str) – The unique identifier.

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The record.

Return type:

WorkScheduleDayConfiguration

class factorialhr.OverlapPeriodEndpoint(api: ApiClient)[source]

Endpoint for work_schedule/overlap_periods operations.

async all(**kwargs) ListApiResponse[WorkScheduleOverlapPeriod][source]

Get all overlap period records.

Official documentation: work_schedule/overlap_periods

Parameters:

kwargs (optional) – Optional keyword arguments (e.g. params for 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:

ListApiResponse[WorkScheduleOverlapPeriod]

async create(data: Mapping[str, Any], **kwargs) WorkScheduleOverlapPeriod[source]

Create a new overlap period.

Official documentation: work_schedule/overlap_periods

Parameters:
  • data (Mapping[str, Any]) – Payload for the new record (key-value mapping).

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The created record.

Return type:

WorkScheduleOverlapPeriod

async delete(overlap_period_id: int | str, **kwargs) WorkScheduleOverlapPeriod[source]

Delete an overlap period.

Official documentation: work_schedule/overlap_periods

Parameters:
  • overlap_period_id (int | str) – The unique identifier of the record to delete.

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The deleted record.

Return type:

WorkScheduleOverlapPeriod

async get(**kwargs) MetaApiResponse[WorkScheduleOverlapPeriod][source]

Get overlap periods with pagination metadata.

Official documentation: work_schedule/overlap_periods

Parameters:

kwargs (optional) – Optional keyword arguments (e.g. params for 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:

MetaApiResponse[WorkScheduleOverlapPeriod]

async get_by_id(overlap_period_id: int | str, **kwargs) WorkScheduleOverlapPeriod[source]

Get a specific overlap period by ID.

Official documentation: work_schedule/overlap_periods

Parameters:
  • overlap_period_id (int | str) – The unique identifier.

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The record.

Return type:

WorkScheduleOverlapPeriod

async update(overlap_period_id: int | str, data: Mapping[str, Any], **kwargs) WorkScheduleOverlapPeriod[source]

Update an overlap period.

Official documentation: work_schedule/overlap_periods

Parameters:
  • overlap_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. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The updated record.

Return type:

WorkScheduleOverlapPeriod

class factorialhr.ScheduleEndpoint(api: ApiClient)[source]

Endpoint for work_schedule/schedules operations.

async all(**kwargs) ListApiResponse[WorkScheduleSchedule][source]

Get all schedule records.

Official documentation: work_schedule/schedules

Parameters:

kwargs (optional) – Optional keyword arguments (e.g. params for 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:

ListApiResponse[WorkScheduleSchedule]

async create(data: Mapping[str, Any], **kwargs) WorkScheduleSchedule[source]

Create a new schedule.

Official documentation: work_schedule/schedules

Parameters:
  • data (Mapping[str, Any]) – Payload for the new record (key-value mapping).

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The created record.

Return type:

WorkScheduleSchedule

async get(**kwargs) MetaApiResponse[WorkScheduleSchedule][source]

Get schedules with pagination metadata.

Official documentation: work_schedule/schedules

Parameters:

kwargs (optional) – Optional keyword arguments (e.g. params for 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:

MetaApiResponse[WorkScheduleSchedule]

async get_by_id(schedule_id: int | str, **kwargs) WorkScheduleSchedule[source]

Get a specific schedule by ID.

Official documentation: work_schedule/schedules

Parameters:
  • schedule_id (int | str) – The unique identifier.

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The record.

Return type:

WorkScheduleSchedule

async toggle_archive(data: Mapping[str, Any], **kwargs) WorkScheduleSchedule[source]

Toggle archive status of a schedule.

Official documentation: work_schedule/schedules

Parameters:
  • data (Mapping[str, Any]) – Payload for the new record (key-value mapping).

  • kwargs (optional) – Optional keyword arguments (e.g. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

Result.

Return type:

WorkScheduleSchedule

async update(schedule_id: int | str, data: Mapping[str, Any], **kwargs) WorkScheduleSchedule[source]

Update a schedule.

Official documentation: work_schedule/schedules

Parameters:
  • schedule_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. params for query string) forwarded to the HTTP request.

Raises:

httpx.HTTPStatusError – When the API returns an error status code.

Returns:

The updated record.

Return type:

WorkScheduleSchedule

class factorialhr.WorkScheduleDayConfiguration(*, id: int, overlap_period_id: int, weekday: str, start_at: date | None = None, duration_in_seconds: int)[source]

Model for work_schedule_day_configuration.

duration_in_seconds: int

Duration in seconds

id: int

Day configuration ID

overlap_period_id: int

Overlap period ID

start_at: date | None

Start time

weekday: str

Day of the week

class factorialhr.WorkScheduleOverlapPeriod(*, id: int, default: bool, schedule_id: int, start_month: int, start_day: int, end_month: int, end_day: int, schedule_type: str)[source]

Model for work_schedule_overlap_period.

default: bool

Whether this is the default period

end_day: int

End day

end_month: int

End month

id: int

Overlap period ID

schedule_id: int

Schedule ID

schedule_type: str

Type of schedule

start_day: int

Start day

start_month: int

Start month

class factorialhr.WorkScheduleSchedule(*, id: int, name: str, archived_at: datetime | None = None, company_id: int, created_at: datetime, updated_at: datetime, employee_ids: Sequence[int], periods: Sequence[Any])[source]

Model for work_schedule_schedule.

archived_at: datetime | None

Archive date

company_id: int

Company ID

created_at: datetime

Creation date

employee_ids: Sequence[int]

List of employee IDs

id: int

Schedule ID

name: str

Schedule name

periods: Sequence[Any]

Schedule periods

updated_at: datetime

Last update date