Edits history of script submission #17265 for ' Retrieve a screen (mezmo)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Retrieve a screen
     * Retrieve a specific screen
     */
    export async function main(auth: RT.Mezmo, id: string) {
    	const url = new URL(`https://api.mezmo.com/v1/config/screen/${id}`)
    
    	const response = await fetch(url, {
    		method: 'GET',
    		headers: {
    			Authorization: 'Token ' + auth.apiKey
    		},
    		body: undefined
    	})
    	if (!response.ok) {
    		const text = await response.text()
    		throw new Error(`${response.status} ${text}`)
    	}
    	return await response.json()
    }
    

    Submitted by hugo697 235 days ago