/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { employeesCreate } from "../funcs/employeesCreate.js"; import { employeesCreateHistorical } from "../funcs/employeesCreateHistorical.js"; import { employeesDelete } from "../funcs/employeesDelete.js"; import { employeesGet } from "../funcs/employeesGet.js"; import { employeesGetCustomFields } from "../funcs/employeesGetCustomFields.js"; import { employeesGetOnboardingStatus } from "../funcs/employeesGetOnboardingStatus.js"; import { employeesGetTimeOffActivities } from "../funcs/employeesGetTimeOffActivities.js"; import { employeesGetV1CompaniesCompanyIdEmployeesPaymentDetails } from "../funcs/employeesGetV1CompaniesCompanyIdEmployeesPaymentDetails.js"; import { employeesList } from "../funcs/employeesList.js"; import { employeesUpdate } from "../funcs/employeesUpdate.js"; import { employeesUpdateOnboardingDocumentsConfig } from "../funcs/employeesUpdateOnboardingDocumentsConfig.js"; import { employeesUpdateOnboardingStatus } from "../funcs/employeesUpdateOnboardingStatus.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { DeleteV1EmployeeRequest, DeleteV1EmployeeResponse, } from "../models/operations/deletev1employee.js"; import { GetV1CompaniesCompanyIdEmployeesRequest, GetV1CompaniesCompanyIdEmployeesResponse, } from "../models/operations/getv1companiescompanyidemployees.js"; import { GetV1CompaniesCompanyIdEmployeesPaymentDetailsRequest, GetV1CompaniesCompanyIdEmployeesPaymentDetailsResponse, } from "../models/operations/getv1companiescompanyidemployeespaymentdetails.js"; import { GetV1EmployeesRequest, GetV1EmployeesResponse, } from "../models/operations/getv1employees.js"; import { GetV1EmployeesEmployeeIdCustomFieldsRequest, GetV1EmployeesEmployeeIdCustomFieldsResponse, } from "../models/operations/getv1employeesemployeeidcustomfields.js"; import { GetV1EmployeesEmployeeIdOnboardingStatusRequest, GetV1EmployeesEmployeeIdOnboardingStatusResponse, } from "../models/operations/getv1employeesemployeeidonboardingstatus.js"; import { GetVersionEmployeesTimeOffActivitiesRequest, GetVersionEmployeesTimeOffActivitiesResponse, } from "../models/operations/getversionemployeestimeoffactivities.js"; import { PostV1EmployeesRequest, PostV1EmployeesResponse, } from "../models/operations/postv1employees.js"; import { PostV1HistoricalEmployeesRequest, PostV1HistoricalEmployeesResponse, } from "../models/operations/postv1historicalemployees.js"; import { PutV1EmployeesRequest, PutV1EmployeesResponse, } from "../models/operations/putv1employees.js"; import { PutV1EmployeesEmployeeIdOnboardingDocumentsConfigRequest, PutV1EmployeesEmployeeIdOnboardingDocumentsConfigResponse, } from "../models/operations/putv1employeesemployeeidonboardingdocumentsconfig.js"; import { PutV1EmployeesEmployeeIdOnboardingStatusRequest, PutV1EmployeesEmployeeIdOnboardingStatusResponse, } from "../models/operations/putv1employeesemployeeidonboardingstatus.js"; import { unwrapAsync } from "../types/fp.js"; export class Employees extends ClientSDK { /** * Get employees of a company * * @remarks * Get all of the employees, onboarding, active and terminated, for a given company. * * Note: Compensation data (pay rate, payment unit, and related fields) represents sensitive employee pay information. When retrieving employee job data, these fields (`rate`, `payment_unit`, `current_compensation_uuid`, `compensations`) are only returned when the `compensations:read` scope is included. This allows you to access employee and job metadata without exposing pay rates. * * scope: `employees:read` */ async list( request: GetV1CompaniesCompanyIdEmployeesRequest, options?: RequestOptions, ): Promise { return unwrapAsync(employeesList( this, request, options, )); } /** * Create an employee * * @remarks * Create an employee. * * scope: `employees:manage` */ async create( request: PostV1EmployeesRequest, options?: RequestOptions, ): Promise { return unwrapAsync(employeesCreate( this, request, options, )); } /** * Get employee payment details for a company * * @remarks * Fetches payment details for employees in a given company. Results are paginated. * * Use the `employee_uuid` query parameter to filter for a single employee. * Use the `payroll_uuid` query parameter to filter for employees on a specific payroll. * Providing both `employee_uuid` and `payroll_uuid` will result in a 422 error. * An empty array is returned if the company has no employees or if no employees match the filter criteria. * * The `encrypted_account_number` in the `splits` array is only visible if the `employee_payment_methods:read:account_number` scope is present. * * scope: `employee_payment_methods:read` */ async getV1CompaniesCompanyIdEmployeesPaymentDetails( request: GetV1CompaniesCompanyIdEmployeesPaymentDetailsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(employeesGetV1CompaniesCompanyIdEmployeesPaymentDetails( this, request, options, )); } /** * Create a historical employee * * @remarks * Create a historical employee, an employee that was previously dismissed from the company in the current year. * * scope: `employees:manage` */ async createHistorical( request: PostV1HistoricalEmployeesRequest, options?: RequestOptions, ): Promise { return unwrapAsync(employeesCreateHistorical( this, request, options, )); } /** * Get an employee * * @remarks * Get an employee. * * Note: Compensation data (pay rate, payment unit, and related fields) represents sensitive employee pay information. When retrieving employee job data, these fields (`rate`, `payment_unit`, `current_compensation_uuid`, `compensations`) are only returned when the `compensations:read` scope is included. This allows you to access employee and job metadata without exposing pay rates. * * scope: `employees:read` */ async get( request: GetV1EmployeesRequest, options?: RequestOptions, ): Promise { return unwrapAsync(employeesGet( this, request, options, )); } /** * Update an employee. * * @remarks * Update an employee. * * scope: `employees:write` */ async update( request: PutV1EmployeesRequest, options?: RequestOptions, ): Promise { return unwrapAsync(employeesUpdate( this, request, options, )); } /** * Delete an onboarding employee * * @remarks * Use this endpoint to delete an employee who is in onboarding. Deleting * an onboarded employee is not allowed and will return a 422 response. Please check out the Terminations api * if you need to terminate an onboarded employee. * * scope: `employees:manage` */ async delete( request: DeleteV1EmployeeRequest, options?: RequestOptions, ): Promise { return unwrapAsync(employeesDelete( this, request, options, )); } /** * Get an employee's custom fields * * @remarks * Returns a list of the employee's custom fields. * * scope: `employees:read` */ async getCustomFields( request: GetV1EmployeesEmployeeIdCustomFieldsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(employeesGetCustomFields( this, request, options, )); } /** * Update employee onboarding documents config * * @remarks * Indicate whether to include the Form I-9 for an employee during the onboarding process. * If included, the employee will be prompted to complete Form I-9 as part of their onboarding. * * ## Related guides * - [Employee onboarding](doc:employee-onboarding) * * scope: `employees:manage` */ async updateOnboardingDocumentsConfig( request: PutV1EmployeesEmployeeIdOnboardingDocumentsConfigRequest, options?: RequestOptions, ): Promise { return unwrapAsync(employeesUpdateOnboardingDocumentsConfig( this, request, options, )); } /** * Get the employee's onboarding status * * @remarks * # Description * Retrieves an employee's onboarding status. The data returned helps inform the required onboarding steps and respective completion status. * * ## onboarding_status * * ### Admin-facilitated onboarding * | onboarding_status | Description | * |:------------------|------------:| * | `admin_onboarding_incomplete` | Admin needs to complete the full employee-onboarding. | * | `onboarding_completed` | Employee has been fully onboarded and verified. | * * ### Employee self-onboarding * | onboarding_status | Description | * |:------------------|------------:| * | `admin_onboarding_incomplete` | Admin needs to enter basic information about the employee. | * | `self_onboarding_pending_invite` | Admin has the intention to invite the employee to self-onboard (e.g., marking a checkbox), but the system has not yet sent the invitation. | * | `self_onboarding_invited` | Employee has been sent an invitation to self-onboard. | * | `self_onboarding_invited_started` | Employee has started the self-onboarding process. | * | `self_onboarding_invited_overdue` | Employee's start date has passed, and employee has still not completed self-onboarding. | * | `self_onboarding_completed_by_employee` | Employee has completed entering in their information. The status should be updated via API to "self_onboarding_awaiting_admin_review" from here, once the Admin has started reviewing. | * | `self_onboarding_awaiting_admin_review` | Admin has started to verify the employee's information. | * | `onboarding_completed` | Employee has been fully onboarded and verified. | * * ## onboarding_steps * * | onboarding_steps | Requirement(s) to be completed | * |:-----------------|-------------------------------:| * | `personal_details` | Add employee's first name, last name, email, date of birth, social security number | * | `compensation_details` | Associate employee to a job & compensation. | * | `add_work_address` | Add employee work address. | * | `add_home_address` | Add employee home address. | * | `federal_tax_setup` | Set up federal tax withholdings. | * | `state_tax_setup` | Set up state tax withholdings. | * | `direct_deposit_setup` | (optional) Set up employee's direct deposit. | * | `employee_form_signing` | Employee forms (e.g., W4, direct deposit authorization) are generated & signed. | * | `file_new_hire_report` | File a new hire report for this employee. | * | `admin_review` | Admin reviews & confirms employee details (only required for Employee self-onboarding) | * * scope: `employees:read` */ async getOnboardingStatus( request: GetV1EmployeesEmployeeIdOnboardingStatusRequest, options?: RequestOptions, ): Promise { return unwrapAsync(employeesGetOnboardingStatus( this, request, options, )); } /** * Update the employee's onboarding status * * @remarks * Updates an employee's onboarding status. * Below is a list of valid onboarding status changes depending on the intended action to be performed on behalf of the employee. * * | Action | current onboarding_status | new onboarding_status | * |:------------------|:------------:|----------:| * | Mark an employee as self-onboarding | `admin_onboarding_incomplete` | `self_onboarding_pending_invite` | * | Invite an employee to self-onboard | `admin_onboarding_incomplete` or `self_onboarding_pending_invite` | `self_onboarding_invited` | * | Cancel an employee's self-onboarding | `self_onboarding_invited` or `self_onboarding_pending_invite` | `admin_onboarding_incomplete` | * | Review an employee's self-onboarded info | `self_onboarding_completed_by_employee` | `self_onboarding_awaiting_admin_review` | * | Finish an employee's onboarding | `admin_onboarding_incomplete` or `self_onboarding_awaiting_admin_review` | `onboarding_completed` | * * scope: `employees:manage` */ async updateOnboardingStatus( request: PutV1EmployeesEmployeeIdOnboardingStatusRequest, options?: RequestOptions, ): Promise { return unwrapAsync(employeesUpdateOnboardingStatus( this, request, options, )); } /** * Get employee time off activities * * @remarks * Get employee time off activities. * * scope: `employee_time_off_activities:read` */ async getTimeOffActivities( request: GetVersionEmployeesTimeOffActivitiesRequest, options?: RequestOptions, ): Promise { return unwrapAsync(employeesGetTimeOffActivities( this, request, options, )); } }