Edits history of script submission #9471 for ' Clone values list (botify)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    type Botify = {
    	token: string
    }
    /**
     * Clone values list
     * Clone all keyword groups of the current project to another one.  This endpoint is a little more general (for further use). That's why you will see a 'type' field (with a default value of: 'keywords').
     */
    export async function main(auth: Botify, username: string, project_slug: string) {
    	const url = new URL(
    		`https://api.botify.com/projects/${username}/${project_slug}/values_list/clone`
    	)
    
    	const response = await fetch(url, {
    		method: 'POST',
    		headers: {
    			Authorization: 'Token ' + auth.token
    		},
    		body: undefined
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.text()
    }
    

    Submitted by hugo697 566 days ago