// 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 CompensationsAPI from './compensations'; import * as DepartmentsAPI from './departments'; import * as EmploymentTypesAPI from './employment-types'; import * as LegalEntitiesAPI from './legal-entities'; import * as LevelsAPI from './levels'; import * as TeamsAPI from './teams'; import * as UsersAPI from './users'; import { APIPromise } from '../core/api-promise'; import { PageCursorURL, PagePromise } from '../core/pagination'; import { RequestOptions } from '../internal/request-options'; import { path } from '../internal/utils/path'; /** * Workers who work or have worked at the company */ export class Workers extends APIResource { /** * A list of workers. * * - Requires: `API Tier 1` * - Filterable fields: `status`, `work_email`, `user_id`, `created_at`, * `updated_at` * - Expandable fields: `user`, `manager`, `legal_entity`, `employment_type`, * `compensation`, `department`, `teams`, `level`, `custom_fields`, * `business_partners` * - Sortable fields: `id`, `created_at`, `updated_at` */ list( query: WorkerListParams | null | undefined = {}, options?: RequestOptions, ): PagePromise { return this._client.getAPIList('/workers/', PageCursorURL, { query, ...options }); } /** * Retrieve a specific worker */ retrieve( id: string, query: WorkerRetrieveParams | null | undefined = {}, options?: RequestOptions, ): APIPromise { return this._client.get(path`/workers/${id}/`, { query, ...options }); } } export type WorkersPageCursorURL = PageCursorURL; export interface Worker { /** * Identifier field */ id: string; /** * Record creation date */ created_at: string; /** * Record update date */ updated_at: string; /** * Worker's assigned business partners. This field is only populated when * explicitly requested via the expand parameter (e.g., ?expand=business_partners). * When expanded, returns an empty list ([]) if the worker has no business * partners. * * Expandable field */ business_partners?: Array; /** * Worker's assigned business partners unique identifiers. Returns an empty list * ([]) if the worker has no business partners. */ business_partners_id?: Array; /** * The countries that the worker has citizenship in. */ citizenship?: | 'AF' | 'AX' | 'AL' | 'DZ' | 'AS' | 'AD' | 'AO' | 'AI' | 'AQ' | 'AG' | 'AR' | 'AM' | 'AW' | 'AU' | 'AT' | 'AZ' | 'BS' | 'BH' | 'BD' | 'BB' | 'BY' | 'BE' | 'BZ' | 'BJ' | 'BM' | 'BT' | 'BO' | 'BQ' | 'BA' | 'BW' | 'BV' | 'BR' | 'IO' | 'BN' | 'BG' | 'BF' | 'BI' | 'CV' | 'KH' | 'CM' | 'CA' | 'KY' | 'CF' | 'TD' | 'CL' | 'CN' | 'CX' | 'CC' | 'CO' | 'KM' | 'CG' | 'CD' | 'CK' | 'CR' | 'CI' | 'HR' | 'CW' | 'CY' | 'CZ' | 'DK' | 'DJ' | 'DM' | 'DO' | 'EC' | 'EG' | 'SV' | 'GQ' | 'ER' | 'EE' | 'SZ' | 'ET' | 'FK' | 'FO' | 'FJ' | 'FI' | 'FR' | 'GF' | 'PF' | 'TF' | 'GA' | 'GM' | 'GE' | 'DE' | 'GH' | 'GI' | 'GR' | 'GL' | 'GD' | 'GP' | 'GU' | 'GT' | 'GG' | 'GN' | 'GW' | 'GY' | 'HT' | 'HM' | 'VA' | 'HN' | 'HK' | 'HU' | 'IS' | 'IN' | 'ID' | 'IQ' | 'IR' | 'IE' | 'IM' | 'IL' | 'IT' | 'JM' | 'JP' | 'JE' | 'JO' | 'KZ' | 'KE' | 'KI' | 'KR' | 'XK' | 'KW' | 'KG' | 'LA' | 'LV' | 'LB' | 'LS' | 'LR' | 'LY' | 'LI' | 'LT' | 'LU' | 'MO' | 'MG' | 'MW' | 'MY' | 'MV' | 'ML' | 'MT' | 'MH' | 'MQ' | 'MR' | 'MU' | 'YT' | 'MX' | 'FM' | 'MD' | 'MC' | 'MN' | 'ME' | 'MS' | 'MA' | 'MZ' | 'MM' | 'NA' | 'NR' | 'NP' | 'NL' | 'AN' | 'NC' | 'NZ' | 'NI' | 'NE' | 'NG' | 'NU' | 'NF' | 'MK' | 'MP' | 'NO' | 'OM' | 'PK' | 'PW' | 'PS' | 'PA' | 'PG' | 'PY' | 'PE' | 'PH' | 'PN' | 'PL' | 'PT' | 'PR' | 'QA' | 'RO' | 'RU' | 'RW' | 'RE' | 'BL' | 'SH' | 'KN' | 'LC' | 'MF' | 'PM' | 'VC' | 'WS' | 'SM' | 'ST' | 'SA' | 'SN' | 'RS' | 'SC' | 'SL' | 'SG' | 'SX' | 'SY' | 'SK' | 'SI' | 'SB' | 'SO' | 'ZA' | 'GS' | 'SS' | 'ES' | 'LK' | 'SD' | 'SR' | 'SJ' | 'SE' | 'CH' | 'TW' | 'TJ' | 'TZ' | 'TH' | 'TL' | 'TG' | 'TK' | 'TO' | 'TT' | 'TN' | 'TR' | 'TM' | 'TC' | 'TV' | 'UG' | 'UA' | 'AE' | 'GB' | 'US' | 'UM' | 'UY' | 'UZ' | 'VU' | 'VE' | 'VN' | 'VG' | 'VI' | 'WF' | 'EH' | 'YE' | 'ZM' | 'ZW'; /** * The compensation package for the worker. * * Expandable field */ compensation?: CompensationsAPI.Compensation; /** * The compensation package for the worker. */ compensation_id?: string; /** * The worker's country. */ country?: | 'AF' | 'AX' | 'AL' | 'DZ' | 'AS' | 'AD' | 'AO' | 'AI' | 'AQ' | 'AG' | 'AR' | 'AM' | 'AW' | 'AU' | 'AT' | 'AZ' | 'BS' | 'BH' | 'BD' | 'BB' | 'BY' | 'BE' | 'BZ' | 'BJ' | 'BM' | 'BT' | 'BO' | 'BQ' | 'BA' | 'BW' | 'BV' | 'BR' | 'IO' | 'BN' | 'BG' | 'BF' | 'BI' | 'CV' | 'KH' | 'CM' | 'CA' | 'KY' | 'CF' | 'TD' | 'CL' | 'CN' | 'CX' | 'CC' | 'CO' | 'KM' | 'CG' | 'CD' | 'CK' | 'CR' | 'CI' | 'HR' | 'CW' | 'CY' | 'CZ' | 'DK' | 'DJ' | 'DM' | 'DO' | 'EC' | 'EG' | 'SV' | 'GQ' | 'ER' | 'EE' | 'SZ' | 'ET' | 'FK' | 'FO' | 'FJ' | 'FI' | 'FR' | 'GF' | 'PF' | 'TF' | 'GA' | 'GM' | 'GE' | 'DE' | 'GH' | 'GI' | 'GR' | 'GL' | 'GD' | 'GP' | 'GU' | 'GT' | 'GG' | 'GN' | 'GW' | 'GY' | 'HT' | 'HM' | 'VA' | 'HN' | 'HK' | 'HU' | 'IS' | 'IN' | 'ID' | 'IQ' | 'IR' | 'IE' | 'IM' | 'IL' | 'IT' | 'JM' | 'JP' | 'JE' | 'JO' | 'KZ' | 'KE' | 'KI' | 'KR' | 'XK' | 'KW' | 'KG' | 'LA' | 'LV' | 'LB' | 'LS' | 'LR' | 'LY' | 'LI' | 'LT' | 'LU' | 'MO' | 'MG' | 'MW' | 'MY' | 'MV' | 'ML' | 'MT' | 'MH' | 'MQ' | 'MR' | 'MU' | 'YT' | 'MX' | 'FM' | 'MD' | 'MC' | 'MN' | 'ME' | 'MS' | 'MA' | 'MZ' | 'MM' | 'NA' | 'NR' | 'NP' | 'NL' | 'AN' | 'NC' | 'NZ' | 'NI' | 'NE' | 'NG' | 'NU' | 'NF' | 'MK' | 'MP' | 'NO' | 'OM' | 'PK' | 'PW' | 'PS' | 'PA' | 'PG' | 'PY' | 'PE' | 'PH' | 'PN' | 'PL' | 'PT' | 'PR' | 'QA' | 'RO' | 'RU' | 'RW' | 'RE' | 'BL' | 'SH' | 'KN' | 'LC' | 'MF' | 'PM' | 'VC' | 'WS' | 'SM' | 'ST' | 'SA' | 'SN' | 'RS' | 'SC' | 'SL' | 'SG' | 'SX' | 'SY' | 'SK' | 'SI' | 'SB' | 'SO' | 'ZA' | 'GS' | 'SS' | 'ES' | 'LK' | 'SD' | 'SR' | 'SJ' | 'SE' | 'CH' | 'TW' | 'TJ' | 'TZ' | 'TH' | 'TL' | 'TG' | 'TK' | 'TO' | 'TT' | 'TN' | 'TR' | 'TM' | 'TC' | 'TV' | 'UG' | 'UA' | 'AE' | 'GB' | 'US' | 'UM' | 'UY' | 'UZ' | 'VU' | 'VE' | 'VN' | 'VG' | 'VI' | 'WF' | 'EH' | 'YE' | 'ZM' | 'ZW'; /** * Country level fields for the worker. */ country_fields?: Worker.CountryFields; /** * Custom field values defined on the Employee object for this worker * * Expandable field */ custom_fields?: Array; /** * The worker's date of birth. */ date_of_birth?: string; /** * The worker's assigned department. * * Expandable field */ department?: DepartmentsAPI.Department; /** * The worker's assigned department. */ department_id?: string; /** * The worker's employment type. * * Expandable field */ employment_type?: EmploymentTypesAPI.CompanyEmploymentType; /** * The worker's employment type. */ employment_type_id?: string; /** * The end date of the worker. */ end_date?: string; /** * The identified ethnicity of the worker, if specified. */ ethnicity?: | 'HISPANIC_OR_LATINO' | 'WHITE' | 'BLACK_OR_AFRICAN_AMERICAN' | 'NATIVE_HAWAIIAN_OR_OTHER_PACIFIC_ISLANDER' | 'ASIAN' | 'AMERICAN_INDIAN_OR_ALASKA_NATIVE' | 'TWO_OR_MORE_RACES' | 'MIDDLE_EASTERN_OR_NORTH_AFRICAN' | 'DECLINE_TO_SELF_IDENTIFY' | 'AFRICAN' | 'COLOURED' | 'INDIAN' | 'OTHER' | 'PREFER_NOT_TO_SAY'; /** * The gender of the worker, if specified. */ gender?: | 'MALE' | 'FEMALE' | 'NONBINARY' | 'UNDETERMINED' | 'DIVERSE' | 'DOES_NOT_APPLY' | 'PREFER_NOT_TO_SAY'; /** * Whether the worker is a manager */ is_manager?: boolean; /** * The worker's associated legal entity. * * Expandable field */ legal_entity?: LegalEntitiesAPI.LegalEntity; /** * The worker's associated legal entity. */ legal_entity_id?: string; /** * The level of the worker. * * Expandable field */ level?: LevelsAPI.Level; /** * The level of the worker. */ level_id?: string; /** * The location that the worker is mapped to for tax purposes. In the case that a * worker is remote, the location's type is remote. */ location?: Worker.Location; /** * The worker's manager. * * Expandable field */ manager?: Worker; /** * The worker's manager. */ manager_id?: string; /** * The worker's number within the organization. */ number?: number; /** * The worker's overtime exemption status. */ overtime_exemption?: 'EXEMPT' | 'NON_EXEMPT'; /** * The worker's associated personal email address. */ personal_email?: string; /** * The identified race of the worker, if specified. */ race?: | 'BLACK' | 'BROWN' | 'CHINESE' | 'EURASIAN' | 'INDIAN' | 'INDIGENOUS' | 'MALAY' | 'WHITE' | 'YELLOW' | 'NOT_INFORMED' | 'OTHER'; /** * The start date of the worker. */ start_date?: string; /** * The worker's status within the organization. */ status?: 'INIT' | 'HIRED' | 'ACCEPTED' | 'ACTIVE' | 'TERMINATED'; /** * The worker's assigned teams. * * Expandable field */ teams?: Array; /** * The worker's assigned teams. */ teams_id?: Array; /** * The details of the worker's termination, if applicable. */ termination_details?: Worker.TerminationDetails; /** * The worker's title. */ title?: string; /** * Title effective date */ title_effective_date?: string; /** * The worker's associated user. * * Expandable field */ user?: UsersAPI.User; /** * The worker's associated user. */ user_id?: string; /** * The worker's associated work email address. */ work_email?: string; } export namespace Worker { /** * Country level fields for the worker. */ export interface CountryFields { /** * Country-wise regional fields for Canada */ ca?: CountryFields.Ca; /** * Country-wise regional fields for USA */ us?: CountryFields.Us; } export namespace CountryFields { /** * Country-wise regional fields for Canada */ export interface Ca { /** * Social Insurance Number (SIN) for Canada employees. */ sin?: string; } /** * Country-wise regional fields for USA */ export interface Us { /** * Social Security Number (SSN) for US employees. */ ssn?: string; } } /** * The location that the worker is mapped to for tax purposes. In the case that a * worker is remote, the location's type is remote. */ export interface Location { /** * The type of location. */ type: 'REMOTE' | 'WORK'; /** * The work location, if the worker isn't remote. */ work_location_id: string; } /** * The details of the worker's termination, if applicable. */ export interface TerminationDetails { /** * This is a description that will be custom to each Rippling company. */ reason?: string; /** * The termination type indicates whether the termination was voluntary or * involuntary. */ type?: | 'VOLUNTARY' | 'INVOLUNTARY' | 'RETIREMENT' | 'DEATH' | 'ABANDONMENT' | 'OFFER_DECLINED' | 'RESCIND' | 'RENEGE'; } } /** * Meta information for the response. */ export interface WorkerRetrieveResponse extends BusinessPartnersAPI.Meta, Worker {} export interface WorkerListParams { cursor?: string; expand?: string; filter?: string; order_by?: string; } export interface WorkerRetrieveParams { expand?: string; } export declare namespace Workers { export { type Worker as Worker, type WorkerRetrieveResponse as WorkerRetrieveResponse, type WorkersPageCursorURL as WorkersPageCursorURL, type WorkerListParams as WorkerListParams, type WorkerRetrieveParams as WorkerRetrieveParams, }; }