Edits history of script submission #15350 for ' Acknowledge a compliance document (deel)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Acknowledge a compliance document
     * API endpoint to submit consent for compliance documents that require acknowledgement.
     **Token scopes**: `worker:write`
     */
    export async function main(auth: RT.Deel, document_id: string) {
    	const url = new URL(
    		`https://api.letsdeel.com/rest/v2/eor/workers/compliance-documents/${document_id}/acknowledgement`
    	)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			Authorization: 'Bearer ' + auth.apiKey
    		},
    		body: undefined
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.text()
    }
    

    Submitted by hugo697 235 days ago