Trainings
Usage
List trainings, sessions, and attendance:
import asyncio
import factorialhr
async def main():
auth = factorialhr.AccessTokenAuth("your_access_token")
async with factorialhr.ApiClient(auth=auth) as api:
trainings = factorialhr.TrainingsEndpoint(api)
response = await trainings.get(params={"limit": 20})
for t in response.data():
print(t.name, t.status)
sessions = factorialhr.SessionsEndpoint(api)
for s in (await sessions.all()).data():
print(s.training_id, s.starts_at)
attendance = factorialhr.SessionAttendancesEndpoint(api)
for a in (await attendance.get(params={"page": 1})).data():
print(a.session_id, a.employee_id)
asyncio.run(main())
- class factorialhr.Session(*, id: int, name: str, training_id: int, description: str | None = None, training_class_id: str | None = None, starts_at: datetime | None = None, ends_at: datetime | None = None, due_date: date | None = None, duration: Mapping[str, Any] | None = None, modality: SessionModality | None = None, schedule: SessionSchedule | None = None, link: str | None = None, location: str | None = None, session_attendance_ids: Sequence[int] | None = None, session_feedback_id: int | None = None, subsidized: bool, status: str | None = None, parent_id: int | None = None)[source]
Model for trainings_session.
- description: str | None
Session description
- due_date: date | None
Date when the session should end
- duration: Mapping[str, Any] | None
The duration in hours and minutes of the session
- ends_at: datetime | None
Date when the session should end
- id: int
Session ID
- link: str | None
The link to see material from the session
- location: str | None
The place where the session takes place
- modality: SessionModality | None
The mode the session will be handled, online, in person or hybrid
- name: str
Session name
- parent_id: int | None
ID of the recurrent session that is parent of the current one
- schedule: SessionSchedule | None
Session schedule information (scheduled, self-paced)
- session_attendance_ids: Sequence[int] | None
Session attendance IDs
- session_feedback_id: int | None
Session feedback ID
- starts_at: datetime | None
Date when the session should start
- status: str | None
Status of the session
- subsidized: bool
If the session is subsidized
- training_class_id: str | None
Identifier of the group
- training_id: int
Identifier of the course
- class factorialhr.SessionAccessMembership(*, id: int, access_id: int, employee_id: int | None = None, session_id: int, first_name: str | None = None, last_name: str | None = None, job_title: str | None = None)[source]
Model for trainings_session_access_membership.
- access_id: int
ID of the access associated with this membership
- employee_id: int | None
ID of the employee associated with this membership
- first_name: str | None
First name of the user associated with this membership
- id: int
ID of this membership
- job_title: str | None
Job title of the user associated with this membership
- last_name: str | None
Last name of the user associated with this membership
- session_id: int
ID of the session associated with this membership
- class factorialhr.SessionAccessMembershipsEndpoint(api: ApiClient)[source]
Endpoint for trainings/session_access_memberships operations.
- async all(**kwargs) ListApiResponse[SessionAccessMembership][source]
Get all session access memberships.
Official documentation: trainings/session_access_memberships
- 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 bulk_create(data: Mapping[str, Any], **kwargs) Sequence[SessionAccessMembership][source]
Bulk create session access memberships.
Official documentation: trainings/session_access_memberships
- 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:
Sequence[SessionAccessMembership]
- async bulk_destroy(data: Mapping[str, Any], **kwargs) Sequence[SessionAccessMembership][source]
Bulk destroy session access memberships.
Official documentation: trainings/session_access_memberships
- 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:
Sequence[SessionAccessMembership]
- async get(**kwargs) MetaApiResponse[SessionAccessMembership][source]
Get session access memberships with pagination metadata.
Official documentation: trainings/session_access_memberships
- 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(membership_id: int | str, **kwargs) SessionAccessMembership[source]
Get a specific session access membership by ID.
Official documentation: trainings/session_access_memberships
- Parameters:
membership_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.SessionAttendance(*, id: int, status: str, session_access_membership_id: int, access_id: int, employee_id: int | None = None)[source]
Model for trainings_session_attendance.
- access_id: int
Access ID
- employee_id: int | None
Employee ID
- id: int
Session attendance ID
- session_access_membership_id: int
Session access membership ID
- status: str
Attendance status
- class factorialhr.SessionAttendancesEndpoint(api: ApiClient)[source]
Endpoint for trainings/session_attendances operations.
- async all(**kwargs) ListApiResponse[SessionAttendance][source]
Get all session attendances.
Official documentation: trainings/session_attendances
- 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 bulk_update(data: Mapping[str, Any], **kwargs) Sequence[SessionAttendance][source]
Bulk update session attendances.
Official documentation: trainings/session_attendances
- Parameters:
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:
Result.
- Return type:
Sequence[SessionAttendance]
- async get(**kwargs) MetaApiResponse[SessionAttendance][source]
Get session attendances with pagination metadata.
Official documentation: trainings/session_attendances
- 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(attendance_id: int | str, **kwargs) SessionAttendance[source]
Get a specific session attendance by ID.
Official documentation: trainings/session_attendances
- Parameters:
attendance_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.SessionsEndpoint(api: ApiClient)[source]
Endpoint for trainings/sessions operations.
- async all(**kwargs) ListApiResponse[Session][source]
Get all training sessions.
Official documentation: trainings/sessions
- 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) Session[source]
Create a new training session.
Official documentation: trainings/sessions
- 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(session_id: int | str, **kwargs) Session[source]
Delete a training session.
Official documentation: trainings/sessions
- Parameters:
session_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[Session][source]
Get training sessions with pagination metadata.
Official documentation: trainings/sessions
- 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(session_id: int | str, **kwargs) Session[source]
Get a specific training session by ID.
Official documentation: trainings/sessions
- Parameters:
session_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(session_id: int | str, data: Mapping[str, Any], **kwargs) Session[source]
Update a training session.
Official documentation: trainings/sessions
- Parameters:
session_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.Training(*, id: int, company_id: int, author_id: int, name: str, code: str | None = None, description: str, created_at: datetime | None = None, updated_at: datetime | None = None, external_provider: str | None = None, external: bool, total_cost: int | None = None, fundae_subsidized: bool, subsidized: bool, cost: int, subsidized_cost: int, total_cost_decimal: Mapping[str, Any] | None = None, cost_decimal: Mapping[str, Any], subsidized_cost_decimal: Mapping[str, Any], category_ids: Sequence[int] | None = None, status: TrainingStatus | None = None, year: int, catalog: bool, competency_ids: Sequence[int], total_training_cost: Mapping[str, Any], total_training_indirect_cost: Mapping[str, Any], total_training_salary_cost: Mapping[str, Any], total_training_subsidized_cost: Mapping[str, Any], total_participants: int, training_attendance_status: TrainingAttendanceStatus, valid_for: int | None = None, objectives: str | None = None, number_of_expired_participants: int | None = None, thumbnail: str | None = None, is_mandatory: bool, total_duration: float)[source]
Model for trainings_training.
- is_mandatory: bool
This field is used to define if the training is mandatory or not
- status: TrainingStatus | None
Training status. Can be one of the following values
- thumbnail: str | None
The training thumbnail
- total_duration: float
The total duration in hours and minutes of the course
- training_attendance_status: TrainingAttendanceStatus
Training attendance status
- class factorialhr.TrainingCategoriesEndpoint(api: ApiClient)[source]
Endpoint for trainings/categories operations.
- async all(**kwargs) ListApiResponse[TrainingCategory][source]
Get all training categories.
Official documentation: trainings/categories
- 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) TrainingCategory[source]
Create a new training category.
Official documentation: trainings/categories
- 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(category_id: int | str, **kwargs) TrainingCategory[source]
Delete a training category.
Official documentation: trainings/categories
- Parameters:
category_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[TrainingCategory][source]
Get training categories with pagination metadata.
Official documentation: trainings/categories
- 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(category_id: int | str, **kwargs) TrainingCategory[source]
Get a specific training category by ID.
Official documentation: trainings/categories
- Parameters:
category_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.TrainingCategory(*, id: int, name: str, company_id: int, created_at: datetime | None = None, updated_at: datetime | None = None)[source]
Model for trainings_category.
- company_id: int
Company ID
- created_at: datetime | None
Creation date
- id: int
Category ID
- name: str
Category name
- updated_at: datetime | None
Last update date
- class factorialhr.TrainingClass(*, id: str, training_id: int, name: str, description: str | None = None, start_date: date | None = None, end_date: date | None = None, cost: str, indirect_cost: str, salary_cost: str, subsidized_cost: str, completed_attendances_count: int, total_attendances_count: int)[source]
Model for trainings_training_class.
- completed_attendances_count: int
Number of completed session attendances in this group.
- total_attendances_count: int
Total number of session attendances expected in this group.
- class factorialhr.TrainingClassesEndpoint(api: ApiClient)[source]
Endpoint for trainings/training_classes operations.
- async all(**kwargs) ListApiResponse[TrainingClass][source]
Get all training classes.
Official documentation: trainings/training_classes
- 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) TrainingClass[source]
Create a new training class.
Official documentation: trainings/training_classes
- 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(class_id: int | str, **kwargs) TrainingClass[source]
Delete a training class.
Official documentation: trainings/training_classes
- Parameters:
class_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[TrainingClass][source]
Get training classes with pagination metadata.
Official documentation: trainings/training_classes
- 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(class_id: int | str, **kwargs) TrainingClass[source]
Get a specific training class by ID.
Official documentation: trainings/training_classes
- Parameters:
class_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(class_id: int | str, data: Mapping[str, Any], **kwargs) TrainingClass[source]
Update a training class.
Official documentation: trainings/training_classes
- Parameters:
class_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.TrainingMembership(*, id: int, access_id: int, employee_id: int, training_id: int, status: str, training_due_date: date | None = None, training_completed_at: date | None = None)[source]
Model for trainings_training_membership.
- class factorialhr.TrainingMembershipsEndpoint(api: ApiClient)[source]
Endpoint for trainings/training_memberships operations.
- async all(**kwargs) ListApiResponse[TrainingMembership][source]
Get all training memberships.
Official documentation: trainings/training_memberships
- 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 bulk_create(data: Mapping[str, Any], **kwargs) Sequence[TrainingMembership][source]
Bulk create training memberships.
Official documentation: trainings/training_memberships
- 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:
Sequence[TrainingMembership]
- async bulk_destroy(data: Mapping[str, Any], **kwargs) Sequence[TrainingMembership][source]
Bulk destroy training memberships.
Official documentation: trainings/training_memberships
- 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:
Sequence[TrainingMembership]
- async get(**kwargs) MetaApiResponse[TrainingMembership][source]
Get training memberships with pagination metadata.
Official documentation: trainings/training_memberships
- 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(membership_id: int | str, **kwargs) TrainingMembership[source]
Get a specific training membership by ID.
Official documentation: trainings/training_memberships
- Parameters:
membership_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(membership_id: int | str, data: Mapping[str, Any], **kwargs) TrainingMembership[source]
Update a training membership.
Official documentation: trainings/training_memberships
- Parameters:
membership_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.TrainingsEndpoint(api: ApiClient)[source]
Endpoint for trainings/trainings operations.
- async all(**kwargs) ListApiResponse[Training][source]
Get all trainings.
Official documentation: trainings/trainings
- 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 bulk_delete(data: Mapping[str, Any], **kwargs) Sequence[Training][source]
Bulk delete trainings.
Official documentation: trainings/trainings
- 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:
Sequence[Training]
- async bulk_update_catalog(data: Mapping[str, Any], **kwargs) Sequence[Training][source]
Bulk update catalog visibility for trainings.
Official documentation: trainings/trainings
- Parameters:
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:
Result.
- Return type:
Sequence[Training]
- async create(data: Mapping[str, Any], **kwargs) Training[source]
Create a new training.
Official documentation: trainings/trainings
- 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(training_id: int | str, **kwargs) Training[source]
Delete a training.
Official documentation: trainings/trainings
- Parameters:
training_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[Training][source]
Get trainings with pagination metadata.
Official documentation: trainings/trainings
- 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(training_id: int | str, **kwargs) Training[source]
Get a specific training by ID.
Official documentation: trainings/trainings
- Parameters:
training_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(training_id: int | str, data: Mapping[str, Any], **kwargs) Training[source]
Update a training.
Official documentation: trainings/trainings
- Parameters:
training_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:
- async update_status(data: Mapping[str, Any], **kwargs) Training[source]
Update training status.
Official documentation: trainings/trainings
- Parameters:
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:
Result.
- Return type: