/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { jobsAndCompensationsCreateCompensation } from "../funcs/jobsAndCompensationsCreateCompensation.js"; import { jobsAndCompensationsCreateJob } from "../funcs/jobsAndCompensationsCreateJob.js"; import { jobsAndCompensationsDelete } from "../funcs/jobsAndCompensationsDelete.js"; import { jobsAndCompensationsDeleteCompensation } from "../funcs/jobsAndCompensationsDeleteCompensation.js"; import { jobsAndCompensationsGetCompensation } from "../funcs/jobsAndCompensationsGetCompensation.js"; import { jobsAndCompensationsGetCompensations } from "../funcs/jobsAndCompensationsGetCompensations.js"; import { jobsAndCompensationsGetJob } from "../funcs/jobsAndCompensationsGetJob.js"; import { jobsAndCompensationsGetJobs } from "../funcs/jobsAndCompensationsGetJobs.js"; import { jobsAndCompensationsUpdate } from "../funcs/jobsAndCompensationsUpdate.js"; import { jobsAndCompensationsUpdateCompensation } from "../funcs/jobsAndCompensationsUpdateCompensation.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { DeleteV1CompensationsCompensationIdRequest, DeleteV1CompensationsCompensationIdResponse, } from "../models/operations/deletev1compensationscompensationid.js"; import { DeleteV1JobsJobIdRequest, DeleteV1JobsJobIdResponse, } from "../models/operations/deletev1jobsjobid.js"; import { GetV1CompensationsCompensationIdRequest, GetV1CompensationsCompensationIdResponse, } from "../models/operations/getv1compensationscompensationid.js"; import { GetV1EmployeesEmployeeIdJobsRequest, GetV1EmployeesEmployeeIdJobsResponse, } from "../models/operations/getv1employeesemployeeidjobs.js"; import { GetV1JobsJobIdRequest, GetV1JobsJobIdResponse, } from "../models/operations/getv1jobsjobid.js"; import { GetV1JobsJobIdCompensationsRequest, GetV1JobsJobIdCompensationsResponse, } from "../models/operations/getv1jobsjobidcompensations.js"; import { PostV1CompensationsCompensationIdRequest, PostV1CompensationsCompensationIdResponse, } from "../models/operations/postv1compensationscompensationid.js"; import { PostV1EmployeesEmployeeIdJobsRequest, PostV1EmployeesEmployeeIdJobsResponse, } from "../models/operations/postv1employeesemployeeidjobs.js"; import { PutV1CompensationsCompensationIdRequest, PutV1CompensationsCompensationIdResponse, } from "../models/operations/putv1compensationscompensationid.js"; import { PutV1JobsJobIdRequest, PutV1JobsJobIdResponse, } from "../models/operations/putv1jobsjobid.js"; import { unwrapAsync } from "../types/fp.js"; export class JobsAndCompensations extends ClientSDK { /** * Get jobs for an employee * * @remarks * Get all of the jobs that an employee holds. * 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. * * Compensation data in the response requires the `compensations:read` scope. * * scope: `jobs:read` */ async getJobs( request: GetV1EmployeesEmployeeIdJobsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(jobsAndCompensationsGetJobs( this, request, options, )); } /** * Create a job * * @remarks * Create a job. * * scope: `jobs:write` */ async createJob( request: PostV1EmployeesEmployeeIdJobsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(jobsAndCompensationsCreateJob( this, request, options, )); } /** * Get a job * * @remarks * Get a job. * * 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. * * Compensation data in the response requires the `compensations:read` scope. * * scope: `jobs:read` */ async getJob( request: GetV1JobsJobIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(jobsAndCompensationsGetJob( this, request, options, )); } /** * Update a job * * @remarks * Update a job. * * scope: `jobs:write` */ async update( request: PutV1JobsJobIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(jobsAndCompensationsUpdate( this, request, options, )); } /** * Delete an individual job * * @remarks * Deletes a specific job that an employee holds. * * scope: `jobs:write` */ async delete( request: DeleteV1JobsJobIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(jobsAndCompensationsDelete( this, request, options, )); } /** * Get compensations for a job * * @remarks * Compensations contain information on how much is paid out for a job. Jobs may have many compensations, but only one that is active. The current compensation is the one with the most recent `effective_date`. * * *Note: Currently the API does not support creating multiple compensations per job - creating a compensation with the same job_uuid as another will fail with a relevant error.* * * Use `flsa_status` to determine if an employee is eligible for overtime * By default the API returns only the current compensation - use the `include` parameter to return all compensations. * * scope: `compensations:read` */ async getCompensations( request: GetV1JobsJobIdCompensationsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(jobsAndCompensationsGetCompensations( this, request, options, )); } /** * Create a compensation * * @remarks * Compensations contain information on how much is paid out for a job. Jobs may have many compensations, but only one that is active. The current compensation is the one with the most recent `effective_date`. * * ### Prerequisites * Before calling this endpoint: * 1. A [job](ref:post-v1-jobs-job_id) must exist for the employee * * ### Webhooks * - `employee_job_compensation.created`: Fires when a compensation is successfully created * * scope: `compensations:write` */ async createCompensation( request: PostV1CompensationsCompensationIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(jobsAndCompensationsCreateCompensation( this, request, options, )); } /** * Get a compensation * * @remarks * Compensations contain information on how much is paid out for a job. Jobs may have many compensations, but only one that is active. The current compensation is the one with the most recent `effective_date`. * * scope: `compensations:read` */ async getCompensation( request: GetV1CompensationsCompensationIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(jobsAndCompensationsGetCompensation( this, request, options, )); } /** * Update a compensation * * @remarks * Compensations contain information on how much is paid out for a job. Jobs may have many compensations, but only one that is active. The current compensation is the one with the most recent `effective_date`. * * ### Webhooks * - `employee_job_compensation.updated`: Fires when a compensation is successfully updated * * scope: `compensations:write` */ async updateCompensation( request: PutV1CompensationsCompensationIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(jobsAndCompensationsUpdateCompensation( this, request, options, )); } /** * Delete a compensation * * @remarks * Compensations contain information on how much is paid out for a job. Jobs may have many compensations, but only one that is active. The current compensation is the one with the most recent `effective_date`. This endpoint deletes a compensation for a job that hasn't been processed on payroll. * * ### Webhooks * - `employee_job_compensation.destroyed`: Fires when a compensation is successfully deleted * * scope: `compensations:write` */ async deleteCompensation( request: DeleteV1CompensationsCompensationIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(jobsAndCompensationsDeleteCompensation( this, request, options, )); } }