Edits history of script submission #18216 for ' Delete organization api token (qovery)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Delete organization api token
     * Delete organization api token
     */
    export async function main(auth: RT.Qovery, organizationId: string, apiTokenId: string) {
    	const url = new URL(
    		`https://api.qovery.com/organization/${organizationId}/apiToken/${apiTokenId}`
    	)
    
    	const response = await fetch(url, {
    		method: 'DELETE',
    		headers: {
    			Authorization: 'Token ' + 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