Locations
Usage
List locations and work areas:
import asyncio
import factorialhr
async def main():
auth = factorialhr.AccessTokenAuth("your_access_token")
async with factorialhr.ApiClient(auth=auth) as api:
locations = factorialhr.LocationsEndpoint(api)
response = await locations.all()
for loc in response.data():
print(loc.name, loc.location_type)
areas = factorialhr.WorkAreasEndpoint(api)
for area in (await areas.all()).data():
print(area.name)
asyncio.run(main())
- class factorialhr.Location(*, id: int, company_id: int, name: str, timezone: str | None = None, country: str | None = None, state: str | None = None, city: str | None = None, address_line_1: str | None = None, address_line_2: str | None = None, postal_code: str | None = None, phone_number: str | None = None, main: bool, latitude: float | None = None, longitude: float | None = None, radius: float | None = None, siret: str | None = None)[source]
Model for locations_location.
- address_line_1: str | None
Address line 1 of the location
- address_line_2: str | None
Address line 2 of the location
- city: str | None
City of the location
- company_id: int
Company identifier
- country: str | None
Country code of the location
- id: int
Identifier of the location
- latitude: float | None
Latitude of the location
- longitude: float | None
Longitude of the location
- main: bool
Whether the location is the main one
- name: str
Name of the location
- phone_number: str | None
Phone number of the location
- postal_code: str | None
Postal code of the location
- radius: float | None
Radius of the location
- siret: str | None
SIRET of the location (only for France)
- state: str | None
State of the location
- timezone: str | None
Timezone of the location
- class factorialhr.LocationsEndpoint(api: ApiClient)[source]
Endpoint for locations/locations operations.
- async all(**kwargs) ListApiResponse[Location][source]
Get all locations records.
Official documentation: locations/locations
- 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) Location[source]
Create a new location.
Official documentation: locations/locations
- 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(location_id: int | str, **kwargs) Location[source]
Delete a location.
Official documentation: locations/locations
- Parameters:
location_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[Location][source]
Get locations with pagination metadata.
Official documentation: locations/locations
- 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(location_id: int | str, **kwargs) Location[source]
Get a specific location by ID.
Official documentation: locations/locations
- Parameters:
location_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(location_id: int | str, data: Mapping[str, Any], **kwargs) Location[source]
Update a location.
Official documentation: locations/locations
- Parameters:
location_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.WorkArea(*, id: int, location_id: int, name: str, archived_at: str | None = None)[source]
Model for locations_work_area.
- archived_at: str | None
Archival timestamp of the work area
- id: int
Work area identifier
- location_id: int
Location identifier
- name: str
Name of the work area
- class factorialhr.WorkAreasEndpoint(api: ApiClient)[source]
Endpoint for locations/work_areas operations.
- async all(**kwargs) ListApiResponse[WorkArea][source]
Get all work areas records.
Official documentation: locations/work_areas
- 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 archive(data: Mapping[str, Any], **kwargs) WorkArea[source]
Archive a work area.
Official documentation: locations/work_areas
- 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:
- async create(data: Mapping[str, Any], **kwargs) WorkArea[source]
Create a new work area.
Official documentation: locations/work_areas
- 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 get(**kwargs) MetaApiResponse[WorkArea][source]
Get work areas with pagination metadata.
Official documentation: locations/work_areas
- 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(work_area_id: int | str, **kwargs) WorkArea[source]
Get a specific work area by ID.
Official documentation: locations/work_areas
- Parameters:
work_area_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 unarchive(data: Mapping[str, Any], **kwargs) WorkArea[source]
Unarchive a work area.
Official documentation: locations/work_areas
- 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:
- async update(work_area_id: int | str, data: Mapping[str, Any], **kwargs) WorkArea[source]
Update a work area.
Official documentation: locations/work_areas
- Parameters:
work_area_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: