Compensations

Usage

Fetch compensation concepts (e.g. salary components, allowances):

import asyncio
import factorialhr

async def main():
    auth = factorialhr.AccessTokenAuth("your_access_token")
    async with factorialhr.ApiClient(auth=auth) as api:
        concepts = factorialhr.ConceptsEndpoint(api)
        response = await concepts.all()
        for concept in response.data():
            print(concept.name, concept.category, concept.unit_type)

asyncio.run(main())

Enums

class factorialhr.ConceptCategory(*values)[source]

Bases: StrEnum

Enum for concept categories.

COMPANY_CONTRIBUTION = 'company_contribution'
DEDUCTIONS = 'deductions'
EARNINGS_BENEFITS_IN_KIND = 'earnings_benefits_in_kind'
EARNINGS_FIXED_SALARY = 'earnings_fixed_salary'
EARNINGS_OTHERS = 'earnings_others'
EARNINGS_VARIABLE = 'earnings_variable'
SUMMARIZED_VALUES = 'summarized_values'
class factorialhr.UnitType(*values)[source]

Bases: StrEnum

Enum for unit types.

DISTANCE = 'distance'
MONEY = 'money'
TIME = 'time'
UNIT = 'unit'

Models and endpoints

class factorialhr.Concept(*, id: int, company_id: int, default: bool, description: str, label: str, name: str, category: ConceptCategory | None = None, translated_name: str | None = None, unit_name: str | None = None, unit_type: UnitType | None = None)[source]

Model for compensations_concept.

category: ConceptCategory | None

The category of the concept

company_id: int

The company identifier of the concept

default: bool

Whether the concept is a default or a custom concept

description: str

The description of the concept

id: int

The identifier of the concept

label: str

The label of the concept

name: str

The name of the concept

translated_name: str | None

The translated name of the concept if it is a default concept

unit_name: str | None

The name of the unit of the concept

unit_type: UnitType | None

The type of the unit of the concept

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

Endpoint for compensations/concepts operations.

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

Get all concepts records.

Official documentation: compensations/concepts

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

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

Get concepts with pagination metadata.

Official documentation: compensations/concepts

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

async get_by_id(concept_id: int | str, **kwargs) Concept[source]

Get a specific concept by ID.

Official documentation: compensations/concepts

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

Concept