/* * Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT. */ import { companyBenefitsCreate } from "../funcs/companyBenefitsCreate.js"; import { companyBenefitsDelete } from "../funcs/companyBenefitsDelete.js"; import { companyBenefitsGet } from "../funcs/companyBenefitsGet.js"; import { companyBenefitsGetAll } from "../funcs/companyBenefitsGetAll.js"; import { companyBenefitsGetEmployeeBenefits } from "../funcs/companyBenefitsGetEmployeeBenefits.js"; import { companyBenefitsGetRequirements } from "../funcs/companyBenefitsGetRequirements.js"; import { companyBenefitsGetSummary } from "../funcs/companyBenefitsGetSummary.js"; import { companyBenefitsGetSupported } from "../funcs/companyBenefitsGetSupported.js"; import { companyBenefitsGetV1CompanyBenefitsCompanyBenefitIdContributionExclusions } from "../funcs/companyBenefitsGetV1CompanyBenefitsCompanyBenefitIdContributionExclusions.js"; import { companyBenefitsList } from "../funcs/companyBenefitsList.js"; import { companyBenefitsPutV1CompanyBenefitsCompanyBenefitIdContributionExclusions } from "../funcs/companyBenefitsPutV1CompanyBenefitsCompanyBenefitIdContributionExclusions.js"; import { companyBenefitsUpdate } from "../funcs/companyBenefitsUpdate.js"; import { companyBenefitsUpdateEmployeeBenefits } from "../funcs/companyBenefitsUpdateEmployeeBenefits.js"; import { ClientSDK, RequestOptions } from "../lib/sdks.js"; import { DeleteV1CompanyBenefitsCompanyBenefitIdRequest, DeleteV1CompanyBenefitsCompanyBenefitIdResponse, } from "../models/operations/deletev1companybenefitscompanybenefitid.js"; import { GetV1BenefitsRequest, GetV1BenefitsResponse, } from "../models/operations/getv1benefits.js"; import { GetV1BenefitsBenefitIdRequest, GetV1BenefitsBenefitIdResponse, } from "../models/operations/getv1benefitsbenefitid.js"; import { GetV1BenefitsBenefitsIdRequirementsRequest, GetV1BenefitsBenefitsIdRequirementsResponse, } from "../models/operations/getv1benefitsbenefitsidrequirements.js"; import { GetV1BenefitsCompanyBenefitIdSummaryRequest, GetV1BenefitsCompanyBenefitIdSummaryResponse, } from "../models/operations/getv1benefitscompanybenefitidsummary.js"; import { GetV1CompaniesCompanyIdCompanyBenefitsRequest, GetV1CompaniesCompanyIdCompanyBenefitsResponse, } from "../models/operations/getv1companiescompanyidcompanybenefits.js"; import { GetV1CompanyBenefitsCompanyBenefitIdRequest, GetV1CompanyBenefitsCompanyBenefitIdResponse, } from "../models/operations/getv1companybenefitscompanybenefitid.js"; import { GetV1CompanyBenefitsCompanyBenefitIdContributionExclusionsRequest, GetV1CompanyBenefitsCompanyBenefitIdContributionExclusionsResponse, } from "../models/operations/getv1companybenefitscompanybenefitidcontributionexclusions.js"; import { GetV1CompanyBenefitsCompanyBenefitIdEmployeeBenefitsRequest, GetV1CompanyBenefitsCompanyBenefitIdEmployeeBenefitsResponse, } from "../models/operations/getv1companybenefitscompanybenefitidemployeebenefits.js"; import { PostV1CompaniesCompanyIdCompanyBenefitsRequest, PostV1CompaniesCompanyIdCompanyBenefitsResponse, } from "../models/operations/postv1companiescompanyidcompanybenefits.js"; import { PutV1CompanyBenefitsCompanyBenefitIdRequest, PutV1CompanyBenefitsCompanyBenefitIdResponse, } from "../models/operations/putv1companybenefitscompanybenefitid.js"; import { PutV1CompanyBenefitsCompanyBenefitIdContributionExclusionsRequest, PutV1CompanyBenefitsCompanyBenefitIdContributionExclusionsResponse, } from "../models/operations/putv1companybenefitscompanybenefitidcontributionexclusions.js"; import { PutV1CompanyBenefitsCompanyBenefitIdEmployeeBenefitsRequest, PutV1CompanyBenefitsCompanyBenefitIdEmployeeBenefitsResponse, } from "../models/operations/putv1companybenefitscompanybenefitidemployeebenefits.js"; import { unwrapAsync } from "../types/fp.js"; export class CompanyBenefits extends ClientSDK { /** * Get benefits for a company * * @remarks * Company benefits represent the benefits that a company is offering to employees. This ties together a particular supported benefit with the company-specific information for the offering of that benefit. * * Note that company benefits can be deactivated only when no employees are enrolled. * * Benefits containing PHI are only visible to applications with the `company_benefits:read:phi` scope. * * scope: `company_benefits:read` */ async list( request: GetV1CompaniesCompanyIdCompanyBenefitsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(companyBenefitsList( this, request, options, )); } /** * Create a company benefit * * @remarks * Company benefits represent the benefits that a company is offering to employees. This ties together a particular supported benefit with the company-specific information for the offering of that benefit. * * Note that company benefits can be deactivated only when no employees are enrolled. * * When the application has the `company_benefits:write:benefit_type_limited` data scope, the application can only create company benefits for benefit types that are permitted for the application. * * scope: `company_benefits:write` */ async create( request: PostV1CompaniesCompanyIdCompanyBenefitsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(companyBenefitsCreate( this, request, options, )); } /** * Get a company benefit * * @remarks * Company benefits represent the benefits that a company is offering to employees. This ties together a particular supported benefit with the company-specific information for the offering of that benefit. * * Note that company benefits can be deactivated only when no employees are enrolled. * * When with_employee_benefits parameter with true value is passed, employee_benefits:read scope is required to return employee_benefits. * * scope: `company_benefits:read` */ async get( request: GetV1CompanyBenefitsCompanyBenefitIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(companyBenefitsGet( this, request, options, )); } /** * Update a company benefit * * @remarks * Company benefits represent the benefits that a company is offering to employees. This ties together a particular supported benefit with the company-specific information for the offering of that benefit. * * Note that company benefits can be deactivated only when no employees are enrolled. * * When the application has the `company_benefits:write:benefit_type_limited` data scope, the application can only update company benefits for benefit types that are permitted for the application. * * scope: `company_benefits:write` */ async update( request: PutV1CompanyBenefitsCompanyBenefitIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(companyBenefitsUpdate( this, request, options, )); } /** * Delete a company benefit * * @remarks * The following must be true in order to delete a company benefit * * - There are no employee benefits associated with the company benefit * - There are no payroll items associated with the company benefit * - The benefit is not managed by a Partner or by Gusto (type must be 'External') * * When the application has the `company_benefits:write:benefit_type_limited` data scope, the application can only delete company benefits for benefit types that are permitted for the application. * * scope: `company_benefits:write` */ async delete( request: DeleteV1CompanyBenefitsCompanyBenefitIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(companyBenefitsDelete( this, request, options, )); } /** * Get all supported benefits * * @remarks * Returns all benefits supported by Gusto. The benefit object in Gusto contains high level information about a particular benefit type and its tax considerations. When companies choose to offer a benefit, they are creating a Company Benefit object associated with a particular benefit. * * scope: `benefits:read` */ async getAll( request: GetV1BenefitsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(companyBenefitsGetAll( this, request, options, )); } /** * Get a supported benefit * * @remarks * Returns a benefit supported by Gusto. The benefit object in Gusto contains high level information about a particular benefit type and its tax considerations. When companies choose to offer a benefit, they are creating a Company Benefit object associated with a particular benefit. * * scope: `benefits:read` */ async getSupported( request: GetV1BenefitsBenefitIdRequest, options?: RequestOptions, ): Promise { return unwrapAsync(companyBenefitsGetSupported( this, request, options, )); } /** * Get company benefit summary by company benefit id. * * @remarks * Returns summary benefit data for the requested company benefit id. * * Benefits containing PHI are only visible to applications with the `company_benefits:read:phi` scope. * * scope: `company_benefits:read` */ async getSummary( request: GetV1BenefitsCompanyBenefitIdSummaryRequest, options?: RequestOptions, ): Promise { return unwrapAsync(companyBenefitsGetSummary( this, request, options, )); } /** * Get all employee benefits for a company benefit * * @remarks * Employee benefits represent an employee enrolled in a particular company benefit. It includes information specific to that employee's enrollment. * * Returns an array of all employee benefits enrolled for this company benefit. * * Benefits containing PHI are only visible to applications with the `employee_benefits:read:phi` scope. * * scope: `employee_benefits:read` */ async getEmployeeBenefits( request: GetV1CompanyBenefitsCompanyBenefitIdEmployeeBenefitsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(companyBenefitsGetEmployeeBenefits( this, request, options, )); } /** * Bulk update employee benefits for a company benefit * * @remarks * Employee benefits represent an employee enrolled in a particular company benefit. It includes information specific to that employee's enrollment. * * Create or update(if the employee is already enrolled in the company benefit previously) an employee benefit for the company benefit. * * Benefits containing PHI are only visible to applications with the `employee_benefits:read:phi` scope. * * When the application has the `employee_benefits:write:benefit_type_limited` data scope, the application can only create or update employee benefits for benefit types that are permitted for the application. * * scope: `employee_benefits:write` */ async updateEmployeeBenefits( request: PutV1CompanyBenefitsCompanyBenefitIdEmployeeBenefitsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(companyBenefitsUpdateEmployeeBenefits( this, request, options, )); } /** * Get benefit fields requirements by benefit type * * @remarks * Returns the field requirements for a given benefit type. * * scope: `benefits:read` */ async getRequirements( request: GetV1BenefitsBenefitsIdRequirementsRequest, options?: RequestOptions, ): Promise { return unwrapAsync(companyBenefitsGetRequirements( this, request, options, )); } /** * Get contribution exclusions for a company benefit * * @remarks * Returns all contributions for a given company benefit and whether they are excluded or not. * * Currently this endpoint only works for 401-k and Roth 401-k benefit types. * * scope: `company_benefits:read` */ async getV1CompanyBenefitsCompanyBenefitIdContributionExclusions( request: GetV1CompanyBenefitsCompanyBenefitIdContributionExclusionsRequest, options?: RequestOptions, ): Promise< GetV1CompanyBenefitsCompanyBenefitIdContributionExclusionsResponse > { return unwrapAsync( companyBenefitsGetV1CompanyBenefitsCompanyBenefitIdContributionExclusions( this, request, options, ), ); } /** * Update contribution exclusions for a company benefit * * @remarks * Updates contribution exclusions for a given company benefit. * * Currently this endpoint only works for 401-k and Roth 401-k benefit types. * * scope: `company_benefits:write` */ async putV1CompanyBenefitsCompanyBenefitIdContributionExclusions( request: PutV1CompanyBenefitsCompanyBenefitIdContributionExclusionsRequest, options?: RequestOptions, ): Promise< PutV1CompanyBenefitsCompanyBenefitIdContributionExclusionsResponse > { return unwrapAsync( companyBenefitsPutV1CompanyBenefitsCompanyBenefitIdContributionExclusions( this, request, options, ), ); } }