Edits history of script submission #14152 for ' Get Aggregate Goal Info (bamboo_hr)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Get Aggregate Goal Info
     * Provides goal information, goal comments, and employees shared with goals or who have commented on the given goal.
     */
    export async function main(auth: RT.BambooHr, employeeId: string, goalId: string) {
    	const url = new URL(
    		`https://${auth.companyDomain}.bamboohr.com/api/v1/performance/employees/${employeeId}/goals/${goalId}/aggregate`
    	)
    
    	const response = await fetch(url, {
    		method: 'GET',
    		headers: {
    			Authorization: 'Basic ' + btoa(`${auth.apiKey}:x`)
    		},
    		body: undefined
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    

    Submitted by hugo697 235 days ago