// File generated from our OpenAPI spec by Stainless. See CONTRIBUTING.md for details. import { APIResource } from '../core/resource'; import * as BusinessPartnersAPI from './business-partners'; import * as WorkersAPI from './workers'; import { APIPromise } from '../core/api-promise'; import { PageCursorURL, PagePromise } from '../core/pagination'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; /** * Leave accruals for workers */ export class LeaveAccruals extends APIResource { /** * A list of leave accruals. * * - Requires: `API Tier 1` * - Filterable fields: `worker_id`, `leave_type_id`, `accrual_date` * - Expandable fields: `worker`, `grantor` * - Sortable fields: `id`, `created_at`, `updated_at`, `accrual_date`, * `expiration_date` * * @example HTTP * Representative request and response shapes. * ``` * GET /leave-accruals/?filter=filter&expand=expand&order_by=order_by&limit=50&cursor=cursor HTTP/1.1 * Host: rest.ripplingapis.com * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "__meta": { * "redacted_fields": [ * { * "name": "date_of_birth", * "reason": "Insufficient entitlements" * } * ] * }, * "results": [ * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "worker_id": "string", * "worker": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "user_id": "string", * "user": {}, * "is_manager": "string", * "manager_id": "string", * "manager": {}, * "legal_entity_id": "string", * "legal_entity": {}, * "country": "AF", * "start_date": "string", * "end_date": "string", * "number": "string", * "work_email": "string", * "personal_email": "string", * "status": "INIT", * "location": {}, * "employment_type_id": "string", * "employment_type": {}, * "gender": "MALE", * "date_of_birth": "string", * "race": "BLACK", * "ethnicity": "HISPANIC_OR_LATINO", * "citizenship": "AF", * "compensation_id": "string", * "compensation": {}, * "overtime_exemption": "EXEMPT", * "department_id": "string", * "department": {}, * "teams_id": [], * "teams": [], * "title": "string", * "title_effective_date": "string", * "level_id": "string", * "level": {}, * "job_function_id": "string", * "job_function": {}, * "termination_details": {}, * "pay_schedule_id": "string", * "work_schedule": {}, * "compensation_grade": {}, * "original_start_date": "string", * "custom_fields": [], * "country_fields": {}, * "business_partners_id": [], * "business_partners": [] * }, * "grantor_id": "string", * "grantor": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "user_id": "string", * "user": {}, * "is_manager": "string", * "manager_id": "string", * "manager": {}, * "legal_entity_id": "string", * "legal_entity": {}, * "country": "AF", * "start_date": "string", * "end_date": "string", * "number": "string", * "work_email": "string", * "personal_email": "string", * "status": "INIT", * "location": {}, * "employment_type_id": "string", * "employment_type": {}, * "gender": "MALE", * "date_of_birth": "string", * "race": "BLACK", * "ethnicity": "HISPANIC_OR_LATINO", * "citizenship": "AF", * "compensation_id": "string", * "compensation": {}, * "overtime_exemption": "EXEMPT", * "department_id": "string", * "department": {}, * "teams_id": [], * "teams": [], * "title": "string", * "title_effective_date": "string", * "level_id": "string", * "level": {}, * "job_function_id": "string", * "job_function": {}, * "termination_details": {}, * "pay_schedule_id": "string", * "work_schedule": {}, * "compensation_grade": {}, * "original_start_date": "string", * "custom_fields": [], * "country_fields": {}, * "business_partners_id": [], * "business_partners": [] * }, * "leave_type_id": "string", * "accrual_type": "AUTO", * "accrual_date": "string", * "num_hours": 0, * "num_days": 0, * "monetary_amount_accrued": 0, * "expiration_date": "string", * "comment": "string" * } * ], * "next_link": "string" * } * ``` */ list( query: LeaveAccrualListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/leave-accruals/', PageCursorURL, { query, ...options, }); } /** * Create a new leave accrual * * @example HTTP * Representative request and response shapes. * ``` * POST /leave-accruals/ HTTP/1.1 * Host: rest.ripplingapis.com * Content-Type: application/json * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * { * "accrual_date": "accrual_date", * "grantor_id": "grantor_id", * "leave_type_id": "leave_type_id", * "worker_id": "worker_id" * } * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "worker_id": "string", * "worker": { * "id": "string", * "created_at": "string", * "updated_at": "string" * }, * "grantor_id": "string", * "grantor": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "user_id": "string", * "user": { * "id": "string", * "created_at": "string", * "updated_at": "string" * }, * "is_manager": false, * "manager_id": "string", * "manager": { * "id": "string", * "created_at": "string", * "updated_at": "string" * }, * "legal_entity_id": "string", * "legal_entity": { * "id": "string", * "created_at": "string", * "updated_at": "string" * }, * "country": "AF", * "start_date": "string", * "end_date": "string", * "number": 0, * "work_email": "string", * "personal_email": "string", * "status": "INIT", * "location": { * "type": "REMOTE", * "work_location_id": "string" * }, * "employment_type_id": "string", * "employment_type": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "label": "string" * }, * "gender": "MALE", * "date_of_birth": "string", * "race": "BLACK", * "ethnicity": "HISPANIC_OR_LATINO", * "citizenship": "AF", * "compensation_id": "string", * "compensation": { * "id": "string", * "created_at": "string", * "updated_at": "string" * }, * "overtime_exemption": "EXEMPT", * "department_id": "string", * "department": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string" * }, * "teams_id": [ * "string" * ], * "teams": [ * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string" * } * ], * "title": "string", * "title_effective_date": "string", * "level_id": "string", * "level": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "parent_id": "string", * "parent": {}, * "global_level": "string", * "description": "string" * }, * "global_level": 0, * "description": "string", * "scope_of_responsibilities": "string", * "experience_requirements": "string", * "rank": 0, * "track_id": "string", * "track": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "is_default": "string", * "order": "string", * "start_global_level": "string" * } * }, * "job_function_id": "string", * "job_function": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string" * }, * "termination_details": { * "type": "VOLUNTARY", * "reason": "string" * }, * "pay_schedule_id": "string", * "work_schedule": {}, * "compensation_grade": { * "id": "string", * "label": "string" * }, * "original_start_date": "string", * "custom_fields": [ * null * ], * "country_fields": { * "us": { * "ssn": "string" * }, * "ca": { * "sin": "string" * }, * "nz": { * "ird_number": "string" * } * }, * "business_partners_id": [ * "string" * ], * "business_partners": [ * { * "id": "string", * "created_at": "string", * "updated_at": "string", * "business_partner_group_id": "string", * "business_partner_group": {}, * "worker_id": "string", * "worker": {}, * "client_group_id": "string", * "client_group": {}, * "client_group_member_count": "string" * } * ] * }, * "leave_type_id": "string", * "accrual_type": "AUTO", * "accrual_date": "string", * "num_hours": 0, * "num_days": 0, * "monetary_amount_accrued": 0, * "expiration_date": "string", * "comment": "string" * } * ``` */ create(body: LeaveAccrualCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/leave-accruals/', { body, ...options }); } /** * Retrieve a specific leave accrual * * @example HTTP * Representative request and response shapes. * ``` * GET /leave-accruals/{id}/?expand=expand HTTP/1.1 * Host: rest.ripplingapis.com * Accept: application/json * Rippling-Api-Version: 2024-08-01 * * HTTP/1.1 200 OK * Content-Type: application/json * * { * "__meta": { * "redacted_fields": [ * {} * ] * } * } * ``` */ retrieve( id: string, query: LeaveAccrualRetrieveParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get(path`/leave-accruals/${id}/`, { query, ...options }); } } export type LeaveAccrualListResponsesPageCursorURL = PageCursorURL; /** * Leave accrual resource representing time off credits granted to employees. * * Leave accruals track the allocation of paid time off (vacation, sick days, etc.) * to employees based on company policies, manual grants, or other accrual sources. */ export interface LeaveAccrualListResponse { /** * Identifier field */ id: string; /** * The date when this accrual becomes effective */ accrual_date: string; /** * Record creation date */ created_at: string; /** * The ID of the worker who granted this accrual. This is typically the Time Off * admin. */ grantor_id: string; /** * The company leave type ID associated with this accrual */ leave_type_id: string; /** * Record update date */ updated_at: string; /** * The ID of the worker for whom the accrual is for */ worker_id: string; /** * The type of accrual */ accrual_type?: | 'AUTO' | 'CARRYOVER_PENALTY' | 'RESET_PENALTY' | 'RESET_NEGATIVE_PENALTY' | 'BALANCE_PENALTY' | 'LEAVE_GRANT' | 'BALANCE_CORRECTION_ADJUSTMENT' | 'PAID_OUT' | 'SUB_BALANCE_EXPIRATION' | 'TANDA_ACCRUAL_BONUS' | 'TILT_ADJUSTMENT' | 'WORKFLOW_ACTION' | 'EXPIRATION_DEDUCTION' | 'EXPIRATION_PAYOUT' | 'MANUAL_BALANCE_PAYOUT' | 'CARRYOVER_PENALTY_PAYOUT' | 'RESET_PENALTY_PAYOUT' | 'HOLIDAY_ADJUSTMENT' | 'HOURS_WORKED_TANDA' | 'TENURE_MILESTONE' | 'FR_COP_FRACTIONNEMENT'; /** * The comment for this accrual. This is required if the leave policy requires a * comment on accruals. */ comment?: string; /** * The date when this accrual expires (if applicable) */ expiration_date?: string; /** * The worker who granted this accrual. This is typically the Time Off admin. * * Expandable field */ grantor?: WorkersAPI.Worker; /** * The monetary value of this accrual (for policies with monetary tracking) */ monetary_amount_accrued?: number; /** * The number of days accrued. It can be negative for deductions. This is * applicable if the policy tracks in days. */ num_days?: number; /** * The number of hours accrued. It can be negative for deductions. This is * applicable if the policy tracks in hours. */ num_hours?: number; /** * The worker for whom the accrual is for * * Expandable field */ worker?: WorkersAPI.Worker; } /** * Leave accrual resource representing time off credits granted to employees. * * Leave accruals track the allocation of paid time off (vacation, sick days, etc.) * to employees based on company policies, manual grants, or other accrual sources. */ export interface LeaveAccrualCreateResponse { /** * Identifier field */ id: string; /** * The date when this accrual becomes effective */ accrual_date: string; /** * Record creation date */ created_at: string; /** * The ID of the worker who granted this accrual. This is typically the Time Off * admin. */ grantor_id: string; /** * The company leave type ID associated with this accrual */ leave_type_id: string; /** * Record update date */ updated_at: string; /** * The ID of the worker for whom the accrual is for */ worker_id: string; /** * The type of accrual */ accrual_type?: | 'AUTO' | 'CARRYOVER_PENALTY' | 'RESET_PENALTY' | 'RESET_NEGATIVE_PENALTY' | 'BALANCE_PENALTY' | 'LEAVE_GRANT' | 'BALANCE_CORRECTION_ADJUSTMENT' | 'PAID_OUT' | 'SUB_BALANCE_EXPIRATION' | 'TANDA_ACCRUAL_BONUS' | 'TILT_ADJUSTMENT' | 'WORKFLOW_ACTION' | 'EXPIRATION_DEDUCTION' | 'EXPIRATION_PAYOUT' | 'MANUAL_BALANCE_PAYOUT' | 'CARRYOVER_PENALTY_PAYOUT' | 'RESET_PENALTY_PAYOUT' | 'HOLIDAY_ADJUSTMENT' | 'HOURS_WORKED_TANDA' | 'TENURE_MILESTONE' | 'FR_COP_FRACTIONNEMENT'; /** * The comment for this accrual. This is required if the leave policy requires a * comment on accruals. */ comment?: string; /** * The date when this accrual expires (if applicable) */ expiration_date?: string; /** * The worker who granted this accrual. This is typically the Time Off admin. * * Expandable field */ grantor?: WorkersAPI.Worker; /** * The monetary value of this accrual (for policies with monetary tracking) */ monetary_amount_accrued?: number; /** * The number of days accrued. It can be negative for deductions. This is * applicable if the policy tracks in days. */ num_days?: number; /** * The number of hours accrued. It can be negative for deductions. This is * applicable if the policy tracks in hours. */ num_hours?: number; /** * The worker for whom the accrual is for * * Expandable field */ worker?: WorkersAPI.Worker; } /** * Meta information for the response. */ export interface LeaveAccrualRetrieveResponse extends BusinessPartnersAPI.Meta { /** * Identifier field */ id: string; /** * The date when this accrual becomes effective */ accrual_date: string; /** * Record creation date */ created_at: string; /** * The ID of the worker who granted this accrual. This is typically the Time Off * admin. */ grantor_id: string; /** * The company leave type ID associated with this accrual */ leave_type_id: string; /** * Record update date */ updated_at: string; /** * The ID of the worker for whom the accrual is for */ worker_id: string; /** * The type of accrual */ accrual_type?: | 'AUTO' | 'CARRYOVER_PENALTY' | 'RESET_PENALTY' | 'RESET_NEGATIVE_PENALTY' | 'BALANCE_PENALTY' | 'LEAVE_GRANT' | 'BALANCE_CORRECTION_ADJUSTMENT' | 'PAID_OUT' | 'SUB_BALANCE_EXPIRATION' | 'TANDA_ACCRUAL_BONUS' | 'TILT_ADJUSTMENT' | 'WORKFLOW_ACTION' | 'EXPIRATION_DEDUCTION' | 'EXPIRATION_PAYOUT' | 'MANUAL_BALANCE_PAYOUT' | 'CARRYOVER_PENALTY_PAYOUT' | 'RESET_PENALTY_PAYOUT' | 'HOLIDAY_ADJUSTMENT' | 'HOURS_WORKED_TANDA' | 'TENURE_MILESTONE' | 'FR_COP_FRACTIONNEMENT'; /** * The comment for this accrual. This is required if the leave policy requires a * comment on accruals. */ comment?: string; /** * The date when this accrual expires (if applicable) */ expiration_date?: string; /** * The worker who granted this accrual. This is typically the Time Off admin. * * Expandable field */ grantor?: WorkersAPI.Worker; /** * The monetary value of this accrual (for policies with monetary tracking) */ monetary_amount_accrued?: number; /** * The number of days accrued. It can be negative for deductions. This is * applicable if the policy tracks in days. */ num_days?: number; /** * The number of hours accrued. It can be negative for deductions. This is * applicable if the policy tracks in hours. */ num_hours?: number; /** * The worker for whom the accrual is for * * Expandable field */ worker?: WorkersAPI.Worker; } export interface LeaveAccrualListParams { cursor?: string; expand?: string; filter?: string; /** * The maximum number of results to return. Defaults to 50. Maximum is 100. */ limit?: number; order_by?: string; } export interface LeaveAccrualCreateParams { /** * The date when this accrual becomes effective */ accrual_date: string; /** * The ID of the worker who granted this accrual. This is typically the Time Off * admin. */ grantor_id: string; /** * The company leave type ID associated with this accrual */ leave_type_id: string; /** * The ID of the worker for whom the accrual is for */ worker_id: string; /** * The type of accrual */ accrual_type?: | 'AUTO' | 'CARRYOVER_PENALTY' | 'RESET_PENALTY' | 'RESET_NEGATIVE_PENALTY' | 'BALANCE_PENALTY' | 'LEAVE_GRANT' | 'BALANCE_CORRECTION_ADJUSTMENT' | 'PAID_OUT' | 'SUB_BALANCE_EXPIRATION' | 'TANDA_ACCRUAL_BONUS' | 'TILT_ADJUSTMENT' | 'WORKFLOW_ACTION' | 'EXPIRATION_DEDUCTION' | 'EXPIRATION_PAYOUT' | 'MANUAL_BALANCE_PAYOUT' | 'CARRYOVER_PENALTY_PAYOUT' | 'RESET_PENALTY_PAYOUT' | 'HOLIDAY_ADJUSTMENT' | 'HOURS_WORKED_TANDA' | 'TENURE_MILESTONE' | 'FR_COP_FRACTIONNEMENT'; /** * The comment for this accrual. This is required if the leave policy requires a * comment on accruals. */ comment?: string; /** * The date when this accrual expires (if applicable) */ expiration_date?: string; /** * The monetary value of this accrual (for policies with monetary tracking) */ monetary_amount_accrued?: number; /** * The number of days accrued. It can be negative for deductions. This is * applicable if the policy tracks in days. */ num_days?: number; /** * The number of hours accrued. It can be negative for deductions. This is * applicable if the policy tracks in hours. */ num_hours?: number; } export interface LeaveAccrualRetrieveParams { expand?: string; } export declare namespace LeaveAccruals { export { type LeaveAccrualListResponse as LeaveAccrualListResponse, type LeaveAccrualCreateResponse as LeaveAccrualCreateResponse, type LeaveAccrualRetrieveResponse as LeaveAccrualRetrieveResponse, type LeaveAccrualListResponsesPageCursorURL as LeaveAccrualListResponsesPageCursorURL, type LeaveAccrualListParams as LeaveAccrualListParams, type LeaveAccrualCreateParams as LeaveAccrualCreateParams, type LeaveAccrualRetrieveParams as LeaveAccrualRetrieveParams, }; }