Tasks

Usage

List tasks and task files:

import asyncio
import factorialhr

async def main():
    auth = factorialhr.AccessTokenAuth("your_access_token")
    async with factorialhr.ApiClient(auth=auth) as api:
        tasks = factorialhr.TasksEndpoint(api)
        response = await tasks.get(params={"limit": 20})
        for t in response.data():
            print(t.title, t.status, t.due_date)
        files = factorialhr.TaskFilesEndpoint(api)
        for f in (await files.all()).data():
            print(f.task_id, f.filename)

asyncio.run(main())
class factorialhr.Task(*, id: int, name: str, company_id: int, content: str | None = None, due_on: date | None = None, assignee_ids: Sequence[int], author_employee_id: int | None = None, completed_at: str | None = None, completed_by_id: int | None = None, created_at: datetime, updated_at: datetime, status: TaskStatus | None = None)[source]

Model for tasks_task.

assignee_ids: Sequence[int]

Employees assigned to the task, assignee_id references to access_id

author_employee_id: int | None

Employee id of the author of the task

company_id: int

Company identifier of the author of the task

completed_at: str | None

Completed at date of the task

completed_by_id: int | None

Completed by identifier

content: str | None

Content of the task

created_at: datetime

Created at date of the task

due_on: date | None

Due on date of the task

id: int

Identifier of the task

name: str

Name of the task

status: TaskStatus | None

Status of the task

updated_at: datetime

Updated at date of the task

class factorialhr.TaskFile(*, id: int, task_id: int, filename: str, content_type: str | None = None, path: str, created_at: datetime)[source]

Model for tasks_task_file.

content_type: str | None

Content type of the file

created_at: datetime

Creation date of the file

filename: str

Name of the file

id: int

Identifier of the file

path: str

Path of the file, for downloading the file you need to concat api_url/path

task_id: int

Identifier of the task

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

Endpoint for tasks/task_files operations.

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

Get all task files records.

Official documentation: tasks/task_files

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[TaskFile]

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

Create a new task file.

Official documentation: tasks/task_files

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:

TaskFile

async delete(file_id: int | str, **kwargs) TaskFile[source]

Delete a task file.

Official documentation: tasks/task_files

Parameters:
  • file_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:

TaskFile

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

Get task files with pagination metadata.

Official documentation: tasks/task_files

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[TaskFile]

async get_by_id(file_id: int | str, **kwargs) TaskFile[source]

Get a specific task file by ID.

Official documentation: tasks/task_files

Parameters:
  • file_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:

TaskFile

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

Endpoint for tasks/tasks operations.

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

Get all tasks records.

Official documentation: tasks/tasks

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[Task]

async bulk_create(data: Mapping[str, Any], **kwargs) Sequence[Task][source]

Bulk create tasks.

Official documentation: tasks/tasks

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:

Sequence[Task]

async bulk_delete(data: Mapping[str, Any], **kwargs) Sequence[Task][source]

Bulk delete tasks.

Official documentation: tasks/tasks

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:

Sequence[Task]

async bulk_update(data: Mapping[str, Any], **kwargs) Sequence[Task][source]

Bulk update tasks.

Official documentation: tasks/tasks

Parameters:
  • 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:

Result.

Return type:

Sequence[Task]

async copy(data: Mapping[str, Any], **kwargs) Task[source]

Copy a task.

Official documentation: tasks/tasks

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:

Task

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

Create a new task.

Official documentation: tasks/tasks

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:

Task

async create_comment(data: Mapping[str, Any], **kwargs) Task[source]

Create a comment on a task.

Official documentation: tasks/tasks

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:

Task

async delete(task_id: int | str, **kwargs) Task[source]

Delete a task.

Official documentation: tasks/tasks

Parameters:
  • task_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:

Task

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

Get tasks with pagination metadata.

Official documentation: tasks/tasks

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[Task]

async get_by_id(task_id: int | str, **kwargs) Task[source]

Get a specific task by ID.

Official documentation: tasks/tasks

Parameters:
  • task_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:

Task

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

Update a task.

Official documentation: tasks/tasks

Parameters:
  • task_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:

Task