Edits history of script submission #6089 for ' Find User (todoist)'

  • bun
    One script reply has been approved by the moderators
    Ap­pro­ved
    type Todoist = {
    	Token: string
    }
    
    interface Response {
    	collaborators: {
    		email: string
    		full_name: string
    		id: string
    		image_id: null
    		timezone: string
    	}[]
    }
    
    export async function main(resource: Todoist, email: string) {
    	const response = await fetch('https://api.todoist.com/sync/v9/sync', {
    		method: 'POST',
    		headers: {
    			Authorization: `Bearer ${resource.Token}`,
    			'Content-Type': 'application/x-www-form-urlencoded'
    		},
    		body: new URLSearchParams({
    			sync_token: '*',
    			resource_types: '["all"]'
    		})
    	})
    	const data = (await response.json()) as Response
    	return data.collaborators.find((x) => x.email === email)
    }
    

    Submitted by hugo697 399 days ago

  • bun
    type Todoist = {
    	Token: string
    }
    
    interface Response {
    	collaborators: {
    		email: string
    		full_name: string
    		id: string
    		image_id: null
    		timezone: string
    	}[]
    }
    
    export async function main(resource: Todoist, email: string) {
    	const response = await fetch('https://api.todoist.com/sync/v9/sync', {
    		method: 'POST',
    		headers: {
    			Authorization: `Bearer ${resource.Token}`,
    			'Content-Type': 'application/x-www-form-urlencoded'
    		},
    		body: new URLSearchParams({
    			sync_token: '*',
    			resource_types: '["all"]'
    		})
    	})
    	const data = (await response.json()) as Response
    	return data.collaborators.find((x) => x.email === email)
    }
    

    Submitted by hugo697 764 days ago