Edits history of script submission #14218 for ' Update Goal (bamboo_hr)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Update Goal
     * Update a goal. This version will not update a goal to contain milestones, that functionality is added in version 1.1
     */
    export async function main(
    	auth: RT.BambooHr,
    	employeeId: string,
    	goalId: string,
    	body: EmployeeGoal
    ) {
    	const url = new URL(
    		`https://${auth.companyDomain}.bamboohr.com/api/v1/performance/employees/${employeeId}/goals/${goalId}`
    	)
    
    	const response = await fetch(url, {
    		method: 'PUT',
    		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 EmployeeGoal {
    	/**
    	 * A unique identifier for the record. Use this ID to reference this goal.
    	 */
    	id: number
    	/**
    	 * The goal title.
    	 */
    	title: string
    	/**
    	 * The goal description.
    	 */
    	description?: string
    	/**
    	 * The goal completion percentage (0 - 100).
    	 */
    	percentComplete?: number
    	/**
    	 * The option ID that aligns with this goal.
    	 */
    	alignsWithOptionId?: string
    	/**
    	 * Employee IDs of employees with whom the goal is shared. All goal owners are considered "shared with".
    	 */
    	sharedWithEmployeeIds?: number[]
    	/**
    	 * The goal due date in YYYY-mm-dd format.
    	 */
    	dueDate?: string
    	/**
    	 * The date the goal was completed.
    	 */
    	completionDate?: number
    	[k: string]: unknown
    }
    

    Submitted by hugo697 235 days ago