Edits history of script submission #18738 for ' Update project (render)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Render = {
    	apiKey: string
    }
    /**
     * Update project
     * Update the details of a project.
    
    To update the details of a particular _environment_ in the project, instead use the [Update environment](https://api-docs.render.com/reference/update-environment) endpoint.
    
     */
    export async function main(auth: Render, projectId: string, body: { name?: string }) {
    	const url = new URL(`https://api.render.com/v1/projects/${projectId}`)
    
    	const response = await fetch(url, {
    		method: 'PATCH',
    		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.json()
    }
    

    Submitted by hugo697 235 days ago