// 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 { APIPromise } from '../core/api-promise'; import { PageCursorURL, PagePromise } from '../core/pagination'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; /** * Leave types used by the company */ export class LeaveTypes extends APIResource { /** * A list of leave types. * * - Requires: `API Tier 1` * - Filterable fields: `name` * - Sortable fields: `id`, `created_at`, `updated_at` * * @example HTTP * Representative request and response shapes. * ``` * GET /leave-types/?filter=filter&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", * "type": "string", * "name": "string", * "description": "string", * "is_paid": false, * "is_managed_by_external_system": false * } * ], * "next_link": "string" * } * ``` */ list( query: LeaveTypeListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/leave-types/', PageCursorURL, { query, ...options }); } /** * Retrieve a specific leave type * * @example HTTP * Representative request and response shapes. * ``` * GET /leave-types/{id}/ 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, options?: RequestOptions): APIPromise { return this._client.get(path`/leave-types/${id}/`, options); } } export type LeaveTypesPageCursorURL = PageCursorURL; export interface LeaveType { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Whether the leave is managed by an external system. */ is_managed_by_external_system: boolean; /** * Whether the leave is paid. */ is_paid: boolean; /** * The name of the leave type. */ name: string; /** * The type of leave. */ type: string; /** * Record update date */ updated_at: string; /** * The description of the leave type. */ description?: string; } /** * Meta information for the response. */ export interface LeaveTypeRetrieveResponse extends BusinessPartnersAPI.Meta, LeaveType {} export interface LeaveTypeListParams { cursor?: string; filter?: string; /** * The maximum number of results to return. Defaults to 50. Maximum is 100. */ limit?: number; order_by?: string; } export declare namespace LeaveTypes { export { type LeaveType as LeaveType, type LeaveTypeRetrieveResponse as LeaveTypeRetrieveResponse, type LeaveTypesPageCursorURL as LeaveTypesPageCursorURL, type LeaveTypeListParams as LeaveTypeListParams, }; }