//native
/**
* Update 401k plan
* Update 401k plan
**Token scopes**: `benefits:write`
*/
export async function main(auth: RT.Deel, id: string, plan_id: string, body: Body) {
const url = new URL(
`https://api.letsdeel.com/rest/v2/benefits/legal-entities/${id}/401k/plans/${plan_id}`
)
const response = await fetch(url, {
method: 'PUT',
headers: {
'Content-Type': 'application/json',
Authorization: 'Bearer ' + auth.apiKey
},
body: JSON.stringify(body)
})
if (!response.ok) {
const text = await response.text()
throw new Error(`${response.status} ${text}`)
}
return await response.json()
}
/* eslint-disable */
/**
* This file was automatically generated by json-schema-to-typescript.
* DO NOT MODIFY IT BY HAND. Instead, modify the source JSONSchema file,
* and run json-schema-to-typescript to regenerate this file.
*/
/**
* Schema for the 401K Guideline Plan request body.
*/
export interface Body {
/**
* Name of the 401K plan.
*/
name?: string
/**
* Object containing additional information about the 401K plan.
*/
details?: {
/**
* A key-value pair providing additional details about the plan.
*/
key?: string
[k: string]: unknown
}
/**
* Start date of the plan.
*/
start_date?: string
/**
* Type of contribution for the 401K plan.
*/
contribution_type?:
| 'NEC_PERCENTAGE'
| 'NEC_FIXED_AMOUNT'
| 'PERCENTAGE'
| 'FIXED_AMOUNT'
| 'MATCH'
/**
* Value of the contribution if type is percent or amount.
*/
contribution_value?: number
/**
* Array of objects containing limits and rates for match rate contribution type.
*/
contribution_value_for_match_rate?: {
/**
* Rate of matching contribution.
*/
rate: number
/**
* Limit up to which the match rate is applicable.
*/
limit: number
[k: string]: unknown
}[]
[k: string]: unknown
}
Submitted by hugo697 235 days ago