//native
/**
* Apply changes to positions.
* Apply add, edit, and delete operations to profiles.
**Token scopes**: `profile:write`
*/
export async function main(auth: RT.Deel, body: Body) {
const url = new URL(`https://api.letsdeel.com/rest/v2/hris/positions/apply_changes`)
const response = await fetch(url, {
method: 'POST',
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.text()
}
/* 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.
*/
export interface Body {
data?: {
add?: {
/**
* Id of the role to be assigned to the position.
*/
role_id?: string
/**
* Id of the team to be assigned to the position.
*/
team_id: string
/**
* Flag to indicate if the position is supportive.
*/
is_supportive?: boolean
[k: string]: unknown
}[]
edit?: {
/**
* Id of the position to be edited.
*/
id: string
/**
* Id of the role to be assigned to the position.
*/
role_id?: string
/**
* Flag to indicate if the position is supportive.
*/
is_supportive?: boolean
[k: string]: unknown
}[]
delete?: {
/**
* Id of the position to be deleted.
*/
id: string
[k: string]: unknown
}[]
/**
* Id of the profile to which the positions belong.
*/
profile_id: string
[k: string]: unknown
}
[k: string]: unknown
}
Submitted by hugo697 235 days ago