Edits history of script submission #17261 for ' Lists all members (mezmo)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    //native
    /**
     * Lists all members
     * Retrieves all of the current members in an organization and returns their email, role, and groups.
     */
    export async function main(auth: RT.Mezmo) {
    	const url = new URL(`https://api.mezmo.com/v1/config/members`)
    
    	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