// 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 2` * - Filterable fields: `policy_id` * - Expandable fields: `policy` * - Sortable fields: `id`, `created_at`, `updated_at` */ list( query: BreakTypeListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/break-types/', PageCursorURL, { query, ...options, }); } /** * Retrieve a specific break type */ 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; 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, }; }