Custom Resources

Usage

Work with custom resource definitions and values:

import asyncio
import factorialhr

async def main():
    auth = factorialhr.AccessTokenAuth("your_access_token")
    async with factorialhr.ApiClient(auth=auth) as api:
        schemas = factorialhr.CustomResourcesSchemasEndpoint(api)
        for schema in (await schemas.all()).data():
            print(schema.name)
        resources = factorialhr.ResourcesEndpoint(api)
        response = await resources.get(params={"limit": 20})
        for r in response.data():
            print(r.resource_field_id, r.value)

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

Endpoint for custom_resources/schemas operations.

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

Get all schemas records.

Official documentation: custom_resources/schemas

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

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

Create a new schema.

Official documentation: custom_resources/schemas

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:

Schema

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

Get schemas with pagination metadata.

Official documentation: custom_resources/schemas

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

async get_by_id(schema_id: int | str, **kwargs) Schema[source]

Get a specific schema by ID.

Official documentation: custom_resources/schemas

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

Schema

class factorialhr.CustomResourcesValue(*, id: int, resource_id: int, attachable_id: int | None = None)[source]

Model for custom_resources_value.

attachable_id: int | None

The id of the attached resource like an employee

id: int

Value identifier

resource_id: int

The identifier of the resource that owns the resource value

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

Endpoint for custom_resources/values operations.

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

Get all values records.

Official documentation: custom_resources/values

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

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

Create a new value.

Official documentation: custom_resources/values

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:

CustomResourcesValue

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

Get values with pagination metadata.

Official documentation: custom_resources/values

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

async get_by_id(value_id: int | str, **kwargs) CustomResourcesValue[source]

Get a specific value by ID.

Official documentation: custom_resources/values

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

CustomResourcesValue

class factorialhr.Resource(*, id: int, name: str, company_id: int, created_at: datetime, updated_at: datetime)[source]

Model for custom_resources_resource.

company_id: int

Company identifier

created_at: datetime

Creation date

id: int

Resource identifier

name: str

Resource name

updated_at: datetime

Last update date

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

Endpoint for custom_resources/resources operations.

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

Get all resources records.

Official documentation: custom_resources/resources

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

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

Get resources with pagination metadata.

Official documentation: custom_resources/resources

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

async get_by_id(resource_id: int | str, **kwargs) Resource[source]

Get a specific resource by ID.

Official documentation: custom_resources/resources

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

Resource

class factorialhr.Schema(*, id: int, name: str, company_id: int, hidden: bool, position: int | None = None)[source]

Model for custom_resources_schema.

company_id: int

Company identifier where this schema belongs

hidden: bool

Manages visibility of the schema

id: int

Schema identifier

name: str

Schema name

position: int | None

Schema position within employee profile