Edits history of script submission #8947 for ' Find Member (ghostcms)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    import GhostAdminAPI from '@tryghost/admin-api'
    
    type Ghostcms = {
    	apiKey: string
    	apiUrl: string
    }
    
    export async function main(resource: Ghostcms, email: string) {
    	const apiClient = new GhostAdminAPI({
    		url: resource.apiUrl,
    		version: 'v5.87',
    		key: resource.apiKey
    	})
    
    	const response = await apiClient.members.browse()
    
    	const filteredResponse = response.find((member) => member.email === email)
    
    	return filteredResponse
    }
    

    Submitted by hugo697 652 days ago