Integrations

Usage

List syncable items and sync runs:

import asyncio
import factorialhr

async def main():
    auth = factorialhr.AccessTokenAuth("your_access_token")
    async with factorialhr.ApiClient(auth=auth) as api:
        items = factorialhr.SyncableItemsEndpoint(api)
        response = await items.get(params={"limit": 10})
        for item in response.data():
            print(item.syncable_type, item.external_id)
        runs = factorialhr.SyncableSyncRunsEndpoint(api)
        for run in (await runs.all()).data():
            print(run.started_at, run.status)

asyncio.run(main())

Enums

class factorialhr.SyncableType(*values)[source]

Bases: StrEnum

Enum for syncable item types.

COMPENSATION = 'compensations/compensation'
EXPENSE = 'expenses/expense'

Models and endpoints

class factorialhr.SyncableItem(*, id: int, sync_run_id: int, item_type: str, item_id: int, status: str, syncable_type: SyncableType, created_at: datetime, updated_at: datetime)[source]

Model for integrations_syncable_item.

created_at: datetime

Creation date

id: int

Syncable item identifier

item_id: int

Identifier of the item

item_type: str

Type of the syncable item

status: str

Status of the syncable item

sync_run_id: int

Sync run identifier

syncable_type: SyncableType

Type of the syncable item

updated_at: datetime

Last update date

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

Endpoint for integrations/syncable_items operations.

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

Get all syncable items records.

Official documentation: integrations/syncable_items

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

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

Get syncable items with pagination metadata.

Official documentation: integrations/syncable_items

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

async get_by_id(item_id: int | str, **kwargs) SyncableItem[source]

Get a specific syncable item by ID.

Official documentation: integrations/syncable_items

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

SyncableItem

class factorialhr.SyncableSyncRun(*, id: int, syncable_item_id: int, status: str, started_at: datetime | None = None, completed_at: datetime | None = None, created_at: datetime, updated_at: datetime)[source]

Model for integrations_syncable_sync_run.

completed_at: datetime | None

Completion date

created_at: datetime

Creation date

id: int

Sync run identifier

started_at: datetime | None

Start date

status: str

Status of the sync run

syncable_item_id: int

Syncable item identifier

updated_at: datetime

Last update date

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

Endpoint for integrations/syncable_sync_runs operations.

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

Get all syncable sync runs records.

Official documentation: integrations/syncable_sync_runs

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

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

Get syncable sync runs with pagination metadata.

Official documentation: integrations/syncable_sync_runs

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

async get_by_id(run_id: int | str, **kwargs) SyncableSyncRun[source]

Get a specific syncable sync run by ID.

Official documentation: integrations/syncable_sync_runs

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

SyncableSyncRun

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

Update a syncable sync run.

Official documentation: integrations/syncable_sync_runs

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

SyncableSyncRun