// 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'; /** * Break types configured by the company for time tracking */ export class BreakTypes extends APIResource { /** * A list of break types. * * - Requires: `API Tier 1` * - Filterable fields: `policy_id` * - Expandable fields: `policy` * - Sortable fields: `id`, `created_at`, `updated_at` * * @example HTTP * Representative request and response shapes. * ``` * GET /break-types/?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", * "name": "string", * "is_paid": false, * "break_category": "MEAL", * "policy_id": "string", * "policy": { * "id": "string", * "created_at": "string", * "updated_at": "string", * "name": "string", * "country_code": "string", * "is_default": "string" * } * } * ], * "next_link": "string" * } * ``` */ list( query: BreakTypeListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/break-types/', PageCursorURL, { query, ...options, }); } /** * Retrieve a specific break type * * @example HTTP * Representative request and response shapes. * ``` * GET /break-types/{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: BreakTypeRetrieveParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get(path`/break-types/${id}/`, { query, ...options }); } } export type BreakTypeListResponsesPageCursorURL = PageCursorURL; export interface BreakTypeListResponse { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The display name of the break type. */ name: string; /** * Record update date */ updated_at: string; /** * The break category. One of: MEAL, REST, or OTHER. */ break_category?: 'MEAL' | 'REST' | 'OTHER'; /** * Whether this is a paid break (true) or unpaid (false). */ is_paid?: boolean; /** * The break policy this break type belongs to. Use ?expand=policy to inline the * full policy object. * * Expandable field */ policy?: BreakTypeListResponse.Policy; /** * The ID of the break policy this break type belongs to. */ policy_id?: string; } export namespace BreakTypeListResponse { /** * The break policy this break type belongs to. Use ?expand=policy to inline the * full policy object. * * Expandable field */ export interface Policy { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The display name of the break policy. For default policies this is the * system-generated label (e.g. 'Default Break policy: All Workers | California'); * for custom policies this is the admin-provided description. */ name: string; /** * Record update date */ updated_at: string; /** * ISO 3166-1 alpha-2 country code the policy applies to (e.g. 'US', 'CA', 'GB'). */ country_code?: string; /** * Whether this is a system-seeded default policy (true) or a custom policy created * by an admin (false). */ is_default?: boolean; } } /** * Meta information for the response. */ export interface BreakTypeRetrieveResponse extends BusinessPartnersAPI.Meta { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The display name of the break type. */ name: string; /** * Record update date */ updated_at: string; /** * The break category. One of: MEAL, REST, or OTHER. */ break_category?: 'MEAL' | 'REST' | 'OTHER'; /** * Whether this is a paid break (true) or unpaid (false). */ is_paid?: boolean; /** * The break policy this break type belongs to. Use ?expand=policy to inline the * full policy object. * * Expandable field */ policy?: BreakTypeRetrieveResponse.Policy; /** * The ID of the break policy this break type belongs to. */ policy_id?: string; } export namespace BreakTypeRetrieveResponse { /** * The break policy this break type belongs to. Use ?expand=policy to inline the * full policy object. * * Expandable field */ export interface Policy { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * The display name of the break policy. For default policies this is the * system-generated label (e.g. 'Default Break policy: All Workers | California'); * for custom policies this is the admin-provided description. */ name: string; /** * Record update date */ updated_at: string; /** * ISO 3166-1 alpha-2 country code the policy applies to (e.g. 'US', 'CA', 'GB'). */ country_code?: string; /** * Whether this is a system-seeded default policy (true) or a custom policy created * by an admin (false). */ is_default?: boolean; } } export interface BreakTypeListParams { 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 BreakTypeRetrieveParams { expand?: string; } export declare namespace BreakTypes { export { type BreakTypeListResponse as BreakTypeListResponse, type BreakTypeRetrieveResponse as BreakTypeRetrieveResponse, type BreakTypeListResponsesPageCursorURL as BreakTypeListResponsesPageCursorURL, type BreakTypeListParams as BreakTypeListParams, type BreakTypeRetrieveParams as BreakTypeRetrieveParams, }; }