// 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'; /** * Time entries submitted by workers */ export class TimeCards extends APIResource { /** * A list of time cards. * * - Requires: `API Tier 2` * - Filterable fields: `pay_period.start_date`, `worker_id` * - Expandable fields: `worker` * - Sortable fields: `id`, `created_at`, `updated_at` */ list( query: TimeCardListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/time-cards/', PageCursorURL, { query, ...options }); } /** * Retrieve a specific time card */ retrieve( id: string, query: TimeCardRetrieveParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get(path`/time-cards/${id}/`, { query, ...options }); } } export type TimeCardsPageCursorURL = PageCursorURL; export interface PayPeriod { /** * The end date of the pay period. */ end_date?: string; /** * The ID of the pay schedule associated with the pay period. */ pay_schedule_id?: string; /** * The start date of the pay period. */ start_date?: string; } export interface TimeCard { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * The ID of the worker associated with the time card. */ worker_id: string; /** * The pay period associated with the time card. */ pay_period?: PayPeriod; /** * The summary of the time card. */ summary?: TimeCard.Summary; /** * The worker associated with the time card. * * Expandable field */ worker?: WorkersAPI.Worker; } export namespace TimeCard { /** * The summary of the time card. */ export interface Summary { /** * The approved hours for the pay period. */ approved_hours?: number; /** * The total number of doubletime hours worked during the pay period. */ double_overtime_hours?: number; /** * The earnings for the pay period. */ earnings?: number; /** * The amount of hours worked for each job code for the pay period. */ hours_worked_by_job_code?: Array; /** * The total number of overtime hours worked during the pay period. */ overtime_hours?: number; /** * The paid hours for the pay period. */ paid_hours?: number; /** * The premiums for the pay period. */ premiums?: number; /** * The total number of regular hours worked during the pay period. */ regular_hours?: number; /** * The total holiday hours for the pay period. */ total_holiday_hours?: number; /** * The total hours for the pay period. */ total_hours?: number; /** * The total paid time off hours for the pay period. */ total_paid_time_off_hours?: number; /** * The total unpaid time off hours for the pay period. */ total_unpaid_time_off_hours?: number; /** * The map of time entry to unpaidBreakHours in seconds */ unpaid_break_hours_by_entry?: number; } export namespace Summary { export interface HoursWorkedByJobCode { /** * The total hours worked for the job codes. */ hours_worked?: number; /** * List of job code ids that this summary is tracking hours for. */ job_codes_id?: Array; } } } /** * Meta information for the response. */ export interface TimeCardRetrieveResponse extends BusinessPartnersAPI.Meta, TimeCard {} export interface TimeCardListParams { cursor?: string; expand?: string; filter?: string; order_by?: string; } export interface TimeCardRetrieveParams { expand?: string; } export declare namespace TimeCards { export { type PayPeriod as PayPeriod, type TimeCard as TimeCard, type TimeCardRetrieveResponse as TimeCardRetrieveResponse, type TimeCardsPageCursorURL as TimeCardsPageCursorURL, type TimeCardListParams as TimeCardListParams, type TimeCardRetrieveParams as TimeCardRetrieveParams, }; }