//native
/**
* Create Goal
* Create a new goal for an employee.
*/
export async function main(auth: RT.BambooHr, employeeId: string, body: Body) {
const url = new URL(
`https://${auth.companyDomain}.bamboohr.com/api/v1/performance/employees/${employeeId}/goals`
)
const response = await fetch(url, {
method: 'POST',
headers: {
'Content-Type': 'application/json',
Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
},
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.
*/
export interface Body {
/**
* The title of the goal
*/
title: string
/**
* A detailed description of the goal
*/
description?: string
/**
* The due date for the goal in YYYY-MM-DD format
*/
dueDate: string
/**
* The percentage of completion for the goal (0-100)
*/
percentComplete: number
/**
* The date when the goal was completed in YYYY-MM-DD format. Required when percentComplete is 100.
*/
completionDate?: string | null
/**
* List of employee IDs with whom the goal is shared. Must include the employee ID of the goal owner.
*/
sharedWithEmployeeIds: number[]
/**
* ID of the option this goal aligns with
*/
alignsWithOptionId?: number | null
/**
* List of milestones for this goal
*/
milestones?:
| {
/**
* The title of the milestone
*/
title?: string
[k: string]: unknown
}[]
| null
[k: string]: unknown
}
Submitted by hugo697 235 days ago