/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { timeOffRequestsDeleteV1TimeOffRequestsTimeOffRequestUuid } from "../funcs/timeOffRequestsDeleteV1TimeOffRequestsTimeOffRequestUuid.js"; import { timeOffRequestsGetV1CompaniesCompanyUuidTimeOffBalances } from "../funcs/timeOffRequestsGetV1CompaniesCompanyUuidTimeOffBalances.js"; import { timeOffRequestsGetV1CompaniesCompanyUuidTimeOffRequests } from "../funcs/timeOffRequestsGetV1CompaniesCompanyUuidTimeOffRequests.js"; import { timeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuid } from "../funcs/timeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuid.js"; import { timeOffRequestsPostV1CompaniesCompanyUuidTimeOffAdminApprovedRequests } from "../funcs/timeOffRequestsPostV1CompaniesCompanyUuidTimeOffAdminApprovedRequests.js"; import { timeOffRequestsPostV1CompaniesCompanyUuidTimeOffRequests } from "../funcs/timeOffRequestsPostV1CompaniesCompanyUuidTimeOffRequests.js"; import { timeOffRequestsPostV1CompaniesCompanyUuidTimeOffRequestsPreview } from "../funcs/timeOffRequestsPostV1CompaniesCompanyUuidTimeOffRequestsPreview.js"; import { timeOffRequestsPutV1TimeOffRequestsTimeOffRequestUuidApprove } from "../funcs/timeOffRequestsPutV1TimeOffRequestsTimeOffRequestUuidApprove.js"; import { timeOffRequestsPutV1TimeOffRequestsTimeOffRequestUuidDecline } from "../funcs/timeOffRequestsPutV1TimeOffRequestsTimeOffRequestUuidDecline.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { DeleteV1TimeOffRequestsTimeOffRequestUuidRequest, DeleteV1TimeOffRequestsTimeOffRequestUuidResponse, } from "../models/operations/deletev1timeoffrequeststimeoffrequestuuid.js"; import { GetV1CompaniesCompanyUuidTimeOffBalancesRequest, GetV1CompaniesCompanyUuidTimeOffBalancesResponse, } from "../models/operations/getv1companiescompanyuuidtimeoffbalances.js"; import { GetV1CompaniesCompanyUuidTimeOffRequestsRequest, GetV1CompaniesCompanyUuidTimeOffRequestsResponse, } from "../models/operations/getv1companiescompanyuuidtimeoffrequests.js"; import { GetV1TimeOffRequestsTimeOffRequestUuidRequest, GetV1TimeOffRequestsTimeOffRequestUuidResponse, } from "../models/operations/getv1timeoffrequeststimeoffrequestuuid.js"; import { PostV1CompaniesCompanyUuidTimeOffAdminApprovedRequestsRequest, PostV1CompaniesCompanyUuidTimeOffAdminApprovedRequestsResponse, } from "../models/operations/postv1companiescompanyuuidtimeoffadminapprovedrequests.js"; import { PostV1CompaniesCompanyUuidTimeOffRequestsRequest, PostV1CompaniesCompanyUuidTimeOffRequestsResponse, } from "../models/operations/postv1companiescompanyuuidtimeoffrequests.js"; import { PostV1CompaniesCompanyUuidTimeOffRequestsPreviewRequest, PostV1CompaniesCompanyUuidTimeOffRequestsPreviewResponse, } from "../models/operations/postv1companiescompanyuuidtimeoffrequestspreview.js"; import { PutV1TimeOffRequestsTimeOffRequestUuidApproveRequest, PutV1TimeOffRequestsTimeOffRequestUuidApproveResponse, } from "../models/operations/putv1timeoffrequeststimeoffrequestuuidapprove.js"; import { PutV1TimeOffRequestsTimeOffRequestUuidDeclineRequest, PutV1TimeOffRequestsTimeOffRequestUuidDeclineResponse, } from "../models/operations/putv1timeoffrequeststimeoffrequestuuiddecline.js"; import { unwrapAsync } from "../types/fp.js"; export class TimeOffRequests extends ClientSDK { /** * Create an admin-approved time off request * * @remarks * Create a pre-approved time off request on behalf of an employee (admin or system initiated). * The request is always created with approved status. * * scope: `time_off_requests:manage` */ async postV1CompaniesCompanyUuidTimeOffAdminApprovedRequests( request: PostV1CompaniesCompanyUuidTimeOffAdminApprovedRequestsRequest, options?: RequestOptions, ): Promise { return unwrapAsync( timeOffRequestsPostV1CompaniesCompanyUuidTimeOffAdminApprovedRequests( this, request, options, ), ); } /** * Get time off balances for a company * * @remarks * Get time off balances for all employees in a company * * scope: `time_off_requests:read` */ async getV1CompaniesCompanyUuidTimeOffBalances( request: GetV1CompaniesCompanyUuidTimeOffBalancesRequest, options?: RequestOptions, ): Promise { return unwrapAsync(timeOffRequestsGetV1CompaniesCompanyUuidTimeOffBalances( this, request, options, )); } /** * List time off requests for a company * * @remarks * Get all time off requests for a company. Supports filtering by status, employee, and date ranges. * * Possible statuses: * - `pending` — awaiting approval * - `approved` — approved by an admin but not yet processed in a payroll * - `declined` — declined by an admin * - `consumed` — processed in a completed payroll * * Allowed values for `status`: pending, approved, declined, consumed. * * scope: `time_off_requests:read` */ async getV1CompaniesCompanyUuidTimeOffRequests( request: GetV1CompaniesCompanyUuidTimeOffRequestsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(timeOffRequestsGetV1CompaniesCompanyUuidTimeOffRequests( this, request, options, )); } /** * Create a time off request * * @remarks * Create a time off request for an employee * * scope: `time_off_requests:write` */ async postV1CompaniesCompanyUuidTimeOffRequests( request: PostV1CompaniesCompanyUuidTimeOffRequestsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(timeOffRequestsPostV1CompaniesCompanyUuidTimeOffRequests( this, request, options, )); } /** * Preview a time off request * * @remarks * Preview a time off request to see balance impact before creating * * scope: `time_off_requests:read` */ async postV1CompaniesCompanyUuidTimeOffRequestsPreview( request: PostV1CompaniesCompanyUuidTimeOffRequestsPreviewRequest, options?: RequestOptions, ): Promise { return unwrapAsync( timeOffRequestsPostV1CompaniesCompanyUuidTimeOffRequestsPreview( this, request, options, ), ); } /** * Get a time off request * * @remarks * Get a single time off request by UUID * * scope: `time_off_requests:read` */ async getV1TimeOffRequestsTimeOffRequestUuid( request: GetV1TimeOffRequestsTimeOffRequestUuidRequest, options?: RequestOptions, ): Promise { return unwrapAsync(timeOffRequestsGetV1TimeOffRequestsTimeOffRequestUuid( this, request, options, )); } /** * Delete a time off request * * @remarks * Delete a time off request * * scope: `time_off_requests:write` */ async deleteV1TimeOffRequestsTimeOffRequestUuid( request: DeleteV1TimeOffRequestsTimeOffRequestUuidRequest, options?: RequestOptions, ): Promise { return unwrapAsync(timeOffRequestsDeleteV1TimeOffRequestsTimeOffRequestUuid( this, request, options, )); } /** * Approve a time off request * * @remarks * Approve a pending time off request. Optionally override the dates and hours. * * Only requests with a `pending` status can be approved. Attempting to approve a request that has already been `declined` or `consumed` will fail with a 422 error. * * scope: `time_off_requests:manage` */ async putV1TimeOffRequestsTimeOffRequestUuidApprove( request: PutV1TimeOffRequestsTimeOffRequestUuidApproveRequest, options?: RequestOptions, ): Promise { return unwrapAsync( timeOffRequestsPutV1TimeOffRequestsTimeOffRequestUuidApprove( this, request, options, ), ); } /** * Decline a time off request * * @remarks * Decline a pending or approved time off request. Requires an employer_note. * * scope: `time_off_requests:manage` */ async putV1TimeOffRequestsTimeOffRequestUuidDecline( request: PutV1TimeOffRequestsTimeOffRequestUuidDeclineRequest, options?: RequestOptions, ): Promise { return unwrapAsync( timeOffRequestsPutV1TimeOffRequestsTimeOffRequestUuidDecline( this, request, options, ), ); } }