// 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 2` * - Filterable fields: `worker_id`, `leave_type_id`, `accrual_date` * - Expandable fields: `worker`, `grantor` * - Sortable fields: `id`, `created_at`, `updated_at`, `accrual_date`, * `expiration_date` */ list( query: LeaveAccrualListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/leave-accruals/', PageCursorURL, { query, ...options, }); } /** * Create a new leave accrual */ create(body: LeaveAccrualCreateParams, options?: RequestOptions): APIPromise { return this._client.post('/leave-accruals/', { body, ...options }); } /** * Retrieve a specific leave accrual */ 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'; /** * 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'; /** * 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'; /** * 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; 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'; /** * 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, }; }